public function getCategoryOptions() { $options = Category::all(['id', 'title'])->toArray(); foreach ($options as $option) { $categoryArray[$option['id']] = $option['title']; } return $categoryArray; }
public function index_onDelete() { if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) { foreach ($checkedIds as $catId) { if (!($cat = Category::find($catId))) { continue; } $cat->delete(); } Flash::success('Successfully deleted category(ies).'); } return $this->listRefresh(); }
public function getCategory() { $id = (int) $this->property('category'); $category = Category::get()->where('id', $id)->first(); return $category; }