| @@ 21-33 (lines=13) @@ | ||
| 18 | private $email; |
|
| 19 | private $token; |
|
| 20 | ||
| 21 | public function store(NotificationRequest $request) |
|
| 22 | { |
|
| 23 | $this->setAttributes($request); |
|
| 24 | try { |
|
| 25 | $notificationOption = $this->controlAttributes(); |
|
| 26 | $notificationOption->value = 1; |
|
| 27 | $notificationOption->token = tokenSetter(); |
|
| 28 | $notificationOption->save(); |
|
| 29 | } catch (NotificationNotFoundException $exception) { |
|
| 30 | return $this->failureResponse($exception); |
|
| 31 | } |
|
| 32 | return $this->successResponse(); |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * @param NotificationRequest $request |
|
| @@ 39-51 (lines=13) @@ | ||
| 36 | * @param NotificationRequest $request |
|
| 37 | * @return Factory|View |
|
| 38 | */ |
|
| 39 | public function destroy(NotificationRequest $request) |
|
| 40 | { |
|
| 41 | $this->setAttributes($request); |
|
| 42 | try { |
|
| 43 | $notificationOption = $this->controlAttributes(); |
|
| 44 | $notificationOption->value = 0; |
|
| 45 | $notificationOption->token = tokenSetter(); |
|
| 46 | $notificationOption->save(); |
|
| 47 | } catch (NotificationNotFoundException $exception) { |
|
| 48 | return $this->failureResponse($exception); |
|
| 49 | } |
|
| 50 | return $this->successResponse(); |
|
| 51 | } |
|
| 52 | ||
| 53 | protected function successResponse() |
|
| 54 | { |
|