• File: Refund.php
  • Full Path: /var/www/imaliapitest/app/Refund.php
  • Date Modified: 05/19/2025 4:29 PM
  • File size: 1.55 KB
  • MIME-type: text/x-php
  • Charset: utf-8
<?php

namespace App;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use DateTimeInterface;

class Refund extends Model
{
    use HasFactory;
    use LogsActivity;

    protected $fillable = [
        'transaction', 'amount', 'fee', 'amount_debited', 'description', 'estado', 'estado_color', 'account_number',
        'store_id', 'merchant_id', 'store_id', 'imali_user_id', 'user_client_id', 'terminalCompanyName', 'terminalChannel',
        'terminalID', 'client_id', 'payment_id', 'token', 'partner_transaction_id'
    ];

    protected static $logAttributes = [
        'transaction', 'amount', 'fee', 'amount_debited', 'description', 'estado', 'estado_color', 'account_number',
        'store_id', 'merchant_id', 'store_id', 'imali_user_id', 'user_client_id', 'terminalCompanyName', 'terminalChannel',
        'terminalID', 'client_id', 'payment_id', 'token', 'partner_transaction_id'
    ];
    protected static $logName = 'Refund';

    public function getDescriptionForEvent(string $eventName): string
    {
        return "This model has been {$eventName}";
    }

    public function setDescriptionAttribute($value)
    {
        $this->attributes['description'] = ucfirst(strtolower($value));
    }

    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('d-m-Y H:i:s');
    }

    public function getActivitylogOptions(): LogOptions
    {
        return LogOptions::defaults()->logOnly(["*"]);
    }
}