Laravel Route Different From Tinker and Webpage

  Kiến thức lập trình

I have laravel 10 project, and I have route called `post-login’

Route::post('/post-login', 'AuthController@post_login')->name('post-login');

And I have custom base url (.env APP_URL) is http://myfrontend.test/app/

What I expected is i can get http://myfrontend.test/app/post-login when I call route('post-login'), but the result between artisan tinker and webpage was different, here’s the result

Artisan Tinker

php artisan tinker
Psy Shell v0.12.0 (PHP 8.2.18 — cli) by Justin Hileman
> route('post-login')
= "http://myfrontend.test/app/post-login"

Webpage

<form class="form w-100" novalidate="novalidate" id="kt_sign_in_form" method="POST"
                            action="{{ route('post-login') }}">
....
</form>
<form class="form w-100" novalidate="novalidate" id="kt_sign_in_form" method="POST"
                            action="http://myfrontend.test/post-login">
....
</form>

the url path /app/ not detected from the webpage, I had tried to php artiasn optimize:clear but the result still the same, what’s the problem?

LEAVE A COMMENT