api code global jain
This commit is contained in:
40
app/Models/PostMention.php
Normal file
40
app/Models/PostMention.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user