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('/', '[email protected]');
   Route::get('/{slug}/{slug2?}/{slug3?}', '[email protected]');

And these are my admin routes:

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

   Route::get('/', 'Sites\[email protected]')->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?}', '[email protected]');

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\[email protected]')->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('/', '[email protected]');
            Route::get('/{slug}/{slug2?}/{slug3?}', '[email protected]');
       });

Route::namespace('Backend')
        ->prefix('admin')
        ->group(function () {
            Route::resource('/', '[email protected]');
       });

Advanced Routes

    
answered by 25.10.2018 в 01:56