Update fitur impor dan history exlusion
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Traits\Blameable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Altek\Accountant\Contracts\Recordable;
|
||||
|
||||
class Icd extends Model
|
||||
{
|
||||
@@ -20,11 +21,12 @@ class Icd extends Model
|
||||
'name',
|
||||
'description',
|
||||
'parent_code',
|
||||
'active'
|
||||
];
|
||||
|
||||
public $appends = [
|
||||
'type',
|
||||
'active'
|
||||
// 'active'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
@@ -41,10 +43,10 @@ class Icd extends Model
|
||||
return 'ICD-'.$this->rev;
|
||||
}
|
||||
|
||||
public function getActiveAttribute()
|
||||
{
|
||||
return empty($this->deleted_at);
|
||||
}
|
||||
// public function getActiveAttribute()
|
||||
// {
|
||||
// return empty($this->deleted_at);
|
||||
// }
|
||||
|
||||
public function subCategories()
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Models\CorporateService;
|
||||
use App\Models\CorporatePlan;
|
||||
use App\Models\CorporateBenefit;
|
||||
use App\Models\Member;
|
||||
use App\Models\Icd;
|
||||
use App\Models\AuditTrail;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Str;
|
||||
@@ -94,6 +95,15 @@ class AppServiceProvider extends ServiceProvider
|
||||
$this->logAuditTrail($model, 'deleted');
|
||||
});
|
||||
|
||||
// ICD or exlusion
|
||||
Icd::updated(function ($model) {
|
||||
$this->logAuditTrail($model, 'updated');
|
||||
});
|
||||
|
||||
Icd::deleted(function ($model) {
|
||||
$this->logAuditTrail($model, 'deleted');
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user