SystemOperateLog.php 783 Bytes
<?php

namespace App\Models;

use App\Support\Model;
use App\Traits\DateTimeTrait;
use Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class SystemOperateLog extends Model
{
    use SoftDeletes, DateTimeTrait;

    protected $table = 'system_operate_logs';

    protected $guarded = [];

    protected $casts = [
        'path' => 'array',
    ];

    protected $hidden = [
        'deleted_at'
    ];

    /**
     * @return BelongsTo
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }

    /**
     * @return MorphTo
     */
    public function subject(): MorphTo
    {
        return $this->morphTo('subject');
    }
}