title: auth logout doesn't work laravel
body: <p>I made the files for authentication using the command</p>
  
  <pre><code>php artisan make:auth
  </code></pre>
  
  <p>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.</p>
  
  <p>I also read something about modifying AuthController in app, but I do not have that file.</p>
  
  <p>I tried to do it by hand, which means I created a middleware LogoutRedirect:</p>
  
  <pre><code> public function handle($request, Closure $next)
  {
      return redirect(pages.logout);
  }
  </code></pre>
  
  <p>In the routes I added</p>
  
  <pre><code>use App\Http\Middleware\LogoutRedirect;
  
  Route::get('logout', function()
  {
      return view('pages.logout');
  })-&gt;middleware(LogoutRedirect::class);
  </code></pre>
  
  <p>And logout.blade.php looks like</p>
  
  <pre><code>{{ Auth::logout() }}
  </code></pre>
  
  <p>I get the error (when trying to access localhost:8080/logout)</p>
  
  <pre><code>Use of undefined constant pages - assumed 'pages'
  </code></pre>
  
  <p>What could I do about it?</p>
  
  <hr>
  
  <h2>EDIT</h2>
  
  <hr>
  
  <p>I tried another approach (but with no better results):</p>
  
  <ol>
  <li>renamed the route which redirects to '/' to 'home'</li>
  <li><p>made a LogoutController in app/http/Controllers/Auth</p>
  
  <p>
  
  <pre><code>namespace App\Http\Controllers;
  use [...]
  class LogoutController extends Controller
  {
      public function logout() {
          Auth::logout();
          return Redirect::route('home');
  }
  }
  </code></pre></li>
  <li><p>made the route</p>
  
  <pre><code>Route::post('logout', array(
      'as' =&gt; 'account-sign-out',
      'uses' =&gt; 'Auth\LogoutController@logout'
  ));
  </code></pre></li>
  </ol>
  
  <p>The error I get is</p>
  
  <pre><code>  MethodNotAllowedHttpException in RouteCollection.php line 233:
  </code></pre>
  
  <p>That's the same error I get when I try to use the default logout defined in auth</p>