public function handle(Request $request, $redirect = null)
    {
        if (\is_user_logged_in() === true) {
            return true;
        }

        if ($redirect === 'login') {
            Response::redirect_to_login();
        }

        if ($redirect === 'admin') {
            Response::redirect_to_admin();
        }

        if ($redirect !== null) {
            Response::redirect($redirect);
        }

        Response::set_404();

        return false;
    }
public function handle(Request $request, $redirect = null)
    {
        if (\is_user_logged_in() === true) {
            return true;
        }

        if ($redirect === 'login') {
            Response::redirect_to_login();
        }

        if ($redirect === 'admin') {
            Response::redirect_to_admin();
        }

        if ($redirect !== null) {
            Response::redirect($redirect);
        }

        Response::set_404();

        return false;
    }
public function handle ( Request $ request , $ redirect = null ) { if ( \ is_user_logged_in ( ) === true ) { return true ; } if ( $ redirect === 'login' ) { Response :: redirect_to_login ( ) ; } if ( $ redirect === 'admin' ) { Response :: redirect_to_admin ( ) ; } if ( $ redirect !== null ) { Response :: redirect ( $ redirect ) ; } Response :: set_404 ( ) ; return false ; }
Check if the current user is logged in, and perform the redirect if not.

Example: is_logged_in|404

@since  1.0.0

@param  \Snap\Http\Request $request  The current request.
@param  string|null        $redirect The middleware argument. How to redirect this request.
@return boolean
Check if the current user is logged in and perform the redirect if not .