Answers for "adding soft delete in pivot table"

0

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()]);
Posted by: Guest on November-06-2020

Browse Popular Code Answers by Language