public function edituserdetails() { $rules = array('confirmpassword' => 'required|passcheck'); Validator::extend('passcheck', function ($attribute, $value, $parameters, $validator) { return Hash::check($value, Auth::user()->getAuthPassword()); }); $messages = array('passcheck' => 'Your password is incorrect'); $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { return redirect('editprofile')->withInput()->withErrors($validator); } $user = User::where('username', Input::get('username'))->first(); $details = user_detail::find($user->id); $details->first_name = Input::get('first_name'); $details->middle_name = Input::get('middle_name'); $details->last_name = Input::get('last_name'); $details->email_id = Input::get('email_id'); $details->address = Input::get('address'); $details->department = Input::get('department'); $details->designation = Input::get('designation'); $details->save(); return redirect('/home'); }
</div> </div> @endsection @section('sidebar') @endsection @section('bodycontent') <?php use App\User; use App\user_detail; //$user = User::where('username',$loggeduser)->get('username'); $user = User::where('username', $loggeduser)->first(); $id = $user->id; $details = user_detail::where('id', $id)->first(); $first_name = $details->first_name; ?> <div class="container"> @if ($errors->has()) <div class="alert alert-danger"> @foreach ($errors->all() as $error) {{ $error }}<br> @endforeach </div> @endif {!! Form::open(array('class'=>'form-horizontal', 'action'=>'UserController@edituserdetails','method'=>'post')) !!} <fieldset> <legend>Edit your personal details </legend> <div class="control-group">