Lager-v3/app/Models/Log.php

41 lines
760 B
PHP
Raw Normal View History

2022-09-28 07:38:08 +00:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Log extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'target_id',
'loggable_type',
'loggable_id',
'log',
'amount'
];
public function user()
{
return $this->belongsTo(User::class, 'user_id')->withTrashed();
}
public function target()
{
return $this->belongsTo(User::class, 'target_id')->withTrashed();
}
public function action()
{
return $this->belongsTo(LogAction::class, 'log_action_id');
}
public function loggable()
{
return $this->morphTo()->withTrashed();
}
}