user->type; } protected $casts = [ 'is_paid' => 'integer', 'is_ads' => 'boolean', 'status' => StatusEnum::class, ]; protected static function boot() { parent::boot(); self::observe(FeedObserver::class); } public function feedable() { return $this->morphTo(); } public function tags() { return $this->belongsToMany(Tag::class, 'feed_tags'); } public function comments() { return $this->hasMany(Comment::class); } public function views() { return $this->belongsToMany(User::class, 'users_feeds_view'); } public function likes() { return $this->belongsToMany(User::class, 'users_feeds_like'); } public function user() { return $this->belongsTo(User::class); } public function who_boughts() { return $this->belongsToMany(User::class, 'user_feed_purchase')->withPivot('amount')->withTimestamps(); } public function complaints() { return $this->hasMany(Complaint::class); } }