eloquent sync code example
Example 1: laravel detach
// Detach a single role from the user...
$user->roles()->detach($roleId);
// Detach all roles from the user...
$user->roles()->detach();
Example 2: laravel eloquent associate
$account = App\Account::find(10);
$user->account()->associate($account);
$user->save();