Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    api for modify customer profile

    General Discussion
    3
    11
    623
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cmpengineers last edited by

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • C
        cmpengineers last edited by

        wow not even any one would help !!!

        1 Reply Last reply Reply Quote 0
        • J
          Jyoti last edited by

          @cmpengineers
          Use PUT method to update customer profile.
          Data for all required fields need to be pass to update profile

          C 1 Reply Last reply Reply Quote 0
          • C
            cmpengineers @Jyoti last edited by

            Dear @Jyoti

            you mean i have to pass all these

            id :
            first_name:
            last_name:
            email:
            password:
            password_confirmation:
            gender:
            group :
            data_of_birth:
            phone:
            created_at:
            updated_at:

            Correct ?

            best regards

            1 Reply Last reply Reply Quote 0
            • J
              Jyoti last edited by

              No, need to pass only required fields and data for field that you want to update.

              C 1 Reply Last reply Reply Quote 0
              • C
                cmpengineers @Jyoti last edited by cmpengineers

                Dear @Jyoti

                from where do i check the required field ? from the Customer Model ?

                Best regards

                1 Reply Last reply Reply Quote 0
                • C
                  cmpengineers last edited by

                  Dear @Jyoti

                  i have found the function for the api

                   $customer = auth($this->guard)->user();
                  
                      $this->validate(request(), [
                          'first_name' => 'required',
                          'last_name' => 'required',
                          'gender' => 'required',
                          'date_of_birth' => 'nullable|date|before:today',
                          'email' => 'email|unique:customers,email,' . $customer->id,
                          'password' => 'confirmed|min:6'
                      ]);
                  

                  Route::put('customer/profile', 'SessionController@update');

                  when i tried to update it give me error Route [auth.login] in Postman

                  Screen Shot 2020-02-10 at 5.11.18 PM.png

                  Please advise

                  Best regards

                  1 Reply Last reply Reply Quote 0
                  • C
                    cmpengineers last edited by cmpengineers

                    Dear @Jyoti

                    How do you authenticate (login) and at the same time modify in Postman , im confused

                    Screen Shot 2020-02-10 at 5.21.37 PM.png

                    1 Reply Last reply Reply Quote 0
                    • C
                      cmpengineers last edited by

                      Dear @Jyoti

                      i managed to login and then create another link to modify its working but not sure why is asking for fields that i already is sending

                      Screen Shot 2020-02-10 at 5.21.37 PM.png

                      Best regards

                      1 Reply Last reply Reply Quote 0
                      • J
                        Jyoti last edited by

                        @cmpengineers
                        Make sure that in header content type application/json is added

                        1 Reply Last reply Reply Quote 0
                        • H
                          harismansoor last edited by

                          Make content-type as application/json and send put data in json formate
                          like

                          {
                                  "email": "new2@email.com",
                                  "first_name": "New",
                                  "last_name": "Name",
                                  "gender": "Male",
                                  "date_of_birth": null,
                                  "phone": null
                          }
                          
                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post