validate(); $filament = new Model(); $filament->name = $this->name; $filament->description = $this->description; $filament->diameter = $this->diameter; $filament->color_id = $this->color_id; $filament->filament_type_id = $this->type_id; $filament->manufacturer_id = $this->manufacturer_id; $filament->weight = $this->weight; $filament->price = $this->price; $filament->stock = $this->stock; $filament->save(); // Clear the form $this->resetInputFields(); // Close the modal Flux::modal('createModal')->close(); } public function cancel() { $this->resetInputFields(); Flux::modals()->close(); } public function resetInputFields() { $this->reset(['name', 'description', 'diameter', 'color_id', 'type_id', 'manufacturer_id', 'weight', 'price', 'stock', 'deleteid', 'editid']); } public function render() { return view('livewire.filament.filament', [ 'filaments' => Model::search('name', $this->search)->paginate(10), 'colors' => Color::all(), 'manufacturers' => Manufacturer::all(), 'types' => Type::all() ]); } }