/** * Delete a billboard collection * * @return void */ public function removeTask() { // Check for request forgeries Request::checkToken(); // Incoming $ids = Request::getVar('id', array()); if (!is_array($ids)) { $ids = array($ids); } // Loop through the selected collections to delete // @TODO: maybe we should warn people if trying to delete a collection with associated billboards? foreach ($ids as $id) { $collection = Collection::oneOrFail($id); // Delete record $collection->destroy(); } // Output messsage and redirect App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_BILLBOARDS_COLLECTION_SUCCESSFULLY_DELETED', count($ids))); }
/** * Delete a billboard collection * * @return void */ public function removeTask() { // Check for request forgeries Request::checkToken(); if (!User::authorise('core.delete', $this->_option)) { App::abort(403, Lang::txt('JERROR_ALERTNOAUTHOR')); } // Incoming $ids = Request::getVar('id', array()); if (!is_array($ids)) { $ids = array($ids); } // Loop through the selected collections to delete // @TODO: maybe we should warn people if trying to delete a collection with associated billboards? $i = 0; foreach ($ids as $id) { $collection = Collection::oneOrFail($id); // Delete record if (!$collection->destroy()) { Notify::error($collection->getError()); continue; } $i++; } // Output messsage and redirect if ($i) { Notify::success(Lang::txt('COM_BILLBOARDS_COLLECTION_SUCCESSFULLY_DELETED', $i)); } $this->cancelTask(); }