static function boot() { parent::boot(); Static::observe(new HeadlineObserver()); Static::observe(new HasManyImagesObserver()); Static::observe(new BelongsToTravelAgentObserver()); }
public static function boot() { parent::boot(); Region::deleted(function ($region) { $region->quotations()->delete(); }); }
static function boot() { parent::boot(); Static::observe(new DestinationObserver()); Static::observe(new HasNameObserver()); Static::observe(new TreeObserver()); }
public static function boot() { parent::boot(); static::saved(function ($model) { $targetKerja = TargetKerja::find($model->attributes['target_kerja_id']); // hitung nilai $nilais = []; if ($targetKerja->kuantitas) { // 1. Kuantitas = Realisasi Output / Target Output * 100 $nilais[] = $kuantitas = $model->attributes['kuantitas'] / $targetKerja->kuantitas * 100; } if ($targetKerja->kualitas) { // 2. Kualitas = Realisasi Output / Target Output * 100 $nilais[] = $kualitas = $model->attributes['kualitas'] / $targetKerja->kualitas * 100; } if ($targetKerja->waktu) { // 3. Waktu = (1.76 * Target Waktu - Realisasi Waktu) / Target Waktu * 100 $nilais[] = $waktu = (1.76 * $targetKerja->waktu - $model->attributes['waktu']) / $targetKerja->waktu * 100; } if ($targetKerja->biaya) { // 4. Biaya = (1.76 * Target Biaya - Realisasi Biaya) / Target Biaya * 100 $nilais[] = $biaya = (1.76 * $targetKerja->biaya - $model->attributes['biaya']) / $targetKerja->biaya * 100; } $total_nilai = collect($nilais)->sum(); $score = Score::firstOrNew(['target_kerja_id' => $targetKerja->id]); $score->fill(compact('kuantitas', 'kualitas', 'waktu', 'biaya', 'total_nilai')); $targetKerja->score()->save($score); $nilai = collect($nilais)->average(); $targetKerja->update(compact('nilai')); }); }
static function boot() { parent::boot(); Static::observe(new PackageObserver()); Static::observe(new HasNameObserver()); Static::observe(new HasSlugObserver()); }
static function boot() { parent::boot(); Static::observe(new TourObserver()); Static::observe(new HasNameObserver()); Static::observe(new HasSlugObserver()); Static::observe(new HasPublishedAtObserver()); }
public static function boot() { parent::boot(); static::saving(function ($model) { $user = $model->user ?: new User(); $user->fill(['name' => $model->attributes['nama'], 'email' => $model->attributes['email'], 'password' => $user->password ? $user->password : bcrypt('abdinegara')]); $user->save(); $model->attributes['pengguna_id'] = $user->id; }); }
static function boot() { parent::boot(); Static::observe(new PhoneObserver()); }
static function boot() { parent::boot(); Static::observe(new TravelAgentObserver()); Static::observe(new HasNameObserver()); }
static function boot() { parent::boot(); Static::observe(new SettingObserver()); }
static function boot() { parent::boot(); Static::observe(new AddressObserver()); }
static function boot() { parent::boot(); Static::observe(new TourOptionObserver()); Static::observe(new HasNameObserver()); }
static function boot() { parent::boot(); Static::observe(new TourScheduleObserver()); }