Answers for "laravel sync vs syncwithoutdetaching"

PHP
0

laravel syncwithoutdetaching

$user->roles()->syncWithoutDetaching([1, 2, 3]);
Posted by: Guest on November-11-2020
1

laravel attach

//id for single
$user->reasons->attach($reasonId);

//array for multiple
$user->reasons->attach($reasonIds);

$user->save();
Posted by: Guest on July-10-2020

Browse Popular Code Answers by Language