| Conditions | 3 |
| Paths | 6 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 5 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Bedard\Webhooks\Http; |
||
| 18 | public function execute($token) |
||
| 19 | { |
||
| 20 | try { |
||
| 21 | // If no webhook was found, return a 404 |
||
| 22 | if (!$hook = Hook::findByTokenAndMethod($token, Request::method())) { |
||
| 23 | return Response::make(e(trans('bedard.webhooks::lang.responses.not_found')), 404); |
||
| 24 | } |
||
| 25 | |||
| 26 | // Otherwise queue the script for execution, and return a 200 |
||
| 27 | $hook->queueScript(); |
||
| 28 | return Response::make(e(trans('bedard.webhooks::lang.responses.success')), 200); |
||
| 29 | } catch (Exception $e) { |
||
| 30 | return Response::make(e(trans('bedard.webhooks::lang.responses.failed')), 500); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | } |
||
| 34 |