Laravel The GET method is not supported for this route when redirecting back()


I have Laravel project and there is a post route that I pass a parameter in the URL and a form in the Request

Route::post('/gc/verifierQR-{qr_url}', [UserController::class, 'inquiryResult'])->name('inquiry.result');

this route returns to a view file and in this view there is change language button

<div class="nav-item">
    <div class="dropdown">
        <button class="bg-transparent border-0" type="button" id="dropdownMenuButton1"
            data-bs-toggle="dropdown" aria-expanded="false">
            <a class="nav-link text-white"><i class="fas fa-globe me-2"></i> العربية <i
                    class="fas fa-chevron-down"></i></a>
        <ul class="dropdown-menu border-0 shadow" aria-labelledby="dropdownMenuButton1">
            <li><a class="dropdown-item fw-bold" href="{{ route('lang', $arabic_locale) }}"><img
                        src="{{ asset('images/egypt-flag.png') }}" class="egypt-flag">
                <hr class="dropdown-divider">
            <li><a class="dropdown-item" href="{{ route('lang', $english_locale) }}"><img
                        src="{{ asset('images/usa-flag.png') }}" class="egypt-flag">

the route of language changing

Route::get('/language/{locale}', function ($locale) {
    session()->put('locale', $locale);
    return redirect()->back();

but in this page when I change the language and redirect back() I found this error

The GET method is not supported for this route. Supported methods: POST.

Source: Laravel

Categorised as laravel, php Tagged ,


Leave a Reply

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us