bind('post', function ($value) { return Post::whereTranslation('slug', $value, app()->getLocale())->firstOrFail(); }); $router->bind('category', function ($value) { return Category::whereTranslation('slug', $value, app()->getLocale())->firstOrFail(); }); parent::boot($router); } /** * Define the routes for the application. * * @param \Illuminate\Routing\Router $router * @return void */ public function map(Router $router) { $this->mapWebRoutes($router); // } /** * Define the "web" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @param \Illuminate\Routing\Router $router * @return void */ protected function mapWebRoutes(Router $router) { $router->group([ 'namespace' => $this->namespace, 'middleware' => 'web', ], function ($router) { require app_path('Http/routes.php'); }); } }