2
I have a route
Route::get('/','WebController@index');
I have a controller
public function index()
{
$cars = Cars::table('cars')->get();
return view('web::index')->with('cars', $cars);
}
And in the form
reads as follows URL
{!! Form::open(['class' => 'form-horizontal search-side-box', 'url' => '/', 'method' => 'post', 'autocomplete' => 'off']) !!}
But when I click the button submit
of form
, of the following error:
Class App\Front\Http\Controllers\WebController does not exist
But the controller is configured, so much so that in other places I call the URL '/' and it works, only on form
that no. And when I pass another URL in the form
it also works:
{!! Form::open(['class' => 'form-horizontal search-side-box', 'url' => '/about', 'method' => 'post', 'autocomplete' => 'off']) !!}
What your form does or should do?
– Darlei Fernando Zillmer
In this case you pass the search data of a specific item. If you do not have any field filled it must fetch all the items, otherwise search by passing the form parameters
– Edinho Rodrigues
@Edinhorodrigues, you have to create a post route: Route::post('/','Webcontroller@index');
– pss1suporte
Thanks, I decided even better: Route::any('/', 'Webcontroller@index');
– Edinho Rodrigues
@Edinhorodrigues, before using Route::any() checks the security issue. I have to confirm, but if no mistake favors vulnerabilities.
– pss1suporte