Seperated Route Files

April 27th, 2023 · LinkedIn

As a Laravel developer, consider creating multiple route files to keep your codebase clean and organized. This approach helps separate your application logic into distinct modules, making it easier to maintain and scale your code.

// app/Providers/RouteServiceProvider.php
 
protected function map()
{
Route::prefix('users')
->middleware('web')
->namespace($this->namespace)
->group(base_path('routes/user.php'));
}