Beispiel #1
0
 public function testCanDeleteWebhook()
 {
     $webhook = \Mpociot\CaptainHook\Webhook::create(["url" => "http://foo.baz", "event" => "DeleteWebhook"]);
     $cmd = m::mock("\\Mpociot\\CaptainHook\\Commands\\DeleteWebhook[argument,info]");
     $cmd->shouldReceive("argument")->with("id")->andReturn($webhook->getKey());
     $cmd->shouldReceive("info")->with(m::type("string"));
     $cmd->handle();
     $this->notSeeInDatabase("webhooks", ["url" => "http://foo.baz", "event" => "DeleteWebhook"]);
 }
 /**
  * Create a new webhook for the user.
  *
  * @param  CreateWebhookRequest  $request
  * @return Response
  */
 public function store(CreateWebhookRequest $request)
 {
     $hook = Webhook::create(['url' => $request->url, 'tenant_id' => $this->getTenantId($request), 'event' => $request->event]);
     return response()->json($hook);
 }