2024-06-10 12:21:58 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Log;
|
|
|
|
|
|
|
|
use App\Models\User;
|
|
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
class OperationLog extends Model
|
|
|
|
{
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
|
|
|
|
protected $primaryKey = 'operation_id';
|
|
|
|
public $timestamps = true;
|
|
|
|
protected $fillable = [
|
|
|
|
'refNo',
|
|
|
|
'user_id',
|
|
|
|
'operation_start_no',
|
|
|
|
'operation_end_no',
|
|
|
|
'model_name',
|
|
|
|
'model_id',
|
|
|
|
'operation_name',
|
|
|
|
'previous_values',
|
|
|
|
'new_values',
|
|
|
|
'created_at',
|
|
|
|
'updated_at',
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
2024-06-15 16:38:54 +00:00
|
|
|
protected $appends = ['operation_by'];
|
2024-06-10 12:21:58 +00:00
|
|
|
|
2024-06-15 16:38:54 +00:00
|
|
|
public function getOperationByAttribute()
|
|
|
|
{
|
|
|
|
$user = User::find($this->user_id);
|
|
|
|
return $user ? $user->name : '';
|
|
|
|
}
|
2024-06-10 12:21:58 +00:00
|
|
|
}
|