27 lines
641 B
PHP
27 lines
641 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Concerns\BelongsToTenant;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Str;
|
|
|
|
class TenantEncryptionKey extends Model
|
|
{
|
|
use BelongsToTenant;
|
|
|
|
protected $fillable = ['tenant_id', 'version', 'wrapped_key', 'is_active', 'source', 'created_by', 'retired_at'];
|
|
|
|
protected $hidden = ['wrapped_key'];
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::creating(fn (self $key) => $key->uuid ??= (string) Str::uuid());
|
|
}
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['is_active' => 'boolean', 'retired_at' => 'immutable_datetime'];
|
|
}
|
|
}
|