vendredi 28 septembre 2018

laravel nested route with prefix and resource dosent work

I have many routes like these :

Route::resource('/dashboard/class', 'classController');
Route::get('/dashboard/class/get-by-filter', 'classController@getByFilter');
Route::get('/dashboard/class/get-by-search', 'classController@getBySearch');
...
...

Route::resource('/dashboard/orders', 'OrderController');
Route::get('/dashboard/orders/get-by-filter', 'OrderController@getByFilter');
...

now I want to write these with prefix ,group and resources but I have a problem when write like this :

Route::prefix('dashboard')->group(function()
    {

       Route::prefix('class')->group(function()
         {
            Route::get('/', 'classController');
            Route::get('/get-by-filter', 'classController@getByFilter');
            Route::get('/get-by-search', 'classController@getBySearch');
         });

       Route::prefix('orders')->group(function()
         {
            Route::get('/', 'OrderController');
            Route::get('/get-by-filter', 'OrderController@getByFilter');
            Route::get('/get-by-search', 'OrderController@getBySearch');
         });

});

why return 404 when I try to access show address like this :

example.com/dashboard/orders/4



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire