@@ -46,19 +46,19 @@ |
||
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 |
@@ -27,10 +27,11 @@ |
||
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 | } |
@@ -17,30 +17,30 @@ discard block |
||
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 && is_object($activity->causer)) { |
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 && is_object($activity->subject)) { |
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 |
||
137 | 137 | */ |
138 | 138 | protected function filename() |
139 | 139 | { |
140 | - return 'activitylog_' . time(); |
|
140 | + return 'activitylog_'.time(); |
|
141 | 141 | } |
142 | 142 | } |
@@ -16,19 +16,19 @@ |
||
16 | 16 | public function dataTable($query) |
17 | 17 | { |
18 | 18 | return datatables($query) |
19 | - ->editColumn('name', function ($device) { |
|
20 | - return '<a href="' . route('device.show', $device->id) . '">' . $device->name . '</a>'; |
|
19 | + ->editColumn('name', function($device) { |
|
20 | + return '<a href="'.route('device.show', $device->id).'">'.$device->name.'</a>'; |
|
21 | 21 | }) |
22 | - ->addColumn('location', function ($device) { |
|
22 | + ->addColumn('location', function($device) { |
|
23 | 23 | return ($device->location->name ?? 'null'); |
24 | 24 | }) |
25 | - ->addColumn('site', function ($device) { |
|
25 | + ->addColumn('site', function($device) { |
|
26 | 26 | return ($device->location->site->name ?? 'null'); |
27 | 27 | }) |
28 | - ->addColumn('rates', function ($device) { |
|
29 | - return $device->update_rate . '/' . $device->image_rate .'/' . $device->sensor_rate; |
|
28 | + ->addColumn('rates', function($device) { |
|
29 | + return $device->update_rate.'/'.$device->image_rate.'/'.$device->sensor_rate; |
|
30 | 30 | }) |
31 | - ->editColumn('updated_at', function ($device) { |
|
31 | + ->editColumn('updated_at', function($device) { |
|
32 | 32 | return (is_object($device->updated_at) ? $device->updatedAtHuman : 'null'); |
33 | 33 | }) |
34 | 34 | ->blacklist([ 'location', 'site', 'rates' ]) |
@@ -16,16 +16,16 @@ |
||
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') |
@@ -145,10 +145,11 @@ discard block |
||
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 |
||
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 |
@@ -54,10 +54,10 @@ |
||
54 | 54 | 'registration_password' => 'required|string|min:8', |
55 | 55 | ]); |
56 | 56 | |
57 | - return $validator->after(function ($validator) { |
|
57 | + return $validator->after(function($validator) { |
|
58 | 58 | if (array_key_exists('registration_password', $validator->valid())) |
59 | 59 | { |
60 | - if ($validator->valid()['registration_password'] != env('REGISTRATION_CHALLENGE', 'temppass')) { |
|
60 | + if ($validator->valid()[ 'registration_password' ] != env('REGISTRATION_CHALLENGE', 'temppass')) { |
|
61 | 61 | $validator->errors()->add('registration_password', 'Incorrect registration password.'); |
62 | 62 | } |
63 | 63 | } |