laravel many to many softdelete code example
Example: adding soft delete in pivot table
public function groups() {
return $this->belongsToMany(Group::class)
->wherePivot('deleted_at', null)
->withTimestamps();
}
$user->groups
->updateExistingPivot($groupId, ['deleted_at' => Carbon\Carbon::now()]);