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'));
}
}