コード例 #1
0
 protected function handle()
 {
     if ($this->request->isAjax()) {
         return JsonResponse::notFound();
     }
     return Response::notFound();
 }
コード例 #2
0
 public function post()
 {
     if (!$this->validTwilioRequest()) {
         return Response::forbidden('Invalid Signature');
     }
     $template = $this->getTemplate('twiml/no-call');
     return TwimlResponse::ok($template);
 }
コード例 #3
0
 /**
  * @return Response
  */
 public function options()
 {
     $response = Response::ok();
     $response->setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
     $response->setHeader('Access-Control-Max-Age', '604800');
     $response->setHeader('Access-Control-Allow-Headers', 'authorization, x-requested-with, x-requested-by');
     return $response;
 }
コード例 #4
0
 public function post()
 {
     try {
         if (!$this->security->checkToken()) {
             throw new Exception('Something went wrong. Please try again.');
         }
         $this->setColor($this->request->getPost('color', 'alphanum'));
     } catch (Exception $e) {
         $this->flash->error($e->getMessage());
     }
     return Response::temporaryRedirect(array('for' => 'home'));
 }
コード例 #5
0
 public function post()
 {
     try {
         if (!$this->validTwilioRequest()) {
             return Response::forbidden('Invalid Signature');
         }
         $color = strtolower(trim($this->request->getPost('Body')));
         $this->setColor($color);
         $template = $this->getTemplate('twiml/thanks');
         return TwimlResponse::ok($template);
     } catch (Exception $e) {
         $template = $this->getTemplate('twiml/bad-color');
         return TwimlResponse::ok($template);
     }
 }
コード例 #6
0
 public function delete()
 {
     return $this->request->isAjax() ? JsonResponse::methodNotAllowed() : Response::methodNotAllowed();
 }