Routes of Laravel

2

Thank you in advance, I am working on a CMS and I want to separate the backend routes and the front routes but I have conflicts.

The backend is currently in / admin and whatever follows, for example / admin / users / etc ...

The problem comes from the front side when I want to put: / paginax or / paginax / paginax2

Because I can no longer enter the admin when I declare the front routes:

Route::namespace('Frontend')->group(function () {
   Route::get('/', 'PageController@index');
   Route::get('/{slug}/{slug2?}/{slug3?}', 'PageController@routing');

And these are my admin routes:

Route::namespace('Backend')->prefix('admin')->group(function () {

   Route::get('/', 'Sites\SitesController@index')->name('admin.index');

Having my routes in this way, when I try to enter / admin I go to the path Route::get('/{slug}/{slug2?}/{slug3?}', 'PageController@routing');

Any idea how to solve it?

    
asked by Carlos Agaton 25.10.2018 в 01:39
source

2 answers

2

Try this possibly if it works:

Route::get('{slug1?}/{slug2?}/{slug3?}/{slug4?}', 'Frontend\PageController@index')->where(['slug1' =>'^(?!.?admin).*'

Greetings

    
answered by 25.10.2018 / 17:37
source
0

Have you tried it this way?

Route::namespace('Frontend')
        ->group(function () {
            Route::get('/', 'PageController@index');
            Route::get('/{slug}/{slug2?}/{slug3?}', 'PageController@routing');
       });

Route::namespace('Backend')
        ->prefix('admin')
        ->group(function () {
            Route::resource('/', 'SitesController@index');
       });

Advanced Routes

    
answered by 25.10.2018 в 01:56