jeudi 20 décembre 2018

How to redirect to a previous URL in Laravel 5.6 and intended

In my Laravel application I have a middleware for specific routes, in this middleware I validate to redirect to a url.

public function handle($request, Closure $next)
{
    $isValidated= ....
    if ($isValidated) {
        session()->put('url.intended', URL::full());
        return redirect()->route('routeone')
    }
    return $next($request);
}

in the store method of that table when you register I do a redirect in the following way, but it turns out that when I do it, it redirects me to domain/img/favicon.png and I did not do the previous route

public function store(Request $request)
{
    ....
    return redirect()->intended(session('url.intended') ?? '/admin');
}

What is the problem here or how could I address this detail to redirect to the url before the middleware redirects. ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire