Anthony Dekoci
Anthony Dekoci

Reputation: 122

How to make every Laravel URL have parameter

So I want to create admin page,

The result I want is like this

foo.com/admin/anthony

foo.com/admin/anthony/dologin

foo.com/admin/anthony/index

I tried using this routes

Route::any('admin/{username}', 'adminController@login'):

Route::any('admin/{username}/login', 'adminController@dologin');

I want to use every username parameter in admin page, but wont redeclare every page.

Upvotes: 1

Views: 37

Answers (1)

Parth Panchal
Parth Panchal

Reputation: 131

you can create group of route in laravel, below is the example which might help you.

Route::group(['prefix' => 'admin/{username}'], function () {
    Route::get('login', 'adminController@dologin');
});

Let me know if this doesn't work for you.

Upvotes: 0

Related Questions