| Conditions | 4 |
| Paths | 7 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace Bedard\Shop\Controllers; |
||
| 14 | public function createValue() |
||
| 15 | { |
||
| 16 | $data = input('value'); |
||
| 17 | if (! $data || ! is_array($data)) { |
||
| 18 | return Response::make('Error', 422); |
||
| 19 | } |
||
| 20 | |||
| 21 | try { |
||
| 22 | $sessionKey = uniqid('session_key', true); |
||
| 23 | $value = OptionValue::create($data); |
||
| 24 | $option = new Option; |
||
| 25 | $option->values()->add($value, $sessionKey); |
||
| 26 | |||
| 27 | return Response::make($value, 202); |
||
| 28 | } catch (Exception $e) { |
||
| 29 | return Response::make($e->getMessage(), 500); |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 55 |