57 lines
1.2 KiB
PHP
57 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Traits\LogsModelActivity;
|
|
|
|
class Room extends Model
|
|
{
|
|
/** @use HasFactory<\Database\Factories\ArtistFactory> */
|
|
use HasFactory, LogsModelActivity;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'internal_ip',
|
|
'port',
|
|
'status',
|
|
'started_at',
|
|
'ended_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'name' => 'string',
|
|
'internal_ip' =>'string',
|
|
'port' => 'int',
|
|
'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);
|
|
}
|
|
}
|