Add tenant lifecycle view and limit controls
This commit is contained in:
27
app/Services/Tenant/TenantLifecycleLogger.php
Normal file
27
app/Services/Tenant/TenantLifecycleLogger.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Tenant;
|
||||
|
||||
use App\Models\Tenant;
|
||||
use App\Models\TenantLifecycleEvent;
|
||||
use App\Models\User;
|
||||
use Carbon\CarbonInterface;
|
||||
|
||||
class TenantLifecycleLogger
|
||||
{
|
||||
public function record(
|
||||
Tenant $tenant,
|
||||
string $type,
|
||||
array $payload = [],
|
||||
?User $actor = null,
|
||||
?CarbonInterface $occurredAt = null
|
||||
): TenantLifecycleEvent {
|
||||
return TenantLifecycleEvent::create([
|
||||
'tenant_id' => $tenant->getKey(),
|
||||
'actor_id' => $actor?->getKey(),
|
||||
'type' => $type,
|
||||
'payload' => $payload,
|
||||
'occurred_at' => $occurredAt ?? now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user