WIP: Road to 1.0.0 #1

Draft
miguel456 wants to merge 123 commits from develop into master
14 changed files with 1655 additions and 913 deletions
Showing only changes of commit 0930c29b9a - Show all commits

View File

@ -6,8 +6,11 @@ use App\Application;
use App\Observers\ApplicationObserver; use App\Observers\ApplicationObserver;
use App\Observers\UserObserver; use App\Observers\UserObserver;
use App\User; use App\User;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Sentry; use Sentry;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
@ -34,6 +37,9 @@ class AppServiceProvider extends ServiceProvider
]); ]);
Schema::defaultStringLength(191); Schema::defaultStringLength(191);
// Keep using Bootstrap; Laravel 8 has the paginator use Tailwind. Quite opinionated tbh
Paginator::useBootstrap();
User::observe(UserObserver::class); User::observe(UserObserver::class);
Application::observe(ApplicationObserver::class); Application::observe(ApplicationObserver::class);

View File

@ -7,14 +7,6 @@ use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider class RouteServiceProvider extends ServiceProvider
{ {
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/** /**
* The path to the "home" route for your application. * The path to the "home" route for your application.
@ -59,7 +51,6 @@ class RouteServiceProvider extends ServiceProvider
protected function mapWebRoutes() protected function mapWebRoutes()
{ {
Route::middleware('web') Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php')); ->group(base_path('routes/web.php'));
} }

View File

@ -8,34 +8,34 @@
], ],
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^7.2.5", "php": "^7.3.4",
"ext-imagick": "*", "ext-imagick": "*",
"ext-json": "*", "ext-json": "*",
"arcanedev/log-viewer": "^7.0", "arcanedev/log-viewer": "^8.0",
"doctrine/dbal": "^2.10", "doctrine/dbal": "^2.10",
"fideloper/proxy": "^4.2", "fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0", "fruitcake/laravel-cors": "^1.0",
"geo-sot/laravel-env-editor": "^0.9.9", "geo-sot/laravel-env-editor": "^0.9.9",
"graham-campbell/markdown": "^12.0", "graham-campbell/markdown": "^13.1",
"guzzlehttp/guzzle": "^6.5", "guzzlehttp/guzzle": "^7.0.1",
"jeroennoten/laravel-adminlte": "^3.2", "jeroennoten/laravel-adminlte": "^3.2",
"laravel/framework": "^7.0", "laravel/framework": "^8.0",
"laravel/slack-notification-channel": "^2.0", "laravel/slack-notification-channel": "^2.0",
"laravel/tinker": "^2.0", "laravel/tinker": "^2.0",
"laravel/ui": "^2.0", "laravel/ui": "^3.0",
"mcamara/laravel-localization": "^1.5", "mcamara/laravel-localization": "^1.5",
"mpociot/teamwork": "^6.0", "mpociot/teamwork": "^6.0",
"pragmarx/google2fa-laravel": "^1.3", "pragmarx/google2fa-laravel": "^1.3",
"sentry/sentry-laravel": "1.7.1", "sentry/sentry-laravel": "2.1.1",
"spatie/laravel-permission": "^3.13" "spatie/laravel-permission": "^3.13"
}, },
"require-dev": { "require-dev": {
"barryvdh/laravel-debugbar": "^3.3", "barryvdh/laravel-debugbar": "^3.3",
"facade/ignition": "^2.0", "facade/ignition": "^2.3.6",
"fzaninotto/faker": "^1.9.1", "fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1", "mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1", "nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^8.5" "phpunit/phpunit": "^9.0"
}, },
"config": { "config": {
"optimize-autoloader": true, "optimize-autoloader": true,
@ -49,12 +49,10 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"App\\": "app/" "App\\": "app/",
}, "Database\\Factories\\": "database/factories/",
"classmap": [ "Database\\Seeders\\": "database/seeders/"
"database/seeds", }
"database/factories"
]
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {

2322
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -81,7 +81,7 @@ return [
*/ */
'failed' => [ 'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database'), 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'), 'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs', 'table' => 'failed_jobs',
], ],

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddUuidToFailedJobs extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('failed_jobs', function (Blueprint $table) {
$table->string('uuid')->after('id')->nullable()->unique();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('failed_jobs', function (Blueprint $table) {
$table->dropColumn('uuid');
});
}
}

View File

@ -1,4 +1,5 @@
<?php <?php
namespace Database\Seeders;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;

View File

@ -1,4 +1,5 @@
<?php <?php
namespace Database\Seeders;
use App\Facades\Options; use App\Facades\Options;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;

View File

@ -1,4 +1,5 @@
<?php <?php
namespace Database\Seeders;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission; use Spatie\Permission\Models\Permission;

View File

@ -1,5 +1,7 @@
<?php <?php
namespace Database\Seeders;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission; use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role; use Spatie\Permission\Models\Role;

View File

@ -1,4 +1,5 @@
<?php <?php
namespace Database\Seeders;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission; use Spatie\Permission\Models\Permission;

View File

@ -1,4 +1,5 @@
<?php <?php
namespace Database\Seeders;
use App\Profile; use App\Profile;
use App\User; use App\User;

View File

@ -1,14 +1,23 @@
<?php <?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
define('LARAVEL_START', microtime(true)); define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Check If Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is maintenance / demo mode via the "down" command we
| will require this file so that any prerendered template can be shown
| instead of starting the framework, which could cause an exception.
|
*/
if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
require __DIR__.'/../storage/framework/maintenance.php';
}
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Register The Auto Loader | Register The Auto Loader

View File

@ -1,6 +1,22 @@
<?php <?php
use App\Http\Controllers\ApplicationController;
use App\Http\Controllers\AppointmentController;
use App\Http\Controllers\Auth\TwofaController;
use App\Http\Controllers\BanController;
use App\Http\Controllers\CommentController;
use App\Http\Controllers\ContactController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\DevToolsController;
use App\Http\Controllers\FormController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\TeamController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\VacancyController;
use App\Http\Controllers\VoteController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization; use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
/* /*
@ -19,92 +35,93 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'l
Auth::routes(['verify' => true]); Auth::routes(['verify' => true]);
Route::post('/twofa/authenticate', 'Auth\TwofaController@verify2FA') Route::post('/twofa/authenticate', [TwofaController::class, 'verify2FA'])
->name('verify2FA'); ->name('verify2FA');
}); });
Route::get('/','HomeController@index') Route::get('/', [HomeController::class, 'index'])
->middleware('eligibility'); ->middleware('eligibility');
Route::post('/form/contact', 'ContactController@create') Route::post('/form/contact', [ContactController::class, 'create'])
->name('sendSubmission'); ->name('sendSubmission');
Route::get('/accounts/danger-zone/{ID}/{action}/{token}', 'UserController@processDeleteConfirmation') Route::get('/accounts/danger-zone/{ID}/{action}/{token}', [UserController::class, 'processDeleteConfirmation'])
->name('processDeleteConfirmation'); ->name('processDeleteConfirmation');
Route::group(['middleware' => ['auth', 'forcelogout', '2fa', 'verified']], function(){ Route::group(['middleware' => ['auth', 'forcelogout', '2fa', 'verified']], function(){
Route::get('/dashboard', 'DashboardController@index') Route::get('/dashboard', [DashboardController::class, 'index'])
->name('dashboard') ->name('dashboard')
->middleware('eligibility'); ->middleware('eligibility');
Route::get('users/directory', 'ProfileController@index') Route::get('users/directory', [ProfileController::class, 'index'])
->name('directory'); ->name('directory');
Route::post('teams/{team}/invites/send', 'TeamController@invite') Route::post('teams/{team}/invites/send', [TeamController::class, 'invite'])
->name('sendInvite'); ->name('sendInvite');
Route::get('teams/{team}/switch', 'TeamController@switchTeam') Route::get('teams/{team}/switch', [TeamController::class, 'switchTeam'])
->name('switchTeam'); ->name('switchTeam');
Route::get('teams/invites/{action}/{token}', 'TeamController@processInviteAction') Route::get('teams/invites/{action}/{token}', [TeamController::class, 'processInviteAction'])
->name('processInvite'); ->name('processInvite');
Route::resource('teams', 'TeamController'); // WARNING: This is a resource, might not work under laravel 8.
Route::resource('teams', TeamController::class);
Route::group(['prefix' => '/applications'], function (){ Route::group(['prefix' => '/applications'], function (){
Route::get('/my-applications', 'ApplicationController@showUserApps') Route::get('/my-applications', [ApplicationController::class, 'showUserApps'])
->name('showUserApps') ->name('showUserApps')
->middleware('eligibility'); ->middleware('eligibility');
Route::get('/view/{application}', 'ApplicationController@showUserApp') Route::get('/view/{application}', [ApplicationController::class, 'showUserApp'])
->name('showUserApp'); ->name('showUserApp');
Route::post('/{application}/comments', 'CommentController@insert') Route::post('/{application}/comments', [CommentController::class, 'insert'])
->name('addApplicationComment'); ->name('addApplicationComment');
Route::delete('/comments/{comment}/delete', 'CommentController@delete') Route::delete('/comments/{comment}/delete', [CommentController::class, 'delete'])
->name('deleteApplicationComment'); ->name('deleteApplicationComment');
Route::patch('/notes/save/{application}', 'AppointmentController@saveNotes') Route::patch('/notes/save/{application}', [AppointmentController::class, 'saveNotes'])
->name('saveNotes'); ->name('saveNotes');
Route::patch('/update/{application}/{newStatus}', 'ApplicationController@updateApplicationStatus') Route::patch('/update/{application}/{newStatus}', [ApplicationController::class, 'updateApplicationStatus'])
->name('updateApplicationStatus'); ->name('updateApplicationStatus');
Route::delete('{application}/delete', 'ApplicationController@delete') Route::delete('{application}/delete', [ApplicationController::class, 'delete'])
->name('deleteApplication'); ->name('deleteApplication');
Route::get('/staff/all', 'ApplicationController@showAllApps') Route::get('/staff/all', [ApplicationController::class, 'showAllApps'])
->name('allApplications'); ->name('allApplications');
Route::get('/staff/outstanding', 'ApplicationController@showAllPendingApps') Route::get('/staff/outstanding', [ApplicationController::class, 'showAllPendingApps'])
->name('staffPendingApps'); ->name('staffPendingApps');
Route::get('/staff/peer-review', 'ApplicationController@showPeerReview') Route::get('/staff/peer-review', [ApplicationController::class, 'showPeerReview'])
->name('peerReview'); ->name('peerReview');
Route::get('/staff/pending-interview', 'ApplicationController@showPendingInterview') Route::get('/staff/pending-interview', [ApplicationController::class, 'showPendingInterview'])
->name('pendingInterview'); ->name('pendingInterview');
Route::post('{application}/staff/vote', 'VoteController@vote') Route::post('{application}/staff/vote', [VoteController::class, 'vote'])
->name('voteApplication'); ->name('voteApplication');
@ -112,56 +129,56 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'l
Route::group(['prefix' => 'appointments'], function (){ Route::group(['prefix' => 'appointments'], function (){
Route::post('schedule/appointments/{application}', 'AppointmentController@saveAppointment') Route::post('schedule/appointments/{application}', [AppointmentController::class, 'saveAppointment'])
->name('scheduleAppointment'); ->name('scheduleAppointment');
Route::patch('update/appointments/{application}/{status}', 'AppointmentController@updateAppointment') Route::patch('update/appointments/{application}/{status}', [AppointmentController::class, 'updateAppointment'])
->name('updateAppointment'); ->name('updateAppointment');
}); });
Route::group(['prefix' => 'apply', 'middleware' => ['eligibility']], function (){ Route::group(['prefix' => 'apply', 'middleware' => ['eligibility']], function (){
Route::get('positions/{vacancySlug}', 'ApplicationController@renderApplicationForm') Route::get('positions/{vacancySlug}', [ApplicationController::class, 'renderApplicationForm'])
->name('renderApplicationForm'); ->name('renderApplicationForm');
Route::post('positions/{vacancySlug}/submit', 'ApplicationController@saveApplicationAnswers') Route::post('positions/{vacancySlug}/submit', [ApplicationController::class, 'saveApplicationAnswers'])
->name('saveApplicationForm'); ->name('saveApplicationForm');
}); });
Route::group(['prefix' => '/profile'], function (){ Route::group(['prefix' => '/profile'], function (){
Route::get('/settings', 'ProfileController@showProfile') Route::get('/settings', [ProfileController::class, 'showProfile'])
->name('showProfileSettings'); ->name('showProfileSettings');
Route::patch('/settings/save', 'ProfileController@saveProfile') Route::patch('/settings/save', [ProfileController::class, 'saveProfile'])
->name('saveProfileSettings'); ->name('saveProfileSettings');
Route::get('user/{user}', 'ProfileController@showSingleProfile') Route::get('user/{user}', [ProfileController::class, 'showSingleProfile'])
->name('showSingleProfile'); ->name('showSingleProfile');
Route::get('/settings/account', 'UserController@showAccount') Route::get('/settings/account', [UserController::class, 'showAccount'])
->name('showAccountSettings'); ->name('showAccountSettings');
Route::patch('/settings/account/change-password', 'UserController@changePassword') Route::patch('/settings/account/change-password', [UserController::class, 'changePassword'])
->name('changePassword'); ->name('changePassword');
Route::patch('/settings/account/change-email', 'UserController@changeEmail') Route::patch('/settings/account/change-email', [UserController::class, 'changeEmail'])
->name('changeEmail'); ->name('changeEmail');
Route::post('/settings/account/flush-sessions', 'UserController@flushSessions') Route::post('/settings/account/flush-sessions', [UserController::class, 'flushSessions'])
->name('flushSessions'); ->name('flushSessions');
Route::patch('/settings/account/twofa/enable', 'UserController@add2FASecret') Route::patch('/settings/account/twofa/enable', [UserController::class, 'add2FASecret'])
->name('enable2FA'); ->name('enable2FA');
Route::patch('/settings/account/twofa/disable', 'UserController@remove2FASecret') Route::patch('/settings/account/twofa/disable', [UserController::class, 'remove2FASecret'])
->name('disable2FA'); ->name('disable2FA');
Route::patch('/settings/account/dg/delete', 'UserController@userDelete') Route::patch('/settings/account/dg/delete', [UserController::class, 'userDelete'])
->name('userDelete'); ->name('userDelete');
}); });
@ -169,89 +186,89 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => [ 'l
Route::group(['prefix' => '/hr'], function (){ Route::group(['prefix' => '/hr'], function (){
Route::get('staff-members', 'UserController@showStaffMembers') Route::get('staff-members', [UserController::class, 'showStaffMembers'])
->name('staffMemberList'); ->name('staffMemberList');
Route::get('players', 'UserController@showPlayers') Route::get('players', [UserController::class, 'showPlayers'])
->name('registeredPlayerList'); ->name('registeredPlayerList');
Route::post('players/search', 'UserController@showPlayersLike') Route::post('players/search', [UserController::class, 'showPlayersLike'])
->name('searchRegisteredPLayerList'); ->name('searchRegisteredPLayerList');
Route::patch('staff-members/terminate/{user}', 'UserController@terminate') Route::patch('staff-members/terminate/{user}', [UserController::class, 'terminate'])
->name('terminateStaffMember'); ->name('terminateStaffMember');
}); });
Route::group(['prefix' => 'admin'], function (){ Route::group(['prefix' => 'admin'], function (){
Route::get('settings', 'OptionsController@index') Route::get('settings', [OptionsController::class, 'index'])
->name('showSettings'); ->name('showSettings');
Route::post('settings/save', 'OptionsController@saveSettings') Route::post('settings/save', [OptionsController::class, 'saveSettings'])
->name('saveSettings'); ->name('saveSettings');
Route::post('players/ban/{user}', 'BanController@insert') Route::post('players/ban/{user}', [BanController::class, 'insert'])
->name('banUser'); ->name('banUser');
Route::delete('players/unban/{user}', 'BanController@delete') Route::delete('players/unban/{user}', [BanController::class, 'delete'])
->name('unbanUser'); ->name('unbanUser');
Route::delete('players/delete/{user}', 'UserController@delete') Route::delete('players/delete/{user}', [UserController::class, 'delete'])
->name('deleteUser'); ->name('deleteUser');
Route::patch('players/update/{user}', 'UserController@update') Route::patch('players/update/{user}', [UserController::class, 'update'])
->name('updateUser'); ->name('updateUser');
Route::get('positions', 'VacancyController@index') Route::get('positions', [VacancyController::class, 'index'])
->name('showPositions'); ->name('showPositions');
Route::post('positions/save', 'VacancyController@store') Route::post('positions/save', [VacancyController::class, 'store'])
->name('savePosition'); ->name('savePosition');
Route::get('positions/edit/{vacancy}', 'VacancyController@edit') Route::get('positions/edit/{vacancy}', [VacancyController::class, 'edit'])
->name('editPosition'); ->name('editPosition');
Route::patch('positions/update/{vacancy}', 'VacancyController@update') Route::patch('positions/update/{vacancy}', [VacancyController::class, 'update'])
->name('updatePosition'); ->name('updatePosition');
Route::patch('positions/availability/{status}/{vacancy}', 'VacancyController@updatePositionAvailability') Route::patch('positions/availability/{status}/{vacancy}', [VacancyController::class, 'updatePositionAvailability'])
->name('updatePositionAvailability'); ->name('updatePositionAvailability');
Route::get('forms/builder', 'FormController@showFormBuilder') Route::get('forms/builder', [FormController::class, 'showFormBuilder'])
->name('showFormBuilder'); ->name('showFormBuilder');
Route::post('forms/save', 'FormController@saveForm') Route::post('forms/save', [FormController::class, 'saveForm'])
->name('saveForm'); ->name('saveForm');
Route::delete('forms/destroy/{form}', 'FormController@destroy') Route::delete('forms/destroy/{form}', [FormController::class, 'destroy'])
->name('destroyForm'); ->name('destroyForm');
Route::get('forms', 'FormController@index') Route::get('forms', [FormController::class, 'showFormBuilder'])
->name('showForms'); ->name('showForms');
Route::get('forms/preview/{form}', 'FormController@preview') Route::get('forms/preview/{form}', [FormController::class, 'preview'])
->name('previewForm'); ->name('previewForm');
Route::get('forms/edit/{form}', 'FormController@edit') Route::get('forms/edit/{form}', [FormController::class, 'edit'])
->name('editForm'); ->name('editForm');
Route::patch('forms/update/{form}', 'FormController@update') Route::patch('forms/update/{form}', [FormController::class, 'update'])
->name('updateForm'); ->name('updateForm');
Route::get('devtools', 'DevToolsController@index') Route::get('devtools', [DevToolsController::class, 'index'])
->name('devTools'); ->name('devTools');
// we could use route model binding // we could use route model binding
Route::post('devtools/vote-evaluation/force', 'DevToolsController@forceVoteCount') Route::post('devtools/vote-evaluation/force', [DevToolsController::class, 'forceVoteCount'])
->name('devToolsForceVoteCount'); ->name('devToolsForceVoteCount');
}); });