validate([ 'currency' => 'required', 'exdate' => 'required', 'finishdate' => 'nullable', 'rate' => 'nullable|numeric', 'baht' => 'nullable|numeric', 'exbaht' => 'nullable|numeric', ]); //$exdate = Carbon::createFromFormat('m/d/Y', $this->exdate)->format('Y-m-d'); //$finishdate = $this->finishdate ? Carbon::createFromFormat('m/d/Y', $this->finishdate)->format('Y-m-d') : null; CenterConfExchangerate::create([ 'currency' => $this->currency, 'exdate' => $this->exdate, 'finishdate' => $this->finishdate, 'rate' => $this->rate, 'baht' => $this->baht, ]); CenterConfExchangerateExport::create([ 'currency' => $this->currency, 'exdate' => $this->exdate, 'finishdate' => $this->finishdate, 'rate' => $this->rate, 'baht' => $this->exbaht, ]); $this->reset(['currency', 'exdate', 'finishdate', 'rate', 'baht', 'exbaht']); $this->emit('showexchangerateListForm'); session()->flash('message', 'Exchangerate added successfully!'); } public function render() { return view('livewire.pages.exchangerate.exchangerate-create'); } public function loadPage($page) { $this->action = $page; } }