我正在使用 Laravel 8.0 开发一个多语言 Web 项目。我已经使用https://github.com/mcamara/laravel-localization包来更改语言。它只有 3 个主要页面,即仪表板、注册和登录。该软件包在仪表板页面上正常工作,但在注册页面中显示如下:Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException The GET method is not supported for this route. Supported methods: POST.
这是 web.php:
Route::group(
[
'prefix' => LaravelLocalization::setLocale(),
'middleware' => [ 'localeSessionRedirect', 'localizationRedirect', 'localeViewPath' ]
], function(){ //...
Route::get('/', function()
{
return redirect()->route('login');
});
Route::post('/register', 'App\Http\Controllers\RegisteredUserController@store')->name('register2');
Route::group(['middleware' => 'auth'],function (){
Route::get('/register-step2','\App\Http\Controllers\RegisterStepTwoController@create')
->name('register-step2.create');
Route::post('/register-step2','\App\Http\Controllers\RegisterStepTwoController@store')
->name('register-step2.post');
Route::group([ 'middleware' => ['auth:sanctum','verified','registered']], function() {
Route::get('/dashboard', '\App\Http\Controllers\DashboardController@index')->name('dashboard');
});
});
});
这是注册刀片:
<x-guest-layout>
<x-jet-authentication-card>
<x-slot name="logo">
<h1 class="text-white headersize px-3"> Sign up as a Coinshop Partner Below</h1>
</x-slot>
<x-jet-validation-errors class="mb-4"/>
<!-- Fields to complete Registration Step 1 -->
<form method="POST" action="{{ route('register2') }}">
@csrf
<div>
<x-jet-label for="country_id" value="{{ ('Choose your country')}}"/>
<select id="country_id" name="country_id"
class=' w-full border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm'>
<option value="" disabled selected>Select Country</option>
<option value="Denmark">Denmark</option>
<option value="Mauritius">England</option>
</select>
</div>
...