public static function countStatus($group, $status) { switch ($group) { case 'SSD-AMM': $q = ['SSD-AMM-GSL', 'SSD-CLOUD', 'SSD-AMM-SV', 'SSD-MOBILITY', 'SSD-DSC']; break; case 'SSD-BOM': $q = ['SSD-BOM', 'PSD-BOM']; break; case 'SSD-DEL': $q = ['SSD-DEL', 'PSD-DEL']; break; case 'SSD-FRA': $q = ['SSD-FRA']; break; case 'SSD-MOW': $q = ['SSD-MOW']; break; case 'SSD-SJO': $q = ['SSD-SJO', 'PSD-SJO']; break; default: ['SSD-AMM-GSL', 'SSD-CLOUD', 'SSD-AMM-SV', 'SSD-MOBILITY', 'SSD-BOM', 'PSD-BOM', 'SSD-DEL', 'PSD-DEL', 'SSD-FRA', 'SSD-MOW', 'SSD-SJO', 'PSD-SJO', 'SSD-DSC']; break; } $Ticket = Ticket::whereIn('requester', $q)->where('status', $status)->get(); return $Ticket->count(); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $groups = Customer::where('id', $this->my_customer_id)->first()->groups()->get(); $my_groups = []; foreach ($groups as $group) { $my_groups[] = $group->id; } //$tickets = Ticket::whereRaw('group_id in (' . implode(', ', $my_groups) . ')')->orderBy('updated_at', 'desc')->take(5)->get(); $tickets = Ticket::whereIn('group_id', $my_groups)->where('status_id', '1')->orderBy('updated_at', 'desc')->take(5)->get(); return view('layouts.dashboard.index', ['my_permissions' => $this->my_permissions, 'tickets' => $tickets]); }