FEATURE: use more route model binding

This commit is contained in:
Michal Kváček
2017-08-01 19:10:55 +02:00
parent a7e91ef499
commit 3275e5aeed
22 changed files with 163 additions and 159 deletions
+27 -12
View File
@@ -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'));
}
}