ok

Mini Shell

Direktori : /proc/thread-self/root/home2/selectio/public_html/billingsoftwarenew/core/app/Models/
Upload File :
Current File : //proc/thread-self/root/home2/selectio/public_html/billingsoftwarenew/core/app/Models/OtherBank.php

<?php

namespace App\Models;

use App\Traits\Searchable;
use App\Traits\GlobalStatus;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;

class OtherBank extends Model {
    use GlobalStatus, Searchable;

    public function beneficiaryTypes() {
        return $this->morphMany(Beneficiary::class, 'beneficiary', 'beneficiary_type', 'beneficiary_id');
    }

    public function form() {
        return $this->belongsTo(Form::class);
    }

    // Accessors
    public function chargeText(): Attribute {
        return Attribute::make(get: function () {
            $charge = '';

            if ($this->percent_charge > 0) {
                $charge .= getAmount($this->percent_charge) . '%';
            }

            if ($this->percent_charge > 0 && $this->fixed_charge > 0) {
                $charge .= ' + ';
            }

            if ($this->fixed_charge > 0) {
                $charge .= gs()->cur_sym . showAmount($this->fixed_charge);
            }

            return $charge;
        });
    }
}

Zerion Mini Shell 1.0