43 lines
721 B
PHP
43 lines
721 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class AuditLog extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'action',
|
|
'description',
|
|
'model_type',
|
|
'model_id',
|
|
'user_id',
|
|
'changes',
|
|
'ip_address',
|
|
'user_agent',
|
|
];
|
|
|
|
protected $casts = [
|
|
'changes' => 'array',
|
|
];
|
|
|
|
/**
|
|
* Get the model that was changed.
|
|
*/
|
|
public function model()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
/**
|
|
* Get the user that performed the action.
|
|
*/
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|