One Hat Cyber Team
Your IP :
216.73.216.55
Server IP :
5.189.175.239
Server :
Linux panel.gemx-ai.com 5.14.0-570.19.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 4 04:00:24 EDT 2025 x86_64
Server Software :
LiteSpeed
PHP Version :
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
farmersapp
/
loan.farmersapp.store
/
app
/
Models
/
View File Name :
SalaryScale.php
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Spatie\Activitylog\Traits\LogsActivity; use Spatie\Activitylog\LogOptions; use Illuminate\Database\Eloquent\Builder; class SalaryScale extends Model { use HasFactory; use LogsActivity; public function getActivitylogOptions(): LogOptions { return LogOptions::defaults() ->logAll(); } protected $fillable = [ 'organization_id', 'branch_id', 'scale_name', 'scale_code', 'description', 'basic_salary', 'housing_allowance', 'transport_allowance', 'medical_allowance', 'other_allowances', 'is_active', 'sort_order', ]; protected $casts = [ 'basic_salary' => 'decimal:2', 'housing_allowance' => 'decimal:2', 'transport_allowance' => 'decimal:2', 'medical_allowance' => 'decimal:2', 'other_allowances' => 'decimal:2', 'is_active' => 'boolean', 'sort_order' => 'integer', ]; public function employees() { return $this->hasMany(Employee::class, 'salary_scale_id', 'id'); } public function getTotalAllowancesAttribute() { return $this->housing_allowance + $this->transport_allowance + $this->medical_allowance + $this->other_allowances; } public function getGrossSalaryAttribute() { return $this->basic_salary + $this->total_allowances; } protected static function booted(): void { static::addGlobalScope('org', function (Builder $query) { if (auth()->check()) { $query->where('organization_id', auth()->user()->organization_id) ->where('branch_id', auth()->user()->branch_id) ->orWhere('organization_id', "=", NULL); } }); } }