probably there are validation errors. you need to show them back in the form using variable $errors.
paste code from https://laravel.com/docs/5.1/validation#quick-displaying-the-validation-errors in to your view and see what you get there
Hi, jerauf I advise to rework your code like this, and maybe it can resolve the problem:
public function postProfileEdit(UpdateProfileRequest $request)
{
$profile_update = User::find(Auth::user()->id);
$profile_update->name = Input::get('name');
$profile_update->biography = Input::get('biography');
$profile_update->location = Input::get('location');
$profile_update->email = Input::get('email');
$profile_update->email_private = Input::get('email_private');
$profile_update->website = Input::get('website');
$profile_update->facebook = Input::get('facebook');
$profile_update->twitter = Input::get('twitter');
$profile_update->google_plus = Input::get('google_plus');
$profile_update->linkedin = Input::get('linkedin');
$profile_update->save();
return Redirect::to('profile'); // I advise to use the redirect->back(); or redirect->route('routeName'), and make redirect with some variables ->withSuccess('Your profile was successeful updated !') and ->withErrors($request->getErrors());
}
<?php namespace App\Http\Requests
use Auth;
class UpdateProfileRequest extends Request
{
public function authorize() // required method
{
return true; // here u can handle if current user can handle the request like mini middleware. If u return false jst returns the forbidden.
}
public function rules()
{
return [
'name' => 'required', // However, DO NOT make 'name' field for users unique, this is no sense, this is not 'username' the users can have the same names, only "auth" stuff like email, username MUST be unique.
'email' => 'required|unique:users', // Here the your problem, u try to update yor email on save profile then email input is not changed, so it returns the error on validation and u jst don't know about it because you dont shows that errors. So to fix this stuff you just need to update it with this:
'email' => 'required|unique:users,email,'.Auth::id() // It means the email validator excepts only user with id -> Auth::id()
];
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community