<?php
 namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class ClientBalanceType extends Model { use HasFactory; protected $fillable = [ 'name', 'code', 'description', 'is_positive', 'is_active', ]; protected $casts = [ 'is_positive' => 'boolean', 'is_active' => 'boolean', ]; public function scopeActive($query) { return $query->where('is_active', true); } public function scopePositive($query) { return $query->where('is_positive', true); } public function scopeNegative($query) { return $query->where('is_positive', false); } public function getBadgeClassAttribute() { return $this->is_positive ? 'bg-success' : 'bg-danger'; } public function getIconAttribute() { return $this->is_positive ? 'fa-plus' : 'fa-minus'; } } 