39 lines
648 B
PHP
39 lines
648 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ActivityLog extends Model
|
|
{
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
'log_name',
|
|
'subject_id',
|
|
'causer_id',
|
|
'event',
|
|
'changes',
|
|
];
|
|
|
|
protected $casts = [
|
|
'changes' => 'array',
|
|
'created_at' => 'datetime',
|
|
];
|
|
|
|
protected static function boot()
|
|
{
|
|
parent::boot();
|
|
|
|
static::creating(function ($log) {
|
|
$log->created_at = now();
|
|
});
|
|
}
|
|
|
|
public function causer()
|
|
{
|
|
return $this->belongsTo(Admin::class, 'causer_id');
|
|
}
|
|
|
|
}
|