Completed
Push — master ( 3ad61c...e81a09 )
by Brandon
29s
created
app/Http/Requests/EditDevice.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace App\Http\Requests;
4 4
 
5 5
 use Illuminate\Foundation\Http\FormRequest;
6
-use App\Http\Requests\Request;
7 6
 use Illuminate\Support\Facades\Auth;
8 7
 
9 8
 class EditDevice extends FormRequest
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,19 +46,19 @@
 block discarded – undo
46 46
     {
47 47
         $validator = parent::getValidatorInstance();
48 48
     
49
-        $validator->sometimes('site_id', 'bail|integer|digits_between:1,10|exists:sites,id', function ($input) {
49
+        $validator->sometimes('site_id', 'bail|integer|digits_between:1,10|exists:sites,id', function($input) {
50 50
             return !$input->new_site_name && $input->site_id;
51 51
         });
52 52
     
53
-        $validator->sometimes('location_id', 'bail|integer|digits_between:1,10|exists:locations,id', function ($input) {
53
+        $validator->sometimes('location_id', 'bail|integer|digits_between:1,10|exists:locations,id', function($input) {
54 54
             return !$input->new_location_name && $input->location_id;
55 55
         });
56 56
     
57
-        $validator->sometimes('new_site_name', 'bail|min:2|max:190|name|unique:sites,name', function ($input) {
57
+        $validator->sometimes('new_site_name', 'bail|min:2|max:190|name|unique:sites,name', function($input) {
58 58
             return !$input->site_id && $input->name;
59 59
         });
60 60
     
61
-        $validator->sometimes('new_location_name', 'bail|min:2|max:190|name|unique:locations,name', function ($input) {
61
+        $validator->sometimes('new_location_name', 'bail|min:2|max:190|name|unique:locations,name', function($input) {
62 62
             return !$input->location_id && $input->name;
63 63
         });
64 64
         
Please login to merge, or discard this patch.
app/Device.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -330,7 +330,7 @@
 block discarded – undo
330 330
      * Get the page number of the device for the dashboard device table pagination
331 331
      *
332 332
      * @param int $limit
333
-     * @return int
333
+     * @return double
334 334
      */
335 335
     public function dashPageNum($limit)
336 336
     {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      *
30 30
      * @var array
31 31
      */
32
-    protected $hidden = ['token'];
32
+    protected $hidden = [ 'token' ];
33 33
     
34 34
     /**
35 35
      * The attributes that are mass assignable.
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @var array
50 50
      */
51
-    protected static $ignoreChangedAttributes = ['updated_at', 'last_network_update_at'];
51
+    protected static $ignoreChangedAttributes = [ 'updated_at', 'last_network_update_at' ];
52 52
     
53 53
     /**
54 54
      * The attributes to log in the Activity Log
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function getSiteAttribute()
91 91
     {
92
-        return $this->location->site ?? (object)[];
92
+        return $this->location->site ?? (object) [ ];
93 93
     }
94 94
     
95 95
     /**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function getOpenTimeHumanAttribute()
121 121
     {
122
-        $time = new Carbon($this->attributes['open_time'], 'UTC');
122
+        $time = new Carbon($this->attributes[ 'open_time' ], 'UTC');
123 123
         $time = $time->setTimezone(Auth::user()->timezone);
124 124
         
125 125
         return $time->format('h:i a');
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function getCloseTimeHumanAttribute()
154 154
     {
155
-        $time = new Carbon($this->attributes['close_time'], 'UTC');
155
+        $time = new Carbon($this->attributes[ 'close_time' ], 'UTC');
156 156
         $time = $time->setTimezone(Auth::user()->timezone);
157 157
         
158 158
         return $time->format('h:i a');
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         else
178 178
             $time = new Carbon($value, 'UTC');
179 179
         
180
-        $this->attributes['open_time'] = $time->format('H:i:s');
180
+        $this->attributes[ 'open_time' ] = $time->format('H:i:s');
181 181
     }
182 182
     
183 183
     /**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         else
200 200
             $time = new Carbon($value, 'UTC');
201 201
         
202
-        $this->attributes['close_time'] = $time->format('H:i:s');
202
+        $this->attributes[ 'close_time' ] = $time->format('H:i:s');
203 203
     }
204 204
     
205 205
     /**
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         $isClosed = $this->cover_status === 'closed';
372 372
         $isLocked = $this->cover_status === 'locked';
373 373
             
374
-        switch ($this['cover_command'])
374
+        switch ($this[ 'cover_command' ])
375 375
         {
376 376
             case 'open':
377 377
                 if ($isOpen)
Please login to merge, or discard this patch.
Braces   +47 added lines, -38 removed lines patch added patch discarded remove patch
@@ -103,8 +103,9 @@  discard block
 block discarded – undo
103 103
         $time = new Carbon($value, 'UTC');
104 104
         
105 105
         //If the user is logged in then use there preferred timezone
106
-        if (Auth::check())
107
-            $time = $time->setTimezone(Auth::user()->timezone);
106
+        if (Auth::check()) {
107
+                    $time = $time->setTimezone(Auth::user()->timezone);
108
+        }
108 109
 
109 110
         return $time->format('H:i');
110 111
     }
@@ -136,8 +137,9 @@  discard block
 block discarded – undo
136 137
         $time = new Carbon($value, 'UTC');
137 138
     
138 139
         //If the user is logged in then use there preferred timezone
139
-        if (Auth::check())
140
-            $time = $time->setTimezone(Auth::user()->timezone);
140
+        if (Auth::check()) {
141
+                    $time = $time->setTimezone(Auth::user()->timezone);
142
+        }
141 143
         
142 144
         return $time->format('H:i');
143 145
     }
@@ -171,9 +173,9 @@  discard block
 block discarded – undo
171 173
         {
172 174
             $time = new Carbon($value, Auth::user()->timezone);
173 175
             $time = $time->setTimezone('UTC');
176
+        } else {
177
+                    $time = new Carbon($value, 'UTC');
174 178
         }
175
-        else
176
-            $time = new Carbon($value, 'UTC');
177 179
         
178 180
         $this->attributes['open_time'] = $time->format('H:i:s');
179 181
     }
@@ -193,9 +195,9 @@  discard block
 block discarded – undo
193 195
         {
194 196
             $time = new Carbon($value, Auth::user()->timezone);
195 197
             $time = $time->setTimezone('UTC');
198
+        } else {
199
+                    $time = new Carbon($value, 'UTC');
196 200
         }
197
-        else
198
-            $time = new Carbon($value, 'UTC');
199 201
         
200 202
         $this->attributes['close_time'] = $time->format('H:i:s');
201 203
     }
@@ -211,10 +213,11 @@  discard block
 block discarded – undo
211 213
      */
212 214
     public function getLastNetworkUpdateAtHumanAttribute()
213 215
     {
214
-        if ($this->last_network_update_at->diffInDays() > 0)
215
-            return $this->last_network_update_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
216
-        else
217
-            return $this->last_network_update_at->diffForHumans();
216
+        if ($this->last_network_update_at->diffInDays() > 0) {
217
+                    return $this->last_network_update_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
218
+        } else {
219
+                    return $this->last_network_update_at->diffForHumans();
220
+        }
218 221
     }
219 222
     
220 223
     /**
@@ -229,10 +232,11 @@  discard block
 block discarded – undo
229 232
      */
230 233
     public function getUpdatedAtHumanAttribute()
231 234
     {
232
-        if ($this->updated_at->diffInDays() > 0)
233
-            return $this->updated_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
234
-        else
235
-            return $this->updated_at->diffForHumans();
235
+        if ($this->updated_at->diffInDays() > 0) {
236
+                    return $this->updated_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
237
+        } else {
238
+                    return $this->updated_at->diffForHumans();
239
+        }
236 240
     }
237 241
     
238 242
     /**
@@ -246,10 +250,11 @@  discard block
 block discarded – undo
246 250
      */
247 251
     public function getCreatedAtHumanAttribute()
248 252
     {
249
-        if ($this->created_at->diffInDays() > 0)
250
-            return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
251
-        else
252
-            return $this->created_at->diffForHumans();
253
+        if ($this->created_at->diffInDays() > 0) {
254
+                    return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
255
+        } else {
256
+                    return $this->created_at->diffForHumans();
257
+        }
253 258
     }
254 259
     
255 260
     /**
@@ -360,10 +365,11 @@  discard block
 block discarded – undo
360 365
         $time_now = Carbon::now($timezone);
361 366
     
362 367
         //Check if the current time is during the open schedule or not
363
-        if ($time_now->gt($open_time) && $time_now->lt($close_time))
364
-            return true;
365
-        else
366
-            return false;
368
+        if ($time_now->gt($open_time) && $time_now->lt($close_time)) {
369
+                    return true;
370
+        } else {
371
+                    return false;
372
+        }
367 373
     }
368 374
     
369 375
     /**
@@ -380,20 +386,22 @@  discard block
 block discarded – undo
380 386
         switch ($this['cover_command'])
381 387
         {
382 388
             case 'open':
383
-                if ($isOpen)
384
-                    $status = 'open';
385
-                else if ($isLocked)
386
-                    $status = 'unlocking';
387
-                else
388
-                    $status = 'opening';
389
+                if ($isOpen) {
390
+                                    $status = 'open';
391
+                } else if ($isLocked) {
392
+                                    $status = 'unlocking';
393
+                } else {
394
+                                    $status = 'opening';
395
+                }
389 396
                 break;
390 397
             case 'close':
391
-                if ($isClosed)
392
-                    $status = 'closed';
393
-                else if ($isLocked)
394
-                    $status = 'unlocking';
395
-                else
396
-                    $status = 'closing';
398
+                if ($isClosed) {
399
+                                    $status = 'closed';
400
+                } else if ($isLocked) {
401
+                                    $status = 'unlocking';
402
+                } else {
403
+                                    $status = 'closing';
404
+                }
397 405
                 break;
398 406
             case 'lock':
399 407
                 $status = 'locked';
@@ -402,8 +410,9 @@  discard block
 block discarded – undo
402 410
                 $status = 'error';
403 411
         }
404 412
     
405
-        if ($this->cover_status === 'error')
406
-            $status = 'error';
413
+        if ($this->cover_status === 'error') {
414
+                    $status = 'error';
415
+        }
407 416
         
408 417
         return $status;
409 418
     }
Please login to merge, or discard this patch.
app/User.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
     public function roleString()
144 144
     {
145 145
         $role_en = array(0 => "Registered", 1 => "User", 2 => "Manager", 3 => "Admin");
146
-        return $role_en[ $this->role ] . ' (' . $this->role . ')';
146
+        return $role_en[ $this->role ].' ('.$this->role.')';
147 147
     }
148 148
     
149 149
     /**
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -89,10 +89,11 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function getUpdatedAtHumanAttribute()
91 91
     {
92
-        if ($this->updated_at->diffInDays() > 0)
93
-            return $this->updated_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
94
-        else
95
-            return $this->updated_at->diffForHumans();
92
+        if ($this->updated_at->diffInDays() > 0) {
93
+                    return $this->updated_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
94
+        } else {
95
+                    return $this->updated_at->diffForHumans();
96
+        }
96 97
     }
97 98
     
98 99
     /**
@@ -107,9 +108,10 @@  discard block
 block discarded – undo
107 108
      */
108 109
     public function getCreatedAtHumanAttribute()
109 110
     {
110
-        if ($this->created_at->diffInDays() > 0)
111
-            return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
112
-        else
113
-            return $this->created_at->diffForHumans();
111
+        if ($this->created_at->diffInDays() > 0) {
112
+                    return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
113
+        } else {
114
+                    return $this->created_at->diffForHumans();
115
+        }
114 116
     }
115 117
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
     /**
138 138
      * Returns the users role as a string.
139 139
      *
140
-     * @return Users
140
+     * @return string
141 141
      */
142 142
     public function roleString()
143 143
     {
Please login to merge, or discard this patch.
app/Http/Controllers/DashboardController.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Illuminate\Support\Facades\Auth;
6 6
 use Illuminate\Http\Request;
7
-use Validator;
8 7
 use App\Device;
9 8
 use App\Site;
10 9
 use App\Location;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             
45 45
             //If the location exists then set the pagination page to be where the device is located
46 46
             if ($location != null)
47
-                $request->merge(['page' => $device->dashPageNum(4)]);
47
+                $request->merge([ 'page' => $device->dashPageNum(4) ]);
48 48
             $site_id = $location->site_id ?? 0;
49 49
             $location_id = $location->id ?? 0;
50 50
             $device_id = $device->id ?? 0;
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
             ->get();
65 65
         //Get all locations for the selected site with the selected location first
66 66
         $locations = Location::select('id', 'name', 'site_id')
67
-            ->where('site_id', '=', $sites[0]->id ?? 0)
67
+            ->where('site_id', '=', $sites[ 0 ]->id ?? 0)
68 68
             ->orderByRaw("id = ? DESC", $location_id)
69 69
             ->orderBy('name', 'ASC')
70 70
             ->get();
71 71
         //Get all devices for the selected location
72 72
         $devices = Device::publicDashData()
73 73
             ->leftJoin('deviceimages as image', 'devices.id', '=', 'image.device_id')
74
-            ->where('location_id', '=', $locations[0]->id ?? 0)
74
+            ->where('location_id', '=', $locations[ 0 ]->id ?? 0)
75 75
             ->orderBy('name', 'ASC')
76 76
             ->paginate(4);
77 77
     
@@ -84,33 +84,33 @@  discard block
 block discarded – undo
84 84
             //If the original device with the given device id was not found
85 85
             //Then assign the the first device in the device list as the active device
86 86
             if ($active_device == null)
87
-                $active_device = $devices[0];
87
+                $active_device = $devices[ 0 ];
88 88
         
89 89
             //Add an attribute to each device defining if it is stale
90
-            $devices->transform(function ($item)
90
+            $devices->transform(function($item)
91 91
             {
92 92
                 //Mark the device as stale if the device has missed three updates plus a minute
93 93
                 $deviceStaleMins = ceil(($item->update_rate * 3) / 60) + 1;
94
-                $item['isDeviceStale'] = ($item->last_network_update_at <= Carbon::now()->subMinute($deviceStaleMins)) ? true : false;
94
+                $item[ 'isDeviceStale' ] = ($item->last_network_update_at <= Carbon::now()->subMinute($deviceStaleMins)) ? true : false;
95 95
     
96 96
                 //Mark the device image as stale if the device has missed three image updates plus a minute
97 97
                 if ($item->image_updated_at != null)
98 98
                 {
99 99
                     $imageStaleMins = ceil(($item->image_rate * 3) / 60) + 1;
100
-                    $item['isImageStale'] = ($item->image_updated_at <= Carbon::now()->subMinute($imageStaleMins)) ? true : false;
100
+                    $item[ 'isImageStale' ] = ($item->image_updated_at <= Carbon::now()->subMinute($imageStaleMins)) ? true : false;
101 101
                 }
102 102
                 else
103
-                    $item['isImageStale'] = false;
103
+                    $item[ 'isImageStale' ] = false;
104 104
                 
105 105
                 return $item;
106 106
             });
107 107
         }
108 108
     
109 109
         //Store the active site, location, and device in a collection
110
-        $active_data = collect(['device' => $active_device, 'location' => $locations[0] ?? null, 'site' => $sites[0] ?? null]);
110
+        $active_data = collect([ 'device' => $active_device, 'location' => $locations[ 0 ] ?? null, 'site' => $sites[ 0 ] ?? null ]);
111 111
     
112 112
         //Use the device_list.blade.php to generate the device table html
113
-        $html_device_table = view('dashboard.device_list', ['devices' => $devices, 'active_data' => $active_data])->render();
113
+        $html_device_table = view('dashboard.device_list', [ 'devices' => $devices, 'active_data' => $active_data ])->render();
114 114
         
115 115
         if (\Request::ajax())
116 116
             return response()->json([ 'active_data' => $active_data, 'devices' => $devices, 'locations' => $locations,
Please login to merge, or discard this patch.
Braces   +14 added lines, -12 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
             $location = $device->location ?? null;
44 44
             
45 45
             //If the location exists then set the pagination page to be where the device is located
46
-            if ($location != null)
47
-                $request->merge(['page' => $device->dashPageNum(4)]);
46
+            if ($location != null) {
47
+                            $request->merge(['page' => $device->dashPageNum(4)]);
48
+            }
48 49
             $site_id = $location->site_id ?? 0;
49 50
             $location_id = $location->id ?? 0;
50 51
             $device_id = $device->id ?? 0;
51
-        }
52
-        else
52
+        } else
53 53
         {
54 54
             //Get the active site, location, and device ids
55 55
             $site_id = $request->site_id ?? 0;
@@ -83,8 +83,9 @@  discard block
 block discarded – undo
83 83
         {
84 84
             //If the original device with the given device id was not found
85 85
             //Then assign the the first device in the device list as the active device
86
-            if ($active_device == null)
87
-                $active_device = $devices[0];
86
+            if ($active_device == null) {
87
+                            $active_device = $devices[0];
88
+            }
88 89
         
89 90
             //Add an attribute to each device defining if it is stale
90 91
             $devices->transform(function ($item)
@@ -98,9 +99,9 @@  discard block
 block discarded – undo
98 99
                 {
99 100
                     $imageStaleMins = ceil(($item->image_rate * 3) / 60) + 1;
100 101
                     $item['isImageStale'] = ($item->image_updated_at <= Carbon::now()->subMinute($imageStaleMins)) ? true : false;
102
+                } else {
103
+                                    $item['isImageStale'] = false;
101 104
                 }
102
-                else
103
-                    $item['isImageStale'] = false;
104 105
                 
105 106
                 return $item;
106 107
             });
@@ -112,12 +113,13 @@  discard block
 block discarded – undo
112 113
         //Use the device_list.blade.php to generate the device table html
113 114
         $html_device_table = view('dashboard.device_list', ['devices' => $devices, 'active_data' => $active_data])->render();
114 115
         
115
-        if (\Request::ajax())
116
-            return response()->json([ 'active_data' => $active_data, 'devices' => $devices, 'locations' => $locations,
116
+        if (\Request::ajax()) {
117
+                    return response()->json([ 'active_data' => $active_data, 'devices' => $devices, 'locations' => $locations,
117 118
                 'sites' => $sites, 'html_device_table' => $html_device_table ]);
118
-        else
119
-            return view('dashboard.index', [ 'active_data' => $active_data, 'devices' => $devices,
119
+        } else {
120
+                    return view('dashboard.index', [ 'active_data' => $active_data, 'devices' => $devices,
120 121
                 'locations' => $locations, 'sites' => $sites ]);
122
+        }
121 123
     }
122 124
     
123 125
     /**
Please login to merge, or discard this patch.
app/Sensor.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
     {
70 70
         return SensorData::whereRaw('id = (SELECT MAX(id)
71 71
                                                     FROM sensor_data
72
-                                                    WHERE sensor_id = ?)', [$this->id])->first() ?? (object)[];
72
+                                                    WHERE sensor_id = ?)', [ $this->id ])->first() ?? (object) [ ];
73 73
     }
74 74
     
75 75
     /**
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -145,10 +145,11 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function getUpdatedAtHumanAttribute()
147 147
     {
148
-        if ($this->updated_at->diffInDays() > 0)
149
-            return $this->updated_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
150
-        else
151
-            return $this->updated_at->diffForHumans();
148
+        if ($this->updated_at->diffInDays() > 0) {
149
+                    return $this->updated_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
150
+        } else {
151
+                    return $this->updated_at->diffForHumans();
152
+        }
152 153
     }
153 154
     
154 155
     /**
@@ -163,9 +164,10 @@  discard block
 block discarded – undo
163 164
      */
164 165
     public function getCreatedAtHumanAttribute()
165 166
     {
166
-        if ($this->created_at->diffInDays() > 0)
167
-            return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
168
-        else
169
-            return $this->created_at->diffForHumans();
167
+        if ($this->created_at->diffInDays() > 0) {
168
+                    return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
169
+        } else {
170
+                    return $this->created_at->diffForHumans();
171
+        }
170 172
     }
171 173
 }
172 174
\ No newline at end of file
Please login to merge, or discard this patch.
app/Http/Requests/EditLocation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,11 +38,11 @@
 block discarded – undo
38 38
     {
39 39
         $validator = parent::getValidatorInstance();
40 40
         
41
-        $validator->sometimes('site', 'integer|digits_between:1,10|exists:sites,id', function ($input) {
41
+        $validator->sometimes('site', 'integer|digits_between:1,10|exists:sites,id', function($input) {
42 42
             return !$input->new_site_name && $input->site;
43 43
         });
44 44
         
45
-        $validator->sometimes('new_site_name', 'bail|min:2|max:190|name|unique:sites,name', function ($input) {
45
+        $validator->sometimes('new_site_name', 'bail|min:2|max:190|name|unique:sites,name', function($input) {
46 46
             return !$input->site;
47 47
         });
48 48
         
Please login to merge, or discard this patch.
app/DataTables/ActivityLogDataTable.php 2 patches
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,10 +27,11 @@
 block discarded – undo
27 27
                 return $activity->properties;
28 28
             })
29 29
             ->editColumn('created_at', function ($activity) {
30
-                if ($activity->created_at->diffInDays() > 0)
31
-                    return $activity->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
32
-                else
33
-                    return $activity->created_at->diffForHumans();
30
+                if ($activity->created_at->diffInDays() > 0) {
31
+                                    return $activity->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
32
+                } else {
33
+                                    return $activity->created_at->diffForHumans();
34
+                }
34 35
             })
35 36
             ->rawColumns(['causer_id', 'subject_id', 'properties']);
36 37
     }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,30 +17,30 @@  discard block
 block discarded – undo
17 17
     public function dataTable($query)
18 18
     {
19 19
         return datatables($query)
20
-            ->editColumn('causer_id', function ($activity) {
20
+            ->editColumn('causer_id', function($activity) {
21 21
                 if ($activity->causer_id) {
22
-                    return '<a href="' . route($this->getRouteFromType($activity->causer_type), $activity->causer_id) . '">' . $activity->causer->name ?? '' . '</a>';
22
+                    return '<a href="'.route($this->getRouteFromType($activity->causer_type), $activity->causer_id).'">'.$activity->causer->name ?? ''.'</a>';
23 23
                 } else {
24 24
                     return '';
25 25
                 }
26 26
             })
27
-            ->editColumn('subject_id', function ($activity) {
27
+            ->editColumn('subject_id', function($activity) {
28 28
                 if ($activity->subject_id) {
29
-                    return '<a href="' . route($this->getRouteFromType($activity->subject_type), $activity->subject_id) . '">' . $activity->subject->name ?? '' . '</a>';
29
+                    return '<a href="'.route($this->getRouteFromType($activity->subject_type), $activity->subject_id).'">'.$activity->subject->name ?? ''.'</a>';
30 30
                 } else {
31 31
                     return '';
32 32
                 }
33 33
             })
34
-            ->editColumn('properties', function ($activity) {
34
+            ->editColumn('properties', function($activity) {
35 35
                 return $activity->properties;
36 36
             })
37
-            ->editColumn('created_at', function ($activity) {
37
+            ->editColumn('created_at', function($activity) {
38 38
                 if ($activity->created_at->diffInDays() > 0)
39 39
                     return $activity->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
40 40
                 else
41 41
                     return $activity->created_at->diffForHumans();
42 42
             })
43
-            ->rawColumns(['causer_id', 'subject_id', 'properties']);
43
+            ->rawColumns([ 'causer_id', 'subject_id', 'properties' ]);
44 44
     }
45 45
     
46 46
     public function getRouteFromType($type) {
@@ -137,6 +137,6 @@  discard block
 block discarded – undo
137 137
      */
138 138
     protected function filename()
139 139
     {
140
-        return 'activitylog_' . time();
140
+        return 'activitylog_'.time();
141 141
     }
142 142
 }
Please login to merge, or discard this patch.
app/DataTables/UsersDataTable.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@
 block discarded – undo
16 16
     {
17 17
         return datatables($query)
18 18
             ->editColumn('name', function(User $user) {
19
-                return '<a href="' . route('user.show', $user->id) . '">'. $user->name . '</a>';
19
+                return '<a href="'.route('user.show', $user->id).'">'.$user->name.'</a>';
20 20
             })
21 21
 
22 22
             ->editColumn('role', function(User $user) {
23 23
                 return $user->roleString();
24 24
             })
25
-            ->editColumn('updated_at', function ($user) {
25
+            ->editColumn('updated_at', function($user) {
26 26
                 return $user->updatedAtHuman;
27 27
             })
28
-            ->editColumn('created_at', function ($user) {
28
+            ->editColumn('created_at', function($user) {
29 29
                 return $user->createdAtHuman;
30 30
             })
31 31
             ->addColumn('action', 'user.action')
Please login to merge, or discard this patch.
app/SensorData.php 1 patch
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -145,10 +145,11 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function getUpdatedAtHumanAttribute()
147 147
     {
148
-        if ($this->updated_at->diffInDays() > 0)
149
-            return $this->updated_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
150
-        else
151
-            return $this->updated_at->diffForHumans();
148
+        if ($this->updated_at->diffInDays() > 0) {
149
+                    return $this->updated_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
150
+        } else {
151
+                    return $this->updated_at->diffForHumans();
152
+        }
152 153
     }
153 154
     
154 155
     /**
@@ -163,9 +164,10 @@  discard block
 block discarded – undo
163 164
      */
164 165
     public function getCreatedAtHumanAttribute()
165 166
     {
166
-        if ($this->created_at->diffInDays() > 0)
167
-            return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
168
-        else
169
-            return $this->created_at->diffForHumans();
167
+        if ($this->created_at->diffInDays() > 0) {
168
+                    return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a');
169
+        } else {
170
+                    return $this->created_at->diffForHumans();
171
+        }
170 172
     }
171 173
 }
172 174
\ No newline at end of file
Please login to merge, or discard this patch.