ProModel.php 654 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\HttpModels;
  3. use App\Models\Pro;
  4. class ProModel {
  5. public $uid;
  6. public $name;
  7. public $type;
  8. public $avatarFile;
  9. public $is_active_and_visible;
  10. public $lobbies = [];
  11. public function __construct(Pro $pro)
  12. {
  13. $this->uid = $pro->uid;
  14. $this->name = $pro->name_display;
  15. $this->type = $pro->pro_type;
  16. $this->avatarFile = $pro->profile_picture_base64;
  17. $this->is_active_and_visible = $pro->is_currently_clocked_in;
  18. foreach ($pro->lobbies()->where('lobby.is_active',true)->get() as $lobby) {
  19. $this->lobbies[] = new LobbyModel($lobby);
  20. }
  21. }
  22. }