*/ use HasFactory, LogsModelActivity; protected $fillable = [ 'branch_id', 'floor', 'type', 'name', 'internal_ip', 'port', 'is_online', 'status', 'started_at', 'ended_at', ]; protected $hidden = [ 'internal_ip', 'port', ]; protected $casts = [ 'floor' => 'int', 'type' => \App\Enums\RoomType::class, 'name' => 'string', 'internal_ip' =>'string', 'port' => 'int', 'is_online' => 'boolean', 'status' => \App\Enums\RoomStatus::class, 'started_at' => 'datetime', 'ended_at' => 'datetime', ]; public function str_started_at(){ $str ="Not Set"; if($this->started_at !=null){ $str = $this->started_at; } return $str; } public function str_ended_at(){ $str ="Not Set"; if($this->ended_at !=null){ $str = $this->ended_at; } return $str; } public function branch() { return $this->belongsTo(Branch::class); } public function statusLogs() { return $this->hasMany(RoomStatusLog::class); } }