title: Laravel: How to properly rewrite an authentification route in an MVC?
body: <p>I have to setup my authentication for my reservations system in Laravel.</p>
  <p>The basic routing methods by Laravel and a lot of tutorials is by writing the function for the route inside the web.php like this <strong>Laraval example</strong>:</p>
  <pre><code>Route::get('/flights', function () {
      // Only authenticated users may access this route...
  })-&gt;middleware('auth');
  </code></pre>
  <p>However, I was told this isn't the best way to set up routing and that I should use a controller to manage routes.
  But that means I have to setup authentification methods inside the controller and to be honest, I don't have the vision to do this..
  I thought I could do it like this (<strong>My Code</strong>)</p>
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use App\Providers\RouteServiceProvider;
  use Illuminate\Support\Facades\Auth;
  
  class PagesController extends Controller
  {
      public function home() {
          return view('home');
      }
  
      public function reservations() {
          return view('reservations')
          -&gt;middleware(['auth']);
      }
  
      public function newreservations() {
          return view('reservations_new');
      }
  
   }
  </code></pre>
  <p>combined with this web.php setup:</p>
  <pre><code>Route::get('/reservations.html', [PagesController::class, 'reservations']);
  
  Route::get('/reservations.html/login', [AuthenticatedSessionController::class, 'create']);
  
  Route::post('/reservations.html/login', [AuthenticatedSessionController::class, 'store']);
  
  Route::get('/reservations_new.html', [PagesController::class, 'newReservations']);
  </code></pre>
  <p>but then I got the error:
  <em>Method Illuminate\View\View::middleware does not exist.</em></p>
  <p>So any tips/tricks/methods to do it the right way?</p>