Support the ongoing development of Laravel.io →
posted 10 years ago
Requests
Last updated 1 year ago.
0

I think that should be fine, as long as you make the email column in the database unique. You can also use "username", if you want.

Last updated 1 year ago.
0

Also consider, your users may not want their email address in a URL. That's where the username idea may be a little more appropriate.

Last updated 1 year ago.
0

Thank you. Now I need a email Route::pattern :)

Last updated 1 year ago.
0

Email pattern:

Route::pattern('email', '^[a-zA-Z0-9.!#$%&\'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$');

Route::get('user/{email}', function($email)
{
    // Only called if {email} is a valid email address
});

Email regex from http://stackoverflow.com/a/8829363/941158

Last updated 1 year ago.
0

Thanks Benjamin! :)

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.