47 lines
949 B
PHP
47 lines
949 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class AuditLog extends Model
|
|
{
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
'actor_user_id',
|
|
'actor_role',
|
|
'action',
|
|
'subject_type',
|
|
'subject_id',
|
|
'target_user_id',
|
|
'project_id',
|
|
'old_values',
|
|
'new_values',
|
|
'justification',
|
|
'ip_address',
|
|
'user_agent',
|
|
'created_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'old_values' => 'array',
|
|
'new_values' => 'array',
|
|
'created_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function actor(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'actor_user_id');
|
|
}
|
|
|
|
public function targetUser(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'target_user_id');
|
|
}
|
|
}
|