Completed
Pull Request — master (#107)
by
unknown
02:22
created
app/Http/Requests/EditDevice.php 1 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:75|name|unique:sites,name', function ($input) {
57
+        $validator->sometimes('new_site_name', 'bail|min:2|max:75|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:75|name|unique:locations,name', function ($input) {
61
+        $validator->sometimes('new_location_name', 'bail|min:2|max:75|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/Http/Controllers/SiteController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/Http/Controllers/DeviceController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/Device.php 1 patch
Spacing   +6 added lines, -6 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'];
51
+    protected static $ignoreChangedAttributes = [ 'updated_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
     /**
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         else
150 150
             $time = new Carbon($value, 'UTC');
151 151
         
152
-        $this->attributes['open_time'] = $time->format('H:i:s');
152
+        $this->attributes[ 'open_time' ] = $time->format('H:i:s');
153 153
     }
154 154
     
155 155
     /**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         else
172 172
             $time = new Carbon($value, 'UTC');
173 173
         
174
-        $this->attributes['close_time'] = $time->format('H:i:s');
174
+        $this->attributes[ 'close_time' ] = $time->format('H:i:s');
175 175
     }
176 176
     
177 177
     /**
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
         $isClosed = $this->cover_status === 'closed';
312 312
         $isLocked = $this->cover_status === 'locked';
313 313
             
314
-        switch ($this['cover_command'])
314
+        switch ($this[ 'cover_command' ])
315 315
         {
316 316
             case 'open':
317 317
                 if ($isOpen)
Please login to merge, or discard this patch.