1// Detach a single role from the user...
2$user->roles()->detach($roleId);
3
4// Detach all roles from the user...
5$user->roles()->detach();
1//id for single
2$user->reasons->attach($reasonId);
3
4//array for multiple
5$user->reasons->attach($reasonIds);
6
7$user->save();
1$movies = Movie::whereHas('director', function($q) {
2 $q->where('name', 'great');
3})->get();
4