You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
541 B
PHP
20 lines
541 B
PHP
<?php
|
|
namespace App\Models;
|
|
final class CloudInstance extends Model
|
|
{
|
|
protected $connection = 'default';
|
|
protected $table = 'cloud_instances';
|
|
protected $hidden = ['credential_cipher'];
|
|
|
|
public function serviceAvailable(?int $now = null): bool
|
|
{
|
|
if ((string) $this->service_status === 'exempt') {
|
|
return true;
|
|
}
|
|
$now ??= time();
|
|
return (string) $this->service_status === 'active'
|
|
&& $this->expires_at !== null
|
|
&& (int) $this->expires_at > $now;
|
|
}
|
|
}
|