When I use the command "php artisan route:list" I have this error
[Illuminate\Container\BindingResolutionException]
Unresolvable dependency resolving [Parameter #0 [ <required> $methods ]] in class Illuminate\Routing\Route
The command works nicely when I have
Route::get('/', 'WelcomeController@index');
Route::get('home', 'HomeController@index');
but as soon as i add other routes, I have this exception
I found the problem :
I'm doing IOC in the controller and I inject Illuminate\Routing\Route. As soon as i delete the injection its works.
I have BaseController which extends Controller.
The BaseController is
class BaseController extends Controller {
/**
* @var array Options used by the pages
*/
protected $options;
/**
* @param Route $route
*/
public function __construct(Route $route)
{
$this->options = Option::getAutoloaded();
// Load the options for the named route page
$this->options = array_merge($this->options, Option::getByPage($route->getAction()['as']));
$this->initListPlugins();
}
A controller is
class MediasController extends BaseController {
public function __construct(Route $route)
{
parent::__construct($route);
$this->options = array_merge($this->options, Option::getByPage('media'));
}
Now thre problem is how I fix it :)
Thanx for your help
When ever I see this error I think of typo's, so make sure you recheck everything for those.
Just make sure your Route is linked to the correct Controller@function:
Would go to the MediasController in Http/Controllers:
class MediasController extends Controller {
}
Also make sure your controller has a correct return to the view. And if you're using the
make sure you have the "illuminate/html": "5.0.*@dev" installed through your composer.json aswell.