$documents * Associated documents of the category. */ class DocumentCategory extends Model implements TranslatableModel { use ActivityLog; use HasFactory; use HasCache; use HasTranslations; use SoftDeletes; /** * The attributes that are mass assignable. * * @var list */ protected $fillable = [ 'name', 'slug' ]; /** * The translatable columns. * * @var list */ public $translatable = [ 'name', 'slug' ]; // * RELATIONSHIPS /** * Associated documents of the category. * * @return \Illuminate\Database\Eloquent\Relations\MorphToMany */ public function documents(): \Illuminate\Database\Eloquent\Relations\MorphToMany { return $this->morphToMany( Document::class, 'documentable', 'documentables', 'documentable_id', 'document_id' ); } }