Many To Many Polymorphic Relations (Model Structure)
https://viblo.asia/p/eloquent-relationships-in-laravel-phan-2-aRBvXWEokWE
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
/**
* Get all of the tags for the post.
*/
public function tags()
{
return $this->morphToMany('App\Tag', 'taggable');
}
}PreviousMany To Many Polymorphic Relations (Table Structure)NextMany To Many Polymorphic Relations (Defining The Inverse Of The Relationship)
Last updated