L5路由中间件的问题

Route::post('/getProduct', ['middleware' => 'tokenVerify','HomeApiController@getProduct']);

报错:ReflectionException in compiled.php line 7275:Function () does not exist
这是设置
protected $routeMiddleware = [
            'tokenVerify'=>'App\Http\Middleware\VerifyCsrfToken',
    'auth' => 'App\Http\Middleware\Authenticate',
    'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
    'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
];

解决了

Route::post('/verify','WelcomeController@VerifyStep',['middleware' => 'tokenVerify']);

但是又出现了

Call to a member function setCookie() on a non-object 这个错误

我现在只想放行一个 路由其他的都要用CSRF该怎么做呢
已邀请:

fengbingji

赞同来自: motecshine

Route::post('/getProduct', ['middleware' => 'tokenVerify','uses'=>'HomeApiController@getProduct']);

要回复问题请先登录注册