/** * @param $modelName * @param $id * @return Redirect */ public function destroy($modelName, $id) { $instance = $this->modelRepository->getInstance($id); if (!$this->modelItem->isDeletable($instance)) { return $this->redirectToTable(); } try { $this->modelRepository->destroy($id); } catch (QueryException $e) { return $this->redirectToTable()->withMessage(Lang::get('admin::lang.table.delete-error')); } return $this->redirectToTable(); }