|
|
@ -16,6 +16,7 @@ class Post extends Model |
|
|
|
'contact', 'openlink', 'embed', |
|
|
|
'links', 'files', 'pictures', 'picture', |
|
|
|
'attachment']; |
|
|
|
public $withCount = ['userViews']; |
|
|
|
|
|
|
|
private $titleLimit = 200; |
|
|
|
private $changed = false; // Detect if the set post was different from the cache
|
|
|
@ -51,6 +52,11 @@ class Post extends Model |
|
|
|
->where('node', $this->node); |
|
|
|
} |
|
|
|
|
|
|
|
public function userViews() |
|
|
|
{ |
|
|
|
return $this->belongsToMany(User::class, 'post_user_views', 'post_id', 'user_id')->withTimestamps(); |
|
|
|
} |
|
|
|
|
|
|
|
public function likes() |
|
|
|
{ |
|
|
|
return $this->hasMany('App\Post', 'parent_id', 'id') |
|
|
|