From 6541e25a39c2906912ce80fc30e0a8e2cfac7efa Mon Sep 17 00:00:00 2001 From: Miguel Nogueira Date: Sat, 10 Oct 2020 16:30:26 +0000 Subject: [PATCH] Apply fixes from StyleCI --- app/Application.php | 28 +- app/Appointment.php | 25 +- app/Ban.php | 25 +- app/Comment.php | 23 +- app/Console/Commands/CountVotes.php | 79 +++--- app/Console/Commands/Install.php | 159 ++++++------ app/Console/Commands/SetEnv.php | 43 ++- app/Console/Kernel.php | 21 +- app/CustomFacades/IP.php | 45 ++-- app/Events/ApplicationApprovedEvent.php | 25 +- app/Events/ApplicationDeniedEvent.php | 24 +- app/Events/NewApplicationEvent.php | 22 +- app/Events/UserBannedEvent.php | 30 ++- app/Exceptions/Handler.php | 19 ++ app/Facades/ContextAwareValidation.php | 30 ++- app/Facades/IP.php | 19 ++ app/Facades/Options.php | 21 +- app/Facades/UUID.php | 23 +- app/Form.php | 21 +- app/Helpers/ContextAwareValidator.php | 185 ++++++------- app/Helpers/Options.php | 61 +++-- .../Controllers/ApplicationController.php | 145 +++++------ .../Controllers/AppointmentController.php | 51 ++-- .../Auth/ConfirmPasswordController.php | 20 +- .../Auth/ForgotPasswordController.php | 19 ++ app/Http/Controllers/Auth/LoginController.php | 35 ++- .../Controllers/Auth/RegisterController.php | 33 ++- .../Auth/ResetPasswordController.php | 20 +- app/Http/Controllers/Auth/TwofaController.php | 26 +- .../Auth/VerificationController.php | 20 +- app/Http/Controllers/BanController.php | 61 ++--- app/Http/Controllers/CommentController.php | 42 +-- app/Http/Controllers/ContactController.php | 55 ++-- app/Http/Controllers/Controller.php | 19 ++ app/Http/Controllers/DashboardController.php | 38 ++- app/Http/Controllers/DevToolsController.php | 36 ++- app/Http/Controllers/FormController.php | 96 +++---- app/Http/Controllers/HomeController.php | 23 +- app/Http/Controllers/OptionsController.php | 102 ++++---- app/Http/Controllers/ProfileController.php | 78 +++--- app/Http/Controllers/ResponseController.php | 21 +- .../Controllers/StaffProfileController.php | 21 +- app/Http/Controllers/TeamController.php | 99 +++---- app/Http/Controllers/UserController.php | 245 ++++++++---------- app/Http/Controllers/VacancyController.php | 106 ++++---- app/Http/Controllers/VoteController.php | 27 +- app/Http/Kernel.php | 21 +- .../Middleware/ApplicationEligibility.php | 39 ++- app/Http/Middleware/Authenticate.php | 19 ++ app/Http/Middleware/Bancheck.php | 31 ++- .../Middleware/CheckForMaintenanceMode.php | 19 ++ app/Http/Middleware/EncryptCookies.php | 19 ++ app/Http/Middleware/ForceLogoutMiddleware.php | 23 +- .../Middleware/RedirectIfAuthenticated.php | 19 ++ app/Http/Middleware/TrimStrings.php | 19 ++ app/Http/Middleware/TrustProxies.php | 21 +- app/Http/Middleware/UsernameUUID.php | 40 ++- app/Http/Middleware/VerifyCsrfToken.php | 19 ++ app/Http/Requests/Add2FASecretRequest.php | 23 +- app/Http/Requests/BanUserRequest.php | 22 +- app/Http/Requests/ChangeEmailRequest.php | 21 +- app/Http/Requests/ChangePasswordRequest.php | 21 +- app/Http/Requests/DeleteUserRequest.php | 21 +- app/Http/Requests/EditTeamRequest.php | 21 +- app/Http/Requests/FlushSessionsRequest.php | 21 +- app/Http/Requests/NewCommentRequest.php | 22 +- app/Http/Requests/NewTeamRequest.php | 21 +- app/Http/Requests/ProfileSave.php | 22 +- app/Http/Requests/Remove2FASecretRequest.php | 21 +- app/Http/Requests/SaveNotesRequest.php | 21 +- app/Http/Requests/SearchPlayerRequest.php | 21 +- app/Http/Requests/SendInviteRequest.php | 21 +- app/Http/Requests/UpdateUserRequest.php | 21 +- app/Http/Requests/UserDeleteRequest.php | 26 +- app/Http/Requests/VacancyEditRequest.php | 22 +- app/Http/Requests/VacancyRequest.php | 21 +- app/Http/Requests/VoteRequest.php | 21 +- app/Jobs/CleanBans.php | 47 ++-- app/Listeners/DenyUser.php | 24 +- app/Listeners/LogAuthenticationFailure.php | 26 +- app/Listeners/LogAuthenticationSuccess.php | 21 +- app/Listeners/OnUserBanned.php | 39 ++- app/Listeners/OnUserRegistration.php | 36 ++- app/Listeners/PromoteUser.php | 31 ++- app/Mail/InviteToTeam.php | 27 +- app/Mail/NewContactSubmission.php | 20 +- app/Mail/UserAccountDeleteConfirmation.php | 29 ++- app/Notifications/ApplicationApproved.php | 29 ++- app/Notifications/ApplicationDenied.php | 36 ++- app/Notifications/ApplicationMoved.php | 25 +- app/Notifications/AppointmentFinished.php | 21 +- app/Notifications/AppointmentScheduled.php | 31 ++- app/Notifications/ChangedPassword.php | 21 +- app/Notifications/EmailChanged.php | 21 +- app/Notifications/NewApplicant.php | 48 ++-- app/Notifications/NewComment.php | 30 ++- app/Notifications/NewContact.php | 35 ++- app/Notifications/NewUser.php | 58 +++-- app/Notifications/UserBanned.php | 29 ++- app/Notifications/VacancyClosed.php | 32 ++- app/Observers/ApplicationObserver.php | 33 ++- app/Observers/UserObserver.php | 43 +-- app/Observers/VacancyObserver.php | 20 +- app/Options.php | 21 +- app/Policies/ApplicationPolicy.php | 43 ++- app/Policies/AppointmentPolicy.php | 19 ++ app/Policies/BanPolicy.php | 24 +- app/Policies/CommentPolicy.php | 22 +- app/Policies/FormPolicy.php | 22 +- app/Policies/ProfilePolicy.php | 20 +- app/Policies/UserPolicy.php | 26 +- app/Policies/VacancyPolicy.php | 20 ++ app/Policies/VotePolicy.php | 19 ++ app/Profile.php | 23 +- app/Providers/AppServiceProvider.php | 25 +- app/Providers/AuthServiceProvider.php | 49 ++-- app/Providers/BroadcastServiceProvider.php | 19 ++ .../ContextAwareValidatorProvider.php | 30 ++- app/Providers/EventServiceProvider.php | 34 ++- app/Providers/IPInfoProvider.php | 25 +- app/Providers/MojangStatusProvider.php | 35 ++- app/Providers/OptionsProvider.php | 23 +- app/Providers/RouteServiceProvider.php | 20 +- app/Providers/UUIDConversionProvider.php | 25 +- app/Response.php | 22 +- app/Services/VacancyApplicationService.php | 34 ++- app/StaffProfile.php | 21 +- app/Team.php | 23 +- app/Traits/AuthenticatesTwoFactor.php | 56 ++-- app/Traits/Cancellable.php | 32 ++- app/Traits/HandlesAccountTokens.php | 41 +-- app/Traits/ReceivesAccountTokens.php | 58 +++-- app/UUID/UUID.php | 61 +++-- app/User.php | 33 ++- app/Vacancy.php | 74 +++--- app/View/Components/Alert.php | 20 +- app/View/Components/Card.php | 23 +- app/View/Components/Form.php | 24 +- app/View/Components/GlobalErrors.php | 19 ++ app/View/Components/Modal.php | 22 +- app/View/Components/NoPermission.php | 24 +- app/Vote.php | 21 +- bootstrap/app.php | 26 +- config/adminlte.php | 197 +++++++------- config/app.php | 24 +- config/auth.php | 19 ++ config/broadcasting.php | 19 ++ config/cache.php | 19 ++ config/cors.php | 19 ++ config/database.php | 19 ++ config/filesystems.php | 19 ++ config/general.php | 34 ++- config/google2fa.php | 21 +- config/hashing.php | 19 ++ config/laravellocalization.php | 21 +- config/log-viewer.php | 21 +- config/logging.php | 19 ++ config/mail.php | 19 ++ config/markdown.php | 18 +- config/notification.php | 27 +- config/permission.php | 19 ++ config/queue.php | 19 ++ config/recaptcha.php | 25 +- config/sentry.php | 19 ++ config/services.php | 19 ++ config/session.php | 19 ++ config/slack.php | 26 +- config/teamwork.php | 19 ++ config/view.php | 19 ++ database/factories/UserFactory.php | 19 +- .../2014_10_12_000000_create_users_table.php | 19 ++ ...12_100000_create_password_resets_table.php | 19 ++ ..._08_19_000000_create_failed_jobs_table.php | 19 ++ ...020_04_29_022245_create_profiles_table.php | 21 +- ...04_29_022402_create_applications_table.php | 21 +- .../2020_04_29_022421_create_votes_table.php | 21 +- ...04_29_022442_create_appointments_table.php | 25 +- .../2020_04_29_022541_create_forms_table.php | 21 +- ...20_04_29_022542_create_vacancies_table.php | 20 +- ..._29_023647_create_staff_profiles_table.php | 19 ++ ...20_04_29_030107_create_responses_table.php | 20 +- ...020_04_29_195848_votes_has_application.php | 23 +- .../2020_05_02_223355_create_cache_table.php | 19 ++ ...0_05_07_021604_add_status_to_vacancies.php | 21 +- .../2020_05_08_024654_add_slug_to_vacancy.php | 19 ++ ...08_063141_add_vacancy_i_d_to_responses.php | 19 ++ ...14_004542_change_form_structure_length.php | 23 +- ..._05_29_234431_create_permission_tables.php | 23 +- .../2020_06_08_153602_create_bans_table.php | 20 +- ...020_06_20_210255_create_comments_table.php | 21 +- .../2020_06_25_093708_create_jobs_table.php | 19 ++ ...43_add_detailed_description_to_vacancy.php | 19 ++ ...07_17_053247_add_twofa_secret_to_users.php | 19 ++ ...2020_08_30_152900_create_options_table.php | 19 ++ ...020_09_10_174112_teamwork_setup_tables.php | 19 ++ .../2020_10_02_112730_add_team_details.php | 29 ++- ..._10_04_124115_vacancy_nullable_team_id.php | 27 +- .../2020_10_04_163715_team_has_vacancy.php | 23 +- ...0_07_095240_add_account_tokens_to_user.php | 19 ++ ...10_07_100540_add_soft_deletes_to_users.php | 19 ++ ...0_10_08_203356_add_uuid_to_failed_jobs.php | 19 ++ database/seeders/DatabaseSeeder.php | 20 ++ database/seeders/DefaultOptionsSeeder.php | 22 +- database/seeders/NewPermissions.php | 24 +- database/seeders/PermissionSeeder.php | 34 ++- database/seeders/TeamSeeder.php | 27 +- database/seeders/UserSeeder.php | 70 +++-- public/index.php | 20 +- resources/lang/en/auth.php | 19 ++ resources/lang/en/messages.php | 72 +++-- resources/lang/en/pagination.php | 19 ++ resources/lang/en/passwords.php | 19 ++ resources/lang/en/validation.php | 19 ++ resources/lang/es/auth.php | 19 ++ resources/lang/es/messages.php | 69 +++-- resources/lang/es/pagination.php | 19 ++ resources/lang/es/passwords.php | 19 ++ resources/lang/es/validation.php | 19 ++ resources/lang/fr/auth.php | 19 ++ resources/lang/fr/messages.php | 69 +++-- resources/lang/fr/pagination.php | 19 ++ resources/lang/fr/passwords.php | 19 ++ resources/lang/fr/validation.php | 19 ++ resources/lang/pt/auth.php | 19 ++ resources/lang/pt/messages.php | 77 +++--- resources/lang/pt/pagination.php | 19 ++ resources/lang/pt/passwords.php | 21 +- resources/lang/pt/validation.php | 19 ++ routes/api.php | 19 ++ routes/channels.php | 19 ++ routes/console.php | 19 ++ routes/web.php | 84 ++---- server.php | 20 +- tests/CreatesApplication.php | 19 ++ tests/Feature/ExampleTest.php | 20 +- tests/Feature/OptionsTest.php | 21 +- tests/TestCase.php | 19 ++ tests/Unit/ExampleTest.php | 19 ++ 238 files changed, 5627 insertions(+), 1878 deletions(-) diff --git a/app/Application.php b/app/Application.php index f1066d8..eae5c83 100644 --- a/app/Application.php +++ b/app/Application.php @@ -1,5 +1,24 @@ . + */ + namespace App; use Illuminate\Database\Eloquent\Model; @@ -10,13 +29,10 @@ class Application extends Model 'applicantUserID', 'applicantFormResponseID', - 'applicationStatus' + 'applicationStatus', ]; - - - public function user() { return $this->belongsTo('App\User', 'applicantUserID', 'id'); @@ -37,7 +53,6 @@ class Application extends Model return $this->belongsToMany('App\Vote', 'votes_has_application'); } - public function comments() { return $this->hasMany('App\Comment', 'applicationID', 'id'); @@ -46,8 +61,7 @@ class Application extends Model public function setStatus($status) { return $this->update([ - 'applicationStatus' => $status + 'applicationStatus' => $status, ]); - } } diff --git a/app/Appointment.php b/app/Appointment.php index d62e39a..a87c02f 100644 --- a/app/Appointment.php +++ b/app/Appointment.php @@ -1,5 +1,24 @@ . + */ + namespace App; use Illuminate\Database\Eloquent\Model; @@ -13,19 +32,19 @@ class Appointment extends Model 'appointmentStatus', 'appointmentLocation', 'meetingNotes', - 'userAccepted' + 'userAccepted', ]; public function application() { - // FIXME: Possible bug here, where laravel looks for the wrong column in the applications table. + // FIXME: Possible bug here, where laravel looks for the wrong column in the applications table. return $this->belongsTo('App\Application', 'id', 'applicationID'); } public function setStatus($status) { $this->update([ - 'appointmentStatus' => $status + 'appointmentStatus' => $status, ]); } } diff --git a/app/Ban.php b/app/Ban.php index c1a6e90..e08b336 100644 --- a/app/Ban.php +++ b/app/Ban.php @@ -1,29 +1,46 @@ . + */ + namespace App; use Illuminate\Database\Eloquent\Model; class Ban extends Model { - public $fillable = [ 'userID', 'reason', 'bannedUntil', 'userAgent', - 'authorUserID' + 'authorUserID', ]; public $dates = [ - 'bannedUntil' + 'bannedUntil', ]; public function user() { return $this->belongsTo('App\User', 'userID', 'id'); } - } diff --git a/app/Comment.php b/app/Comment.php index c8dc8cc..ea4092b 100644 --- a/app/Comment.php +++ b/app/Comment.php @@ -1,16 +1,34 @@ . + */ + namespace App; use Illuminate\Database\Eloquent\Model; class Comment extends Model { - protected $fillable = [ 'authorID', 'applicationID', - 'text' + 'text', ]; public function application() @@ -22,5 +40,4 @@ class Comment extends Model { return $this->belongsTo('App\User', 'authorID', 'id'); } - } diff --git a/app/Console/Commands/CountVotes.php b/app/Console/Commands/CountVotes.php index a2a7c6d..c15ce68 100644 --- a/app/Console/Commands/CountVotes.php +++ b/app/Console/Commands/CountVotes.php @@ -1,5 +1,24 @@ . + */ + namespace App\Console\Commands; use App\Application; @@ -43,28 +62,23 @@ class CountVotes extends Command $eligibleApps = Application::where('applicationStatus', 'STAGE_PEERAPPROVAL')->get(); $pbar = $this->output->createProgressBar($eligibleApps->count()); - if($eligibleApps->isEmpty()) - { + if ($eligibleApps->isEmpty()) { $this->error('𐄂 There are no applications that need to be processed.'); return false; } - foreach ($eligibleApps as $application) - { + foreach ($eligibleApps as $application) { $votes = $application->votes; $voteCount = $application->votes->count(); $positiveVotes = 0; $negativeVotes = 0; - if ($voteCount > 5) - { - $this->info('Counting votes for application ID ' . $application->id); - foreach ($votes as $vote) - { - switch ($vote->allowedVoteType) - { + if ($voteCount > 5) { + $this->info('Counting votes for application ID '.$application->id); + foreach ($votes as $vote) { + switch ($vote->allowedVoteType) { case 'VOTE_APPROVE': $positiveVotes++; break; @@ -74,7 +88,7 @@ class CountVotes extends Command } } - $this->info('Total votes for application ID ' . $application->id . ': ' . $voteCount); + $this->info('Total votes for application ID '.$application->id.': '.$voteCount); $this->info('Calculating criteria...'); $negativeVotePercent = floor(($negativeVotes / $voteCount) * 100); $positiveVotePercent = floor(($positiveVotes / $voteCount) * 100); @@ -83,54 +97,43 @@ class CountVotes extends Command $this->table([ '% of approval votes', - '% of denial votes' + '% of denial votes', ], [ // array of arrays, e.g. rows [ - $positiveVotePercent . "%", - $negativeVotePercent . "%" - ] + $positiveVotePercent.'%', + $negativeVotePercent.'%', + ], ]); - if ($pollResult) - { - $this->info('✓ Dispatched promotion event for applicant ' . $application->user->name); - if (!$this->option('dryrun')) - { + if ($pollResult) { + $this->info('✓ Dispatched promotion event for applicant '.$application->user->name); + if (! $this->option('dryrun')) { $application->response->vacancy->vacancyCount -= 1; $application->response->vacancy->save(); event(new ApplicationApprovedEvent(Application::find($application->id))); - } - else - { + } else { $this->warn('Dry run: Event won\'t be dispatched'); } $pbar->advance(); - - } - else { - - if (!$this->option('dryrun')) - { + } else { + if (! $this->option('dryrun')) { event(new ApplicationDeniedEvent(Application::find($application->id))); - } - else { + } else { $this->warn('Dry run: Event won\'t be dispatched'); } $pbar->advance(); - $this->error('𐄂 Applicant ' . $application->user->name . ' does not meet vote criteria (Majority)'); + $this->error('𐄂 Applicant '.$application->user->name.' does not meet vote criteria (Majority)'); } + } else { + $this->warn('Application ID'.$application->id.' did not have enough votes for processing (min 5)'); } - else - { - $this->warn("Application ID" . $application->id . " did not have enough votes for processing (min 5)"); - } - } $pbar->finish(); + return true; } } diff --git a/app/Console/Commands/Install.php b/app/Console/Commands/Install.php index d7f81ae..18fb9a6 100644 --- a/app/Console/Commands/Install.php +++ b/app/Console/Commands/Install.php @@ -1,5 +1,24 @@ . + */ + namespace App\Console\Commands; use Illuminate\Console\Command; @@ -39,103 +58,89 @@ class Install extends Command public function handle() { $basePath = base_path(); - if (Storage::disk('local')->missing('INSTALLED')) - { + if (Storage::disk('local')->missing('INSTALLED')) { + $this->info('[!! Welcome to Rasberry Teams !!]'); + $this->info('>> Installing...'); + $this->call('down', [ + '--message' => 'Down for maintenance. We\'ll be right back!', + ]); + copy($basePath.'/.env.example', $basePath.'/.env'); + $this->call('key:generate'); - $this->info('[!! Welcome to Rasberry Teams !!]'); - $this->info('>> Installing...'); - $this->call('down', [ - '--message' => 'Down for maintenance. We\'ll be right back!' - ]); + $this->info('>> Installing and preparing dependencies. This may take a while, depending on your computer.'); - copy($basePath . '/.env.example', $basePath . '/.env'); - $this->call('key:generate'); + $npmOut = 0; + $npmMessages = []; - $this->info('>> Installing and preparing dependencies. This may take a while, depending on your computer.'); + $npmBuildOut = 0; + $npmBuildMessages = []; - $npmOut = 0; - $npmMessages = []; + exec('cd '.$basePath.' && npm install --silent', $npmBuildOut, $npmOut); + exec('cd '.$basePath.'&& npm run dev --silent', $npmBuildMessages, $npmBuildOut); - $npmBuildOut = 0; - $npmBuildMessages = []; + if ($npmOut !== 0 && $npmBuildOut !== 0) { + $this->error('[!] One or more errors have ocurred whilst attempting to install dependencies.'); + $this->error('[!] It is recommended to run this command again, and report a bug if it keeps happening.'); - exec('cd ' . $basePath . ' && npm install --silent', $npmBuildOut, $npmOut); - exec('cd ' . $basePath . '&& npm run dev --silent', $npmBuildMessages, $npmBuildOut); + return false; + } + $settings = []; - if($npmOut !== 0 && $npmBuildOut !== 0) - { - $this->error('[!] One or more errors have ocurred whilst attempting to install dependencies.'); - $this->error('[!] It is recommended to run this command again, and report a bug if it keeps happening.'); + $this->info('>> Configuring application - We\'re going to ask a few questions here!'); + do { + $this->info('== Database Settings (1/6) =='); - return false; - } + $settings['DB_USERNAME'] = $this->ask('Database username'); + $settings['DB_PASSWORD'] = $this->secret('Database password (Input won\'t be seen)'); + $settings['DB_DATABASE'] = $this->ask('Database name'); + $settings['DB_PORT'] = $this->ask('Database port'); + $settings['DB_HOST'] = $this->ask('Database hostname'); + $this->info('== Antispam Settings (2/6) (Recaptcha v2) =='); + $settings['RECAPTCHA_SITE_KEY'] = $this->ask('Site key'); + $settings['RECAPTCHA_PRIVATE_KEY'] = $this->ask('Private site key'); + $this->info('== IP Geolocation Settings (3/6) (refer to README.md) =='); + $settings['IPGEO_API_KEY'] = $this->ask('API Key'); - $settings = []; + $this->info('== Notification Settings (4/6) (Email) =='); + $settings['MAIL_USERNAME'] = $this->ask('SMTP Username'); + $settings['MAIL_PASSWORD'] = $this->secret('SMTP Password (Input won\'t be seen)'); + $settings['MAIL_PORT'] = $this->ask('SMTP Server Port'); + $settings['MAIL_HOST'] = $this->ask('SMTP Server Hostname'); + $settings['MAIL_FROM'] = $this->ask('E-mail address to send from: '); - $this->info('>> Configuring application - We\'re going to ask a few questions here!'); - do - { - $this->info('== Database Settings (1/6) =='); + $this->info('== Notification Settings (5/6) (Slack) =='); + $settings['SLACK_INTEGRATION_WEBHOOK'] = $this->ask('Integration webhook URL'); - $settings['DB_USERNAME'] = $this->ask('Database username'); - $settings['DB_PASSWORD'] = $this->secret('Database password (Input won\'t be seen)'); - $settings['DB_DATABASE'] = $this->ask('Database name'); - $settings['DB_PORT'] = $this->ask('Database port'); - $settings['DB_HOST'] = $this->ask('Database hostname'); + $this->info('== Web Settings (6/6) =='); + $settings['APP_URL'] = $this->ask('Application\'s URL (ex. https://where.you.installed.theapp.com): '); + $settings['APP_LOGO'] = $this->ask('App logo (Link to an image): '); + $settings['APP_SITEHOMEPAGE'] = $this->ask('Site homepage (appears in the main header): '); + } while (! $this->confirm('Are you sure you want to save these settings? You can always go back and try again.')); - $this->info('== Antispam Settings (2/6) (Recaptcha v2) =='); - $settings['RECAPTCHA_SITE_KEY'] = $this->ask('Site key'); - $settings['RECAPTCHA_PRIVATE_KEY'] = $this->ask('Private site key'); + foreach ($settings as $keyname => $value) { + $this->call('environment:modify', [ + 'key' => $keyname, + 'value' => $value, + ]); + } - $this->info('== IP Geolocation Settings (3/6) (refer to README.md) =='); - $settings['IPGEO_API_KEY'] = $this->ask('API Key'); + $this->info('>> Saved configuration settings!'); + $this->info('>> Preparing database...'); - $this->info('== Notification Settings (4/6) (Email) =='); - $settings['MAIL_USERNAME'] = $this->ask('SMTP Username'); - $settings['MAIL_PASSWORD'] = $this->secret('SMTP Password (Input won\'t be seen)'); - $settings['MAIL_PORT'] = $this->ask('SMTP Server Port'); - $settings['MAIL_HOST'] = $this->ask('SMTP Server Hostname'); - $settings['MAIL_FROM'] = $this->ask('E-mail address to send from: '); + $this->callSilent('config:cache'); + $this->call('migrate'); + $this->call('db:seed'); - $this->info('== Notification Settings (5/6) (Slack) =='); - $settings['SLACK_INTEGRATION_WEBHOOK'] = $this->ask('Integration webhook URL'); + touch($basePath.'/INSTALLED'); - $this->info('== Web Settings (6/6) =='); - $settings['APP_URL'] = $this->ask('Application\'s URL (ex. https://where.you.installed.theapp.com): '); - $settings['APP_LOGO'] = $this->ask('App logo (Link to an image): '); - $settings['APP_SITEHOMEPAGE'] = $this->ask('Site homepage (appears in the main header): '); - - - } while(!$this->confirm('Are you sure you want to save these settings? You can always go back and try again.')); - - foreach($settings as $keyname => $value) - { - $this->call('environment:modify', [ - 'key' => $keyname, - 'value' => $value - ]); - } - - $this->info('>> Saved configuration settings!'); - $this->info('>> Preparing database...'); - - $this->callSilent('config:cache'); - $this->call('migrate'); - $this->call('db:seed'); - - touch($basePath . '/INSTALLED'); - - $this->call('up'); - $this->info('>> All done! Visit ' . $basePath . ' to start using your brand new installation of Raspberry Teams!'); - - } - else - { - $this->error('[!] The application is already installed!'); + $this->call('up'); + $this->info('>> All done! Visit '.$basePath.' to start using your brand new installation of Raspberry Teams!'); + } else { + $this->error('[!] The application is already installed!'); } } } diff --git a/app/Console/Commands/SetEnv.php b/app/Console/Commands/SetEnv.php index 9125ffa..3c49403 100644 --- a/app/Console/Commands/SetEnv.php +++ b/app/Console/Commands/SetEnv.php @@ -1,9 +1,28 @@ . + */ + namespace App\Console\Commands; -use Illuminate\Console\Command; use GeoSot\EnvEditor\Facades\EnvEditor; +use Illuminate\Console\Command; class SetEnv extends Command { @@ -37,20 +56,16 @@ class SetEnv extends Command */ public function handle() { - $path = base_path('/.env'); - $key = $this->argument('key'); - $value = $this->argument('value'); + $path = base_path('/.env'); + $key = $this->argument('key'); + $value = $this->argument('value'); + if (file_exists($path)) { + EnvEditor::editKey($key, $value); + } else { + $this->error('Cannot update a file that doesn\'t exist! Please create .env first.'); - - if (file_exists($path)) - { - EnvEditor::editKey($key, $value); - } - else - { - $this->error('Cannot update a file that doesn\'t exist! Please create .env first.'); - return false; - } + return false; + } } } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index fdf4d00..28273ca 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -1,10 +1,29 @@ . + */ + namespace App\Console; +use App\Jobs\CleanBans; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; -use App\Jobs\CleanBans; class Kernel extends ConsoleKernel { diff --git a/app/CustomFacades/IP.php b/app/CustomFacades/IP.php index 2b04064..230ec83 100644 --- a/app/CustomFacades/IP.php +++ b/app/CustomFacades/IP.php @@ -1,5 +1,24 @@ . + */ + namespace App\CustomFacades; use Illuminate\Support\Facades\Cache; @@ -7,7 +26,6 @@ use Illuminate\Support\Facades\Http; class IP { - /** * Looks up information on a specified IP address. Caches results automatically. * @param string $IP IP address to lookup @@ -15,23 +33,18 @@ class IP */ public function lookup(string $IP): object { - - $params = [ - 'apiKey' => config('general.keys.ipapi.apikey'), - 'ip' => $IP - ]; - - // TODO: Maybe unwrap this? Methods are chained here - - return json_decode(Cache::remember($IP, 3600, function() use ($IP) - { - return Http::get(config('general.urls.ipapi.ipcheck'), [ + $params = [ 'apiKey' => config('general.keys.ipapi.apikey'), - 'ip' => $IP - ])->body(); - })); + 'ip' => $IP, + ]; + // TODO: Maybe unwrap this? Methods are chained here + return json_decode(Cache::remember($IP, 3600, function () use ($IP) { + return Http::get(config('general.urls.ipapi.ipcheck'), [ + 'apiKey' => config('general.keys.ipapi.apikey'), + 'ip' => $IP, + ])->body(); + })); } - } diff --git a/app/Events/ApplicationApprovedEvent.php b/app/Events/ApplicationApprovedEvent.php index 4bb005c..066d83c 100644 --- a/app/Events/ApplicationApprovedEvent.php +++ b/app/Events/ApplicationApprovedEvent.php @@ -1,13 +1,28 @@ . + */ + namespace App\Events; use App\Application; -use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Broadcasting\PresenceChannel; -use Illuminate\Broadcasting\PrivateChannel; -use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; @@ -26,6 +41,4 @@ class ApplicationApprovedEvent { $this->application = $application; } - - } diff --git a/app/Events/ApplicationDeniedEvent.php b/app/Events/ApplicationDeniedEvent.php index fb84a57..48951a3 100644 --- a/app/Events/ApplicationDeniedEvent.php +++ b/app/Events/ApplicationDeniedEvent.php @@ -1,13 +1,28 @@ . + */ + namespace App\Events; use App\Application; -use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Broadcasting\PresenceChannel; -use Illuminate\Broadcasting\PrivateChannel; -use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; @@ -26,5 +41,4 @@ class ApplicationDeniedEvent { $this->application = $application; } - } diff --git a/app/Events/NewApplicationEvent.php b/app/Events/NewApplicationEvent.php index bb67787..867ab50 100644 --- a/app/Events/NewApplicationEvent.php +++ b/app/Events/NewApplicationEvent.php @@ -1,12 +1,28 @@ . + */ + namespace App\Events; -use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Broadcasting\PrivateChannel; -use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; diff --git a/app/Events/UserBannedEvent.php b/app/Events/UserBannedEvent.php index 92addbf..05902ad 100644 --- a/app/Events/UserBannedEvent.php +++ b/app/Events/UserBannedEvent.php @@ -1,23 +1,36 @@ . + */ + namespace App\Events; -use Illuminate\Broadcasting\Channel; +use App\Ban; +use App\User; use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Broadcasting\PresenceChannel; -use Illuminate\Broadcasting\PrivateChannel; -use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; -use App\User; -use App\Ban; - class UserBannedEvent { use Dispatchable, InteractsWithSockets, SerializesModels; - public $user; public $ban; @@ -32,5 +45,4 @@ class UserBannedEvent $this->user = $user; $this->ban = $ban; } - } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index ff35bfd..37c0edb 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -1,5 +1,24 @@ . + */ + namespace App\Exceptions; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; diff --git a/app/Facades/ContextAwareValidation.php b/app/Facades/ContextAwareValidation.php index 2771c77..41a6de8 100644 --- a/app/Facades/ContextAwareValidation.php +++ b/app/Facades/ContextAwareValidation.php @@ -1,14 +1,32 @@ . + */ + namespace App\Facades; use Illuminate\Support\Facades\Facade; class ContextAwareValidation extends Facade { - - protected static function getFacadeAccessor() - { - return 'contextAwareValidator'; - } - + protected static function getFacadeAccessor() + { + return 'contextAwareValidator'; + } } diff --git a/app/Facades/IP.php b/app/Facades/IP.php index b7301b8..0e438fb 100644 --- a/app/Facades/IP.php +++ b/app/Facades/IP.php @@ -1,5 +1,24 @@ . + */ + namespace App\Facades; use Illuminate\Support\Facades\Facade; diff --git a/app/Facades/Options.php b/app/Facades/Options.php index 6fbd4c0..71e9bfa 100644 --- a/app/Facades/Options.php +++ b/app/Facades/Options.php @@ -1,8 +1,27 @@ . + */ namespace App\Facades; -use \Illuminate\Support\Facades\Facade; + +use Illuminate\Support\Facades\Facade; class Options extends Facade { diff --git a/app/Facades/UUID.php b/app/Facades/UUID.php index 18699ee..b26e3a3 100644 --- a/app/Facades/UUID.php +++ b/app/Facades/UUID.php @@ -1,13 +1,32 @@ . + */ + namespace App\Facades; use Illuminate\Support\Facades\Facade; -class UUID extends Facade +class UUID extends Facade { protected static function getFacadeAccessor() { return 'uuidConversionFacade'; } -} \ No newline at end of file +} diff --git a/app/Form.php b/app/Form.php index dc64af2..80220fc 100644 --- a/app/Form.php +++ b/app/Form.php @@ -1,5 +1,24 @@ . + */ + namespace App; use Illuminate\Database\Eloquent\Model; @@ -10,7 +29,7 @@ class Form extends Model 'formName', 'formStructure', - 'formStatus' + 'formStatus', ]; diff --git a/app/Helpers/ContextAwareValidator.php b/app/Helpers/ContextAwareValidator.php index f2ffb55..6f59cb5 100644 --- a/app/Helpers/ContextAwareValidator.php +++ b/app/Helpers/ContextAwareValidator.php @@ -1,138 +1,141 @@ . + */ + namespace App\Helpers; -use Illuminate\Support\Facades\Validator; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Validator; class ContextAwareValidator { - /** - * The excludedNames array will make the validator ignore any of these names when including names into the rules. - * @var array - */ + * The excludedNames array will make the validator ignore any of these names when including names into the rules. + * @var array + */ private $excludedNames = [ - '_token', - '_method', - 'formName' + '_token', + '_method', + 'formName', ]; - /** - * Utility wrapper for json_encode. - * - * @param array $value The array to be converted. - * @return string The JSON representation of $value - */ - private function encode(array $value) : string + * Utility wrapper for json_encode. + * + * @param array $value The array to be converted. + * @return string The JSON representation of $value + */ + private function encode(array $value): string { - return json_encode($value); + return json_encode($value); } /** - * The getValidator() method will take an array of fields from the request body, iterates through them, - * and dynamically adds validation rules for them. Depending on parameters, it may or may not generate - * a form structure for rendering purposes. - * - * This method is mostly meant by internal use by means of static proxies (Facades), in order to reduce code repetition; - * Using it outside it's directed scope may cause unexpected results; For instance, the method expects inputs to be in array format, e.g. myFieldNameID1[], - * myFieldNameID2[], and so on and so forth. - * - * This isn't checked by the code yet, but if you're implementing it this way in the HTML markup, make sure it's consistent (e.g. use a loop). - * - * P.S This method automatically ignores the CSRF token for validation. - * - * @param array $fields The request form fields - * @param bool $generateStructure Whether to incldue a JSON-ready form structure for rendering - * @param bool $includeFormName Whether to include formName in the list of validation rules - * @return Validator|Collection A validator instance you can use to check for validity, or a Collection with a validator and structure (validator, structure) - */ + * The getValidator() method will take an array of fields from the request body, iterates through them, + * and dynamically adds validation rules for them. Depending on parameters, it may or may not generate + * a form structure for rendering purposes. + * + * This method is mostly meant by internal use by means of static proxies (Facades), in order to reduce code repetition; + * Using it outside it's directed scope may cause unexpected results; For instance, the method expects inputs to be in array format, e.g. myFieldNameID1[], + * myFieldNameID2[], and so on and so forth. + * + * This isn't checked by the code yet, but if you're implementing it this way in the HTML markup, make sure it's consistent (e.g. use a loop). + * + * P.S This method automatically ignores the CSRF token for validation. + * + * @param array $fields The request form fields + * @param bool $generateStructure Whether to incldue a JSON-ready form structure for rendering + * @param bool $includeFormName Whether to include formName in the list of validation rules + * @return Validator|Collection A validator instance you can use to check for validity, or a Collection with a validator and structure (validator, structure) + */ public function getValidator(array $fields, bool $generateStructure = false, bool $includeFormName = false) { $formStructure = []; $validator = []; - if ($includeFormName) - { + if ($includeFormName) { $validator['formName'] = 'required|string|max:100'; - } + } - foreach ($fields as $fieldName => $field) - { - if(!in_array($fieldName, $this->excludedNames)) - { - $validator[$fieldName . ".0"] = 'required|string'; - $validator[$fieldName . ".1"] = 'required|string'; + foreach ($fields as $fieldName => $field) { + if (! in_array($fieldName, $this->excludedNames)) { + $validator[$fieldName.'.0'] = 'required|string'; + $validator[$fieldName.'.1'] = 'required|string'; - if ($generateStructure) - { + if ($generateStructure) { $formStructure['fields'][$fieldName]['title'] = $field[0]; $formStructure['fields'][$fieldName]['type'] = $field[1]; - } + } + } + } - } - } + $validatorInstance = Validator::make($fields, $validator); - $validatorInstance = Validator::make($fields, $validator); - - return ($generateStructure) ? + return ($generateStructure) ? collect([ - 'validator' => $validatorInstance, - 'structure' => $this->encode($formStructure) + 'validator' => $validatorInstance, + 'structure' => $this->encode($formStructure), ]) : $validatorInstance; - - } /** - * The getResponseValidator method is similar to the getValidator method; It basically takes - * an array of fields from a previous form (that probably went through the other method) and adds validation - * to the field names. - * - * Also generates the storable response structure if you tell it to. - * - * @param array $fields The received fields - * @param array $formStructure The form structure - You must supply this if you want the response structure - * @param bool $generateResponseStructure Whether to generate the response structure - * @return Validator|Collection A collection or a validator, depending on the args. Will return validatior if only fields are supplied. - */ + * The getResponseValidator method is similar to the getValidator method; It basically takes + * an array of fields from a previous form (that probably went through the other method) and adds validation + * to the field names. + * + * Also generates the storable response structure if you tell it to. + * + * @param array $fields The received fields + * @param array $formStructure The form structure - You must supply this if you want the response structure + * @param bool $generateResponseStructure Whether to generate the response structure + * @return Validator|Collection A collection or a validator, depending on the args. Will return validatior if only fields are supplied. + */ public function getResponseValidator(array $fields, array $formStructure = [], bool $generateResponseStructure = true) { + $responseStructure = []; + $validator = []; - $responseStructure = []; - $validator = []; + if (empty($formStructure) && $generateResponseStructure) { + throw new \InvalidArgumentException('Illegal combination of arguments supplied! Please check the method\'s documentation.'); + } - if (empty($formStructure) && $generateResponseStructure) - { - throw new \InvalidArgumentException('Illegal combination of arguments supplied! Please check the method\'s documentation.'); - } + foreach ($fields as $fieldName => $value) { + if (! in_array($fieldName, $this->excludedNames)) { + $validator[$fieldName] = 'required|string'; - foreach($fields as $fieldName => $value) - { - if(!in_array($fieldName, $this->excludedNames)) - { - $validator[$fieldName] = 'required|string'; + if ($generateResponseStructure) { + $responseStructure['responses'][$fieldName]['type'] = $formStructure['fields'][$fieldName]['type'] ?? 'Unavailable'; + $responseStructure['responses'][$fieldName]['title'] = $formStructure['fields'][$fieldName]['title']; + $responseStructure['responses'][$fieldName]['response'] = $value; + } + } + } - if ($generateResponseStructure) - { - $responseStructure['responses'][$fieldName]['type'] = $formStructure['fields'][$fieldName]['type'] ?? 'Unavailable'; - $responseStructure['responses'][$fieldName]['title'] = $formStructure['fields'][$fieldName]['title']; - $responseStructure['responses'][$fieldName]['response'] = $value; - } - } - } + $validatorInstance = Validator::make($fields, $validator); - $validatorInstance = Validator::make($fields, $validator); - - return ($generateResponseStructure) ? + return ($generateResponseStructure) ? collect([ - 'validator' => $validatorInstance, - 'responseStructure' => $this->encode($responseStructure) + 'validator' => $validatorInstance, + 'responseStructure' => $this->encode($responseStructure), ]) : $validatorInstance; - } - } diff --git a/app/Helpers/Options.php b/app/Helpers/Options.php index 13c416d..925d910 100644 --- a/app/Helpers/Options.php +++ b/app/Helpers/Options.php @@ -1,5 +1,23 @@ . + */ namespace App\Helpers; @@ -9,20 +27,18 @@ use Illuminate\Support\Facades\Log; class Options { - public function getOption(string $option): string { $value = Cache::get($option); - if (is_null($value)) - { - Log::debug('Option ' . $option . 'not found in cache, refreshing from database'); + if (is_null($value)) { + Log::debug('Option '.$option.'not found in cache, refreshing from database'); $value = Option::where('option_name', $option)->first(); - if (is_null($value)) + if (is_null($value)) { throw new \Exception('This option does not exist.'); - + } Cache::put($option, $value); - Cache::put($option . '_desc', 'Undefined description'); + Cache::put($option.'_desc', 'Undefined description'); } return $value->option_value; @@ -30,14 +46,14 @@ class Options public function setOption(string $option, string $value, string $description) { - Option::create([ - 'option_name' => $option, - 'option_value' => $value, - 'friendly_name' => $description - ]); + Option::create([ + 'option_name' => $option, + 'option_value' => $value, + 'friendly_name' => $description, + ]); - Cache::put($option, $value, now()->addDay()); - Cache::put($option . '_desc', $description, now()->addDay()); + Cache::put($option, $value, now()->addDay()); + Cache::put($option.'_desc', $description, now()->addDay()); } public function pullOption($option): array @@ -48,7 +64,7 @@ class Options // putMany is overkill here return [ Cache::pull($option), - Cache::pull($option . '_desc') + Cache::pull($option.'_desc'), ]; } @@ -56,14 +72,13 @@ class Options { $dbOption = Option::where('option_name', $option); - if ($dbOption->first()) - { + if ($dbOption->first()) { $dbOptionInstance = Option::find($dbOption->first()->id); Cache::forget($option); Log::debug('Changing db configuration option', [ 'old_value' => $dbOptionInstance->option_value, - 'new_value' => $newValue + 'new_value' => $newValue, ]); $dbOptionInstance->option_value = $newValue; @@ -71,24 +86,20 @@ class Options Log::debug('New db configuration option saved', [ - 'option' => $dbOptionInstance->option_value + 'option' => $dbOptionInstance->option_value, ]); Cache::put('option_name', $newValue, now()->addDay()); - } - else - { + } else { throw new \Exception('This option does not exist.'); } } - public function optionExists(string $option): bool { $dbOption = Option::where('option_name', $option)->first(); $locallyCachedOption = Cache::get($option); - return !is_null($dbOption) || !is_null($locallyCachedOption); + return ! is_null($dbOption) || ! is_null($locallyCachedOption); } - } diff --git a/app/Http/Controllers/ApplicationController.php b/app/Http/Controllers/ApplicationController.php index bcedc0a..2102759 100644 --- a/app/Http/Controllers/ApplicationController.php +++ b/app/Http/Controllers/ApplicationController.php @@ -1,36 +1,46 @@ . + */ + namespace App\Http\Controllers; use App\Application; - -use App\Response; -use App\Vacancy; -use App\User; - use App\Events\ApplicationDeniedEvent; -use App\Notifications\NewApplicant; use App\Notifications\ApplicationMoved; - +use App\Notifications\NewApplicant; +use App\Response; +use App\User; +use App\Vacancy; +use ContextAwareValidator; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Validator; -use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Log; -use ContextAwareValidator; - class ApplicationController extends Controller { - private function canVote($votes) { $allvotes = collect([]); - foreach ($votes as $vote) - { - if ($vote->userID == Auth::user()->id) - { + foreach ($votes as $vote) { + if ($vote->userID == Auth::user()->id) { $allvotes->push($vote); } } @@ -38,22 +48,17 @@ class ApplicationController extends Controller return ($allvotes->count() == 1) ? false : true; } - - public function showUserApps() { - return view('dashboard.user.applications') ->with('applications', Auth::user()->applications); } - public function showUserApp(Request $request, Application $application) { $this->authorize('view', $application); - if (!is_null($application)) - { + if (! is_null($application)) { return view('dashboard.user.viewapp') ->with( [ @@ -62,20 +67,16 @@ class ApplicationController extends Controller 'structuredResponses' => json_decode($application->response->responseData, true), 'formStructure' => $application->response->form, 'vacancy' => $application->response->vacancy, - 'canVote' => $this->canVote($application->votes) + 'canVote' => $this->canVote($application->votes), ] ); - } - else - { + } else { $request->session()->flash('error', 'The application you requested could not be found.'); } return redirect()->back(); } - - public function showAllApps() { $this->authorize('viewAny', Application::class); @@ -84,7 +85,6 @@ class ApplicationController extends Controller ->with('applications', Application::paginate(6)); } - public function showAllPendingApps() { $this->authorize('viewAny', Application::class); @@ -93,7 +93,6 @@ class ApplicationController extends Controller ->with('applications', Application::where('applicationStatus', 'STAGE_SUBMITTED')->get()); } - public function showPendingInterview() { $this->authorize('viewAny', Application::class); @@ -103,16 +102,12 @@ class ApplicationController extends Controller $pendingInterviews = collect([]); $upcomingInterviews = collect([]); - - foreach ($applications as $application) - { - if (!is_null($application->appointment) && $application->appointment->appointmentStatus == 'CONCLUDED') - { - $count =+ 1; + foreach ($applications as $application) { + if (! is_null($application->appointment) && $application->appointment->appointmentStatus == 'CONCLUDED') { + $count = +1; } - switch ($application->applicationStatus) - { + switch ($application->applicationStatus) { case 'STAGE_INTERVIEW': $upcomingInterviews->push($application); @@ -123,29 +118,24 @@ class ApplicationController extends Controller break; } - } return view('dashboard.appmanagement.interview') ->with([ 'finishedCount' => $count, 'applications' => $pendingInterviews, - 'upcomingApplications' => $upcomingInterviews + 'upcomingApplications' => $upcomingInterviews, ]); } - - public function showPeerReview() { $this->authorize('viewAny', Application::class); + return view('dashboard.appmanagement.peerreview') ->with('applications', Application::where('applicationStatus', 'STAGE_PEERAPPROVAL')->get()); - } - - public function renderApplicationForm(Request $request, $vacancySlug) { // FIXME: Get rid of references to first(), this is a wonky query @@ -153,36 +143,27 @@ class ApplicationController extends Controller $firstVacancy = $vacancyWithForm->first(); - if (!$vacancyWithForm->isEmpty() && $firstVacancy->vacancyCount !== 0 && $firstVacancy->vacancyStatus == 'OPEN') - { - + if (! $vacancyWithForm->isEmpty() && $firstVacancy->vacancyCount !== 0 && $firstVacancy->vacancyStatus == 'OPEN') { return view('dashboard.application-rendering.apply') ->with([ 'vacancy' => $vacancyWithForm->first(), - 'preprocessedForm' => json_decode($vacancyWithForm->first()->forms->formStructure, true) + 'preprocessedForm' => json_decode($vacancyWithForm->first()->forms->formStructure, true), ]); - } - else - { + } else { abort(404, 'The application you\'re looking for could not be found or it is currently unavailable.'); } - } - - public function saveApplicationAnswers(Request $request, $vacancySlug) { $vacancy = Vacancy::with('forms')->where('vacancySlug', $vacancySlug)->get(); - if ($vacancy->first()->vacancyCount == 0 || $vacancy->first()->vacancyStatus !== 'OPEN') - { - - $request->session()->flash('error', 'This application is unavailable.'); - return redirect()->back(); + if ($vacancy->first()->vacancyCount == 0 || $vacancy->first()->vacancyStatus !== 'OPEN') { + $request->session()->flash('error', 'This application is unavailable.'); + return redirect()->back(); } Log::info('Processing new application!'); @@ -192,15 +173,14 @@ class ApplicationController extends Controller Log::info('Built response & validator structure!'); - if (!$responseValidation->get('validator')->fails()) - { + if (! $responseValidation->get('validator')->fails()) { $response = Response::create([ 'responseFormID' => $vacancy->first()->forms->id, 'associatedVacancyID' => $vacancy->first()->id, // Since a form can be used by multiple vacancies, we can only know which specific vacancy this response ties to by using a vacancy ID - 'responseData' => $responseValidation->get('responseStructure') + 'responseData' => $responseValidation->get('responseStructure'), ]); - Log::info('Registered form response for user ' . Auth::user()->name . ' for vacancy ' . $vacancy->first()->vacancyName); + Log::info('Registered form response for user '.Auth::user()->name.' for vacancy '.$vacancy->first()->vacancyName); $application = Application::create([ 'applicantUserID' => Auth::user()->id, @@ -208,24 +188,20 @@ class ApplicationController extends Controller 'applicationStatus' => 'STAGE_SUBMITTED', ]); - Log::info('Submitted application for user ' . Auth::user()->name . ' with response ID' . $response->id); + Log::info('Submitted application for user '.Auth::user()->name.' with response ID'.$response->id); - foreach(User::all() as $user) - { - if ($user->hasRole('admin')) - { - $user->notify((new NewApplicant($application, $vacancy->first()))->delay(now()->addSeconds(10))); - } + foreach (User::all() as $user) { + if ($user->hasRole('admin')) { + $user->notify((new NewApplicant($application, $vacancy->first()))->delay(now()->addSeconds(10))); + } } $request->session()->flash('success', 'Thank you for your application! It will be reviewed as soon as possible.'); - return redirect()->to(route('showUserApps')); - } - else - { - Log::warning('Application form for ' . Auth::user()->name . ' contained errors, resetting!'); - $request->session()->flash('error', 'There are one or more errors in your application. Please make sure none of your fields are empty, since they are all required.'); + return redirect()->to(route('showUserApps')); + } else { + Log::warning('Application form for '.Auth::user()->name.' contained errors, resetting!'); + $request->session()->flash('error', 'There are one or more errors in your application. Please make sure none of your fields are empty, since they are all required.'); } return redirect()->back(); @@ -235,15 +211,14 @@ class ApplicationController extends Controller { $this->authorize('update', Application::class); - switch ($newStatus) - { + switch ($newStatus) { case 'deny': event(new ApplicationDeniedEvent($application)); break; case 'interview': - Log::info('User ' . Auth::user()->name . ' has moved application ID ' . $application->id . 'to interview stage'); + Log::info('User '.Auth::user()->name.' has moved application ID '.$application->id.'to interview stage'); $request->session()->flash('success', 'Application moved to interview stage! (:'); $application->setStatus('STAGE_INTERVIEW'); @@ -259,13 +234,11 @@ class ApplicationController extends Controller public function delete(Request $request, Application $application) { + $this->authorize('delete', $application); + $application->delete(); // observers will run, cleaning it up - $this->authorize('delete', $application); - $application->delete(); // observers will run, cleaning it up - - $request->session()->flash('success', 'Application deleted. Comments, appointments and responses have also been deleted.'); - return redirect()->back(); + $request->session()->flash('success', 'Application deleted. Comments, appointments and responses have also been deleted.'); + return redirect()->back(); } - } diff --git a/app/Http/Controllers/AppointmentController.php b/app/Http/Controllers/AppointmentController.php index 8ed2722..3931995 100644 --- a/app/Http/Controllers/AppointmentController.php +++ b/app/Http/Controllers/AppointmentController.php @@ -1,14 +1,33 @@ . + */ + namespace App\Http\Controllers; use App\Application; -use App\Http\Requests\SaveNotesRequest; -use Carbon\Carbon; -use Illuminate\Http\Request; use App\Appointment; +use App\Http\Requests\SaveNotesRequest; use App\Notifications\ApplicationMoved; use App\Notifications\AppointmentScheduled; +use Carbon\Carbon; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Log; @@ -20,7 +39,7 @@ class AppointmentController extends Controller 'DISCORD', 'SKYPE', 'MEET', - 'TEAMSPEAK' + 'TEAMSPEAK', ]; @@ -37,26 +56,24 @@ class AppointmentController extends Controller ]); $application->setStatus('STAGE_INTERVIEW_SCHEDULED'); - - Log::info('User ' . Auth::user()->name . ' has scheduled an appointment with ' . $application->user->name . ' for application ID' . $application->id, [ + Log::info('User '.Auth::user()->name.' has scheduled an appointment with '.$application->user->name.' for application ID'.$application->id, [ 'datetime' => $appointmentDate->toDateTimeString(), - 'scheduled' => now() + 'scheduled' => now(), ]); $application->user->notify(new AppointmentScheduled($appointment)); - $request->session()->flash('success', 'Appointment successfully scheduled @ ' . $appointmentDate->toDateTimeString()); - + $request->session()->flash('success', 'Appointment successfully scheduled @ '.$appointmentDate->toDateTimeString()); return redirect()->back(); } public function updateAppointment(Request $request, Application $application, $status) { - $this->authorize('update', $application->appointment); + $this->authorize('update', $application->appointment); $validStatuses = [ - 'SCHEDULED', - 'CONCLUDED' + 'SCHEDULED', + 'CONCLUDED', ]; // NOTE: This is a little confusing, refactor @@ -66,29 +83,25 @@ class AppointmentController extends Controller $application->setStatus('STAGE_PEERAPPROVAL'); $application->user->notify(new ApplicationMoved()); - $request->session()->flash('success', 'Interview finished! Staff members can now vote on it.'); + return redirect()->back(); } // also updates public function saveNotes(SaveNotesRequest $request, Application $application) { - if (!is_null($application)) - { + if (! is_null($application)) { $application->load('appointment'); $application->appointment->meetingNotes = $request->noteText; $application->appointment->save(); $request->session()->flash('success', 'Meeting notes have been saved.'); - } - else - { + } else { $request->session()->flash('error', 'There\'s no appointment to save notes to!'); } return redirect()->back(); } - } diff --git a/app/Http/Controllers/Auth/ConfirmPasswordController.php b/app/Http/Controllers/Auth/ConfirmPasswordController.php index 71a9592..10760cc 100644 --- a/app/Http/Controllers/Auth/ConfirmPasswordController.php +++ b/app/Http/Controllers/Auth/ConfirmPasswordController.php @@ -1,9 +1,27 @@ . + */ + namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; -use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\ConfirmsPasswords; class ConfirmPasswordController extends Controller diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 465c39c..2ddd570 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 47413e2..a762270 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -1,10 +1,28 @@ . + */ + namespace App\Http\Controllers\Auth; -use App\User; use App\Http\Controllers\Controller; -use App\Providers\RouteServiceProvider; +use App\User; use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Http\Request; @@ -48,22 +66,15 @@ class LoginController extends Controller { $user = User::where('email', $request->email)->first(); - if ($user) - { + if ($user) { $isBanned = $user->isBanned(); - if ($isBanned) - { + if ($isBanned) { return false; - } - else - { + } else { return $this->originalAttemptLogin($request); } } return $this->originalAttemptLogin($request); - } - - } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index c6b3364..2b9d69f 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -1,15 +1,32 @@ . + */ + namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use App\Profile; -use App\Providers\RouteServiceProvider; use App\User; use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; -use function GuzzleHttp\Psr7\str; class RegisterController extends Controller { @@ -47,10 +64,8 @@ class RegisterController extends Controller { $users = User::where('originalIP', \request()->ip())->get(); - foreach($users as $user) - { - if ($user && $user->isBanned()) - { + foreach ($users as $user) { + if ($user && $user->isBanned()) { abort(403, 'You do not have permission to access this page.'); } } @@ -72,7 +87,7 @@ class RegisterController extends Controller 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'password' => ['required', 'string', 'min:10', 'confirmed', 'regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\x])(?=.*[!$#%]).*$/'], ], [ - 'uuid.required' => 'Please enter a valid (and Premium) Minecraft username! We do not support cracked users.' + 'uuid.required' => 'Please enter a valid (and Premium) Minecraft username! We do not support cracked users.', ]); } @@ -84,19 +99,19 @@ class RegisterController extends Controller */ protected function create(array $data) { - $user = User::create([ 'uuid' => $data['uuid'], 'name' => $data['name'], 'email' => $data['email'], 'password' => Hash::make($data['password']), - 'originalIP' => request()->ip() + 'originalIP' => request()->ip(), ]); // It's not the registration controller's concern to create a profile for the user, // so this code has been moved to it's respective observer, following the separation of concerns pattern. $user->assignRole('user'); + return $user; } } diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 6c0c13a..bbf75a7 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -1,9 +1,27 @@ . + */ + namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; -use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\ResetsPasswords; class ResetPasswordController extends Controller diff --git a/app/Http/Controllers/Auth/TwofaController.php b/app/Http/Controllers/Auth/TwofaController.php index a3ecac9..d8bad0e 100644 --- a/app/Http/Controllers/Auth/TwofaController.php +++ b/app/Http/Controllers/Auth/TwofaController.php @@ -1,16 +1,32 @@ . + */ + namespace App\Http\Controllers\Auth; -use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Traits\AuthenticatesTwoFactor; class TwofaController extends Controller { - use AuthenticatesTwoFactor; - - - protected $redirectTo = '/dashboard'; + use AuthenticatesTwoFactor; + protected $redirectTo = '/dashboard'; } diff --git a/app/Http/Controllers/Auth/VerificationController.php b/app/Http/Controllers/Auth/VerificationController.php index 482a167..74be54b 100644 --- a/app/Http/Controllers/Auth/VerificationController.php +++ b/app/Http/Controllers/Auth/VerificationController.php @@ -1,9 +1,27 @@ . + */ + namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; -use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\VerifiesEmails; class VerificationController extends Controller diff --git a/app/Http/Controllers/BanController.php b/app/Http/Controllers/BanController.php index 3ae2a42..f472910 100644 --- a/app/Http/Controllers/BanController.php +++ b/app/Http/Controllers/BanController.php @@ -1,35 +1,48 @@ . + */ + namespace App\Http\Controllers; -use Illuminate\Http\Request; -use Illuminate\Support\Facades\Auth; use App\Ban; -use App\User; use App\Events\UserBannedEvent; use App\Http\Requests\BanUserRequest; +use App\User; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; class BanController extends Controller { - public function insert(BanUserRequest $request, User $user) { - $this->authorize('create', [Ban::class, $user]); - if (is_null($user->bans)) - { - + if (is_null($user->bans)) { $reason = $request->reason; $duration = strtolower($request->durationOperator); $durationOperand = $request->durationOperand; $expiryDate = now(); - if (!empty($duration)) - { - switch($duration) - { + if (! empty($duration)) { + switch ($duration) { case 'days': $expiryDate->addDays($durationOperand); break; @@ -46,9 +59,7 @@ class BanController extends Controller $expiryDate->addYears($durationOperand); break; } - } - else - { + } else { // Essentially permanent $expiryDate->addYears(5); } @@ -57,35 +68,27 @@ class BanController extends Controller 'userID' => $user->id, 'reason' => $reason, 'bannedUntil' => $expiryDate->format('Y-m-d H:i:s'), - 'userAgent' => "Unknown", - 'authorUserID' => Auth::user()->id + 'userAgent' => 'Unknown', + 'authorUserID' => Auth::user()->id, ]); event(new UserBannedEvent($user, $ban)); - $request->session()->flash('success', 'User banned successfully! Ban ID: #' . $ban->id); - - } - else - { + $request->session()->flash('success', 'User banned successfully! Ban ID: #'.$ban->id); + } else { $request->session()->flash('error', 'User already banned!'); } return redirect()->back(); } - public function delete(Request $request, User $user) { - $this->authorize('delete', $user->bans); - if (!is_null($user->bans)) - { + if (! is_null($user->bans)) { $user->bans->delete(); $request->session()->flash('success', 'User unbanned successfully!'); - } - else - { + } else { $request->session()->flash('error', 'This user isn\'t banned!'); } diff --git a/app/Http/Controllers/CommentController.php b/app/Http/Controllers/CommentController.php index 09d2aa2..3f7fc11 100644 --- a/app/Http/Controllers/CommentController.php +++ b/app/Http/Controllers/CommentController.php @@ -1,19 +1,34 @@ . + */ + namespace App\Http\Controllers; +use App\Application; +use App\Comment; +use App\Http\Requests\NewCommentRequest; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; -use App\Http\Requests\NewCommentRequest; - -use App\Comment; -use App\Application; -use App\Notifications\NewComment; -use App\User; class CommentController extends Controller { - public function index() { // @@ -26,21 +41,16 @@ class CommentController extends Controller $comment = Comment::create([ 'authorID' => Auth::user()->id, 'applicationID' => $application->id, - 'text' => $request->comment + 'text' => $request->comment, ]); - if ($comment) - { - + if ($comment) { $request->session()->flash('success', 'Comment posted! (:'); - } - else - { + } else { $request->session()->flash('error', 'Something went wrong while posting your comment!'); } return redirect()->back(); - } public function delete(Request $request, Comment $comment) @@ -51,7 +61,5 @@ class CommentController extends Controller $request->session()->flash('success', 'Comment deleted!'); return redirect()->back(); - } - } diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index 7a2923f..c2cb2ef 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -1,26 +1,40 @@ . + */ + namespace App\Http\Controllers; -use Illuminate\Http\Request; -use GuzzleHttp; use App\Notifications\NewContact; -use Illuminate\Support\Facades\Http; - use App\User; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\Http; class ContactController extends Controller { - protected $users; - public function __construct(User $users) { $this->users = $users; } - public function create(Request $request) { $name = $request->name; @@ -34,32 +48,29 @@ class ContactController extends Controller $verifyrequest = Http::asForm()->post(config('recaptcha.verify.apiurl'), [ 'secret' => config('recaptcha.keys.secret'), 'response' => $challenge, - 'remoteip' => $request->ip() + 'remoteip' => $request->ip(), ]); - $response = json_decode($verifyrequest->getBody(), true); - if (!$response['success']) - { + if (! $response['success']) { $request->session()->flash('error', 'Beep beep boop... Robot? Submission failed.'); + return redirect()->back(); } - - foreach(User::all() as $user) - { - if ($user->hasRole('admin')) - { - $user->notify(new NewContact(collect([ - 'message' => $msg, - 'ip' => $request->ip(), - 'email' => $email - ]))); - } + foreach (User::all() as $user) { + if ($user->hasRole('admin')) { + $user->notify(new NewContact(collect([ + 'message' => $msg, + 'ip' => $request->ip(), + 'email' => $email, + ]))); + } } $request->session()->flash('success', 'Message sent successfully! We usually respond within 48 hours.'); + return redirect()->back(); } } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index a0a2a8a..5f92f69 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Controllers; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index d397d89..573ae61 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -1,16 +1,32 @@ . + */ + namespace App\Http\Controllers; -use Illuminate\Http\Request; -use App\Vacancy; -use App\User; -use App\Ban; use App\Application; +use App\User; +use App\Vacancy; class DashboardController extends Controller { - public function index() { $totalPeerReview = Application::where('applicationStatus', 'STAGE_PEERAPPROVAL')->get()->count(); @@ -19,13 +35,11 @@ class DashboardController extends Controller return view('dashboard.dashboard') ->with([ - 'vacancies' => Vacancy::all(), - 'totalUserCount' => User::all()->count(), - 'totalDenied' => $totalDenied, - 'totalPeerReview' => $totalPeerReview, - 'totalNewApplications' => $totalNewApplications + 'vacancies' => Vacancy::all(), + 'totalUserCount' => User::all()->count(), + 'totalDenied' => $totalDenied, + 'totalPeerReview' => $totalPeerReview, + 'totalNewApplications' => $totalNewApplications, ]); - } - } diff --git a/app/Http/Controllers/DevToolsController.php b/app/Http/Controllers/DevToolsController.php index 5c82d26..1749ed5 100644 --- a/app/Http/Controllers/DevToolsController.php +++ b/app/Http/Controllers/DevToolsController.php @@ -1,28 +1,45 @@ . + */ + namespace App\Http\Controllers; use App\Application; use App\Events\ApplicationApprovedEvent; use Illuminate\Http\Request; - use Illuminate\Support\Facades\Auth; class DevToolsController extends Controller { - // The use case for Laravel's gate and/or validation Requests is so tiny here that a full-blown policy would be overkill. protected function isolatedAuthorise() { - if (!Auth::user()->can('admin.developertools.use')) - { - abort(403, 'You\'re not authorized to access this page.'); - } + if (! Auth::user()->can('admin.developertools.use')) { + abort(403, 'You\'re not authorized to access this page.'); + } } public function index() { $this->isolatedAuthorise(); + return view('dashboard.administration.devtools') ->with('applications', Application::where('applicationStatus', 'STAGE_PEERAPPROVAL')->get()); } @@ -32,14 +49,11 @@ class DevToolsController extends Controller $this->isolatedAuthorise(); $application = Application::find($request->application); - if (!is_null($application)) - { + if (! is_null($application)) { event(new ApplicationApprovedEvent($application)); $request->session()->flash('success', 'Event dispatched! Please check the debug logs for more info'); - } - else - { + } else { $request->session()->flash('error', 'Application doesn\'t exist!'); } diff --git a/app/Http/Controllers/FormController.php b/app/Http/Controllers/FormController.php index 4452ac5..7c8407a 100644 --- a/app/Http/Controllers/FormController.php +++ b/app/Http/Controllers/FormController.php @@ -1,17 +1,32 @@ . + */ + namespace App\Http\Controllers; use App\Form; -use Illuminate\Http\Request; -use Illuminate\Support\Facades\Validator; -use Illuminate\Support\Facades\Auth; - use ContextAwareValidator; +use Illuminate\Http\Request; class FormController extends Controller { - public function index() { $forms = Form::all(); @@ -24,42 +39,43 @@ class FormController extends Controller public function showFormBuilder() { $this->authorize('viewFormbuilder', Form::class); + return view('dashboard.administration.formbuilder'); } public function saveForm(Request $request) { - $this->authorize('create', Form::class); $fields = $request->all(); - if (count($fields) == 2) - { + if (count($fields) == 2) { // form is probably empty, since forms with fields will alawys have more than 2 items $request->session()->flash('error', 'Sorry, but you may not create empty forms.'); + return redirect()->to(route('showForms')); } $contextValidation = ContextAwareValidator::getValidator($fields, true, true); - if (!$contextValidation->get('validator')->fails()) - { + if (! $contextValidation->get('validator')->fails()) { $storableFormStructure = $contextValidation->get('structure'); Form::create( [ 'formName' => $fields['formName'], 'formStructure' => $storableFormStructure, - 'formStatus' => 'ACTIVE' + 'formStatus' => 'ACTIVE', ] ); $request->session()->flash('success', 'Form created! You can now link this form to a vacancy.'); + return redirect()->to(route('showForms')); } $request->session()->flash('errors', $contextValidation->get('validator')->errors()->getMessages()); + return redirect()->back(); } @@ -68,25 +84,19 @@ class FormController extends Controller $this->authorize('delete', $form); $deletable = true; - - if (!is_null($form) && !is_null($form->vacancies) && $form->vacancies->count() !== 0 || !is_null($form->responses)) - { - $deletable = false; + if (! is_null($form) && ! is_null($form->vacancies) && $form->vacancies->count() !== 0 || ! is_null($form->responses)) { + $deletable = false; } - if ($deletable) - { - $form->delete(); + if ($deletable) { + $form->delete(); - $request->session()->flash('success', 'Form deleted successfully.'); - } - else - { - $request->session()->flash('error', 'You cannot delete this form because it\'s tied to one or more applications and ranks, or because it doesn\'t exist.'); + $request->session()->flash('success', 'Form deleted successfully.'); + } else { + $request->session()->flash('error', 'You cannot delete this form because it\'s tied to one or more applications and ranks, or because it doesn\'t exist.'); } return redirect()->back(); - } public function preview(Request $request, Form $form) @@ -101,9 +111,9 @@ class FormController extends Controller public function edit(Request $request, Form $form) { - $this->authorize('update', $form); + $this->authorize('update', $form); - return view('dashboard.administration.editform') + return view('dashboard.administration.editform') ->with('formStructure', json_decode($form->formStructure, true)) ->with('title', $form->formName) ->with('formID', $form->id); @@ -111,29 +121,23 @@ class FormController extends Controller public function update(Request $request, Form $form) { - $this->authorize('update', $form); + $this->authorize('update', $form); - $contextValidation = ContextAwareValidator::getValidator($request->all(), true); - $this->authorize('update', $form); + $contextValidation = ContextAwareValidator::getValidator($request->all(), true); + $this->authorize('update', $form); + if (! $contextValidation->get('validator')->fails()) { + // Add the new structure into the form. New, subsquent fields will be identified by the "new" prefix + // This prefix doesn't actually change the app's behavior when it receives applications. + // Additionally, old applications won't of course display new and updated fields, because we can't travel into the past and get data for them + $form->formStructure = $contextValidation->get('structure'); + $form->save(); - if (!$contextValidation->get('validator')->fails()) - { - // Add the new structure into the form. New, subsquent fields will be identified by the "new" prefix - // This prefix doesn't actually change the app's behavior when it receives applications. - // Additionally, old applications won't of course display new and updated fields, because we can't travel into the past and get data for them - $form->formStructure = $contextValidation->get('structure'); - $form->save(); - - $request->session()->flash('success', 'Hooray! Your form was updated. New applications for it\'s vacancy will use it.'); - } - else - { - $request->session()->flash('errors', $contextValidation->get('validator')->errors()->getMessages()); - } - - return redirect()->to(route('previewForm', ['form' => $form->id])); + $request->session()->flash('success', 'Hooray! Your form was updated. New applications for it\'s vacancy will use it.'); + } else { + $request->session()->flash('errors', $contextValidation->get('validator')->errors()->getMessages()); + } + return redirect()->to(route('previewForm', ['form' => $form->id])); } - } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 1afc222..2696b59 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -1,10 +1,27 @@ . + */ + namespace App\Http\Controllers; use App\Vacancy; -use Illuminate\Http\Request; -use Illuminate\Support\Facades\DB; class HomeController extends Controller { @@ -15,12 +32,10 @@ class HomeController extends Controller */ public function index() { - $positions = Vacancy::where('vacancyStatus', 'OPEN') ->where('vacancyCount', '<>', 0) ->get(); - return view('home') ->with('positions', $positions); } diff --git a/app/Http/Controllers/OptionsController.php b/app/Http/Controllers/OptionsController.php index c76a57c..2bba992 100644 --- a/app/Http/Controllers/OptionsController.php +++ b/app/Http/Controllers/OptionsController.php @@ -1,10 +1,28 @@ . + */ + namespace App\Http\Controllers; use App\Facades\Options; use App\Options as Option; - use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Log; @@ -21,57 +39,47 @@ class OptionsController extends Controller // TODO: Obtain this from the facade $options = Option::all(); - return view('dashboard.administration.settings') ->with('options', $options); } - public function saveSettings(Request $request) - { - if (Auth::user()->can('admin.settings.edit')) - { - Log::debug('Updating application options', [ - 'ip' => $request->ip(), - 'ua' => $request->userAgent(), - 'username' => Auth::user()->username - ]); - foreach($request->all() as $optionName => $option) - { - try - { - Log::debug('Going through option ' . $optionName); - if (Options::optionExists($optionName)) - { - Log::debug('Option exists, updating to new values', [ - 'opt' => $optionName, - 'new_value' => $option - ]); - Options::changeOption($optionName, $option); - } - } - catch(\Exception $ex) - { - Log::error('Unable to update options!', [ - 'msg' => $ex->getMessage(), - 'trace' => $ex->getTraceAsString() - ]); - report($ex); + public function saveSettings(Request $request) + { + if (Auth::user()->can('admin.settings.edit')) { + Log::debug('Updating application options', [ + 'ip' => $request->ip(), + 'ua' => $request->userAgent(), + 'username' => Auth::user()->username, + ]); + foreach ($request->all() as $optionName => $option) { + try { + Log::debug('Going through option '.$optionName); + if (Options::optionExists($optionName)) { + Log::debug('Option exists, updating to new values', [ + 'opt' => $optionName, + 'new_value' => $option, + ]); + Options::changeOption($optionName, $option); + } + } catch (\Exception $ex) { + Log::error('Unable to update options!', [ + 'msg' => $ex->getMessage(), + 'trace' => $ex->getTraceAsString(), + ]); + report($ex); - $errorCond = true; - $request->session()->flash('error', 'An error occurred while trying to save settings: ' . $ex->getMessage()); - } - } + $errorCond = true; + $request->session()->flash('error', 'An error occurred while trying to save settings: '.$ex->getMessage()); + } + } - if (!isset($errorCond)) - { - $request->session()->flash('success', 'Settings saved successfully!'); - } - } - else - { - $request->session()->flash('error', 'You do not have permission to update this resource.'); - } + if (! isset($errorCond)) { + $request->session()->flash('success', 'Settings saved successfully!'); + } + } else { + $request->session()->flash('error', 'You do not have permission to update this resource.'); + } - return redirect()->back(); - } + return redirect()->back(); + } } diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 0fc063d..0f63b2d 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -1,12 +1,29 @@ . + */ + namespace App\Http\Controllers; -use App\Http\Requests\ProfileSave; -use Illuminate\Support\Facades\Log; -use App\Profile; -use App\User; use App\Facades\IP; +use App\Http\Requests\ProfileSave; +use App\User; use Carbon\Carbon; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -14,18 +31,15 @@ use Spatie\Permission\Models\Role; class ProfileController extends Controller { - - public function index() - { - - return view('dashboard.user.directory') + public function index() + { + return view('dashboard.user.directory') ->with('users', User::with('profile', 'bans')->paginate(9)); - } + } public function showProfile() { - - $socialLinks = Auth::user()->profile->socialLinks ?? "[]"; + $socialLinks = Auth::user()->profile->socialLinks ?? '[]'; $socialMediaProfiles = json_decode($socialLinks, true); return view('dashboard.user.profile.userprofile') @@ -36,13 +50,11 @@ class ProfileController extends Controller 'insta' => $socialMediaProfiles['links']['insta'] ?? 'UpdateMe', 'discord' => $socialMediaProfiles['links']['discord'] ?? 'UpdateMe#12345', ]); - } // Route model binding public function showSingleProfile(Request $request, User $user) { - $socialMediaProfiles = json_decode($user->profile->socialLinks, true); $createdDate = Carbon::parse($user->created_at); @@ -51,21 +63,15 @@ class ProfileController extends Controller $roleList = []; - - foreach($systemRoles as $role) - { - if (in_array($role, $userRoles)) - { - $roleList[$role] = true; - } - else - { - $roleList[$role] = false; - } + foreach ($systemRoles as $role) { + if (in_array($role, $userRoles)) { + $roleList[$role] = true; + } else { + $roleList[$role] = false; + } } - if (Auth::user()->is($user) || Auth::user()->can('profiles.view.others')) - { + if (Auth::user()->is($user) || Auth::user()->can('profiles.view.others')) { return view('dashboard.user.profile.displayprofile') ->with([ 'profile' => $user->profile, @@ -73,16 +79,13 @@ class ProfileController extends Controller 'twitter' => $socialMediaProfiles['links']['twitter'] ?? 'UpdateMe', 'insta' => $socialMediaProfiles['links']['insta'] ?? 'UpdateMe', 'discord' => $socialMediaProfiles['links']['discord'] ?? 'UpdateMe#12345', - 'since' => $createdDate->englishMonth . " " . $createdDate->year, + 'since' => $createdDate->englishMonth.' '.$createdDate->year, 'ipInfo' => IP::lookup($user->originalIP), - 'roles' => $roleList + 'roles' => $roleList, ]); - } - else - { + } else { abort(403, 'You cannot view someone else\'s profile.'); } - } public function saveProfile(ProfileSave $request) @@ -90,10 +93,8 @@ class ProfileController extends Controller $profile = User::find(Auth::user()->id)->profile; $social = []; - if (!is_null($profile)) - { - switch ($request->avatarPref) - { + if (! is_null($profile)) { + switch ($request->avatarPref) { case 'MOJANG': $avatarPref = 'crafatar'; @@ -117,11 +118,8 @@ class ProfileController extends Controller $newProfile = $profile->save(); $request->session()->flash('success', 'Profile settings saved successfully.'); - } return redirect()->back(); - } - } diff --git a/app/Http/Controllers/ResponseController.php b/app/Http/Controllers/ResponseController.php index 64037c9..bcb5070 100644 --- a/app/Http/Controllers/ResponseController.php +++ b/app/Http/Controllers/ResponseController.php @@ -1,8 +1,25 @@ . + */ -use Illuminate\Http\Request; +namespace App\Http\Controllers; class ResponseController extends Controller { diff --git a/app/Http/Controllers/StaffProfileController.php b/app/Http/Controllers/StaffProfileController.php index b20d4d1..1f6b569 100644 --- a/app/Http/Controllers/StaffProfileController.php +++ b/app/Http/Controllers/StaffProfileController.php @@ -1,8 +1,25 @@ . + */ -use Illuminate\Http\Request; +namespace App\Http\Controllers; class StaffProfileController extends Controller { diff --git a/app/Http/Controllers/TeamController.php b/app/Http/Controllers/TeamController.php index 2276bf6..905f7d2 100644 --- a/app/Http/Controllers/TeamController.php +++ b/app/Http/Controllers/TeamController.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Controllers; use App\Http\Requests\EditTeamRequest; @@ -16,7 +35,6 @@ use Mpociot\Teamwork\Exceptions\UserNotInTeamException; use Mpociot\Teamwork\Facades\Teamwork; use Mpociot\Teamwork\TeamInvite; - class TeamController extends Controller { /** @@ -52,12 +70,13 @@ class TeamController extends Controller { $team = Team::create([ 'name' => $request->teamName, - 'owner_id' => Auth::user()->id + 'owner_id' => Auth::user()->id, ]); Auth::user()->teams()->attach($team->id); $request->session()->flash('success', 'Team successfully created.'); + return redirect()->back(); } @@ -101,6 +120,7 @@ class TeamController extends Controller $team->save(); $request->session()->flash('success', 'Team edited successfully.'); + return redirect()->to(route('teams.index')); } @@ -119,50 +139,34 @@ class TeamController extends Controller { $user = User::findOrFail($request->user); - if (!$team->openJoin) - { - - if (!Teamwork::hasPendingInvite($user->email, $team)) - { - Teamwork::inviteToTeam($user, $team, function(TeamInvite $invite) use ($user) { + if (! $team->openJoin) { + if (! Teamwork::hasPendingInvite($user->email, $team)) { + Teamwork::inviteToTeam($user, $team, function (TeamInvite $invite) use ($user) { Mail::to($user)->send(new InviteToTeam($invite)); }); $request->session()->flash('success', 'Invite sent! They can now accept or deny it.'); - } - else - { + } else { $request->session()->flash('error', 'This user has already been invited.'); } - - - } - else - { + } else { $request->session()->flash('error', 'You can\'t invite users to public teams.'); } return redirect()->back(); } - - public function processInviteAction(Request $request, $action, $token) { - - switch($action) - { + switch ($action) { case 'accept': $invite = Teamwork::getInviteFromAcceptToken($token); - if ($invite && $invite->user->is(Auth::user())) - { + if ($invite && $invite->user->is(Auth::user())) { Teamwork::acceptInvite($invite); - $request->session()->flash('success', 'Invite accepted! You have now joined ' . $invite->team->name . '.'); - } - else - { + $request->session()->flash('success', 'Invite accepted! You have now joined '.$invite->team->name.'.'); + } else { $request->session()->flash('error', 'Invalid or expired invite URL.'); } @@ -172,13 +176,10 @@ class TeamController extends Controller $invite = Teamwork::getInviteFromDenyToken($token); - if ($invite && $invite->user->is(Auth::user())) - { + if ($invite && $invite->user->is(Auth::user())) { Teamwork::denyInvite($invite); $request->session()->flash('success', 'Invite denied! Ask for another invite if this isn\'t what you meant.'); - } - else - { + } else { $request->session()->flash('error', 'Invalid or expired invite URL.'); } @@ -187,31 +188,25 @@ class TeamController extends Controller default: $request->session()->flash('error', 'Sorry, but the invite URL you followed was malformed. Try asking for another invite, or submit a bug report.'); - } // This page will show the user's current teams return redirect()->to(route('teams.index')); - } public function switchTeam(Request $request, Team $team) { - try - { + try { Auth::user()->switchTeam($team); $request->session()->flash('success', 'Switched teams! Your team dashboard will now use this context.'); - } - catch(UserNotInTeamException $ex) - { + } catch (UserNotInTeamException $ex) { $request->session()->flash('error', 'You can\'t switch to a team you don\'t belong to.'); } return redirect()->back(); } - // Since it's a separate form, we shouldn't use the same update method public function assignVacancies(Request $request, Team $team) { @@ -222,41 +217,33 @@ class TeamController extends Controller $requestVacancies = $request->assocVacancies; $currentVacancies = $team->vacancies->pluck('id')->all(); - if (is_null($requestVacancies)) - { - - foreach ($team->vacancies as $vacancy) - { + if (is_null($requestVacancies)) { + foreach ($team->vacancies as $vacancy) { $team->vacancies()->detach($vacancy->id); } $request->session()->flash('success', 'Removed all vacancy associations.'); + return redirect()->back(); } $vacancyDiff = array_diff($requestVacancies, $currentVacancies); $deselectedDiff = array_diff($currentVacancies, $requestVacancies); - - if (!empty($vacancyDiff) || !empty($deselectedDiff)) - { - foreach ($vacancyDiff as $selectedVacancy) - { + if (! empty($vacancyDiff) || ! empty($deselectedDiff)) { + foreach ($vacancyDiff as $selectedVacancy) { $team->vacancies()->attach($selectedVacancy); } - foreach ($deselectedDiff as $deselectedVacancy) - { + foreach ($deselectedDiff as $deselectedVacancy) { $team->vacancies()->detach($deselectedVacancy); } - } - else - { + } else { $team->vacancies()->attach($requestVacancies); } $request->session()->flash('success', 'Assignments changed successfully.'); - return redirect()->back(); + return redirect()->back(); } } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 64ac48f..6d94f08 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -1,34 +1,48 @@ . + */ + namespace App\Http\Controllers; +use App\Ban; +use App\Http\Requests\Add2FASecretRequest; use App\Http\Requests\ChangeEmailRequest; use App\Http\Requests\ChangePasswordRequest; -use App\Http\Requests\FlushSessionsRequest; use App\Http\Requests\DeleteUserRequest; +use App\Http\Requests\FlushSessionsRequest; +use App\Http\Requests\Remove2FASecretRequest; use App\Http\Requests\SearchPlayerRequest; use App\Http\Requests\UpdateUserRequest; -use App\Http\Requests\Add2FASecretRequest; -use App\Http\Requests\Remove2FASecretRequest; - +use App\Notifications\ChangedPassword; +use App\Notifications\EmailChanged; +use App\Traits\ReceivesAccountTokens; use App\User; -use App\Ban; - +use Google2FA; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Log; -use App\Facades\UUID; -use App\Notifications\EmailChanged; -use App\Notifications\ChangedPassword; use Spatie\Permission\Models\Role; -use App\Traits\ReceivesAccountTokens; -use Google2FA; - class UserController extends Controller { - use ReceivesAccountTokens; public function showStaffMembers() @@ -38,24 +52,20 @@ class UserController extends Controller $staffRoles = [ 'reviewer', 'hiringManager', - 'admin' + 'admin', ]; // TODO: Un-hardcode this, move to config/roles.php $users = User::with('roles')->get(); $staffMembers = collect([]); - foreach($users as $user) - { - if (empty($user->roles)) - { + foreach ($users as $user) { + if (empty($user->roles)) { Log::debug($user->role->name); Log::debug('Staff list: User without role detected; Ignoring'); continue; } - foreach($user->roles as $role) - { - if (in_array($role->name, $staffRoles)) - { + foreach ($user->roles as $role) { + if (in_array($role->name, $staffRoles)) { $staffMembers->push($user); continue 2; // Skip directly to the next user instead of comparing more roles for the current user } @@ -64,7 +74,7 @@ class UserController extends Controller return view('dashboard.administration.staff-members') ->with([ - 'users' => $staffMembers + 'users' => $staffMembers, ]); } @@ -75,11 +85,9 @@ class UserController extends Controller $users = User::with('roles')->get(); $players = collect([]); - foreach($users as $user) - { + foreach ($users as $user) { // TODO: Might be problematic if we don't check if the role is user - if (count($user->roles) == 1) - { + if (count($user->roles) == 1) { $players->push($user); } } @@ -87,11 +95,10 @@ class UserController extends Controller return view('dashboard.administration.players') ->with([ 'users' => $players, - 'bannedUserCount' => Ban::all()->count() + 'bannedUserCount' => Ban::all()->count(), ]); } - public function showPlayersLike(SearchPlayerRequest $request) { $this->authorize('viewPlayers', User::class); @@ -102,18 +109,17 @@ class UserController extends Controller ->orWhere('email', 'LIKE', "%{$searchTerm}%") ->get(); - if (!$matchingUsers->isEmpty()) - { $request->session()->flash('success', 'There were ' . $matchingUsers->count() . ' user(s) matching your search.'); + if (! $matchingUsers->isEmpty()) { + $request->session()->flash('success', 'There were '.$matchingUsers->count().' user(s) matching your search.'); return view('dashboard.administration.players') ->with([ 'users' => $matchingUsers, - 'bannedUserCount' => Ban::all()->count() + 'bannedUserCount' => Ban::all()->count(), ]); - } - else - { + } else { $request->session()->flash('error', 'Your search term did not return any results.'); + return redirect(route('registeredPlayerList')); } } @@ -122,14 +128,10 @@ class UserController extends Controller { $QRCode = null; - if (!$request->user()->has2FA()) - { - if ($request->session()->has('twofaAttemptFailed')) - { + if (! $request->user()->has2FA()) { + if ($request->session()->has('twofaAttemptFailed')) { $twoFactorSecret = $request->session()->get('current2FA'); - } - else - { + } else { $twoFactorSecret = Google2FA::generateSecretKey(32, ''); $request->session()->put('current2FA', $twoFactorSecret); } @@ -146,21 +148,21 @@ class UserController extends Controller ->with('twofaQRCode', $QRCode); } - public function flushSessions(FlushSessionsRequest $request) { // TODO: Move all log calls to a listener, which binds to an event fired by each significant event, such as this one // This will allow for other actions to be performed on certain events (like login failed event) Auth::logoutOtherDevices($request->currentPasswordFlush); - Log::notice('User ' . Auth::user()->name . ' has logged out other devices in their account', + Log::notice('User '.Auth::user()->name.' has logged out other devices in their account', [ 'originIPAddress' => $request->ip(), 'userID' => Auth::user()->id, - 'timestamp' => now() + 'timestamp' => now(), ]); $request->session()->flash('success', 'Successfully logged out other devices. Remember to change your password if you think you\'ve been compromised.'); + return redirect()->back(); } @@ -168,112 +170,92 @@ class UserController extends Controller { $user = User::find(Auth::user()->id); - if (!is_null($user)) - { + if (! is_null($user)) { $user->password = Hash::make($request->newPassword); $user->save(); - Log::info('User ' . $user->name . ' has changed their password', [ + Log::info('User '.$user->name.' has changed their password', [ 'originIPAddress' => $request->ip(), 'userID' => $user->id, - 'timestamp' => now() + 'timestamp' => now(), ]); $user->notify(new ChangedPassword()); Auth::logout(); + return redirect()->back(); } - } public function changeEmail(ChangeEmailRequest $request) { $user = User::find(Auth::user()->id); - if (!is_null($user)) - { + if (! is_null($user)) { $user->email = $request->newEmail; $user->save(); - Log::notice('User ' . $user->name . ' has just changed their contact email address', [ + Log::notice('User '.$user->name.' has just changed their contact email address', [ 'originIPAddress' => $request->ip(), 'userID' => $user->id, - 'timestamp' => now() + 'timestamp' => now(), ]); $user->notify(new EmailChanged()); $request->session()->flash('success', 'Your email address has been changed!'); - } - else - { + } else { $request->session()->flash('error', 'There has been an error whilst trying to update your account. Please contact administrators.'); } return redirect()->back(); - } - - public function delete(DeleteUserRequest $request, User $user) { - $this->authorize('delete', $user); - if ($request->confirmPrompt == 'DELETE ACCOUNT') - { + if ($request->confirmPrompt == 'DELETE ACCOUNT') { $user->forceDelete(); - $request->session()->flash('success','User deleted successfully. PII has been erased.'); - } - else - { + $request->session()->flash('success', 'User deleted successfully. PII has been erased.'); + } else { $request->session()->flash('error', 'Wrong confirmation text! Try again.'); } - return redirect()->route('registeredPlayerList'); } - public function update(UpdateUserRequest $request, User $user) { + $this->authorize('adminEdit', $user); - $this->authorize('adminEdit', $user); + // Mass update would not be possible here without extra code, making route model binding useless + $user->email = $request->email; + $user->name = $request->name; + $user->uuid = $request->uuid; - // Mass update would not be possible here without extra code, making route model binding useless - $user->email = $request->email; - $user->name = $request->name; - $user->uuid = $request->uuid; - - $existingRoles = Role::all() + $existingRoles = Role::all() ->pluck('name') ->all(); - $roleDiff = array_diff($existingRoles, $request->roles); + $roleDiff = array_diff($existingRoles, $request->roles); - // Adds roles that were selected. Removes roles that aren't selected if the user has them. - foreach($roleDiff as $deselectedRole) - { - if ($user->hasRole($deselectedRole) && $deselectedRole !== 'user') - { - $user->removeRole($deselectedRole); - } - } - - foreach($request->roles as $role) - { - if (!$user->hasRole($role)) - { - $user->assignRole($role); + // Adds roles that were selected. Removes roles that aren't selected if the user has them. + foreach ($roleDiff as $deselectedRole) { + if ($user->hasRole($deselectedRole) && $deselectedRole !== 'user') { + $user->removeRole($deselectedRole); + } } - } + foreach ($request->roles as $role) { + if (! $user->hasRole($role)) { + $user->assignRole($role); + } + } - $user->save(); - $request->session()->flash('success', 'User updated successfully!'); - - return redirect()->back(); + $user->save(); + $request->session()->flash('success', 'User updated successfully!'); + return redirect()->back(); } public function add2FASecret(Add2FASecretRequest $request) @@ -281,35 +263,32 @@ class UserController extends Controller $currentSecret = $request->session()->get('current2FA'); $isValid = Google2FA::verifyKey($currentSecret, $request->otp); - if ($isValid) - { - $request->user()->twofa_secret = $currentSecret; - $request->user()->save(); + if ($isValid) { + $request->user()->twofa_secret = $currentSecret; + $request->user()->save(); - Log::warning('SECURITY: User activated two-factor authentication', [ - 'initiator' => $request->user()->email, - 'ip' => $request->ip() - ]); + Log::warning('SECURITY: User activated two-factor authentication', [ + 'initiator' => $request->user()->email, + 'ip' => $request->ip(), + ]); - Google2FA::login(); + Google2FA::login(); - Log::warning('SECURITY: Started two factor session automatically', [ - 'initiator' => $request->user()->email, - 'ip' => $request->ip() - ]); + Log::warning('SECURITY: Started two factor session automatically', [ + 'initiator' => $request->user()->email, + 'ip' => $request->ip(), + ]); - $request->session()->forget('current2FA'); + $request->session()->forget('current2FA'); - if ($request->session()->has('twofaAttemptFailed')) - $request->session()->forget('twofaAttemptFailed'); + if ($request->session()->has('twofaAttemptFailed')) { + $request->session()->forget('twofaAttemptFailed'); + } - - $request->session()->flash('success', '2FA succesfully enabled! You\'ll now be prompted for an OTP each time you log in.'); - } - else - { - $request->session()->flash('error', 'Incorrect code. Please reopen the 2FA settings panel and try again.'); - $request->session()->put('twofaAttemptFailed', true); + $request->session()->flash('success', '2FA succesfully enabled! You\'ll now be prompted for an OTP each time you log in.'); + } else { + $request->session()->flash('error', 'Incorrect code. Please reopen the 2FA settings panel and try again.'); + $request->session()->put('twofaAttemptFailed', true); } return redirect()->back(); @@ -318,47 +297,41 @@ class UserController extends Controller public function remove2FASecret(Remove2FASecretRequest $request) { Log::warning('SECURITY: Disabling two factor authentication (user initiated)', [ - 'initiator' => $request->user()->email, - 'ip' => $request->ip() + 'initiator' => $request->user()->email, + 'ip' => $request->ip(), ]); $request->user()->twofa_secret = null; $request->user()->save(); $request->session()->flash('success', 'Two-factor authentication disabled.'); + return redirect()->back(); } - - - public function terminate(Request $request, User $user) { $this->authorize('terminate', User::class); // TODO: move logic to policy - if (!$user->isStaffMember() || $user->is(Auth::user())) - { + if (! $user->isStaffMember() || $user->is(Auth::user())) { $request->session()->flash('error', 'You cannot terminate this user.'); + return redirect()->back(); } - foreach ($user->roles as $role) - { - if ($role->name == 'user') - { - continue; - } + foreach ($user->roles as $role) { + if ($role->name == 'user') { + continue; + } - $user->removeRole($role->name); + $user->removeRole($role->name); } - Log::info('User ' . $user->name . ' has just been demoted.'); + Log::info('User '.$user->name.' has just been demoted.'); $request->session()->flash('success', 'User terminated successfully.'); //TODO: Dispatch event return redirect()->back(); } - - } diff --git a/app/Http/Controllers/VacancyController.php b/app/Http/Controllers/VacancyController.php index fdb5ce0..5316d3b 100644 --- a/app/Http/Controllers/VacancyController.php +++ b/app/Http/Controllers/VacancyController.php @@ -1,30 +1,45 @@ . + */ + namespace App\Http\Controllers; -use App\Http\Requests\VacancyRequest; -use App\Http\Requests\VacancyEditRequest; - -use App\Vacancy; -use App\User; use App\Form; - +use App\Http\Requests\VacancyEditRequest; +use App\Http\Requests\VacancyRequest; use App\Notifications\VacancyClosed; - +use App\User; +use App\Vacancy; use Illuminate\Http\Request; use Illuminate\Support\Str; -use Illuminate\Support\Facades\Auth; - class VacancyController extends Controller { public function index() { - $this->authorize('viewAny', Vacancy::class); + $this->authorize('viewAny', Vacancy::class); + return view('dashboard.administration.positions') ->with([ 'forms' => Form::all(), - 'vacancies' => Vacancy::all() + 'vacancies' => Vacancy::all(), ]); } @@ -33,13 +48,12 @@ class VacancyController extends Controller $this->authorize('create', Vacancy::class); $form = Form::find($request->vacancyFormID); - if (!is_null($form)) - { - /* note: since we can't convert HTML back to Markdown, we'll have to do the converting when the user requests a page, - * and leave the database with Markdown only so it can be used and edited everywhere. - * for several vacancies, this would require looping through all of them and replacing MD with HTML, which is obviously not the most clean solution; - * however, the Model can be configured to return MD instead of HTML on that specific field saving us from looping. - */ + if (! is_null($form)) { + /* note: since we can't convert HTML back to Markdown, we'll have to do the converting when the user requests a page, + * and leave the database with Markdown only so it can be used and edited everywhere. + * for several vacancies, this would require looping through all of them and replacing MD with HTML, which is obviously not the most clean solution; + * however, the Model can be configured to return MD instead of HTML on that specific field saving us from looping. + */ Vacancy::create([ 'vacancyName' => $request->vacancyName, @@ -49,48 +63,40 @@ class VacancyController extends Controller 'permissionGroupName' => $request->permissionGroup, 'discordRoleID' => $request->discordRole, 'vacancyFormID' => $request->vacancyFormID, - 'vacancyCount' => $request->vacancyCount + 'vacancyCount' => $request->vacancyCount, ]); $request->session()->flash('success', 'Vacancy successfully opened. It will now show in the home page.'); - } - else - { + } else { $request->session()->flash('error', 'You cannot create a vacancy without a valid form.'); } return redirect()->back(); - } public function updatePositionAvailability(Request $request, $status, Vacancy $vacancy) { - $this->authorize('update', $vacancy); - if (!is_null($vacancy)) - { + if (! is_null($vacancy)) { $type = 'success'; - switch ($status) - { + switch ($status) { case 'open': $vacancy->open(); - $message = "Position successfully opened!"; + $message = 'Position successfully opened!'; break; case 'close': $vacancy->close(); - $message = "Position successfully closed!"; + $message = 'Position successfully closed!'; - foreach(User::all() as $user) - { - if ($user->isStaffMember()) - { - $user->notify(new VacancyClosed($vacancy)); - } + foreach (User::all() as $user) { + if ($user->isStaffMember()) { + $user->notify(new VacancyClosed($vacancy)); + } } break; @@ -99,40 +105,36 @@ class VacancyController extends Controller $type = 'error'; } - } - else - { + } else { $message = "The position you're trying to update doesn't exist!"; - $type = "error"; + $type = 'error'; } $request->session()->flash($type, $message); + return redirect()->back(); } - public function edit(Request $request, Vacancy $vacancy) { - $this->authorize('update', $vacancy); + $this->authorize('update', $vacancy); + return view('dashboard.administration.editposition') ->with('vacancy', $vacancy); } - - public function update(VacancyEditRequest $request, Vacancy $vacancy) { - $this->authorize('update', $vacancy); + $this->authorize('update', $vacancy); - $vacancy->vacancyFullDescription = $request->vacancyFullDescription; - $vacancy->vacancyDescription = $request->vacancyDescription; - $vacancy->vacancyCount = $request->vacancyCount; + $vacancy->vacancyFullDescription = $request->vacancyFullDescription; + $vacancy->vacancyDescription = $request->vacancyDescription; + $vacancy->vacancyCount = $request->vacancyCount; - $vacancy->save(); + $vacancy->save(); - $request->session()->flash('success', 'Vacancy successfully updated.'); - return redirect()->back(); + $request->session()->flash('success', 'Vacancy successfully updated.'); + return redirect()->back(); } - } diff --git a/app/Http/Controllers/VoteController.php b/app/Http/Controllers/VoteController.php index eba3ae1..30eb2ea 100644 --- a/app/Http/Controllers/VoteController.php +++ b/app/Http/Controllers/VoteController.php @@ -1,18 +1,34 @@ . + */ + namespace App\Http\Controllers; use App\Application; use App\Http\Requests\VoteRequest; -use App\Jobs\ProcessVoteList; use App\Vote; -use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Log; class VoteController extends Controller { - public function vote(VoteRequest $voteRequest, Application $application) { $this->authorize('create', Vote::class); @@ -23,9 +39,8 @@ class VoteController extends Controller ]); $vote->application()->attach($application->id); - - Log::info('User ' . Auth::user()->name . ' has voted in applicant ' . $application->user->name . '\'s application', [ - 'voteType' => $voteRequest->voteType + Log::info('User '.Auth::user()->name.' has voted in applicant '.$application->user->name.'\'s application', [ + 'voteType' => $voteRequest->voteType, ]); $voteRequest->session()->flash('success', 'Your vote has been registered!'); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 9a2a7f5..f0d3604 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; @@ -70,6 +89,6 @@ class Kernel extends HttpKernel 'localizationRedirect' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRedirectFilter::class, 'localeSessionRedirect' => \Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect::class, 'localeCookieRedirect' => \Mcamara\LaravelLocalization\Middleware\LocaleCookieRedirect::class, - 'localeViewPath' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationViewPath::class + 'localeViewPath' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationViewPath::class, ]; } diff --git a/app/Http/Middleware/ApplicationEligibility.php b/app/Http/Middleware/ApplicationEligibility.php index f091d8e..13cb1da 100644 --- a/app/Http/Middleware/ApplicationEligibility.php +++ b/app/Http/Middleware/ApplicationEligibility.php @@ -1,12 +1,31 @@ . + */ + namespace App\Http\Middleware; use App\Application; -use Illuminate\Support\Facades\Log; use Carbon\Carbon; use Closure; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\View; class ApplicationEligibility @@ -23,37 +42,29 @@ class ApplicationEligibility { $curtime = new Carbon(now()); - - if (Auth::check()) - { + if (Auth::check()) { $applications = Application::where('applicantUserID', Auth::user()->id)->get(); $eligible = true; $daysRemaining = 0; - if (!$applications->isEmpty()) - { - foreach ($applications as $application) - { + if (! $applications->isEmpty()) { + foreach ($applications as $application) { $appTime = Carbon::parse($application->created_at); - if ($appTime->isSameMonth($curtime)) - { - - Log::warning('Notice: Application ID ' . $application->id . ' was found to be in the same month as today\'s time, making the user ' . Auth::user()->name . ' ineligible for application'); + if ($appTime->isSameMonth($curtime)) { + Log::warning('Notice: Application ID '.$application->id.' was found to be in the same month as today\'s time, making the user '.Auth::user()->name.' ineligible for application'); $eligible = false; } } $allowedTime = Carbon::parse($applications->last()->created_at)->addMonth(); $daysRemaining = $allowedTime->diffInDays(now()); - } View::share('isEligibleForApplication', $eligible); View::share('eligibilityDaysRemaining', $daysRemaining); } - return $next($request); } } diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 704089a..af34268 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Middleware; use Illuminate\Auth\Middleware\Authenticate as Middleware; diff --git a/app/Http/Middleware/Bancheck.php b/app/Http/Middleware/Bancheck.php index 0eca7f7..6c8a8ef 100644 --- a/app/Http/Middleware/Bancheck.php +++ b/app/Http/Middleware/Bancheck.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Middleware; use Closure; @@ -20,17 +39,11 @@ class Bancheck $userIP = $request->ip(); $anonymousUser = User::where('ipAddress', $userIP)->get(); - - if (Auth::check() && Auth::user()->isBanned()) - { + if (Auth::check() && Auth::user()->isBanned()) { View::share('isBanned', true); - } - elseif(!$anonymousUser->isEmpty() && User::find($anonymousUser->id)->isBanned()) - { + } elseif (! $anonymousUser->isEmpty() && User::find($anonymousUser->id)->isBanned()) { View::share('isBanned', true); - } - else - { + } else { View::share('isBanned', false); } diff --git a/app/Http/Middleware/CheckForMaintenanceMode.php b/app/Http/Middleware/CheckForMaintenanceMode.php index 35b9824..c58ffff 100644 --- a/app/Http/Middleware/CheckForMaintenanceMode.php +++ b/app/Http/Middleware/CheckForMaintenanceMode.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware; diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index 033136a..140dd8d 100644 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Middleware; use Illuminate\Cookie\Middleware\EncryptCookies as Middleware; diff --git a/app/Http/Middleware/ForceLogoutMiddleware.php b/app/Http/Middleware/ForceLogoutMiddleware.php index 551c287..7501cdd 100644 --- a/app/Http/Middleware/ForceLogoutMiddleware.php +++ b/app/Http/Middleware/ForceLogoutMiddleware.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Middleware; use Closure; @@ -16,11 +35,11 @@ class ForceLogoutMiddleware */ public function handle($request, Closure $next) { - if (Auth::user()->isBanned()) - { + if (Auth::user()->isBanned()) { Auth::logout(); $request->session()->flash('error', 'Error: Your session has been forcefully terminated. Please try again in a few days.'); + return redirect('/'); } diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 2395ddc..674a32b 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Middleware; use App\Providers\RouteServiceProvider; diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php index 5a50e7b..1698610 100644 --- a/app/Http/Middleware/TrimStrings.php +++ b/app/Http/Middleware/TrimStrings.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware; diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index 085cdb5..785351e 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Middleware; use Fideloper\Proxy\TrustProxies as Middleware; @@ -12,7 +31,7 @@ class TrustProxies extends Middleware * * @var array|string */ - protected $proxies = "*"; + protected $proxies = '*'; /** * The headers that should be used to detect proxies. diff --git a/app/Http/Middleware/UsernameUUID.php b/app/Http/Middleware/UsernameUUID.php index 29a93cf..32c8a8e 100644 --- a/app/Http/Middleware/UsernameUUID.php +++ b/app/Http/Middleware/UsernameUUID.php @@ -1,15 +1,33 @@ . + */ + namespace App\Http\Middleware; -use Closure; use App\Facades\UUID; -use Illuminate\Support\Facades\Http; +use Closure; class UsernameUUID { /** - * Converts a Minecraft username found in the request body to a UUID + * Converts a Minecraft username found in the request body to a UUID. * * @param \Illuminate\Http\Request $request * @param \Closure $next @@ -18,23 +36,21 @@ class UsernameUUID public function handle($request, Closure $next) { $input = $request->all(); - if (isset($input['uuid'])) - { - try - { - $username = $input['uuid']; - $input['uuid'] = UUID::toUUID($username); - } - catch(\InvalidArgumentException $iae) - { + if (isset($input['uuid'])) { + try { + $username = $input['uuid']; + $input['uuid'] = UUID::toUUID($username); + } catch (\InvalidArgumentException $iae) { report($iae); $request->session()->flash('error', $iae->getMessage()); + return redirect(route('register')); } $request->replace($input); } + return $next($request); } } diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index 0c13b85..0b6761a 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; diff --git a/app/Http/Requests/Add2FASecretRequest.php b/app/Http/Requests/Add2FASecretRequest.php index 13fa9dd..f1b2ca4 100644 --- a/app/Http/Requests/Add2FASecretRequest.php +++ b/app/Http/Requests/Add2FASecretRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -13,7 +32,7 @@ class Add2FASecretRequest extends FormRequest */ public function authorize() { - // current logic only updates currently authenticated user + // current logic only updates currently authenticated user return true; } @@ -25,7 +44,7 @@ class Add2FASecretRequest extends FormRequest public function rules() { return [ - 'otp' => 'required|string|min:6|max:6' + 'otp' => 'required|string|min:6|max:6', ]; } } diff --git a/app/Http/Requests/BanUserRequest.php b/app/Http/Requests/BanUserRequest.php index ba25c34..6c0469b 100644 --- a/app/Http/Requests/BanUserRequest.php +++ b/app/Http/Requests/BanUserRequest.php @@ -1,11 +1,29 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Support\Facades\Auth; - class BanUserRequest extends FormRequest { /** @@ -28,7 +46,7 @@ class BanUserRequest extends FormRequest return [ 'reason' => 'required|string', 'durationOperand' => 'nullable|string', - 'durationOperator' => 'nullable|string' + 'durationOperator' => 'nullable|string', ]; } } diff --git a/app/Http/Requests/ChangeEmailRequest.php b/app/Http/Requests/ChangeEmailRequest.php index 128a3eb..c591f2b 100644 --- a/app/Http/Requests/ChangeEmailRequest.php +++ b/app/Http/Requests/ChangeEmailRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -25,7 +44,7 @@ class ChangeEmailRequest extends FormRequest { return [ 'currentPassword' => 'required|password', - 'newEmail' => 'required|email|unique:users,email' + 'newEmail' => 'required|email|unique:users,email', ]; } } diff --git a/app/Http/Requests/ChangePasswordRequest.php b/app/Http/Requests/ChangePasswordRequest.php index 3feb69b..f82dae3 100644 --- a/app/Http/Requests/ChangePasswordRequest.php +++ b/app/Http/Requests/ChangePasswordRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -25,7 +44,7 @@ class ChangePasswordRequest extends FormRequest { return [ 'newPassword' => 'required|string|confirmed', - 'oldPassword' => 'required|string|password' + 'oldPassword' => 'required|string|password', ]; } } diff --git a/app/Http/Requests/DeleteUserRequest.php b/app/Http/Requests/DeleteUserRequest.php index 924635c..bdaaada 100644 --- a/app/Http/Requests/DeleteUserRequest.php +++ b/app/Http/Requests/DeleteUserRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -25,7 +44,7 @@ class DeleteUserRequest extends FormRequest public function rules() { return [ - 'confirmPrompt' => 'required|string' + 'confirmPrompt' => 'required|string', ]; } } diff --git a/app/Http/Requests/EditTeamRequest.php b/app/Http/Requests/EditTeamRequest.php index 801f2a9..d2ad544 100644 --- a/app/Http/Requests/EditTeamRequest.php +++ b/app/Http/Requests/EditTeamRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -25,7 +44,7 @@ class EditTeamRequest extends FormRequest { return [ 'teamDescription' => 'required|string|max:200', - 'joinType' => 'required|boolean' + 'joinType' => 'required|boolean', ]; } } diff --git a/app/Http/Requests/FlushSessionsRequest.php b/app/Http/Requests/FlushSessionsRequest.php index f274ebd..6f4c78e 100644 --- a/app/Http/Requests/FlushSessionsRequest.php +++ b/app/Http/Requests/FlushSessionsRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -24,7 +43,7 @@ class FlushSessionsRequest extends FormRequest public function rules() { return [ - 'currentPasswordFlush' => 'required|password' + 'currentPasswordFlush' => 'required|password', ]; } } diff --git a/app/Http/Requests/NewCommentRequest.php b/app/Http/Requests/NewCommentRequest.php index e1470bc..9d05a95 100644 --- a/app/Http/Requests/NewCommentRequest.php +++ b/app/Http/Requests/NewCommentRequest.php @@ -1,11 +1,29 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Support\Facades\Auth; - class NewCommentRequest extends FormRequest { /** @@ -27,7 +45,7 @@ class NewCommentRequest extends FormRequest public function rules() { return [ - 'comment' => 'required|string|max:600|min:20' + 'comment' => 'required|string|max:600|min:20', ]; } } diff --git a/app/Http/Requests/NewTeamRequest.php b/app/Http/Requests/NewTeamRequest.php index 9e8329d..a4fcb4e 100644 --- a/app/Http/Requests/NewTeamRequest.php +++ b/app/Http/Requests/NewTeamRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -24,7 +43,7 @@ class NewTeamRequest extends FormRequest public function rules() { return [ - 'teamName' => 'required|max:200|string' + 'teamName' => 'required|max:200|string', ]; } } diff --git a/app/Http/Requests/ProfileSave.php b/app/Http/Requests/ProfileSave.php index 75278be..7d79846 100644 --- a/app/Http/Requests/ProfileSave.php +++ b/app/Http/Requests/ProfileSave.php @@ -1,10 +1,28 @@ . + */ + namespace App\Http\Requests; use App\Profile; use Illuminate\Foundation\Http\FormRequest; -use Illuminate\Support\Facades\Auth; class ProfileSave extends FormRequest { @@ -33,7 +51,7 @@ class ProfileSave extends FormRequest 'socialInsta' => 'nullable|string', 'socialTwitter' => 'nullable|string', 'socialDiscord' => 'nullable|string', - 'socialGithub' => 'nullable|string' + 'socialGithub' => 'nullable|string', ]; } } diff --git a/app/Http/Requests/Remove2FASecretRequest.php b/app/Http/Requests/Remove2FASecretRequest.php index 6583b93..4cd69bb 100644 --- a/app/Http/Requests/Remove2FASecretRequest.php +++ b/app/Http/Requests/Remove2FASecretRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -25,7 +44,7 @@ class Remove2FASecretRequest extends FormRequest { return [ 'currentPassword' => 'required|password', - 'consent' => 'required|accepted' + 'consent' => 'required|accepted', ]; } } diff --git a/app/Http/Requests/SaveNotesRequest.php b/app/Http/Requests/SaveNotesRequest.php index b6dd782..7b89a98 100644 --- a/app/Http/Requests/SaveNotesRequest.php +++ b/app/Http/Requests/SaveNotesRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -24,7 +43,7 @@ class SaveNotesRequest extends FormRequest public function rules() { return [ - 'noteText' => 'required|string' + 'noteText' => 'required|string', ]; } } diff --git a/app/Http/Requests/SearchPlayerRequest.php b/app/Http/Requests/SearchPlayerRequest.php index 4689a49..23c7e78 100644 --- a/app/Http/Requests/SearchPlayerRequest.php +++ b/app/Http/Requests/SearchPlayerRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -25,7 +44,7 @@ class SearchPlayerRequest extends FormRequest public function rules() { return [ - 'searchTerm' => 'required|string|max:17' // max user char limit set by Mojang + 'searchTerm' => 'required|string|max:17', // max user char limit set by Mojang ]; } } diff --git a/app/Http/Requests/SendInviteRequest.php b/app/Http/Requests/SendInviteRequest.php index 6c66faf..234ed89 100644 --- a/app/Http/Requests/SendInviteRequest.php +++ b/app/Http/Requests/SendInviteRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -24,7 +43,7 @@ class SendInviteRequest extends FormRequest public function rules() { return [ - 'user' => 'required|integer' + 'user' => 'required|integer', ]; } } diff --git a/app/Http/Requests/UpdateUserRequest.php b/app/Http/Requests/UpdateUserRequest.php index 99403b4..709f013 100644 --- a/app/Http/Requests/UpdateUserRequest.php +++ b/app/Http/Requests/UpdateUserRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -28,7 +47,7 @@ class UpdateUserRequest extends FormRequest 'email' => 'required|email', 'name' => 'required|string', 'uuid' => 'required|max:32|min:32', - 'roles' => 'required_without_all' + 'roles' => 'required_without_all', ]; } } diff --git a/app/Http/Requests/UserDeleteRequest.php b/app/Http/Requests/UserDeleteRequest.php index 5135685..1d0774e 100644 --- a/app/Http/Requests/UserDeleteRequest.php +++ b/app/Http/Requests/UserDeleteRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -24,16 +43,15 @@ class UserDeleteRequest extends FormRequest */ public function rules() { - if (Auth::user()->has2FA()) - { + if (Auth::user()->has2FA()) { return [ 'currentPassword' => 'required|password:web', - 'otp' => 'required|integer|max:6' + 'otp' => 'required|integer|max:6', ]; } return [ - 'currentPassword' => 'required|password:web' + 'currentPassword' => 'required|password:web', ]; } } diff --git a/app/Http/Requests/VacancyEditRequest.php b/app/Http/Requests/VacancyEditRequest.php index c7ba958..b9c4c3e 100644 --- a/app/Http/Requests/VacancyEditRequest.php +++ b/app/Http/Requests/VacancyEditRequest.php @@ -1,11 +1,29 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Support\Facades\Auth; - class VacancyEditRequest extends FormRequest { /** @@ -28,7 +46,7 @@ class VacancyEditRequest extends FormRequest return [ 'vacancyDescription' => 'required|string', 'vacancyFullDescription' => 'nullable|string', - 'vacancyCount' => 'required|integer|min:1' + 'vacancyCount' => 'required|integer|min:1', ]; } } diff --git a/app/Http/Requests/VacancyRequest.php b/app/Http/Requests/VacancyRequest.php index 176610d..07e333c 100644 --- a/app/Http/Requests/VacancyRequest.php +++ b/app/Http/Requests/VacancyRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -30,7 +49,7 @@ class VacancyRequest extends FormRequest 'permissionGroup' => 'required|string', 'discordRole' => 'required|string', 'vacancyCount' => 'required|integer', - 'vacancyFormID' => 'required|integer' + 'vacancyFormID' => 'required|integer', ]; } } diff --git a/app/Http/Requests/VoteRequest.php b/app/Http/Requests/VoteRequest.php index fdcf8c9..67e30a9 100644 --- a/app/Http/Requests/VoteRequest.php +++ b/app/Http/Requests/VoteRequest.php @@ -1,5 +1,24 @@ . + */ + namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; @@ -24,7 +43,7 @@ class VoteRequest extends FormRequest public function rules() { return [ - 'voteType' => 'required|string|in:VOTE_DENY,VOTE_APPROVE' + 'voteType' => 'required|string|in:VOTE_DENY,VOTE_APPROVE', ]; } } diff --git a/app/Jobs/CleanBans.php b/app/Jobs/CleanBans.php index a5a6862..5a25994 100644 --- a/app/Jobs/CleanBans.php +++ b/app/Jobs/CleanBans.php @@ -1,7 +1,28 @@ . + */ + namespace App\Jobs; +use App\Ban; +use Carbon\Carbon; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; @@ -9,15 +30,12 @@ use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Log; -use App\Ban; -use Carbon\Carbon; - class CleanBans implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public $bans; + /** * Create a new job instance. * @@ -34,23 +52,18 @@ class CleanBans implements ShouldQueue */ public function handle() { - Log::debug('Running automatic ban cleaner...'); $bans = Ban::all(); - if (!is_null($bans)) - { - foreach($this->bans as $ban) - { - $bannedUntil = Carbon::parse($ban->bannedUntil); + if (! is_null($bans)) { + foreach ($this->bans as $ban) { + $bannedUntil = Carbon::parse($ban->bannedUntil); - if ($bannedUntil->equalTo(now())) - { - Log::debug('Deleted ban ' . $ban->id . ' belonging to ' . $ban->user->name); - $ban->delete(); - } - } + if ($bannedUntil->equalTo(now())) { + Log::debug('Deleted ban '.$ban->id.' belonging to '.$ban->user->name); + $ban->delete(); + } + } } - } } diff --git a/app/Listeners/DenyUser.php b/app/Listeners/DenyUser.php index 0670cc3..34095ca 100644 --- a/app/Listeners/DenyUser.php +++ b/app/Listeners/DenyUser.php @@ -1,11 +1,28 @@ . + */ + namespace App\Listeners; use App\Events\ApplicationDeniedEvent; use App\Notifications\ApplicationDenied; -use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Queue\InteractsWithQueue; use Illuminate\Support\Facades\Log; class DenyUser @@ -29,9 +46,8 @@ class DenyUser public function handle(ApplicationDeniedEvent $event) { $event->application->setStatus('DENIED'); - Log::info('User ' . $event->application->user->name . ' just had their application denied.'); + Log::info('User '.$event->application->user->name.' just had their application denied.'); $event->application->user->notify(new ApplicationDenied($event->application)); - } } diff --git a/app/Listeners/LogAuthenticationFailure.php b/app/Listeners/LogAuthenticationFailure.php index afe1fee..15ce404 100644 --- a/app/Listeners/LogAuthenticationFailure.php +++ b/app/Listeners/LogAuthenticationFailure.php @@ -1,9 +1,26 @@ . + */ + namespace App\Listeners; -use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Queue\InteractsWithQueue; use Illuminate\Support\Facades\Log; class LogAuthenticationFailure @@ -27,10 +44,9 @@ class LogAuthenticationFailure public function handle($event) { $targetAccountID = 0; - $originalIP = "0.0.0.0"; + $originalIP = '0.0.0.0'; - if (isset($event->user->id)) - { + if (isset($event->user->id)) { $targetAccountID = $event->user->id; } diff --git a/app/Listeners/LogAuthenticationSuccess.php b/app/Listeners/LogAuthenticationSuccess.php index 40781d9..7dd3ef3 100644 --- a/app/Listeners/LogAuthenticationSuccess.php +++ b/app/Listeners/LogAuthenticationSuccess.php @@ -1,9 +1,26 @@ . + */ + namespace App\Listeners; -use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Queue\InteractsWithQueue; use Illuminate\Support\Facades\Log; class LogAuthenticationSuccess diff --git a/app/Listeners/OnUserBanned.php b/app/Listeners/OnUserBanned.php index 897a280..804aac5 100644 --- a/app/Listeners/OnUserBanned.php +++ b/app/Listeners/OnUserBanned.php @@ -1,15 +1,30 @@ . + */ + namespace App\Listeners; -use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Queue\InteractsWithQueue; use App\Events\UserBannedEvent; use App\Notifications\UserBanned; - -use Illuminate\Support\Facades\Log; - use App\User; +use Illuminate\Support\Facades\Log; class OnUserBanned { @@ -31,16 +46,12 @@ class OnUserBanned */ public function handle(UserBannedEvent $event) { + Log::warning('User '.$event->user->name.' has just been banned from the site!'); - Log::warning("User " . $event->user->name . " has just been banned from the site!"); - - foreach(User::all() as $user) - { - if ($user->isStaffMember()) - { - $user->notify((new UserBanned($event->user, $event->ban))->delay(now()->addSeconds(10))); - } + foreach (User::all() as $user) { + if ($user->isStaffMember()) { + $user->notify((new UserBanned($event->user, $event->ban))->delay(now()->addSeconds(10))); + } } - } } diff --git a/app/Listeners/OnUserRegistration.php b/app/Listeners/OnUserRegistration.php index 7ab08f9..f2fa814 100644 --- a/app/Listeners/OnUserRegistration.php +++ b/app/Listeners/OnUserRegistration.php @@ -1,14 +1,30 @@ . + */ + namespace App\Listeners; -use Illuminate\Support\Facades\Log; -use Illuminate\Auth\Events\Registered; -use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Queue\InteractsWithQueue; - -use App\User; use App\Notifications\NewUser; +use App\User; +use Illuminate\Auth\Events\Registered; +use Illuminate\Support\Facades\Log; class OnUserRegistration { @@ -31,12 +47,10 @@ class OnUserRegistration public function handle(Registered $event) { // TODO: Send push notification to online admins via browser (w/ pusher) - Log::info('User ' . $event->user->name . ' has just registered for an account.'); + Log::info('User '.$event->user->name.' has just registered for an account.'); - foreach(User::all() as $user) - { - if ($user->hasRole('admin')) - { + foreach (User::all() as $user) { + if ($user->hasRole('admin')) { $user->notify(new NewUser($event->user)); } } diff --git a/app/Listeners/PromoteUser.php b/app/Listeners/PromoteUser.php index 62760b0..a3ca047 100644 --- a/app/Listeners/PromoteUser.php +++ b/app/Listeners/PromoteUser.php @@ -1,13 +1,29 @@ . + */ + namespace App\Listeners; use App\Events\ApplicationApprovedEvent; -use App\StaffProfile; use App\Notifications\ApplicationApproved; -use Carbon\Carbon; -use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Queue\InteractsWithQueue; +use App\StaffProfile; use Illuminate\Support\Facades\Log; class PromoteUser @@ -35,19 +51,18 @@ class PromoteUser $staffProfile = StaffProfile::create([ 'userID' => $event->application->user->id, 'approvalDate' => now()->toDateTimeString(), - 'memberNotes' => 'Approved by staff members. Welcome them to the team!' + 'memberNotes' => 'Approved by staff members. Welcome them to the team!', ]); $event->application->user->assignRole('reviewer'); - Log::info('User ' . $event->application->user->name . ' has just been promoted!', [ + Log::info('User '.$event->application->user->name.' has just been promoted!', [ 'newRank' => $event->application->response->vacancy->permissionGroupName, - 'staffProfileID' => $staffProfile->id + 'staffProfileID' => $staffProfile->id, ]); $event->application->user->notify(new ApplicationApproved($event->application)); // note: Also notify staff // TODO: Also assign new app role based on the permission group name - } } diff --git a/app/Mail/InviteToTeam.php b/app/Mail/InviteToTeam.php index 990246b..5e2714d 100644 --- a/app/Mail/InviteToTeam.php +++ b/app/Mail/InviteToTeam.php @@ -1,9 +1,27 @@ . + */ + namespace App\Mail; use Illuminate\Bus\Queueable; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Mpociot\Teamwork\TeamInvite; @@ -12,19 +30,14 @@ class InviteToTeam extends Mailable { use Queueable, SerializesModels; - public $teamName; - public $name; - public $inviterName; - public $denyToken; - public $acceptToken; /** @@ -49,7 +62,7 @@ class InviteToTeam extends Mailable public function build() { return $this - ->subject('You have just been invited to ' . $this->teamName) + ->subject('You have just been invited to '.$this->teamName) ->view('mail.invited-to-team'); } } diff --git a/app/Mail/NewContactSubmission.php b/app/Mail/NewContactSubmission.php index 24373f8..15e2cdf 100644 --- a/app/Mail/NewContactSubmission.php +++ b/app/Mail/NewContactSubmission.php @@ -1,9 +1,27 @@ . + */ + namespace App\Mail; use Illuminate\Bus\Queueable; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; diff --git a/app/Mail/UserAccountDeleteConfirmation.php b/app/Mail/UserAccountDeleteConfirmation.php index 3ad83b2..33b021f 100644 --- a/app/Mail/UserAccountDeleteConfirmation.php +++ b/app/Mail/UserAccountDeleteConfirmation.php @@ -1,32 +1,43 @@ . + */ + namespace App\Mail; +use App\User; use Illuminate\Bus\Queueable; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; -use App\User; - class UserAccountDeleteConfirmation extends Mailable { use Queueable, SerializesModels; - - public $deleteToken; - public $cancelToken; - public $originalIP; - public $name; - public $userID; /** diff --git a/app/Notifications/ApplicationApproved.php b/app/Notifications/ApplicationApproved.php index bfde408..9c20eae 100644 --- a/app/Notifications/ApplicationApproved.php +++ b/app/Notifications/ApplicationApproved.php @@ -1,7 +1,27 @@ . + */ + namespace App\Notifications; +use App\Application; use App\Facades\Options; use App\Traits\Cancellable; use Illuminate\Bus\Queueable; @@ -9,7 +29,6 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; -use App\Application; class ApplicationApproved extends Notification implements ShouldQueue { @@ -45,10 +64,9 @@ class ApplicationApproved extends Notification implements ShouldQueue */ public function toMail($notifiable) { - return (new MailMessage) ->from(config('notification.sender.address'), config('notification.sender.name')) - ->subject(config('app.name') . ' - ' . $this->application->response->vacancy->vacancyName . ' application approved') + ->subject(config('app.name').' - '.$this->application->response->vacancy->vacancyName.' application approved') ->line('
') ->line('Congratulations! Our Staff team has reviewed your application today, and your application has been approved.') ->line('You have just received the Reviewer role, which allows you to view and vote on other applications.') @@ -62,19 +80,18 @@ class ApplicationApproved extends Notification implements ShouldQueue public function toSlack($notifiable) { - $url = route('showSingleProfile', ['user' => $notifiable->id]); $roles = implode(', ', $notifiable->roles->pluck('name')->all()); return (new SlackMessage) ->success() ->content('A user has been approved on the team. Welcome aboard!') - ->attachment(function($attachment) use ($notifiable, $url, $roles){ + ->attachment(function ($attachment) use ($notifiable, $url, $roles) { $attachment->title('New staff member') ->fields([ 'Name' => $notifiable->name, 'Email' => $notifiable->email, - 'Roles' => $roles + 'Roles' => $roles, ]) ->action('View profile', $url); }); diff --git a/app/Notifications/ApplicationDenied.php b/app/Notifications/ApplicationDenied.php index 03a4382..09233ad 100644 --- a/app/Notifications/ApplicationDenied.php +++ b/app/Notifications/ApplicationDenied.php @@ -1,19 +1,37 @@ . + */ + namespace App\Notifications; +use App\Application; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; -use App\Application; class ApplicationDenied extends Notification implements ShouldQueue { use Queueable; - public $application; /** @@ -45,10 +63,9 @@ class ApplicationDenied extends Notification implements ShouldQueue */ public function toMail($notifiable) { - return (new MailMessage) ->from(config('notification.sender.address'), config('notification.sender.name')) - ->subject(config('app.name') . ' - ' . $this->application->response->vacancy->vacancyName . ' application denied') + ->subject(config('app.name').' - '.$this->application->response->vacancy->vacancyName.' application denied') ->line('Your most recent application has been denied.') ->line('Our review team denies applications for several reasons, including poor answers.') ->line('Please review your application and try again in 30 days.') @@ -56,20 +73,19 @@ class ApplicationDenied extends Notification implements ShouldQueue ->line('Better luck next time!'); } - public function toSlack($notifiable) { - $notifiableName = $notifiable->name; + $notifiableName = $notifiable->name; - return (new SlackMessage) + return (new SlackMessage) ->error() ->content('An application has just been denied.') - ->attachment(function($attachment) use ($notifiableName){ + ->attachment(function ($attachment) use ($notifiableName) { $attachment->title('Application denied!') - ->content($notifiableName . '\'s application has just been denied. They can try again in 30 days.'); + ->content($notifiableName.'\'s application has just been denied. They can try again in 30 days.'); }); - } + /** * Get the array representation of the notification. * diff --git a/app/Notifications/ApplicationMoved.php b/app/Notifications/ApplicationMoved.php index 9598258..59c1c63 100644 --- a/app/Notifications/ApplicationMoved.php +++ b/app/Notifications/ApplicationMoved.php @@ -1,13 +1,32 @@ . + */ + namespace App\Notifications; +use App\Facades\Options; +use App\Traits\Cancellable; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; -use App\Traits\Cancellable; -use App\Facades\Options; class ApplicationMoved extends Notification implements ShouldQueue { @@ -38,7 +57,7 @@ class ApplicationMoved extends Notification implements ShouldQueue { return (new MailMessage) ->from(config('notification.sender.address'), config('notification.sender.name')) - ->subject(config('app.name') . ' - Application Updated') + ->subject(config('app.name').' - Application Updated') ->line('Your most recent application has been moved up a stage.') ->line('This means our team has reviewed it and an interview will be scheduled ASAP.') ->action('Sign in', url(route('login'))) diff --git a/app/Notifications/AppointmentFinished.php b/app/Notifications/AppointmentFinished.php index c1e879a..76a54c8 100644 --- a/app/Notifications/AppointmentFinished.php +++ b/app/Notifications/AppointmentFinished.php @@ -1,5 +1,24 @@ . + */ + namespace App\Notifications; use Illuminate\Bus\Queueable; @@ -42,7 +61,7 @@ class AppointmentFinished extends Notification implements ShouldQueue { return (new MailMessage) ->from(config('notification.sender.address'), config('notification.sender.name')) - ->subject(config('app.name') . ' - Appointment completed') + ->subject(config('app.name').' - Appointment completed') ->line('Your appointment has been marked as completed!') ->line('Please allow an additional day for your application to be fully processed.') ->action('View applications', url(route('showUserApps'))) diff --git a/app/Notifications/AppointmentScheduled.php b/app/Notifications/AppointmentScheduled.php index 3ad3f60..e77cd5d 100644 --- a/app/Notifications/AppointmentScheduled.php +++ b/app/Notifications/AppointmentScheduled.php @@ -1,19 +1,36 @@ . + */ + namespace App\Notifications; +use App\Appointment; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; -use App\Appointment; - class AppointmentScheduled extends Notification implements ShouldQueue { use Queueable; - protected $appointment; /** @@ -47,10 +64,10 @@ class AppointmentScheduled extends Notification implements ShouldQueue { return (new MailMessage) ->from(config('notification.sender.address'), config('notification.sender.name')) - ->subject(config('app.name') . ' - Interview scheduled') - ->line('A voice interview has been scheduled for you @ ' . $this->appointment->appointmentDate . '.') - ->line('With the following details: ' . $this->appointment->appointmentDescription) - ->line('This meeting will take place @ ' . $this->appointment->appointmentLocation . '. You will receive an email soon with details on how to join this meeting.') + ->subject(config('app.name').' - Interview scheduled') + ->line('A voice interview has been scheduled for you @ '.$this->appointment->appointmentDate.'.') + ->line('With the following details: '.$this->appointment->appointmentDescription) + ->line('This meeting will take place @ '.$this->appointment->appointmentLocation.'. You will receive an email soon with details on how to join this meeting.') ->line('You are expected to show up at least 5 minutes before the scheduled date.') ->action('Sign in', url(route('login'))) ->line('Thank you!'); diff --git a/app/Notifications/ChangedPassword.php b/app/Notifications/ChangedPassword.php index bc4cca5..6c9bd54 100644 --- a/app/Notifications/ChangedPassword.php +++ b/app/Notifications/ChangedPassword.php @@ -1,5 +1,24 @@ . + */ + namespace App\Notifications; use Illuminate\Bus\Queueable; @@ -42,7 +61,7 @@ class ChangedPassword extends Notification implements ShouldQueue { return (new MailMessage) ->from(config('notification.sender.address'), config('notification.sender.name')) - ->subject(config('app.name') . ' - Account password changed') + ->subject(config('app.name').' - Account password changed') ->line('The password for the account registered to this email address has just been changed.') ->line('If this was not you, please contact an administrator immediately.') ->action('Sign in', url(route('login'))) diff --git a/app/Notifications/EmailChanged.php b/app/Notifications/EmailChanged.php index e946102..6003cf6 100644 --- a/app/Notifications/EmailChanged.php +++ b/app/Notifications/EmailChanged.php @@ -1,5 +1,24 @@ . + */ + namespace App\Notifications; use Illuminate\Bus\Queueable; @@ -42,7 +61,7 @@ class EmailChanged extends Notification implements ShouldQueue { return (new MailMessage) ->from(config('notification.sender.address'), config('notification.sender.name')) - ->subject(config('app.name') . ' - Email address changed') + ->subject(config('app.name').' - Email address changed') ->line('The email address for your account has just been updated, either by you or an administrator.') ->action('Sign in', url(route('login'))) ->line('Thank you!'); diff --git a/app/Notifications/NewApplicant.php b/app/Notifications/NewApplicant.php index 0fdbac9..a0aab57 100644 --- a/app/Notifications/NewApplicant.php +++ b/app/Notifications/NewApplicant.php @@ -1,26 +1,42 @@ . + */ + namespace App\Notifications; +use App\Application; +use App\Facades\Options; +use App\Traits\Cancellable; +use App\Vacancy; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; -use App\Application; -use App\Vacancy; - -use App\Traits\Cancellable; -use App\Facades\Options; class NewApplicant extends Notification implements ShouldQueue { use Queueable, Cancellable; - protected $application; - protected $vacancy; /** @@ -36,8 +52,7 @@ class NewApplicant extends Notification implements ShouldQueue public function channels() { - if (Options::getOption('enable_slack_notifications') == 1) - { + if (Options::getOption('enable_slack_notifications') == 1) { return ['slack']; } @@ -59,17 +74,15 @@ class NewApplicant extends Notification implements ShouldQueue { return (new MailMessage) ->from(config('notification.sender.address'), config('notification.sender.name')) - ->subject(config('app.name') . ' - New application') + ->subject(config('app.name').' - New application') ->line('Someone has just applied for a position. Check it out!') - ->line('You are receiving this because you\'re a staff member at ' . config('app.name') . '.') + ->line('You are receiving this because you\'re a staff member at '.config('app.name').'.') ->action('View Application', url(route('showUserApp', ['application' => $this->application->id]))) ->line('Thank you!'); } - public function toSlack($notifiable) { - $vacancyDetails = []; $vacancyDetails['name'] = $this->vacancy->vacancyName; $vacancyDetails['slots'] = $this->vacancy->vacancyCount; @@ -80,16 +93,17 @@ class NewApplicant extends Notification implements ShouldQueue return (new SlackMessage) ->success() ->content('Notice: New application coming through. Please review as soon as possible.') - ->attachment(function($attachment) use ($vacancyDetails, $url, $applicant){ + ->attachment(function ($attachment) use ($vacancyDetails, $url, $applicant) { $attachment->title('Application details') ->fields([ - 'Applied for' => $vacancyDetails['name'], - 'Avaiable positions' => $vacancyDetails['slots'], - 'Applicant' => $applicant + 'Applied for' => $vacancyDetails['name'], + 'Avaiable positions' => $vacancyDetails['slots'], + 'Applicant' => $applicant, ]) ->action('Review application', $url); }); } + /** * Get the array representation of the notification. * diff --git a/app/Notifications/NewComment.php b/app/Notifications/NewComment.php index 10c7bfc..48e55f9 100644 --- a/app/Notifications/NewComment.php +++ b/app/Notifications/NewComment.php @@ -1,21 +1,39 @@ . + */ + namespace App\Notifications; +use App\Application; +use App\Comment; +use App\Facades\Options; +use App\Traits\Cancellable; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; -use App\Comment; -use App\Application; -use App\Traits\Cancellable; -use App\Facades\Options; class NewComment extends Notification implements ShouldQueue { use Queueable, Cancellable; - protected $application; /** @@ -43,7 +61,7 @@ class NewComment extends Notification implements ShouldQueue { return (new MailMessage) ->from(config('notification.sender.address'), config('notification.sender.name')) - ->subject(config('app.name') . ' - New comment') + ->subject(config('app.name').' - New comment') ->line('Someone has just posted a new comment on an application you follow.') ->line('You\'re receiving this email because you\'ve voted/commented on this application.') ->action('Check it out', url(route('showUserApp', ['application' => $this->application->id]))) diff --git a/app/Notifications/NewContact.php b/app/Notifications/NewContact.php index 761f27c..9526327 100644 --- a/app/Notifications/NewContact.php +++ b/app/Notifications/NewContact.php @@ -1,9 +1,27 @@ . + */ + namespace App\Notifications; use Illuminate\Bus\Queueable; -use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; use Illuminate\Support\Collection; @@ -44,23 +62,22 @@ class NewContact extends Notification public function toMail($notifiable) { if ($this->message->has([ - 'message', - 'ip', - 'email' - ])) - { - return (new MailMessage) + 'message', + 'ip', + 'email', + ])) { + return (new MailMessage) ->line('We\'ve received a new contact form submission in the StaffManagement app center.') ->line('This is what they sent: ') ->line('') ->line($this->message->get('message')) ->line('') - ->line('This message was received from ' . $this->message->get('ip') . ' and submitted by ' . $this->message->get('email') . '.') + ->line('This message was received from '.$this->message->get('ip').' and submitted by '.$this->message->get('email').'.') ->action('Sign in', url(route('login'))) ->line('Thank you!'); } - throw new \InvalidArgumentException("Invalid arguments supplied to NewContact!"); + throw new \InvalidArgumentException('Invalid arguments supplied to NewContact!'); } /** diff --git a/app/Notifications/NewUser.php b/app/Notifications/NewUser.php index ec31cd6..1d0db11 100644 --- a/app/Notifications/NewUser.php +++ b/app/Notifications/NewUser.php @@ -1,17 +1,35 @@ . + */ + namespace App\Notifications; +use App\Facades\Options; +use App\Facades\UUID; +use App\Traits\Cancellable; +use App\User; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; -use Illuminate\Notifications\Notification; use Illuminate\Notifications\Messages\SlackMessage; - -use App\User; -use App\Facades\UUID; -use App\Traits\Cancellable; -use App\Facades\Options; +use Illuminate\Notifications\Notification; class NewUser extends Notification implements ShouldQueue { @@ -49,8 +67,8 @@ class NewUser extends Notification implements ShouldQueue { return (new MailMessage) ->from(config('notification.sender.address'), config('notification.sender.name')) - ->subject(config('app.name') . ' - New user') - ->line($this->user->name . ' has just registered to our site.') + ->subject(config('app.name').' - New user') + ->line($this->user->name.' has just registered to our site.') ->line('You are receiving this email because you opted to receive new user notifications.') ->action('View profile', url(route('showSingleProfile', ['user' => $this->user->id]))) ->line('Thank you!'); @@ -58,28 +76,26 @@ class NewUser extends Notification implements ShouldQueue public function toSlack($notifiable) { - $user = []; + $user = []; - $user['name'] = $this->user->name; - $user['email'] = $this->user->email; - $user['username'] = UUID::toUsername($this->user->uuid); + $user['name'] = $this->user->name; + $user['email'] = $this->user->email; + $user['username'] = UUID::toUsername($this->user->uuid); - $date = \Carbon\Carbon::parse($this->user->created_at); - $user['created_at'] = $date->englishMonth . ' ' . $date->day . ' ' . $date->year; + $date = \Carbon\Carbon::parse($this->user->created_at); + $user['created_at'] = $date->englishMonth.' '.$date->day.' '.$date->year; return (new SlackMessage) ->success() ->content('A new user has signed up!') - ->attachment(function($attachment) use ($user){ - + ->attachment(function ($attachment) use ($user) { $attachment->title('User details') ->fields([ - 'Email address' => $user['email'], - 'Name' => $user['name'], - 'Minecraft Username' => $user['username'], - 'Registration date' => $user['created_at'] + 'Email address' => $user['email'], + 'Name' => $user['name'], + 'Minecraft Username' => $user['username'], + 'Registration date' => $user['created_at'], ]); - }); } diff --git a/app/Notifications/UserBanned.php b/app/Notifications/UserBanned.php index f5d5c4e..c230580 100644 --- a/app/Notifications/UserBanned.php +++ b/app/Notifications/UserBanned.php @@ -1,15 +1,33 @@ . + */ + namespace App\Notifications; +use App\Ban; +use App\User; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; -use App\User; -use App\Ban; - class UserBanned extends Notification implements ShouldQueue { use Queueable; @@ -17,6 +35,7 @@ class UserBanned extends Notification implements ShouldQueue protected $user; protected $ban; + /** * Create a new notification instance. * @@ -50,8 +69,8 @@ class UserBanned extends Notification implements ShouldQueue return (new MailMessage) ->from(config('notification.sender.address'), config('notification.sender.name')) ->line('Hello, ') - ->line('Moderators have just banned user ' . $this->user->name . ' for ' . $this->ban->reason) - ->line('This ban will remain in effect until ' . $this->ban->bannedUntil . '.') + ->line('Moderators have just banned user '.$this->user->name.' for '.$this->ban->reason) + ->line('This ban will remain in effect until '.$this->ban->bannedUntil.'.') ->action('View profile', url(route('showSingleProfile', ['user' => $this->user->id]))) ->line('Thank you!'); } diff --git a/app/Notifications/VacancyClosed.php b/app/Notifications/VacancyClosed.php index 8ae85e4..4016273 100644 --- a/app/Notifications/VacancyClosed.php +++ b/app/Notifications/VacancyClosed.php @@ -1,17 +1,35 @@ . + */ + namespace App\Notifications; +use App\Facades\Options; +use App\Traits\Cancellable; +use App\Vacancy; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; use Illuminate\Queue\SerializesModels; -use App\Vacancy; -use App\Facades\Options; -use App\Traits\Cancellable; - class VacancyClosed extends Notification implements ShouldQueue { use Queueable, SerializesModels, Cancellable; @@ -25,7 +43,7 @@ class VacancyClosed extends Notification implements ShouldQueue */ public function __construct(Vacancy $vacancy) { - $this->vacancy = $vacancy; + $this->vacancy = $vacancy; } public function optOut($notifiable) @@ -43,8 +61,8 @@ class VacancyClosed extends Notification implements ShouldQueue { return (new MailMessage) ->from(config('notification.sender.address'), config('notification.sender.name')) - ->subject(config('app.name') . ' - Vacancy Closed') - ->line('The vacancy ' . $this->vacancy->vacancyName . ', with ' . $this->vacancy->vacancyCount . ' remaining slots, has just been closed.') + ->subject(config('app.name').' - Vacancy Closed') + ->line('The vacancy '.$this->vacancy->vacancyName.', with '.$this->vacancy->vacancyCount.' remaining slots, has just been closed.') ->line('Please be aware that this position may be deleted/reopened any time.') ->action('View positions', url(route('showPositions'))) ->line('Thank you!'); diff --git a/app/Observers/ApplicationObserver.php b/app/Observers/ApplicationObserver.php index 8821414..16b6615 100644 --- a/app/Observers/ApplicationObserver.php +++ b/app/Observers/ApplicationObserver.php @@ -1,5 +1,24 @@ . + */ + namespace App\Observers; use App\Application; @@ -34,24 +53,20 @@ class ApplicationObserver $application->response()->delete(); $votes = $application->votes; - foreach ($votes as $vote) - { - Log::debug('Referential integrity cleanup: Deleting and detaching vote ' . $vote->id); + foreach ($votes as $vote) { + Log::debug('Referential integrity cleanup: Deleting and detaching vote '.$vote->id); $vote->application()->detach($application->id); $vote->delete(); } - if (!is_null($application->appointment)) - { + if (! is_null($application->appointment)) { Log::debug('RIC: Deleting appointment!'); $application->appointment()->delete(); } - if (!$application->comments->isEmpty()) - { + if (! $application->comments->isEmpty()) { Log::debug('RIC: Deleting comments!'); - foreach($application->comments as $comment) - { + foreach ($application->comments as $comment) { $comment->delete(); } } diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index eab928b..4e62976 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -1,5 +1,24 @@ . + */ + namespace App\Observers; use App\Profile; @@ -8,7 +27,6 @@ use Illuminate\Support\Facades\Log; class UserObserver { - public function __construct() { Log::debug('User observer has been initialised and ready for use!'); @@ -27,7 +45,7 @@ class UserObserver 'profileShortBio' => 'Write a one-liner about you here!', 'profileAboutMe' => 'Tell us a bit about you.', 'socialLinks' => '{}', - 'userID' => $user->id + 'userID' => $user->id, ]); } @@ -45,27 +63,20 @@ class UserObserver public function deleting(User $user) { - if ($user->isForceDeleting()) - { + if ($user->isForceDeleting()) { $user->profile->delete(); Log::debug('Referential integrity cleanup: Deleted profile!'); $applications = $user->applications; - - if (!$applications->isEmpty()) - { + + if (! $applications->isEmpty()) { Log::debug('RIC: Now trying to delete applications and responses...'); - foreach($applications as $application) - { + foreach ($applications as $application) { // code moved to Application observer, where it gets rid of attached elements individually - Log::debug('RIC: Deleting application ' . $application->id); + Log::debug('RIC: Deleting application '.$application->id); $application->delete(); - } } - - } - else - { + } else { Log::debug('RIC: Not cleaning up soft deleted models!'); } @@ -102,7 +113,7 @@ class UserObserver public function forceDeleted(User $user) { Log::info('Model has been force deleted', [ - 'modelID' => $user->id + 'modelID' => $user->id, ]); } } diff --git a/app/Observers/VacancyObserver.php b/app/Observers/VacancyObserver.php index decf1f7..c363e15 100644 --- a/app/Observers/VacancyObserver.php +++ b/app/Observers/VacancyObserver.php @@ -1,10 +1,28 @@ . + */ + namespace App\Observers; use App\Vacancy; - class VacancyObserver { /** diff --git a/app/Options.php b/app/Options.php index e650bbc..895fe88 100644 --- a/app/Options.php +++ b/app/Options.php @@ -1,5 +1,24 @@ . + */ + namespace App; use Illuminate\Database\Eloquent\Model; @@ -8,6 +27,6 @@ class Options extends Model { public $fillable = [ 'option_name', - 'option_value' + 'option_value', ]; } diff --git a/app/Policies/ApplicationPolicy.php b/app/Policies/ApplicationPolicy.php index 07edbca..6c7c2b9 100644 --- a/app/Policies/ApplicationPolicy.php +++ b/app/Policies/ApplicationPolicy.php @@ -1,11 +1,30 @@ . + */ + namespace App\Policies; use App\Application; -use Illuminate\Auth\Access\Response; use App\User; use Illuminate\Auth\Access\HandlesAuthorization; +use Illuminate\Auth\Access\Response; class ApplicationPolicy { @@ -23,22 +42,20 @@ class ApplicationPolicy public function viewAny(User $user) { - if ($user->can('applications.view.all')) - { - return Response::allow(); - } + if ($user->can('applications.view.all')) { + return Response::allow(); + } - return Response::deny('Forbidden'); + return Response::deny('Forbidden'); } public function view(User $user, Application $application) { - if ($user->is($application->user) && $user->can('applications.view.own') || $user->can('applications.view.all')) - { - return Response::allow(); - } + if ($user->is($application->user) && $user->can('applications.view.own') || $user->can('applications.view.all')) { + return Response::allow(); + } - return Response::deny('You are not authorised to view this application'); + return Response::deny('You are not authorised to view this application'); } public function update(User $user) @@ -48,8 +65,6 @@ class ApplicationPolicy public function delete(User $user, Application $application) { - - return $user->hasRole('admin'); - + return $user->hasRole('admin'); } } diff --git a/app/Policies/AppointmentPolicy.php b/app/Policies/AppointmentPolicy.php index e541e4c..29a5b50 100644 --- a/app/Policies/AppointmentPolicy.php +++ b/app/Policies/AppointmentPolicy.php @@ -1,5 +1,24 @@ . + */ + namespace App\Policies; use App\Appointment; diff --git a/app/Policies/BanPolicy.php b/app/Policies/BanPolicy.php index 754458e..0eaa62e 100644 --- a/app/Policies/BanPolicy.php +++ b/app/Policies/BanPolicy.php @@ -1,5 +1,24 @@ . + */ + namespace App\Policies; use App\Ban; @@ -44,12 +63,13 @@ class BanPolicy */ public function create(User $user, User $targetUser) { - Log::debug("Authorization check started", [ + Log::debug('Authorization check started', [ 'requiredRoles' => 'admin', 'hasRequiredRole' => $user->hasRole('admin'), 'targetUser' => $targetUser->username, - 'isCurrentUser' => Auth::user()->is($user) + 'isCurrentUser' => Auth::user()->is($user), ]); + return $user->hasRole('admin') && $user->isNot($targetUser); } diff --git a/app/Policies/CommentPolicy.php b/app/Policies/CommentPolicy.php index 477b445..b9ce668 100644 --- a/app/Policies/CommentPolicy.php +++ b/app/Policies/CommentPolicy.php @@ -1,5 +1,24 @@ . + */ + namespace App\Policies; use App\Comment; @@ -65,8 +84,7 @@ class CommentPolicy */ public function delete(User $user, Comment $comment) { - if ($user->is($comment->user) || $user->hasRole('admin')) - { + if ($user->is($comment->user) || $user->hasRole('admin')) { return true; } diff --git a/app/Policies/FormPolicy.php b/app/Policies/FormPolicy.php index c382190..ca6e808 100644 --- a/app/Policies/FormPolicy.php +++ b/app/Policies/FormPolicy.php @@ -1,5 +1,24 @@ . + */ + namespace App\Policies; use App\Form; @@ -35,8 +54,9 @@ class FormPolicy public function viewFormbuilder(User $user) { - return $user->can('admin.hiring.formbuilder'); + return $user->can('admin.hiring.formbuilder'); } + /** * Determine whether the user can create models. * diff --git a/app/Policies/ProfilePolicy.php b/app/Policies/ProfilePolicy.php index bd3bc01..d19801f 100644 --- a/app/Policies/ProfilePolicy.php +++ b/app/Policies/ProfilePolicy.php @@ -1,5 +1,24 @@ . + */ + namespace App\Policies; use App\Profile; @@ -17,7 +36,6 @@ class ProfilePolicy */ public function __construct() { - } public function edit(User $user, Profile $profile) diff --git a/app/Policies/UserPolicy.php b/app/Policies/UserPolicy.php index b98f105..f87838a 100644 --- a/app/Policies/UserPolicy.php +++ b/app/Policies/UserPolicy.php @@ -1,5 +1,24 @@ . + */ + namespace App\Policies; use App\User; @@ -16,7 +35,6 @@ class UserPolicy */ public function __construct() { - } public function edit(User $authUser, User $user) @@ -27,7 +45,7 @@ class UserPolicy // This refers to the admin tools that let staff update more information than users themselves can public function adminEdit(User $authUser, User $user) { - return $authUser->hasRole('admin') && $authUser->isNot($user); + return $authUser->hasRole('admin') && $authUser->isNot($user); } public function viewStaff(User $user) @@ -42,11 +60,11 @@ class UserPolicy public function terminate(User $authUser) { - return $authUser->hasRole('admin'); + return $authUser->hasRole('admin'); } public function delete(User $authUser, User $subject) { - return $authUser->hasRole('admin') && $authUser->isNot($subject); + return $authUser->hasRole('admin') && $authUser->isNot($subject); } } diff --git a/app/Policies/VacancyPolicy.php b/app/Policies/VacancyPolicy.php index 7e547f2..3ff57ad 100644 --- a/app/Policies/VacancyPolicy.php +++ b/app/Policies/VacancyPolicy.php @@ -1,5 +1,24 @@ . + */ + namespace App\Policies; use App\User; @@ -10,6 +29,7 @@ class VacancyPolicy { use HandlesAuthorization; // TODO: Switch to permissions (there are no specific permissions yet) + /** * Determine whether the user can view any models. * diff --git a/app/Policies/VotePolicy.php b/app/Policies/VotePolicy.php index 9337aa4..570e145 100644 --- a/app/Policies/VotePolicy.php +++ b/app/Policies/VotePolicy.php @@ -1,5 +1,24 @@ . + */ + namespace App\Policies; use App\User; diff --git a/app/Profile.php b/app/Profile.php index 9a64243..0367189 100644 --- a/app/Profile.php +++ b/app/Profile.php @@ -1,19 +1,37 @@ . + */ + namespace App; use Illuminate\Database\Eloquent\Model; class Profile extends Model { - public $fillable = [ 'profileShortBio', 'profileAboutMe', 'avatarPreference', 'socialLinks', - 'userID' + 'userID', ]; @@ -21,5 +39,4 @@ class Profile extends Model { return $this->belongsTo('App\User', 'userID', 'id'); } - } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 7126ad0..94aa882 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -1,16 +1,33 @@ . + */ + namespace App\Providers; use App\Application; use App\Observers\ApplicationObserver; use App\Observers\UserObserver; use App\User; - use Illuminate\Pagination\Paginator; use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; - use Sentry; class AppServiceProvider extends ServiceProvider @@ -33,11 +50,11 @@ class AppServiceProvider extends ServiceProvider public function boot() { Sentry\init([ - 'release' => env('RELEASE') + 'release' => env('RELEASE'), ]); Schema::defaultStringLength(191); - + // Keep using Bootstrap; Laravel 8 has the paginator use Tailwind. Quite opinionated tbh Paginator::useBootstrap(); diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 52563b4..ee9ecfd 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -1,27 +1,42 @@ . + */ + namespace App\Providers; -use App\Policies\ProfilePolicy; -use App\Policies\VacancyPolicy; -use App\Policies\UserPolicy; -use App\Policies\BanPolicy; -use App\Policies\FormPolicy; -use App\Policies\VotePolicy; -use App\Policies\ApplicationPolicy; -use App\Policies\AppointmentPolicy; - -use App\User; -use App\Form; -use App\Vote; -use App\Vacancy; use App\Application; use App\Appointment; use App\Ban; - - +use App\Form; +use App\Policies\ApplicationPolicy; +use App\Policies\AppointmentPolicy; +use App\Policies\BanPolicy; +use App\Policies\FormPolicy; +use App\Policies\ProfilePolicy; +use App\Policies\UserPolicy; +use App\Policies\VacancyPolicy; +use App\Policies\VotePolicy; +use App\User; +use App\Vacancy; +use App\Vote; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; -use Illuminate\Support\Facades\Gate; class AuthServiceProvider extends ServiceProvider { @@ -40,7 +55,7 @@ class AuthServiceProvider extends ServiceProvider 'App\Form' => 'App\Policies\FormPolicy', Vote::class => VotePolicy::class, Ban::class => BanPolicy::class, - Appointment::class => AppointmentPolicy::class + Appointment::class => AppointmentPolicy::class, ]; /** diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 395c518..f3d62bd 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -1,5 +1,24 @@ . + */ + namespace App\Providers; use Illuminate\Support\Facades\Broadcast; diff --git a/app/Providers/ContextAwareValidatorProvider.php b/app/Providers/ContextAwareValidatorProvider.php index 749de88..bc4f309 100644 --- a/app/Providers/ContextAwareValidatorProvider.php +++ b/app/Providers/ContextAwareValidatorProvider.php @@ -1,10 +1,28 @@ . + */ + namespace App\Providers; -use Illuminate\Support\ServiceProvider; - use App; +use Illuminate\Support\ServiceProvider; class ContextAwareValidatorProvider extends ServiceProvider { @@ -25,10 +43,8 @@ class ContextAwareValidatorProvider extends ServiceProvider */ public function boot() { - App::bind('contextAwareValidator', function(){ - - return new App\Helpers\ContextAwareValidator(); - - }); + App::bind('contextAwareValidator', function () { + return new App\Helpers\ContextAwareValidator(); + }); } } diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 6ea787f..11b6295 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -1,5 +1,24 @@ . + */ + namespace App\Providers; use App\Listeners\LogAuthenticationFailure; @@ -22,23 +41,23 @@ class EventServiceProvider extends ServiceProvider protected $listen = [ Registered::class => [ SendEmailVerificationNotification::class, - OnUserRegistration::class + OnUserRegistration::class, ], Failed::class => [ - LogAuthenticationFailure::class + LogAuthenticationFailure::class, ], Login::class => [ - LogAuthenticationSuccess::class + LogAuthenticationSuccess::class, ], 'App\Events\ApplicationApprovedEvent' => [ - 'App\Listeners\PromoteUser' + 'App\Listeners\PromoteUser', ], 'App\Events\ApplicationDeniedEvent' => [ - 'App\Listeners\DenyUser' + 'App\Listeners\DenyUser', ], 'App\Events\UserBannedEvent' => [ - 'App\Listeners\OnUserBanned' - ] + 'App\Listeners\OnUserBanned', + ], ]; /** @@ -48,7 +67,6 @@ class EventServiceProvider extends ServiceProvider */ public function boot() { - parent::boot(); // diff --git a/app/Providers/IPInfoProvider.php b/app/Providers/IPInfoProvider.php index 3b7150a..5ebe6f8 100644 --- a/app/Providers/IPInfoProvider.php +++ b/app/Providers/IPInfoProvider.php @@ -1,9 +1,28 @@ . + */ + namespace App\Providers; -use Illuminate\Support\ServiceProvider; use App; +use Illuminate\Support\ServiceProvider; class IPInfoProvider extends ServiceProvider { @@ -24,10 +43,8 @@ class IPInfoProvider extends ServiceProvider */ public function boot() { - App::bind('ipInformationFacade', function(){ - + App::bind('ipInformationFacade', function () { return new App\CustomFacades\IP(); - }); } } diff --git a/app/Providers/MojangStatusProvider.php b/app/Providers/MojangStatusProvider.php index 3fe4dc1..84bb47d 100644 --- a/app/Providers/MojangStatusProvider.php +++ b/app/Providers/MojangStatusProvider.php @@ -1,13 +1,32 @@ . + */ + namespace App\Providers; use GuzzleHttp\Exception\ConnectException; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; -use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\View; +use Illuminate\Support\ServiceProvider; class MojangStatusProvider extends ServiceProvider { @@ -29,19 +48,15 @@ class MojangStatusProvider extends ServiceProvider public function boot() { // TODO: (IMPORTANT) Switch this to Middleware - if (!Cache::has('mojang_status')) - { - Log::info("Mojang Status Provider: Mojang Status not found in the cache; Sending new request."); + if (! Cache::has('mojang_status')) { + Log::info('Mojang Status Provider: Mojang Status not found in the cache; Sending new request.'); - try - { + try { $mcstatus = Http::get(config('general.urls.mojang.statuscheck')); Cache::put('mojang_status', base64_encode($mcstatus->body()), now()->addDays(3)); - } - catch(ConnectException $connectException) - { + } catch (ConnectException $connectException) { Log::critical('Could not connect to Mojang servers: Cannot check/refresh status', [ - 'message' => $connectException->getMessage() + 'message' => $connectException->getMessage(), ]); } } diff --git a/app/Providers/OptionsProvider.php b/app/Providers/OptionsProvider.php index 3bc98db..7c70e8e 100644 --- a/app/Providers/OptionsProvider.php +++ b/app/Providers/OptionsProvider.php @@ -1,9 +1,28 @@ . + */ + namespace App\Providers; -use Illuminate\Support\ServiceProvider; use App; +use Illuminate\Support\ServiceProvider; class OptionsProvider extends ServiceProvider { @@ -24,7 +43,7 @@ class OptionsProvider extends ServiceProvider */ public function boot() { - App::bind('smOptions', function (){ + App::bind('smOptions', function () { return new App\Helpers\Options(); }); } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index ecf88b6..1c5f6b7 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -1,5 +1,24 @@ . + */ + namespace App\Providers; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; @@ -7,7 +26,6 @@ use Illuminate\Support\Facades\Route; class RouteServiceProvider extends ServiceProvider { - /** * The path to the "home" route for your application. * diff --git a/app/Providers/UUIDConversionProvider.php b/app/Providers/UUIDConversionProvider.php index 6ce7fad..7f26d6b 100644 --- a/app/Providers/UUIDConversionProvider.php +++ b/app/Providers/UUIDConversionProvider.php @@ -1,9 +1,28 @@ . + */ + namespace App\Providers; -use Illuminate\Support\ServiceProvider; use App; +use Illuminate\Support\ServiceProvider; class UUIDConversionProvider extends ServiceProvider { @@ -24,10 +43,8 @@ class UUIDConversionProvider extends ServiceProvider */ public function boot() { - App::bind('uuidConversionFacade', function(){ - + App::bind('uuidConversionFacade', function () { return new App\UUID\UUID(); - }); } } diff --git a/app/Response.php b/app/Response.php index 08312ea..dfa96d0 100644 --- a/app/Response.php +++ b/app/Response.php @@ -1,5 +1,24 @@ . + */ + namespace App; use Illuminate\Database\Eloquent\Model; @@ -9,10 +28,9 @@ class Response extends Model public $fillable = [ 'responseFormID', 'associatedVacancyID', - 'responseData' + 'responseData', ]; - public function form() { return $this->hasOne('App\Form', 'id', 'responseFormID'); diff --git a/app/Services/VacancyApplicationService.php b/app/Services/VacancyApplicationService.php index 94ca873..c1fbddc 100644 --- a/app/Services/VacancyApplicationService.php +++ b/app/Services/VacancyApplicationService.php @@ -1,13 +1,31 @@ . + */ + namespace App\Services; -use App\Vacancy; use App\Application; +use App\Vacancy; class VacancyApplicationService { - /** * Finds all applications associated with $model. * @@ -16,20 +34,14 @@ class VacancyApplicationService */ public function findApplications(Vacancy $model) { - $applications = collect([]); - foreach(Application::all() as $application) - { - if ($application->response->vacancy->id == $model->id) - { + foreach (Application::all() as $application) { + if ($application->response->vacancy->id == $model->id) { $applications->push($application); } } return $applications; - } - - -} \ No newline at end of file +} diff --git a/app/StaffProfile.php b/app/StaffProfile.php index 8d6cfba..87d131b 100644 --- a/app/StaffProfile.php +++ b/app/StaffProfile.php @@ -1,5 +1,24 @@ . + */ + namespace App; use Illuminate\Database\Eloquent\Model; @@ -12,7 +31,7 @@ class StaffProfile extends Model 'approvalDate', 'terminationDate', 'resignationDate', - 'memberNotes' + 'memberNotes', ]; } diff --git a/app/Team.php b/app/Team.php index 1492b2e..f7fe0fd 100644 --- a/app/Team.php +++ b/app/Team.php @@ -1,8 +1,26 @@ . + */ + namespace App; -use Illuminate\Database\Eloquent\Model; use Mpociot\Teamwork\TeamworkTeam; class Team extends TeamworkTeam @@ -11,10 +29,9 @@ class Team extends TeamworkTeam 'owner_id', 'name', 'description', - 'openJoin' + 'openJoin', ]; - public function vacancies() { return $this->belongsToMany('App\Vacancy', 'team_has_vacancy'); diff --git a/app/Traits/AuthenticatesTwoFactor.php b/app/Traits/AuthenticatesTwoFactor.php index 4b6ab31..9a36d51 100644 --- a/app/Traits/AuthenticatesTwoFactor.php +++ b/app/Traits/AuthenticatesTwoFactor.php @@ -1,40 +1,54 @@ . + */ + namespace App\Traits; -use Google2FA; use App\Http\Requests\Add2FASecretRequest; +use Google2FA; use Illuminate\Support\Facades\Log; - trait AuthenticatesTwoFactor { - public function verify2FA(Add2FASecretRequest $request) { $isValid = Google2FA::verifyKey($request->user()->twofa_secret, $request->otp); - if ($isValid) - { - Google2FA::login(); + if ($isValid) { + Google2FA::login(); - Log::info('SECURITY (postauth): One-time password verification succeeded', [ - 'initiator' => $request->user()->email, - 'ip' => $request->ip() - ]); + Log::info('SECURITY (postauth): One-time password verification succeeded', [ + 'initiator' => $request->user()->email, + 'ip' => $request->ip(), + ]); - return redirect()->to($this->redirectTo); - } - else - { - Log::warning('SECURITY (preauth): One-time password verification failed', [ - 'initiator' => $request->user()->email, - 'ip' => $request->ip() - ]); + return redirect()->to($this->redirectTo); + } else { + Log::warning('SECURITY (preauth): One-time password verification failed', [ + 'initiator' => $request->user()->email, + 'ip' => $request->ip(), + ]); - $request->session()->flash('error', 'Your one time password is invalid.'); - return redirect()->back(); + $request->session()->flash('error', 'Your one time password is invalid.'); + + return redirect()->back(); } } - } diff --git a/app/Traits/Cancellable.php b/app/Traits/Cancellable.php index cbccb67..53a9e37 100644 --- a/app/Traits/Cancellable.php +++ b/app/Traits/Cancellable.php @@ -1,24 +1,37 @@ . + */ namespace App\Traits; - use App\Facades\Options; trait Cancellable { - public function chooseChannelsViaOptions() { $channels = []; - if (Options::getOption('enable_slack_notifications') == 1) - { + if (Options::getOption('enable_slack_notifications') == 1) { array_push($channels, 'slack'); - } - elseif(Options::getOption('enable_email_notifications') == 1) - { + } elseif (Options::getOption('enable_email_notifications') == 1) { array_push($channels, 'email'); } @@ -32,18 +45,15 @@ trait Cancellable public function via($notifiable) { - if ($this->optOut($notifiable)) - { + if ($this->optOut($notifiable)) { return []; } return $this->channels(); } - public function optOut($notifiable) { return false; } - } diff --git a/app/Traits/HandlesAccountTokens.php b/app/Traits/HandlesAccountTokens.php index ce6ee34..965e54a 100644 --- a/app/Traits/HandlesAccountTokens.php +++ b/app/Traits/HandlesAccountTokens.php @@ -1,13 +1,30 @@ . + */ + namespace App\Traits; use Illuminate\Support\Facades\Hash; trait HandlesAccountTokens { - - public function generateAccountTokens() { $deleteToken = bin2hex(openssl_random_pseudo_bytes(32)); @@ -16,7 +33,7 @@ trait HandlesAccountTokens $tokens = [ 'delete' => Hash::make($deleteToken), - 'cancel' => Hash::make($cancelToken) + 'cancel' => Hash::make($cancelToken), ]; @@ -26,26 +43,20 @@ trait HandlesAccountTokens return [ 'delete' => $deleteToken, - 'cancel' => $cancelToken + 'cancel' => $cancelToken, ]; - } public function verifyAccountToken(string $token, string $type): bool { $tokens = json_decode($this->account_tokens); - if ($type == 'deleteToken') - { + if ($type == 'deleteToken') { return Hash::check($token, $tokens->delete); - } - elseif ($type == 'cancelToken') - { + } elseif ($type == 'cancelToken') { return Hash::check($token, $tokens->cancel); - } + } return false; - } - - -} \ No newline at end of file + } +} diff --git a/app/Traits/ReceivesAccountTokens.php b/app/Traits/ReceivesAccountTokens.php index 798c3ff..e9848c6 100644 --- a/app/Traits/ReceivesAccountTokens.php +++ b/app/Traits/ReceivesAccountTokens.php @@ -1,18 +1,33 @@ . + */ + namespace App\Traits; -use Illuminate\Support\Facades\Log; -use Illuminate\Support\Facades\Mail; -use Illuminate\Support\Facades\Auth; - -use Illuminate\Http\Request; - - use App\Http\Requests\UserDeleteRequest; use App\Mail\UserAccountDeleteConfirmation; use App\User; - +use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Mail; trait ReceivesAccountTokens { @@ -28,10 +43,10 @@ trait ReceivesAccountTokens Auth::logout(); $request->session()->flash('success', 'Please check your email to finish deleting your account.'); + return redirect()->to('/'); } - public function processDeleteConfirmation(Request $request, $ID, $action, $token) { // We can't rely on Laravel's route model injection, because it'll ignore soft-deleted models, @@ -39,34 +54,30 @@ trait ReceivesAccountTokens $user = User::withTrashed()->findOrFail($ID); $email = $user->email; - switch($action) - { + switch ($action) { case 'confirm': - if ($user->verifyAccountToken($token, 'deleteToken')) - { + if ($user->verifyAccountToken($token, 'deleteToken')) { Log::info('SECURITY: User deleted account!', [ 'confirmDeleteToken' => $token, 'ipAddress' => $request->ip(), - 'email' => $user->email + 'email' => $user->email, ]); - - - + $user->forceDelete(); $request->session()->flash('success', 'Account permanently deleted. Thank you for using our service.'); + return redirect()->to('/'); } break; - + case 'cancel': - if ($user->verifyAccountToken($token, 'cancelToken')) - { + if ($user->verifyAccountToken($token, 'cancelToken')) { $user->restore(); $request->session()->flash('success', 'Account deletion cancelled! You may now login.'); @@ -74,11 +85,10 @@ trait ReceivesAccountTokens } break; - + default: - + abort(404, 'The page you were trying to access may not exist or may be expired.'); } - } -} \ No newline at end of file +} diff --git a/app/UUID/UUID.php b/app/UUID/UUID.php index cee10d1..2a4de20 100644 --- a/app/UUID/UUID.php +++ b/app/UUID/UUID.php @@ -1,59 +1,66 @@ . + */ namespace App\UUID; -use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; class UUID { - // Caching would not be needed here since this method won't be used in pages that loop over a collection of usernames. public function toUUID($username) { - if (is_null($username)) - { - throw new \LogicException('Argument username for ' . __METHOD__ . ' cannot be null!'); + if (is_null($username)) { + throw new \LogicException('Argument username for '.__METHOD__.' cannot be null!'); } - $response = json_decode(Http::post(trim(config('general.urls.mojang.api')) . '/profiles/minecraft', [ - $username + $response = json_decode(Http::post(trim(config('general.urls.mojang.api')).'/profiles/minecraft', [ + $username, ])->body(), true); - if (isset($response[0])) - { - return $response[0]['id']; - + if (isset($response[0])) { + return $response[0]['id']; } - throw new \InvalidArgumentException("You must supply a valid, premium Minecraft account to sign up."); + throw new \InvalidArgumentException('You must supply a valid, premium Minecraft account to sign up.'); } // Note: Caching could simply be assigning the username to it's UUID, however, to make this work, we'd need to loop over all cache items, which would be slighly ineffective public function toUsername($uuid) { - - if (is_null($uuid)) - { - throw new \LogicException('Argument uuid for ' . __METHOD__ . ' cannot be null!'); + if (is_null($uuid)) { + throw new \LogicException('Argument uuid for '.__METHOD__.' cannot be null!'); } - $shortUUID = substr($uuid, 0, 8); - $username = Cache::remember('uuid_' . $shortUUID, now()->addDays(30), function() use ($shortUUID, $uuid) { + $shortUUID = substr($uuid, 0, 8); + $username = Cache::remember('uuid_'.$shortUUID, now()->addDays(30), function () use ($shortUUID, $uuid) { + $response = json_decode(Http::get(trim(config('general.urls.mojang.session')).'/session/minecraft/profile/'.$uuid)->body(), true); - $response = json_decode(Http::get(trim(config('general.urls.mojang.session')) . '/session/minecraft/profile/' . $uuid)->body(), true); + Log::debug('Caching '.$shortUUID.'for thirty days'); - Log::debug('Caching ' . $shortUUID . 'for thirty days'); return $response['name']; + }); - }); - - return $username; - + return $username; } - - } diff --git a/app/User.php b/app/User.php index cacb175..b17aa9c 100644 --- a/app/User.php +++ b/app/User.php @@ -1,5 +1,24 @@ . + */ + namespace App; use App\Traits\HandlesAccountTokens; @@ -7,7 +26,6 @@ use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; -use Illuminate\Support\Facades\Hash; use Mpociot\Teamwork\Traits\UserHasTeams; use Spatie\Permission\Traits\HasRoles; @@ -21,7 +39,7 @@ class User extends Authenticatable implements MustVerifyEmail * @var array */ protected $fillable = [ - 'name', 'email', 'password', 'originalIP', 'username', 'uuid', 'dob' + 'name', 'email', 'password', 'originalIP', 'username', 'uuid', 'dob', ]; /** @@ -42,7 +60,6 @@ class User extends Authenticatable implements MustVerifyEmail 'email_verified_at' => 'datetime', ]; - // public function applications() { @@ -69,14 +86,11 @@ class User extends Authenticatable implements MustVerifyEmail return $this->hasMany('App\Comment', 'authorID', 'id'); } - public function isBanned() { - return !$this->bans()->get()->isEmpty(); + return ! $this->bans()->get()->isEmpty(); } - - public function isStaffMember() { return $this->hasAnyRole('reviewer', 'admin', 'hiringManager'); @@ -84,12 +98,11 @@ class User extends Authenticatable implements MustVerifyEmail public function has2FA() { - return !is_null($this->twofa_secret); + return ! is_null($this->twofa_secret); } - public function routeNotificationForSlack($notification) { - return config('slack.webhook.integrationURL'); + return config('slack.webhook.integrationURL'); } } diff --git a/app/Vacancy.php b/app/Vacancy.php index e205074..0829a4e 100644 --- a/app/Vacancy.php +++ b/app/Vacancy.php @@ -1,16 +1,32 @@ . + */ + namespace App; +use GrahamCampbell\Markdown\Facades\Markdown; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Log; use Mpociot\Teamwork\Traits\UsedByTeams; - -use GrahamCampbell\Markdown\Facades\Markdown; - - class Vacancy extends Model { //use UsedByTeams; @@ -26,36 +42,30 @@ class Vacancy extends Model 'vacancyCount', 'vacancyStatus', 'vacancySlug', - 'team_id' + 'team_id', ]; - /** - * Get the HTML variant of the vacancyFullDescription attribute. - * - * @param string $value The original value - * @return string - */ + * Get the HTML variant of the vacancyFullDescription attribute. + * + * @param string $value The original value + * @return string + */ public function getVacancyFullDescriptionAttribute($value) { - if (!is_null($value)) - { - return Markdown::convertToHTML($value); - } - else - { - return null; + if (! is_null($value)) { + return Markdown::convertToHTML($value); + } else { + return null; } } - public function teams() { return $this->belongsToMany('App\Team', 'team_has_vacancy'); } - public function forms() { return $this->belongsTo('App\Form', 'vacancyFormID', 'id'); @@ -64,48 +74,42 @@ class Vacancy extends Model public function open() { $this->update([ - 'vacancyStatus' => 'OPEN' + 'vacancyStatus' => 'OPEN', ]); - Log::info("Vacancies: Vacancy " . $this->id . " (" . $this->vacancyName . ") opened by " . Auth::user()->name); + Log::info('Vacancies: Vacancy '.$this->id.' ('.$this->vacancyName.') opened by '.Auth::user()->name); } public function close() { $this->update([ - 'vacancyStatus' => 'CLOSED' + 'vacancyStatus' => 'CLOSED', ]); - Log::warning("Vacancies: Vacancy " . $this->id . " (" . $this->vacancyName . ") closed by " . Auth::user()->name); - + Log::warning('Vacancies: Vacancy '.$this->id.' ('.$this->vacancyName.') closed by '.Auth::user()->name); } - /** - * Check if the Modal is attached to the $checkingTeam Model + * Check if the Modal is attached to the $checkingTeam Model. * * @param Team $checkingTeam The mdoel you want to check against - * @return boolean Whether the models are attached + * @return bool Whether the models are attached */ public function hasTeam(Team $checkingTeam): bool { $myTeams = $this->teams; - if (empty($myTeams)) - { + if (empty($myTeams)) { // no associated teams return false; } - foreach($myTeams as $team) - { - if ($team->id === $checkingTeam->id) - { + foreach ($myTeams as $team) { + if ($team->id === $checkingTeam->id) { return true; } } return false; } - } diff --git a/app/View/Components/Alert.php b/app/View/Components/Alert.php index 04b5f3c..be497b4 100644 --- a/app/View/Components/Alert.php +++ b/app/View/Components/Alert.php @@ -1,12 +1,30 @@ . + */ + namespace App\View\Components; use Illuminate\View\Component; class Alert extends Component { - public $alertType; public $extraStyling; diff --git a/app/View/Components/Card.php b/app/View/Components/Card.php index 6a5a953..ee20d0d 100644 --- a/app/View/Components/Card.php +++ b/app/View/Components/Card.php @@ -1,5 +1,24 @@ . + */ + namespace App\View\Components; use Illuminate\View\Component; @@ -8,14 +27,10 @@ class Card extends Component { public $id; - public $cardTitle; - - public $footerStyle; - /** * Create a new component instance. * diff --git a/app/View/Components/Form.php b/app/View/Components/Form.php index 06e868d..821ea5d 100644 --- a/app/View/Components/Form.php +++ b/app/View/Components/Form.php @@ -1,16 +1,34 @@ . + */ + namespace App\View\Components; use Illuminate\View\Component; class Form extends Component { - public $formFields; - public $disableFields = false; + /** * Create a new component instance. * @@ -18,7 +36,7 @@ class Form extends Component */ public function __construct($disableFields = false) { - $this->disableFields = $disableFields; + $this->disableFields = $disableFields; } /** diff --git a/app/View/Components/GlobalErrors.php b/app/View/Components/GlobalErrors.php index ab130be..5360e13 100644 --- a/app/View/Components/GlobalErrors.php +++ b/app/View/Components/GlobalErrors.php @@ -1,5 +1,24 @@ . + */ + namespace App\View\Components; use Illuminate\View\Component; diff --git a/app/View/Components/Modal.php b/app/View/Components/Modal.php index 4ab43d3..fd23b3f 100644 --- a/app/View/Components/Modal.php +++ b/app/View/Components/Modal.php @@ -1,5 +1,24 @@ . + */ + namespace App\View\Components; use Illuminate\View\Component; @@ -8,13 +27,10 @@ class Modal extends Component { public $id; - public $modalLabel; - public $modalTitle; - public $includeCloseButton; /** diff --git a/app/View/Components/NoPermission.php b/app/View/Components/NoPermission.php index 6da51a1..f55f30a 100644 --- a/app/View/Components/NoPermission.php +++ b/app/View/Components/NoPermission.php @@ -1,5 +1,24 @@ . + */ + namespace App\View\Components; use Illuminate\View\Component; @@ -9,6 +28,7 @@ class NoPermission extends Component public $type; public $inDashboard; + /** * Create a new component instance. * @@ -16,9 +36,9 @@ class NoPermission extends Component */ public function __construct($type, $inDashboard = true) { - $this->type = $type; + $this->type = $type; - $this->inDashboard = $inDashboard; + $this->inDashboard = $inDashboard; } /** diff --git a/app/Vote.php b/app/Vote.php index 6a89b21..74a5aa0 100644 --- a/app/Vote.php +++ b/app/Vote.php @@ -1,5 +1,24 @@ . + */ + namespace App; use Illuminate\Database\Eloquent\Model; @@ -14,7 +33,7 @@ class Vote extends Model ]; public $touches = [ - 'application' + 'application', ]; public function user() diff --git a/bootstrap/app.php b/bootstrap/app.php index 037e17d..c89db0b 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,15 +1,23 @@ . + */ $app = new Illuminate\Foundation\Application( $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__) diff --git a/config/adminlte.php b/config/adminlte.php index b0555f4..b5763e3 100644 --- a/config/adminlte.php +++ b/config/adminlte.php @@ -1,5 +1,24 @@ . + */ + return [ /* @@ -50,7 +69,7 @@ return [ 'logo_img_class' => 'brand-image img-circle elevation-3', 'logo_img_xl' => null, 'logo_img_xl_class' => 'brand-image-xs', - 'logo_img_alt' => env('APP_NAME') . '\'s Temporary Logo', + 'logo_img_alt' => env('APP_NAME').'\'s Temporary Logo', /* |-------------------------------------------------------------------------- @@ -211,17 +230,17 @@ return [ [ 'text' => 'm_home', 'icon' => 'fas fa-home', - 'url' => 'dashboard' + 'url' => 'dashboard', ], [ 'text' => 'm_directory', 'icon' => 'fas fa-users', 'url' => 'users/directory', - 'can' => 'profiles.view.others' + 'can' => 'profiles.view.others', ], [ 'header' => 'h_applications', - 'can' => 'applications.view.own' + 'can' => 'applications.view.own', ], [ 'text' => 'm_my_applications', @@ -231,8 +250,8 @@ return [ [ 'text' => 'm_curr_applications', 'icon' => 'fas fa-fw fa-check-double', - 'url' => '/applications/my-applications' - ] + 'url' => '/applications/my-applications', + ], ], ], @@ -242,40 +261,40 @@ return [ [ 'text' => 'm_profile_settings', 'url' => '/profile/settings', - 'icon' => 'fas fa-fw fa-cog' + 'icon' => 'fas fa-fw fa-cog', ], [ 'text' => 'm_account_settings', 'icon' => 'fas fa-user-circle', - 'url' => '/profile/settings/account' + 'url' => '/profile/settings/account', ], [ 'header' => 'h_app_management', - 'can' => ['applications.view.all', 'applications.vote'] + 'can' => ['applications.view.all', 'applications.vote'], ], [ 'text' => 'm_all_apps', 'url' => 'applications/staff/all', 'icon' => 'fas fa-list-ol', - 'can' => 'applications.view.all' + 'can' => 'applications.view.all', ], [ 'text' => 'm_outstanding_apps', 'url' => '/applications/staff/outstanding', 'icon' => 'far fa-folder-open', - 'can' => 'applications.view.all' + 'can' => 'applications.view.all', ], [ 'text' => 'm_interview_queue', 'url' => '/applications/staff/pending-interview', 'icon' => 'fas fa-fw fa-microphone-alt', - 'can' => 'applications.view.all' + 'can' => 'applications.view.all', ], [ 'text' => 'm_peer_approval', 'url' => '/applications/staff/peer-review', 'icon' => 'fas fa-fw fa-search', - 'can' => 'applications.view.all' + 'can' => 'applications.view.all', ], [ 'header' => 'h_admin', @@ -284,26 +303,26 @@ return [ 'admin.userlist', 'admin.stafflist', 'admin.hiring.*', - 'admin.notificationsettings.*' - ] + 'admin.notificationsettings.*', + ], ], [ 'text' => 'm_staff_m', 'icon' => 'fas fa-fw fa-users', 'url' => '/hr/staff-members', - 'can' => 'admin.stafflist' + 'can' => 'admin.stafflist', ], [ // players who haven't been promoted yet 'text' => 'm_reg_players', 'icon' => 'fas fa-fw fa-user-friends', 'url' => '/hr/players', - 'can' => 'admin.userlist' + 'can' => 'admin.userlist', ], [ 'text' => 'm_teams', 'icon' => 'fas fa-user-friends', 'url' => 'teams', - 'can' => 'teams.view' + 'can' => 'teams.view', ], [ 'text' => 'sm_hiring_man', @@ -313,7 +332,7 @@ return [ [ 'text' => 'm_open_pos', 'icon' => 'fas fa-box-open', - 'url' => '/admin/positions' + 'url' => '/admin/positions', ], [ 'text' => 'sm_forms', @@ -322,16 +341,16 @@ return [ [ 'text' => 'sm_all_forms', 'icon' => 'far fa-list-alt', - 'url' => '/admin/forms' + 'url' => '/admin/forms', ], [ 'text' => 'm_form_builder', 'icon' => 'fas fa-fw fa-hammer', - 'url' => '/admin/forms/builder' - ] - ] - ] - ] + 'url' => '/admin/forms/builder', + ], + ], + ], + ], ], [ 'text' => 'sm_app_settings', @@ -342,22 +361,22 @@ return [ 'text' => 'm_global_app_s', 'icon' => 'fas fa-cogs', 'url' => '/admin/settings', - 'can' => 'admin.settings.view' + 'can' => 'admin.settings.view', ], [ 'text' => 'm_devtools', 'icon' => 'fas fa-code', 'url' => '/admin/devtools', - 'can' => 'admin.developertools.use' - ] - ] + 'can' => 'admin.developertools.use', + ], + ], ], [ 'text' => 'm_s_logs', 'url' => '/admin/maintenance/system-logs', 'icon' => 'fas fa-clipboard-list', - 'can' => 'admin.maintenance.logs.view' - ] + 'can' => 'admin.maintenance.logs.view', + ], ], /* @@ -423,9 +442,9 @@ return [ [ 'type' => 'js', 'asset' => false, - 'location' => '/js/formbuilder.js' - ] - ] + 'location' => '/js/formbuilder.js', + ], + ], ], [ 'name' => 'Select2', @@ -488,14 +507,14 @@ return [ [ 'type' => 'js', 'asset' => false, - 'location' => 'https://cdn.jsdelivr.net/npm/toastr@2.1.4/toastr.min.js' + 'location' => 'https://cdn.jsdelivr.net/npm/toastr@2.1.4/toastr.min.js', ], [ 'type' => 'css', 'asset' => false, - 'location' => 'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css' - ] - ] + 'location' => 'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css', + ], + ], ], [ 'name' => 'GlobalTooltip', @@ -504,9 +523,9 @@ return [ [ 'type' => 'js', 'asset' => false, - 'location' => '/js/globaltooltip.js' - ] - ] + 'location' => '/js/globaltooltip.js', + ], + ], ], [ 'name' => 'DatePickApp', @@ -515,25 +534,25 @@ return [ [ 'type' => 'js', 'asset' => false, - 'location' => '/js/datepick.js' - ] - ] + 'location' => '/js/datepick.js', + ], + ], ], [ - 'name' => 'Fullcalendar', - 'active' => true, - 'files' => [ - [ - 'type' => 'js', - 'asset' => false, - 'location' => 'https://cdn.jsdelivr.net/npm/fullcalendar@5.0.1/main.min.js', + 'name' => 'Fullcalendar', + 'active' => true, + 'files' => [ + [ + 'type' => 'js', + 'asset' => false, + 'location' => 'https://cdn.jsdelivr.net/npm/fullcalendar@5.0.1/main.min.js', + ], + [ + 'type' => 'css', + 'asset' => false, + 'location' => 'https://cdn.jsdelivr.net/npm/fullcalendar@5.0.1/main.min.css', + ], ], - [ - 'type' => 'css', - 'asset' => false, - 'location' => 'https://cdn.jsdelivr.net/npm/fullcalendar@5.0.1/main.min.css' - ] - ] ], [ 'name' => 'CheckboxValues', @@ -542,36 +561,36 @@ return [ [ 'type' => 'js', 'asset' => false, - 'location' => '/js/switches.js' - ] - ] + 'location' => '/js/switches.js', + ], + ], ], [ - 'name' => 'AuthCustomisations', - 'active' => true, - 'files' => [ - [ - 'type' => 'css', - 'asset' => false, - 'location' => '/css/authpages.css' - ] - ] + 'name' => 'AuthCustomisations', + 'active' => true, + 'files' => [ + [ + 'type' => 'css', + 'asset' => false, + 'location' => '/css/authpages.css', + ], ], - [ - 'name' => 'BootstrapToggleButton', - 'active' => true, - 'files' => [ - [ - 'type' => 'css', - 'asset' => false, - 'location' => 'https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css' - ], - [ - 'type' => 'js', - 'asset' => false, - 'location' => 'https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js' - ] - ] + ], + [ + 'name' => 'BootstrapToggleButton', + 'active' => true, + 'files' => [ + [ + 'type' => 'css', + 'asset' => false, + 'location' => 'https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css', + ], + [ + 'type' => 'js', + 'asset' => false, + 'location' => 'https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js', + ], + ], ], [ 'name' => 'BootstrapMultiselectDropdown', @@ -580,14 +599,14 @@ return [ [ 'type' => 'js', 'asset' => 'false', - 'location' => 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.min.js' + 'location' => 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.min.js', ], [ 'type' => 'css', 'asset' => false, - 'location' => 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css' - ] - ] - ] + 'location' => 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css', + ], + ], + ], ], ]; diff --git a/config/app.php b/config/app.php index 96e5484..188a5ba 100644 --- a/config/app.php +++ b/config/app.php @@ -1,5 +1,24 @@ . + */ + return [ /* @@ -15,7 +34,6 @@ return [ 'name' => env('APP_NAME', 'Laravel'), - /* |-------------------------------------------------------------------------- | Application Homepage @@ -193,7 +211,7 @@ return [ App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, \App\Providers\MojangStatusProvider::class, - \App\Providers\OptionsProvider::class + \App\Providers\OptionsProvider::class, ], @@ -250,7 +268,7 @@ return [ 'IP' => App\Facades\IP::class, 'Markdown' => GrahamCampbell\Markdown\Facades\Markdown::class, 'ContextAwareValidator' => App\Facades\ContextAwareValidation::class, - 'Settings' => App\Facades\Options::class + 'Settings' => App\Facades\Options::class, ], diff --git a/config/auth.php b/config/auth.php index aaf982b..071543c 100644 --- a/config/auth.php +++ b/config/auth.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/config/broadcasting.php b/config/broadcasting.php index 3bba110..2fa0dee 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/config/cache.php b/config/cache.php index 4f41fdf..475421a 100644 --- a/config/cache.php +++ b/config/cache.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Support\Str; return [ diff --git a/config/cors.php b/config/cors.php index 558369d..c06d99f 100644 --- a/config/cors.php +++ b/config/cors.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/config/database.php b/config/database.php index b42d9b3..493e1af 100644 --- a/config/database.php +++ b/config/database.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Support\Str; return [ diff --git a/config/filesystems.php b/config/filesystems.php index 94c8112..7ae4a84 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/config/general.php b/config/general.php index 7749c97..bdc5e90 100644 --- a/config/general.php +++ b/config/general.php @@ -1,27 +1,45 @@ . + */ + return [ - 'urls' => - [ + 'urls' => [ 'mojang' => [ 'statuscheck' => env('MOJANG_STATUS_URL') ?? 'https://status.mojang.com/check', 'api' => env('MOJANG_API_URL') ?? ' https://api.mojang.com', - 'session' => env('MOJANG_SESSIONAPI_URL') ?? 'https://sessionserver.mojang.com' + 'session' => env('MOJANG_SESSIONAPI_URL') ?? 'https://sessionserver.mojang.com', ], 'ipapi' => [ - 'ipcheck' => env('IPGEO_API_URL') ?? 'https://api.ipgeolocation.io/ipgeo' - ] + 'ipcheck' => env('IPGEO_API_URL') ?? 'https://api.ipgeolocation.io/ipgeo', + ], ], 'keys' => [ 'ipapi' => [ - 'apikey' => env('IPGEO_API_KEY') - ] + 'apikey' => env('IPGEO_API_KEY'), + ], - ] + ], ]; diff --git a/config/google2fa.php b/config/google2fa.php index 4dd5824..42eab82 100644 --- a/config/google2fa.php +++ b/config/google2fa.php @@ -1,5 +1,24 @@ . + */ + return [ /* @@ -59,7 +78,7 @@ return [ * One Time Password error message. */ 'error_messages' => [ - 'wrong_otp' => "Your one time code was incorrect.", + 'wrong_otp' => 'Your one time code was incorrect.', 'cannot_be_empty' => 'The one time code cannot be empty.', 'unknown' => 'An unknown error has occurred. Please try again.', ], diff --git a/config/hashing.php b/config/hashing.php index 8425770..e7a93bf 100644 --- a/config/hashing.php +++ b/config/hashing.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/config/laravellocalization.php b/config/laravellocalization.php index 37578d7..8055da2 100644 --- a/config/laravellocalization.php +++ b/config/laravellocalization.php @@ -1,5 +1,24 @@ . + */ + return [ // Uncomment the languages that your site supports - or add new ones. @@ -64,7 +83,7 @@ return [ '/app.css', '/robots.txt', '/slides/*', - '/auth/logout' + '/auth/logout', ], ]; diff --git a/config/log-viewer.php b/config/log-viewer.php index b0532ba..c733cb7 100644 --- a/config/log-viewer.php +++ b/config/log-viewer.php @@ -1,5 +1,24 @@ . + */ + use Arcanedev\LogViewer\Contracts\Utilities\Filesystem; return [ @@ -95,7 +114,7 @@ return [ 'icons' => [ /** * Font awesome >= 4.3 - * http://fontawesome.io/icons/ + * http://fontawesome.io/icons/. */ 'all' => 'fa fa-fw fa-list', // http://fontawesome.io/icon/list/ 'emergency' => 'fa fa-fw fa-bug', // http://fontawesome.io/icon/bug/ diff --git a/config/logging.php b/config/logging.php index 088c204..283cdeb 100644 --- a/config/logging.php +++ b/config/logging.php @@ -1,5 +1,24 @@ . + */ + use Monolog\Handler\NullHandler; use Monolog\Handler\StreamHandler; use Monolog\Handler\SyslogUdpHandler; diff --git a/config/mail.php b/config/mail.php index 5201bb7..bf9953d 100644 --- a/config/mail.php +++ b/config/mail.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/config/markdown.php b/config/markdown.php index 6408d6f..a206312 100644 --- a/config/markdown.php +++ b/config/markdown.php @@ -3,12 +3,22 @@ declare(strict_types=1); /* - * This file is part of Laravel Markdown. + * Copyright © 2020 Miguel Nogueira * - * (c) Graham Campbell + * This file is part of Raspberry Staff Manager. * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * Raspberry Staff Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Raspberry Staff Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Raspberry Staff Manager. If not, see . */ return [ diff --git a/config/notification.php b/config/notification.php index 8f3da66..4abedc4 100644 --- a/config/notification.php +++ b/config/notification.php @@ -1,12 +1,31 @@ . + */ + return [ - 'sender' => [ + 'sender' => [ - 'address' => 'teams@spacejewel-hosting.com', - 'name' => 'RaspberryNet Teams' + 'address' => 'teams@spacejewel-hosting.com', + 'name' => 'RaspberryNet Teams', - ] + ], ]; diff --git a/config/permission.php b/config/permission.php index d4a7764..23d28d1 100644 --- a/config/permission.php +++ b/config/permission.php @@ -1,5 +1,24 @@ . + */ + return [ 'models' => [ diff --git a/config/queue.php b/config/queue.php index 1222296..e9edb7e 100644 --- a/config/queue.php +++ b/config/queue.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/config/recaptcha.php b/config/recaptcha.php index 82e0813..3487b17 100644 --- a/config/recaptcha.php +++ b/config/recaptcha.php @@ -1,14 +1,33 @@ . + */ + return [ 'keys' => [ 'sitekey' => env('RECAPTCHA_SITE_KEY'), - 'secret' => env('RECAPTCHA_PRIVATE_KEY') + 'secret' => env('RECAPTCHA_PRIVATE_KEY'), ], 'verify' => [ - 'apiurl' => env('RECAPTCHA_VERIFY_URL') - ] + 'apiurl' => env('RECAPTCHA_VERIFY_URL'), + ], ]; diff --git a/config/sentry.php b/config/sentry.php index 4d9ef4d..f8e2b20 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -1,5 +1,24 @@ . + */ + return [ 'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')), diff --git a/config/services.php b/config/services.php index 2a1d616..cbda757 100644 --- a/config/services.php +++ b/config/services.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/config/session.php b/config/session.php index 37ae384..a5b0c90 100644 --- a/config/session.php +++ b/config/session.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Support\Str; return [ diff --git a/config/slack.php b/config/slack.php index 2651cc4..02627e7 100644 --- a/config/slack.php +++ b/config/slack.php @@ -1,12 +1,30 @@ . + */ + return [ - 'webhook' => [ + 'webhook' => [ - 'integrationURL' => env('SLACK_INTEGRATION_WEBHOOK') - - ] + 'integrationURL' => env('SLACK_INTEGRATION_WEBHOOK'), + ], ]; diff --git a/config/teamwork.php b/config/teamwork.php index 58656d1..cdc823f 100644 --- a/config/teamwork.php +++ b/config/teamwork.php @@ -1,5 +1,24 @@ . + */ + return [ /* |-------------------------------------------------------------------------- diff --git a/config/view.php b/config/view.php index 22b8a18..44a66b9 100644 --- a/config/view.php +++ b/config/view.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 741edea..451aae6 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -1,6 +1,23 @@ . + */ use App\User; use Faker\Generator as Faker; diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 4ee8c3e..2596a64 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php index 0ee0a36..7715044 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_resets_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index 9bddee3..b348447 100644 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2020_04_29_022245_create_profiles_table.php b/database/migrations/2020_04_29_022245_create_profiles_table.php index b3ac735..bc21b71 100644 --- a/database/migrations/2020_04_29_022245_create_profiles_table.php +++ b/database/migrations/2020_04_29_022245_create_profiles_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -19,7 +38,7 @@ class CreateProfilesTable extends Migration $table->text('profileAboutMe')->nullable(); $table->enum('avatarPreference', [ 'crafatar', // Mojang Profile - 'gravatar' // Email profile + 'gravatar', // Email profile ])->default('gravatar'); $table->text('socialLinks')->nullable(); $table->bigInteger('userID')->unsigned(); diff --git a/database/migrations/2020_04_29_022402_create_applications_table.php b/database/migrations/2020_04_29_022402_create_applications_table.php index 3074f8e..529e046 100644 --- a/database/migrations/2020_04_29_022402_create_applications_table.php +++ b/database/migrations/2020_04_29_022402_create_applications_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -28,7 +47,7 @@ class CreateApplicationsTable extends Migration 'STAGE_INTERVIEW', 'STAGE_INTERVIEW_SCHEDULED', 'APPROVED', - 'DENIED' + 'DENIED', ])->default('STAGE_SUBMITTED'); $table->timestamps(); diff --git a/database/migrations/2020_04_29_022421_create_votes_table.php b/database/migrations/2020_04_29_022421_create_votes_table.php index 9062e22..6164f56 100644 --- a/database/migrations/2020_04_29_022421_create_votes_table.php +++ b/database/migrations/2020_04_29_022421_create_votes_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -18,7 +37,7 @@ class CreateVotesTable extends Migration $table->bigInteger('userID')->unsigned(); $table->enum('allowedVoteType', [ 'VOTE_DENY', - 'VOTE_APPROVE' + 'VOTE_APPROVE', ]); $table->timestamps(); diff --git a/database/migrations/2020_04_29_022442_create_appointments_table.php b/database/migrations/2020_04_29_022442_create_appointments_table.php index 77cce6e..08d60f2 100644 --- a/database/migrations/2020_04_29_022442_create_appointments_table.php +++ b/database/migrations/2020_04_29_022442_create_appointments_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -23,11 +42,11 @@ class CreateAppointmentsTable extends Migration 'DISCORD', 'SKYPE', 'MEET', - 'TEAMSPEAK' + 'TEAMSPEAK', ]); $table->enum('appointmentStatus', [ - 'SCHEDULED', - 'CONCLUDED' // TODO: Review whether this status is necessary + 'SCHEDULED', + 'CONCLUDED', // TODO: Review whether this status is necessary ])->default('SCHEDULED'); $table->boolean('userAccepted')->default(false); $table->longText('meetingNotes')->nullable(); diff --git a/database/migrations/2020_04_29_022541_create_forms_table.php b/database/migrations/2020_04_29_022541_create_forms_table.php index 610a6d7..32fbc27 100644 --- a/database/migrations/2020_04_29_022541_create_forms_table.php +++ b/database/migrations/2020_04_29_022541_create_forms_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -19,7 +38,7 @@ class CreateFormsTable extends Migration $table->string('formStructure'); $table->enum('formStatus', [ 'ACTIVE', - 'SUSPENDED' + 'SUSPENDED', ]); $table->timestamps(); }); diff --git a/database/migrations/2020_04_29_022542_create_vacancies_table.php b/database/migrations/2020_04_29_022542_create_vacancies_table.php index dfa3aa0..7f17357 100644 --- a/database/migrations/2020_04_29_022542_create_vacancies_table.php +++ b/database/migrations/2020_04_29_022542_create_vacancies_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -26,7 +45,6 @@ class CreateVacanciesTable extends Migration $table->foreign('vacancyFormID') ->references('id') ->on('forms'); - }); } diff --git a/database/migrations/2020_04_29_023647_create_staff_profiles_table.php b/database/migrations/2020_04_29_023647_create_staff_profiles_table.php index 352dbca..be2ba85 100644 --- a/database/migrations/2020_04_29_023647_create_staff_profiles_table.php +++ b/database/migrations/2020_04_29_023647_create_staff_profiles_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2020_04_29_030107_create_responses_table.php b/database/migrations/2020_04_29_030107_create_responses_table.php index 35ea926..02acc46 100644 --- a/database/migrations/2020_04_29_030107_create_responses_table.php +++ b/database/migrations/2020_04_29_030107_create_responses_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -23,7 +42,6 @@ class CreateResponsesTable extends Migration $table->foreign('responseFormID') ->references('id') ->on('forms'); - }); } diff --git a/database/migrations/2020_04_29_195848_votes_has_application.php b/database/migrations/2020_04_29_195848_votes_has_application.php index 4464737..8ccf13f 100644 --- a/database/migrations/2020_04_29_195848_votes_has_application.php +++ b/database/migrations/2020_04_29_195848_votes_has_application.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -13,8 +32,7 @@ class VotesHasApplication extends Migration */ public function up() { - Schema::create('votes_has_application', function (Blueprint $table){ - + Schema::create('votes_has_application', function (Blueprint $table) { $table->id('id'); $table->bigInteger('vote_id')->unsigned(); $table->bigInteger('application_id')->unsigned(); @@ -22,7 +40,6 @@ class VotesHasApplication extends Migration $table->foreign('vote_id')->references('id')->on('votes'); $table->foreign('application_id')->references('id')->on('applications'); - }); } diff --git a/database/migrations/2020_05_02_223355_create_cache_table.php b/database/migrations/2020_05_02_223355_create_cache_table.php index 7b73e5f..f50d132 100644 --- a/database/migrations/2020_05_02_223355_create_cache_table.php +++ b/database/migrations/2020_05_02_223355_create_cache_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2020_05_07_021604_add_status_to_vacancies.php b/database/migrations/2020_05_07_021604_add_status_to_vacancies.php index 1d40c92..830bec4 100644 --- a/database/migrations/2020_05_07_021604_add_status_to_vacancies.php +++ b/database/migrations/2020_05_07_021604_add_status_to_vacancies.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -16,7 +35,7 @@ class AddStatusToVacancies extends Migration Schema::table('vacancies', function (Blueprint $table) { $table->enum('vacancyStatus', [ 'OPEN', - 'CLOSED' + 'CLOSED', ])->after('vacancyCount'); }); } diff --git a/database/migrations/2020_05_08_024654_add_slug_to_vacancy.php b/database/migrations/2020_05_08_024654_add_slug_to_vacancy.php index 5daa2c6..e14f42e 100644 --- a/database/migrations/2020_05_08_024654_add_slug_to_vacancy.php +++ b/database/migrations/2020_05_08_024654_add_slug_to_vacancy.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2020_05_08_063141_add_vacancy_i_d_to_responses.php b/database/migrations/2020_05_08_063141_add_vacancy_i_d_to_responses.php index e8b8591..f2a3ea4 100644 --- a/database/migrations/2020_05_08_063141_add_vacancy_i_d_to_responses.php +++ b/database/migrations/2020_05_08_063141_add_vacancy_i_d_to_responses.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2020_05_14_004542_change_form_structure_length.php b/database/migrations/2020_05_14_004542_change_form_structure_length.php index 9ba0006..eb699ca 100644 --- a/database/migrations/2020_05_14_004542_change_form_structure_length.php +++ b/database/migrations/2020_05_14_004542_change_form_structure_length.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -13,8 +32,8 @@ class ChangeFormStructureLength extends Migration */ public function up() { - Schema::table('forms', function (Blueprint $schema){ - $schema->longText('formStructure')->change(); + Schema::table('forms', function (Blueprint $schema) { + $schema->longText('formStructure')->change(); }); } diff --git a/database/migrations/2020_05_29_234431_create_permission_tables.php b/database/migrations/2020_05_29_234431_create_permission_tables.php index 3f9448d..e790941 100644 --- a/database/migrations/2020_05_29_234431_create_permission_tables.php +++ b/database/migrations/2020_05_29_234431_create_permission_tables.php @@ -1,8 +1,27 @@ . + */ + use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreatePermissionTables extends Migration { diff --git a/database/migrations/2020_06_08_153602_create_bans_table.php b/database/migrations/2020_06_08_153602_create_bans_table.php index 7674c17..dd18593 100644 --- a/database/migrations/2020_06_08_153602_create_bans_table.php +++ b/database/migrations/2020_06_08_153602_create_bans_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -25,7 +44,6 @@ class CreateBansTable extends Migration $table->foreign('userID') ->references('id') ->on('users'); - }); } diff --git a/database/migrations/2020_06_20_210255_create_comments_table.php b/database/migrations/2020_06_20_210255_create_comments_table.php index 501254f..fc9c1d2 100644 --- a/database/migrations/2020_06_20_210255_create_comments_table.php +++ b/database/migrations/2020_06_20_210255_create_comments_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -28,8 +47,6 @@ class CreateCommentsTable extends Migration ->references('id') ->on('applications'); }); - - } /** diff --git a/database/migrations/2020_06_25_093708_create_jobs_table.php b/database/migrations/2020_06_25_093708_create_jobs_table.php index 1be9e8a..55d71dd 100644 --- a/database/migrations/2020_06_25_093708_create_jobs_table.php +++ b/database/migrations/2020_06_25_093708_create_jobs_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2020_07_11_020743_add_detailed_description_to_vacancy.php b/database/migrations/2020_07_11_020743_add_detailed_description_to_vacancy.php index d049d3f..e443101 100644 --- a/database/migrations/2020_07_11_020743_add_detailed_description_to_vacancy.php +++ b/database/migrations/2020_07_11_020743_add_detailed_description_to_vacancy.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2020_07_17_053247_add_twofa_secret_to_users.php b/database/migrations/2020_07_17_053247_add_twofa_secret_to_users.php index b4dd0a9..5ebf83d 100644 --- a/database/migrations/2020_07_17_053247_add_twofa_secret_to_users.php +++ b/database/migrations/2020_07_17_053247_add_twofa_secret_to_users.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2020_08_30_152900_create_options_table.php b/database/migrations/2020_08_30_152900_create_options_table.php index 2c0537c..570a08f 100644 --- a/database/migrations/2020_08_30_152900_create_options_table.php +++ b/database/migrations/2020_08_30_152900_create_options_table.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2020_09_10_174112_teamwork_setup_tables.php b/database/migrations/2020_09_10_174112_teamwork_setup_tables.php index 144f40c..954ff5d 100644 --- a/database/migrations/2020_09_10_174112_teamwork_setup_tables.php +++ b/database/migrations/2020_09_10_174112_teamwork_setup_tables.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; diff --git a/database/migrations/2020_10_02_112730_add_team_details.php b/database/migrations/2020_10_02_112730_add_team_details.php index 113b316..7b82190 100644 --- a/database/migrations/2020_10_02_112730_add_team_details.php +++ b/database/migrations/2020_10_02_112730_add_team_details.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -13,12 +32,10 @@ class AddTeamDetails extends Migration */ public function up() { - Schema::table(config('teamwork.teams_table'), function(Blueprint $table){ - + Schema::table(config('teamwork.teams_table'), function (Blueprint $table) { $table->text('description')->after('name')->nullable(); - $table->enum('status', ['ACTIVE','SUSPENDED'])->after('description'); + $table->enum('status', ['ACTIVE', 'SUSPENDED'])->after('description'); $table->boolean('openJoin')->default(false)->after('status'); - }); } @@ -29,12 +46,10 @@ class AddTeamDetails extends Migration */ public function down() { - Schema::table(config('teamwork.teams_table'), function(Blueprint $table){ - + Schema::table(config('teamwork.teams_table'), function (Blueprint $table) { $table->dropColumn('description'); $table->dropColumn('status'); $table->dropColumn('openJoin'); - }); } } diff --git a/database/migrations/2020_10_04_124115_vacancy_nullable_team_id.php b/database/migrations/2020_10_04_124115_vacancy_nullable_team_id.php index 569a9f5..6fff503 100644 --- a/database/migrations/2020_10_04_124115_vacancy_nullable_team_id.php +++ b/database/migrations/2020_10_04_124115_vacancy_nullable_team_id.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -13,12 +32,10 @@ class VacancyNullableTeamId extends Migration */ public function up() { - Schema::table('vacancies', function(Blueprint $table){ - + Schema::table('vacancies', function (Blueprint $table) { $table->dropForeign('vacancies_ownerteamid_foreign'); $table->dropColumn('ownerTeamID'); $table->bigInteger('team_id')->nullable()->unsigned(); - }); } @@ -29,10 +46,8 @@ class VacancyNullableTeamId extends Migration */ public function down() { - Schema::table('vacancies', function(Blueprint $table){ - + Schema::table('vacancies', function (Blueprint $table) { $table->dropColumn('team_id'); - }); } } diff --git a/database/migrations/2020_10_04_163715_team_has_vacancy.php b/database/migrations/2020_10_04_163715_team_has_vacancy.php index f71182b..d766d23 100644 --- a/database/migrations/2020_10_04_163715_team_has_vacancy.php +++ b/database/migrations/2020_10_04_163715_team_has_vacancy.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -13,8 +32,7 @@ class TeamHasVacancy extends Migration */ public function up() { - Schema::create('team_has_vacancy', function(Blueprint $table){ - + Schema::create('team_has_vacancy', function (Blueprint $table) { $table->id(); $table->integer('team_id')->unsigned(); $table->bigInteger('vacancy_id')->unsigned(); @@ -27,7 +45,6 @@ class TeamHasVacancy extends Migration $table->foreign('vacancy_id') ->references('id') ->on('vacancies'); - }); } diff --git a/database/migrations/2020_10_07_095240_add_account_tokens_to_user.php b/database/migrations/2020_10_07_095240_add_account_tokens_to_user.php index 9cd3ffd..616742c 100644 --- a/database/migrations/2020_10_07_095240_add_account_tokens_to_user.php +++ b/database/migrations/2020_10_07_095240_add_account_tokens_to_user.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2020_10_07_100540_add_soft_deletes_to_users.php b/database/migrations/2020_10_07_100540_add_soft_deletes_to_users.php index cce9928..c54d27c 100644 --- a/database/migrations/2020_10_07_100540_add_soft_deletes_to_users.php +++ b/database/migrations/2020_10_07_100540_add_soft_deletes_to_users.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/migrations/2020_10_08_203356_add_uuid_to_failed_jobs.php b/database/migrations/2020_10_08_203356_add_uuid_to_failed_jobs.php index 264e6e3..f5e5921 100644 --- a/database/migrations/2020_10_08_203356_add_uuid_to_failed_jobs.php +++ b/database/migrations/2020_10_08_203356_add_uuid_to_failed_jobs.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 5bcd216..b267f30 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -1,4 +1,24 @@ . + */ + namespace Database\Seeders; use Illuminate\Database\Seeder; diff --git a/database/seeders/DefaultOptionsSeeder.php b/database/seeders/DefaultOptionsSeeder.php index 1940264..2cfb775 100644 --- a/database/seeders/DefaultOptionsSeeder.php +++ b/database/seeders/DefaultOptionsSeeder.php @@ -1,4 +1,24 @@ . + */ + namespace Database\Seeders; use App\Facades\Options; @@ -20,9 +40,7 @@ class DefaultOptionsSeeder extends Seeder Options::setOption('notify_applicant_approved', true, 'Notify when an applicant is approved'); // done Options::setOption('notify_vacancystatus_change', false, 'Notify when a vacancy\'s status changes'); // done - Options::setOption('enable_slack_notifications', true, 'Enable slack notifications'); Options::setOption('enable_email_notifications', true, 'Enable e-mail notifications'); - } } diff --git a/database/seeders/NewPermissions.php b/database/seeders/NewPermissions.php index e643631..e3d1ca7 100644 --- a/database/seeders/NewPermissions.php +++ b/database/seeders/NewPermissions.php @@ -1,4 +1,24 @@ . + */ + namespace Database\Seeders; use Illuminate\Database\Seeder; @@ -15,7 +35,7 @@ class NewPermissions extends Seeder public function run() { $developer = Role::create([ - 'name' => 'developer' + 'name' => 'developer', ]); $admin = Role::where('name', 'admin')->first(); @@ -26,7 +46,5 @@ class NewPermissions extends Seeder $developer->givePermissionTo('admin.developertools.use'); $admin->givePermissionTo('admin.settings.view'); $admin->givePermissionTo('admin.settings.edit'); - - } } diff --git a/database/seeders/PermissionSeeder.php b/database/seeders/PermissionSeeder.php index 32b949e..87abaf3 100644 --- a/database/seeders/PermissionSeeder.php +++ b/database/seeders/PermissionSeeder.php @@ -1,5 +1,24 @@ . + */ + namespace Database\Seeders; use Illuminate\Database\Seeder; @@ -20,24 +39,24 @@ class PermissionSeeder extends Seeder // $user = Role::create( [ - 'name' => 'user' + 'name' => 'user', ] ); $reviewer = Role::create( [ - 'name' => 'reviewer' + 'name' => 'reviewer', ] ); $hiringManager = Role::create( [ - 'name' => 'hiringManager' + 'name' => 'hiringManager', ] ); $admin = Role::create([ - 'name' => 'admin' + 'name' => 'admin', ]); // Spatie wildcard permissions (same concept of MC permissions) @@ -69,19 +88,18 @@ class PermissionSeeder extends Seeder Permission::create(['name' => 'admin.notificationsettings.*']); Permission::create(['name' => 'admin.maintenance.logs.view']); - Permission::create(['name' => 'admin.developertools.use']); $user->givePermissionTo([ 'applications.submit', 'applications.view.own', - 'profiles.view.others' + 'profiles.view.others', ]); // Able to view applications and vote on them once they reach the right stage, but not approve applications up to said stage $reviewer->givePermissionTo([ 'applications.view.all', - 'applications.vote' + 'applications.vote', ]); $hiringManager->givePermissionTo('appointments.*', 'applications.*', 'admin.hiring.*'); @@ -94,7 +112,7 @@ class PermissionSeeder extends Seeder 'admin.notificationsettings.*', 'profiles.view.others', 'profiles.edit.others', - 'admin.maintenance.logs.view' + 'admin.maintenance.logs.view', ]); } } diff --git a/database/seeders/TeamSeeder.php b/database/seeders/TeamSeeder.php index 5651ac9..f347ba2 100644 --- a/database/seeders/TeamSeeder.php +++ b/database/seeders/TeamSeeder.php @@ -1,4 +1,24 @@ . + */ + namespace Database\Seeders; use Illuminate\Database\Seeder; @@ -13,18 +33,17 @@ class TeamSeeder extends Seeder */ public function run() { - Permission::create([ - 'name' => 'teams.user.view.own' + 'name' => 'teams.user.view.own', ]); Permission::create([ - 'name' => 'teams.admin.view.all' + 'name' => 'teams.admin.view.all', ]); // Has access to the teams feature Permission::create([ - 'name' => 'teams.view' + 'name' => 'teams.view', ]); Permission::create([ diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index 307bd95..af89e15 100644 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -1,4 +1,24 @@ . + */ + namespace Database\Seeders; use App\Profile; @@ -23,7 +43,7 @@ class UserSeeder extends Seeder 'email' => 'tester1@example.com', 'username' => 'tester1', 'originalIP' => '99.18.146.235', - 'password' => Hash::make('password') + 'password' => Hash::make('password'), ], [ 'uuid' => 'ab22b5da02644953ace969fce85c0819', @@ -31,7 +51,7 @@ class UserSeeder extends Seeder 'email' => 'tester2@example.com', 'username' => 'tester2', 'originalIP' => '141.239.229.53', - 'password' => Hash::make('password') + 'password' => Hash::make('password'), ], [ 'uuid' => 'df38e6bf762944d3a600ded59a693ad1', @@ -39,7 +59,7 @@ class UserSeeder extends Seeder 'email' => 'tester3@example.com', 'username' => 'tester3', 'originalIP' => '25.63.20.97', - 'password' => Hash::make('password') + 'password' => Hash::make('password'), ], [ 'uuid' => '689e446484824f6bad5064e3df0aaa96', @@ -47,7 +67,7 @@ class UserSeeder extends Seeder 'email' => 'tester4@example.com', 'username' => 'tester4', 'originalIP' => '220.105.223.142', - 'password' => Hash::make('password') + 'password' => Hash::make('password'), ], [ 'uuid' => '172391f917bf418ab1c40ebc041ed5ba', @@ -55,7 +75,7 @@ class UserSeeder extends Seeder 'email' => 'tester5@example.com', 'username' => 'tester5', 'originalIP' => '224.66.76.60', - 'password' => Hash::make('password') + 'password' => Hash::make('password'), ], [ 'uuid' => '371f34dcce2a4457bf385ab9417a2345', @@ -63,7 +83,7 @@ class UserSeeder extends Seeder 'email' => 'tester6@example.com', 'username' => 'tester6', 'originalIP' => '97.113.131.0', - 'password' => Hash::make('password') + 'password' => Hash::make('password'), ], [ 'uuid' => '89aa5222855542bebe7a7780248ef5f9', @@ -71,7 +91,7 @@ class UserSeeder extends Seeder 'email' => 'tester7@example.com', 'username' => 'tester7', 'originalIP' => '15.160.137.222', - 'password' => Hash::make('password') + 'password' => Hash::make('password'), ], ]; @@ -84,7 +104,7 @@ class UserSeeder extends Seeder 'email' => 'user1@example.com', 'username' => 'user1', 'originalIP' => '253.25.237.78', - 'password' => Hash::make('password') + 'password' => Hash::make('password'), ], [ 'uuid' => '5f900018241e4aaba7883f2d5c5c2357', @@ -92,7 +112,7 @@ class UserSeeder extends Seeder 'email' => 'user2@example.com', 'username' => 'user2', 'originalIP' => '82.92.156.176', - 'password' => Hash::make('password') + 'password' => Hash::make('password'), ], [ 'uuid' => 'ba9780c3270745c6840eaabe1bf8aa14', @@ -100,34 +120,31 @@ class UserSeeder extends Seeder 'email' => 'user3@example.com', 'username' => 'user3', 'originalIP' => '224.123.129.17', - 'password' => Hash::make('password') - ] + 'password' => Hash::make('password'), + ], ]; - foreach ($regularUsers as $regularUser) - { + foreach ($regularUsers as $regularUser) { $user = User::create($regularUser); Profile::create([ - 'profileShortBio' => 'Random data ' . rand(0,1000), - 'profileAboutMe' => 'Random data ' . rand(0, 1000), - 'socialLinks' => "[]", // empty json set, not an array + 'profileShortBio' => 'Random data '.rand(0, 1000), + 'profileAboutMe' => 'Random data '.rand(0, 1000), + 'socialLinks' => '[]', // empty json set, not an array 'avatarPreference' => 'gravatar', - 'userID' => $user->id + 'userID' => $user->id, ]); } - foreach($staffUsers as $staffUser) - { + foreach ($staffUsers as $staffUser) { $user = User::create($staffUser); Profile::create([ - 'profileShortBio' => 'Random data ' . rand(0,1000), - 'profileAboutMe' => 'Random data ' . rand(0, 1000), - 'socialLinks' => "[]", + 'profileShortBio' => 'Random data '.rand(0, 1000), + 'profileAboutMe' => 'Random data '.rand(0, 1000), + 'socialLinks' => '[]', 'avatarPreference' => 'gravatar', - 'userID' => $user->id + 'userID' => $user->id, ]); - } User::create([ @@ -136,11 +153,10 @@ class UserSeeder extends Seeder 'email' => 'admin@example.com', 'username' => 'admin', 'originalIP' => '192.168.1.2', - 'password' => Hash::make('password') + 'password' => Hash::make('password'), ]); - foreach (User::all() as $user) - { + foreach (User::all() as $user) { $user->assignRole('reviewer', 'user'); } } diff --git a/public/index.php b/public/index.php index 751e0c9..7a1ec43 100644 --- a/public/index.php +++ b/public/index.php @@ -1,7 +1,25 @@ . + */ +define('LARAVEL_START', microtime(true)); /* |-------------------------------------------------------------------------- diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index e5506df..f7c5c88 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index 5ea6393..edcc8af 100644 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -1,24 +1,28 @@ 'translate-me' - * Also, don't translate, change, or move placeholders (:this-is-a-placeholder) starting with a colon. - * Try to keep the message as close to the original in meaning as possible. These simple rules also apply to other files you're translating, such as: - * auth.php, pagination.php, passwords.php, and validation.php. - * It is VERY important that you "escape" single quotes with a backslash if they're present in your language, like this: I\'m an escaped quote + * Copyright © 2020 Miguel Nogueira * - * Additionally, don't change anything in square or curly brackets, and don't remove pipe (|) characters. - * If you see two messages separated by pipe, then usually the left side is singular and the right side is plural, so translate accordingly. + * This file is part of Raspberry Staff Manager. * - * Thank you for translating! + * Raspberry Staff Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Raspberry Staff Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Raspberry Staff Manager. If not, see . */ return [ // ============== MENU TRANSLATIONS ====================== - 'menu' => [ 'my_apps' => 'My Applications', @@ -28,11 +32,9 @@ return [ 'all_forms' => 'All Forms', 'app_settings' => 'App Settings', 'global_app_settings' => 'Global App Settings', - 'system_logs' => 'System Logs' + 'system_logs' => 'System Logs', ], - - // ============== REUSABLE, GENERIC STRINGS =============== 'reusable' => [ @@ -79,10 +81,9 @@ return [ 'platform' => 'Platform', 'notepad' => 'Shared Notepad', // Context: The shared notepad that appears when votes are needed, 'appointment_info' => 'Appointment Information', - 'ip_info' => 'IP Address Information for' + 'ip_info' => 'IP Address Information for', ], - // ============== HOMEPAGE MESSAGES ====================== 'home' => 'Home', @@ -125,8 +126,6 @@ return [ 'contactlabel_subject' => 'Subject (ex. Site Suggestion)', 'contactlabel_send' => 'Send', - - // ======================== AUTHENTICATION MESSAGES =========================== '2fa_txt' => 'Two-Factor Authentication', @@ -151,7 +150,7 @@ return [ 'line4' => 'A minimum of 10 characters;', 'line5' => 'At least 3 uppercase characters;', 'line6' => 'At least 3 numbers;', - 'line7' => 'Any number of special characters.' + 'line7' => 'Any number of special characters.', ], 'sronly_confirmpassword' => 'Confirm Password', // hint: sronly stands for screen-reader only 'sronly_mcusername' => 'Minecraft Username (Premium)', @@ -180,7 +179,6 @@ return [ 'upcoming' => 'Your upcoming interviews', 'soon' => 'Coming soon', - //=================== ADMINISTRATION MESSAGES (for all administration pages) =============== 'adm' => 'Administration', @@ -198,7 +196,6 @@ return [ 'artisan_evaluate' => 'Artisan: Evaluate Votes Now', // Tip: Artisan is a program name, therefore not translatable 'devtools_info' => 'This panel may be also used to completely override the vote system in stalemate scenarios', - 'forms' => 'Forms', 'positions' => 'Positions', // Context: Positions as in job opening 'edit_form' => 'Edit Form', @@ -234,7 +231,7 @@ return [ 'cancel' => 'Cancel', 'close_vacancy' => 'Close Position', 'description_tooltip' => 'Add things like admission requirements, rank resposibilities and roles, and anything else you feel is necessary', - '' + '', ], @@ -252,7 +249,7 @@ return [ 'title' => 'Application Form Preview', 'looks' => 'This is how your form looks like to applicants', 'f_info' => 'You may edit it and add more fields later.', - '' + '', ], 'forms_p' => [ @@ -260,7 +257,7 @@ return [ 'available_forms' => 'Available forms', 'form_title' => 'Form title', 'empty_noforms' => 'Nothing to see here! Please add some forms first.', - 'new_form' => 'NEW FORM' + 'new_form' => 'NEW FORM', ], 'players' => [ @@ -281,7 +278,7 @@ return [ Registered players are those without a staff role in the team management application. There may be other users registered in the platform, but they won't be displayed here. ", - 'see_staff' => 'See Staff Members' + 'see_staff' => 'See Staff Members', ], @@ -305,7 +302,7 @@ return [ 'settings' => 'Settings', 'settings_header' => 'Notification Settings', 'settings_p' => 'Change which notifications are sent here.', - 'back_btn' => 'Back to Dashboard' + 'back_btn' => 'Back to Dashboard', ], @@ -331,19 +328,17 @@ return [ 'yrs_old' => 'Years old', // Context: "years old" as in: Tom is 24 years old 'line1' => 'We\'re glad you\'ve decided to apply. Generally, applications take 48 hours to be processed and reviewed. Depending on the circumstances and the volume of applications, you may receive an answer in a shorter time.', 'line2' => 'Please fill out the form below. Keep all answers concise and complete. Please keep in mind that the age requirement is at least :agerqr.', - 'line3' => 'Asking about your application will result in instant denial. Everything you need to know is here.' + 'line3' => 'Asking about your application will result in instant denial. Everything you need to know is here.', ], - 'app_timeout' => 'Your account is not permitted to submit another application. Please wait :days more days before trying to submit an application.' + 'app_timeout' => 'Your account is not permitted to submit another application. Please wait :days more days before trying to submit an application.', ], - 'application_m' => [ 'title' => 'Application Management', 'all_apps' => 'All Applications', 'modal_confirm' => 'Are you sure?', 'really_delete' => 'Really delete this?', - 'outstanding_sm' => 'Outstanding', 'outstanding_apps' => 'Outstanding Applications', 'outstanding_subm' => 'Outstanding (Submitted)', @@ -400,7 +395,7 @@ return [ 'title' => 'Voting Reminder', 'line1' => 'Applications which gain more than 50% of positive votes are automatically approved after one day.', 'line2' => 'Conversely, applications that do not reach this number are automatically denied.', - 'line3' => 'Please note that the vote system can be overridden' + 'line3' => 'Please note that the vote system can be overridden', ], @@ -521,7 +516,7 @@ return [ 'insta_user' => 'Instagram Username', 'discord_user' => 'Discord Handle', - 'update_prfl' => 'Update Profile' + 'update_prfl' => 'Update Profile', ], @@ -532,7 +527,7 @@ return [ 'app_process' => [ 'title' => 'Application Process', 'line1' => 'Please allow up to three days for your application to be processed. Your application will be reviewed by every team member, and will move up in stages.', - 'line2' => 'If an interview is scheduled, you\'ll need to open your application here and confirm the time, date, and location assigned for you.' + 'line2' => 'If an interview is scheduled, you\'ll need to open your application here and confirm the time, date, and location assigned for you.', ], 'account_standing' => 'Account Standing', @@ -551,9 +546,9 @@ return [ 'itsyou' => 'It\'s you!', 'title' => 'User Directory', - 'directory' => 'Directory' + 'directory' => 'Directory', - ] + ], ], @@ -590,7 +585,7 @@ return [ 'line1' => 'If you weren\'t present during this meeting, you can view the shared meeting notepad to help you make a decision.', 'line2' => 'You may vote on as many applications as needed; However, you can only vote once per application.', - 'line3' => 'Votes carry no weight based on rank. This system has been designed with fairness and ease of use in mind.' + 'line3' => 'Votes carry no weight based on rank. This system has been designed with fairness and ease of use in mind.', ], @@ -607,12 +602,11 @@ return [ ], - 'teams' => [ - 'm_teams_page' => 'Teams' + 'm_teams_page' => 'Teams', - ] + ], // ==================== END OF MAIN I18N FILE ====================== diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php index d481411..59d8a5d 100644 --- a/resources/lang/en/pagination.php +++ b/resources/lang/en/pagination.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php index 2345a56..8957598 100644 --- a/resources/lang/en/passwords.php +++ b/resources/lang/en/passwords.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index a65914f..b5f1b29 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/es/auth.php b/resources/lang/es/auth.php index e5506df..f7c5c88 100644 --- a/resources/lang/es/auth.php +++ b/resources/lang/es/auth.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/es/messages.php b/resources/lang/es/messages.php index 9be7687..cb43ba7 100644 --- a/resources/lang/es/messages.php +++ b/resources/lang/es/messages.php @@ -1,24 +1,28 @@ 'translate-me' - * Also, don't translate, change, or move placeholders (:this-is-a-placeholder) starting with a colon. - * Try to keep the message as close to the original in meaning as possible. These simple rules also apply to other files you're translating, such as: - * auth.php, pagination.php, passwords.php, and validation.php. - * It is VERY important that you "escape" single quotes with a backslash if they're present in your language, like this: I\'m an escaped quote + * Copyright © 2020 Miguel Nogueira * - * Additionally, don't change anything in square or curly brackets, and don't remove pipe (|) characters. - * If you see two messages separated by pipe, then usually the left side is singular and the right side is plural, so translate accordingly. + * This file is part of Raspberry Staff Manager. * - * Thank you for translating! + * Raspberry Staff Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Raspberry Staff Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Raspberry Staff Manager. If not, see . */ return [ // ============== MENU TRANSLATIONS ====================== - 'menu' => [ 'my_apps' => 'My Applications', @@ -28,11 +32,9 @@ return [ 'all_forms' => 'All Forms', 'app_settings' => 'App Settings', 'global_app_settings' => 'Global App Settings', - 'system_logs' => 'System Logs' + 'system_logs' => 'System Logs', ], - - // ============== REUSABLE, GENERIC STRINGS =============== 'reusable' => [ @@ -79,10 +81,9 @@ return [ 'platform' => 'Platform', 'notepad' => 'Shared Notepad', // Context: The shared notepad that appears when votes are needed, 'appointment_info' => 'Appointment Information', - 'ip_info' => 'IP Address Information for' + 'ip_info' => 'IP Address Information for', ], - // ============== HOMEPAGE MESSAGES ====================== 'home' => 'Home', @@ -125,8 +126,6 @@ return [ 'contactlabel_subject' => 'Subject (ex. Site Suggestion)', 'contactlabel_send' => 'Send', - - // ======================== AUTHENTICATION MESSAGES =========================== '2fa_txt' => 'Two-Factor Authentication', @@ -151,7 +150,7 @@ return [ 'line4' => 'A minimum of 10 characters;', 'line5' => 'At least 3 uppercase characters;', 'line6' => 'At least 3 numbers;', - 'line7' => 'Any number of special characters.' + 'line7' => 'Any number of special characters.', ], 'sronly_confirmpassword' => 'Confirm Password', // hint: sronly stands for screen-reader only 'sronly_mcusername' => 'Minecraft Username (Premium)', @@ -180,7 +179,6 @@ return [ 'upcoming' => 'Your upcoming interviews', 'soon' => 'Coming soon', - //=================== ADMINISTRATION MESSAGES (for all administration pages) =============== 'adm' => 'Administration', @@ -198,7 +196,6 @@ return [ 'artisan_evaluate' => 'Artisan: Evaluate Votes Now', // Tip: Artisan is a program name, therefore not translatable 'devtools_info' => 'This panel may be also used to completely override the vote system in stalemate scenarios', - 'forms' => 'Forms', 'positions' => 'Positions', // Context: Positions as in job opening 'edit_form' => 'Edit Form', @@ -234,7 +231,7 @@ return [ 'cancel' => 'Cancel', 'close_vacancy' => 'Close Position', 'description_tooltip' => 'Add things like admission requirements, rank resposibilities and roles, and anything else you feel is necessary', - '' + '', ], @@ -252,7 +249,7 @@ return [ 'title' => 'Application Form Preview', 'looks' => 'This is how your form looks like to applicants', 'f_info' => 'You may edit it and add more fields later.', - '' + '', ], 'forms_p' => [ @@ -260,7 +257,7 @@ return [ 'available_forms' => 'Available forms', 'form_title' => 'Form title', 'empty_noforms' => 'Nothing to see here! Please add some forms first.', - 'new_form' => 'NEW FORM' + 'new_form' => 'NEW FORM', ], 'players' => [ @@ -281,7 +278,7 @@ return [ Registered players are those without a staff role in the team management application. There may be other users registered in the platform, but they won't be displayed here. ", - 'see_staff' => 'See Staff Members' + 'see_staff' => 'See Staff Members', ], @@ -305,7 +302,7 @@ return [ 'settings' => 'Settings', 'settings_header' => 'Notification Settings', 'settings_p' => 'Change which notifications are sent here.', - 'back_btn' => 'Back to Dashboard' + 'back_btn' => 'Back to Dashboard', ], @@ -331,19 +328,17 @@ return [ 'yrs_old' => 'Years old', // Context: "years old" as in: Tom is 24 years old 'line1' => 'We\'re glad you\'ve decided to apply. Generally, applications take 48 hours to be processed and reviewed. Depending on the circumstances and the volume of applications, you may receive an answer in a shorter time.', 'line2' => 'Please fill out the form below. Keep all answers concise and complete. Please keep in mind that the age requirement is at least :agerqr.', - 'line3' => 'Asking about your application will result in instant denial. Everything you need to know is here.' + 'line3' => 'Asking about your application will result in instant denial. Everything you need to know is here.', ], - 'app_timeout' => 'Your account is not permitted to submit another application. Please wait :days more days before trying to submit an application.' + 'app_timeout' => 'Your account is not permitted to submit another application. Please wait :days more days before trying to submit an application.', ], - 'application_m' => [ 'title' => 'Application Management', 'all_apps' => 'All Applications', 'modal_confirm' => 'Are you sure?', 'really_delete' => 'Really delete this?', - 'outstanding_sm' => 'Outstanding', 'outstanding_apps' => 'Outstanding Applications', 'outstanding_subm' => 'Outstanding (Submitted)', @@ -400,7 +395,7 @@ return [ 'title' => 'Voting Reminder', 'line1' => 'Applications which gain more than 50% of positive votes are automatically approved after one day.', 'line2' => 'Conversely, applications that do not reach this number are automatically denied.', - 'line3' => 'Please note that the vote system can be overridden' + 'line3' => 'Please note that the vote system can be overridden', ], @@ -521,7 +516,7 @@ return [ 'insta_user' => 'Instagram Username', 'discord_user' => 'Discord Handle', - 'update_prfl' => 'Update Profile' + 'update_prfl' => 'Update Profile', ], @@ -532,7 +527,7 @@ return [ 'app_process' => [ 'title' => 'Application Process', 'line1' => 'Please allow up to three days for your application to be processed. Your application will be reviewed by every team member, and will move up in stages.', - 'line2' => 'If an interview is scheduled, you\'ll need to open your application here and confirm the time, date, and location assigned for you.' + 'line2' => 'If an interview is scheduled, you\'ll need to open your application here and confirm the time, date, and location assigned for you.', ], 'account_standing' => 'Account Standing', @@ -551,9 +546,9 @@ return [ 'itsyou' => 'It\'s you!', 'title' => 'User Directory', - 'directory' => 'Directory' + 'directory' => 'Directory', - ] + ], ], @@ -590,7 +585,7 @@ return [ 'line1' => 'If you weren\'t present during this meeting, you can view the shared meeting notepad to help you make a decision.', 'line2' => 'You may vote on as many applications as needed; However, you can only vote once per application.', - 'line3' => 'Votes carry no weight based on rank. This system has been designed with fairness and ease of use in mind.' + 'line3' => 'Votes carry no weight based on rank. This system has been designed with fairness and ease of use in mind.', ], @@ -605,7 +600,7 @@ return [ 'max_chars' => 'max characters', // Context: A number is added before max characters 'post' => 'Post', // Context: Post as in post comment - ] + ], // ==================== END OF MAIN I18N FILE ====================== diff --git a/resources/lang/es/pagination.php b/resources/lang/es/pagination.php index d481411..59d8a5d 100644 --- a/resources/lang/es/pagination.php +++ b/resources/lang/es/pagination.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/es/passwords.php b/resources/lang/es/passwords.php index 2345a56..8957598 100644 --- a/resources/lang/es/passwords.php +++ b/resources/lang/es/passwords.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/es/validation.php b/resources/lang/es/validation.php index a65914f..b5f1b29 100644 --- a/resources/lang/es/validation.php +++ b/resources/lang/es/validation.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/fr/auth.php b/resources/lang/fr/auth.php index e5506df..f7c5c88 100644 --- a/resources/lang/fr/auth.php +++ b/resources/lang/fr/auth.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/fr/messages.php b/resources/lang/fr/messages.php index 9be7687..cb43ba7 100644 --- a/resources/lang/fr/messages.php +++ b/resources/lang/fr/messages.php @@ -1,24 +1,28 @@ 'translate-me' - * Also, don't translate, change, or move placeholders (:this-is-a-placeholder) starting with a colon. - * Try to keep the message as close to the original in meaning as possible. These simple rules also apply to other files you're translating, such as: - * auth.php, pagination.php, passwords.php, and validation.php. - * It is VERY important that you "escape" single quotes with a backslash if they're present in your language, like this: I\'m an escaped quote + * Copyright © 2020 Miguel Nogueira * - * Additionally, don't change anything in square or curly brackets, and don't remove pipe (|) characters. - * If you see two messages separated by pipe, then usually the left side is singular and the right side is plural, so translate accordingly. + * This file is part of Raspberry Staff Manager. * - * Thank you for translating! + * Raspberry Staff Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Raspberry Staff Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Raspberry Staff Manager. If not, see . */ return [ // ============== MENU TRANSLATIONS ====================== - 'menu' => [ 'my_apps' => 'My Applications', @@ -28,11 +32,9 @@ return [ 'all_forms' => 'All Forms', 'app_settings' => 'App Settings', 'global_app_settings' => 'Global App Settings', - 'system_logs' => 'System Logs' + 'system_logs' => 'System Logs', ], - - // ============== REUSABLE, GENERIC STRINGS =============== 'reusable' => [ @@ -79,10 +81,9 @@ return [ 'platform' => 'Platform', 'notepad' => 'Shared Notepad', // Context: The shared notepad that appears when votes are needed, 'appointment_info' => 'Appointment Information', - 'ip_info' => 'IP Address Information for' + 'ip_info' => 'IP Address Information for', ], - // ============== HOMEPAGE MESSAGES ====================== 'home' => 'Home', @@ -125,8 +126,6 @@ return [ 'contactlabel_subject' => 'Subject (ex. Site Suggestion)', 'contactlabel_send' => 'Send', - - // ======================== AUTHENTICATION MESSAGES =========================== '2fa_txt' => 'Two-Factor Authentication', @@ -151,7 +150,7 @@ return [ 'line4' => 'A minimum of 10 characters;', 'line5' => 'At least 3 uppercase characters;', 'line6' => 'At least 3 numbers;', - 'line7' => 'Any number of special characters.' + 'line7' => 'Any number of special characters.', ], 'sronly_confirmpassword' => 'Confirm Password', // hint: sronly stands for screen-reader only 'sronly_mcusername' => 'Minecraft Username (Premium)', @@ -180,7 +179,6 @@ return [ 'upcoming' => 'Your upcoming interviews', 'soon' => 'Coming soon', - //=================== ADMINISTRATION MESSAGES (for all administration pages) =============== 'adm' => 'Administration', @@ -198,7 +196,6 @@ return [ 'artisan_evaluate' => 'Artisan: Evaluate Votes Now', // Tip: Artisan is a program name, therefore not translatable 'devtools_info' => 'This panel may be also used to completely override the vote system in stalemate scenarios', - 'forms' => 'Forms', 'positions' => 'Positions', // Context: Positions as in job opening 'edit_form' => 'Edit Form', @@ -234,7 +231,7 @@ return [ 'cancel' => 'Cancel', 'close_vacancy' => 'Close Position', 'description_tooltip' => 'Add things like admission requirements, rank resposibilities and roles, and anything else you feel is necessary', - '' + '', ], @@ -252,7 +249,7 @@ return [ 'title' => 'Application Form Preview', 'looks' => 'This is how your form looks like to applicants', 'f_info' => 'You may edit it and add more fields later.', - '' + '', ], 'forms_p' => [ @@ -260,7 +257,7 @@ return [ 'available_forms' => 'Available forms', 'form_title' => 'Form title', 'empty_noforms' => 'Nothing to see here! Please add some forms first.', - 'new_form' => 'NEW FORM' + 'new_form' => 'NEW FORM', ], 'players' => [ @@ -281,7 +278,7 @@ return [ Registered players are those without a staff role in the team management application. There may be other users registered in the platform, but they won't be displayed here. ", - 'see_staff' => 'See Staff Members' + 'see_staff' => 'See Staff Members', ], @@ -305,7 +302,7 @@ return [ 'settings' => 'Settings', 'settings_header' => 'Notification Settings', 'settings_p' => 'Change which notifications are sent here.', - 'back_btn' => 'Back to Dashboard' + 'back_btn' => 'Back to Dashboard', ], @@ -331,19 +328,17 @@ return [ 'yrs_old' => 'Years old', // Context: "years old" as in: Tom is 24 years old 'line1' => 'We\'re glad you\'ve decided to apply. Generally, applications take 48 hours to be processed and reviewed. Depending on the circumstances and the volume of applications, you may receive an answer in a shorter time.', 'line2' => 'Please fill out the form below. Keep all answers concise and complete. Please keep in mind that the age requirement is at least :agerqr.', - 'line3' => 'Asking about your application will result in instant denial. Everything you need to know is here.' + 'line3' => 'Asking about your application will result in instant denial. Everything you need to know is here.', ], - 'app_timeout' => 'Your account is not permitted to submit another application. Please wait :days more days before trying to submit an application.' + 'app_timeout' => 'Your account is not permitted to submit another application. Please wait :days more days before trying to submit an application.', ], - 'application_m' => [ 'title' => 'Application Management', 'all_apps' => 'All Applications', 'modal_confirm' => 'Are you sure?', 'really_delete' => 'Really delete this?', - 'outstanding_sm' => 'Outstanding', 'outstanding_apps' => 'Outstanding Applications', 'outstanding_subm' => 'Outstanding (Submitted)', @@ -400,7 +395,7 @@ return [ 'title' => 'Voting Reminder', 'line1' => 'Applications which gain more than 50% of positive votes are automatically approved after one day.', 'line2' => 'Conversely, applications that do not reach this number are automatically denied.', - 'line3' => 'Please note that the vote system can be overridden' + 'line3' => 'Please note that the vote system can be overridden', ], @@ -521,7 +516,7 @@ return [ 'insta_user' => 'Instagram Username', 'discord_user' => 'Discord Handle', - 'update_prfl' => 'Update Profile' + 'update_prfl' => 'Update Profile', ], @@ -532,7 +527,7 @@ return [ 'app_process' => [ 'title' => 'Application Process', 'line1' => 'Please allow up to three days for your application to be processed. Your application will be reviewed by every team member, and will move up in stages.', - 'line2' => 'If an interview is scheduled, you\'ll need to open your application here and confirm the time, date, and location assigned for you.' + 'line2' => 'If an interview is scheduled, you\'ll need to open your application here and confirm the time, date, and location assigned for you.', ], 'account_standing' => 'Account Standing', @@ -551,9 +546,9 @@ return [ 'itsyou' => 'It\'s you!', 'title' => 'User Directory', - 'directory' => 'Directory' + 'directory' => 'Directory', - ] + ], ], @@ -590,7 +585,7 @@ return [ 'line1' => 'If you weren\'t present during this meeting, you can view the shared meeting notepad to help you make a decision.', 'line2' => 'You may vote on as many applications as needed; However, you can only vote once per application.', - 'line3' => 'Votes carry no weight based on rank. This system has been designed with fairness and ease of use in mind.' + 'line3' => 'Votes carry no weight based on rank. This system has been designed with fairness and ease of use in mind.', ], @@ -605,7 +600,7 @@ return [ 'max_chars' => 'max characters', // Context: A number is added before max characters 'post' => 'Post', // Context: Post as in post comment - ] + ], // ==================== END OF MAIN I18N FILE ====================== diff --git a/resources/lang/fr/pagination.php b/resources/lang/fr/pagination.php index d481411..59d8a5d 100644 --- a/resources/lang/fr/pagination.php +++ b/resources/lang/fr/pagination.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/fr/passwords.php b/resources/lang/fr/passwords.php index 2345a56..8957598 100644 --- a/resources/lang/fr/passwords.php +++ b/resources/lang/fr/passwords.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php index a65914f..b5f1b29 100644 --- a/resources/lang/fr/validation.php +++ b/resources/lang/fr/validation.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/pt/auth.php b/resources/lang/pt/auth.php index fffd887..bb63a28 100644 --- a/resources/lang/pt/auth.php +++ b/resources/lang/pt/auth.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/pt/messages.php b/resources/lang/pt/messages.php index bc83c18..78123b1 100644 --- a/resources/lang/pt/messages.php +++ b/resources/lang/pt/messages.php @@ -1,24 +1,28 @@ 'translate-me' - * Also, don't translate, change, or move placeholders (:this-is-a-placeholder) starting with a colon. - * Try to keep the message as close to the original in meaning as possible. These simple rules also apply to other files you're translating, such as: - * auth.php, pagination.php, passwords.php, and validation.php. - * It is VERY important that you "escape" single quotes with a backslash if they're present in your language, like this: I\'m an escaped quote + * Copyright © 2020 Miguel Nogueira * - * Additionally, don't change anything in square or curly brackets, and don't remove pipe (|) characters. - * If you see two messages separated by pipe, then usually the left side is singular and the right side is plural, so translate accordingly. + * This file is part of Raspberry Staff Manager. * - * Thank you for translating! + * Raspberry Staff Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Raspberry Staff Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Raspberry Staff Manager. If not, see . */ return [ // ============== MENU TRANSLATIONS ====================== - 'menu' => [ 'my_apps' => 'As minhas Candidaturas', @@ -28,11 +32,9 @@ return [ 'all_forms' => 'Todos os Formulários', 'app_settings' => 'Configurações da App', 'global_app_settings' => 'Configurações globais do aplicativo', - 'system_logs' => 'Registos do Sistema' + 'system_logs' => 'Registos do Sistema', ], - - // ============== REUSABLE, GENERIC STRINGS =============== 'reusable' => [ @@ -79,10 +81,9 @@ return [ 'platform' => 'Plataforma', 'notepad' => 'Bloco Notas Partilhado', // Context: The shared notepad that appears when votes are needed, 'appointment_info' => 'Informação da Marcação', - 'ip_info' => 'Informação de Endereço IP para' + 'ip_info' => 'Informação de Endereço IP para', ], - // ============== HOMEPAGE MESSAGES ====================== 'home' => 'Início', @@ -125,8 +126,6 @@ return [ 'contactlabel_subject' => 'Assunto (ex. sugestão do site)', 'contactlabel_send' => 'Enviar', - - // ======================== AUTHENTICATION MESSAGES =========================== '2fa_txt' => 'Autenticação de dois Fatores', @@ -151,7 +150,7 @@ return [ 'line4' => 'Um mínimo de 10 caracteres;', 'line5' => 'Pelo menos 3 caracteres maiúsculos;', 'line6' => 'Pelo menos 3 números;', - 'line7' => 'Números e caracteres especiais.' + 'line7' => 'Números e caracteres especiais.', ], 'sronly_confirmpassword' => 'Confirmar palavra-passe', // hint: sronly stands for screen-reader only 'sronly_mcusername' => 'Utilizador do Minecraft (Premium)', @@ -180,7 +179,6 @@ return [ 'upcoming' => 'As suas próximas entrevistas', 'soon' => 'Disponível em breve', - //=================== ADMINISTRATION MESSAGES (for all administration pages) =============== 'adm' => 'Administração', @@ -198,7 +196,6 @@ return [ 'artisan_evaluate' => 'Artisan: Avaliar Votos Agora', // Tip: Artisan is a program name, therefore not translatable 'devtools_info' => 'Este painel também pode ser usado para substituir completamente o sistema de votação em cenários de impasse', - 'forms' => 'Formulários', 'positions' => 'Vagas', // Context: Positions as in job opening 'edit_form' => 'Editar Formulário', @@ -234,7 +231,7 @@ return [ 'cancel' => 'Cancelar', 'close_vacancy' => 'Fechar vaga', 'description_tooltip' => 'Adicione coisas como requisitos de admissão, responsabilidades e funções, e qualquer outra coisa que você ache necessária', - '' + '', ], @@ -252,7 +249,7 @@ return [ 'title' => 'Pré-visualização do Formulário de Candidatura', 'looks' => 'É assim que o seu formulário aparece para os candidatos', 'f_info' => 'Você pode editá-lo e adicionar mais campos posteriormente.', - '' + '', ], 'forms_p' => [ @@ -260,7 +257,7 @@ return [ 'available_forms' => 'Formulários disponíveis', 'form_title' => 'Título do Formulário', 'empty_noforms' => 'Nada para ver aqui! Por favor, crie alguns formulários primeiro.', - 'new_form' => 'NOVO FORMULÁRIO' + 'new_form' => 'NOVO FORMULÁRIO', ], 'players' => [ @@ -277,11 +274,11 @@ return [ 'banned' => 'Banido', 'active' => 'Ativo', 'no_reg' => 'Não há jogadores inscritos!', - 'no_reg_exp' => " + 'no_reg_exp' => ' Jogadores registados são aqueles que não possuem uma função administrativa no aplicativo de gestão de equipa. Pode haver outros utilizadores registados na plataforma, mas eles não serão exibidos aqui. -", - 'see_staff' => 'Ver Membros da Equipa' +', + 'see_staff' => 'Ver Membros da Equipa', ], @@ -289,11 +286,11 @@ return [ 'application_form' => 'Formulário de Candidatura', 'select_form' => 'Selecione um formulário...', - 'no_form_error' => " + 'no_form_error' => ' Não pode criar uma vaga sem qualquer formulário cujos quais as pessoas se poderiam candidatar. Crie um formulário primeiro, e depois crie uma vaga. Um único formulário pode ter várias vagas, para que possa anexar futuras vagas ao mesmo formulário, se quiser. -", +', 'new_pos' => 'NOVA VAGA', 'empty_pos_warning' => 'Nada para ver aqui! Abra algumas vagas primeiro. Isso fará os candidatos aparecerem! (esperançoso)', 'manage_forms' => 'GERIR FORMULÁRIOS DE CANDIDATURA', @@ -305,7 +302,7 @@ return [ 'settings' => 'Definições', 'settings_header' => 'Configuração das notificações', 'settings_p' => 'Altere quais notificações são enviadas aqui.', - 'back_btn' => 'Voltar ao painel' + 'back_btn' => 'Voltar ao painel', ], @@ -331,19 +328,17 @@ return [ 'yrs_old' => 'Anos de idade', // Context: "years old" as in: Tom is 24 years old 'line1' => 'Estamos felizes que você decidiu se candidatar. Geralmente, as candidaturas levam 48 horas para serem processadas e revisadas. Dependendo das circunstâncias e do volume de candidaturas, você poderá receber uma resposta em um período mais curto de tempo.', 'line2' => 'Por favor, preencha o formulário abaixo. Mantenha todas as respostas concisas e completas. Lembre-se de que o requisito de idade é de pelo menos :agerqr.', - 'line3' => 'Perguntar sobre a sua candidatura resultará em ser negado instantaneamente. Tudo o que você precisa saber está aqui.' + 'line3' => 'Perguntar sobre a sua candidatura resultará em ser negado instantaneamente. Tudo o que você precisa saber está aqui.', ], - 'app_timeout' => 'A sua conta não pode enviar outra candidatura. Por favor, espere :days mais dias antes de tentar enviar uma candidatura.' + 'app_timeout' => 'A sua conta não pode enviar outra candidatura. Por favor, espere :days mais dias antes de tentar enviar uma candidatura.', ], - 'application_m' => [ 'title' => 'Gestão de Candidaturas', 'all_apps' => 'Todas as Candidaturas', 'modal_confirm' => 'Tem a certeza?', 'really_delete' => 'Deseja realmente excluir isto?', - 'outstanding_sm' => 'Pendente', 'outstanding_apps' => 'Candidaturas Pendendes', 'outstanding_subm' => 'Pendente (Enviado)', @@ -400,7 +395,7 @@ return [ 'title' => 'Lembrete de votação', 'line1' => 'Candidaturas que obtêm mais de 50% dos votos positivos são automaticamente aprovadas após um dia.', 'line2' => 'Inversamente, candidaturas que não atingem esse número são automaticamente negadas.', - 'line3' => 'Por favor, lembre-se que o sistema de votação pode ser substituído' + 'line3' => 'Por favor, lembre-se que o sistema de votação pode ser substituído', ], @@ -521,7 +516,7 @@ return [ 'insta_user' => 'Nome de Utilizador do Instagram', 'discord_user' => '"Handle" do Discord', - 'update_prfl' => 'Atualizar Perfil' + 'update_prfl' => 'Atualizar Perfil', ], @@ -532,7 +527,7 @@ return [ 'app_process' => [ 'title' => 'Processo de Candidatura', 'line1' => 'Por favor, aguarde pelo menos três dias para que sua candidatura seja processada. A inscrição será revisada por todos os membros da equipa, e será promovida em fases.', - 'line2' => 'Se uma entrevista estiver programada, você precisará abrir o aplicativo aqui e confirmar a hora, data e local atribuídos para você.' + 'line2' => 'Se uma entrevista estiver programada, você precisará abrir o aplicativo aqui e confirmar a hora, data e local atribuídos para você.', ], 'account_standing' => 'Estado da Conta', @@ -551,9 +546,9 @@ return [ 'itsyou' => 'É você!', 'title' => 'Diretório de Utilizadores', - 'directory' => 'Diretório' + 'directory' => 'Diretório', - ] + ], ], @@ -590,7 +585,7 @@ return [ 'line1' => 'Se você não estava presente durante esta reunião, pode visualizar o bloco de notas da reunião partilhado para ajudá-lo a tomar uma decisão.', 'line2' => 'Você pode votar em quantas candidaturas forem necessárias; no entanto, só pode votar uma vez por candidatura.', - 'line3' => 'Os votos não têm peso baseado no cargo. Esse sistema foi projetado com justiça e facilidade de uso em mente.' + 'line3' => 'Os votos não têm peso baseado no cargo. Esse sistema foi projetado com justiça e facilidade de uso em mente.', ], @@ -605,7 +600,7 @@ return [ 'max_chars' => 'caracteres no máximo', // Context: A number is added before max characters 'post' => 'Publicar', // Context: Post as in post comment - ] + ], // ==================== END OF MAIN I18N FILE ====================== diff --git a/resources/lang/pt/pagination.php b/resources/lang/pt/pagination.php index afe7439..bed9cc9 100644 --- a/resources/lang/pt/pagination.php +++ b/resources/lang/pt/pagination.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/resources/lang/pt/passwords.php b/resources/lang/pt/passwords.php index 178ca4f..0f19f79 100644 --- a/resources/lang/pt/passwords.php +++ b/resources/lang/pt/passwords.php @@ -1,5 +1,24 @@ . + */ + return [ /* @@ -17,6 +36,6 @@ return [ 'sent' => 'Enviamos um e-mail com um link para redefinir a sua password!', 'throttled' => 'Por favor, aguarde antes de tentar novamente.', 'token' => 'Token para recuperação de senha inválido.', - 'user' => "Não foi possível encontrar um utilizador com este e-mail.", + 'user' => 'Não foi possível encontrar um utilizador com este e-mail.', ]; diff --git a/resources/lang/pt/validation.php b/resources/lang/pt/validation.php index c167208..6e69bb1 100644 --- a/resources/lang/pt/validation.php +++ b/resources/lang/pt/validation.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/routes/api.php b/routes/api.php index bcb8b18..b473196 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; diff --git a/routes/channels.php b/routes/channels.php index 963b0d2..a5399ff 100644 --- a/routes/channels.php +++ b/routes/channels.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Support\Facades\Broadcast; /* diff --git a/routes/console.php b/routes/console.php index da55196..8a11008 100644 --- a/routes/console.php +++ b/routes/console.php @@ -1,5 +1,24 @@ . + */ + use Illuminate\Foundation\Inspiring; use Illuminate\Support\Facades\Artisan; diff --git a/routes/web.php b/routes/web.php index 4467c7f..95588fc 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,24 @@ . + */ + use App\Http\Controllers\ApplicationController; use App\Http\Controllers\AppointmentController; use App\Http\Controllers\Auth\TwofaController; @@ -16,7 +35,6 @@ use App\Http\Controllers\UserController; use App\Http\Controllers\VacancyController; use App\Http\Controllers\VoteController; use Illuminate\Support\Facades\Route; - use Mcamara\LaravelLocalization\Facades\LaravelLocalization; /* @@ -29,15 +47,12 @@ use Mcamara\LaravelLocalization\Facades\LaravelLocalization; | contains the "web" middleware group. Now create something great! | */ -Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'localeSessionRedirect', 'localizationRedirect', 'localeViewPath' ]], function (){ - - Route::group(['prefix' => 'auth', 'middleware' => ['usernameUUID']], function (){ - +Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'localeViewPath']], function () { + Route::group(['prefix' => 'auth', 'middleware' => ['usernameUUID']], function () { Auth::routes(['verify' => true]); Route::post('/twofa/authenticate', [TwofaController::class, 'verify2FA']) ->name('verify2FA'); - }); Route::get('/', [HomeController::class, 'index']) @@ -49,9 +64,7 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'l Route::get('/accounts/danger-zone/{ID}/{action}/{token}', [UserController::class, 'processDeleteConfirmation']) ->name('processDeleteConfirmation'); - - Route::group(['middleware' => ['auth', 'forcelogout', '2fa', 'verified']], function(){ - + Route::group(['middleware' => ['auth', 'forcelogout', '2fa', 'verified']], function () { Route::get('/dashboard', [DashboardController::class, 'index']) ->name('dashboard') ->middleware('eligibility'); @@ -59,11 +72,8 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'l Route::get('users/directory', [ProfileController::class, 'index']) ->name('directory'); - - Route::resource('teams', TeamController::class); - Route::post('teams/{team}/invites/send', [TeamController::class, 'invite']) ->name('sendInvite'); @@ -73,14 +83,10 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'l Route::patch('teams/{team}/vacancies/update', [TeamController::class, 'assignVacancies']) ->name('assignVacancies'); - Route::get('teams/invites/{action}/{token}', [TeamController::class, 'processInviteAction']) ->name('processInvite'); - - - Route::group(['prefix' => '/applications'], function (){ - + Route::group(['prefix' => '/applications'], function () { Route::get('/my-applications', [ApplicationController::class, 'showUserApps']) ->name('showUserApps') ->middleware('eligibility'); @@ -94,63 +100,48 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'l Route::delete('/comments/{comment}/delete', [CommentController::class, 'delete']) ->name('deleteApplicationComment'); - Route::patch('/notes/save/{application}', [AppointmentController::class, 'saveNotes']) ->name('saveNotes'); - Route::patch('/update/{application}/{newStatus}', [ApplicationController::class, 'updateApplicationStatus']) ->name('updateApplicationStatus'); Route::delete('{application}/delete', [ApplicationController::class, 'delete']) ->name('deleteApplication'); - Route::get('/staff/all', [ApplicationController::class, 'showAllApps']) ->name('allApplications'); - Route::get('/staff/outstanding', [ApplicationController::class, 'showAllPendingApps']) ->name('staffPendingApps'); - Route::get('/staff/peer-review', [ApplicationController::class, 'showPeerReview']) ->name('peerReview'); - Route::get('/staff/pending-interview', [ApplicationController::class, 'showPendingInterview']) ->name('pendingInterview'); - - Route::post('{application}/staff/vote', [VoteController::class, 'vote']) ->name('voteApplication'); - - }); - Route::group(['prefix' => 'appointments'], function (){ - + Route::group(['prefix' => 'appointments'], function () { Route::post('schedule/appointments/{application}', [AppointmentController::class, 'saveAppointment']) ->name('scheduleAppointment'); Route::patch('update/appointments/{application}/{status}', [AppointmentController::class, 'updateAppointment']) ->name('updateAppointment'); - }); - Route::group(['prefix' => 'apply', 'middleware' => ['eligibility']], function (){ - + Route::group(['prefix' => 'apply', 'middleware' => ['eligibility']], function () { Route::get('positions/{vacancySlug}', [ApplicationController::class, 'renderApplicationForm']) ->name('renderApplicationForm'); Route::post('positions/{vacancySlug}/submit', [ApplicationController::class, 'saveApplicationAnswers']) ->name('saveApplicationForm'); - }); - Route::group(['prefix' => '/profile'], function (){ - + Route::group(['prefix' => '/profile'], function () { Route::get('/settings', [ProfileController::class, 'showProfile']) ->name('showProfileSettings'); @@ -160,11 +151,9 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'l Route::get('user/{user}', [ProfileController::class, 'showSingleProfile']) ->name('showSingleProfile'); - Route::get('/settings/account', [UserController::class, 'showAccount']) ->name('showAccountSettings'); - Route::patch('/settings/account/change-password', [UserController::class, 'changePassword']) ->name('changePassword'); @@ -182,12 +171,9 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'l Route::patch('/settings/account/dg/delete', [UserController::class, 'userDelete']) ->name('userDelete'); - }); - - Route::group(['prefix' => '/hr'], function (){ - + Route::group(['prefix' => '/hr'], function () { Route::get('staff-members', [UserController::class, 'showStaffMembers']) ->name('staffMemberList'); @@ -199,11 +185,9 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'l Route::patch('staff-members/terminate/{user}', [UserController::class, 'terminate']) ->name('terminateStaffMember'); - }); - Route::group(['prefix' => 'admin'], function (){ - + Route::group(['prefix' => 'admin'], function () { Route::get('settings', [OptionsController::class, 'index']) ->name('showSettings'); @@ -216,34 +200,27 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'l Route::delete('players/unban/{user}', [BanController::class, 'delete']) ->name('unbanUser'); - - Route::delete('players/delete/{user}', [UserController::class, 'delete']) ->name('deleteUser'); Route::patch('players/update/{user}', [UserController::class, 'update']) ->name('updateUser'); - - Route::get('positions', [VacancyController::class, 'index']) ->name('showPositions'); Route::post('positions/save', [VacancyController::class, 'store']) ->name('savePosition'); - Route::get('positions/edit/{vacancy}', [VacancyController::class, 'edit']) ->name('editPosition'); Route::patch('positions/update/{vacancy}', [VacancyController::class, 'update']) ->name('updatePosition'); - Route::patch('positions/availability/{status}/{vacancy}', [VacancyController::class, 'updatePositionAvailability']) ->name('updatePositionAvailability'); - Route::get('forms/builder', [FormController::class, 'showFormBuilder']) ->name('showFormBuilder'); @@ -265,17 +242,12 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'l Route::patch('forms/update/{form}', [FormController::class, 'update']) ->name('updateForm'); - Route::get('devtools', [DevToolsController::class, 'index']) ->name('devTools'); // we could use route model binding Route::post('devtools/vote-evaluation/force', [DevToolsController::class, 'forceVoteCount']) ->name('devToolsForceVoteCount'); - }); - }); }); - - diff --git a/server.php b/server.php index 5fb6379..8fef71b 100644 --- a/server.php +++ b/server.php @@ -1,10 +1,22 @@ + * This file is part of Raspberry Staff Manager. + * + * Raspberry Staff Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Raspberry Staff Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Raspberry Staff Manager. If not, see . */ $uri = urldecode( diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index 547152f..0320f1f 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -1,5 +1,24 @@ . + */ + namespace Tests; use Illuminate\Contracts\Console\Kernel; diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php index cdb5111..0ad542e 100644 --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -1,8 +1,26 @@ . + */ + namespace Tests\Feature; -use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; class ExampleTest extends TestCase diff --git a/tests/Feature/OptionsTest.php b/tests/Feature/OptionsTest.php index 08a68f5..d06358e 100644 --- a/tests/Feature/OptionsTest.php +++ b/tests/Feature/OptionsTest.php @@ -1,9 +1,26 @@ . + */ + namespace Tests\Feature; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Illuminate\Foundation\Testing\WithFaker; use Tests\TestCase; class OptionsTest extends TestCase diff --git a/tests/TestCase.php b/tests/TestCase.php index 2932d4a..3997b9e 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,5 +1,24 @@ . + */ + namespace Tests; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php index 358cfc8..2d151d7 100644 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/ExampleTest.php @@ -1,5 +1,24 @@ . + */ + namespace Tests\Unit; use PHPUnit\Framework\TestCase;