laravel 8 attach() code example
Example: laravel attach
//id for single
$user->reasons->attach($reasonId);
//array for multiple
$user->reasons->attach($reasonIds);
$user->save();
//id for single
$user->reasons->attach($reasonId);
//array for multiple
$user->reasons->attach($reasonIds);
$user->save();