lundi 30 novembre 2015

Laravel - Handle pages with wildcard route

In my application I need to set a route that respond to any pages.

I have put in my routes.php file:

// Handle all the pages
Route::get('{slug?}', 'Frontend\PageController@show');

and it works, the problem is that now I need an admin section so in my routes.php I added before the previous route:

Route::group( [ 'prefix' => 'admin', 'middleware' => config('admin.filter.auth') ], function(){
    // other routes
}  );

The problem is that the url site.com/admin has been catch by the wildcard so I'm not able to visit that url.

This is the full routes file:

//admin routes
Route::group( [ 'prefix' => 'admin', 'middleware' => config('admin.filter.auth') ], function(){

    Route::get('upload-file', 'Backend\UploadController@index');
    Route::post('upload-file', 'Backend\UploadController@uploadFile');
    Route::get('load-contacts', 'Backend\UploadController@loadContacts');

}  );

// Handle all the pages
Route::get('{slug?}', 'Frontend\PageController@show');

How should I manage this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire