如果你有像
/users/posts/
, /users/posts/create
, 和/users/posts/edit
这样的路线,那么创建和编辑路线应该写在/users/posts
之前,以避免路线冲突问题。
在您的路线
web.php
中,更改以下路线顺序:
Route::get('/', function () {
return view('welcome');
});
Route::prefix('admin')->middleware(['auth', 'verified'])->group(function() {
Route::get('/', function () {
return view('admin.index');
});
Route::resource('users' , App\Http\Controllers\Admin\AdminUserController::class)->middleware('admin');
Route::get('/settings/twofactor/phone' , [App\Http\Controllers\Admin\AdminSettingsController::class, 'getPhoneVerify']);
Route::post('/settings/twofactor/phone' , [App\Http\Controllers\Admin\AdminSettingsController::class, 'postPhoneVerify'])->name('profile.2fa.phone');
Route::post('/settings/twofactor' , [App\Http\Controllers\Admin\AdminSettingsController::class, 'postManageTwoFactor'])->name('profile.2fa.manage');
Route::get('/settings', [App\Http\Controllers\Admin\AdminSettingsController::class, 'index'])->name('profile');
Route::get('/auth/token' ,[App\Http\Controllers\Auth\AuthTokenController::class, 'getToken'])->name('2fa.token');
Route::post('/auth/token' ,[App\Http\Controllers\Auth\AuthTokenController::class, 'postToken']);
});
Auth::routes(['verify' => true]);
Route::get('/auth/google/callback', [App\Http\Controllers\Auth\GoogleAuthController::class, 'result']);
Route::get('/auth/google', [App\Http\Controllers\Auth\GoogleAuthController::class, 'redirect'])->name('auth.google');
Auth::routes();
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
如果你尝试这个,我认为你的问题会解决,只需用这个更改代码的以下行。
<button type="submit" class="btn btn-primary">Validate token</button>
是的!,更改为以下对我有用。 提交表格