<?php

namespace App\Models\Logs;

use App\Models\Application\Client;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ClientLog extends Model
{
    use HasFactory;

    protected $table = 'log_clients';
    public $timestamps = false;

    protected $fillable = [
        'id',
        'fk_client',
        'type',
        'old_value',
        'new_value',
        'fk_userupdater',
        'updated_at'
    ];

    protected $cast = [
        'id' => 'integer',
        'fk_client' => 'integer',
        'fk_userupdater' => 'integer',
        'updated_at' => 'timestamp'
    ];

    protected $hidden = [
        'id',
        'fk_client',
        'fk_userupdater',
    ];

    public function client()
    {
        return $this->belongsTo(Client::class, 'fk_client', 'id');
    }
}
