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

namespace App\Imali;

use App\User;
use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\LogOptions;
use DateTimeInterface;

class ImaliAccount extends Model
{

    protected $fillable = ['captive_balance', 'firebase_token', 'account_number', 'balance', 'points', 'user_id', 'imali_account_config', 'accounting_balance', 'reference'];

    protected static $logAttributes = [
        'account_number',
        'balance',
        'points',
        'user_id',
        'imali_account_config',
        'reference',
        'firebase_token'
    ];

    protected static $logName = 'imali_account';

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

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

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

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

    function recharges()
    {
        return $this->hasMany(RechargeImaliAccount::class);
    }
}