1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace App\Repositories\Models\Inform;
- use App\Repositories\Models\Model;
- use Carbon\Carbon;
- use Prettus\Repository\Contracts\Transformable;
- use Prettus\Repository\Traits\TransformableTrait;
- /**
- * Class UserMessage.
- *
- * @package namespace App\Repositories\Models\Inform;
- */
- class UserMessage extends Model implements Transformable
- {
- use TransformableTrait;
- protected $table = 'inform_messages';
- protected $appends = ['created_at_text'];
- /**
- * The attributes that are mass assignable.
- *
- * @var array
- */
- protected $guarded = [];
- protected static function booted()
- {
- self::language();
- }
- public function information()
- {
- return $this->belongsTo(Information::class);
- }
- public function category()
- {
- return $this->belongsTo(Category::class);
- }
- public function getCreatedAtTextAttribute()
- {
- return Carbon::parse($this->attributes['created_at'])->diffForHumans();
- }
- }
|