Completed
Push — develop ( 1c7ff0...b15f7e )
by Neil
08:15
created
app/Http/Controllers/NotificationController.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
app/Notification.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -42,6 +42,9 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
app/Api/Controllers/NotificationController.php 4 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.