| @@ 59-65 (lines=7) @@ | ||
| 56 | $user_widget->size_y = $request->size_y; |
|
| 57 | $user_widget->title = $request->title; |
|
| 58 | $user_widget->dashboard_id = $request->dashboard_id; |
|
| 59 | if ($user_widget->save()) { |
|
| 60 | return $this->response->array(array('statusText' => 'OK', 'user_widget_id' => $user_widget->user_widget_id)); |
|
| 61 | } else { |
|
| 62 | return $this->response->errorInternal(); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * Display the specified resource. |
|
| 68 | * |
|
| @@ 110-116 (lines=7) @@ | ||
| 107 | $users_widgets->size_y = $request->input('height'); |
|
| 108 | } |
|
| 109 | ||
| 110 | if ($users_widgets->save()) { |
|
| 111 | return $this->response->array(array('statusText' => 'OK')); |
|
| 112 | } else { |
|
| 113 | return $this->response->errorInternal(); |
|
| 114 | } |
|
| 115 | } |
|
| 116 | ||
| 117 | /** |
|
| 118 | * Remove the specified resource from storage. |
|
| 119 | * |
|
| @@ 98-104 (lines=7) @@ | ||
| 95 | { |
|
| 96 | $alert = Alert::find($id); |
|
| 97 | $alert->state = $request->input('state'); |
|
| 98 | if ($alert->save()) { |
|
| 99 | return $this->response->array(array('statusText' => 'OK')); |
|
| 100 | } else { |
|
| 101 | return $this->response->errorInternal(); |
|
| 102 | } |
|
| 103 | } |
|
| 104 | ||
| 105 | /** |
|
| 106 | * Remove the specified resource from storage. |
|
| 107 | * |
|
| @@ 121-127 (lines=7) @@ | ||
| 118 | $dashboard = Dashboard::find($id); |
|
| 119 | $dashboard->dashboard_name = $request->name; |
|
| 120 | $dashboard->access = $request->access; |
|
| 121 | if ($dashboard->save()) { |
|
| 122 | return $this->response->array(array('statusText' => 'OK')); |
|
| 123 | } else { |
|
| 124 | return $this->response->errorInternal(); |
|
| 125 | } |
|
| 126 | } else { |
|
| 127 | $errors = $validation->errors(); |
|
| 128 | return response()->json($errors, 422); |
|
| 129 | } |
|
| 130 | } |
|
| @@ 141-147 (lines=7) @@ | ||
| 138 | public function destroy(Request $request, $id) |
|
| 139 | { |
|
| 140 | if (Dashboard::where('user_id', $request->user()->user_id)->where('dashboard_id', $id)->delete()) { |
|
| 141 | if (UsersWidgets::where('dashboard_id', $id)->delete() >= 0) { |
|
| 142 | return $this->response->array(array('statusText' => 'OK')); |
|
| 143 | } else { |
|
| 144 | return $this->response->errorInternal(); |
|
| 145 | } |
|
| 146 | } else { |
|
| 147 | return $this->response->errorInternal(); |
|
| 148 | } |
|
| 149 | } |
|
| 150 | ||
| @@ 46-51 (lines=6) @@ | ||
| 43 | $result = $notification->markSticky(false); |
|
| 44 | } |
|
| 45 | ||
| 46 | if ($result === false) { |
|
| 47 | return $this->response->errorInternal(); |
|
| 48 | } else { |
|
| 49 | return $this->response->array(array('statusText' => 'OK')); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * Create a new notification |
|
| @@ 65-70 (lines=6) @@ | ||
| 62 | $notification->body = $request->body; |
|
| 63 | $notification->checksum = hash('sha512', $request->user()->user_id.'.LOCAL.'.$request->title); |
|
| 64 | $notification->source = $request->user()->user_id; |
|
| 65 | if ($notification->save()) { |
|
| 66 | return $this->response->array(array('statusText' => 'OK')); |
|
| 67 | } else { |
|
| 68 | return $this->response->errorInternal(); |
|
| 69 | } |
|
| 70 | } |
|
| 71 | } |
|
| 72 | ||