-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
Hello,
I got this model:
<?php
namespace App;
[...]
class Item extends Model
{
use Cloneable;
protected $cloneable_relations = ['category', 'children'];
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function category()
{
return $this->belongsTo(Category::class);
}
/**
* @return \Illuminate\Database\Eloquent\Relations\belongsToMany
*/
public function children(): belongsToMany
{
return $this->belongsToMany(Child::class)
->withPivot('value')->withTimestamps();
}
}
Now if I do Item::first()->duplicate(), the category is cloned as new row - but the children are not. I understand the docs that tell me that this is not possible on many to many: But it would be nice if it would be optional. Any ideas on that?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels