Render Relation List/Form with trashed datas
2
Sometimes, you have a model with related datas but those datas have softDelete enabled. And when you try to access the parent model, you may encounter an error due to some partials in your model form or list.
To avoid getting this error, you need to configure your relation to get the data with trashed.
Go to your parent model, and change your relation like this :
public $belongsTo = [
'relationName' => [
\Author\Plugin\Models\YourRelationModel::class,
'scope'=>'withTrashed'
],
];
and all works again.
There are no comments yet
Be the first one to comment