Files
Global-Jain/app/Models/PostMention.php
2025-11-05 10:37:10 +05:30

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();
}
}