384 Laravel 6 changes (#385)
* 384 Laravel 6 changes * Library versions * Update package versions * Add keyType to models * Remove unused dependencies * StyleCI fixes * Fix models for test * Fix tests output and update test runner * Unused imports * Update exceptions handler * Fix login page
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Log;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
/**
|
||||
@@ -10,6 +10,16 @@ use Symfony\Component\Process\Process;
|
||||
*/
|
||||
abstract class Command extends \Illuminate\Console\Command
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Running in the console but not in the tests
|
||||
if (app()->runningInConsole() && env('APP_ENV') !== 'testing') {
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
@@ -7,9 +7,6 @@ use App\Facades\Utils;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
/**
|
||||
* Class AcarsReplay
|
||||
*/
|
||||
class AcarsReplay extends Command
|
||||
{
|
||||
protected $signature = 'phpvms:replay {files} {--manual} {--write-all} {--no-submit}';
|
||||
@@ -47,8 +44,6 @@ class AcarsReplay extends Command
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
|
||||
$this->httpClient = new Client([
|
||||
'base_uri' => config('app.url'),
|
||||
'headers' => [
|
||||
|
||||
@@ -3,23 +3,13 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Console\Command;
|
||||
use Artisan;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
/**
|
||||
* Class ComposerCommand
|
||||
*/
|
||||
class ComposerCommand extends Command
|
||||
{
|
||||
protected $signature = 'phpvms:composer {cmd}';
|
||||
protected $description = 'Composer related tasks';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run composer update related commands
|
||||
*/
|
||||
|
||||
@@ -3,12 +3,9 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Console\Command;
|
||||
use Log;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Tivie\OS\Detector;
|
||||
|
||||
/**
|
||||
* Class CreateDatabase
|
||||
*/
|
||||
class CreateDatabase extends Command
|
||||
{
|
||||
protected $signature = 'database:create {--reset} {--conn=?}';
|
||||
@@ -21,8 +18,6 @@ class CreateDatabase extends Command
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
$this->os = new Detector();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
use PDO;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
/**
|
||||
* Class DevCommands
|
||||
*/
|
||||
class DevCommands extends Command
|
||||
{
|
||||
protected $signature = 'phpvms {cmd} {param?}';
|
||||
@@ -37,7 +34,6 @@ class DevCommands extends Command
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
$this->dbSvc = $dbSvc;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ class DevInstall extends Command
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
$this->databaseSeeder = $databaseSeeder;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,6 @@ namespace App\Console\Commands;
|
||||
use App\Console\Command;
|
||||
use App\Services\ImportService;
|
||||
|
||||
/**
|
||||
* Class ImportCsv
|
||||
*/
|
||||
class ImportCsv extends Command
|
||||
{
|
||||
protected $signature = 'phpvms:csv-import {type} {file}';
|
||||
@@ -24,7 +21,6 @@ class ImportCsv extends Command
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
$this->importer = $importer;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,21 +6,11 @@ use App\Console\Command;
|
||||
use App\Models\Enums\NavaidType;
|
||||
use App\Models\Navdata;
|
||||
|
||||
/**
|
||||
* Class NavdataImport
|
||||
*/
|
||||
class NavdataImport extends Command
|
||||
{
|
||||
protected $signature = 'phpvms:navdata';
|
||||
protected $description = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \League\Geotools\Exception\InvalidArgumentException
|
||||
*
|
||||
|
||||
@@ -5,20 +5,11 @@ namespace App\Console\Commands;
|
||||
use App\Console\Command;
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
/**
|
||||
* Class TestApi
|
||||
*/
|
||||
class TestApi extends Command
|
||||
{
|
||||
protected $signature = 'phpvms:test-api {apikey} {url}';
|
||||
protected $httpClient;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run dev related commands
|
||||
*/
|
||||
|
||||
@@ -6,9 +6,6 @@ use App\Console\Command;
|
||||
use App\Services\VersionService;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
/**
|
||||
* Class Version
|
||||
*/
|
||||
class Version extends Command
|
||||
{
|
||||
protected $signature = 'phpvms:version {--write} {--base-only}';
|
||||
@@ -19,7 +16,6 @@ class Version extends Command
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
$this->versionSvc = $versionSvc;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,13 +14,6 @@ class YamlExport extends Command
|
||||
protected $signature = 'phpvms:yaml-export {tables*}';
|
||||
protected $description = 'YAML table export';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run dev related commands
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,6 @@ class YamlImport extends Command
|
||||
parent::__construct();
|
||||
|
||||
$this->dbSvc = $dbSvc;
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,9 +9,6 @@ use App\Console\Cron\Weekly;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
/**
|
||||
* Class Kernel
|
||||
*/
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -7,8 +7,6 @@ namespace App\Contracts;
|
||||
*/
|
||||
class FormRequest extends \Illuminate\Foundation\Http\FormRequest
|
||||
{
|
||||
protected $sanitizer;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ use App\Exceptions\Converters\ValidationException;
|
||||
use Exception;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -19,6 +20,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException as SymfonyHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Whoops\Handler\HandlerInterface;
|
||||
|
||||
/**
|
||||
* Class Handler
|
||||
@@ -133,4 +135,16 @@ class Handler extends ExceptionHandler
|
||||
|
||||
return $this->convertExceptionToResponse($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignition error page integration
|
||||
*/
|
||||
protected function whoopsHandler()
|
||||
{
|
||||
try {
|
||||
return app(HandlerInterface::class);
|
||||
} catch (BindingResolutionException $e) {
|
||||
return parent::whoopsHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Http\Resources\AirportDistance as AirportDistanceResource;
|
||||
use App\Repositories\AirportRepository;
|
||||
use App\Services\AirportService;
|
||||
use Illuminate\Http\Request;
|
||||
use Prettus\Repository\Criteria\RequestCriteria;
|
||||
|
||||
/**
|
||||
* Class AirportController
|
||||
@@ -45,6 +46,8 @@ class AirportController extends Controller
|
||||
$where['hub'] = $request->get('hub');
|
||||
}
|
||||
|
||||
$this->airportRepo->pushCriteria(new RequestCriteria($request));
|
||||
|
||||
$airports = $this->airportRepo
|
||||
->whereOrder($where, 'icao', 'asc')
|
||||
->paginate();
|
||||
|
||||
@@ -28,6 +28,8 @@ class Acars extends Model
|
||||
use HashIdTrait;
|
||||
|
||||
public $table = 'acars';
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
public $fillable = [
|
||||
|
||||
@@ -30,8 +30,10 @@ class Airport extends Model
|
||||
use FilesTrait;
|
||||
|
||||
public $table = 'airports';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
|
||||
@@ -23,7 +23,9 @@ class File extends Model
|
||||
use HashIdTrait;
|
||||
use ReferenceTrait;
|
||||
|
||||
protected $table = 'files';
|
||||
public $table = 'files';
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
|
||||
@@ -38,12 +38,14 @@ class Flight extends Model
|
||||
use HashIdTrait;
|
||||
|
||||
public $table = 'flights';
|
||||
public $incrementing = false;
|
||||
|
||||
/** The form wants this */
|
||||
public $hours;
|
||||
public $minutes;
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'airline_id',
|
||||
|
||||
@@ -4,13 +4,11 @@ namespace App\Models;
|
||||
|
||||
use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* Class Navdata
|
||||
*/
|
||||
class Navdata extends Model
|
||||
{
|
||||
public $table = 'navdata';
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $timestamps = false;
|
||||
public $incrementing = false;
|
||||
|
||||
|
||||
@@ -4,9 +4,6 @@ namespace App\Models;
|
||||
|
||||
use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* Class News
|
||||
*/
|
||||
class News extends Model
|
||||
{
|
||||
public $table = 'news';
|
||||
|
||||
@@ -13,8 +13,6 @@ use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Class Pirep
|
||||
*
|
||||
* @property string id
|
||||
* @property string flight_number
|
||||
* @property string route_code
|
||||
@@ -57,6 +55,8 @@ class Pirep extends Model
|
||||
use HashIdTrait;
|
||||
|
||||
public $table = 'pireps';
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
/** The form wants this */
|
||||
|
||||
@@ -5,8 +5,6 @@ namespace App\Models;
|
||||
use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* Class PirepComment
|
||||
*
|
||||
* @property string pirep_id
|
||||
* @property int user_id
|
||||
*/
|
||||
|
||||
@@ -4,9 +4,6 @@ namespace App\Models;
|
||||
|
||||
use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* Class PirepFare
|
||||
*/
|
||||
class PirepFare extends Model
|
||||
{
|
||||
public $table = 'pirep_fares';
|
||||
|
||||
@@ -5,8 +5,6 @@ namespace App\Models;
|
||||
use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* Class PirepField
|
||||
*
|
||||
* @property string name
|
||||
* @property string slug
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,11 @@ use App\Contracts\Model;
|
||||
use App\Models\Enums\PirepFieldSource;
|
||||
|
||||
/**
|
||||
* Class PirepFieldValue
|
||||
* @property string pirep_id
|
||||
* @property string name
|
||||
* @property string slug
|
||||
* @property string value
|
||||
* @property string source
|
||||
*/
|
||||
class PirepFieldValue extends Model
|
||||
{
|
||||
|
||||
@@ -5,8 +5,6 @@ namespace App\Models;
|
||||
use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* Class Rank
|
||||
*
|
||||
* @property string name
|
||||
* @property int hours
|
||||
* @property float manual_base_pay_rate
|
||||
|
||||
@@ -5,8 +5,6 @@ namespace App\Models;
|
||||
use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* Class Setting
|
||||
*
|
||||
* @property string id
|
||||
* @property string name
|
||||
* @property string key
|
||||
@@ -19,6 +17,8 @@ use App\Contracts\Model;
|
||||
class Setting extends Model
|
||||
{
|
||||
public $table = 'settings';
|
||||
|
||||
protected $keyType = 'string';
|
||||
public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
|
||||
@@ -4,9 +4,6 @@ namespace App\Models;
|
||||
|
||||
use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* Class UserAward
|
||||
*/
|
||||
class UserAward extends Model
|
||||
{
|
||||
public $table = 'user_awards';
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Support\TimezonelistExtended;
|
||||
use App\Support\Timezonelist;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ExtendedTimezonelistProvider extends ServiceProvider
|
||||
class TimezonelistProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
@@ -24,7 +24,7 @@ class ExtendedTimezonelistProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->singleton('timezonelist', function ($app) {
|
||||
return new TimezonelistExtended();
|
||||
return new Timezonelist();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* MIT License
|
||||
* Copyright (c) 2017 Anh Vũ Đỗ
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use DateTimeZone;
|
||||
use Jackiedo\Timezonelist\Timezonelist;
|
||||
|
||||
class TimezonelistExtended extends Timezonelist
|
||||
/**
|
||||
* This library is from:
|
||||
* https://github.com/JackieDo/Timezone-List
|
||||
*
|
||||
* With some changes to suite the formatting, etc that we need
|
||||
*/
|
||||
class Timezonelist
|
||||
{
|
||||
/**
|
||||
* Whitespace seperate
|
||||
*/
|
||||
const WHITESPACE_SEP = ' ';
|
||||
/**
|
||||
* Popular timezones
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $popularTimezones = [
|
||||
'GMT' => 'GMT timezone',
|
||||
'UTC' => 'UTC timezone',
|
||||
];
|
||||
/**
|
||||
* All continents of the world
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $continents = [
|
||||
'Africa' => DateTimeZone::AFRICA,
|
||||
'America' => DateTimeZone::AMERICA,
|
||||
'Antarctica' => DateTimeZone::ANTARCTICA,
|
||||
'Arctic' => DateTimeZone::ARCTIC,
|
||||
'Asia' => DateTimeZone::ASIA,
|
||||
'Atlantic' => DateTimeZone::ATLANTIC,
|
||||
'Australia' => DateTimeZone::AUSTRALIA,
|
||||
'Europe' => DateTimeZone::EUROPE,
|
||||
'Indian' => DateTimeZone::INDIAN,
|
||||
'Pacific' => DateTimeZone::PACIFIC,
|
||||
];
|
||||
|
||||
/**
|
||||
* Format to display timezones
|
||||
*
|
||||
Reference in New Issue
Block a user