api fixes
This commit is contained in:
parent
a32ed6c1fc
commit
56d25bed7f
@ -67,7 +67,8 @@ public function createAnnouncement(Request $request)
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'title' => 'required|string|max:255',
|
||||
'body' => 'required|string|max:5000',
|
||||
'body' => 'required_without:content|string|max:5000',
|
||||
'content' => 'required_without:body|string|max:5000',
|
||||
'type' => 'nullable|string|in:info,warning,success',
|
||||
]);
|
||||
|
||||
@ -80,9 +81,23 @@ public function createAnnouncement(Request $request)
|
||||
}
|
||||
|
||||
try {
|
||||
$bodyText = $request->body ?? $request->content;
|
||||
|
||||
// Append extra event details if they are provided
|
||||
$extras = [];
|
||||
if ($request->event_date) $extras[] = "Date: " . $request->event_date;
|
||||
if ($request->event_time) $extras[] = "Time: " . $request->event_time;
|
||||
if ($request->location_details) $extras[] = "Location: " . $request->location_details;
|
||||
if ($request->location_pin) $extras[] = "Map Pin: " . $request->location_pin;
|
||||
if ($request->provided_items) $extras[] = "Provided: " . $request->provided_items;
|
||||
|
||||
if (!empty($extras)) {
|
||||
$bodyText .= "\n\n" . implode("\n", $extras);
|
||||
}
|
||||
|
||||
$announcement = Announcement::create([
|
||||
'title' => $request->title,
|
||||
'body' => $request->body,
|
||||
'body' => $bodyText,
|
||||
'type' => $request->type ?? 'info',
|
||||
'employer_id' => $employer->id,
|
||||
]);
|
||||
|
||||
@ -219,7 +219,7 @@ public function setupProfile(Request $request)
|
||||
'experience' => 'Not Specified',
|
||||
'religion' => 'Not Specified',
|
||||
'bio' => 'New worker on Migrant platform.',
|
||||
'category_id' => 7, // Default: General Helper
|
||||
'category_id' => \App\Models\WorkerCategory::where('name', 'General Helper')->value('id') ?? 1,
|
||||
'verified' => false,
|
||||
'status' => 'active',
|
||||
'api_token' => $apiToken,
|
||||
@ -342,7 +342,7 @@ public function register(Request $request)
|
||||
'experience' => $request->experience ?? 'Not Specified',
|
||||
'religion' => 'Not Specified',
|
||||
'bio' => 'Hardworking and reliable General Helper available for immediate hire.',
|
||||
'category_id' => 7,
|
||||
'category_id' => \App\Models\WorkerCategory::where('name', 'General Helper')->value('id') ?? 1,
|
||||
'verified' => false,
|
||||
'status' => 'active',
|
||||
'api_token' => $apiToken,
|
||||
|
||||
BIN
public/uploads/documents/1779990582_passport_mds11.png
Normal file
BIN
public/uploads/documents/1779990582_passport_mds11.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 112 KiB |
BIN
public/uploads/documents/1779990582_visa_mds13.png
Normal file
BIN
public/uploads/documents/1779990582_visa_mds13.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 169 KiB |
Loading…
x
Reference in New Issue
Block a user