/** * Delete an IP address. * * @param Http $http * * @return \Herbert\Framework\Response * * @throws HttpErrorException */ public function delete(Http $http) { try { $address = Access::findOrFail($http->get('id')); } catch (ModelNotFoundException $e) { throw new HttpErrorException(404, "It looks like that address doesn't exist."); } $address->delete(); return redirect_response(panel_url('ApiPosts::mainPanel')); }
public function save(Http $http) { $inputs = $http->only($this->options); if (!$this->validate($inputs) || !$this->check($inputs)) { return redirect_response(panel_url('GitContent::settings'))->with('__form_data', $inputs); } update_option($this->optionName, $inputs); Notifier::success('Settings have been saved', true); return redirect_response(panel_url('GitContent::settings')); }
/** * Validates the form. * * @param string $url * * @return bool */ public function validate($url) { if ($this->dirty) { $this->gatherErrors(); } if ($url === null || ($valid = $this->isValid())) { return $valid; } Notifier::error('There were errors validating your input.', true); throw new HttpErrorException(302, redirect_response($url)->with('__validation_errors', $this->errors)->with('__form_data', $this->data)); }
/** * Destroys a share. * * @param \Herbert\Framework\Http $http * * @return \Herbert\Framework\RedirectResponse */ public function postDestroy(Http $http) { $share = $this->getShare($http->get('set')); $share->delete(); return redirect_response(panel_url('Socializr::index')); }