• File: ImaliAccount.php
  • Full Path: /var/www/imalipartnersapi/app/Imali/ImaliAccount.php
  • Date Modified: 02/07/2023 8:01 PM
  • File size: 998 bytes
  • 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', '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(['*']);
    }
}