Why Not Redirect?

  • Hello guys, I have a problem. İf when user not found (So Not login). I want to redirect the @user/login



    PHP
    1. 'events'=>[
    2. 'boot' => function($event , $app){
    3. $app->subscribe(new AuthListener());
    4. }
    5. ]


    I Where did I go wrong

    Hello guys, my name is Yunus and I'm a backend developer. If you have a problem just drop me a message, but unfortinately I can't understand everything as I'm using google translator and many things gets lost in translation. So there is a language barrier and I'm sorry about this. Be patient and we will find a solution for sure. Thank you in advance.

  • Hi, Yns!


    Try like this:

    Code
    1. $event->setResponse(App::response()->redirect('@user/login'));

    Hi neicv , Not working.

    Images

    Hello guys, my name is Yunus and I'm a backend developer. If you have a problem just drop me a message, but unfortinately I can't understand everything as I'm using google translator and many things gets lost in translation. So there is a language barrier and I'm sorry about this. Be patient and we will find a solution for sure. Thank you in advance.

  • I want to just redirect. Auth not important.


    example:


    $event->setResponse(App::response()->redirect('@page/1')); ->Not Working

    $event->setResponse(App::response()->redirect('@dpnblog/1')); ->Not Working

    $event->setResponse(App::response()->redirect('@blog/1')); ->Not Working


    bla bla


    :(

    Hello guys, my name is Yunus and I'm a backend developer. If you have a problem just drop me a message, but unfortinately I can't understand everything as I'm using google translator and many things gets lost in translation. So there is a language barrier and I'm sorry about this. Be patient and we will find a solution for sure. Thank you in advance.

    • Helpful

    But you cannot do a redirect on every request, that will not work. Therefore the error `Pagekit redireced you too much`.

    The LORD is my strength and my shield; in him my heart trusts, and I am helped; my heart exults, and with my song I give thanks to him. Psalm 28,7

  • Okey thank you bro

    Hello guys, my name is Yunus and I'm a backend developer. If you have a problem just drop me a message, but unfortinately I can't understand everything as I'm using google translator and many things gets lost in translation. So there is a language barrier and I'm sorry about this. Be patient and we will find a solution for sure. Thank you in advance.