src/Controllers/AdministratorsController.php
public function syncAdministratorCategories($id, Request $request)
    {
        $form_cats = ($request->input('administrator_cats') == null) ? [] : $request->input('administrator_cats');
        $administrator = Agent::find($id);
        $administrator->categories()->sync($form_cats);
    }
public function syncAdministratorCategories($id, Request $request)
    {
        $form_cats = ($request->input('administrator_cats') == null) ? [] : $request->input('administrator_cats');
        $administrator = Agent::find($id);
        $administrator->categories()->sync($form_cats);
    }
public function syncAdministratorCategories ( $ id , Request $ request ) { $ form_cats = ( $ request -> input ( 'administrator_cats' ) == null ) ? [ ] : $ request -> input ( 'administrator_cats' ) ; $ administrator = Agent :: find ( $ id ) ; $ administrator -> categories ( ) -> sync ( $ form_cats ) ; }
Sync Administrator categories with the selected categories got from update form.

@param $id
@param Request $request
Sync Administrator categories with the selected categories got from update form .