<?php

namespace App\Models;

use App\Models\User\User;
use App\Trait\BelongsToSolicitor;
use Illuminate\Database\Eloquent\Model;

class History extends Model {
    protected $table = 'history';
    protected $fillable = [
        'solicitor_id',
        'user_id',
        'action',
        'context',
    ];

    public $casts = [
        'context' => 'json',
    ];

    use BelongsToSolicitor;

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

    public function owner() {
        return $this->morphTo();
    }
}
