@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | if (Storage::disk('private')->exists('deviceimage/'.$device_id)) { |
31 | 31 | $image = Image::make(Storage::disk('private')->get('deviceimage/'.$device_id)); |
32 | 32 | } else { |
33 | - $image = Image::make(public_path() . '/img/video_not_found.jpg'); |
|
33 | + $image = Image::make(public_path().'/img/video_not_found.jpg'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | return $image->response(); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function store($device_id, $binaryData) |
47 | 47 | { |
48 | - $storagePath = storage_path('app/private/deviceimage/') . $device_id; |
|
48 | + $storagePath = storage_path('app/private/deviceimage/').$device_id; |
|
49 | 49 | $image = Image::make($binaryData); |
50 | 50 | $image->save($storagePath, 75); |
51 | 51 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected static $ignoreChangedAttributes = ['updated_at']; |
|
27 | + protected static $ignoreChangedAttributes = [ 'updated_at' ]; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * The attributes to log in the Activity Log |
@@ -17,7 +17,7 @@ |
||
17 | 17 | { |
18 | 18 | return datatables($query) |
19 | 19 | ->addColumn('action', 'device.action') |
20 | - ->blacklist([ 'action']) |
|
20 | + ->blacklist([ 'action' ]) |
|
21 | 21 | ->setRowClass(function($device) { |
22 | 22 | return $device->trashed() ? 'alert-danger' : ""; |
23 | 23 | }); |
@@ -29,7 +29,7 @@ discard block |
||
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 |
||
48 | 48 | * |
49 | 49 | * @var array |
50 | 50 | */ |
51 | - protected static $ignoreChangedAttributes = ['updated_at']; |
|
51 | + protected static $ignoreChangedAttributes = [ 'updated_at' ]; |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * The attributes to log in the Activity Log |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | else |
150 | 150 | $time = new Carbon($value, 'UTC'); |
151 | 151 | |
152 | - $this->attributes['open_time'] = $time; |
|
152 | + $this->attributes[ 'open_time' ] = $time; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | else |
172 | 172 | $time = new Carbon($value, 'UTC'); |
173 | 173 | |
174 | - $this->attributes['close_time'] = $time; |
|
174 | + $this->attributes[ 'close_time' ] = $time; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected static $ignoreChangedAttributes = ['updated_at']; |
|
27 | + protected static $ignoreChangedAttributes = [ 'updated_at' ]; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * The attributes to log in the Activity Log |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected static $ignoreChangedAttributes = ['updated_at']; |
|
27 | + protected static $ignoreChangedAttributes = [ 'updated_at' ]; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * The attributes to log in the Activity Log |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | //Get the first device that doesn't have a null location_id |
36 | 36 | $device = Device::publicDashData()->where('location_id', '!=', 'null')->orderBy('id', 'ASC')->first(); |
37 | 37 | } |
38 | - catch(ModelNotFoundException $e) |
|
38 | + catch (ModelNotFoundException $e) |
|
39 | 39 | { |
40 | 40 | //If no device is found then redirect the user to the home page and display a message about registering a device |
41 | 41 | return redirect('home')->with('no_devices', 'To access the dashboard page there must be at least one registered device assigned to a location.'); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $data = $this->dashData($site, $location, $device); |
50 | 50 | |
51 | - return view('dashboard.index', [ 'active_device' => $data[0], 'devices' => $data[1], 'locations' => $data[2], 'sites' => $data[3] ]); |
|
51 | + return view('dashboard.index', [ 'active_device' => $data[ 0 ], 'devices' => $data[ 1 ], 'locations' => $data[ 2 ], 'sites' => $data[ 3 ] ]); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | //Get the first site and if no sites exist throw an error |
93 | 93 | $site = Site::select('id', 'name')->firstOrFail(); |
94 | 94 | } |
95 | - catch(ModelNotFoundException $e) |
|
95 | + catch (ModelNotFoundException $e) |
|
96 | 96 | { |
97 | 97 | //If no device is found then redirect the user to the home page and display a message about registering a device |
98 | 98 | return redirect('home')->with('no_devices', 'To access the dashboard page there must be at least one registered device assigned to a location.'); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | $data = $this->dashData($site, $location, $device); |
120 | 120 | |
121 | - return response()->json([ 'active_device' => $data[0], 'devices' => $data[1], 'locations' => $data[2], 'sites' => $data[3] ]); |
|
121 | + return response()->json([ 'active_device' => $data[ 0 ], 'devices' => $data[ 1 ], 'locations' => $data[ 2 ], 'sites' => $data[ 3 ] ]); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | $data = $this->dashData($site, $location, $device); |
140 | 140 | |
141 | - return response()->json([ 'active_device' => $data[0], 'devices' => $data[1], 'locations' => $data[2], 'sites' => $data[3] ]); |
|
141 | + return response()->json([ 'active_device' => $data[ 0 ], 'devices' => $data[ 1 ], 'locations' => $data[ 2 ], 'sites' => $data[ 3 ] ]); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | $data = $this->dashData($site, $location, $device); |
160 | 160 | |
161 | - return response()->json([ 'active_device' => $data[0], 'devices' => $data[1], 'locations' => $data[2], 'sites' => $data[3] ]); |
|
161 | + return response()->json([ 'active_device' => $data[ 0 ], 'devices' => $data[ 1 ], 'locations' => $data[ 2 ], 'sites' => $data[ 3 ] ]); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | //Get all the devices that belong to the given location ordered by name |
181 | 181 | $devices = $location->devices()->publicDashData()->orderBy('name', 'ASC')->get(); |
182 | 182 | |
183 | - $active_device = collect([$device, $location, $site]); |
|
183 | + $active_device = collect([ $device, $location, $site ]); |
|
184 | 184 | |
185 | - return collect([$active_device, $devices, $locations, $sites]); |
|
185 | + return collect([ $active_device, $devices, $locations, $sites ]); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | return response()->json("Device is currently in use.", 403); |
204 | 204 | |
205 | 205 | //1 = open, 2 = close, 3 = lock |
206 | - switch($request->command) |
|
206 | + switch ($request->command) |
|
207 | 207 | { |
208 | 208 | case 1: |
209 | 209 | $device->cover_command = 'open'; |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | |
240 | 240 | //Check if the current time is during the open schedule or not |
241 | 241 | if (($time_now > $open_time) && ($time_now < $close_time)) |
242 | - $command = 'open'; |
|
242 | + $command = 'open'; |
|
243 | 243 | else |
244 | - $command = 'close'; |
|
244 | + $command = 'close'; |
|
245 | 245 | } |
246 | 246 | else |
247 | - $command = 'lock'; |
|
247 | + $command = 'lock'; |
|
248 | 248 | |
249 | 249 | return $command; |
250 | 250 | } |
@@ -16,16 +16,16 @@ discard block |
||
16 | 16 | public function dataTable($query) |
17 | 17 | { |
18 | 18 | return datatables($query) |
19 | - ->editColumn('causer_id', function ($activity) { |
|
20 | - return ($activity->causer_id ? '<a href="/' . ($activity->causer_type == "App\User" ? 'user' : 'device') . '/' . $activity->causer_id . '">' . (is_object($activity->causer) ? $activity->causer->name : '') . '</a>' : 'App'); |
|
19 | + ->editColumn('causer_id', function($activity) { |
|
20 | + return ($activity->causer_id ? '<a href="/'.($activity->causer_type == "App\User" ? 'user' : 'device').'/'.$activity->causer_id.'">'.(is_object($activity->causer) ? $activity->causer->name : '').'</a>' : 'App'); |
|
21 | 21 | }) |
22 | - ->editColumn('subject_id', function ($activity) { |
|
23 | - return ($activity->subject_id ? '<a href="/' . ($activity->subject_type == "App\User" ? 'user' : 'device') . '/' . $activity->subject_id . '">' . (is_object($activity->subject) ? $activity->subject->name : '') . '</a>' : 'App'); |
|
22 | + ->editColumn('subject_id', function($activity) { |
|
23 | + return ($activity->subject_id ? '<a href="/'.($activity->subject_type == "App\User" ? 'user' : 'device').'/'.$activity->subject_id.'">'.(is_object($activity->subject) ? $activity->subject->name : '').'</a>' : 'App'); |
|
24 | 24 | }) |
25 | - ->editColumn('properties', function ($activity) { |
|
25 | + ->editColumn('properties', function($activity) { |
|
26 | 26 | return $activity->properties; |
27 | 27 | }) |
28 | - ->rawColumns(['causer_id', 'subject_id', 'properties']); |
|
28 | + ->rawColumns([ 'causer_id', 'subject_id', 'properties' ]); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -98,6 +98,6 @@ discard block |
||
98 | 98 | */ |
99 | 99 | protected function filename() |
100 | 100 | { |
101 | - return 'activitylog_' . time(); |
|
101 | + return 'activitylog_'.time(); |
|
102 | 102 | } |
103 | 103 | } |
@@ -143,6 +143,6 @@ |
||
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 | } |