fixed editing and deleting of colors
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user