Skip to content

Commit

Permalink
Update ProfileController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
sangnguyenplus authored Oct 6, 2024
1 parent 59a3afb commit 8f08537
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/Http/Controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;

class ProfileController extends Controller
{
Expand Down Expand Up @@ -76,8 +77,8 @@ public function updateAvatar(Request $request, BaseHttpResponse $response)
*
* @bodyParam name string required Name.
* @bodyParam email string Email.
* @bodyParam dob string required Date of birth.
* @bodyParam gender string Gender
* @bodyParam dob date nullable Date of birth (format: Y-m-d).
* @bodyParam gender string Gender (male, female, other).
* @bodyParam description string Description
* @bodyParam phone string required Phone.
*
Expand All @@ -93,10 +94,16 @@ public function updateProfile(Request $request, BaseHttpResponse $response)
'last_name' => ['nullable', 'required_without:name', 'string', 'max:120', 'min:2'],
'name' => ['nullable', 'required_without:first_name', 'string', 'max:120', 'min:2'],
'phone' => ['nullable', 'string', ...BaseHelper::getPhoneValidationRule(true)],
'dob' => 'required|max:15|min:8',
'gender' => 'nullable',
'description' => 'nullable',
'email' => 'nullable|max:60|min:6|email|unique:' . ApiHelper::getTable() . ',email,' . $userId,
'dob' => ['nullable', 'sometimes', 'date_format:' . BaseHelper::getDateFormat(), 'max:20'],
'gender' => ['nullable', 'string', Rule::in(['male', 'female', 'other'])],
'description' => ['nullable', 'string', 'max:1000'],
'email' => [
'nullable',
'max:60',
'min:6',
'email',
'unique:' . ApiHelper::getTable() . ',email,' . $userId,
],
]);

if ($validator->fails()) {
Expand Down

0 comments on commit 8f08537

Please sign in to comment.