D
D
Div-Man2018-10-23 17:08:21
Laravel
Div-Man, 2018-10-23 17:08:21

What routing to do in this case?

Now, in order to be able to see any user profile, I made a route

Route::get('/masters/profile/{d}', '[email protected]');

Now they are asking for the link to be direct by login, like VKontakte
site.ru/dima
, if not, it will give a 404 error, the normal way?
Then it is better to lower this route to the very bottom, after all the routes?
You did it, right?
Route::get('/{userProfile}', function(){
    return 3333;
})->where('userProfile', '[A-Za-z0-9-]+');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
anlamas, 2018-10-24
@Div-Man

Yes, this route should be the last one.
No, it's not allowed, then everyone will see 3333)
And so, everything is ok, just fix the regular expression, now it works for 1 character or more, usually they do at least 3-5

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question