private function deleteUser($id)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('user', 'delete')) {
            return $this->noPermission();
        }

        $user = User::find($id);
        // user can't be deleted if it has related data to him, like posts, categories ect
        if($user->hasRelatedData()) {
            $user->isActive = false;
            if($user->save()) {
                return true;
            }
        }

        // Delete all roles relations
        $roles = RoleRelationsModel::where('userID', $id);
        if($roles) {
            $roles->delete();
        }

        if ($user && $user->delete()) {
            return true;
        }

        return false;
    }
private function deleteUser($id)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('user', 'delete')) {
            return $this->noPermission();
        }

        $user = User::find($id);
        // user can't be deleted if it has related data to him, like posts, categories ect
        if($user->hasRelatedData()) {
            $user->isActive = false;
            if($user->save()) {
                return true;
            }
        }

        // Delete all roles relations
        $roles = RoleRelationsModel::where('userID', $id);
        if($roles) {
            $roles->delete();
        }

        if ($user && $user->delete()) {
            return true;
        }

        return false;
    }
private function deleteUser ( $ id ) { // check if user has permissions to access this link if ( ! User :: hasAccess ( 'user' , 'delete' ) ) { return $ this -> noPermission ( ) ; } $ user = User :: find ( $ id ) ; // user can't be deleted if it has related data to him, like posts, categories ect if ( $ user -> hasRelatedData ( ) ) { $ user -> isActive = false ; if ( $ user -> save ( ) ) { return true ; } } // Delete all roles relations $ roles = RoleRelationsModel :: where ( 'userID' , $ id ) ; if ( $ roles ) { $ roles -> delete ( ) ; } if ( $ user && $ user -> delete ( ) ) { return true ; } return false ; }
Deletes user,
called from bulkDelete and delete functions.

@param  int $id
@return array|bool
Deletes user called from bulkDelete and delete functions .