fixed editing and deleting of colors

This commit is contained in:
2025-03-16 02:54:42 +01:00
parent 820058dab0
commit 003e600a38
3 changed files with 62 additions and 6 deletions
+28 -1
View File
@@ -26,6 +26,11 @@ class Color extends Component
public $search ='';
// Edit Modal + Query
public $editModal = false;
public $editquery = '';
public function create() {
@Auth::check();
@@ -47,7 +52,29 @@ class Color extends Component
$this->createModal = false;
}
public function delete(Color $color) {
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();
}