For the first time I have a problem with a route in laravel 5 (5.8.35).
I have a form that makes a post request to /client/ban
<div class="text-center">
<form action="/client/ban" method="post">
{{ csrf_field() }}
Token:<br>
<label>
<input type="text" name="token">
</label>
<button type="submit" name="ban" value="1">Ban</button>
<button type="submit" name="ban" value="0">Pardon</button>
</form>
</div>
My routes are here, it should redirect my /client/ban
request to the action_ban_req
method.
Route::post('/client/ban', 'HomeController@action_ban_req');
Route::post('/client/new', 'HomeController@action_new_req');
Here are my two methods, in the HomeController.php
file, with, for debug purpose, have a very simple content (it contains other methods that works on theirs own routes);
public function action_ban_req(Request $request)
{
return "Test BAN";
}
public function action_new_req(Request $request)
{
return "Test NEW";
}
However, every time I make a request, parameters are sent to /client/ban
but it returns "Test NEW". I also tried with this route instead:
Route::post('/client/ban', function () { return 'Test'; });
Even with that, there is no difference, I'm still stuck with a "Test NEW" response.
Did I miss something?
Edit: Nothing change when I swap order of routes, my others routes with /client
prefix (that have other forms) works fine.
/client
prefix? – Laerte/client
prefix (and theirs form in html). – Glastiscomposer dump-autoload
. Then, check ifphp artisan route:list
show both paths. – Jeff Harrisphp artisan route:cache
– Glastis