我已经在本地服务器上安装了 laravel 7。当我运行php artisan route:cache
命令时,laravel 返回错误:
逻辑异常
无法为序列化准备路由 [api/user]。使用闭包。
我该如何解决这个问题?
我尝试运行工匠命令:
php artisan config:cache
php artisan config:clear
php artisan cache:clear
composer dumpautoload
这是内容routes/api.php
:
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});