Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel 6 use username on url

// using User->username instead of id on url:
public function show($user)
    {
  		// where<YourAtributeName>($param)->firstOrFail()
        $user = User::whereUsername($user)->firstOrFail();
        return view('users.show', ['user'=>$user]);
    }
Source by laracasts.com #
 
PREVIOUS NEXT
Tagged: #laravel #username #url
ADD COMMENT
Topic
Name
8+7 =