User Profile

The user is able to change update his profile information.


The profile can be accessed by a logged in user by clicking User Profile from the sidebar or adding user-profile in the url. The user can add information like phone number, location, description or change the name and email

The App/Http/Controllers/InfoUserController.php handles the user's profile information.

Copy

                public function store()
                {

                    $attributes = request()->validate([
                        'name' => ['required', 'max:50'],
                        'email' => ['required', 'email', 'max:50', Rule::unique('users')->ignore(Auth::user()->id)],
                        'phone'     => ['max:50'],
                        'location' => ['max:70'],
                        'about_me'    => ['max:150'],
                    ]);

                    User::where('id',Auth::user()->id)
                    ->update([
                        'name'    => $attributes['name'],
                        'email' => $attributes['email'],
                        'phone'     => $attributes['phone'],
                        'location' => $attributes['location'],
                        'about_me'    => $attributes["about_me"],
                    ]);


                    return redirect('/user-profile');
                }