type = $type; } /** * Execute the job. * * @return void */ public function handle() { $insert = function (ContactFormType $type) { $contact = Contact::where('date', '=', Carbon::now()->isoFormat('YYYY-MM-DD'))->firstOrNew(); // * Can't do $contact->counter[$type->value]++ => ErrorException $d = $contact->values; $d[$type->value]++; $contact->values = $d; $contact->saveOrFail(); }; try { $insert($this->type); } catch (\Exception $e) { // * Handle user requests colisions $insert($this->type); } } }