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