App\Http\Controllers\Laralum\ProfileController::update PHP Метод

update() публичный Метод

Update the user profile
public update ( Illuminate\Http\Request $request )
$request Illuminate\Http\Request
    public function update(Request $request)
    {
        $this->validate($request, ['image' => 'image|max:5120', 'current_password' => 'required']);
        $row = Laralum::loggedInUser();
        if (Hash::check($request->current_password, $row->password)) {
            # Password correct, setup the new password and redirect with confirmation
            # Save the data
            $data_index = 'profile';
            require 'Data/Edit/Save.php';
            if (array_key_exists('image', $request->all())) {
                $request->file('image')->move('avatars', md5($row->email));
            }
            return redirect()->route('Laralum::profile')->with('success', trans('laralum.profile_updated'));
        } else {
            # Password not correct, redirect back with error
            return redirect()->route('Laralum::profile')->with('error', trans('laralum.incorrect_password'));
        }
    }
ProfileController