我试图通过中间件保护路由described in the doc
当我点击网址时,我得到:
JSONArray arr = obj.getJSONObject("dailygameschedule").getJSONArray("gameentry");
for (int i = 0; i < arr.length(); i++)
{
//String post_id = arr.getJSONObject(i).getString("id");
System.out.println(arr.getJSONObject(i).getString("awayTeam.ID"));
}
以下是std::map<std::string, std::ofstream> Map;
std::string name="name";
std::ofstream ofs(name,std::ios::app);
Map[name] = std::move(ofs);
的相关部分:
ReflectionException in Container.php line 749:
Class can does not exist
routes.php
:
Route::get('{user}/profile/edit/{type?}', [
'as' => 'edit',
'uses' => 'User\UserController@edit',
'middleware' => ['can:edit-user,user'],
]);
也许是因为我没有使用单独的策略类来定义门?
答案 0 :(得分:3)
根据documentation on using Middleware with Routes - 您需要在app/Http/Kernel.php
如果您希望在对应用程序的每个HTTP请求期间运行中间件,只需在app / Http / Kernel.php类的$ middleware属性中列出中间件类。
您看到的错误表明此定义缺失。你需要添加类似的东西
// Within App\Http\Kernel Class...
protected $routeMiddleware = [
//...
'can' => \Path\To\Your\Middleware::class,
];