diff --git a/app/Console/Commands/CreateUser.php b/app/Console/Commands/CreateUser.php index 4cbd007..eb98a8d 100755 --- a/app/Console/Commands/CreateUser.php +++ b/app/Console/Commands/CreateUser.php @@ -1,5 +1,24 @@ . + */ + namespace App\Console\Commands; use App\Facades\UUID; @@ -23,6 +42,7 @@ class CreateUser extends Command * @var string */ protected $description = 'Creates an application user. Seeding the database is for testing environments, so use this command in production for your first admin user.'; + /** * Create a new command instance. * @@ -40,9 +60,7 @@ class CreateUser extends Command */ public function handle() { - - do - { + do { if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { system('cls'); } else { @@ -53,60 +71,43 @@ class CreateUser extends Command $this->info('We\'ll ask some questions to get you started.'); $username = $this->ask('Username'); - do - { + do { $password = $this->secret('Password'); $password_confirm = $this->secret('Confirm Password'); - if ($password === $password_confirm) - { + if ($password === $password_confirm) { $password = Hash::make($password); $matches = true; - } - else - { + } else { $this->error('Password doesn\'t match. Please try again.'); $matches = false; } - } - while(!$matches); + } while (! $matches); $email = $this->ask('E-mail address'); $name = $this->ask('First/Last Name'); - do - { - try - { + do { + try { $uuid = UUID::toUUID($this->ask('Minecraft username (Must be a valid Premium account)')); - } - catch (\InvalidArgumentException $e) - { + } catch (\InvalidArgumentException $e) { $this->error($e->getMessage()); $hasError = true; } - if (isset($hasError)) - { + if (isset($hasError)) { $continue = true; - } - else - { + } else { $continue = false; } unset($hasError); - } - while($continue); - + } while ($continue); $this->info('Please check if these details are correct: '); - $this->info('Username: ' . $username); - $this->info('Email: ' . $email); - $this->info('Name: ' . $name); - - } - while(!$this->confirm('Create user now? You can go back to correct any details.')); - + $this->info('Username: '.$username); + $this->info('Email: '.$email); + $this->info('Name: '.$name); + } while (! $this->confirm('Create user now? You can go back to correct any details.')); $user = User::create([ 'uuid' => $uuid, @@ -114,11 +115,10 @@ class CreateUser extends Command 'email' => $email, 'username' => $username, 'originalIP' => '127.0.0.1', - 'password' => $password + 'password' => $password, ]); - if ($user) - { + if ($user) { $user->assignRole('admin', 'reviewer', 'user', 'hiringManager'); Profile::create([ 'profileShortBio' => 'Random data '.rand(0, 1000), @@ -128,13 +128,12 @@ class CreateUser extends Command 'userID' => $user->id, ]); - $this->info('Account created! You may now login at ' . route('login') . '. Enjoy the app!'); + $this->info('Account created! You may now login at '.route('login').'. Enjoy the app!'); return 0; - } - else - { + } else { $this->error('There was an unknown problem creating the user. There might have been errors above. Please try again.'); + return 1; } } diff --git a/app/Console/Commands/MakeFile.php b/app/Console/Commands/MakeFile.php index 47e7a77..5d3cf40 100755 --- a/app/Console/Commands/MakeFile.php +++ b/app/Console/Commands/MakeFile.php @@ -1,12 +1,29 @@ . + */ + namespace App\Console\Commands; use Faker\Factory; use Faker\Generator; - use Illuminate\Console\Command; -use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Storage; class MakeFile extends Command @@ -25,7 +42,6 @@ class MakeFile extends Command */ protected $description = 'Generates test files for the TeamFile model. Use in conjunction with it\'s factory.'; - /** * The faker instance used to obtain dummy text. * @@ -53,15 +69,14 @@ class MakeFile extends Command public function handle() { $count = $this->argument('count'); - $this->info('Creating ' . $this->argument('count') . ' files!'); - - for ($max = 1; $max < $count; $max++) - { - Storage::disk('local')->put('factory_files/testfile_' . rand(0, 5000) . '.txt', $this->faker->paragraphs(40, true)); + $this->info('Creating '.$this->argument('count').' files!'); + for ($max = 1; $max < $count; $max++) { + Storage::disk('local')->put('factory_files/testfile_'.rand(0, 5000).'.txt', $this->faker->paragraphs(40, true)); } $this->info('Finished creating files! They will be randomly picked by the factory.'); + return 0; } } diff --git a/app/Team.php b/app/Team.php index 27fe33c..77c372b 100755 --- a/app/Team.php +++ b/app/Team.php @@ -37,7 +37,6 @@ class Team extends TeamworkTeam return $this->belongsToMany('App\Vacancy', 'team_has_vacancy'); } - public function files() { return $this->hasMany('App\TeamFile', 'team_id'); diff --git a/config/debugbar.php b/config/debugbar.php index ada83c6..87b003e 100755 --- a/config/debugbar.php +++ b/config/debugbar.php @@ -1,5 +1,24 @@ . + */ + return [ /* diff --git a/config/env-editor.php b/config/env-editor.php index b58184a..7b56924 100755 --- a/config/env-editor.php +++ b/config/env-editor.php @@ -1,5 +1,24 @@ . + */ + return [ /* |-------------------------------------------------------------------------- diff --git a/config/onesignal.php b/config/onesignal.php index 8eb3448..aa03903 100755 --- a/config/onesignal.php +++ b/config/onesignal.php @@ -1,23 +1,42 @@ . + */ + +return [ /* - |-------------------------------------------------------------------------- - | One Signal App Id - |-------------------------------------------------------------------------- - | - | - */ + |-------------------------------------------------------------------------- + | One Signal App Id + |-------------------------------------------------------------------------- + | + | + */ 'app_id' => 'YOUR-APP-ID-HERE', /* - |-------------------------------------------------------------------------- - | Rest API Key - |-------------------------------------------------------------------------- - | + |-------------------------------------------------------------------------- + | Rest API Key + |-------------------------------------------------------------------------- | - | - */ + | + | + */ 'rest_api_key' => 'YOUR-REST-API-KEY-HERE', - 'user_auth_key' => 'YOUR-USER-AUTH-KEY' -); \ No newline at end of file + 'user_auth_key' => 'YOUR-USER-AUTH-KEY', +]; diff --git a/database/factories/TeamFileFactory.php b/database/factories/TeamFileFactory.php index 7782137..dc5abf1 100755 --- a/database/factories/TeamFileFactory.php +++ b/database/factories/TeamFileFactory.php @@ -1,5 +1,24 @@ . + */ + namespace Database\Factories; use App\TeamFile; @@ -27,12 +46,12 @@ class TeamFileFactory extends Factory return [ 'uploaded_by' => rand(1, 10), // Also assuming that the user seeder has ran before 'team_id' => rand(1, 3), // Assuming you create 3 teams beforehand - 'name' => $this->faker->file($prefix . 'factory_files', $prefix . 'uploads', false), + 'name' => $this->faker->file($prefix.'factory_files', $prefix.'uploads', false), 'caption' => $this->faker->sentence(), 'description' => $this->faker->paragraphs(3, true), - 'fs_location' => $this->faker->file($prefix . 'factory_files', $prefix . 'uploads'), + 'fs_location' => $this->faker->file($prefix.'factory_files', $prefix.'uploads'), 'extension' => 'txt', - 'size' => rand(1, 1000) // random fake size between 0 bytes and 1 mb + 'size' => rand(1, 1000), // random fake size between 0 bytes and 1 mb ]; } } diff --git a/database/migrations/2020_10_10_185952_create_team_files_table.php b/database/migrations/2020_10_10_185952_create_team_files_table.php index b1b0835..38a6714 100755 --- a/database/migrations/2020_10_10_185952_create_team_files_table.php +++ b/database/migrations/2020_10_10_185952_create_team_files_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_10_10_235319_add_details_to_team_files.php b/database/migrations/2020_10_10_235319_add_details_to_team_files.php index 0ea7fd0..577baf0 100755 --- a/database/migrations/2020_10_10_235319_add_details_to_team_files.php +++ b/database/migrations/2020_10_10_235319_add_details_to_team_files.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/TeamFileSeeder.php b/database/seeders/TeamFileSeeder.php index 91f88c2..4e44a98 100755 --- a/database/seeders/TeamFileSeeder.php +++ b/database/seeders/TeamFileSeeder.php @@ -1,5 +1,24 @@ . + */ + namespace Database\Seeders; use App\TeamFile;