dimanche 1 avril 2018

Update User Profile Laravel 5.6

Hello I have just started in Laravel and am trying to update the users profile: My route:

Route::patch('users/{user}/update',  ['as' => 'users.update', 'uses' => 'UserController@update']);

My View:

<form method="post" action="">

    
    

    <input type="text" name="name"  value="" />
    <input type="email" name="email"  value="" />
    <input type="text" name="email"  value="" />
    <input type="text" name="email"  value="" />
    <input type="text" name="email"  value="" />

    <input type="password" name="password" />

    <input type="password" name="password_confirmation" />

    <button type="submit">Send</button>
</form>

and my update function in UserController:

public function update(User $user)
    { 

        $this->validate(request(), [
            'name' => 'required',
            'email' => 'required|email|unique:users',
        ]);

        $user->name = Request::input('name');
        $user->email = Request::input('email');

        $user->save();
        Flash::message('Your account has been updated!');
        return back();
    }

I dont get any errors yet my user profiles aren't updated.Can sb help me?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire