public function profileData()
    {
        $user = Auth::user();

        $profile = UserProfile::whereUserId($user->id)->first();

        $data = Input::all();

        $rules = [
            'nombre' => 'required',
            'apellidos' => 'required'
        ];

        $validator = Validator::make($data, $rules);

        if($validator->passes())
        {
            $profile->fill($data);
            $profile->save();

            //REDIRECCIONAR A PAGINA PARA VER DATOS
            return redirect()->route('admin.user.profile');
        }
        else
        {
            return Redirect::back()->withInput()->withErrors($validator->messages());
        }
    }
public function profileData()
    {
        $user = Auth::user();

        $profile = UserProfile::whereUserId($user->id)->first();

        $data = Input::all();

        $rules = [
            'nombre' => 'required',
            'apellidos' => 'required'
        ];

        $validator = Validator::make($data, $rules);

        if($validator->passes())
        {
            $profile->fill($data);
            $profile->save();

            //REDIRECCIONAR A PAGINA PARA VER DATOS
            return redirect()->route('admin.user.profile');
        }
        else
        {
            return Redirect::back()->withInput()->withErrors($validator->messages());
        }
    }
public function profileData ( ) { $ user = Auth :: user ( ) ; $ profile = UserProfile :: whereUserId ( $ user -> id ) -> first ( ) ; $ data = Input :: all ( ) ; $ rules = [ 'nombre' => 'required' , 'apellidos' => 'required' ] ; $ validator = Validator :: make ( $ data , $ rules ) ; if ( $ validator -> passes ( ) ) { $ profile -> fill ( $ data ) ; $ profile -> save ( ) ; //REDIRECCIONAR A PAGINA PARA VER DATOS return redirect ( ) -> route ( 'admin.user.profile' ) ; } else { return Redirect :: back ( ) -> withInput ( ) -> withErrors ( $ validator -> messages ( ) ) ; } }
Funcion para cambiar datos de Perfil de usuario logeado
Funcion para cambiar datos de Perfil de usuario logeado