app/Http/Controllers/Tutor/MyProfileController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\User  $user
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, User $myprofile)
    {
        $validator = Validator::make($request->all(), [
            'fname'             => ['required', 'string', 'max:255'],
            'lname'             => ['required', 'string', 'max:255'],
            'home_phone'        => ['required', 'string', 'max:255'],
            'cell_phone'        => ['required', 'string', 'max:255'],
            'password'          => ['required', 'string', 'min:8', 'confirmed'],
            'address'           => ['required', 'string', 'max:255'],
            'city'              => ['required', 'string', 'max:255'],
            'state_id'          => ['required', 'integer'],
            'pcode'             => ['required', 'string', 'max:255'],
            'country_id'        => ['required', 'integer'],
            'email'             => ['required', 'string', 'email', 'max:255'],
            'other_notes'       => ['required', 'string', 'max:255'],
            'post_secondary_edu'=> ['required', 'string', 'max:255'],
            'subjects_studied'  => ['required', 'string', 'max:255'],
            'tutoring_courses'  => ['required', 'string', 'max:255'],
            'work_experience'   => ['required', 'string', 'max:255'],
            'tutoring_areas'    => ['required', 'string', 'max:255'],
            'gender'            => ['required', 'string', 'max:255'],
            'certified'         => ['required', 'string', 'max:255'],
            'cr_radio'          => ['required', 'string', 'max:255'],
            'cc_radio'          => ['required', 'string', 'max:255'],
        ]);
        if ($validator->fails())
        {
            $request->session()->flash('error', $validator->messages()->first());
            return redirect()->route('tutor.myprofile.index');
        }
        $data = $request->all();
        $myprofile->fname = $data['fname'];
        $myprofile->lname = $data['lname'];
        $myprofile->home_phone = $data['home_phone'];
        $myprofile->cell_phone = $data['cell_phone'];
        $myprofile->address = $data['address'];
        $myprofile->city = $data['city'];
        $myprofile->state_id = $data['state_id'];
        $myprofile->pcode = $data['pcode'];
        $myprofile->country_id = $data['country_id'];
        $myprofile->email = $data['email'];
        $myprofile->other_notes = $data['other_notes'];
        $myprofile->post_secondary_edu = $data['post_secondary_edu'];
        $myprofile->subjects_studied = $data['subjects_studied'];
        $myprofile->tutoring_courses = $data['tutoring_courses'];
        $myprofile->work_experience = $data['work_experience'];
        $myprofile->tutoring_areas = $data['tutoring_areas'];
        $myprofile->gender = $data['gender'];
        $myprofile->certified_teacher = $data['certified'];
        $myprofile->criminal_record = $data['cr_radio'];
        $myprofile->criminal_check = $data['cc_radio'];
        $myprofile ->password = Hash::make($data['password']);
        if(!$myprofile->save()) {
            $request->session()->flash('error', 'There is an error modifying your account information!');
            return redirect()->route('tutor.myprofile.index');
        }
        $request->session()->flash('success', 'You have modified your account information!');
        return redirect()->route('tutor.myprofile.index');
    }
public function update ( Request $ request , User $ myprofile ) { $ validator = Validator :: make ( $ request -> all ( ) , [ 'fname' => [ 'required' , 'string' , 'max:255' ] , 'lname' => [ 'required' , 'string' , 'max:255' ] , 'home_phone' => [ 'required' , 'string' , 'max:255' ] , 'cell_phone' => [ 'required' , 'string' , 'max:255' ] , 'password' => [ 'required' , 'string' , 'min:8' , 'confirmed' ] , 'address' => [ 'required' , 'string' , 'max:255' ] , 'city' => [ 'required' , 'string' , 'max:255' ] , 'state_id' => [ 'required' , 'integer' ] , 'pcode' => [ 'required' , 'string' , 'max:255' ] , 'country_id' => [ 'required' , 'integer' ] , 'email' => [ 'required' , 'string' , 'email' , 'max:255' ] , 'other_notes' => [ 'required' , 'string' , 'max:255' ] , 'post_secondary_edu' => [ 'required' , 'string' , 'max:255' ] , 'subjects_studied' => [ 'required' , 'string' , 'max:255' ] , 'tutoring_courses' => [ 'required' , 'string' , 'max:255' ] , 'work_experience' => [ 'required' , 'string' , 'max:255' ] , 'tutoring_areas' => [ 'required' , 'string' , 'max:255' ] , 'gender' => [ 'required' , 'string' , 'max:255' ] , 'certified' => [ 'required' , 'string' , 'max:255' ] , 'cr_radio' => [ 'required' , 'string' , 'max:255' ] , 'cc_radio' => [ 'required' , 'string' , 'max:255' ] , ] ) ; if ( $ validator -> fails ( ) ) { $ request -> session ( ) -> flash ( 'error' , $ validator -> messages ( ) -> first ( ) ) ; return redirect ( ) -> route ( 'tutor.myprofile.index' ) ; } $ data = $ request -> all ( ) ; $ myprofile -> fname = $ data [ 'fname' ] ; $ myprofile -> lname = $ data [ 'lname' ] ; $ myprofile -> home_phone = $ data [ 'home_phone' ] ; $ myprofile -> cell_phone = $ data [ 'cell_phone' ] ; $ myprofile -> address = $ data [ 'address' ] ; $ myprofile -> city = $ data [ 'city' ] ; $ myprofile -> state_id = $ data [ 'state_id' ] ; $ myprofile -> pcode = $ data [ 'pcode' ] ; $ myprofile -> country_id = $ data [ 'country_id' ] ; $ myprofile -> email = $ data [ 'email' ] ; $ myprofile -> other_notes = $ data [ 'other_notes' ] ; $ myprofile -> post_secondary_edu = $ data [ 'post_secondary_edu' ] ; $ myprofile -> subjects_studied = $ data [ 'subjects_studied' ] ; $ myprofile -> tutoring_courses = $ data [ 'tutoring_courses' ] ; $ myprofile -> work_experience = $ data [ 'work_experience' ] ; $ myprofile -> tutoring_areas = $ data [ 'tutoring_areas' ] ; $ myprofile -> gender = $ data [ 'gender' ] ; $ myprofile -> certified_teacher = $ data [ 'certified' ] ; $ myprofile -> criminal_record = $ data [ 'cr_radio' ] ; $ myprofile -> criminal_check = $ data [ 'cc_radio' ] ; $ myprofile -> password = Hash :: make ( $ data [ 'password' ] ) ; if ( ! $ myprofile -> save ( ) ) { $ request -> session ( ) -> flash ( 'error' , 'There is an error modifying your account information!' ) ; return redirect ( ) -> route ( 'tutor.myprofile.index' ) ; } $ request -> session ( ) -> flash ( 'success' , 'You have modified your account information!' ) ; return redirect ( ) -> route ( 'tutor.myprofile.index' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
//dd("aaa");