src/Controllers/AgentsController.php
public function removeAgent($id)
    {
        $agent = Agent::find($id);
        $agent->ticketit_agent = false;
        $agent->save();

        // Remove him from tickets categories as well
        if (version_compare(app()->version(), '5.2.0', '>=')) {
            $agent_cats = $agent->categories->pluck('id')->toArray();
        } else { // if Laravel 5.1
            $agent_cats = $agent->categories->lists('id')->toArray();
        }

        $agent->categories()->detach($agent_cats);

        return $agent;
    }
public function removeAgent($id)
    {
        $agent = Agent::find($id);
        $agent->ticketit_agent = false;
        $agent->save();

        // Remove him from tickets categories as well
        if (version_compare(app()->version(), '5.2.0', '>=')) {
            $agent_cats = $agent->categories->pluck('id')->toArray();
        } else { // if Laravel 5.1
            $agent_cats = $agent->categories->lists('id')->toArray();
        }

        $agent->categories()->detach($agent_cats);

        return $agent;
    }
public function removeAgent ( $ id ) { $ agent = Agent :: find ( $ id ) ; $ agent -> ticketit_agent = false ; $ agent -> save ( ) ; // Remove him from tickets categories as well if ( version_compare ( app ( ) -> version ( ) , '5.2.0' , '>=' ) ) { $ agent_cats = $ agent -> categories -> pluck ( 'id' ) -> toArray ( ) ; } else { // if Laravel 5.1 $ agent_cats = $ agent -> categories -> lists ( 'id' ) -> toArray ( ) ; } $ agent -> categories ( ) -> detach ( $ agent_cats ) ; return $ agent ; }
Remove user from the agents.

@param $id

@return mixed
Remove user from the agents .