mercredi 15 août 2018

Global middleware not redirecting user

I have written a middlware, where I want to redirect users to the dashboard if they don't agree to the terms and conditions of the site.

Middleware

class CheckUserOptedOut
{
    public function handle($request, Closure $next)
    {
      if (Auth::check() && !auth()->user()->checkTermAndConditionSubmitted())
      {
        return redirect('/dashboard');
      }

      return $next($request);
    }
}

Its registered globally at app/http/kernel

protected $middleware = [
  \App\Http\Middleware\CheckUserOptedOut::class,
];

When I click on a link, I'm not redirected. Any ideas



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire