program dan basis data ekosistem

This commit is contained in:
2026-04-20 16:05:27 +07:00
parent 0bbcb22d50
commit 4032eb6e75
49 changed files with 4384 additions and 155 deletions
+13
View File
@@ -4,6 +4,7 @@ namespace App\Models\Pertanian;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Builder;
class Komoditas extends Model
{
@@ -17,4 +18,16 @@ class Komoditas extends Model
'updated_by',
'deleted_by',
];
protected static function booted()
{
static::addGlobalScope('program', function (Builder $builder) {
if (!app()->has('SystemProgram')) {
return;
}
$builder->whereIn('id', app('SystemProgram')->komoditas()->pluck('id'));
});
}
}