event_id = $eventId; $subscription->target_url = trim(Input::get('target_url')); $subscription->save(); if (! $subscription->id) { return Response::json('Failed to create subscription', 500); } return Response::json(['id' => $subscription->public_id], 201); } public function unsubscribe($publicId) { $subscription = Subscription::scope($publicId)->firstOrFail(); $subscription->delete(); return $this->response(RESULT_SUCCESS); } }