<?php

namespace App\Models;

use App\Services\BigNumber;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Http\Traits\Timezone;

class UserBalance extends Model
{
    use HasFactory, Timezone;

    protected $casts = [
        'created_at' => 'datetime:d-m-Y H:i:s'
    ];
    protected $table = "user_balance";
     protected $fillable = ['user_id', 'currency_id', 'balance'];

    public function Balance(): Attribute{
        return Attribute::make(
            function ($value){
                return BigNumber::create($value)->value;
            }
        );
    }
}
