Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4a42c53ba | ||
|
|
a4b90fcce3 |
+1
-5
@@ -1,10 +1,6 @@
|
|||||||
#
|
#
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
[*]
|
|
||||||
end_of_line = lf
|
|
||||||
insert_final_newline = true
|
|
||||||
|
|
||||||
[*.js]
|
[*.js]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
@@ -27,4 +23,4 @@ indent_style = tab
|
|||||||
# Matches the exact files either package.json or .travis.yml
|
# Matches the exact files either package.json or .travis.yml
|
||||||
[{package.json, .travis.yml}]
|
[{package.json, .travis.yml}]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ env.php
|
|||||||
Homestead.json
|
Homestead.json
|
||||||
LocalValetDriver.php
|
LocalValetDriver.php
|
||||||
docker-compose-profiler.yml
|
docker-compose-profiler.yml
|
||||||
|
sync.sh
|
||||||
|
.env.*
|
||||||
|
|
||||||
# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer
|
# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer
|
||||||
.rocketeer/
|
.rocketeer/
|
||||||
|
|||||||
+1
-2
@@ -6,6 +6,7 @@ language: php
|
|||||||
php:
|
php:
|
||||||
- '7.4'
|
- '7.4'
|
||||||
- '7.3'
|
- '7.3'
|
||||||
|
- '7.2'
|
||||||
|
|
||||||
#env:
|
#env:
|
||||||
# - DB=mysql
|
# - DB=mysql
|
||||||
@@ -28,8 +29,6 @@ services:
|
|||||||
install:
|
install:
|
||||||
- php --version
|
- php --version
|
||||||
- mysql --version
|
- mysql --version
|
||||||
# Downgrade composer version to 1.x
|
|
||||||
- composer self-update --1
|
|
||||||
- composer install --dev --no-interaction --verbose
|
- composer install --dev --no-interaction --verbose
|
||||||
- npm i tar-to-zip -g
|
- npm i tar-to-zip -g
|
||||||
- cp .travis/env.travis.php env.php
|
- cp .travis/env.travis.php env.php
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
<directory suffix=".php">./app</directory>
|
<directory suffix=".php">./app</directory>
|
||||||
</whitelist>
|
</whitelist>
|
||||||
</filter>
|
</filter>
|
||||||
<!--<listeners>
|
<listeners>
|
||||||
<listener class="NunoMaduro\Collision\Adapters\Phpunit\Listener"/>
|
<listener class="NunoMaduro\Collision\Adapters\Phpunit\Listener"/>
|
||||||
</listeners>-->
|
</listeners>
|
||||||
<php>
|
<php>
|
||||||
<ini name="error_reporting" value="E_ALL"/>
|
<ini name="error_reporting" value="E_ALL"/>
|
||||||
<ini name="display_errors" value="On"/>
|
<ini name="display_errors" value="On"/>
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ reload-db:
|
|||||||
tests: test
|
tests: test
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test: phpcs
|
||||||
@#php artisan database:create --reset
|
#php artisan database:create --reset
|
||||||
@vendor/bin/phpunit --verbose
|
vendor/bin/phpunit --debug --verbose
|
||||||
|
|
||||||
.PHONY: phpcs
|
.PHONY: phpcs
|
||||||
phpcs:
|
phpcs:
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
# phpVMS <sup>7</sup>
|
# phpvms <sup>7</sup>
|
||||||
|
|
||||||
[](https://travis-ci.org/nabeelio/phpvms) [](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&utm_medium=referral&utm_content=nabeelio/phpvms&utm_campaign=Badge_Grade) [](https://packagist.org/packages/nabeel/phpvms)  [](https://packagist.org/packages/nabeel/phpvms)
|
[](https://travis-ci.org/nabeelio/phpvms) [](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&utm_medium=referral&utm_content=nabeelio/phpvms&utm_campaign=Badge_Grade) [](https://packagist.org/packages/nabeel/phpvms)  [](https://packagist.org/packages/nabeel/phpvms)
|
||||||
|
|
||||||
The next phpvms version built on the laravel framework. work in progress. The latest documentation, with installation instructions is available [on the phpVMS documentation](https://docs.phpvms.net/) page.
|
The next phpvms version built on the laravel framework. work in progress. The latest documentation, with installation instructions is available
|
||||||
|
[on the phpVMS documentation](http://docs.phpvms.net/) page.
|
||||||
|
|
||||||
## Installation
|
# installation
|
||||||
|
|
||||||
A full distribution, with all of the composer dependencies, is available at this
|
A full distribution, with all of the composer dependencies, is available at this
|
||||||
[GitHub Releases](https://github.com/nabeelio/phpvms/releases) link.
|
[GitHub Releases](https://github.com/nabeelio/phpvms/releases) link.
|
||||||
|
|
||||||
### Requirements
|
|
||||||
|
|
||||||
- PHP 7.3+, extensions:
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- PHP 7.1+, extensions:
|
||||||
- cURL
|
- cURL
|
||||||
- JSON
|
- JSON
|
||||||
- mbstring
|
- mbstring
|
||||||
@@ -21,16 +24,16 @@ A full distribution, with all of the composer dependencies, is available at this
|
|||||||
- Database:
|
- Database:
|
||||||
- MySQL 5.5+ (or MySQL variant, including MariaDB and Percona)
|
- MySQL 5.5+ (or MySQL variant, including MariaDB and Percona)
|
||||||
|
|
||||||
[View more details on requirements](https://docs.phpvms.net/requirements)
|
[View more details on requirements](http://docs.phpvms.net/setup/requirements)
|
||||||
|
|
||||||
### Installer
|
## Installer
|
||||||
|
|
||||||
1. Upload to your server
|
1. Upload to your server
|
||||||
1. Visit the site, and follow the link to the installer
|
1. Visit the site, and follow the link to the installer
|
||||||
|
|
||||||
[View installation details](https://docs.phpvms.net/installation/installation)
|
[View installation details](http://docs.phpvms.net/setup/installation)
|
||||||
|
|
||||||
## Development Environment
|
# development environment
|
||||||
|
|
||||||
A full development environment can be brought up using Docker:
|
A full development environment can be brought up using Docker:
|
||||||
|
|
||||||
@@ -47,7 +50,7 @@ Then go to `http://localhost`. If you're using dnsmasq, the `app` container is l
|
|||||||
127.0.0.1 phpvms.test
|
127.0.0.1 phpvms.test
|
||||||
```
|
```
|
||||||
|
|
||||||
### Building JS/CSS assets
|
## Building JS/CSS assets
|
||||||
|
|
||||||
Yarn is required, run:
|
Yarn is required, run:
|
||||||
|
|
||||||
|
|||||||
@@ -79,29 +79,21 @@ class CreateDatabase extends Command
|
|||||||
*/
|
*/
|
||||||
protected function create_sqlite($dbkey)
|
protected function create_sqlite($dbkey)
|
||||||
{
|
{
|
||||||
$dbPath = config($dbkey.'database');
|
|
||||||
|
|
||||||
// Skip if running in memory
|
|
||||||
if ($dbPath === ':memory:') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$exec = 'sqlite3';
|
$exec = 'sqlite3';
|
||||||
if ($this->os->isWindowsLike()) {
|
if ($this->os->isWindowsLike()) {
|
||||||
$exec = 'sqlite3.exe';
|
$exec = 'sqlite3.exe';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->option('reset') === true) {
|
if ($this->option('reset') === true) {
|
||||||
if (file_exists($dbPath)) {
|
$cmd = ['rm', '-rf', config($dbkey.'database')];
|
||||||
unlink(config($dbkey.'database'));
|
$this->runCommand($cmd);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists($dbPath)) {
|
if (!file_exists(config($dbkey.'database'))) {
|
||||||
$cmd = [
|
$cmd = [
|
||||||
$exec,
|
$exec,
|
||||||
$dbPath,
|
config($dbkey.'database'),
|
||||||
'".exit"',
|
'""',
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->runCommand($cmd);
|
$this->runCommand($cmd);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Contracts\Command;
|
use App\Contracts\Command;
|
||||||
use Illuminate\Support\Facades\DB;
|
use DB;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,20 +25,6 @@ class YamlExport extends Command
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// A "preset" for exporting the base set of data
|
|
||||||
if ($tables[0] === 'base') {
|
|
||||||
$tables = [
|
|
||||||
'airlines',
|
|
||||||
'aircraft',
|
|
||||||
'subfleets',
|
|
||||||
'subfleet_fare',
|
|
||||||
'subfleet_rank',
|
|
||||||
'bids',
|
|
||||||
'fares',
|
|
||||||
'flights',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$export_tables = [];
|
$export_tables = [];
|
||||||
foreach ($tables as $table) {
|
foreach ($tables as $table) {
|
||||||
$export_tables[$table] = [];
|
$export_tables[$table] = [];
|
||||||
|
|||||||
@@ -36,10 +36,7 @@ abstract class Award
|
|||||||
* You don't really need to mess with anything below here
|
* You don't really need to mess with anything below here
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @var \App\Models\Award|null */
|
|
||||||
protected $award;
|
protected $award;
|
||||||
|
|
||||||
/** @var \App\Models\User|null */
|
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
public function __construct(AwardModel $award = null, User $user = null)
|
public function __construct(AwardModel $award = null, User $user = null)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use function is_array;
|
|
||||||
use Symfony\Component\Process\Process;
|
use Symfony\Component\Process\Process;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,9 +82,9 @@ abstract class Command extends \Illuminate\Console\Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array|string $cmd
|
* @param $cmd
|
||||||
* @param bool $return
|
* @param bool $return
|
||||||
* @param mixed $verbose
|
* @param mixed $verbose
|
||||||
*
|
*
|
||||||
* @throws \Symfony\Component\Process\Exception\RuntimeException
|
* @throws \Symfony\Component\Process\Exception\RuntimeException
|
||||||
* @throws \Symfony\Component\Process\Exception\LogicException
|
* @throws \Symfony\Component\Process\Exception\LogicException
|
||||||
@@ -94,16 +93,16 @@ abstract class Command extends \Illuminate\Console\Command
|
|||||||
*/
|
*/
|
||||||
public function runCommand($cmd, $return = false, $verbose = true): string
|
public function runCommand($cmd, $return = false, $verbose = true): string
|
||||||
{
|
{
|
||||||
if (is_array($cmd)) {
|
if (\is_array($cmd)) {
|
||||||
$cmd = implode(' ', $cmd);
|
$cmd = implode(' ', $cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($verbose) {
|
if ($verbose) {
|
||||||
$this->info('Running '.$cmd);
|
$this->info('Running "'.$cmd.'"');
|
||||||
}
|
}
|
||||||
|
|
||||||
$val = '';
|
$val = '';
|
||||||
$process = Process::fromShellCommandline($cmd);
|
$process = new Process($cmd);
|
||||||
$process->run(function ($type, $buffer) use ($return, &$val) {
|
$process->run(function ($type, $buffer) use ($return, &$val) {
|
||||||
if ($return) {
|
if ($return) {
|
||||||
$val .= $buffer;
|
$val .= $buffer;
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Contracts;
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
|
||||||
|
|
||||||
class Event
|
|
||||||
{
|
|
||||||
use Dispatchable;
|
|
||||||
use SerializesModels;
|
|
||||||
}
|
|
||||||
@@ -3,9 +3,9 @@
|
|||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use App\Models\Airline;
|
use App\Models\Airline;
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use Log;
|
||||||
|
use Validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common functionality used across all of the importers
|
* Common functionality used across all of the importers
|
||||||
@@ -51,9 +51,9 @@ class ImportExport
|
|||||||
*
|
*
|
||||||
* @param $code
|
* @param $code
|
||||||
*
|
*
|
||||||
* @return Airline
|
* @return \Illuminate\Database\Eloquent\Model
|
||||||
*/
|
*/
|
||||||
public function getAirline($code): Airline
|
public function getAirline($code)
|
||||||
{
|
{
|
||||||
$airline = Airline::firstOrCreate([
|
$airline = Airline::firstOrCreate([
|
||||||
'icao' => $code,
|
'icao' => $code,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ abstract class Listener
|
|||||||
public function subscribe(Dispatcher $events): void
|
public function subscribe(Dispatcher $events): void
|
||||||
{
|
{
|
||||||
foreach (static::$callbacks as $klass => $cb) {
|
foreach (static::$callbacks as $klass => $cb) {
|
||||||
$events->listen($klass, static::class.'@'.$cb);
|
$events->listen($klass, get_class($this).'@'.$cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,8 @@
|
|||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use App\Support\Database;
|
use App\Support\Database;
|
||||||
use Exception;
|
use DB;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Validation\ValidationException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Migration
|
* Class Migration
|
||||||
@@ -28,29 +25,6 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a module and enable it
|
|
||||||
*
|
|
||||||
* @param array $attrs
|
|
||||||
*/
|
|
||||||
public function addModule(array $attrs)
|
|
||||||
{
|
|
||||||
$module = array_merge([
|
|
||||||
'enabled' => true,
|
|
||||||
'created_at' => DB::raw('NOW()'),
|
|
||||||
'updated_at' => DB::raw('NOW()'),
|
|
||||||
], $attrs);
|
|
||||||
|
|
||||||
try {
|
|
||||||
DB::table('modules')->insert($module);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// setting already exists, just ignore it
|
|
||||||
if ($e->getCode() === 23000) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Seed a YAML file into the database
|
* Seed a YAML file into the database
|
||||||
*
|
*
|
||||||
@@ -61,7 +35,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
|||||||
try {
|
try {
|
||||||
$path = base_path($file);
|
$path = base_path($file);
|
||||||
Database::seed_from_yaml_file($path, false);
|
Database::seed_from_yaml_file($path, false);
|
||||||
} catch (Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error('Unable to load '.$file.' file');
|
Log::error('Unable to load '.$file.' file');
|
||||||
Log::error($e);
|
Log::error($e);
|
||||||
}
|
}
|
||||||
@@ -78,7 +52,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
|||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
try {
|
try {
|
||||||
DB::table($table)->insert($row);
|
DB::table($table)->insert($row);
|
||||||
} catch (Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// setting already exists, just ignore it
|
// setting already exists, just ignore it
|
||||||
if ($e->getCode() === 23000) {
|
if ($e->getCode() === 23000) {
|
||||||
continue;
|
continue;
|
||||||
@@ -86,22 +60,4 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add an award from the migrations (for example, if you're adding an award module)
|
|
||||||
*
|
|
||||||
* @param array $award See \App\Models\Awardv
|
|
||||||
*
|
|
||||||
* @throws \Illuminate\Validation\ValidationException
|
|
||||||
*/
|
|
||||||
public function addAward(array $award)
|
|
||||||
{
|
|
||||||
$validator = Validator::make($award, \App\Models\Award::$rules);
|
|
||||||
if ($validator->fails()) {
|
|
||||||
throw new ValidationException($validator);
|
|
||||||
}
|
|
||||||
|
|
||||||
$awardModel = new \App\Models\Award($award);
|
|
||||||
$awardModel->save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Contracts\Modules;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for module service providers
|
|
||||||
* Add-on module service providers must extend this class. Docs on Service Providers:
|
|
||||||
* https://laravel.com/docs/7.x/providers
|
|
||||||
*
|
|
||||||
* For a sample service provider, view the sample module one:
|
|
||||||
* https://github.com/nabeelio/phpvms-module/blob/master/Providers/SampleServiceProvider.php
|
|
||||||
*/
|
|
||||||
abstract class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A boot method is required, even if it doesn't do anything.
|
|
||||||
* https://laravel.com/docs/7.x/providers#the-boot-method
|
|
||||||
*
|
|
||||||
* This is normally where you'd register the routes or other startup tasks for your module
|
|
||||||
*/
|
|
||||||
public function boot(): void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is required to register the links in either the public or admin toolbar
|
|
||||||
* For example, adding a frontend link:
|
|
||||||
*
|
|
||||||
* $this->moduleSvc->addFrontendLink('Sample', '/sample', '', $logged_in=true);
|
|
||||||
*
|
|
||||||
* Or an admin link:
|
|
||||||
*
|
|
||||||
* $this->moduleSvc->addAdminLink('Sample', '/admin/sample');
|
|
||||||
*/
|
|
||||||
public function registerLinks(): void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deferred providers:
|
|
||||||
* https://laravel.com/docs/7.x/providers#deferred-providers
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function provides(): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,12 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for a resource/response
|
* Base class for a resource/response
|
||||||
*/
|
*/
|
||||||
class Resource extends JsonResource
|
class Resource extends \Illuminate\Http\Resources\Json\Resource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Iterate through the list of $fields and check if they're a "Unit"
|
* Iterate through the list of $fields and check if they're a "Unit"
|
||||||
|
|||||||
@@ -1,30 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Airport;
|
|
||||||
use App\Models\Enums\AircraftState;
|
|
||||||
use App\Models\Enums\AircraftStatus;
|
|
||||||
use App\Models\Subfleet;
|
|
||||||
use App\Support\ICAO;
|
|
||||||
use Faker\Generator as Faker;
|
use Faker\Generator as Faker;
|
||||||
|
|
||||||
$factory->define(App\Models\Aircraft::class, function (Faker $faker) {
|
$factory->define(App\Models\Aircraft::class, function (Faker $faker) {
|
||||||
return [
|
return [
|
||||||
'id' => null,
|
'id' => null,
|
||||||
'subfleet_id' => function () {
|
'subfleet_id' => function () {
|
||||||
return factory(Subfleet::class)->create()->id;
|
return factory(App\Models\Subfleet::class)->create()->id;
|
||||||
},
|
},
|
||||||
'airport_id' => function () {
|
'airport_id' => function () {
|
||||||
return factory(Airport::class)->create()->id;
|
return factory(App\Models\Airport::class)->create()->id;
|
||||||
},
|
},
|
||||||
'iata' => $faker->unique()->text(5),
|
'iata' => $faker->unique()->text(5),
|
||||||
'icao' => $faker->unique()->text(5),
|
'icao' => $faker->unique()->text(5),
|
||||||
'name' => $faker->text(50),
|
'name' => $faker->text(50),
|
||||||
'registration' => $faker->unique()->text(10),
|
'registration' => $faker->unique()->text(10),
|
||||||
'hex_code' => ICAO::createHexCode(),
|
'hex_code' => \App\Support\ICAO::createHexCode(),
|
||||||
'mtow' => $faker->randomFloat(2, 0, 50000),
|
|
||||||
'zfw' => $faker->randomFloat(2, 0, 50000),
|
'zfw' => $faker->randomFloat(2, 0, 50000),
|
||||||
'status' => AircraftStatus::ACTIVE,
|
'status' => \App\Models\Enums\AircraftStatus::ACTIVE,
|
||||||
'state' => AircraftState::PARKED,
|
'state' => \App\Models\Enums\AircraftState::PARKED,
|
||||||
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
|
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
|
||||||
'updated_at' => function (array $pirep) {
|
'updated_at' => function (array $pirep) {
|
||||||
return $pirep['created_at'];
|
return $pirep['created_at'];
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use Hashids\Hashids;
|
|||||||
$factory->define(App\Models\Airline::class, function (Faker $faker) {
|
$factory->define(App\Models\Airline::class, function (Faker $faker) {
|
||||||
return [
|
return [
|
||||||
'id' => null,
|
'id' => null,
|
||||||
'icao' => function (array $apt) {
|
'icao' => function (array $apt) use ($faker) {
|
||||||
$hashids = new Hashids(microtime(), 5);
|
$hashids = new Hashids(microtime(), 5);
|
||||||
$mt = str_replace('.', '', microtime(true));
|
$mt = str_replace('.', '', microtime(true));
|
||||||
|
|
||||||
|
|||||||
@@ -8,19 +8,19 @@ $factory->define(App\Models\Flight::class, function (Faker $faker) {
|
|||||||
return [
|
return [
|
||||||
'id' => $faker->unique()->numberBetween(10, 10000000),
|
'id' => $faker->unique()->numberBetween(10, 10000000),
|
||||||
'airline_id' => function () {
|
'airline_id' => function () {
|
||||||
return factory(\App\Models\Airline::class)->create()->id;
|
return factory(App\Models\Airline::class)->create()->id;
|
||||||
},
|
},
|
||||||
'flight_number' => $faker->unique()->numberBetween(10, 1000000),
|
'flight_number' => $faker->unique()->numberBetween(10, 1000000),
|
||||||
'route_code' => $faker->randomElement(['', $faker->text(5)]),
|
'route_code' => $faker->randomElement(['', $faker->text(5)]),
|
||||||
'route_leg' => $faker->randomElement(['', $faker->numberBetween(0, 1000)]),
|
'route_leg' => $faker->randomElement(['', $faker->numberBetween(0, 1000)]),
|
||||||
'dpt_airport_id' => function () {
|
'dpt_airport_id' => function () {
|
||||||
return factory(\App\Models\Airport::class)->create()->id;
|
return factory(App\Models\Airport::class)->create()->id;
|
||||||
},
|
},
|
||||||
'arr_airport_id' => function () {
|
'arr_airport_id' => function () {
|
||||||
return factory(\App\Models\Airport::class)->create()->id;
|
return factory(App\Models\Airport::class)->create()->id;
|
||||||
},
|
},
|
||||||
'alt_airport_id' => function () {
|
'alt_airport_id' => function () {
|
||||||
return factory(\App\Models\Airport::class)->create()->id;
|
return factory(App\Models\Airport::class)->create()->id;
|
||||||
},
|
},
|
||||||
'distance' => $faker->numberBetween(1, 1000),
|
'distance' => $faker->numberBetween(1, 1000),
|
||||||
'route' => null,
|
'route' => null,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $factory->define(App\Models\JournalTransactions::class, function (Faker $faker)
|
|||||||
return [
|
return [
|
||||||
'transaction_group' => \Ramsey\Uuid\Uuid::uuid4()->toString(),
|
'transaction_group' => \Ramsey\Uuid\Uuid::uuid4()->toString(),
|
||||||
'journal_id' => function () {
|
'journal_id' => function () {
|
||||||
return factory(\App\Models\Journal::class)->create()->id;
|
return factory(App\Models\Journal::class)->create()->id;
|
||||||
},
|
},
|
||||||
'credit' => $faker->numberBetween(100, 10000),
|
'credit' => $faker->numberBetween(100, 10000),
|
||||||
'debit' => $faker->numberBetween(100, 10000),
|
'debit' => $faker->numberBetween(100, 10000),
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $factory->define(App\Models\News::class, function (Faker $faker) {
|
|||||||
return [
|
return [
|
||||||
'id' => null,
|
'id' => null,
|
||||||
'user_id' => function () {
|
'user_id' => function () {
|
||||||
return factory(\App\Models\User::class)->create()->id;
|
return factory(App\Models\User::class)->create()->id;
|
||||||
},
|
},
|
||||||
'subject' => $faker->text(),
|
'subject' => $faker->text(),
|
||||||
'body' => $faker->sentence,
|
'body' => $faker->sentence,
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ use Faker\Generator as Faker;
|
|||||||
* Create a new PIREP
|
* Create a new PIREP
|
||||||
*/
|
*/
|
||||||
$factory->define(App\Models\Pirep::class, function (Faker $faker) {
|
$factory->define(App\Models\Pirep::class, function (Faker $faker) {
|
||||||
$airline = factory(\App\Models\Airline::class)->create();
|
$airline = factory(App\Models\Airline::class)->create();
|
||||||
$flight = factory(\App\Models\Flight::class)->create([
|
$flight = factory(App\Models\Flight::class)->create([
|
||||||
'airline_id' => $airline->id,
|
'airline_id' => $airline->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -21,10 +21,10 @@ $factory->define(App\Models\Pirep::class, function (Faker $faker) {
|
|||||||
return $airline->id;
|
return $airline->id;
|
||||||
},
|
},
|
||||||
'user_id' => function () {
|
'user_id' => function () {
|
||||||
return factory(\App\Models\User::class)->create()->id;
|
return factory(App\Models\User::class)->create()->id;
|
||||||
},
|
},
|
||||||
'aircraft_id' => function () {
|
'aircraft_id' => function () {
|
||||||
return factory(\App\Models\Aircraft::class)->create()->id;
|
return factory(App\Models\Aircraft::class)->create()->id;
|
||||||
},
|
},
|
||||||
'flight_id' => function () use ($flight) {
|
'flight_id' => function () use ($flight) {
|
||||||
return $flight->id;
|
return $flight->id;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $factory->define(App\Models\Subfleet::class, function (Faker $faker) {
|
|||||||
return [
|
return [
|
||||||
'id' => null,
|
'id' => null,
|
||||||
'airline_id' => function () {
|
'airline_id' => function () {
|
||||||
return factory(\App\Models\Airline::class)->create()->id;
|
return factory(App\Models\Airline::class)->create()->id;
|
||||||
},
|
},
|
||||||
'name' => $faker->unique()->text(50),
|
'name' => $faker->unique()->text(50),
|
||||||
'type' => $faker->unique()->text(7),
|
'type' => $faker->unique()->text(7),
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Airline;
|
|
||||||
use App\Models\Enums\UserState;
|
use App\Models\Enums\UserState;
|
||||||
use Faker\Generator as Faker;
|
use Faker\Generator as Faker;
|
||||||
use Illuminate\Support\Facades\Hash;
|
|
||||||
|
|
||||||
$factory->define(App\Models\User::class, function (Faker $faker) {
|
$factory->define(App\Models\User::class, function (Faker $faker) {
|
||||||
static $password;
|
static $password;
|
||||||
@@ -16,7 +14,7 @@ $factory->define(App\Models\User::class, function (Faker $faker) {
|
|||||||
'password' => $password ?: $password = Hash::make('secret'),
|
'password' => $password ?: $password = Hash::make('secret'),
|
||||||
'api_key' => $faker->sha1,
|
'api_key' => $faker->sha1,
|
||||||
'airline_id' => function () {
|
'airline_id' => function () {
|
||||||
return factory(Airline::class)->create()->id;
|
return factory(App\Models\Airline::class)->create()->id;
|
||||||
},
|
},
|
||||||
'rank_id' => 1,
|
'rank_id' => 1,
|
||||||
'flights' => $faker->numberBetween(0, 1000),
|
'flights' => $faker->numberBetween(0, 1000),
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ use Illuminate\Database\Schema\Blueprint;
|
|||||||
|
|
||||||
class RolesPermissionsTables extends Migration
|
class RolesPermissionsTables extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
// Create table for storing roles
|
// Create table for storing roles
|
||||||
@@ -74,6 +79,11 @@ class RolesPermissionsTables extends Migration
|
|||||||
$this->addData('roles', $roles);
|
$this->addData('roles', $roles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('permission_user');
|
Schema::dropIfExists('permission_user');
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
|
|
||||||
class CreatePasswordResetsTable extends Migration
|
class CreatePasswordResetsTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('password_resets', function (Blueprint $table) {
|
Schema::create('password_resets', function (Blueprint $table) {
|
||||||
@@ -15,6 +20,11 @@ class CreatePasswordResetsTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('password_resets');
|
Schema::dropIfExists('password_resets');
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
|
|
||||||
class CreateSessionsTable extends Migration
|
class CreateSessionsTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('sessions', function (Blueprint $table) {
|
Schema::create('sessions', function (Blueprint $table) {
|
||||||
@@ -18,6 +23,11 @@ class CreateSessionsTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('sessions');
|
Schema::dropIfExists('sessions');
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ use Illuminate\Database\Schema\Blueprint;
|
|||||||
|
|
||||||
class CreateAirlinesTable extends Migration
|
class CreateAirlinesTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('airlines', function (Blueprint $table) {
|
Schema::create('airlines', function (Blueprint $table) {
|
||||||
@@ -27,6 +32,11 @@ class CreateAirlinesTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('airlines');
|
Schema::dropIfExists('airlines');
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ use Illuminate\Database\Schema\Blueprint;
|
|||||||
|
|
||||||
class CreateFaresTable extends Migration
|
class CreateFaresTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('fares', function (Blueprint $table) {
|
Schema::create('fares', function (Blueprint $table) {
|
||||||
@@ -20,6 +25,11 @@ class CreateFaresTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('fares');
|
Schema::dropIfExists('fares');
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ use Illuminate\Database\Schema\Blueprint;
|
|||||||
|
|
||||||
class CreateFlightTables extends Migration
|
class CreateFlightTables extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('flights', function (Blueprint $table) {
|
Schema::create('flights', function (Blueprint $table) {
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ use Illuminate\Database\Schema\Blueprint;
|
|||||||
|
|
||||||
class CreateRanksTable extends Migration
|
class CreateRanksTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('ranks', function (Blueprint $table) {
|
Schema::create('ranks', function (Blueprint $table) {
|
||||||
@@ -25,6 +30,11 @@ class CreateRanksTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('ranks');
|
Schema::dropIfExists('ranks');
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
use App\Contracts\Migration;
|
use App\Contracts\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CreateSubfleetTables
|
||||||
|
*/
|
||||||
class CreateSubfleetTables extends Migration
|
class CreateSubfleetTables extends Migration
|
||||||
{
|
{
|
||||||
public function up()
|
public function up()
|
||||||
@@ -45,6 +48,11 @@ class CreateSubfleetTables extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('subfleets');
|
Schema::dropIfExists('subfleets');
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
|
|
||||||
class CreateBidsTable extends Migration
|
class CreateBidsTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('bids', function (Blueprint $table) {
|
Schema::create('bids', function (Blueprint $table) {
|
||||||
@@ -20,6 +25,11 @@ class CreateBidsTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('bids');
|
Schema::dropIfExists('bids');
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
|
|
||||||
class CreateJobsTable extends Migration
|
class CreateJobsTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('jobs', function (Blueprint $table) {
|
Schema::create('jobs', function (Blueprint $table) {
|
||||||
@@ -19,6 +24,11 @@ class CreateJobsTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('jobs');
|
Schema::dropIfExists('jobs');
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
|
|
||||||
class CreateFailedJobsTable extends Migration
|
class CreateFailedJobsTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||||
@@ -18,6 +23,11 @@ class CreateFailedJobsTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('failed_jobs');
|
Schema::dropIfExists('failed_jobs');
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
|
|
||||||
class CreateNavdataTables extends Migration
|
class CreateNavdataTables extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -26,6 +31,11 @@ class CreateNavdataTables extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('navdata');
|
Schema::dropIfExists('navdata');
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
|
|
||||||
class CreateAcarsTables extends Migration
|
class CreateAcarsTables extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('acars', function (Blueprint $table) {
|
Schema::create('acars', function (Blueprint $table) {
|
||||||
@@ -39,6 +44,11 @@ class CreateAcarsTables extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('acars');
|
Schema::dropIfExists('acars');
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
|
|
||||||
class CreateStatsTable extends Migration
|
class CreateStatsTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('stats', function (Blueprint $table) {
|
Schema::create('stats', function (Blueprint $table) {
|
||||||
@@ -20,6 +25,11 @@ class CreateStatsTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('stats');
|
Schema::dropIfExists('stats');
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ class CreateNewsTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::drop('news');
|
Schema::drop('news');
|
||||||
|
|||||||
@@ -3,10 +3,14 @@
|
|||||||
use App\Contracts\Migration;
|
use App\Contracts\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Modules\Awards\Awards\PilotFlightAwards;
|
|
||||||
|
|
||||||
class CreateAwardsTable extends Migration
|
class CreateAwardsTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('awards', function (Blueprint $table) {
|
Schema::create('awards', function (Blueprint $table) {
|
||||||
@@ -19,6 +23,7 @@ class CreateAwardsTable extends Migration
|
|||||||
// EG, the airports has an internal expense for gate costs
|
// EG, the airports has an internal expense for gate costs
|
||||||
$table->string('ref_model')->nullable();
|
$table->string('ref_model')->nullable();
|
||||||
$table->text('ref_model_params')->nullable();
|
$table->text('ref_model_params')->nullable();
|
||||||
|
//$table->string('ref_model_id', 36)->nullable();
|
||||||
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
@@ -33,20 +38,13 @@ class CreateAwardsTable extends Migration
|
|||||||
|
|
||||||
$table->index(['user_id', 'award_id']);
|
$table->index(['user_id', 'award_id']);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a default, sample award
|
|
||||||
*/
|
|
||||||
$award = [
|
|
||||||
'name' => 'Pilot 50 flights',
|
|
||||||
'description' => 'When a pilot has 50 flights, give this award',
|
|
||||||
'ref_model' => PilotFlightAwards::class,
|
|
||||||
'ref_model_params' => 50,
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->addAward($award);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('awards');
|
Schema::dropIfExists('awards');
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
|
|
||||||
class CreateJournalTransactionsTable extends Migration
|
class CreateJournalTransactionsTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('journal_transactions', function (Blueprint $table) {
|
Schema::create('journal_transactions', function (Blueprint $table) {
|
||||||
@@ -29,6 +34,11 @@ class CreateJournalTransactionsTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('journal_transactions');
|
Schema::dropIfExists('journal_transactions');
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
|
|
||||||
class CreateJournalsTable extends Migration
|
class CreateJournalsTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('journals', function (Blueprint $table) {
|
Schema::create('journals', function (Blueprint $table) {
|
||||||
@@ -19,6 +24,11 @@ class CreateJournalsTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('journals');
|
Schema::dropIfExists('journals');
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use App\Contracts\Migration;
|
||||||
use App\Contracts\Model;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@@ -15,7 +14,7 @@ class CreateFilesTable extends Migration
|
|||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('files', function (Blueprint $table) {
|
Schema::create('files', function (Blueprint $table) {
|
||||||
$table->string('id', Model::ID_MAX_LENGTH);
|
$table->string('id', \App\Contracts\Model::ID_MAX_LENGTH);
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->string('description')->nullable();
|
$table->string('description')->nullable();
|
||||||
$table->string('disk')->nullable();
|
$table->string('disk')->nullable();
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class AddReadonlyToRoles extends Migration
|
class AddReadonlyToRoles extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('roles', static function (Blueprint $table) {
|
Schema::table('roles', static function (Blueprint $table) {
|
||||||
@@ -19,6 +24,11 @@ class AddReadonlyToRoles extends Migration
|
|||||||
->update(['read_only' => true]);
|
->update(['read_only' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('roles', static function (Blueprint $table) {
|
Schema::table('roles', static function (Blueprint $table) {
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
/**
|
|
||||||
* Kinda of gross operations to change the pilot ID column
|
|
||||||
* 1. Add an `pilot_id` column, which will get populated with the current ID
|
|
||||||
* 2. Drop the `id` column, and then recreate it as a string field
|
|
||||||
* 3. Iterate through all of the users and set their `id` to the `pilot_id`
|
|
||||||
* 4. Change the other tables column types that reference `user_id`
|
|
||||||
*/
|
|
||||||
class UsersAddPilotId extends Migration
|
class UsersAddPilotId extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Kinda of gross operations to change the pilot ID column
|
||||||
|
* 1. Add an `pilot_id` column, which will get populated with the current ID
|
||||||
|
* 2. Drop the `id` column, and then recreate it as a string field
|
||||||
|
* 3. Iterate through all of the users and set their `id` to the `pilot_id`
|
||||||
|
* 4. Change the other tables column types that reference `user_id`
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('users', static function (Blueprint $table) {
|
Schema::table('users', static function (Blueprint $table) {
|
||||||
@@ -27,6 +29,11 @@ class UsersAddPilotId extends Migration
|
|||||||
DB::table('users')->update(['pilot_id' => DB::raw('`id`')]);
|
DB::table('users')->update(['pilot_id' => DB::raw('`id`')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateNotificationsTable extends Migration
|
class CreateNotificationsTable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('notifications', function (Blueprint $table) {
|
Schema::create('notifications', function (Blueprint $table) {
|
||||||
@@ -18,6 +23,11 @@ class CreateNotificationsTable extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('notifications');
|
Schema::dropIfExists('notifications');
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
|
||||||
use App\Models\Enums\PirepState;
|
use App\Models\Enums\PirepState;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
/**
|
|
||||||
* Change the PIREP state column to be a TINYINT
|
|
||||||
*/
|
|
||||||
class PirepsChangeStateType extends Migration
|
class PirepsChangeStateType extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Change the PIREP state column to be a TINYINT
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
// Migrate the old rejected state
|
// Migrate the old rejected state
|
||||||
@@ -23,4 +25,13 @@ class PirepsChangeStateType extends Migration
|
|||||||
$table->unsignedSmallInteger('state')->change();
|
$table->unsignedSmallInteger('state')->change();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,15 +5,27 @@ use Illuminate\Database\Migrations\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a `flight_id` column to the PIREPs table
|
|
||||||
*/
|
|
||||||
class PirepsAddFlightId extends Migration
|
class PirepsAddFlightId extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Add a `flight_id` column to the PIREPs table
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('pireps', function (Blueprint $table) {
|
Schema::table('pireps', function (Blueprint $table) {
|
||||||
$table->string('flight_id', Model::ID_MAX_LENGTH)->nullable()->after('aircraft_id');
|
$table->string('flight_id', Model::ID_MAX_LENGTH)->nullable()->after('aircraft_id');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('pireps', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('flight_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ use Illuminate\Database\Migrations\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a `flight_type` column to the expenses table
|
|
||||||
*/
|
|
||||||
class ExpensesAddFlightType extends Migration
|
class ExpensesAddFlightType extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Add a `flight_type` column to the expenses table
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('expenses', function (Blueprint $table) {
|
Schema::table('expenses', function (Blueprint $table) {
|
||||||
@@ -18,6 +18,11 @@ class ExpensesAddFlightType extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::table('expenses', function (Blueprint $table) {
|
Schema::table('expenses', function (Blueprint $table) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,4 +25,13 @@ class ModifyAirportsCoordinates extends Migration
|
|||||||
$table->decimal('lon', 11, 5)->change()->default(0.0)->nullable();
|
$table->decimal('lon', 11, 5)->change()->default(0.0)->nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8,10 +8,24 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
*/
|
*/
|
||||||
class FlightFieldNullable extends Migration
|
class FlightFieldNullable extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('flight_field_values', function ($table) {
|
Schema::table('flight_field_values', function ($table) {
|
||||||
$table->text('value')->change()->nullable();
|
$table->text('value')->change()->nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a `load_factor` and `load_factor_variance` columns to the expenses table
|
|
||||||
*/
|
|
||||||
class FlightsAddLoadFactor extends Migration
|
class FlightsAddLoadFactor extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Add a `load_factor` and `load_factor_variance` columns to the expenses table
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('flights', function (Blueprint $table) {
|
Schema::table('flights', function (Blueprint $table) {
|
||||||
@@ -22,6 +22,11 @@ class FlightsAddLoadFactor extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::table('flights', function (Blueprint $table) {
|
Schema::table('flights', function (Blueprint $table) {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
|
|
||||||
*/
|
|
||||||
class FlightsAddPilotPay extends Migration
|
class FlightsAddPilotPay extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('flights', function (Blueprint $table) {
|
Schema::table('flights', function (Blueprint $table) {
|
||||||
@@ -18,6 +18,11 @@ class FlightsAddPilotPay extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::table('flights', function (Blueprint $table) {
|
Schema::table('flights', function (Blueprint $table) {
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
|
||||||
use App\Models\Enums\FareType;
|
use App\Models\Enums\FareType;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
|
|
||||||
*/
|
|
||||||
class FaresAddType extends Migration
|
class FaresAddType extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('fares', function (Blueprint $table) {
|
Schema::table('fares', function (Blueprint $table) {
|
||||||
@@ -19,4 +19,16 @@ class FaresAddType extends Migration
|
|||||||
->after('capacity');
|
->after('capacity');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('fares', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('type');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@@ -33,4 +33,13 @@ class IncreaseIdLengths extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@@ -15,4 +15,13 @@ class RemoveSubfleetTypeIndex extends Migration
|
|||||||
$table->dropUnique(['type']);
|
$table->dropUnique(['type']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use App\Models\Enums\PageType;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@@ -11,6 +10,11 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
*/
|
*/
|
||||||
class CreatePages extends Migration
|
class CreatePages extends Migration
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('pages', function (Blueprint $table) {
|
Schema::create('pages', function (Blueprint $table) {
|
||||||
@@ -18,7 +22,7 @@ class CreatePages extends Migration
|
|||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->string('slug');
|
$table->string('slug');
|
||||||
$table->string('icon');
|
$table->string('icon');
|
||||||
$table->unsignedSmallInteger('type')->default(PageType::PAGE);
|
$table->unsignedSmallInteger('type');
|
||||||
$table->boolean('public');
|
$table->boolean('public');
|
||||||
$table->boolean('enabled');
|
$table->boolean('enabled');
|
||||||
$table->mediumText('body');
|
$table->mediumText('body');
|
||||||
@@ -28,6 +32,11 @@ class CreatePages extends Migration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('pages');
|
Schema::dropIfExists('pages');
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@@ -9,7 +9,11 @@ class AirlineRemoveNullable extends Migration
|
|||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('airlines', function (Blueprint $table) {
|
Schema::table('airlines', function (Blueprint $table) {
|
||||||
$table->dropUnique(['iata']);
|
$table->dropUnique('airlines_iata_unique');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@@ -12,4 +12,8 @@ class PageIconNullable extends Migration
|
|||||||
$table->string('icon')->change()->nullable();
|
$table->string('icon')->change()->nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a `link` column and make the body optional. Also add a "new_window" bool
|
|
||||||
* which determines if we open this link in a new window or not
|
|
||||||
*/
|
|
||||||
class PagesAddLink extends Migration
|
|
||||||
{
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
|
||||||
$table->string('body')->change()->nullable();
|
|
||||||
$table->string('link')
|
|
||||||
->default('')
|
|
||||||
->nullable()
|
|
||||||
->after('body');
|
|
||||||
|
|
||||||
$table->boolean('new_window')->default(false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::table('fares', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('link');
|
|
||||||
$table->dropColumn('new_window');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use App\Contracts\Model;
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add two tables for holding user fields and the values
|
|
||||||
*/
|
|
||||||
class CreateUserFields extends Migration
|
|
||||||
{
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Hold a master list of fields
|
|
||||||
*/
|
|
||||||
Schema::create('user_fields', function (Blueprint $table) {
|
|
||||||
$table->increments('id');
|
|
||||||
$table->string('name', 200);
|
|
||||||
$table->text('description')->nullable();
|
|
||||||
$table->boolean('show_on_registration')->default(false)->nullable();
|
|
||||||
$table->boolean('required')->default(false)->nullable();
|
|
||||||
$table->boolean('private')->default(false)->nullable();
|
|
||||||
$table->boolean('active')->default(true)->nullable();
|
|
||||||
$table->timestamps();
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The values for the actual fields
|
|
||||||
*/
|
|
||||||
Schema::create('user_field_values', function (Blueprint $table) {
|
|
||||||
$table->bigIncrements('id');
|
|
||||||
$table->unsignedBigInteger('user_field_id');
|
|
||||||
$table->string('user_id', Model::ID_MAX_LENGTH);
|
|
||||||
$table->text('value')->nullable();
|
|
||||||
$table->timestamps();
|
|
||||||
|
|
||||||
$table->index(['user_field_id', 'user_id']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a `mtow` column for the max takeoff weight
|
|
||||||
*/
|
|
||||||
class AircraftAddMtow extends Migration
|
|
||||||
{
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
Schema::table('aircraft', function (Blueprint $table) {
|
|
||||||
$table->unsignedDecimal('mtow')
|
|
||||||
->nullable()
|
|
||||||
->default(0.0)
|
|
||||||
->after('hex_code');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::table('aircraft', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('mtow');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
class CreateModulesTable extends Migration
|
|
||||||
{
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
Schema::create('modules', function (Blueprint $table) {
|
|
||||||
$table->increments('id');
|
|
||||||
$table->string('name');
|
|
||||||
$table->boolean('enabled')->default(1);
|
|
||||||
$table->timestamps();
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->addModule(['name' => 'Awards']);
|
|
||||||
$this->addModule(['name' => 'Sample']);
|
|
||||||
$this->addModule(['name' => 'VMSAcars']);
|
|
||||||
$this->addModule(['name' => 'Vacentral']);
|
|
||||||
$this->addModule(['name' => 'TestModule']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('modules');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Change the pages body column type to a Medium Text, max size of 16MB
|
|
||||||
*/
|
|
||||||
class ModifyPagesSize extends Migration
|
|
||||||
{
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
|
||||||
$table->mediumText('body')->change()->nullable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use App\Contracts\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Change the downloads link size
|
|
||||||
*/
|
|
||||||
class ModifyDownloadLinkSize extends Migration
|
|
||||||
{
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
Schema::table('files', function (Blueprint $table) {
|
|
||||||
$table->mediumText('disk')->change()->nullable();
|
|
||||||
$table->mediumText('path')->change()->nullable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Services\Installer\MigrationService;
|
|
||||||
use App\Services\Installer\SeederService;
|
use App\Services\Installer\SeederService;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class DatabaseSeeder extends Seeder
|
class DatabaseSeeder extends Seeder
|
||||||
{
|
{
|
||||||
/** @var MigrationService */
|
private $seederService;
|
||||||
private $migrationSvc;
|
|
||||||
|
|
||||||
/** @var SeederService */
|
|
||||||
private $seederSvc;
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->migrationSvc = app(MigrationService::class);
|
$this->seederService = app(SeederService::class);
|
||||||
$this->seederSvc = app(SeederService::class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,12 +19,6 @@ class DatabaseSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
// Make sure any migrations that need to be run are run/cleared out
|
$this->seederService->syncAllSeeds();
|
||||||
if ($this->migrationSvc->migrationsAvailable()) {
|
|
||||||
$this->migrationSvc->runAllMigrations();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then sync all of the seeds
|
|
||||||
$this->seederSvc->syncAllSeeds();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
local.yml
|
local.yml
|
||||||
vmsacars.yml
|
|
||||||
|
|||||||
@@ -12,11 +12,3 @@ airlines:
|
|||||||
active: 1
|
active: 1
|
||||||
created_at: now
|
created_at: now
|
||||||
updated_at: now
|
updated_at: now
|
||||||
- id: 2
|
|
||||||
icao: XXX
|
|
||||||
iata: XX
|
|
||||||
name: inactive airline
|
|
||||||
country: us
|
|
||||||
active: 0
|
|
||||||
created_at: now
|
|
||||||
updated_at: now
|
|
||||||
|
|||||||
@@ -1,10 +1,30 @@
|
|||||||
|
|
||||||
|
#airlines:
|
||||||
|
# - id: 1
|
||||||
|
# icao: VMS
|
||||||
|
# iata: VM
|
||||||
|
# name: phpvms airlines
|
||||||
|
# country: us
|
||||||
|
# active: 1
|
||||||
|
# created_at: now
|
||||||
|
# updated_at: now
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
id_column: name
|
id_column: name
|
||||||
data:
|
data:
|
||||||
- name: fleet-only
|
- name: fleet-only
|
||||||
display_name: Edit Fleet
|
display_name: Edit Fleet
|
||||||
|
|
||||||
|
awards:
|
||||||
|
- id: 1
|
||||||
|
name: Pilot 50 flights
|
||||||
|
description: When a pilot has 50 flights, give this award
|
||||||
|
image_url:
|
||||||
|
ref_model: Modules\Awards\Awards\PilotFlightAwards
|
||||||
|
ref_model_params: 50
|
||||||
|
created_at: now
|
||||||
|
updated_at: now
|
||||||
|
|
||||||
news:
|
news:
|
||||||
- id: 1
|
- id: 1
|
||||||
user_id: 1
|
user_id: 1
|
||||||
@@ -116,91 +136,34 @@ airports:
|
|||||||
ground_handling_cost: 50
|
ground_handling_cost: 50
|
||||||
#
|
#
|
||||||
aircraft:
|
aircraft:
|
||||||
-
|
- id: 1
|
||||||
id: 1
|
|
||||||
subfleet_id: 1
|
subfleet_id: 1
|
||||||
icao: null
|
|
||||||
iata: null
|
|
||||||
airport_id: KJFK
|
airport_id: KJFK
|
||||||
landing_time: '2020-10-23 07:50:16'
|
name: Boeing 747-438
|
||||||
name: 'Boeing 747-438'
|
|
||||||
registration: 001Z
|
registration: 001Z
|
||||||
hex_code: null
|
flight_time: 360
|
||||||
mtow: '0.00'
|
|
||||||
zfw: '0.00'
|
|
||||||
flight_time: 540
|
|
||||||
status: A
|
status: A
|
||||||
state: 0
|
- id: 2
|
||||||
created_at: null
|
|
||||||
updated_at: '2020-10-23 07:50:16'
|
|
||||||
-
|
|
||||||
id: 2
|
|
||||||
subfleet_id: 2
|
subfleet_id: 2
|
||||||
icao: null
|
|
||||||
iata: null
|
|
||||||
airport_id: LGRP
|
airport_id: LGRP
|
||||||
landing_time: null
|
name: Boeing 777-200
|
||||||
name: 'Boeing 777-200'
|
|
||||||
registration: C202
|
registration: C202
|
||||||
hex_code: null
|
|
||||||
mtow: '0.00'
|
|
||||||
zfw: '0.00'
|
|
||||||
flight_time: 260
|
flight_time: 260
|
||||||
status: A
|
status: A
|
||||||
state: 0
|
- id: 3
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
id: 3
|
|
||||||
subfleet_id: 1
|
subfleet_id: 1
|
||||||
icao: null
|
|
||||||
iata: null
|
|
||||||
airport_id: KAUS
|
airport_id: KAUS
|
||||||
landing_time: '2020-10-24 08:50:13'
|
name: Boeing 747-412
|
||||||
name: 'Boeing 747-412'
|
|
||||||
registration: S2333
|
registration: S2333
|
||||||
hex_code: null
|
|
||||||
mtow: '0.00'
|
|
||||||
zfw: '0.00'
|
|
||||||
flight_time: 180
|
|
||||||
status: A
|
|
||||||
state: 0
|
|
||||||
created_at: null
|
|
||||||
updated_at: '2020-10-24 08:50:13'
|
|
||||||
-
|
|
||||||
id: 4
|
|
||||||
subfleet_id: 1
|
|
||||||
icao: null
|
|
||||||
iata: null
|
|
||||||
airport_id: KAUS
|
|
||||||
landing_time: null
|
|
||||||
name: 'Boeing 747-436 RETIRED'
|
|
||||||
registration: null
|
|
||||||
hex_code: null
|
|
||||||
mtow: '0.00'
|
|
||||||
zfw: '0.00'
|
|
||||||
flight_time: 45
|
|
||||||
status: R
|
|
||||||
state: 0
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
id: 5
|
|
||||||
subfleet_id: 4
|
|
||||||
icao: A320
|
|
||||||
iata: '320'
|
|
||||||
airport_id: EGLL
|
|
||||||
landing_time: null
|
|
||||||
name: 'Airbus A320'
|
|
||||||
registration: N786DL
|
|
||||||
hex_code: b47165dd
|
|
||||||
mtow: '78800.00'
|
|
||||||
zfw: '62500.00'
|
|
||||||
flight_time: 0
|
flight_time: 0
|
||||||
status: A
|
status: A
|
||||||
state: 0
|
- id: 4
|
||||||
created_at: '2020-10-22 13:38:50'
|
subfleet_id: 1
|
||||||
updated_at: '2020-10-22 13:38:50'
|
airport_id: KAUS
|
||||||
|
name: Boeing 747-436 RETIRED
|
||||||
|
registration:
|
||||||
|
flight_time: 45
|
||||||
|
status: R
|
||||||
|
|
||||||
expenses:
|
expenses:
|
||||||
- name: Per-Flight (no muliplier)
|
- name: Per-Flight (no muliplier)
|
||||||
@@ -257,192 +220,68 @@ expenses:
|
|||||||
updated_at: now
|
updated_at: now
|
||||||
|
|
||||||
fares:
|
fares:
|
||||||
-
|
- id: 1
|
||||||
id: 1
|
code: Y
|
||||||
code: 'Y'
|
|
||||||
name: Economy
|
name: Economy
|
||||||
price: '100.00'
|
price: 100
|
||||||
cost: '0.00'
|
|
||||||
capacity: 200
|
capacity: 200
|
||||||
type: 0
|
- id: 2
|
||||||
notes: null
|
|
||||||
active: 1
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
id: 2
|
|
||||||
code: B
|
code: B
|
||||||
name: Business
|
name: Business
|
||||||
price: '500.00'
|
price: 500
|
||||||
cost: '0.00'
|
|
||||||
capacity: 10
|
capacity: 10
|
||||||
type: 0
|
- id: 3
|
||||||
notes: null
|
|
||||||
active: 1
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
id: 3
|
|
||||||
code: F
|
code: F
|
||||||
name: First-Class
|
name: First-Class
|
||||||
price: '800.00'
|
price: 800
|
||||||
cost: '0.00'
|
|
||||||
capacity: 5
|
capacity: 5
|
||||||
type: 0
|
|
||||||
notes: null
|
|
||||||
active: 1
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
|
|
||||||
subfleets:
|
subfleets:
|
||||||
-
|
- id: 1
|
||||||
id: 1
|
|
||||||
airline_id: 1
|
airline_id: 1
|
||||||
|
name: 747-43X RB211-524G
|
||||||
type: 744-3X-RB211
|
type: 744-3X-RB211
|
||||||
name: '747-43X RB211-524G'
|
cost_block_hour: 1000
|
||||||
cost_block_hour: '1000.00'
|
ground_handling_multiplier: 200
|
||||||
cost_delay_minute: '0.00'
|
- id: 2
|
||||||
fuel_type: null
|
|
||||||
ground_handling_multiplier: '200.00'
|
|
||||||
cargo_capacity: null
|
|
||||||
fuel_capacity: null
|
|
||||||
gross_weight: null
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
id: 2
|
|
||||||
airline_id: 1
|
airline_id: 1
|
||||||
|
name: 777-222ER GE90-76B
|
||||||
type: 772-22ER-GE90-76B
|
type: 772-22ER-GE90-76B
|
||||||
name: '777-222ER GE90-76B'
|
cost_block_hour: 500
|
||||||
cost_block_hour: '500.00'
|
ground_handling_multiplier: 150
|
||||||
cost_delay_minute: '0.00'
|
- id: 3
|
||||||
fuel_type: null
|
|
||||||
ground_handling_multiplier: '150.00'
|
|
||||||
cargo_capacity: null
|
|
||||||
fuel_capacity: null
|
|
||||||
gross_weight: null
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
id: 3
|
|
||||||
airline_id: 1
|
airline_id: 1
|
||||||
|
name: 777-367 ER GE90-115B
|
||||||
type: 772-36ER-GE90-115B
|
type: 772-36ER-GE90-115B
|
||||||
name: '777-367 ER GE90-115B'
|
cost_block_hour: 100
|
||||||
cost_block_hour: '100.00'
|
ground_handling_multiplier: 150
|
||||||
cost_delay_minute: '0.00'
|
|
||||||
fuel_type: null
|
|
||||||
ground_handling_multiplier: '150.00'
|
|
||||||
cargo_capacity: null
|
|
||||||
fuel_capacity: null
|
|
||||||
gross_weight: null
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
id: 4
|
|
||||||
airline_id: 1
|
|
||||||
type: A320
|
|
||||||
name: A320
|
|
||||||
cost_block_hour: '2300.00'
|
|
||||||
cost_delay_minute: null
|
|
||||||
fuel_type: 1
|
|
||||||
ground_handling_multiplier: '100.00'
|
|
||||||
cargo_capacity: null
|
|
||||||
fuel_capacity: null
|
|
||||||
gross_weight: null
|
|
||||||
created_at: '2020-10-22 13:36:49'
|
|
||||||
updated_at: '2020-10-22 13:36:49'
|
|
||||||
|
|
||||||
|
# add a few mods to aircraft and fares
|
||||||
subfleet_fare:
|
subfleet_fare:
|
||||||
-
|
|
||||||
subfleet_id: 1
|
# Fare classes on the 747
|
||||||
|
- subfleet_id: 1
|
||||||
fare_id: 1
|
fare_id: 1
|
||||||
price: '200'
|
price: 200
|
||||||
cost: null
|
capacity: 400
|
||||||
capacity: '400'
|
- subfleet_id: 1
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
subfleet_id: 1
|
|
||||||
fare_id: 2
|
fare_id: 2
|
||||||
price: 120%
|
price: 120%
|
||||||
cost: null
|
- subfleet_id: 1
|
||||||
capacity: null
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
subfleet_id: 1
|
|
||||||
fare_id: 3
|
fare_id: 3
|
||||||
price: '1000'
|
price: 1000
|
||||||
cost: null
|
|
||||||
capacity: 110%
|
capacity: 110%
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
# Fare classes on the 777
|
||||||
-
|
- subfleet_id: 2
|
||||||
subfleet_id: 2
|
|
||||||
fare_id: 1
|
fare_id: 1
|
||||||
price: null
|
- subfleet_id: 2
|
||||||
cost: null
|
|
||||||
capacity: null
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
subfleet_id: 2
|
|
||||||
fare_id: 3
|
fare_id: 3
|
||||||
price: null
|
capacity: 10
|
||||||
cost: null
|
|
||||||
capacity: '10'
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
subfleet_id: 4
|
|
||||||
fare_id: 1
|
|
||||||
price: null
|
|
||||||
cost: null
|
|
||||||
capacity: '123'
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
subfleet_id: 4
|
|
||||||
fare_id: 2
|
|
||||||
price: null
|
|
||||||
cost: null
|
|
||||||
capacity: '8'
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
-
|
|
||||||
subfleet_id: 4
|
|
||||||
fare_id: 3
|
|
||||||
price: null
|
|
||||||
cost: null
|
|
||||||
capacity: '2'
|
|
||||||
created_at: null
|
|
||||||
updated_at: null
|
|
||||||
subfleet_rank:
|
subfleet_rank:
|
||||||
-
|
- rank_id: 1
|
||||||
rank_id: 1
|
|
||||||
subfleet_id: 1
|
subfleet_id: 1
|
||||||
acars_pay: null
|
|
||||||
manual_pay: null
|
|
||||||
-
|
|
||||||
rank_id: 1
|
|
||||||
subfleet_id: 4
|
|
||||||
acars_pay: null
|
|
||||||
manual_pay: null
|
|
||||||
-
|
|
||||||
rank_id: 2
|
|
||||||
subfleet_id: 4
|
|
||||||
acars_pay: null
|
|
||||||
manual_pay: null
|
|
||||||
-
|
|
||||||
rank_id: 3
|
|
||||||
subfleet_id: 4
|
|
||||||
acars_pay: null
|
|
||||||
manual_pay: null
|
|
||||||
-
|
|
||||||
rank_id: 4
|
|
||||||
subfleet_id: 4
|
|
||||||
acars_pay: null
|
|
||||||
manual_pay: null
|
|
||||||
|
|
||||||
flights:
|
flights:
|
||||||
- id: flightid_1
|
- id: flightid_1
|
||||||
@@ -520,35 +359,6 @@ flights:
|
|||||||
route: 'MLY5 KEMBO UG442 SIA UG633 OTEKO UR640 NALRO GUBEL3'
|
route: 'MLY5 KEMBO UG442 SIA UG633 OTEKO UR640 NALRO GUBEL3'
|
||||||
created_at: NOW
|
created_at: NOW
|
||||||
updated_at: NOW
|
updated_at: NOW
|
||||||
-
|
|
||||||
id: q8mvZ5vdExoy0mQG
|
|
||||||
airline_id: 1
|
|
||||||
flight_number: 3003
|
|
||||||
route_code: null
|
|
||||||
route_leg: null
|
|
||||||
dpt_airport_id: KSEA
|
|
||||||
arr_airport_id: KPAE
|
|
||||||
alt_airport_id: null
|
|
||||||
dpt_time: '8:00'
|
|
||||||
arr_time: '8:45'
|
|
||||||
level: null
|
|
||||||
distance: '27.51'
|
|
||||||
flight_time: 45
|
|
||||||
flight_type: J
|
|
||||||
load_factor: null
|
|
||||||
load_factor_variance: null
|
|
||||||
route: null
|
|
||||||
pilot_pay: null
|
|
||||||
notes: null
|
|
||||||
scheduled: 0
|
|
||||||
days: null
|
|
||||||
start_date: null
|
|
||||||
end_date: null
|
|
||||||
has_bid: 1
|
|
||||||
active: 1
|
|
||||||
visible: 1
|
|
||||||
created_at: now
|
|
||||||
updated_at: now
|
|
||||||
|
|
||||||
flight_fields:
|
flight_fields:
|
||||||
- name: Departure Terminal
|
- name: Departure Terminal
|
||||||
@@ -579,24 +389,12 @@ flight_subfleet:
|
|||||||
flight_id: flightid_4
|
flight_id: flightid_4
|
||||||
|
|
||||||
bids:
|
bids:
|
||||||
-
|
- id: 100
|
||||||
id: 100
|
|
||||||
user_id: 1
|
user_id: 1
|
||||||
flight_id: flightid_1
|
flight_id: flightid_1
|
||||||
created_at: now
|
- id: 101
|
||||||
updated_at: now
|
|
||||||
-
|
|
||||||
id: 101
|
|
||||||
user_id: 1
|
user_id: 1
|
||||||
flight_id: flightid_3
|
flight_id: flightid_3
|
||||||
created_at: now
|
|
||||||
updated_at: now
|
|
||||||
-
|
|
||||||
id: 102
|
|
||||||
user_id: 1
|
|
||||||
flight_id: q8mvZ5vdExoy0mQG
|
|
||||||
created_at: now
|
|
||||||
updated_at: now
|
|
||||||
|
|
||||||
pireps:
|
pireps:
|
||||||
- id: pirepid_1
|
- id: pirepid_1
|
||||||
|
|||||||
@@ -69,33 +69,3 @@ role_user:
|
|||||||
- user_id: 3
|
- user_id: 3
|
||||||
role_id: 2
|
role_id: 2
|
||||||
user_type: App\Models\User
|
user_type: App\Models\User
|
||||||
|
|
||||||
user_fields:
|
|
||||||
- id: 1
|
|
||||||
name: 'VATSIM ID'
|
|
||||||
show_on_registration: true
|
|
||||||
required: false
|
|
||||||
private: false
|
|
||||||
- id: 2
|
|
||||||
name: 'Referral'
|
|
||||||
description: 'Who referred you'
|
|
||||||
show_on_registration: true
|
|
||||||
required: false
|
|
||||||
private: true
|
|
||||||
|
|
||||||
user_field_values:
|
|
||||||
- id: 1
|
|
||||||
user_field_id: 1
|
|
||||||
user_id: 1
|
|
||||||
value: 'my vatsim id'
|
|
||||||
- id: 2
|
|
||||||
user_field_id: 2
|
|
||||||
user_id: 1
|
|
||||||
value: 'Nobody did'
|
|
||||||
|
|
||||||
user_awards:
|
|
||||||
- id: 1
|
|
||||||
user_id: 1
|
|
||||||
award_id: 1
|
|
||||||
created_at: now
|
|
||||||
updated_at: now
|
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
- name: 'Awards'
|
|
||||||
enabled: 1
|
|
||||||
- name: 'Sample'
|
|
||||||
enabled: 1
|
|
||||||
- name: 'VMSAcars'
|
|
||||||
enabled: 1
|
|
||||||
- name: 'Vacentral'
|
|
||||||
enabled: 1
|
|
||||||
- name: 'TestModule'
|
|
||||||
enabled: 1
|
|
||||||
@@ -3,9 +3,6 @@
|
|||||||
- name: admin-access
|
- name: admin-access
|
||||||
display_name: Admin Panel
|
display_name: Admin Panel
|
||||||
description: Access the admin panel
|
description: Access the admin panel
|
||||||
- name: aircraft
|
|
||||||
display_name: Aircraft
|
|
||||||
description: Create/edit aircraft
|
|
||||||
- name: airlines
|
- name: airlines
|
||||||
display_name: Airlines
|
display_name: Airlines
|
||||||
description: Create/edit airlines
|
description: Create/edit airlines
|
||||||
@@ -51,6 +48,3 @@
|
|||||||
- name: maintenance
|
- name: maintenance
|
||||||
display_name: Maintenance
|
display_name: Maintenance
|
||||||
description: Run maintenance tasks
|
description: Run maintenance tasks
|
||||||
- name: modules
|
|
||||||
display_name: Modules
|
|
||||||
description: Add/Edit Modules
|
|
||||||
|
|||||||
@@ -26,13 +26,6 @@
|
|||||||
options:
|
options:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: If an airport isn't added, try to look it up when adding schedules
|
description: If an airport isn't added, try to look it up when adding schedules
|
||||||
- key: general.allow_unadded_airports
|
|
||||||
name: 'Allow unadded airports'
|
|
||||||
group: general
|
|
||||||
value: false
|
|
||||||
options:
|
|
||||||
type: boolean
|
|
||||||
description: If an un-added airport is used, it is looked up and added
|
|
||||||
- key: general.check_prerelease_version
|
- key: general.check_prerelease_version
|
||||||
name: 'Pre-release versions in version check'
|
name: 'Pre-release versions in version check'
|
||||||
group: general
|
group: general
|
||||||
@@ -130,20 +123,6 @@
|
|||||||
options: ''
|
options: ''
|
||||||
type: int
|
type: int
|
||||||
description: 'Initial zoom level on the map'
|
description: 'Initial zoom level on the map'
|
||||||
- key: airports.default_ground_handling_cost
|
|
||||||
name: 'Default Ground Handling Cost'
|
|
||||||
group: airports
|
|
||||||
value: 250
|
|
||||||
options:
|
|
||||||
type: int
|
|
||||||
description: If an airport's Ground Handling Cost Cost isn't added, set this value by default
|
|
||||||
- key: airports.default_jet_a_fuel_cost
|
|
||||||
name: 'Default Jet A Fuel Cost'
|
|
||||||
group: airports
|
|
||||||
value: 0.7
|
|
||||||
options:
|
|
||||||
type: text
|
|
||||||
description: If an airport's Jet A Fuel Cost isn't added, set this value by default
|
|
||||||
- key: bids.disable_flight_on_bid
|
- key: bids.disable_flight_on_bid
|
||||||
name: 'Disable flight on bid'
|
name: 'Disable flight on bid'
|
||||||
group: bids
|
group: bids
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Events;
|
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\Acars;
|
|
||||||
use App\Models\Pirep;
|
|
||||||
|
|
||||||
class AcarsUpdate extends Event
|
|
||||||
{
|
|
||||||
/** @var Pirep */
|
|
||||||
public $pirep;
|
|
||||||
|
|
||||||
/** @var Acars */
|
|
||||||
public $acars;
|
|
||||||
|
|
||||||
public function __construct(Pirep $pirep, Acars $acars)
|
|
||||||
{
|
|
||||||
$this->pirep = $pirep;
|
|
||||||
$this->acars = $acars;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,11 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
class BaseEvent
|
||||||
* @deprecated Extend App\Contracts\Event directly
|
|
||||||
*/
|
|
||||||
class BaseEvent extends Event
|
|
||||||
{
|
{
|
||||||
|
use Dispatchable;
|
||||||
|
use InteractsWithSockets;
|
||||||
|
use SerializesModels;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
class CronHourly extends BaseEvent
|
||||||
|
|
||||||
class CronHourly extends Event
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is dispatched when the monthly cron is run
|
* This event is dispatched when the monthly cron is run
|
||||||
* It happens after all of the default nightly tasks
|
* It happens after all of the default nightly tasks
|
||||||
*/
|
*/
|
||||||
class CronMonthly extends Event
|
class CronMonthly extends BaseEvent
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is dispatched when the daily cron is run
|
* This event is dispatched when the daily cron is run
|
||||||
* It happens after all of the default nightly tasks
|
* It happens after all of the default nightly tasks
|
||||||
*/
|
*/
|
||||||
class CronNightly extends Event
|
class CronNightly extends BaseEvent
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is dispatched when the weekly cron is run
|
* This event is dispatched when the weekly cron is run
|
||||||
* It happens after all of the default nightly tasks
|
* It happens after all of the default nightly tasks
|
||||||
*/
|
*/
|
||||||
class CronWeekly extends Event
|
class CronWeekly extends BaseEvent
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,7 +25,7 @@ use App\Models\Pirep;
|
|||||||
*
|
*
|
||||||
* The event will have a copy of the PIREP model, if it's applicable
|
* The event will have a copy of the PIREP model, if it's applicable
|
||||||
*/
|
*/
|
||||||
class Expenses extends Event
|
class Expenses extends BaseEvent
|
||||||
{
|
{
|
||||||
public $pirep;
|
public $pirep;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\News;
|
use App\Models\News;
|
||||||
|
|
||||||
class NewsAdded extends Event
|
class NewsAdded extends BaseEvent
|
||||||
{
|
{
|
||||||
public $news;
|
public $news;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
|
|
||||||
class PirepAccepted extends Event
|
class PirepAccepted extends BaseEvent
|
||||||
{
|
{
|
||||||
public $pirep;
|
public $pirep;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
|
|
||||||
class PirepCancelled extends Event
|
class PirepCancelled extends BaseEvent
|
||||||
{
|
{
|
||||||
public $pirep;
|
public $pirep;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
|
|
||||||
class PirepFiled extends Event
|
class PirepFiled extends BaseEvent
|
||||||
{
|
{
|
||||||
public $pirep;
|
public $pirep;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
|
|
||||||
class PirepPrefiled extends Event
|
class PirepPrefiled extends BaseEvent
|
||||||
{
|
{
|
||||||
public $pirep;
|
public $pirep;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
|
|
||||||
class PirepRejected extends Event
|
class PirepRejected extends BaseEvent
|
||||||
{
|
{
|
||||||
public $pirep;
|
public $pirep;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
|
|
||||||
class PirepUpdated extends Event
|
class PirepUpdated extends BaseEvent
|
||||||
{
|
{
|
||||||
public $pirep;
|
public $pirep;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
class TestEvent extends Event
|
class TestEvent extends BaseEvent
|
||||||
{
|
{
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
class UserAccepted extends Event
|
class UserAccepted extends BaseEvent
|
||||||
{
|
{
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
class UserRegistered extends Event
|
class UserRegistered extends BaseEvent
|
||||||
{
|
{
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event triggered when a user's state changes
|
* Event triggered when a user's state changes
|
||||||
*/
|
*/
|
||||||
class UserStateChanged extends Event
|
class UserStateChanged extends BaseEvent
|
||||||
{
|
{
|
||||||
public $old_state;
|
public $old_state;
|
||||||
public $user;
|
public $user;
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
use App\Contracts\Event;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
class UserStatsChanged extends Event
|
class UserStatsChanged extends BaseEvent
|
||||||
{
|
{
|
||||||
public $stat_name;
|
public $stat_name;
|
||||||
public $old_value;
|
public $old_value;
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Exceptions;
|
|
||||||
|
|
||||||
use App\Models\Aircraft;
|
|
||||||
|
|
||||||
class AircraftInvalid extends AbstractHttpException
|
|
||||||
{
|
|
||||||
public const MESSAGE = 'The supplied aircraft is invalid';
|
|
||||||
|
|
||||||
private $aircraft;
|
|
||||||
|
|
||||||
public function __construct(Aircraft $aircraft)
|
|
||||||
{
|
|
||||||
$this->aircraft = $aircraft;
|
|
||||||
parent::__construct(
|
|
||||||
400,
|
|
||||||
static::MESSAGE
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the RFC 7807 error type (without the URL root)
|
|
||||||
*/
|
|
||||||
public function getErrorType(): string
|
|
||||||
{
|
|
||||||
return 'aircraft-invalid';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the detailed error string
|
|
||||||
*/
|
|
||||||
public function getErrorDetails(): string
|
|
||||||
{
|
|
||||||
return $this->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an array with the error details, merged with the RFC7807 response
|
|
||||||
*/
|
|
||||||
public function getErrorMetadata(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'aircraft_id' => optional($this->aircraft)->id,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,13 +3,13 @@
|
|||||||
namespace App\Exceptions\Converters;
|
namespace App\Exceptions\Converters;
|
||||||
|
|
||||||
use App\Exceptions\AbstractHttpException;
|
use App\Exceptions\AbstractHttpException;
|
||||||
use Throwable;
|
use Exception;
|
||||||
|
|
||||||
class GenericExceptionAbstract extends AbstractHttpException
|
class GenericExceptionAbstract extends AbstractHttpException
|
||||||
{
|
{
|
||||||
private $exception;
|
private $exception;
|
||||||
|
|
||||||
public function __construct(Throwable $exception)
|
public function __construct(Exception $exception)
|
||||||
{
|
{
|
||||||
$this->exception = $exception;
|
$this->exception = $exception;
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class ValidationException extends AbstractHttpException
|
|||||||
|
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
400,
|
400,
|
||||||
'Validation Error'
|
'Validation exception'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+37
-10
@@ -5,7 +5,8 @@ namespace App\Exceptions;
|
|||||||
use App\Exceptions\Converters\GenericExceptionAbstract;
|
use App\Exceptions\Converters\GenericExceptionAbstract;
|
||||||
use App\Exceptions\Converters\SymfonyException;
|
use App\Exceptions\Converters\SymfonyException;
|
||||||
use App\Exceptions\Converters\ValidationException;
|
use App\Exceptions\Converters\ValidationException;
|
||||||
use App\Http\Middleware\SetActiveTheme;
|
use Exception;
|
||||||
|
use Illuminate\Auth\Access\AuthorizationException;
|
||||||
use Illuminate\Auth\AuthenticationException;
|
use Illuminate\Auth\AuthenticationException;
|
||||||
use Illuminate\Contracts\Container\BindingResolutionException;
|
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
@@ -14,9 +15,10 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Session\TokenMismatchException;
|
use Illuminate\Session\TokenMismatchException;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Validation\ValidationException as IlluminateValidationException;
|
use Illuminate\Validation\ValidationException as IlluminateValidationException;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException as SymfonyHttpException;
|
use Symfony\Component\HttpKernel\Exception\HttpException as SymfonyHttpException;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Throwable;
|
|
||||||
use Whoops\Handler\HandlerInterface;
|
use Whoops\Handler\HandlerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,19 +42,19 @@ class Handler extends ExceptionHandler
|
|||||||
/**
|
/**
|
||||||
* Render an exception into an HTTP response.
|
* Render an exception into an HTTP response.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param \Throwable $exception
|
* @param Exception $exception
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function render($request, Throwable $exception)
|
public function render($request, Exception $exception)
|
||||||
{
|
{
|
||||||
if ($request->is('api/*')) {
|
if ($request->is('api/*')) {
|
||||||
return $this->handleApiError($request, $exception);
|
return $this->handleApiError($request, $exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
(new SetActiveTheme())->setTheme($request);
|
if ($exception instanceof AbstractHttpException
|
||||||
if ($exception instanceof AbstractHttpException && $exception->getStatusCode() === 403) {
|
&& $exception->getStatusCode() === 403) {
|
||||||
return redirect()->guest('login');
|
return redirect()->guest('login');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,11 +65,11 @@ class Handler extends ExceptionHandler
|
|||||||
* Handle errors in the API
|
* Handle errors in the API
|
||||||
*
|
*
|
||||||
* @param $request
|
* @param $request
|
||||||
* @param \Throwable $exception
|
* @param \Exception $exception
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
|
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
private function handleApiError($request, Throwable $exception)
|
private function handleApiError($request, Exception $exception)
|
||||||
{
|
{
|
||||||
Log::error('API Error', $exception->getTrace());
|
Log::error('API Error', $exception->getTrace());
|
||||||
|
|
||||||
@@ -116,13 +118,38 @@ class Handler extends ExceptionHandler
|
|||||||
{
|
{
|
||||||
if ($request->expectsJson() || $request->is('api/*')) {
|
if ($request->expectsJson() || $request->is('api/*')) {
|
||||||
$error = new Unauthenticated();
|
$error = new Unauthenticated();
|
||||||
|
|
||||||
return $error->getResponse();
|
return $error->getResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->guest('login');
|
return redirect()->guest('login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the given HttpException.
|
||||||
|
*
|
||||||
|
* @param AbstractHttpException $e
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response|Response
|
||||||
|
*/
|
||||||
|
protected function renderHttpException(HttpExceptionInterface $e)
|
||||||
|
{
|
||||||
|
$status = $e->getStatusCode();
|
||||||
|
view()->replaceNamespace('errors', [
|
||||||
|
resource_path('views/layouts/'.setting('general.theme', 'default').'/errors'),
|
||||||
|
resource_path('views/errors'),
|
||||||
|
__DIR__.'/views',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (view()->exists("errors::{$status}")) {
|
||||||
|
return response()->view("errors::{$status}", [
|
||||||
|
'exception' => $e,
|
||||||
|
'SKIN_NAME' => setting('general.theme', 'default'),
|
||||||
|
], $status, $e->getHeaders());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->convertExceptionToResponse($e);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ignition error page integration
|
* Ignition error page integration
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Exceptions;
|
|
||||||
|
|
||||||
class ModuleExistsException extends AbstractHttpException
|
|
||||||
{
|
|
||||||
private $module_name;
|
|
||||||
|
|
||||||
public function __construct($module_name)
|
|
||||||
{
|
|
||||||
$this->module_name = $module_name;
|
|
||||||
parent::__construct(
|
|
||||||
409,
|
|
||||||
'Module '.$module_name.' Already Exists!'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the RFC 7807 error type (without the URL root)
|
|
||||||
*/
|
|
||||||
public function getErrorType(): string
|
|
||||||
{
|
|
||||||
return 'module-already-exists';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the detailed error string
|
|
||||||
*/
|
|
||||||
public function getErrorDetails(): string
|
|
||||||
{
|
|
||||||
return $this->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an array with the error details, merged with the RFC7807 response
|
|
||||||
*/
|
|
||||||
public function getErrorMetadata(): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Exceptions;
|
|
||||||
|
|
||||||
class ModuleInstallationError extends AbstractHttpException
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct(
|
|
||||||
500,
|
|
||||||
'Installation of Module Failed!'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the RFC 7807 error type (without the URL root)
|
|
||||||
*/
|
|
||||||
public function getErrorType(): string
|
|
||||||
{
|
|
||||||
return 'module-installation-error';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the detailed error string
|
|
||||||
*/
|
|
||||||
public function getErrorDetails(): string
|
|
||||||
{
|
|
||||||
return $this->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an array with the error details, merged with the RFC7807 response
|
|
||||||
*/
|
|
||||||
public function getErrorMetadata(): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Exceptions;
|
|
||||||
|
|
||||||
class ModuleInvalidFileType extends AbstractHttpException
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct(
|
|
||||||
415,
|
|
||||||
'The Module File Type is Invalid!'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the RFC 7807 error type (without the URL root)
|
|
||||||
*/
|
|
||||||
public function getErrorType(): string
|
|
||||||
{
|
|
||||||
return 'module-file-type-invalid';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the detailed error string
|
|
||||||
*/
|
|
||||||
public function getErrorDetails(): string
|
|
||||||
{
|
|
||||||
return $this->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an array with the error details, merged with the RFC7807 response
|
|
||||||
*/
|
|
||||||
public function getErrorMetadata(): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user