first change

This commit is contained in:
2025-07-27 17:40:56 +05:45
commit f8b9a6725b
3152 changed files with 229528 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Traits;
use Illuminate\Database\Eloquent\Casts\Attribute;
trait StatusTrait
{
const STATUS = [
11 => 'Active',
10 => 'In-Active',
];
protected function statusName(): Attribute
{
return Attribute::make(
get: function (mixed $value, array $attributes) {
switch ($attributes['status']) {
case '10':
return '<span class="badge bg-danger">' . self::STATUS[$attributes['status']] . '</span>';
case '11':
return '<span class="badge bg-success">' . self::STATUS[$attributes['status']] . '</span>';
default:
# code...
break;
}
},
set: fn($value) => $value,
);
}
}