initial commit
This commit is contained in:
36
app/Models/VmidReservation.php
Normal file
36
app/Models/VmidReservation.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class VmidReservation extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'vmid',
|
||||
'customer_id',
|
||||
'status',
|
||||
'release_at',
|
||||
'released_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'vmid' => 'integer',
|
||||
'release_at' => 'datetime',
|
||||
'released_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function isBlocking(int $vmid): bool
|
||||
{
|
||||
return in_array($this->status, ['reserved', 'active', 'pending_release'], true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user