diff --git a/app/Livewire/Filament/Color.php b/app/Livewire/Filament/Color.php index d8f7232..8027afd 100644 --- a/app/Livewire/Filament/Color.php +++ b/app/Livewire/Filament/Color.php @@ -22,17 +22,27 @@ class Color extends Component #[Validate('required')] public $hex = ''; + public $createModal = false; + public function create() { + @Auth::check(); + + // Validate $this->validate(); - // Create the color - ColorModel::create([ - $this->all() - ]); + $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 delete(Color $color) { diff --git a/resources/views/components/modal.blade.php b/resources/views/components/modal.blade.php index 8b43de3..e22a136 100644 --- a/resources/views/components/modal.blade.php +++ b/resources/views/components/modal.blade.php @@ -9,7 +9,9 @@ $maxWidth = [ 'lg' => 'sm:max-w-lg', 'xl' => 'sm:max-w-xl', '2xl' => 'sm:max-w-2xl', -][$maxWidth ?? '2xl']; + '3xl' => 'sm:max-w-3xl', + '4xl' => 'sm:max-w-4xl', +][$maxWidth ?? '4xl']; @endphp