I am trying a really simple thing, but i seems like i cant figure it out. There are two things i want to do:

  1. Check if the url exists
  2. Redirect if it does

Inside my addon controller, i got something like this:

class AddonListener extends Listener
{
    /**
     * The events to be listened for, and the methods to call.
     *
     * @var array
     */
    public $events = [
        'response.created' => 'response',
    ];

    public function response(Response $response)
    {
            if (Cookie::has('somesavedurl')) { //pagetogoto

                $path = base_path() . Cookie::get('somesavedurl'); 
                //https://mypage.com/pagetogoto

                // how to check if the path/route exists ?

                return redirect($path); // Not doing anything
            }
    }
}

It feels stupid, that its not working ... :-)

Answered by Jonas Siewertsen! Go to answer.