我正在为 Laravel4 准备一个包,但找不到向我的包添加可配置路由的方法。
例子:
//this is from the service provider of the bundle
public function register()
{
...
$this->registerRoutes();
...
}
protected function registerRoutes()
{
//The way of doing into the documentation or other bundles is
//the problem is that I cannot put the routes to be from the config file
//and they cannot be overwritten from the app configuration.
include __DIR__ . '/routes.php';
}
//This method gives an error
protected function registerTestRoutes()
{
$this->app['imager'] = $this->app->share(function($app)
{
//$route = 'admin/images/{$image_id}
$route = $app['config']['imager::config']['delete_url'];
return \Route::delete($route, array('uses' => 'CompanyName\Imager\Controllers\ImagerController@destroy'));;
});
}