'int', 'favoritable_id' => 'int' ]; protected $fillable = [ 'user_id', 'favoritable_id', 'favoritable_type' ]; public function user() { return $this->belongsTo(User::class); } public function favorite() { return $this->belongsTo(Favorite::class, 'favoritable_id'); } public function favorites() { return $this->hasMany(Favorite::class, 'favoritable_id'); } }