Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work on sync() #1

Open
supanida opened this issue May 10, 2018 · 1 comment
Open

Doesn't work on sync() #1

supanida opened this issue May 10, 2018 · 1 comment

Comments

@supanida
Copy link

The intermediate pivot table doesn't do soft delete when using sync(). For example(),
public function dept()
{
return $this->belongsToMany('App\Dept', 'user_dept', 'user_id', 'dept_id');
}

User is in many to many relation on Dept. Both User and Dept use SoftDeletes, PivotSoftDeletes;
$user = User::find(1);
$user->dept()->sync([3, 2, 8, 4]); // --> this will attach dept id, 3, 2, 8, 4 to the pivot table for user id 1
$user->dept()->sync([3, 2, 9, 4]); // --> this should put delete_at for dept id 8 and add row with dept id 9 in the pivot table

But after I run it, it instead deleted dept id 8 and add dept id 9 in the pivot table.

Note: I use laravel 5.6

@rogervila
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants