FEATURE: use more route model binding
This commit is contained in:
@@ -2,30 +2,45 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* This namespace is applied to the controller routes in your routes file.
|
||||
*
|
||||
* This namespace is applied to your controller routes.
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
public function boot()
|
||||
{
|
||||
$router->group(['namespace' => $this->namespace], function ($router) {
|
||||
require app_path('Http/routes.php');
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::namespace($this->namespace)
|
||||
->middleware('web')
|
||||
->group(app_path('Http/routes.php'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user