<?php namespace App\Http\Controllers; use App\Models\{AttendanceRecord,Task,ProjectMember,LeaveRequest,Announcement}; class EmployeePortalController extends Controller { public function dashboard(){ $u=request()->user(); return view('portal.employee',['attendance'=>AttendanceRecord::where('user_id',$u->id)->whereDate('work_date',today())->first(),'tasks'=>Task::where('primary_assignee_id',$u->id)->whereNotIn('status',['completed','cancelled'])->orderBy('due_date')->limit(8)->get(),'projects'=>ProjectMember::with('project')->where('user_id',$u->id)->whereNull('end_date')->get(),'leaves'=>LeaveRequest::where('user_id',$u->id)->latest()->limit(5)->get(),'announcements'=>Announcement::where('is_active',true)->whereIn('audience',['all','employees'])->latest('published_at')->limit(5)->get()]); } }