fixed Database Error while creating new color
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user