/**
  * Checks if the users IP is allowed to access the api.
  *
  * @param $ip
  *
  * @throws HttpErrorException
  */
 protected function allowed($ip)
 {
     try {
         Access::where('address', $ip)->firstOrFail();
     } catch (ModelNotFoundException $e) {
         throw new HttpErrorException(403, 'Forbidden.');
     }
 }
 /**
  * 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'));
 }