validate(); $color = new ColorModel(); $color->name = $this->name; $color->hex = $this->hex; $color->save(); session()->flash('status', 'Color successfully created.'); // Clear the form $this->reset(['name', 'hex']); // Close the modal $this->createModal = false; } public function edit($colorid) { @Auth::check(); $color =ColorModel::findOrFail($colorid); $this->name = $color->name; $this->hex = $color->hex; } public function save($colorid) { @Auth::check(); $color = ColorModel::findOrFail($colorid); $color->name = $this->name; $color->hex = $this->hex; $color->save(); session()->flash('status', 'Color successfully updated.'); $this->editModal = false; } public function delete(ColorModel $color) { @Auth::check(); $color->delete(); } public function render() { return view('livewire.filament.color', [ 'colors' => ColorModel::search('name', $this->search)->paginate(10) ]); } }