Tuesday, April 4, 2017

auth logout doesn't work laravel

I made the files for authentication using the command

php artisan make:auth

I've read on the internet that register, login, as well as logout should work properly, but localhost:8080/logout doesn't work, and I don't know why.

I also read something about modifying AuthController in app, but I do not have that file.

I tried to do it by hand, which means I created a middleware LogoutRedirect:

 public function handle($request, Closure $next)
{
    return redirect(pages.logout);
}

In the routes I added

use App\Http\Middleware\LogoutRedirect;

Route::get('logout', function()
{
    return view('pages.logout');
})->middleware(LogoutRedirect::class);

And logout.blade.php looks like



I get the error (when trying to access localhost:8080/logout)

Use of undefined constant pages - assumed 'pages'

What could I do about it?



via Ileana Profeanu

Advertisement