<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class EmpletteLog extends Model
{
    protected $fillable = [
        'emplette_id',
        'user_id',
        'actor_type',
        'action',
        'payload',
        'message',
    ];

    protected function casts(): array
    {
        return [
            'payload' => 'array',
        ];
    }

    public function emplette(): BelongsTo
    {
        return $this->belongsTo(Emplette::class);
    }

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

