@@ -17,8 +17,7 @@ |
||
| 17 | 17 | public function list_devices(Request $request) { |
| 18 | 18 | if ($request->user()->level >= 10 || $request->user()->level == 5) { |
| 19 | 19 | return Devices::all(); |
| 20 | - } |
|
| 21 | - else { |
|
| 20 | + } else { |
|
| 22 | 21 | return User::find($request->user()->user_id)->devices()->get(); |
| 23 | 22 | } |
| 24 | 23 | } |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Illuminate\Contracts\Auth\Guard; |
| 6 | 6 | use Dingo\Api\Http; |
| 7 | 7 | use Dingo\Api\Routing\Helpers; |
| 8 | -use Illuminate\Http\Request; |
|
| 9 | 8 | |
| 10 | 9 | class SetViewVariable |
| 11 | 10 | { |
@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | if ($type === 'archive') |
| 28 | 28 | { |
| 29 | 29 | $notifications = Notification::read([$request->user()->user_id])->limit()->get(); |
| 30 | - } |
|
| 31 | - else { |
|
| 30 | + } else { |
|
| 32 | 31 | $notifications = Notification::unread()->limit()->get(); |
| 33 | 32 | } |
| 34 | 33 | |
@@ -51,19 +50,16 @@ discard block |
||
| 51 | 50 | if ($read->save()) |
| 52 | 51 | { |
| 53 | 52 | return $this->response->array(array('statusText'=>'OK')); |
| 54 | - } |
|
| 55 | - else { |
|
| 53 | + } else { |
|
| 56 | 54 | return $this->response->errorInternal(); |
| 57 | 55 | } |
| 58 | 56 | } |
| 59 | - } |
|
| 60 | - elseif ($action === 'unread' || $action === 'unsticky') |
|
| 57 | + } elseif ($action === 'unread' || $action === 'unsticky') |
|
| 61 | 58 | { |
| 62 | 59 | if (NotificationAttrib::where('notifications_id', $id)->delete() >= 0) |
| 63 | 60 | { |
| 64 | 61 | return $this->response->array(array('statusText'=>'OK')); |
| 65 | - } |
|
| 66 | - else { |
|
| 62 | + } else { |
|
| 67 | 63 | return $this->response->errorInternal(); |
| 68 | 64 | } |
| 69 | 65 | } |
@@ -41,11 +41,11 @@ |
||
| 41 | 41 | |
| 42 | 42 | public function scopeLimit($query) |
| 43 | 43 | { |
| 44 | - return $query->select('notifications.*','key'); |
|
| 44 | + return $query->select('notifications.*', 'key'); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function users() { |
| 48 | - return $this->belongsToMany('App\User')->withPivot('notifications_id','user_id'); |
|
| 48 | + return $this->belongsToMany('App\User')->withPivot('notifications_id', 'user_id'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | } |