@@ -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 | { |
@@ -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 | } |
@@ -42,6 +42,9 @@ |
||
| 42 | 42 | $this->setAttrib('sticky', $enabled); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | + /** |
|
| 46 | + * @param string $name |
|
| 47 | + */ |
|
| 45 | 48 | private function setAttrib($name, $enabled) { |
| 46 | 49 | if ($enabled === true) { |
| 47 | 50 | $read = new NotificationAttrib; |
@@ -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 Dingo\Api\Http; |
| 6 | 6 | use Dingo\Api\Routing\Helpers; |
| 7 | 7 | use App\Notification; |
| 8 | -use App\NotificationAttrib; |
|
| 9 | 8 | use Illuminate\Http\Request; |
| 10 | 9 | |
| 11 | 10 | class NotificationController extends Controller |
@@ -43,10 +43,10 @@ |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | if ($action == 'read') { |
| 46 | - $result = $notification->markRead($enable); |
|
| 46 | + $result = $notification->markRead($enable); |
|
| 47 | 47 | } |
| 48 | 48 | elseif ($action == 'sticky') { |
| 49 | - $result = $notification->markSticky(false); |
|
| 49 | + $result = $notification->markSticky(false); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | if ($result === false) { |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | |
| 39 | 39 | $notification = Notification::find($id); |
| 40 | 40 | $enable = strpos($action, 'un') === false; |
| 41 | - if(!$enable) { |
|
| 41 | + if (!$enable) { |
|
| 42 | 42 | $action = substr($action, 2); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | if ($type === 'archive') |
| 27 | 27 | { |
| 28 | 28 | $notifications = Notification::IsArchived($request)->get(); |
| 29 | - } |
|
| 30 | - else { |
|
| 29 | + } else { |
|
| 31 | 30 | $notifications = Notification::IsUnread()->get(); |
| 32 | 31 | } |
| 33 | 32 | return $notifications; |
@@ -44,15 +43,13 @@ discard block |
||
| 44 | 43 | |
| 45 | 44 | if ($action == 'read') { |
| 46 | 45 | $result = $notification->markRead($enable); |
| 47 | - } |
|
| 48 | - elseif ($action == 'sticky') { |
|
| 46 | + } elseif ($action == 'sticky') { |
|
| 49 | 47 | $result = $notification->markSticky(false); |
| 50 | 48 | } |
| 51 | 49 | |
| 52 | 50 | if ($result === false) { |
| 53 | 51 | return $this->response->errorInternal(); |
| 54 | - } |
|
| 55 | - else { |
|
| 52 | + } else { |
|
| 56 | 53 | return $this->response->array(array('statusText'=>'OK')); |
| 57 | 54 | } |
| 58 | 55 | } |