API: Update Customer

Request

Update a customer by ID using a PUT request:

PUT /customers/1

Request Body:


{
  "mobile": "01XXXXXXXX",
  "name": "John Doe",
  "gender": null,
  "age": null,
  "address": null,
  "passport_no": null,
  "nid": null,
  "nationality": null,
  "email": null,
  "status": null,
}
                

Sample Response:


{
  "status": "success",
  "code": 201,
  "message": "Customer created successfully",
  "data": {
    "data": {
        "id": 1
        "mobile": "01XXXXXXXX",
        "name": "John Doe",
        "gender": null,
        "age": null,
        "address": null,
        "passport_no": null,
        "nid": null,
        "nationality": null,
        "email": null,
        "total_trips": 0,
        "total_tickets": 0,
        "total_cancelled_tickets": 0,
    },
  }
}
                

Validation Rules:

  • mobile_number - Required, String, Length Max:255, must unique in customers table
  • name - Required, String, Length Max:255
  • gender - Nullable, String, Length Max:255
  • age - Nullable, Integer
  • address - Nullable, String, Length Max:255
  • passport_no - Nullable, String, Length Max:255
  • nid - Nullable, String, Length Max:255
  • nationality - Nullable, String, Length Max:255
  • email - Nullable, String, Length Max:255
  • status - Nullable, Integer, must be 0 (inactive) or 1 (active), defaults to 1