RSM-5 Update to Laravel 8

This commit is contained in:
Miguel Nogueira 2020-10-08 23:47:23 +01:00
parent 596a469e15
commit 0930c29b9a
14 changed files with 1655 additions and 913 deletions

View File

@ -6,8 +6,11 @@ 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
@ -34,6 +37,9 @@ class AppServiceProvider extends ServiceProvider
]);
Schema::defaultStringLength(191);
// Keep using Bootstrap; Laravel 8 has the paginator use Tailwind. Quite opinionated tbh
Paginator::useBootstrap();
User::observe(UserObserver::class);
Application::observe(ApplicationObserver::class);

View File

@ -7,14 +7,6 @@ use Illuminate\Support\Facades\Route;
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.
@ -59,7 +51,6 @@ class RouteServiceProvider extends ServiceProvider
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}

View File

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

2322
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -81,7 +81,7 @@ return [
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database'),
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'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
namespace Database\Seeders;
use Illuminate\Database\Seeder;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,23 @@
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
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

View File

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