public function destroy($id)
    {
        $id      = (int) $id;
        $deleted = false;
        $message = '';
        $code    = 0;

        try{
            $user    = Sentry::findUserById($id);
            $deleted = $user->delete();
            $code    = 200;
        }catch(UserNotFoundException $e){
            $message = $e->getMessage();
            $code    = 404;
        }catch(Exception $e){
            $message = $e->getMessage();
            $code    = 500;
        }

        if(Request::isAjax()){
            Response::headers()->set('Content-Type', 'application/json');
            Response::setBody(json_encode(
                array(
                    'success'   => $deleted,
                    'data'      => array( 'id' => $id ),
                    'message'   => $message,
                    'code'      => $code
                )
            ));
        }else{
            Response::redirect($this->siteUrl('admin/user'));
        }
    }
public function destroy($id)
    {
        $id      = (int) $id;
        $deleted = false;
        $message = '';
        $code    = 0;

        try{
            $user    = Sentry::findUserById($id);
            $deleted = $user->delete();
            $code    = 200;
        }catch(UserNotFoundException $e){
            $message = $e->getMessage();
            $code    = 404;
        }catch(Exception $e){
            $message = $e->getMessage();
            $code    = 500;
        }

        if(Request::isAjax()){
            Response::headers()->set('Content-Type', 'application/json');
            Response::setBody(json_encode(
                array(
                    'success'   => $deleted,
                    'data'      => array( 'id' => $id ),
                    'message'   => $message,
                    'code'      => $code
                )
            ));
        }else{
            Response::redirect($this->siteUrl('admin/user'));
        }
    }
public function destroy ( $ id ) { $ id = ( int ) $ id ; $ deleted = false ; $ message = '' ; $ code = 0 ; try { $ user = Sentry :: findUserById ( $ id ) ; $ deleted = $ user -> delete ( ) ; $ code = 200 ; } catch ( UserNotFoundException $ e ) { $ message = $ e -> getMessage ( ) ; $ code = 404 ; } catch ( Exception $ e ) { $ message = $ e -> getMessage ( ) ; $ code = 500 ; } if ( Request :: isAjax ( ) ) { Response :: headers ( ) -> set ( 'Content-Type' , 'application/json' ) ; Response :: setBody ( json_encode ( array ( 'success' => $ deleted , 'data' => array ( 'id' => $ id ) , 'message' => $ message , 'code' => $ code ) ) ) ; } else { Response :: redirect ( $ this -> siteUrl ( 'admin/user' ) ) ; } }
destroy resource with specific id
destroy resource with specific id