public function index_onDelete() { if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) { $plural = 'y'; if (count($checkedIds) > 1) { $plural = 'ies'; } foreach ($checkedIds as $categoryId) { if (!($category = Category::find($categoryId))) { continue; } $category->delete(); } Flash::success('Categor' . $plural . ' Successfully Deleted.'); } return $this->listRefresh(); }