LobbyModel.php 817 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\HttpModels;
  3. use App\Models\Lobby;
  4. use Carbon\Carbon;
  5. class LobbyModel extends ClientLobbyModel {
  6. public $isStrangerAccessible;
  7. public $isClientAccessible;
  8. public $isActive;
  9. public $lobbyProAccessLevel;
  10. public $meetings = [];
  11. public function __construct(Lobby $lobby)
  12. {
  13. parent::__construct($lobby);
  14. $this->isStrangerAccessible = $lobby->is_stranger_accessible;
  15. $this->isClientAccessible = $lobby->is_client_accessible;
  16. $this->isActive = $lobby->is_active;
  17. $this->lobbyProAccessLevel = $lobby->lobby_pro_access_level;
  18. foreach ($lobby->meetings()->where('meeting.is_active',true)->where('created_at','>=',Carbon::today())->get() as $meeting) {
  19. $this->meetings[] = new MeetingModel($meeting);
  20. }
  21. }
  22. }