The jetstream / fortify docs explain using username instead of email.
Sounds like you need a guest setup.
Make the username a slug is one option, but this sounds insecure what you are wanting to do.
Make it like an online shop.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi guys,
I have a project where each user has their own individual page that displays products, but the profiles are public in which users can share URL's with each other. For that, I am trying to get the URL for the profiles to user their username (which I made unique on registration) rather than id, but I am having a bit of trouble.
This is my routes files. the first one is the one I am trying to customize with the username.
Route::get('/index/{user:username}', 'ProductsController@index')->name('products.index');
Route::get('/product/create', 'ProductsController@create');
Route::post('/product', 'ProductsController@store');
Route::get('/product/{product}/edit', 'ProductsController@edit')->name('product.edit');
Route::patch('/product/{product}', 'ProductsController@update')->name('product.update');
Route::delete('/product/{product}', 'ProductsController@destroy')->name('product.destroy');
Then the index method in my ProductsController is:
public function index(User $user)
{
$products = auth()->user()->products;
$username = User::where([
'username' => $user->username,
])->first();
return view('index', compact('products'));
}
The reason I have /index/ in the route is because I would like it to have a generic URL rather that /user or /product (not sure if this is possible).
My apologies is the code is messy but I am a beginner.
Please or to participate in this conversation.