bind('districts', function ($id) { $districts = $this->app->make('\Locations\Location\Interfaces\DistrictsRepositoryInterface'); return $districts->findorNew($id); }); }if (Request::is('*/location/state/*')) { $router->bind('state', function ($id) { $state = $this->app->make('\Locations\Location\Interfaces\StateRepositoryInterface'); return $state->findorNew($id); }); } } /** * Define the routes for the application. * * @param \Illuminate\Routing\Router $router * * @return void */ public function map(Router $router) { $router->group(['namespace' => $this->namespace], function ($router) { require __DIR__ . '/../Http/routes.php'; }); } }