I want an app to use a URL structure something like this:
/account/johnsmith/photos/account/johnsmith/messages/account/johnsmith/settings/account/joebloggs/photos
So users may add multiple accounts and then the route group selects the account automatically.
Route::group(['middleware' => 'auth', 'prefix' => 'account/{username}'], function () {
Route::get('/photos', 'PhotosController@index')->name('photos.index');
});
In the above example I can access the {username} parameter inside of PhotosController@index.
Is there a way to write some middleware that gets the account information automatically and it's accessible to all child routes in the group? Or am is this a bad way to try to build this?