Add Seeder UpdateTarifLMSSeeder
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\OLDLMS\Healthcare;
|
||||
use App\Models\OLDLMS\JadwalDokter;
|
||||
use App\Models\OLDLMS\Speciality;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
@@ -128,6 +129,8 @@ class UpdateTarifLMSSeeder extends Seeder
|
||||
$spesialisUmum = Speciality::where('sSlug', 'general-practitioner')->first();
|
||||
|
||||
foreach ($dataTarifs as $tarif) {
|
||||
$healthcareAppliedIds = Healthcare::whereIn('sKodeRS', $tarif['applied_to'])->pluck('nID');
|
||||
|
||||
// [MARK] : UMUM
|
||||
// Update Tarif Dokter Umum
|
||||
$updateUmum = [];
|
||||
@@ -143,10 +146,7 @@ class UpdateTarifLMSSeeder extends Seeder
|
||||
// Updating
|
||||
$dokUmum = JadwalDokter::query()
|
||||
->where('nIDSpesialis', $spesialisUmum->nID)
|
||||
->whereHas('healthcare', function($hc) use ($tarif) {
|
||||
$hc->whereIn('sKodeRS', $tarif['applied_to'])
|
||||
->withTrashed();
|
||||
})
|
||||
->whereIn('nIDHealthCare', $healthcareAppliedIds)
|
||||
->withTrashed()
|
||||
->update($updateUmum);
|
||||
$this->command->info('Updating : Dokter Umum');
|
||||
@@ -170,10 +170,7 @@ class UpdateTarifLMSSeeder extends Seeder
|
||||
$q->where('nIDSpesialis', $spesialisUmum->nID);
|
||||
})
|
||||
->where('sIsSubSpesialis', 0)
|
||||
->whereHas('healthcare', function($hc) use ($tarif) {
|
||||
$hc->whereIn('sKodeRS', $tarif['applied_to'])
|
||||
->withTrashed();
|
||||
})
|
||||
->whereIn('nIDHealthCare', $healthcareAppliedIds)
|
||||
->withTrashed()
|
||||
->update($updateSpesialis);
|
||||
$this->command->info('Updating : Dokter Spesialis');
|
||||
@@ -199,10 +196,7 @@ class UpdateTarifLMSSeeder extends Seeder
|
||||
$q->where('nIDSpesialis', $spesialisUmum->nID);
|
||||
})
|
||||
->where('sIsSubSpesialis', 1)
|
||||
->whereHas('healthcare', function($hc) use ($tarif) {
|
||||
$hc->whereIn('sKodeRS', $tarif['applied_to'])
|
||||
->withTrashed();
|
||||
})
|
||||
->whereIn('nIDHealthCare', $healthcareAppliedIds)
|
||||
->withTrashed()
|
||||
->update($updateSubSpesialis);
|
||||
$this->command->info('Updating : Dokter Sub Spesialis');
|
||||
|
||||
Reference in New Issue
Block a user