41 lines
819 B
PHP
41 lines
819 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use App\Models\Traits\PostMention\Relationships\PostMentionRelationships;
|
|
|
|
class PostMention extends Model
|
|
{
|
|
use HasFactory, PostMentionRelationships;
|
|
|
|
/*
|
|
* Pseudo-fields that get added to the models when the models are exported to json.
|
|
*/
|
|
protected $appends = ['created_ago'];
|
|
|
|
/**
|
|
* Attributes that are mass assignable
|
|
*
|
|
* @var array
|
|
*/
|
|
|
|
protected $fillable = [
|
|
'post_id',
|
|
'mention_id',
|
|
'type'
|
|
];
|
|
|
|
protected $guarded = [
|
|
'id'
|
|
];
|
|
|
|
/**
|
|
* Returns model in days since created_at.
|
|
*/
|
|
public function getCreatedAgoAttribute() {
|
|
return $this->created_at->diffForHumans();
|
|
}
|
|
}
|