在laravel框架有resource这个方法使用,但在lumen框架中似乎移除了这个方法;一直觉得用resource来规范代码是很不错的。
为了能够让lumen框架使用resource,尝试使用ding go api。ding go api的库里面有resource这个方法。但是使用起来是报错的,报错如下:
(1/1) TypeError
Argument 1 passed to Illuminate\Routing\RouteCollection::add() must be an instance of Illuminate\Routing\Route, null given, called in /home/vagrant/code/lumen_demo/vendor/illuminate/routing/ResourceRegistrar.php on line 99
in RouteCollection.php line 50
at RouteCollection->add(null)
in ResourceRegistrar.php line 99
at ResourceRegistrar->register('demo', 'DemoController', array())
in Router.php line 320
at Router->resource('demo', 'DemoController')
in web.php line 22
at {closure}(object(Router))
at call_user_func(object(Closure), object(Router))
in Router.php line 171
at Router->group(array('namespace' => 'App\\Http\\Controllers', 'version' => array('v1'), 'conditionalRequest' => false, 'prefix' => '/', 'middleware' => array(), 'providers' => array(), 'scopes' => array(), 'before' => array(), 'after' => array(), 'where' => array(), 'domain' => '/'), object(Closure))
in Router.php line 136
at Router->version('v1', array('namespace' => 'App\\Http\\Controllers'), object(Closure))
in web.php line 28
at require('/home/vagrant/code/lumen_demo/routes/web.php')
in app.php line 109
at {closure}(object(Router))
at call_user_func(object(Closure), object(Router))
in Router.php line 62
at Router->group(array('namespace' => 'App\\Http\\Controllers'), object(Closure))
in app.php line 110
at require('/home/vagrant/code/lumen_demo/bootstrap/app.php')
in index.php line 13
请问应该怎么解决呢?