@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | 'name' => 'required|min:2|max:75|name|unique:sites,name', |
50 | 50 | ]); |
51 | 51 | |
52 | - $site = Site::create(['name' => $request->name]); |
|
52 | + $site = Site::create([ 'name' => $request->name ]); |
|
53 | 53 | |
54 | 54 | return redirect()->route('site.show', $site->id) |
55 | 55 | ->with('success', 'Site created successfully'); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $locations = $site->locations()->orderBy('name', 'ASC')->paginate(15); |
68 | 68 | |
69 | 69 | if (\Request::ajax()) |
70 | - return response()->json(['site' => $site, 'locations' => $locations]); |
|
70 | + return response()->json([ 'site' => $site, 'locations' => $locations ]); |
|
71 | 71 | else |
72 | 72 | return view('site.show', [ 'site' => $site, 'locations' => $locations ]); |
73 | 73 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'name' => 'required|min:2|max:75|name|unique:sites,name,'.$site->id, |
99 | 99 | ]); |
100 | 100 | |
101 | - $site->update(['name' => $request->name]); |
|
101 | + $site->update([ 'name' => $request->name ]); |
|
102 | 102 | |
103 | 103 | return redirect()->route('site.show', $site->id) |
104 | 104 | ->with('success', 'Site updated successfully'); |
@@ -114,6 +114,6 @@ discard block |
||
114 | 114 | { |
115 | 115 | Site::findOrFail($id)->delete(); |
116 | 116 | return redirect()->route('site.index') |
117 | - ->with('success','Site deleted successfully'); |
|
117 | + ->with('success', 'Site deleted successfully'); |
|
118 | 118 | } |
119 | 119 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | { |
56 | 56 | $device = Device::findOrFail($id); |
57 | 57 | |
58 | - $charts = []; |
|
58 | + $charts = [ ]; |
|
59 | 59 | foreach ($device->sensors as $sensor) { |
60 | 60 | $data = $sensor->last_month_daily_avg_data; |
61 | - $charts[$sensor->id] = Charts::create('line', 'highcharts') |
|
61 | + $charts[ $sensor->id ] = Charts::create('line', 'highcharts') |
|
62 | 62 | ->title($sensor->name) |
63 | 63 | ->elementLabel($sensor->type) |
64 | 64 | ->labels($data->pluck('date')) |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $sites = Site::select('id', 'name')->orderByRaw("id = ? DESC", $site_id) |
91 | 91 | ->orderBy('name', 'ASC')->get(); |
92 | 92 | //Get all locations for the selected site with the selected location first |
93 | - $locations = Location::select('id', 'name')->where('site_id', '=', $sites[0]->id ?? 0) |
|
93 | + $locations = Location::select('id', 'name')->where('site_id', '=', $sites[ 0 ]->id ?? 0) |
|
94 | 94 | ->orderByRaw("id = ? DESC", $location_id)->orderBy('name', 'ASC')->get(); |
95 | 95 | |
96 | 96 | return view('device.edit', [ 'device' => $device, 'locations' => $locations, 'sites' => $sites ]); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if (!empty($request->input('new_site_name'))) |
117 | 117 | { |
118 | 118 | //Create a new site |
119 | - $site = Site::create(['name' => $request->input('new_site_name')]); |
|
119 | + $site = Site::create([ 'name' => $request->input('new_site_name') ]); |
|
120 | 120 | $site_id = $site->id; |
121 | 121 | } else |
122 | 122 | $site_id = $request->input('site_id'); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | if (!empty($request->input('new_location_name'))) |
126 | 126 | { |
127 | 127 | //Create a new location |
128 | - $location = Location::create(['name' => $request->input('new_location_name'), 'site_id' => $site_id]); |
|
128 | + $location = Location::create([ 'name' => $request->input('new_location_name'), 'site_id' => $site_id ]); |
|
129 | 129 | $location_id = $location->id; |
130 | 130 | } else |
131 | 131 | $location_id = $request->input('location_id'); |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | if ($request->command === 'unlock') |
160 | 160 | { |
161 | 161 | if ($device->isDuringScheduleOpen()) |
162 | - $command = 'open'; |
|
162 | + $command = 'open'; |
|
163 | 163 | else |
164 | - $command = 'close'; |
|
164 | + $command = 'close'; |
|
165 | 165 | } |
166 | 166 | $device->cover_command = $command; |
167 | 167 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $device->save(); |
170 | 170 | |
171 | 171 | if (\Request::ajax()) |
172 | - return response()->json(['success' => 'Device updated successfully']); |
|
172 | + return response()->json([ 'success' => 'Device updated successfully' ]); |
|
173 | 173 | else |
174 | 174 | return redirect()->route('device.show', $id) |
175 | 175 | ->with('success', 'Device updated successfully'); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | return redirect()->route('device.index') |
204 | - ->with('success','Device deleted successfully'); |
|
204 | + ->with('success', 'Device deleted successfully'); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -217,6 +217,6 @@ discard block |
||
217 | 217 | $device->restore(); |
218 | 218 | |
219 | 219 | return redirect()->route('device.show', $device->id) |
220 | - ->with('success','Device restored successfully'); |
|
220 | + ->with('success', 'Device restored successfully'); |
|
221 | 221 | } |
222 | 222 | } |
@@ -69,7 +69,7 @@ |
||
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 | /** |
@@ -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', '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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) |