I have the following routes set in my routes.php
file:
Route::resource('eventos', 'EventosController');
Route::group(['prefix' => 'eventos'], function () {
Route::get('filtrar', ['as' => 'eventos.filtrar', 'uses' => 'EventosController@filtrar']);
Route::get('/', ['as' => 'eventos.index', 'uses' => 'EventosController@index']);
});
Using the command line tool php artisan route:list
I get the following output:
| GET|HEAD | eventos | eventos.index | App\Http\Controllers\EventosController@index | auth,s
etViewVariables |
| | POST | eventos | eventos.store | App\Http\Controllers\EventosController@store | auth,s
etViewVariables |
| | GET|HEAD | eventos/create | eventos.create | App\Http\Controllers\EventosController@create | auth,s
etViewVariables |
| | GET|HEAD | eventos/filtrar | eventos.filtrar | App\Http\Controllers\EventosController@filtrar | auth,s
etViewVariables |
| | GET|HEAD | eventos/{eventos} | eventos.show | App\Http\Controllers\EventosController@show | auth,s
etViewVariables |
| | DELETE | eventos/{eventos} | eventos.destroy | App\Http\Controllers\EventosController@destroy | auth,s
etViewVariables |
| | PUT | eventos/{eventos} | eventos.update | App\Http\Controllers\EventosController@update | auth,s
etViewVariables |
| | PATCH | eventos/{eventos} | | App\Http\Controllers\EventosController@update | auth,s
etViewVariables |
| | GET|HEAD | eventos/{eventos}/edit | eventos.edit | App\Http\Controllers\EventosController@edit | auth,s
etViewVariables |
| | GET|HEAD | usuarios | usuarios.index | App\Http\Controllers\UsersController@index | auth,s
etViewVariables |
The problem is that the route eventos.filtrar
is not redirecting to the filtrar
method in EventosController
.
Here's the form that should redirect when submitted to the route in question:
{!! \Form::open(['route' => 'eventos.filtrar', 'method' => 'GET']) !!}
In EventosController@filtrar all I'm doing is dding the request, but all I get is a blank page. Instead of the request object.
public function filtrar(Request $request)
{
dd($request->all());
}
All the RESTful routes seems to be working fine as well as the route that redirects to the index method.
Any suggestions?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire