My Queue answers the question: "What orders do I need to work on today?" It shows two groups of orders, combined in a single prioritised list:
Resolved and closed orders are excluded. The tab badge count shows only directly assigned orders (not supplier group orders) so it reflects the user's personal workload.
Stores the supplier group the current user is responsible for. Valid values match keys in OrderMonitoring::SUPPLIER_CATEGORIES: IN_STOCK, EXPRS-MI, DEPO, TYC, PBI, CP. When set, unassigned orders from that supplier group appear in the queue below directly assigned orders. Can be set by the user or pre-populated in a future user-settings feature. Defaults to empty string (supplier group section not shown).
Accessible in blade as $this->myQueue. Uses the same base query structure as getLiveOrdersProperty() — joining orders → orders_items → shipments → suppliers → order_monitoring → users → items_status. Returns a paginated result set (50 per page) using a separate paginator key myQueuePage so it doesn't conflict with the All Orders tab pagination.
// Core filter — what defines "my queue" $query->where(function ($q) use ($userId) { // Group 1: directly assigned to me $q->where('om.assigned_to', $userId); // Group 2: unassigned in my supplier group (if set) if ($this->myQueueSupplierGroup) { $groupCodes = array_keys(array_filter( OrderMonitoring::SUPPLIER_CATEGORIES, fn ($cat) => $cat === $this->myQueueSupplierGroup )); if (!empty($groupCodes)) { $q->orWhere(function ($sub) use ($groupCodes) { $sub->whereNull('om.assigned_to') ->whereIn('sup.code', $groupCodes); }); } } }); // Exclude resolved/closed $query->whereNotIn( DB::raw("COALESCE(om.status, 'monitoring')"), ['resolved', 'closed'] ); // Sort: assigned-to-me first, then oldest first $query->orderByRaw("(COALESCE(om.assigned_to, 0) = ?) DESC", [$userId]) ->orderBy('o.date_placed', 'asc');
Accessible in blade as $this->myQueueCount. Returns the count of active (non-resolved, non-closed) orders directly assigned to the current user. Used for the badge count on the My Queue tab header. Intentionally does not count supplier group orders — the badge reflects only personal assignments.
return DB::table('order_monitoring') ->where('assigned_to', Auth::id()) ->whereNotIn('status', ['resolved', 'closed']) ->count();
| Group ($myQueueSupplierGroup) | Supplier Codes Matched |
|---|---|
| IN_STOCK | USANV, USATX, USAIL, USAFL, USAVA |
| EXPRS-MI | EXPRS-MI |
| DEPO | DEPO-EC, DEPO-WC, DEPO WILL CALL |
| TYC | TYC-EC |
| PBI | PBIVA |
| CP | KEY, KSI, MEYER, OCT |
| Criterion | Result | How Verified |
|---|---|---|
| My Queue shows orders assigned to logged-in user at the top | ✓ PASS | orderByRaw("assigned_to = {userId} DESC") puts assigned rows first |
| Orders in user's supplier group appear below assigned orders | ✓ PASS | Tinker test with IN_STOCK group returned 403,531 supplier-group rows correctly |
| Count badge shows only items assigned to current user | ✓ PASS | getMyQueueCountProperty() queries only assigned_to = userId |
| Empty state when no assigned orders | ✓ PASS | Returns empty paginator — blade view (Task 5) will render empty state message |
| PHP syntax clean | ✓ PASS | php -l USAutoMonitoring.php — no syntax errors |