mohan #5

Merged
mohanmd merged 46 commits from mohan into master 2026-06-15 09:13:23 +00:00
4 changed files with 19 additions and 4 deletions
Showing only changes of commit 56d25bed7f - Show all commits

View File

@ -67,7 +67,8 @@ public function createAnnouncement(Request $request)
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [
'title' => 'required|string|max:255', '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', 'type' => 'nullable|string|in:info,warning,success',
]); ]);
@ -80,9 +81,23 @@ public function createAnnouncement(Request $request)
} }
try { 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([ $announcement = Announcement::create([
'title' => $request->title, 'title' => $request->title,
'body' => $request->body, 'body' => $bodyText,
'type' => $request->type ?? 'info', 'type' => $request->type ?? 'info',
'employer_id' => $employer->id, 'employer_id' => $employer->id,
]); ]);

View File

@ -219,7 +219,7 @@ public function setupProfile(Request $request)
'experience' => 'Not Specified', 'experience' => 'Not Specified',
'religion' => 'Not Specified', 'religion' => 'Not Specified',
'bio' => 'New worker on Migrant platform.', '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, 'verified' => false,
'status' => 'active', 'status' => 'active',
'api_token' => $apiToken, 'api_token' => $apiToken,
@ -342,7 +342,7 @@ public function register(Request $request)
'experience' => $request->experience ?? 'Not Specified', 'experience' => $request->experience ?? 'Not Specified',
'religion' => 'Not Specified', 'religion' => 'Not Specified',
'bio' => 'Hardworking and reliable General Helper available for immediate hire.', '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, 'verified' => false,
'status' => 'active', 'status' => 'active',
'api_token' => $apiToken, 'api_token' => $apiToken,

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB