โ˜… A better way to register routes in Laravel

1 ยท Freek Van der Herten ยท Nov. 14, 2018, 11 a.m.
Let's take a look at how you can define routes to controllers in Laravel. By default you can do it like this: Route::get('my-route', 'MyController@index'); This will look for the MyController class in the App\Http\Controllers namespace. This default namespace is set up in Laravel's RouteServiceProvider. This was fine for a long time, but in modern Laravel apps (thanks for that PR, Jaanus Vapper) there's a cool new way to register routes. You can define them using a tuple. Let's see how that l...