0

I'm working on a multi language web project using Laravel 8.0. I have use the https://github.com/mcamara/laravel-localization package to change the language. Its only 3 main pages which are dashboard, register and login. The package works correctly on dashboard page, but in the register page it shows this: Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException The GET method is not supported for this route. Supported methods: POST.

This is 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');
        });
    });

    });

This is register blade:

<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>
...

ingjo12
  • 45
  • 6
  • Open up your browser's developer console and watch the Network tab as you submit the form. You may have some sort of redirect going on, such as HTTP -> HTTPS, that is changing your POST route to a GET – aynber Sep 16 '21 at 12:07
  • Just add it up: When I go the the register page it works pretty well, but when I add in the link the language ex: ```http://127.0.0.1:8000/en/register```, it shows the error – ingjo12 Sep 16 '21 at 12:18

0 Answers0