Answers for "attach many to many laravel"

PHP
0

latavel attach method

$user->roles()->attach($roleId, ['expires' => $expires]);
Posted by: Guest on December-30-2020
0

laravel add many to many

You should pass an array of user IDs to the attach() method.

For convenience, attach and detach also accept arrays of IDs as input

Change your code to:

$team = AppTeam::findOrFail($request->team_id);
$team->teamMembers()->attach($request->members_id);
Posted by: Guest on January-06-2022

Code answers related to "attach many to many laravel"

Browse Popular Code Answers by Language