Initial commit device-management
tests / ci (push) Has been cancelled

This commit is contained in:
Wian Drs
2026-08-25 09:42:00 +07:00
commit 1e80be180e
1159 changed files with 149545 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace App\Models;
use App\Enums\LicenseStatus;
use App\Models\Concerns\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Str;
class License extends Model
{
use BelongsToTenant;
protected $fillable = ['tenant_id', 'deployment_installation_id', 'license_key_hash', 'plan', 'status', 'max_devices', 'max_users', 'features', 'signed_payload', 'starts_at', 'expires_at', 'grace_until', 'issued_by'];
protected static function booted(): void
{
static::creating(fn (self $license) => $license->uuid ??= (string) Str::uuid());
}
protected function casts(): array
{
return ['status' => LicenseStatus::class, 'features' => 'array', 'starts_at' => 'immutable_datetime', 'expires_at' => 'immutable_datetime', 'grace_until' => 'immutable_datetime'];
}
public function installation(): BelongsTo
{
return $this->belongsTo(DeploymentInstallation::class, 'deployment_installation_id');
}
public function issuer(): BelongsTo
{
return $this->belongsTo(User::class, 'issued_by');
}
public function events(): HasMany
{
return $this->hasMany(LicenseEvent::class);
}
}