/var/www/html/back/app/Models/PaymentLog.php
<?php

declare(strict_types=1);

namespace App\Models;

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Carbon;

/**
 * @property int $id
 * @property int $payment_id
 * @property int|null $payment_distribution_id
 * @property int $user_id
 * @property string $status
 * @property string|null $comment
 * @property array|null $changes
 * @property Carbon $created_at
 * @property Carbon $updated_at
 * @property Payment $payment
 * @property PaymentDistribution|null $distribution
 * @property User $user
 */
class PaymentLog extends Model
{
    use HasFactory;

    protected $fillable = ['payment_id', 'payment_distribution_id', 'user_id', 'comment', 'changes', 'status'];

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

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

    public function distribution(): BelongsTo
    {
        return $this->belongsTo(PaymentDistribution::class, 'payment_distribution_id');
    }

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