Brief:
I have a custom routes group with a dynamic prefix:
Route::prefix('{nickname}')->group(function () {
Route::get('/', function($nickname) {
return view('profile');
})->where(['nickname' => '[a-z]+']);
Route::get('/edit', function($nickname) {
return view('profile.edit');
})->where(['nickname' => '[a-z]+']);
});
As you can see, on each route I check the prefix correctness through a regex.
Note: I also used ->where(['nickname' => '[a-z]+'])
to routes group and got an error.
Error message:
Call to a member function where() on null
Question:
How can I solve the problem with checking only once?