Compare commits
No commits in common. "735159906d9f0e4d8c83019ddfc6d189e97def6d" and "f4f6928432babb981d3f8d6c87c2d55ff33ebdd6" have entirely different histories.
735159906d
...
f4f6928432
@ -244,7 +244,6 @@ public function register(Request $request)
|
|||||||
}
|
}
|
||||||
$emiratesIdDob = $emiratesIdInput['date_of_birth'] ?? $emiratesIdInput['date of birth'] ?? $emiratesIdInput['dob'] ?? null;
|
$emiratesIdDob = $emiratesIdInput['date_of_birth'] ?? $emiratesIdInput['date of birth'] ?? $emiratesIdInput['dob'] ?? null;
|
||||||
$emiratesIdNationality = $emiratesIdInput['nationality'] ?? null;
|
$emiratesIdNationality = $emiratesIdInput['nationality'] ?? null;
|
||||||
$emiratesIdGender = $emiratesIdInput['gender'] ?? $emiratesIdInput['sex'] ?? null;
|
|
||||||
$emiratesIdIssueDate = $emiratesIdInput['issue_date'] ?? $emiratesIdInput['issue date'] ?? null;
|
$emiratesIdIssueDate = $emiratesIdInput['issue_date'] ?? $emiratesIdInput['issue date'] ?? null;
|
||||||
$emiratesIdEmployer = $emiratesIdInput['employer'] ?? null;
|
$emiratesIdEmployer = $emiratesIdInput['employer'] ?? null;
|
||||||
$emiratesIdIssuePlace = $emiratesIdInput['issue_place'] ?? $emiratesIdInput['issue place'] ?? null;
|
$emiratesIdIssuePlace = $emiratesIdInput['issue_place'] ?? $emiratesIdInput['issue place'] ?? null;
|
||||||
@ -280,8 +279,6 @@ public function register(Request $request)
|
|||||||
'emirates_id_employer' => $emiratesIdEmployer,
|
'emirates_id_employer' => $emiratesIdEmployer,
|
||||||
'emirates_id_issue_place' => $emiratesIdIssuePlace,
|
'emirates_id_issue_place' => $emiratesIdIssuePlace,
|
||||||
'emirates_id_occupation' => $emiratesIdOccupation,
|
'emirates_id_occupation' => $emiratesIdOccupation,
|
||||||
'emirates_id_nationality' => $emiratesIdNationality,
|
|
||||||
'emirates_id_gender' => $emiratesIdGender,
|
|
||||||
'address' => $request->address,
|
'address' => $request->address,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@ -38,20 +38,33 @@ public function getProfile(Request $request)
|
|||||||
'name' => $employer->name,
|
'name' => $employer->name,
|
||||||
'email' => $employer->email,
|
'email' => $employer->email,
|
||||||
'phone' => $profile->phone,
|
'phone' => $profile->phone,
|
||||||
'country' => $profile->country,
|
'address' => $profile->address,
|
||||||
'language' => $profile->language ?? 'English',
|
|
||||||
'notifications' => (bool)($profile->notifications ?? true),
|
'notifications' => (bool)($profile->notifications ?? true),
|
||||||
'verification_status' => $profile->verification_status ?? 'approved',
|
'verification_status' => $profile->verification_status ?? 'approved',
|
||||||
|
'emirates_id_number' => $profile->emirates_id_number,
|
||||||
|
'emirates_id_expiry' => $profile->emirates_id_expiry,
|
||||||
|
'id_number' => $profile->emirates_id_number,
|
||||||
|
'card_number' => $profile->emirates_id_card_number,
|
||||||
|
'full_name' => $profile->emirates_id_name,
|
||||||
|
'date_of_birth' => $profile->emirates_id_dob,
|
||||||
|
'nationality' => $profile->nationality,
|
||||||
|
'gender' => $profile->emirates_id_gender,
|
||||||
|
'issue_date' => $profile->emirates_id_issue_date,
|
||||||
|
'expiry_date' => $profile->emirates_id_expiry,
|
||||||
|
'occupation' => $profile->emirates_id_occupation,
|
||||||
|
'employer' => $profile->emirates_id_employer,
|
||||||
|
'issuing_place' => $profile->emirates_id_issue_place,
|
||||||
'emirates_id' => [
|
'emirates_id' => [
|
||||||
'emirates_id_number' => $profile->emirates_id_number,
|
'emirates_id_number' => $profile->emirates_id_number,
|
||||||
'name' => $profile->emirates_id_name,
|
'name' => $profile->emirates_id_name,
|
||||||
'date_of_birth' => $profile->emirates_id_dob,
|
'date_of_birth' => $profile->emirates_id_dob,
|
||||||
|
'nationality' => $profile->nationality,
|
||||||
'issue_date' => $profile->emirates_id_issue_date,
|
'issue_date' => $profile->emirates_id_issue_date,
|
||||||
'expiry_date' => $profile->emirates_id_expiry,
|
'expiry_date' => $profile->emirates_id_expiry,
|
||||||
'employer' => $profile->emirates_id_employer,
|
'employer' => $profile->emirates_id_employer,
|
||||||
'issue_place' => $profile->emirates_id_issue_place,
|
'issue_place' => $profile->emirates_id_issue_place,
|
||||||
'occupation' => $profile->emirates_id_occupation,
|
'occupation' => $profile->emirates_id_occupation,
|
||||||
'nationality' => $profile->emirates_id_nationality,
|
'card_number' => $profile->emirates_id_card_number,
|
||||||
'gender' => $profile->emirates_id_gender,
|
'gender' => $profile->emirates_id_gender,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
@ -264,20 +277,33 @@ public function updateProfile(Request $request)
|
|||||||
'name' => $employer->name,
|
'name' => $employer->name,
|
||||||
'email' => $employer->email,
|
'email' => $employer->email,
|
||||||
'phone' => $profile->phone,
|
'phone' => $profile->phone,
|
||||||
'country' => $profile->country,
|
'address' => $profile->address,
|
||||||
'language' => $profile->language,
|
|
||||||
'notifications' => (bool)$profile->notifications,
|
'notifications' => (bool)$profile->notifications,
|
||||||
'verification_status' => $profile->verification_status ?? 'approved',
|
'verification_status' => $profile->verification_status ?? 'approved',
|
||||||
|
'emirates_id_number' => $profile->emirates_id_number,
|
||||||
|
'emirates_id_expiry' => $profile->emirates_id_expiry,
|
||||||
|
'id_number' => $profile->emirates_id_number,
|
||||||
|
'card_number' => $profile->emirates_id_card_number,
|
||||||
|
'full_name' => $profile->emirates_id_name,
|
||||||
|
'date_of_birth' => $profile->emirates_id_dob,
|
||||||
|
'nationality' => $profile->nationality,
|
||||||
|
'gender' => $profile->emirates_id_gender,
|
||||||
|
'issue_date' => $profile->emirates_id_issue_date,
|
||||||
|
'expiry_date' => $profile->emirates_id_expiry,
|
||||||
|
'occupation' => $profile->emirates_id_occupation,
|
||||||
|
'employer' => $profile->emirates_id_employer,
|
||||||
|
'issuing_place' => $profile->emirates_id_issue_place,
|
||||||
'emirates_id' => [
|
'emirates_id' => [
|
||||||
'emirates_id_number' => $profile->emirates_id_number,
|
'emirates_id_number' => $profile->emirates_id_number,
|
||||||
'name' => $profile->emirates_id_name,
|
'name' => $profile->emirates_id_name,
|
||||||
'date_of_birth' => $profile->emirates_id_dob,
|
'date_of_birth' => $profile->emirates_id_dob,
|
||||||
|
'nationality' => $profile->nationality,
|
||||||
'issue_date' => $profile->emirates_id_issue_date,
|
'issue_date' => $profile->emirates_id_issue_date,
|
||||||
'expiry_date' => $profile->emirates_id_expiry,
|
'expiry_date' => $profile->emirates_id_expiry,
|
||||||
'employer' => $profile->emirates_id_employer,
|
'employer' => $profile->emirates_id_employer,
|
||||||
'issue_place' => $profile->emirates_id_issue_place,
|
'issue_place' => $profile->emirates_id_issue_place,
|
||||||
'occupation' => $profile->emirates_id_occupation,
|
'occupation' => $profile->emirates_id_occupation,
|
||||||
'nationality' => $profile->emirates_id_nationality,
|
'card_number' => $profile->emirates_id_card_number,
|
||||||
'gender' => $profile->emirates_id_gender,
|
'gender' => $profile->emirates_id_gender,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -66,13 +66,48 @@ public function register(Request $request)
|
|||||||
|
|
||||||
$licenseExpiry = $request->license_expiry;
|
$licenseExpiry = $request->license_expiry;
|
||||||
$licenseInput = $request->input('license');
|
$licenseInput = $request->input('license');
|
||||||
$licenseNumber = null;
|
$licenseData = null;
|
||||||
if (is_array($licenseInput)) {
|
if (is_array($licenseInput)) {
|
||||||
$rawExpiry = $licenseInput['expiry_date'] ?? $licenseInput['license_expiry'] ?? null;
|
$licenseExpiry = $licenseExpiry ?? ($licenseInput['expiry_date'] ?? $licenseInput['license_expiry'] ?? null);
|
||||||
if ($rawExpiry) {
|
$licenseData = [
|
||||||
$licenseExpiry = $licenseExpiry ?? \App\Services\OcrDocumentService::normaliseDate($rawExpiry);
|
'document_type' => $licenseInput['document_type'] ?? null,
|
||||||
|
'country' => $licenseInput['country'] ?? null,
|
||||||
|
'authority' => $licenseInput['authority'] ?? null,
|
||||||
|
'license_no' => $licenseInput['license_no'] ?? $licenseInput['license_number'] ?? null,
|
||||||
|
'company_name' => $licenseInput['company_name'] ?? $licenseInput['organization_name'] ?? null,
|
||||||
|
'business_name' => $licenseInput['business_name'] ?? null,
|
||||||
|
'license_category' => $licenseInput['license_category'] ?? null,
|
||||||
|
'legal_type' => $licenseInput['legal_type'] ?? null,
|
||||||
|
'issue_date' => $licenseInput['issue_date'] ?? null,
|
||||||
|
'expiry_date' => $licenseInput['expiry_date'] ?? ($licenseInput['license_expiry'] ?? null),
|
||||||
|
'main_license_no' => $licenseInput['main_license_no'] ?? null,
|
||||||
|
'register_no' => $licenseInput['register_no'] ?? null,
|
||||||
|
'dcci_no' => $licenseInput['dcci_no'] ?? null,
|
||||||
|
'members' => $licenseInput['members'] ?? null,
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$licenseData = [
|
||||||
|
'document_type' => $request->document_type,
|
||||||
|
'country' => $request->country,
|
||||||
|
'authority' => $request->authority,
|
||||||
|
'license_no' => $request->license_no,
|
||||||
|
'company_name' => $request->company_name,
|
||||||
|
'business_name' => $request->business_name,
|
||||||
|
'license_category' => $request->license_category,
|
||||||
|
'legal_type' => $request->legal_type,
|
||||||
|
'issue_date' => $request->issue_date,
|
||||||
|
'expiry_date' => $request->expiry_date,
|
||||||
|
'main_license_no' => $request->main_license_no,
|
||||||
|
'register_no' => $request->register_no,
|
||||||
|
'dcci_no' => $request->dcci_no,
|
||||||
|
'members' => $request->members,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
$licenseNumber = $licenseInput['license_number'] ?? $licenseInput['license_no'] ?? $licenseInput['document_number'] ?? null;
|
|
||||||
|
if (is_array($licenseData)) {
|
||||||
|
$licenseData = array_filter($licenseData, function ($val) {
|
||||||
|
return !is_null($val);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$emiratesIdInput = $request->input('emirates_id');
|
$emiratesIdInput = $request->input('emirates_id');
|
||||||
@ -95,7 +130,6 @@ public function register(Request $request)
|
|||||||
}
|
}
|
||||||
$emiratesIdDob = $emiratesIdInput['date_of_birth'] ?? $emiratesIdInput['date of birth'] ?? $emiratesIdInput['dob'] ?? null;
|
$emiratesIdDob = $emiratesIdInput['date_of_birth'] ?? $emiratesIdInput['date of birth'] ?? $emiratesIdInput['dob'] ?? null;
|
||||||
$emiratesIdNationality = $emiratesIdInput['nationality'] ?? null;
|
$emiratesIdNationality = $emiratesIdInput['nationality'] ?? null;
|
||||||
$emiratesIdGender = $emiratesIdInput['gender'] ?? $emiratesIdInput['sex'] ?? null;
|
|
||||||
$emiratesIdIssueDate = $emiratesIdInput['issue_date'] ?? $emiratesIdInput['issue date'] ?? null;
|
$emiratesIdIssueDate = $emiratesIdInput['issue_date'] ?? $emiratesIdInput['issue date'] ?? null;
|
||||||
$emiratesIdEmployer = $emiratesIdInput['employer'] ?? null;
|
$emiratesIdEmployer = $emiratesIdInput['employer'] ?? null;
|
||||||
$emiratesIdIssuePlace = $emiratesIdInput['issue_place'] ?? $emiratesIdInput['issue place'] ?? null;
|
$emiratesIdIssuePlace = $emiratesIdInput['issue_place'] ?? $emiratesIdInput['issue place'] ?? null;
|
||||||
@ -108,7 +142,7 @@ public function register(Request $request)
|
|||||||
$apiToken = Str::random(80);
|
$apiToken = Str::random(80);
|
||||||
|
|
||||||
$sponsor = DB::transaction(function () use (
|
$sponsor = DB::transaction(function () use (
|
||||||
$request, $email, $licensePath, $emiratesIdPath, $emiratesId, $apiToken, $licenseExpiry, $licenseNumber, $licenseInput,
|
$request, $email, $licensePath, $emiratesIdPath, $emiratesId, $apiToken, $licenseExpiry,
|
||||||
$emiratesIdExpiry, $emiratesIdName, $emiratesIdDob, $emiratesIdIssueDate, $emiratesIdEmployer,
|
$emiratesIdExpiry, $emiratesIdName, $emiratesIdDob, $emiratesIdIssueDate, $emiratesIdEmployer,
|
||||||
$emiratesIdIssuePlace, $emiratesIdOccupation, $licenseData
|
$emiratesIdIssuePlace, $emiratesIdOccupation, $licenseData
|
||||||
) {
|
) {
|
||||||
@ -126,8 +160,6 @@ public function register(Request $request)
|
|||||||
'emirates_id_file' => $emiratesIdPath,
|
'emirates_id_file' => $emiratesIdPath,
|
||||||
'emirates_id' => $emiratesId,
|
'emirates_id' => $emiratesId,
|
||||||
'license_expiry' => $licenseExpiry,
|
'license_expiry' => $licenseExpiry,
|
||||||
'license_number' => $licenseNumber,
|
|
||||||
'license_data' => $licenseInput,
|
|
||||||
'status' => 'active',
|
'status' => 'active',
|
||||||
'is_verified' => false,
|
'is_verified' => false,
|
||||||
'subscription_status' => 'none',
|
'subscription_status' => 'none',
|
||||||
@ -140,8 +172,7 @@ public function register(Request $request)
|
|||||||
'emirates_id_employer' => $emiratesIdEmployer,
|
'emirates_id_employer' => $emiratesIdEmployer,
|
||||||
'emirates_id_issue_place' => $emiratesIdIssuePlace,
|
'emirates_id_issue_place' => $emiratesIdIssuePlace,
|
||||||
'emirates_id_occupation' => $emiratesIdOccupation,
|
'emirates_id_occupation' => $emiratesIdOccupation,
|
||||||
'emirates_id_nationality' => $emiratesIdNationality,
|
'license_data' => $licenseData,
|
||||||
'emirates_id_gender' => $emiratesIdGender,
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -157,38 +188,7 @@ public function register(Request $request)
|
|||||||
'success' => true,
|
'success' => true,
|
||||||
'message' => 'Sponsor account registered successfully. Your license is pending admin review.',
|
'message' => 'Sponsor account registered successfully. Your license is pending admin review.',
|
||||||
'data' => [
|
'data' => [
|
||||||
'sponsor' => [
|
'sponsor' => $sponsor->makeHidden(['password', 'api_token']),
|
||||||
'id' => $sponsor->id,
|
|
||||||
'full_name' => $sponsor->full_name,
|
|
||||||
'organization_name' => $sponsor->organization_name,
|
|
||||||
'mobile' => $sponsor->mobile,
|
|
||||||
'email' => $sponsor->email,
|
|
||||||
'nationality' => $sponsor->nationality,
|
|
||||||
'city' => $sponsor->city,
|
|
||||||
'address' => $sponsor->address,
|
|
||||||
'country_code' => $sponsor->country_code,
|
|
||||||
'is_verified' => $sponsor->is_verified,
|
|
||||||
'status' => $sponsor->status,
|
|
||||||
'license_file' => $sponsor->license_file ? asset($sponsor->license_file) : null,
|
|
||||||
'emirates_id_file' => $sponsor->emirates_id_file ? asset($sponsor->emirates_id_file) : null,
|
|
||||||
'license_expiry' => $sponsor->license_expiry ? $sponsor->license_expiry->toDateString() : null,
|
|
||||||
'license_number' => $sponsor->license_number,
|
|
||||||
'license' => $sponsor->license_data,
|
|
||||||
'validity' => $sponsor->license_expiry ? ($sponsor->license_expiry->isFuture() ? 'Valid' : 'Expired') : 'Pending Review',
|
|
||||||
'joined_at' => $sponsor->created_at->toIso8601String(),
|
|
||||||
'emirates_id' => [
|
|
||||||
'emirates_id_number' => $sponsor->emirates_id,
|
|
||||||
'name' => $sponsor->emirates_id_name,
|
|
||||||
'date_of_birth' => $sponsor->emirates_id_dob,
|
|
||||||
'issue_date' => $sponsor->emirates_id_issue_date,
|
|
||||||
'expiry_date' => $sponsor->emirates_id_expiry,
|
|
||||||
'employer' => $sponsor->emirates_id_employer,
|
|
||||||
'issue_place' => $sponsor->emirates_id_issue_place,
|
|
||||||
'occupation' => $sponsor->emirates_id_occupation,
|
|
||||||
'nationality' => $sponsor->emirates_id_nationality,
|
|
||||||
'gender' => $sponsor->emirates_id_gender,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'token' => $apiToken,
|
'token' => $apiToken,
|
||||||
]
|
]
|
||||||
], 201);
|
], 201);
|
||||||
@ -264,36 +264,7 @@ public function login(Request $request)
|
|||||||
'success' => true,
|
'success' => true,
|
||||||
'message' => 'Login successful.',
|
'message' => 'Login successful.',
|
||||||
'data' => [
|
'data' => [
|
||||||
'sponsor' => [
|
'sponsor' => $sponsor->makeHidden(['password', 'api_token']),
|
||||||
'id' => $sponsor->id,
|
|
||||||
'full_name' => $sponsor->full_name,
|
|
||||||
'organization_name' => $sponsor->organization_name,
|
|
||||||
'mobile' => $sponsor->mobile,
|
|
||||||
'email' => $sponsor->email,
|
|
||||||
'nationality' => $sponsor->nationality,
|
|
||||||
'city' => $sponsor->city,
|
|
||||||
'address' => $sponsor->address,
|
|
||||||
'country_code' => $sponsor->country_code,
|
|
||||||
'is_verified' => $sponsor->is_verified,
|
|
||||||
'status' => $sponsor->status,
|
|
||||||
'license_file' => $sponsor->license_file ? asset($sponsor->license_file) : null,
|
|
||||||
'emirates_id_file' => $sponsor->emirates_id_file ? asset($sponsor->emirates_id_file) : null,
|
|
||||||
'license_expiry' => $sponsor->license_expiry ? $sponsor->license_expiry->toDateString() : null,
|
|
||||||
'license_number' => $sponsor->license_number,
|
|
||||||
'license' => $sponsor->license_data,
|
|
||||||
'validity' => $sponsor->license_expiry ? ($sponsor->license_expiry->isFuture() ? 'Valid' : 'Expired') : 'Pending Review',
|
|
||||||
'joined_at' => $sponsor->created_at->toIso8601String(),
|
|
||||||
'emirates_id' => [
|
|
||||||
'emirates_id_number' => $sponsor->emirates_id,
|
|
||||||
'name' => $sponsor->emirates_id_name,
|
|
||||||
'date_of_birth' => $sponsor->emirates_id_dob,
|
|
||||||
'issue_date' => $sponsor->emirates_id_issue_date,
|
|
||||||
'expiry_date' => $sponsor->emirates_id_expiry,
|
|
||||||
'employer' => $sponsor->emirates_id_employer,
|
|
||||||
'issue_place' => $sponsor->emirates_id_issue_place,
|
|
||||||
'occupation' => $sponsor->emirates_id_occupation,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'token' => $apiToken,
|
'token' => $apiToken,
|
||||||
]
|
]
|
||||||
], 200);
|
], 200);
|
||||||
@ -337,13 +308,10 @@ public function uploadLicense(Request $request)
|
|||||||
$licenseFile = $request->file('license_file');
|
$licenseFile = $request->file('license_file');
|
||||||
$ocrLicense = \App\Services\OcrDocumentService::extractSponsorLicenseData($licenseFile);
|
$ocrLicense = \App\Services\OcrDocumentService::extractSponsorLicenseData($licenseFile);
|
||||||
$extractedExpiry = $ocrLicense['expiry_date'];
|
$extractedExpiry = $ocrLicense['expiry_date'];
|
||||||
$extractedNumber = $ocrLicense['license_number'];
|
|
||||||
|
|
||||||
$sponsor->update([
|
$sponsor->update([
|
||||||
'license_file' => null,
|
'license_file' => null,
|
||||||
'license_expiry' => $extractedExpiry,
|
'license_expiry' => $extractedExpiry,
|
||||||
'license_number' => $extractedNumber,
|
|
||||||
'license_data' => $ocrLicense,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
|
|||||||
@ -66,22 +66,8 @@ public function getDashboard(Request $request)
|
|||||||
'license_file' => $sponsor->license_file ? asset($sponsor->license_file) : null,
|
'license_file' => $sponsor->license_file ? asset($sponsor->license_file) : null,
|
||||||
'emirates_id_file' => $sponsor->emirates_id_file ? asset($sponsor->emirates_id_file) : null,
|
'emirates_id_file' => $sponsor->emirates_id_file ? asset($sponsor->emirates_id_file) : null,
|
||||||
'license_expiry' => $sponsor->license_expiry ? $sponsor->license_expiry->toDateString() : null,
|
'license_expiry' => $sponsor->license_expiry ? $sponsor->license_expiry->toDateString() : null,
|
||||||
'license_number' => $sponsor->license_number,
|
|
||||||
'license' => $sponsor->license_data,
|
|
||||||
'validity' => $sponsor->license_expiry ? ($sponsor->license_expiry->isFuture() ? 'Valid' : 'Expired') : 'Pending Review',
|
'validity' => $sponsor->license_expiry ? ($sponsor->license_expiry->isFuture() ? 'Valid' : 'Expired') : 'Pending Review',
|
||||||
'joined_at' => $sponsor->created_at->toIso8601String(),
|
'joined_at' => $sponsor->created_at->toIso8601String(),
|
||||||
'emirates_id' => [
|
|
||||||
'emirates_id_number' => $sponsor->emirates_id,
|
|
||||||
'name' => $sponsor->emirates_id_name,
|
|
||||||
'date_of_birth' => $sponsor->emirates_id_dob,
|
|
||||||
'issue_date' => $sponsor->emirates_id_issue_date,
|
|
||||||
'expiry_date' => $sponsor->emirates_id_expiry,
|
|
||||||
'employer' => $sponsor->emirates_id_employer,
|
|
||||||
'issue_place' => $sponsor->emirates_id_issue_place,
|
|
||||||
'occupation' => $sponsor->emirates_id_occupation,
|
|
||||||
'nationality' => $sponsor->emirates_id_nationality,
|
|
||||||
'gender' => $sponsor->emirates_id_gender,
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
'recent_charity_events' => $recentEvents,
|
'recent_charity_events' => $recentEvents,
|
||||||
'total_events' => Announcement::where(function ($q) use ($sponsorId) {
|
'total_events' => Announcement::where(function ($q) use ($sponsorId) {
|
||||||
@ -319,38 +305,7 @@ public function getProfile(Request $request)
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'data' => [
|
'data' => [
|
||||||
'sponsor' => [
|
'sponsor' => $this->buildSponsorResponse($sponsor)
|
||||||
'id' => $sponsor->id,
|
|
||||||
'full_name' => $sponsor->full_name,
|
|
||||||
'organization_name' => $sponsor->organization_name,
|
|
||||||
'mobile' => $sponsor->mobile,
|
|
||||||
'email' => $sponsor->email,
|
|
||||||
'nationality' => $sponsor->nationality,
|
|
||||||
'city' => $sponsor->city,
|
|
||||||
'address' => $sponsor->address,
|
|
||||||
'country_code' => $sponsor->country_code,
|
|
||||||
'is_verified' => $sponsor->is_verified,
|
|
||||||
'status' => $sponsor->status,
|
|
||||||
'license_file' => $sponsor->license_file ? asset($sponsor->license_file) : null,
|
|
||||||
'emirates_id_file' => $sponsor->emirates_id_file ? asset($sponsor->emirates_id_file) : null,
|
|
||||||
'license_expiry' => $sponsor->license_expiry ? $sponsor->license_expiry->toDateString() : null,
|
|
||||||
'license_number' => $sponsor->license_number,
|
|
||||||
'license' => $sponsor->license_data,
|
|
||||||
'validity' => $sponsor->license_expiry ? ($sponsor->license_expiry->isFuture() ? 'Valid' : 'Expired') : 'Pending Review',
|
|
||||||
'joined_at' => $sponsor->created_at->toIso8601String(),
|
|
||||||
'emirates_id' => [
|
|
||||||
'emirates_id_number' => $sponsor->emirates_id,
|
|
||||||
'name' => $sponsor->emirates_id_name,
|
|
||||||
'date_of_birth' => $sponsor->emirates_id_dob,
|
|
||||||
'issue_date' => $sponsor->emirates_id_issue_date,
|
|
||||||
'expiry_date' => $sponsor->emirates_id_expiry,
|
|
||||||
'employer' => $sponsor->emirates_id_employer,
|
|
||||||
'issue_place' => $sponsor->emirates_id_issue_place,
|
|
||||||
'occupation' => $sponsor->emirates_id_occupation,
|
|
||||||
'nationality' => $sponsor->emirates_id_nationality,
|
|
||||||
'gender' => $sponsor->emirates_id_gender,
|
|
||||||
],
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,6 @@ class EmployerProfile extends Model
|
|||||||
'emirates_id_employer',
|
'emirates_id_employer',
|
||||||
'emirates_id_issue_place',
|
'emirates_id_issue_place',
|
||||||
'emirates_id_occupation',
|
'emirates_id_occupation',
|
||||||
'emirates_id_nationality',
|
|
||||||
'emirates_id_card_number',
|
'emirates_id_card_number',
|
||||||
'emirates_id_gender',
|
'emirates_id_gender',
|
||||||
'address',
|
'address',
|
||||||
|
|||||||
@ -43,12 +43,9 @@ class Sponsor extends Authenticatable
|
|||||||
'emirates_id_employer',
|
'emirates_id_employer',
|
||||||
'emirates_id_issue_place',
|
'emirates_id_issue_place',
|
||||||
'emirates_id_occupation',
|
'emirates_id_occupation',
|
||||||
'emirates_id_nationality',
|
|
||||||
'emirates_id_gender',
|
|
||||||
'license_number',
|
|
||||||
'license_data',
|
|
||||||
'emirates_id_card_number',
|
'emirates_id_card_number',
|
||||||
'emirates_id_gender',
|
'emirates_id_gender',
|
||||||
|
'license_data',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
|
|||||||
@ -162,7 +162,7 @@ public static function extractPassportData(UploadedFile $file): array
|
|||||||
* "2023-04-11" → "2023-04-11" (pass-through)
|
* "2023-04-11" → "2023-04-11" (pass-through)
|
||||||
* "11 APR 2023" → "2023-04-11"
|
* "11 APR 2023" → "2023-04-11"
|
||||||
*/
|
*/
|
||||||
public static function normaliseDate(string $raw): string
|
private static function normaliseDate(string $raw): string
|
||||||
{
|
{
|
||||||
$raw = trim($raw);
|
$raw = trim($raw);
|
||||||
if (empty($raw)) {
|
if (empty($raw)) {
|
||||||
|
|||||||
@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
Schema::table('sponsors', function (Blueprint $table) {
|
|
||||||
$table->string('license_number')->nullable()->after('license_expiry');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::table('sponsors', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('license_number');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
Schema::table('sponsors', function (Blueprint $table) {
|
|
||||||
$table->json('license_data')->nullable()->after('license_number');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::table('sponsors', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('license_data');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
Schema::table('sponsors', function (Blueprint $table) {
|
|
||||||
$table->string('emirates_id_nationality')->nullable()->after('emirates_id_name');
|
|
||||||
});
|
|
||||||
Schema::table('employer_profiles', function (Blueprint $table) {
|
|
||||||
$table->string('emirates_id_nationality')->nullable()->after('emirates_id_name');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::table('sponsors', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('emirates_id_nationality');
|
|
||||||
});
|
|
||||||
Schema::table('employer_profiles', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('emirates_id_nationality');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
Schema::table('sponsors', function (Blueprint $table) {
|
|
||||||
$table->string('emirates_id_gender')->nullable()->after('emirates_id_nationality');
|
|
||||||
});
|
|
||||||
Schema::table('employer_profiles', function (Blueprint $table) {
|
|
||||||
$table->string('emirates_id_gender')->nullable()->after('emirates_id_nationality');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::table('sponsors', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('emirates_id_gender');
|
|
||||||
});
|
|
||||||
Schema::table('employer_profiles', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('emirates_id_gender');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -74,6 +74,78 @@
|
|||||||
"expiry_date": {
|
"expiry_date": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "2028-06-12"
|
"example": "2028-06-12"
|
||||||
|
},
|
||||||
|
"document_type": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "dubai_commercial_license"
|
||||||
|
},
|
||||||
|
"country": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "United Arab Emirates"
|
||||||
|
},
|
||||||
|
"authority": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Dubai Economy and Tourism"
|
||||||
|
},
|
||||||
|
"license_no": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "828302"
|
||||||
|
},
|
||||||
|
"company_name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "MSJ INTERNATIONAL TECHNICAL SERVICES L.L.C"
|
||||||
|
},
|
||||||
|
"business_name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "MSJ INTERNATIONAL TECHNICAL SERVICES L.L.C"
|
||||||
|
},
|
||||||
|
"license_category": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Dep. of Economic Development"
|
||||||
|
},
|
||||||
|
"legal_type": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Limited Liability Company Single Owner(LLC- - SO)"
|
||||||
|
},
|
||||||
|
"issue_date": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "06/03/2019"
|
||||||
|
},
|
||||||
|
"main_license_no": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "828302"
|
||||||
|
},
|
||||||
|
"register_no": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "1656486"
|
||||||
|
},
|
||||||
|
"dcci_no": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "317412"
|
||||||
|
},
|
||||||
|
"members": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"person_no": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "752967"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Lo lo wallus issued in"
|
||||||
|
},
|
||||||
|
"nationality": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "India"
|
||||||
|
},
|
||||||
|
"role": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Shares Owner Who"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -93,10 +165,6 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "NPL"
|
"example": "NPL"
|
||||||
},
|
},
|
||||||
"gender": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "Male"
|
|
||||||
},
|
|
||||||
"date_of_birth": {
|
"date_of_birth": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "1988-03-22"
|
"example": "1988-03-22"
|
||||||
@ -6630,6 +6698,144 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "fcm_token_example"
|
"example": "fcm_token_example"
|
||||||
},
|
},
|
||||||
|
"license": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"license_number": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "828302"
|
||||||
|
},
|
||||||
|
"organization_name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "MSJ INTERNATIONAL TECHNICAL SERVICES L.L.C"
|
||||||
|
},
|
||||||
|
"expiry_date": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2026-05-03"
|
||||||
|
},
|
||||||
|
"document_type": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "dubai_commercial_license"
|
||||||
|
},
|
||||||
|
"country": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "United Arab Emirates"
|
||||||
|
},
|
||||||
|
"authority": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Dubai Economy and Tourism"
|
||||||
|
},
|
||||||
|
"license_no": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "828302"
|
||||||
|
},
|
||||||
|
"company_name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "MSJ INTERNATIONAL TECHNICAL SERVICES L.L.C"
|
||||||
|
},
|
||||||
|
"business_name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "MSJ INTERNATIONAL TECHNICAL SERVICES L.L.C"
|
||||||
|
},
|
||||||
|
"license_category": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Dep. of Economic Development"
|
||||||
|
},
|
||||||
|
"legal_type": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Limited Liability Company Single Owner(LLC- - SO)"
|
||||||
|
},
|
||||||
|
"issue_date": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "06/03/2019"
|
||||||
|
},
|
||||||
|
"main_license_no": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "828302"
|
||||||
|
},
|
||||||
|
"register_no": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "1656486"
|
||||||
|
},
|
||||||
|
"dcci_no": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "317412"
|
||||||
|
},
|
||||||
|
"members": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"person_no": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "752967"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Lo lo wallus issued in"
|
||||||
|
},
|
||||||
|
"nationality": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "India"
|
||||||
|
},
|
||||||
|
"role": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Shares Owner Who"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"emirates_id": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"emirates_id_number": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "784-1988-5310327-2"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "KRISHNA PRASAD"
|
||||||
|
},
|
||||||
|
"nationality": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "NPL"
|
||||||
|
},
|
||||||
|
"date_of_birth": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "1988-03-22"
|
||||||
|
},
|
||||||
|
"expiry_date": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2028-04-11"
|
||||||
|
},
|
||||||
|
"issue_date": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "2023-04-11"
|
||||||
|
},
|
||||||
|
"employer": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Federal Authority"
|
||||||
|
},
|
||||||
|
"issue_place": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Abu Dhabi"
|
||||||
|
},
|
||||||
|
"occupation": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Manager"
|
||||||
|
},
|
||||||
|
"card_number": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "987654321"
|
||||||
|
},
|
||||||
|
"gender": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Male"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"created_at": {
|
"created_at": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user