migrant-web/app/Http/Controllers/Employer/DashboardController.php
2026-05-15 17:40:21 +05:30

111 lines
4.3 KiB
PHP

<?php
namespace App\Http\Controllers\Employer;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Inertia\Inertia;
class DashboardController extends Controller
{
public function index(Request $request)
{
$sess = session('user');
$user = is_array($sess) ? (object)$sess : ($sess ?? (object)[
'name' => 'John Doe',
'subscription_status' => 'active',
'subscription_expires_at' => now()->addDays(24)->format('Y-m-d'),
]);
return Inertia::render('Employer/Dashboard', [
'employer' => [
'name' => $user->name ?? 'John Doe',
'subscription_status' => $user->subscription_status ?? 'active',
'subscription_expires_at' => $user->subscription_expires_at ?? '2026-12-31',
'plan_name' => 'Premium Employer Pass',
],
'stats' => [
'shortlisted_count' => 4,
'messages_sent' => 18,
'profile_views_given' => 45,
'days_remaining' => 24,
],
'shortlisted_workers' => [
[
'id' => 101,
'name' => 'Maria Santos',
'nationality' => 'Philippines',
'skills' => ['Childcare', 'Cooking', 'Housekeeping'],
'availability' => 'Immediate',
'photo_url' => null,
'verified' => true,
],
[
'id' => 102,
'name' => 'Lakshmi Sharma',
'nationality' => 'India',
'skills' => ['Elderly Care', 'Cooking'],
'availability' => '2 Weeks',
'photo_url' => null,
'verified' => true,
],
[
'id' => 103,
'name' => 'Siti Aminah',
'nationality' => 'Indonesia',
'skills' => ['Housekeeping', 'Ironing'],
'availability' => 'Immediate',
'photo_url' => null,
'verified' => true,
],
[
'id' => 104,
'name' => 'Grace Osei',
'nationality' => 'Ghana',
'skills' => ['Childcare', 'English Tutoring'],
'availability' => '1 Month',
'photo_url' => null,
'verified' => false,
],
],
'recent_messages' => [
[
'id' => 201,
'worker_name' => 'Maria Santos',
'last_message' => 'Yes ma\'am, I am available for a video interview tomorrow at 10 AM.',
'unread' => true,
'sent_at' => '10 mins ago',
],
[
'id' => 202,
'worker_name' => 'Lakshmi Sharma',
'last_message' => 'I have 5 years of experience in Dubai taking care of elderly patients.',
'unread' => true,
'sent_at' => '2 hours ago',
],
[
'id' => 203,
'worker_name' => 'Siti Aminah',
'last_message' => 'Thank ma\'am for shortlisting my profile. Please let me know your offer.',
'unread' => false,
'sent_at' => '1 day ago',
],
],
'announcements' => [
[
'id' => 301,
'title' => 'New Visa Regulations Update',
'body' => 'The Ministry of Human Resources and Emiratisation has announced updated guidelines for domestic worker sponsorship starting this month.',
'created_at' => 'May 10, 2026',
],
[
'id' => 302,
'title' => 'Enhanced OCR Verification Active',
'body' => 'We have deployed upgraded OCR passport verification to ensure 100% legal compliance for all worker profiles on the platform.',
'created_at' => 'May 1, 2026',
],
],
]);
}
}