user()->can('shopfloor.access')) { abort(403); } $business_id = $request->session()->get('user.business_id'); $stats = $oeeService->dashboardStats($business_id); $workCenters = WorkCenter::forBusiness($business_id) ->with(['lineTemplate', 'maintenanceEquipment']) ->orderBy('name') ->get(); $recentEvents = ProductionEvent::forBusiness($business_id) ->with(['workCenter', 'workOrder', 'recordedBy']) ->latest('recorded_at') ->limit(10) ->get(); $todayOee = OeeSnapshot::forBusiness($business_id) ->with('workCenter') ->where('snapshot_date', now()->toDateString()) ->get(); return view('shopfloor::dashboard.index', compact('stats', 'workCenters', 'recentEvents', 'todayOee')); } }