Implement compliance exports and retention overrides
This commit is contained in:
55
app/Models/RetentionOverride.php
Normal file
55
app/Models/RetentionOverride.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\RetentionOverrideScope;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class RetentionOverride extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\RetentionOverrideFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'scope',
|
||||
'tenant_id',
|
||||
'event_id',
|
||||
'reason',
|
||||
'note',
|
||||
'created_by_id',
|
||||
'released_by_id',
|
||||
'released_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'scope' => RetentionOverrideScope::class,
|
||||
'released_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function tenant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Tenant::class);
|
||||
}
|
||||
|
||||
public function event(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function createdBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by_id');
|
||||
}
|
||||
|
||||
public function releasedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'released_by_id');
|
||||
}
|
||||
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->released_at === null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user