Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel model sync

//Single
$user->roles()->sync([1,2,3]);

//With attributes
$user->roles()->sync([ 
    1 => ['expires' => true],
    2 => ['expires' => false],
    ...
]);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #model #sync
ADD COMMENT
Topic
Name
3+9 =