我安装了Laravel
和Passport
来制作REST API,api数据工作正常,我安装了通行证并成功设置了配置,但是有一个问题,我没有设置通行证的方式我的路线:
Route::get('posts', 'PostController@index');
Route::get('posts/{post}', 'PostController@show');
Route::post('posts', 'PostController@store');
Route::put('posts/{post}', 'PostController@update');
Route::delete('posts/{post}', 'PostController@delete');
我尝试过:
Route::group([
'prefix' => 'auth'
], function () {
Route::get('posts', 'PostController@index');
Route::get('posts/{post}', 'PostController@show');
});
找不到404
还有:
Route::middleware('auth:api')->group( function () {
Route::resource('posts', 'PostController@index');
});
Symfony \ Component \ Routing \ Exception \ RouteNotFoundException路由 [登录]未定义。
那我该如何在我的路线上使用护照?
邮递员:
Symfony \ Component \ Routing \ Exception \ RouteNotFoundException:路由 [登录]未定义。在文件中 C:\ xampp2 \ htdocs \ api \ vendor \ laravel \ framework \ src \ Illuminate \ Routing \ UrlGenerator.php 在第412行