@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | throw new ModelNotFoundException(); |
| 44 | 44 | } |
| 45 | 45 | $node = $this->model->where('api_key', $apiKey)->first(); |
| 46 | - if (!$node) { |
|
| 46 | + if ( ! $node) { |
|
| 47 | 47 | throw new ModelNotFoundException(); |
| 48 | 48 | } |
| 49 | 49 | return $node; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public function logBoot($device) |
| 56 | 56 | { |
| 57 | 57 | $record = $this->model->where('device_id', $device)->first(); |
| 58 | - if (!$record) { |
|
| 58 | + if ( ! $record) { |
|
| 59 | 59 | $record = $this->createRecord($device); |
| 60 | 60 | } |
| 61 | 61 | $record->last_boot = Carbon::now(); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | { |
| 189 | 189 | $payment = $this->getById($paymentId); |
| 190 | 190 | |
| 191 | - if (!empty($payment->user_id)) { |
|
| 191 | + if ( ! empty($payment->user_id)) { |
|
| 192 | 192 | throw new PaymentException('Payment already assigned to user'); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | public function getEquipmentFeePayments($referencePrefix) |
| 268 | 268 | { |
| 269 | - return $this->model->where('reason', 'equipment-fee')->get()->filter(function($payment) use($referencePrefix) { |
|
| 269 | + return $this->model->where('reason', 'equipment-fee')->get()->filter(function ($payment) use($referencePrefix) { |
|
| 270 | 270 | return strpos($payment->reference, ':' . $referencePrefix) !== false; |
| 271 | 271 | }); |
| 272 | 272 | } |
@@ -6,34 +6,34 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Registrar implements RegistrarContract { |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * Get a validator for an incoming registration request. |
|
| 11 | - * |
|
| 12 | - * @param array $data |
|
| 13 | - * @return \Illuminate\Contracts\Validation\Validator |
|
| 14 | - */ |
|
| 15 | - public function validator(array $data) |
|
| 16 | - { |
|
| 17 | - return Validator::make($data, [ |
|
| 18 | - 'name' => 'required|max:255', |
|
| 19 | - 'email' => 'required|email|max:255|unique:users', |
|
| 20 | - 'password' => 'required|confirmed|min:6', |
|
| 21 | - ]); |
|
| 22 | - } |
|
| 9 | + /** |
|
| 10 | + * Get a validator for an incoming registration request. |
|
| 11 | + * |
|
| 12 | + * @param array $data |
|
| 13 | + * @return \Illuminate\Contracts\Validation\Validator |
|
| 14 | + */ |
|
| 15 | + public function validator(array $data) |
|
| 16 | + { |
|
| 17 | + return Validator::make($data, [ |
|
| 18 | + 'name' => 'required|max:255', |
|
| 19 | + 'email' => 'required|email|max:255|unique:users', |
|
| 20 | + 'password' => 'required|confirmed|min:6', |
|
| 21 | + ]); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Create a new user instance after a valid registration. |
|
| 26 | - * |
|
| 27 | - * @param array $data |
|
| 28 | - * @return User |
|
| 29 | - */ |
|
| 30 | - public function create(array $data) |
|
| 31 | - { |
|
| 32 | - return User::create([ |
|
| 33 | - 'name' => $data['name'], |
|
| 34 | - 'email' => $data['email'], |
|
| 35 | - 'password' => bcrypt($data['password']), |
|
| 36 | - ]); |
|
| 37 | - } |
|
| 24 | + /** |
|
| 25 | + * Create a new user instance after a valid registration. |
|
| 26 | + * |
|
| 27 | + * @param array $data |
|
| 28 | + * @return User |
|
| 29 | + */ |
|
| 30 | + public function create(array $data) |
|
| 31 | + { |
|
| 32 | + return User::create([ |
|
| 33 | + 'name' => $data['name'], |
|
| 34 | + 'email' => $data['email'], |
|
| 35 | + 'password' => bcrypt($data['password']), |
|
| 36 | + ]); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | 39 | } |
@@ -4,7 +4,8 @@ |
||
| 4 | 4 | use Validator; |
| 5 | 5 | use Illuminate\Contracts\Auth\Registrar as RegistrarContract; |
| 6 | 6 | |
| 7 | -class Registrar implements RegistrarContract { |
|
| 7 | +class Registrar implements RegistrarContract |
|
| 8 | +{ |
|
| 8 | 9 | |
| 9 | 10 | /** |
| 10 | 11 | * Get a validator for an incoming registration request. |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use Illuminate\Contracts\Validation\UnauthorizedException; |
| 7 | 7 | use Illuminate\Http\Request; |
| 8 | 8 | use Auth; |
| 9 | -use BB\Http\Requests; |
|
| 10 | 9 | |
| 11 | 10 | |
| 12 | 11 | class NotificationController extends Controller |
@@ -225,7 +225,7 @@ |
||
| 225 | 225 | |
| 226 | 226 | $equipment->addPhoto($newFilename); |
| 227 | 227 | |
| 228 | - } catch(\Exception $e) { |
|
| 228 | + } catch (\Exception $e) { |
|
| 229 | 229 | \Log::error($e); |
| 230 | 230 | throw new ImageFailedException($e->getMessage()); |
| 231 | 231 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $memberData['hash'] = str_random(30); |
| 111 | 111 | |
| 112 | - $memberData['rules_agreed'] = $memberData['rules_agreed']? Carbon::now(): null; |
|
| 112 | + $memberData['rules_agreed'] = $memberData['rules_agreed'] ? Carbon::now() : null; |
|
| 113 | 113 | |
| 114 | 114 | $user = $this->model->create($memberData); |
| 115 | 115 | $this->profileDataRepository->createProfile($user->id); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | $user->induction_completed = true; |
| 220 | 220 | |
| 221 | - $user->rules_agreed = $user->rules_agreed? $user->rules_agreed: Carbon::now(); |
|
| 221 | + $user->rules_agreed = $user->rules_agreed ? $user->rules_agreed : Carbon::now(); |
|
| 222 | 222 | |
| 223 | 223 | $user->save(); |
| 224 | 224 | } |
@@ -210,7 +210,7 @@ |
||
| 210 | 210 | /** |
| 211 | 211 | * Record the fact that the user has agreed to the member induction and the rules |
| 212 | 212 | * |
| 213 | - * @param $userId |
|
| 213 | + * @param integer $userId |
|
| 214 | 214 | */ |
| 215 | 215 | public function recordInductionCompleted($userId) |
| 216 | 216 | { |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use BB\Events\MemberGivenTrustedStatus; |
| 7 | 7 | use BB\Events\MemberPhotoWasDeclined; |
| 8 | 8 | use BB\Exceptions\ValidationException; |
| 9 | -use BB\Validators\InductionValidator; |
|
| 10 | 9 | |
| 11 | 10 | class AccountController extends Controller |
| 12 | 11 | { |
@@ -358,7 +358,7 @@ |
||
| 358 | 358 | |
| 359 | 359 | if ($amount < 5) { |
| 360 | 360 | throw new ValidationException('The minimum subscription is 5 GBP'); |
| 361 | - } elseif (!\Auth::user()->isAdmin() && ($amount < 15)) { |
|
| 361 | + } elseif ( ! \Auth::user()->isAdmin() && ($amount < 15)) { |
|
| 362 | 362 | throw new ValidationException('The minimum subscription is 15 GBP, please contact the trustees for a lower amount. [email protected]'); |
| 363 | 363 | } |
| 364 | 364 | |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use Illuminate\Contracts\Validation\UnauthorizedException; |
| 7 | 7 | use Illuminate\Http\Request; |
| 8 | 8 | use Auth; |
| 9 | -use BB\Http\Requests; |
|
| 10 | 9 | |
| 11 | 10 | |
| 12 | 11 | class NotificationController extends Controller |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | Route::post('account/{account}/payment', ['uses' => 'PaymentController@store', 'as' => 'account.payment.store', 'middleware' => 'role:admin']); |
| 67 | 67 | |
| 68 | -Route::group(array('middleware' => 'role:finance'), function() { |
|
| 68 | +Route::group(array('middleware' => 'role:finance'), function () { |
|
| 69 | 69 | Route::resource('payments', 'PaymentController', ['only' => ['index', 'destroy', 'update']]); |
| 70 | 70 | Route::get('payments/overview', ['uses'=>'PaymentOverviewController@index', 'as'=>'payments.overview']); |
| 71 | 71 | Route::get('payments/sub-charges', ['as' => 'payments.sub-charges', 'uses' => 'SubscriptionController@listCharges']); |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | //Cash |
| 87 | -Route::group(array('middleware' => 'role:admin'), function() { |
|
| 87 | +Route::group(array('middleware' => 'role:admin'), function () { |
|
| 88 | 88 | Route::post('account/{account}/payment/cash/create', ['as'=>'account.payment.cash.create', 'uses' => 'CashPaymentController@store']); |
| 89 | 89 | Route::delete('account/{account}/payment/cash', ['as'=>'account.payment.cash.destroy', 'uses' => 'CashPaymentController@destroy']); |
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | 92 | # Statements |
| 93 | -Route::group(array('middleware' => 'role:finance'), function() { |
|
| 93 | +Route::group(array('middleware' => 'role:finance'), function () { |
|
| 94 | 94 | Route::resource('statement-import', 'StatementImportController', ['except' => ['index', 'show', 'edit', 'update', 'destroy']]); |
| 95 | 95 | }); |
| 96 | 96 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | # Inductions |
| 104 | 104 | ########################## |
| 105 | 105 | |
| 106 | -Route::group(array('middleware' => 'role:admin'), function() { |
|
| 106 | +Route::group(array('middleware' => 'role:admin'), function () { |
|
| 107 | 107 | Route::post('equipment_training/update', ['uses'=>'InductionController@update', 'as'=>'equipment_training.update']); |
| 108 | 108 | Route::resource('account.induction', 'InductionController', ['only' => ['update', 'destroy']]); |
| 109 | 109 | }); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | # Equipment |
| 115 | 115 | ########################## |
| 116 | 116 | |
| 117 | -Route::group(array('middleware' => 'role:member'), function() { |
|
| 117 | +Route::group(array('middleware' => 'role:member'), function () { |
|
| 118 | 118 | Route::resource('equipment', 'EquipmentController'); |
| 119 | 119 | Route::post('equipment/{id}/photo', ['uses'=>'EquipmentController@addPhoto', 'as'=>'equipment.photo.store']); |
| 120 | 120 | Route::delete('equipment/{id}/photo/{key}', ['uses'=>'EquipmentController@destroyPhoto', 'as'=>'equipment.photo.destroy']); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | # Key fobs |
| 138 | 138 | ########################## |
| 139 | 139 | |
| 140 | -Route::group(array('middleware' => 'role:admin'), function() { |
|
| 140 | +Route::group(array('middleware' => 'role:admin'), function () { |
|
| 141 | 141 | Route::resource('keyfob', 'KeyFobController', ['only' => ['index', 'store', 'update', 'destroy']]); |
| 142 | 142 | }); |
| 143 | 143 | |
@@ -169,11 +169,11 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | Route::post('camera/event/store', ['uses' => 'CCTVController@store']); |
| 171 | 171 | |
| 172 | -Route::group(array('middleware' => 'role:admin'), function() { |
|
| 172 | +Route::group(array('middleware' => 'role:admin'), function () { |
|
| 173 | 173 | Route::resource('detected_devices', 'DetectedDevicesController'); |
| 174 | 174 | }); |
| 175 | 175 | |
| 176 | -Route::group(array('middleware' => 'role:acs'), function() { |
|
| 176 | +Route::group(array('middleware' => 'role:acs'), function () { |
|
| 177 | 177 | Route::resource('devices', 'DeviceController'); |
| 178 | 178 | }); |
| 179 | 179 | |
@@ -249,11 +249,11 @@ discard block |
||
| 249 | 249 | # Roles |
| 250 | 250 | ########################## |
| 251 | 251 | |
| 252 | -Route::group(array('middleware' => 'role:admin'), function() { |
|
| 252 | +Route::group(array('middleware' => 'role:admin'), function () { |
|
| 253 | 253 | Route::resource('roles', 'RolesController', []); |
| 254 | 254 | Route::resource('roles.users', 'RoleUsersController', ['only' => ['destroy', 'store']]); |
| 255 | 255 | }); |
| 256 | -Route::group(array('middleware' => 'role:member'), function() { |
|
| 256 | +Route::group(array('middleware' => 'role:member'), function () { |
|
| 257 | 257 | Route::resource('groups', 'GroupsController', ['only' => ['index', 'show']]); |
| 258 | 258 | }); |
| 259 | 259 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | # Expenses |
| 273 | 273 | ########################## |
| 274 | 274 | |
| 275 | -Route::group(array('middleware' => 'role:member'), function() { |
|
| 275 | +Route::group(array('middleware' => 'role:member'), function () { |
|
| 276 | 276 | Route::resource('expenses', 'ExpensesController'); |
| 277 | 277 | }); |
| 278 | 278 | |
@@ -289,10 +289,10 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | |
| 291 | 291 | |
| 292 | -Route::any('api-docs.json', function() { |
|
| 292 | +Route::any('api-docs.json', function () { |
|
| 293 | 293 | $filePath = Config::get('swagger.doc-dir') . "/api-docs.json"; |
| 294 | 294 | |
| 295 | - if (!File::Exists($filePath)) { |
|
| 295 | + if ( ! File::Exists($filePath)) { |
|
| 296 | 296 | App::abort(404, "Cannot find {$filePath}"); |
| 297 | 297 | } |
| 298 | 298 | |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | )); |
| 303 | 303 | }); |
| 304 | 304 | |
| 305 | -Route::get('api-docs', function() { |
|
| 305 | +Route::get('api-docs', function () { |
|
| 306 | 306 | if (Config::get('swagger.generateAlways')) { |
| 307 | - $appDir = base_path()."/".Config::get('swagger.app-dir'); |
|
| 307 | + $appDir = base_path() . "/" . Config::get('swagger.app-dir'); |
|
| 308 | 308 | $docDir = Config::get('swagger.doc-dir'); |
| 309 | 309 | |
| 310 | 310 | |
| 311 | - if (!File::exists($docDir) || is_writable($docDir)) { |
|
| 311 | + if ( ! File::exists($docDir) || is_writable($docDir)) { |
|
| 312 | 312 | // delete all existing documentation |
| 313 | 313 | if (File::exists($docDir)) { |
| 314 | 314 | File::deleteDirectory($docDir); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | $excludeDirs = Config::get('swagger.excludes'); |
| 320 | 320 | |
| 321 | - $swagger = \Swagger\scan($appDir, [ |
|
| 321 | + $swagger = \Swagger\scan($appDir, [ |
|
| 322 | 322 | 'exclude' => $excludeDirs |
| 323 | 323 | ]); |
| 324 | 324 | |