public function destroy($listener, $id)
    {
        $role = $this->model->findOrFail($id);
        try {
            if ($role->users->count() > 0) {
                throw new Exception('Unable to delete group with assigned users.');
            }
            DB::transaction(function () use ($role) {
                $role->delete();
            });
        } catch (Exception $e) {
            Log::warning($e);
            return $listener->destroyFailed(['error' => $e->getMessage()]);
        }

        return $listener->destroySucceed($role);
    }
public function destroy($listener, $id)
    {
        $role = $this->model->findOrFail($id);
        try {
            if ($role->users->count() > 0) {
                throw new Exception('Unable to delete group with assigned users.');
            }
            DB::transaction(function () use ($role) {
                $role->delete();
            });
        } catch (Exception $e) {
            Log::warning($e);
            return $listener->destroyFailed(['error' => $e->getMessage()]);
        }

        return $listener->destroySucceed($role);
    }
public function destroy ( $ listener , $ id ) { $ role = $ this -> model -> findOrFail ( $ id ) ; try { if ( $ role -> users -> count ( ) > 0 ) { throw new Exception ( 'Unable to delete group with assigned users.' ) ; } DB :: transaction ( function ( ) use ( $ role ) { $ role -> delete ( ) ; } ) ; } catch ( Exception $ e ) { Log :: warning ( $ e ) ; return $ listener -> destroyFailed ( [ 'error' => $ e -> getMessage ( ) ] ) ; } return $ listener -> destroySucceed ( $ role ) ; }
Delete a role.

@param  object  $listener
@param  string|int  $id

@return mixed
Delete a role .