/** * Register any other events for your application. * * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function boot(DispatcherContract $events) { parent::boot($events); GenericContainer::creating(function ($genericContainer) { return $genericContainer->isCreating(); }); GenericContainer::saving(function ($genericContainer) { return $genericContainer->isSaving(); }); InboundOrder::creating(function ($inboundOrder) { return $inboundOrder->isCreating(); }); InboundOrderDetail::creating(function ($inboundOrderDetail) { return $inboundOrderDetail->isCreating(); }); Inventory::creating(function ($inventory) { return $inventory->isCreating(); }); Inventory::saving(function ($inventory) { return $inventory->isSaving(); }); Item::creating(function ($item) { return $item->isCreating(); }); JobExperience::creating(function ($jobExperience) { return $jobExperience->isCreating(); }); JobStatus::creating(function ($jobStatus) { return $jobStatus->isCreating(); }); Location::creating(function ($location) { return $location->isCreating(); }); Location::saving(function ($location) { return $location->isSaving(); }); Pallet::creating(function ($pallet) { return $pallet->isCreating(); }); Pallet::saving(function ($pallet) { return $pallet->isSaving(); }); PerformanceTally::creating(function ($performanceTally) { return $performanceTally->isCreating(); }); User::creating(function ($user) { return $user->isCreating(); }); }
/** * This function can set default values, and validate the entered field values. * * Register this function in an Event Listener, see: http://laravel.com/docs/master/events * or call it from EventServiceProvider::boot(..) */ public function isCreating() { // set default values $this->id = JobStatus::select(DB::raw('max(id) as maxid'))->where('name', $this->name)->first()->maxid + 1; Log::debug('Key: [' . $this->name . ',' . $this->id . ']'); }
/** * Implement create($input) */ public function create($input) { return JobStatus::create($input); }