find($clientId); $newList = []; foreach ($tickets->tickets as $ticket) { if (in_array($ticket->status, [0, 1, 2])) { $ticket->visible(['id', 'website', 'datanum', 'progress', 'status']); $newList[] = $ticket->toArray(); } } return $newList; } }