Compare commits

..

2 Commits

Author SHA1 Message Date
Nabeel Shahzad
aa8cda89d6 Change model 2020-10-29 12:06:20 -04:00
Nabeel Shahzad
5ba65cf2d1 Initial pirep fares changes #903 2020-10-28 17:11:05 -04:00
469 changed files with 42426 additions and 49952 deletions

View File

@@ -1,36 +0,0 @@
#!/usr/bin/env bash
if test "$GIT_TAG_NAME"; then
export VERSION=$GIT_TAG_NAME
# Pass in the tag as the version to write out
php artisan phpvms:version --write --write-full-version "${VERSION}"
export FULL_VERSION=$(php artisan phpvms:version)
else
export BRANCH=${GITHUB_REF##*/}
echo "On branch $BRANCH"
# Write the version out but place the branch ID in there
# This is only for the dev branch
export BASE_VERSION=$(php artisan phpvms:version --base-only)
# This now includes the pre-release version, so "-dev" by default
export VERSION=${BASE_VERSION}
# Don't pass in a version here, just write out the latest hash
php artisan phpvms:version --write "${VERSION}"
export FULL_VERSION=$(php artisan phpvms:version)
fi
export FILE_NAME="phpvms-${VERSION}"
export TAR_NAME="$FILE_NAME.tar.gz"
export ZIP_NAME="$FILE_NAME.zip"
export BASE_DIR=`pwd`
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#environment-files
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
echo "FILE_NAME=${FILE_NAME}" >> $GITHUB_ENV
echo "TAR_NAME=${TAR_NAME}" >> $GITHUB_ENV
echo "ZIP_NAME=${ZIP_NAME}" >> $GITHUB_ENV
echo "BASE_DIR=${BASE_DIR}" >> $GITHUB_ENV
echo "DISCORD_MSG=Version ${FULL_VERSION} is available, download: [zip](http://downloads.phpvms.net/$ZIP_NAME) | [tar](http://downloads.phpvms.net/$TAR_NAME)" >> $GITHUB_ENV

View File

@@ -1,248 +0,0 @@
name: 'Build'
on: ['push', 'pull_request', 'workflow_dispatch', 'release']
jobs:
build:
runs-on: ubuntu-18.04
if: github.repository == 'nabeelio/phpvms'
strategy:
fail-fast: true
matrix:
php-versions: ['7.3', '7.4', '8.0']
name: PHP ${{ matrix.php-versions }}
env:
extensions: intl, pcov, mbstring
key: cache-v1
steps:
- name: Checkout
uses: actions/checkout@v2
# Configure Caching
- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: Cache extensions
uses: actions/cache@v1
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
# Configure PHP
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
ini-values: post_max_size=256M, short_open_tag=On
coverage: xdebug
tools: php-cs-fixer, phpunit
- name: Shutdown Ubuntu MySQL
run: sudo service mysql stop
- name: Install MariaDB
uses: getong/mariadb-action@v1.1
with:
character set server: 'utf8'
collation server: 'utf8_general_ci'
mysql database: 'phpvms'
mysql root password: ''
mysql user: ''
mysql password: ''
- name: Configure Environment
run: |
php --version
mysql --version
# Downgrade composer version to 1.x
composer install --dev --no-interaction --verbose
cp .github/scripts/env.php env.php
cp .github/scripts/phpunit.xml phpunit.xml
php artisan database:create --reset
php artisan migrate:refresh --seed
- name: Run Tests
run: |
vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --diff --using-cache=no
vendor/bin/phpunit --debug --verbose
# This runs after all of the tests, run have run. Creates a cleaned up version of the
# distro, and then creates the artifact to push up to S3 or wherever
artifacts:
name: 'Create dev build'
needs: build
runs-on: 'ubuntu-18.04'
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- uses: olegtarasov/get-tag@v2.1
id: tagName
# Configure Caching
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
# Dependencies
- name: 'Install Release Dependencies'
run: |
rm -rf vendor
sudo npm i tar-to-zip -g
composer install --no-dev --prefer-dist --no-interaction --verbose
sudo chmod +x ./.github/scripts/*
- name: Get version
run: .github/scripts/version.sh
- name: Build Distro
run: .github/scripts/build.sh
- name: Upload S3
uses: shallwefootball/s3-upload-action@v1.1.3
with:
aws_key_id: ${{ secrets.S3_BUILD_ARTIFACTS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.S3_BUILD_ARTIFACTS_SECRET_ACCESS_KEY}}
aws_bucket: ${{ secrets.S3_BUCKET_NAME }}
source_dir: 'dist'
destination_dir: ''
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.0
with:
# DISCORD_MSG is defined in versions.sh
args: '{{ DISCORD_MSG }}'
# This runs after all of the tests, run have run. Creates a cleaned up version of the
# distro, and then creates the artifact to push up to S3 or wherever
# https://github.com/actions/create-release
release:
name: 'Create Release'
needs: build
runs-on: 'ubuntu-18.04'
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- uses: olegtarasov/get-tag@v2.1
id: tagName
# Configure Caching
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
# Dependencies
- name: 'Install Release Dependencies'
run: |
rm -rf vendor
sudo npm i tar-to-zip -g
composer install --no-dev --prefer-dist --no-interaction --verbose
sudo chmod +x ./.github/scripts/*
- name: Get version
run: .github/scripts/version.sh
- name: Build Distro
run: .github/scripts/build.sh
- name: Upload S3
uses: shallwefootball/s3-upload-action@v1.1.3
with:
aws_key_id: ${{ secrets.S3_BUILD_ARTIFACTS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.S3_BUILD_ARTIFACTS_SECRET_ACCESS_KEY}}
aws_bucket: ${{ secrets.S3_BUCKET_NAME }}
source_dir: 'dist'
destination_dir: ''
- name: Checkout code
uses: actions/checkout@v2
- name: Get version
run: .github/scripts/version.sh
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
# Upload the tar file to the release
- name: Upload Tar Asset
id: upload-tar-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/{{TAR_NAME}}
asset_name: '{{ TAR_NAME }}'
asset_content_type: application/gzip
# upload the zip file to the release
- name: Upload Zip Asset
id: upload-zip-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/{{ZIP_NAME}}
asset_name: '{{ ZIP_NAME }}'
asset_content_type: application/zip
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.0
with:
# DISCORD_MSG is defined in versions.sh
args: '{{ DISCORD_MSG }}'

1
.gitignore vendored
View File

@@ -74,5 +74,4 @@ error_log
.sass-cache
.DS_Store
/config.php
/config.bak.php
/VERSION

View File

@@ -28,8 +28,6 @@ RedirectMatch 403 ^/composer.phar
RedirectMatch 403 ^/env.php.*?$
RedirectMatch 403 ^/env.php
RedirectMatch 403 ^/env.php$
RedirectMatch 403 ^/config.php$
RedirectMatch 403 ^/config.bak.php$
RedirectMatch 403 ^/Makefile
RedirectMatch 403 ^/package.json
RedirectMatch 403 ^/package-lock.json

160
.travis.yml Normal file
View File

@@ -0,0 +1,160 @@
#
# Travis CI config file
#
language: php
php:
- '7.4'
- '7.3'
#env:
# - DB=mysql
# - DB=mariadb
cache:
# Cache lives for 10 min
# Default of 3m might not be long enough for all the runs
timeout: 600
directories:
- "$HOME/.composer/cache"
- "$HOME/.npm"
services:
- mysql
#addons:
# mariadb: '10.2'
install:
- php --version
- mysql --version
- composer install --dev --no-interaction --verbose
- npm i tar-to-zip -g
- cp .travis/env.travis.php env.php
- cp .travis/phpunit.travis.xml phpunit.xml
before_script:
- php artisan database:create --reset
- php artisan migrate:refresh --seed
script:
- vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --diff --using-cache=no
- vendor/bin/phpunit --debug --verbose
after_failure:
- cat storage/logs/*.log
# Refer to: https://github.com/doctrine/dbal/blob/master/.travis.yml#L39
jobs:
include:
# Different test stages
# - stage: Test
# name: PHP 7.2 + MySQL 5.7
# php: 7.2
# env: DB=mysql
# services:
# - mysql
# - stage: Test
# name: PHP 7.3 + MySQL 5.7
# php: 7.3
# env: DB=mysql
# services:
# - mysql
# - stage: Test
# name: PHP 7.4 + MySQL 5.7
# php: 7.4
# env: DB=mysql
# services:
# - mysql
# - stage: Test
# name: PHP 7.2 + MariaDB 10.1
# php: 7.2
# env: DB=mariadb
# addons:
# mariadb: '10.1'
# - stage: Test
# name: PHP 7.3 + MariaDB 10.1
# php: 7.3
# env: DB=mariadb
# addons:
# mariadb: '10.1'
# - stage: Test
# name: PHP 7.4 + MariaDB 10.1
# php: 7.4
# env: DB=mariadb MARIADB_VERSION=10.1
# addons:
# mariadb: '10.1'
# - stage: Test
# name: PHP 7.2 + MariaDB 10.2
# php: 7.2
# env: DB=mariadb
# addons:
# mariadb: '10.2'
# - stage: Test
# name: PHP 7.3 + MariaDB 10.3
# php: 7.3
# env: DB=mariadb
# addons:
# mariadb: '10.2'
# - stage: Test
# name: PHP 7.4 + MariaDB 10.2
# php: 7.4
# env: DB=mariadb
# addons:
# mariadb: '10.2'
# - stage: Test
# name: PHP 7.2 + MariaDB 10.3
# php: 7.2
# env: DB=mariadb
# addons:
# mariadb: '10.3'
# - stage: Test
# name: PHP 7.3 + MariaDB 10.3
# php: 7.3
# env: DB=mariadb
# addons:
# mariadb: '10.3'
# - stage: Test
# name: PHP 7.4 + MariaDB 10.3
# php: 7.4
# env: DB=mariadb
# addons:
# mariadb: '10.3'
# Just packages up a release
- stage: package
script: skip
before_deploy:
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/6b10798/install | bash
# Configure the conditional deployment
# https://docs.travis-ci.com/user/deployment/#examples-of-conditional-deployment
deploy:
- provider: script
skip_cleanup: true
script: ./.travis/deploy_script.sh
on:
all_branches: true
repo: nabeelio/phpvms
php: '7.4'
tags: false
# RELEASE STAGE
# Only runs when there's a tag applied to this release (tag should be the version)
# This uses Github Releases and posts it there (provider: releases)
# https://docs.travis-ci.com/user/deployment/releases
- stage: release
script: skip
before_deploy:
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/6b10798/install | bash
- ./.travis/deploy_script.sh
deploy:
provider: releases
skip_cleanup: true
api_key: $GITHUB_TOKEN
file_glob: true
file: build/*
on:
tags: true
repo: nabeelio/phpvms
php: '7.4'

85
.github/scripts/build.sh → .travis/deploy_script.sh Normal file → Executable file
View File

@@ -1,12 +1,52 @@
#!/usr/bin/env bash
if [ "$TRAVIS" != "true" ]; then
exit 0
fi
cd $TRAVIS_BUILD_DIR
if test "$TRAVIS_TAG"; then
VERSION=$TRAVIS_TAG
# Pass in the tag as the version to write out
php artisan phpvms:version --write --write-full-version "${VERSION}"
FULL_VERSION=$(php artisan phpvms:version)
else
echo "On branch $TRAVIS_BRANCH"
if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_BRANCH" != "dev" ]; then
echo "Not on valid branch, exiting"
exit 0
fi
# Write the version out but place the branch ID in there
# This is only for the dev branch
BASE_VERSION=$(php artisan phpvms:version --base-only)
# This now includes the pre-release version, so "-dev" by default
VERSION=${BASE_VERSION}
# Don't pass in a version here, just write out the latest hash
php artisan phpvms:version --write "${VERSION}"
FULL_VERSION=$(php artisan phpvms:version)
fi
FILE_NAME="phpvms-${VERSION}"
TAR_NAME="$FILE_NAME.tar.gz"
ZIP_NAME="$FILE_NAME.zip"
echo "Version: ${VERSION}"
echo "Full Version: ${FULL_VERSION}"
echo "Package name: ${TAR_NAME}"
echo "Current directory: ${BASE_DIR}"
echo "==========================="
echo "Cleaning files"
rm -rf vendor
composer install --no-dev --prefer-dist --no-interaction --verbose
# Leftover individual files to delete
declare -a remove_files=(
.git
@@ -30,7 +70,6 @@ declare -a remove_files=(
intellij_style.xml
config.php
docker-compose.yml
docker-compose.local.yml
Makefile
phpcs.xml
phpunit.xml
@@ -68,24 +107,44 @@ mkdir -p storage/framework/cache
mkdir -p storage/framework/sessions
mkdir -p storage/framework/views
# Regenerate the autoloader and classes
composer dump-autoload
make clean
cd /tmp
ls -al $TRAVIS_BUILD_DIR/../
ls -al $BASE_DIR/../
tar -czf $TAR_NAME -C $BASE_DIR .
tar -czf $TAR_NAME -C $TRAVIS_BUILD_DIR .
sha256sum $TAR_NAME >"$TAR_NAME.sha256"
cd $BASE_DIR;
zip -r $ZIP_NAME *
tar2zip $TAR_NAME
sha256sum $ZIP_NAME >"$ZIP_NAME.sha256"
mv $ZIP_NAME /tmp
mv "$ZIP_NAME.sha256" /tmp
ls -al /tmp
echo "Moving to dist"
mkdir -p $BASE_DIR/dist
cd $BASE_DIR/dist
echo "Uploading to S3"
mkdir -p $TRAVIS_BUILD_DIR/build
cd $TRAVIS_BUILD_DIR/build
mv "/tmp/$TAR_NAME" "/tmp/$ZIP_NAME" "/tmp/$TAR_NAME.sha256" "/tmp/$ZIP_NAME.sha256" .
artifacts upload --target-paths "/" $ZIP_NAME $TAR_NAME $TRAVIS_BUILD_DIR/VERSION $TAR_NAME.sha256 $ZIP_NAME.sha256
# Upload the version for a tagged release. Move to a version file in different
# tags. Within phpVMS, we have an option of which version to track in the admin
if test "$TRAVIS_TAG"; then
echo "Uploading release version file"
cp "$TRAVIS_BUILD_DIR/VERSION" release_version
artifacts upload --target-paths "/" release_version
else
echo "Uploading ${TRAVIS_BRANCH}_version file"
cp $TRAVIS_BUILD_DIR/VERSION ${TRAVIS_BRANCH}_version
artifacts upload --target-paths "/" ${TRAVIS_BRANCH}_version
fi
#if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_BRANCH" != "dev" ]; then
# echo "Skipping Discord branch update broadcast"
#else
curl -X POST \
--data "{\"content\": \"A new build is available at http://downloads.phpvms.net/$TAR_NAME (${FULL_VERSION})\"}" \
-H "Content-Type: application/json" \
$DISCORD_WEBHOOK_URL
#fi

View File

@@ -1,3 +1,7 @@
<?php
exit();
?>
APP_ENV="dev"
APP_KEY="base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY="
APP_URL="http://localhost"
@@ -8,7 +12,7 @@ APP_LOCALE="en"
PHPVMS_INSTALLED="true"
APP_LOG="daily"
LOG_LEVEL="debug"
APP_LOG_LEVEL="debug"
APP_LOG_MAX_FILES="3"
DB_CONNECTION="mysql"

View File

@@ -2,7 +2,7 @@ FROM php:7.4-fpm-alpine
WORKDIR /var/www/
RUN apk add gmp-dev icu-dev zlib-dev libpng-dev
RUN apk add gmp-dev
RUN curl --silent --show-error https://getcomposer.org/installer | php
# Copy any config files in
@@ -12,9 +12,7 @@ RUN ln -sf /dev/stderr /var/log/fpm-error.log
RUN docker-php-ext-install \
calendar \
intl \
pdo_mysql \
gd \
gmp \
opcache && \
docker-php-ext-enable pdo_mysql opcache
@@ -27,6 +25,4 @@ RUN php composer.phar install \
--no-scripts \
--prefer-dist
RUN chown -R www-data:www-data /var/www
EXPOSE 9000

View File

@@ -109,9 +109,17 @@ reset-installer:
@php artisan database:create --reset
@php artisan migrate:refresh --seed
.PHONY: docker-test
docker-test:
@docker-compose -f docker-compose.yml -f docker-compose.local.yml up
.PHONY: docker
docker:
@mkdir -p $(CURR_PATH)/tmp/mysql
-docker rm -f phpvms
docker build -t phpvms .
docker run --name=phpvms \
-v $(CURR_PATH):/var/www/ \
-v $(CURR_PATH)/tmp/mysql:/var/lib/mysql \
-p 8080:80 \
phpvms
.PHONY: docker-clean
docker-clean:

View File

@@ -1,15 +1,18 @@
# phpVMS <sup>7</sup>
# phpvms <sup>7</sup>
[![Build](https://github.com/nabeelio/phpvms/workflows/Build/badge.svg?branch=dev)](https://github.com/nabeelio/phpvms/actions) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d668bebb0a3c46bda381af16ce3d9450)](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=nabeelio/phpvms&amp;utm_campaign=Badge_Grade) [![Latest Stable Version](https://poser.pugx.org/nabeel/phpvms/v/stable)](https://packagist.org/packages/nabeel/phpvms) ![StyleCI](https://github.styleci.io/repos/93688482/shield?branch=dev) [![License](https://poser.pugx.org/nabeel/phpvms/license)](https://packagist.org/packages/nabeel/phpvms)
[![Build Status](https://travis-ci.org/nabeelio/phpvms.svg)](https://travis-ci.org/nabeelio/phpvms) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d668bebb0a3c46bda381af16ce3d9450)](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=nabeelio/phpvms&amp;utm_campaign=Badge_Grade) [![Latest Stable Version](https://poser.pugx.org/nabeel/phpvms/v/stable)](https://packagist.org/packages/nabeel/phpvms) ![StyleCI](https://github.styleci.io/repos/93688482/shield?branch=dev) [![License](https://poser.pugx.org/nabeel/phpvms/license)](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
[GitHub Releases](https://github.com/nabeelio/phpvms/releases) link.
### Requirements
## Requirements
- PHP 7.3+, extensions:
- cURL
@@ -21,25 +24,24 @@ A full distribution, with all of the composer dependencies, is available at this
- Database:
- 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. 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 with Docker
# development environment
A full development environment can be brought up using Docker, without having to install composer/npm locally
A full development environment can be brought up using Docker:
```bash
make docker-test
# **OR** with docker-compose directly
docker-compose -f docker-compose.yml -f docker-compose.local.yml up
composer install
yarn install
docker-compose build
docker-compose up
```
Then go to `http://localhost`. If you're using dnsmasq, the `app` container is listening on `phpvms.test`, or you can add to your `/etc/hosts` file:
@@ -48,9 +50,7 @@ Then go to `http://localhost`. If you're using dnsmasq, the `app` container is l
127.0.0.1 phpvms.test
```
The `docker-compose.local.yml` overrides the `app` section in `docker-compose.yml`. The standard `docker-compose.yml` can be used if you want to deploy from the image, or as a template for your own Dockerized deployments.
### Building JS/CSS assets
## Building JS/CSS assets
Yarn is required, run:

View File

@@ -4,9 +4,9 @@ namespace App\Console\Commands;
use App;
use App\Contracts\Command;
use App\Services\Installer\ConfigService;
use App\Services\Installer\SeederService;
use DatabaseSeeder;
use Modules\Installer\Services\ConfigService;
/**
* Create the config files
@@ -81,13 +81,13 @@ class CreateConfigs extends Command
$this->info('Regenerating the config files');
$cfgSvc->createConfigFiles([
'APP_ENV' => 'dev',
'SITE_NAME' => $this->argument('name'),
'DB_CONNECTION' => 'mysql',
'DB_HOST' => $this->argument('db_host'),
'DB_DATABASE' => $this->argument('db_name'),
'DB_USERNAME' => $this->argument('db_user'),
'DB_PASSWORD' => $this->argument('db_pass'),
'APP_ENV' => 'dev',
'SITE_NAME' => $this->argument('name'),
'DB_CONN' => 'mysql',
'DB_HOST' => $this->argument('db_host'),
'DB_NAME' => $this->argument('db_name'),
'DB_USER' => $this->argument('db_user'),
'DB_PASS' => $this->argument('db_pass'),
]);
$this->info('Config files generated!');

View File

@@ -3,7 +3,7 @@
namespace App\Console\Commands;
use App\Contracts\Command;
use App\Services\Installer\ConfigService;
use Modules\Installer\Services\ConfigService;
/**
* Create a fresh development install
@@ -79,9 +79,9 @@ class DevInstall extends Command
$this->info('Regenerating the config files');
$cfgSvc->createConfigFiles([
'APP_ENV' => 'dev',
'SITE_NAME' => 'phpvms test',
'DB_CONNECTION' => 'sqlite',
'APP_ENV' => 'dev',
'SITE_NAME' => 'phpvms test',
'DB_CONN' => 'sqlite',
]);
$this->info('Config files generated!');

View File

@@ -1,32 +0,0 @@
<?php
namespace App\Console\Commands;
use App;
use App\Contracts\Command;
class EmailTest extends Command
{
protected $signature = 'phpvms:email-test';
protected $description = 'Send a test notification to admins';
/**
* Run dev related commands
*
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileException
*/
public function handle()
{
/** @var App\Notifications\NotificationEventsHandler $eventHandler */
$eventHandler = app(App\Notifications\NotificationEventsHandler::class);
$news = new App\Models\News();
$news->user_id = 1;
$news->subject = 'Test News';
$news->body = 'Test Body';
$news->save();
$newsEvent = new App\Events\NewsAdded($news);
$eventHandler->onNewsAdded($newsEvent);
}
}

View File

@@ -1,38 +0,0 @@
<?php
namespace App\Console\Commands;
use App;
use App\Contracts\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;
class ProcessQueue extends Command
{
protected $signature = 'queue:cron';
protected $description = 'Process the queue from a cron job';
/**
* Run the queue tasks
*/
public function handle()
{
Artisan::call('queue:work', [
'--sansdaemon' => null,
'--stop-when-empty' => null,
]);
Log::info(Artisan::output());
///** @var App\Support\WorkCommand $queueWorker */
//$queueWorker = new App\Support\WorkCommand(app('queue.worker'), app('cache.store'));
//$queueWorker->setInput($queueWorker->createInputFromArguments([]));
//$queueWorker->handle();
/*$output = $this->call('queue:work', [
'--stop-when-empty' => null,
]);
Log::info($output);*/
}
}

View File

@@ -1,25 +0,0 @@
<?php
namespace App\Console\Commands;
use App\Contracts\Command;
use App\Services\Installer\ConfigService;
/**
* Command to rewrite the config files
*/
class RewriteConfigs extends Command
{
protected $signature = 'phpvms:rewrite-configs';
protected $description = 'Rewrite the config files';
/**
* Run dev related commands
*/
public function handle()
{
/** @var ConfigService $configSvc */
$configSvc = app(ConfigService::class);
$configSvc->rewriteConfigFiles();
}
}

View File

@@ -1,25 +0,0 @@
<?php
namespace App\Console\Cron;
use App\Contracts\Command;
use Illuminate\Support\Facades\Artisan;
/**
* This just calls the CronHourly event, so all of the
* listeners, etc can just be called to run those tasks
*/
class JobQueue extends Command
{
protected $signature = 'cron:queue';
protected $description = 'Run the cron queue tasks';
protected $schedule;
public function handle(): void
{
$this->redirectLoggingToFile('cron');
Artisan::call('queue:cron');
$this->info(Artisan::output());
}
}

View File

@@ -3,7 +3,6 @@
namespace App\Console;
use App\Console\Cron\Hourly;
use App\Console\Cron\JobQueue;
use App\Console\Cron\Monthly;
use App\Console\Cron\Nightly;
use App\Console\Cron\Weekly;
@@ -14,11 +13,7 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule. How this works... according to the command
* time, an event gets send out with the appropriate time (e.g, hourly sends an hourly event)
*
* Then the CronServiceProvider has the list of cronjobs which then run according to the events
* and then calls those at the proper times.
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
@@ -26,26 +21,16 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule): void
{
// If not using the queue worker then run those via cron
if (!config('queue.worker', false)) {
$schedule->command(JobQueue::class)
->everyMinute()
->withoutOverlapping();
}
$schedule->command(Nightly::class)->dailyAt('01:00');
$schedule->command(Weekly::class)->weeklyOn(0);
$schedule->command(Monthly::class)->monthlyOn(1);
$schedule->command(Hourly::class)->hourly();
// When spatie-backups runs
/*if (config('backup.backup.enabled', false) === true) {
$schedule->command('backup:clean')->daily()->at('01:00');
$schedule->command('backup:run')->daily()->at('02:00');
}*/
$schedule->command('backup:clean')->daily()->at('01:00');
$schedule->command('backup:run')->daily()->at('02:00');
// Update the last time the cron was run
/** @var CronService $cronSvc */
$cronSvc = app(CronService::class);
$cronSvc->updateLastRunTime();
}

View File

@@ -24,9 +24,9 @@ abstract class Command extends \Illuminate\Console\Command
parent::__construct();
// Running in the console but not in the tests
/*if (app()->runningInConsole() && env('APP_ENV') !== 'testing') {
if (app()->runningInConsole() && env('APP_ENV') !== 'testing') {
$this->redirectLoggingToFile('stdout');
}*/
}
}
/**

View File

@@ -12,24 +12,13 @@ abstract class Metar
{
/**
* Implement retrieving the METAR - return the METAR string. Needs to be protected,
* since this shouldn't be directly called. Call `metar($icao)`. If not implemented,
* return a blank string
* since this shouldn't be directly called. Call `get_metar($icao)` instead
*
* @param $icao
*
* @return mixed
*/
abstract protected function get_metar($icao): string;
/**
* Implement retrieving the TAF - return the string. Call `taf($icao)`. If not implemented,
* return a blank string
*
* @param $icao
*
* @return mixed
*/
abstract protected function get_taf($icao): string;
abstract protected function metar($icao): string;
/**
* Download the METAR, wrap in caching
@@ -38,9 +27,9 @@ abstract class Metar
*
* @return string
*/
public function metar($icao): string
public function get_metar($icao): string
{
$cache = config('cache.keys.METAR_WEATHER_LOOKUP');
$cache = config('cache.keys.WEATHER_LOOKUP');
$key = $cache['key'].$icao;
if (Cache::has($key)) {
@@ -51,7 +40,7 @@ abstract class Metar
}
try {
$raw_metar = $this->get_metar($icao);
$raw_metar = $this->metar($icao);
} catch (\Exception $e) {
Log::error('Error getting METAR: '.$e->getMessage(), $e->getTrace());
return '';
@@ -63,37 +52,4 @@ abstract class Metar
return $raw_metar;
}
/**
* Download the TAF, wrap in caching
*
* @param $icao
*
* @return string
*/
public function taf($icao): string
{
$cache = config('cache.keys.TAF_WEATHER_LOOKUP');
$key = $cache['key'].$icao;
if (Cache::has($key)) {
$taf = Cache::get($key);
if ($taf !== '') {
return $taf;
}
}
try {
$taf = $this->get_taf($icao);
} catch (\Exception $e) {
Log::error('Error getting TAF: '.$e->getMessage(), $e->getTrace());
return '';
}
if ($taf !== '') {
Cache::put($key, $taf, $cache['time']);
}
return $taf;
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Contracts;
use App\Models\Module;
use App\Support\Database;
use Exception;
use Illuminate\Support\Facades\DB;

View File

@@ -2,9 +2,9 @@
namespace App\Contracts;
use App\Notifications\Channels\Discord\DiscordMessage;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Log;
class Notification extends \Illuminate\Notifications\Notification implements ShouldQueue
{
@@ -17,14 +17,14 @@ class Notification extends \Illuminate\Notifications\Notification implements Sho
{
// Look in the notifications.channels config and see where this particular
// notification can go. Map it to $channels
/*$klass = static::class;
$klass = static::class;
$notif_config = config('notifications.channels', []);
if (!array_key_exists($klass, $notif_config)) {
Log::error('Notification type '.$klass.' missing from notifications config, defaulting to mail');
return;
}
$this->channels = $notif_config[$klass];*/
$this->channels = $notif_config[$klass];
}
/**
@@ -34,16 +34,8 @@ class Notification extends \Illuminate\Notifications\Notification implements Sho
*
* @return array
*/
/*public function via($notifiable)
public function via($notifiable)
{
return $this->channels;
}*/
/**
* @return DiscordMessage|null
*/
public function toDiscordChannel($notifiable): ?DiscordMessage
{
return null;
}
}

View File

@@ -2,14 +2,11 @@
namespace App\Contracts;
use Exception;
use Illuminate\Validation\Validator;
use function is_array;
use Prettus\Repository\Eloquent\BaseRepository;
use Prettus\Repository\Exceptions\RepositoryException;
/**
* @mixin BaseRepository
* @mixin \Prettus\Repository\Eloquent\BaseRepository
*/
abstract class Repository extends BaseRepository
{
@@ -23,8 +20,8 @@ abstract class Repository extends BaseRepository
{
try {
return $this->find($id, $columns);
} catch (Exception $e) {
return null;
} catch (\Exception $e) {
return;
}
}
@@ -35,7 +32,11 @@ abstract class Repository extends BaseRepository
*/
public function validate($values)
{
$validator = Validator::make($values, $this->model()->rules);
$validator = Validator::make(
$values,
$this->model()->rules
);
if ($validator->fails()) {
return $validator->messages();
}
@@ -49,8 +50,6 @@ abstract class Repository extends BaseRepository
* @param int $count
* @param string $sort_by created_at (default) or updated_at
*
* @throws RepositoryException
*
* @return mixed
*/
public function recent($count = null, $sort_by = 'created_at')
@@ -72,7 +71,7 @@ abstract class Repository extends BaseRepository
return $this->scopeQuery(function ($query) use ($where, $sort_by, $order_by) {
$q = $query->where($where);
// See if there are multi-column sorts
if (is_array($sort_by)) {
if (\is_array($sort_by)) {
foreach ($sort_by as $key => $sort) {
$q = $q->orderBy($key, $sort);
}
@@ -99,7 +98,7 @@ abstract class Repository extends BaseRepository
return $this->scopeQuery(function ($query) use ($col, $values, $sort_by, $order_by) {
$q = $query->whereNotIn($col, $values);
// See if there are multi-column sorts
if (is_array($sort_by)) {
if (\is_array($sort_by)) {
foreach ($sort_by as $key => $sort) {
$q = $q->orderBy($key, $sort);
}
@@ -119,7 +118,7 @@ abstract class Repository extends BaseRepository
* @param array $columns
* @param string $method
*
* @throws RepositoryException
* @throws \Prettus\Repository\Exceptions\RepositoryException
*
* @return mixed
*/

View File

@@ -2,10 +2,7 @@
namespace App\Contracts;
use App\Support\Resources\CustomAnonymousResourceCollection;
use App\Support\Resources\CustomPaginatedResourceResponse;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Pagination\AbstractPaginator;
/**
* Base class for a resource/response
@@ -29,28 +26,4 @@ class Resource extends JsonResource
}
}
}
/**
* Customize the response to exclude all the extra data that isn't used. Based on:
* https://gist.github.com/derekphilipau/4be52164a69ce487dcd0673656d280da
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\JsonResponse
*/
public function toResponse($request)
{
return $this->resource instanceof AbstractPaginator
? (new CustomPaginatedResourceResponse($this))->toResponse($request)
: parent::toResponse($request);
}
public static function collection($resource)
{
return tap(new CustomAnonymousResourceCollection($resource, static::class), function ($collection) {
if (property_exists(static::class, 'preserveKeys')) {
$collection->preserveKeys = (new static([]))->preserveKeys === true;
}
});
}
}

View File

@@ -1,52 +0,0 @@
<?php
namespace App\Cron\Hourly;
use App\Contracts\Listener;
use App\Events\CronHourly;
use App\Models\Enums\PirepState;
use App\Models\Pirep;
use App\Services\PirepService;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
/**
* Remove cancelled/deleted PIREPs. Look for PIREPs that were created before the setting time
* (e.g, 12 hours ago) and are marked with the
*/
class DeletePireps extends Listener
{
/**
* Delete old rejected PIREPs
*
* @param CronHourly $event
*
* @throws \Exception
*/
public function handle(CronHourly $event): void
{
$this->deletePireps(setting('pireps.delete_rejected_hours'), PirepState::REJECTED);
$this->deletePireps(setting('pireps.delete_cancelled_hours'), PirepState::CANCELLED);
}
/**
* Look for and delete PIREPs which match the criteria
*
* @param int $expire_time_hours The time in hours to look for PIREPs
* @param int $state The PirepState enum value
*/
protected function deletePireps(int $expire_time_hours, int $state)
{
$dt = Carbon::now('UTC')->subHours($expire_time_hours);
$pireps = Pirep::where('created_at', '<', $dt)->where(['state' => $state])->get();
/** @var PirepService $pirepSvc */
$pirepSvc = app(PirepService::class);
/** @var Pirep $pirep */
foreach ($pireps as $pirep) {
Log::info('Cron: Deleting PIREP id='.$pirep->id.', state='.PirepState::label($state));
$pirepSvc->delete($pirep);
}
}
}

View File

@@ -25,7 +25,7 @@ class RemoveExpiredBids extends Listener
return;
}
$date = Carbon::now('UTC')->subHours(setting('bids.expire_time'));
Bid::where('created_at', '<', $date)->delete();
$date = Carbon::now()->subHours(setting('bids.expire_time'));
Bid::whereDate('created_at', '<', $date)->delete();
}
}

View File

@@ -4,11 +4,9 @@ namespace App\Cron\Hourly;
use App\Contracts\Listener;
use App\Events\CronHourly;
use App\Events\PirepCancelled;
use App\Models\Enums\PirepState;
use App\Models\Pirep;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
/**
* Remove expired live flights
@@ -28,14 +26,9 @@ class RemoveExpiredLiveFlights extends Listener
return;
}
$date = Carbon::now('UTC')->subHours(setting('acars.live_time'));
$pireps = Pirep::where('updated_at', '<', $date)
$date = Carbon::now()->subHours(setting('acars.live_time'));
Pirep::whereDate('updated_at', '<', $date)
->where('state', PirepState::IN_PROGRESS)
->get();
foreach ($pireps as $pirep) {
event(new PirepCancelled($pirep));
Log::info('Cron: Deleting Expired Live PIREP id='.$pirep->id.', state='.PirepState::label($pirep->state));
$pirep->delete();
}
->delete();
}
}

View File

@@ -6,7 +6,6 @@ use App\Contracts\Listener;
use App\Events\CronMonthly;
use App\Models\Enums\ExpenseType;
use App\Services\Finance\RecurringFinanceService;
use Illuminate\Support\Facades\Log;
/**
* Go through and apply any finances that are daily
@@ -36,7 +35,6 @@ class ApplyExpenses extends Listener
*/
public function handle(CronMonthly $event): void
{
Log::info('Monthly: Applying monthly expenses');
$this->financeSvc->processExpenses(ExpenseType::MONTHLY);
}
}

View File

@@ -6,7 +6,6 @@ use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Models\Enums\ExpenseType;
use App\Services\Finance\RecurringFinanceService;
use Illuminate\Support\Facades\Log;
/**
* Go through and apply any finances that are daily
@@ -36,7 +35,6 @@ class ApplyExpenses extends Listener
*/
public function handle(CronNightly $event): void
{
Log::info('Nightly: Applying daily expenses');
$this->financeSvc->processExpenses(ExpenseType::DAILY);
}
}

View File

@@ -1,11 +1,10 @@
<?php
namespace App\Cron\Hourly;
namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronHourly;
use App\Events\CronNightly;
use App\Services\SimBriefService;
use Illuminate\Support\Facades\Log;
/**
* Clear any expired SimBrief flight briefs that aren't attached to a PIREP
@@ -22,9 +21,8 @@ class ClearExpiredSimbrief extends Listener
/**
* @param \App\Events\CronNightly $event
*/
public function handle(CronHourly $event): void
public function handle(CronNightly $event): void
{
Log::info('Hourly: Removing expired Simbrief entries');
$this->simbriefSvc->removeExpiredEntries();
}
}

View File

@@ -5,8 +5,10 @@ namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Services\VersionService;
use Illuminate\Support\Facades\Log;
/**
* Determine if any pilots should be set to ON LEAVE status
*/
class NewVersionCheck extends Listener
{
private $versionSvc;
@@ -26,7 +28,6 @@ class NewVersionCheck extends Listener
*/
public function handle(CronNightly $event): void
{
Log::info('Nightly: Checking for new version');
$this->versionSvc->isNewVersionAvailable();
}
}

View File

@@ -4,8 +4,10 @@ namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Models\Enums\UserState;
use App\Models\User;
use App\Services\UserService;
use Illuminate\Support\Facades\Log;
use Carbon\Carbon;
/**
* Determine if any pilots should be set to ON LEAVE status
@@ -16,8 +18,6 @@ class PilotLeave extends Listener
/**
* PilotLeave constructor.
*
* @param UserService $userSvc
*/
public function __construct(UserService $userSvc)
{
@@ -34,9 +34,13 @@ class PilotLeave extends Listener
*/
public function handle(CronNightly $event): void
{
Log::info('Cron: Running pilot leave check');
$users = $this->userSvc->findUsersOnLeave();
Log::info('Found '.count($users).' users on leave');
if (setting('pilots.auto_leave_days') === 0) {
return;
}
$date = Carbon::now()->subDay(setting('pilots.auto_leave_days'));
$users = User::where('status', UserState::ACTIVE)
->whereDate('updated_at', '<', $date);
foreach ($users as $user) {
Log::info('Setting user '.$user->ident.' to ON LEAVE status');

View File

@@ -35,7 +35,7 @@ class RecalculateBalances extends Listener
*/
public function handle(CronNightly $event): void
{
Log::info('Nightly: Recalculating balances');
Log::info('Recalculating balances');
$journals = Journal::all();
foreach ($journals as $journal) {

View File

@@ -32,10 +32,10 @@ class RecalculateStats extends Listener
*/
public function handle(CronNightly $event): void
{
Log::info('Nightly: Recalculating user stats');
Log::info('Recalculating user stats');
$this->userSvc->recalculateAllUserStats();
Log::info('Nightly: Recalcuating aircraft status');
Log::info('Recalcuating aircraft status');
$this->aircraftSvc->recalculateStats();
}
}

View File

@@ -19,8 +19,6 @@ class SetActiveFlights extends Listener
*/
public function handle(CronNightly $event): void
{
Log::info('Nightly: Setting active flights');
$this->checkFlights();
}
@@ -44,18 +42,23 @@ class SetActiveFlights extends Listener
continue;
}
// Set to visible by default
$flight->visible = true;
// dates aren't set, so just save if there were any changes above
// and move onto the next one
if ($flight->start_date === null || $flight->end_date === null) {
if ($flight->days !== null && $flight->days > 0) {
$flight->visible = Days::isToday($flight->days);
if (!$flight->visible) {
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
$visible = Days::isToday($flight->days);
if ($flight->visible !== $visible) {
Log::info('Flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden'));
$flight->visible = $visible;
if ($visible === false) {
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
}
}
} else {
Log::info('Toggling flight '.$flight->ident.' to visible');
$flight->visible = true;
}
$flight->save();
@@ -68,11 +71,20 @@ class SetActiveFlights extends Listener
// and then make sure if days of the week are specified, check that too
if ($today->gte($flight->start_date) && $today->lte($flight->end_date)) {
if ($flight->days !== null && $flight->days > 0) {
$flight->visible = Days::isToday($flight->days);
if (!$flight->visible) {
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
$visible = Days::isToday($flight->days);
if ($flight->visible !== $visible) {
Log::info('Toggling flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden').'');
$flight->visible = $visible;
if ($visible === false) {
Log::info('Today='.date('N').', start='.$flight->start_date
.', end='.$flight->end_date.', mask='.$flight->days.', in='
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
}
}
} else {
Log::info('Toggling flight '.$flight->ident.' to visible');
$flight->visible = true;
}
} else {
$flight->visible = false;

View File

@@ -11,7 +11,7 @@ if (!function_exists('createFactoryICAO')) {
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$max = strlen($characters) - 1;
$string = '';
for ($i = 0; $i < 5; $i++) {
for ($i = 0; $i < 4; $i++) {
try {
$string .= $characters[random_int(0, $max)];
} catch (Exception $e) {

View File

@@ -1,20 +1,17 @@
<?php
use App\Models\Journal;
use Carbon\Carbon;
use Faker\Generator as Faker;
use Ramsey\Uuid\Uuid;
$factory->define(App\Models\JournalTransaction::class, function (Faker $faker) {
$factory->define(App\Models\JournalTransactions::class, function (Faker $faker) {
return [
'transaction_group' => Uuid::uuid4()->toString(),
'transaction_group' => \Ramsey\Uuid\Uuid::uuid4()->toString(),
'journal_id' => function () {
return factory(Journal::class)->create()->id;
return factory(\App\Models\Journal::class)->create()->id;
},
'credit' => $faker->numberBetween(100, 10000),
'debit' => $faker->numberBetween(100, 10000),
'currency' => 'USD',
'memo' => $faker->sentence(6),
'post_date' => Carbon::now('UTC'),
'post_date' => \Carbon\Carbon::now(),
];
});

View File

@@ -1,13 +0,0 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\Models\Role::class, function (Faker $faker) {
return [
'id' => null,
'name' => $faker->name,
'display_name' => $faker->name,
'read_only' => false,
'disable_activity_checks' => $faker->boolean(),
];
});

View File

@@ -5,6 +5,11 @@ use Illuminate\Database\Schema\Blueprint;
class RolesPermissionsTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Create table for storing roles
@@ -74,6 +79,11 @@ class RolesPermissionsTables extends Migration
$this->addData('roles', $roles);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('permission_user');

View File

@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
@@ -15,6 +20,11 @@ class CreatePasswordResetsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');

View File

@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
class CreateSessionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function (Blueprint $table) {
@@ -18,6 +23,11 @@ class CreateSessionsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sessions');

View File

@@ -5,6 +5,11 @@ use Illuminate\Database\Schema\Blueprint;
class CreateAirlinesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('airlines', function (Blueprint $table) {
@@ -27,6 +32,11 @@ class CreateAirlinesTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('airlines');

View File

@@ -5,6 +5,11 @@ use Illuminate\Database\Schema\Blueprint;
class CreateFaresTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('fares', function (Blueprint $table) {
@@ -20,6 +25,11 @@ class CreateFaresTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('fares');

View File

@@ -7,6 +7,11 @@ use Illuminate\Database\Schema\Blueprint;
class CreateFlightTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('flights', function (Blueprint $table) {

View File

@@ -5,6 +5,11 @@ use Illuminate\Database\Schema\Blueprint;
class CreateRanksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ranks', function (Blueprint $table) {
@@ -25,6 +30,11 @@ class CreateRanksTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('ranks');

View File

@@ -3,6 +3,9 @@
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateSubfleetTables
*/
class CreateSubfleetTables extends Migration
{
public function up()
@@ -45,6 +48,11 @@ class CreateSubfleetTables extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('subfleets');

View File

@@ -7,6 +7,11 @@ use Illuminate\Support\Facades\Schema;
class CreateBidsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bids', function (Blueprint $table) {
@@ -20,6 +25,11 @@ class CreateBidsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('bids');

View File

@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
@@ -19,6 +24,11 @@ class CreateJobsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');

View File

@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
@@ -18,6 +23,11 @@ class CreateFailedJobsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');

View File

@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
class CreateNavdataTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
/*
@@ -26,6 +31,11 @@ class CreateNavdataTables extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('navdata');

View File

@@ -7,6 +7,11 @@ use Illuminate\Support\Facades\Schema;
class CreateAcarsTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('acars', function (Blueprint $table) {
@@ -39,6 +44,11 @@ class CreateAcarsTables extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('acars');

View File

@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
class CreateStatsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('stats', function (Blueprint $table) {
@@ -20,6 +25,11 @@ class CreateStatsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('stats');

View File

@@ -17,6 +17,11 @@ class CreateNewsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('news');

View File

@@ -7,6 +7,13 @@ use Modules\Awards\Awards\PilotFlightAwards;
class CreateAwardsTable extends Migration
{
/**
* Run the migrations.
*
* @throws \Illuminate\Validation\ValidationException
*
* @return void
*/
public function up()
{
Schema::create('awards', function (Blueprint $table) {
@@ -47,6 +54,11 @@ class CreateAwardsTable extends Migration
$this->addAward($award);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('awards');

View File

@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
class CreateJournalTransactionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('journal_transactions', function (Blueprint $table) {
@@ -29,6 +34,11 @@ class CreateJournalTransactionsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('journal_transactions');

View File

@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
class CreateJournalsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('journals', function (Blueprint $table) {
@@ -19,6 +24,11 @@ class CreateJournalsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('journals');

View File

@@ -1,7 +1,6 @@
<?php
use App\Contracts\Migration;
use App\Contracts\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -15,7 +14,7 @@ class CreateFilesTable extends Migration
public function up()
{
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('description')->nullable();
$table->string('disk')->nullable();

View File

@@ -1,12 +1,17 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class AddReadonlyToRoles extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Schema::table('roles', static function (Blueprint $table) {
@@ -19,6 +24,11 @@ class AddReadonlyToRoles extends Migration
->update(['read_only' => true]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::table('roles', static function (Blueprint $table) {

View File

@@ -1,19 +1,21 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
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
{
/**
* 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()
{
Schema::table('users', static function (Blueprint $table) {
@@ -27,6 +29,11 @@ class UsersAddPilotId extends Migration
DB::table('users')->update(['pilot_id' => DB::raw('`id`')]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {

View File

@@ -1,11 +1,16 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
@@ -18,6 +23,11 @@ class CreateNotificationsTable extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');

View File

@@ -1,16 +1,18 @@
<?php
use App\Contracts\Migration;
use App\Models\Enums\PirepState;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
/**
* Change the PIREP state column to be a TINYINT
*/
class PirepsChangeStateType extends Migration
{
/**
* Change the PIREP state column to be a TINYINT
*
* @return void
*/
public function up()
{
// Migrate the old rejected state
@@ -23,4 +25,13 @@ class PirepsChangeStateType extends Migration
$table->unsignedSmallInteger('state')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@@ -5,15 +5,27 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `flight_id` column to the PIREPs table
*/
class PirepsAddFlightId extends Migration
{
/**
* Add a `flight_id` column to the PIREPs table
*/
public function up()
{
Schema::table('pireps', function (Blueprint $table) {
$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');
});
}
}

View File

@@ -4,11 +4,11 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `flight_type` column to the expenses table
*/
class ExpensesAddFlightType extends Migration
{
/**
* Add a `flight_type` column to the expenses table
*/
public function up()
{
Schema::table('expenses', function (Blueprint $table) {
@@ -18,6 +18,11 @@ class ExpensesAddFlightType extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('expenses', function (Blueprint $table) {

View File

@@ -1,6 +1,6 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
/**
@@ -25,4 +25,13 @@ class ModifyAirportsCoordinates extends Migration
$table->decimal('lon', 11, 5)->change()->default(0.0)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@@ -1,6 +1,6 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
/**
@@ -8,10 +8,24 @@ use Illuminate\Support\Facades\Schema;
*/
class FlightFieldNullable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('flight_field_values', function ($table) {
$table->text('value')->change()->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@@ -1,14 +1,14 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `load_factor` and `load_factor_variance` columns to the expenses table
*/
class FlightsAddLoadFactor extends Migration
{
/**
* Add a `load_factor` and `load_factor_variance` columns to the expenses table
*/
public function up()
{
Schema::table('flights', function (Blueprint $table) {
@@ -22,6 +22,11 @@ class FlightsAddLoadFactor extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('flights', function (Blueprint $table) {

View File

@@ -1,14 +1,14 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
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
{
/**
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
*/
public function up()
{
Schema::table('flights', function (Blueprint $table) {
@@ -18,6 +18,11 @@ class FlightsAddPilotPay extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('flights', function (Blueprint $table) {

View File

@@ -1,15 +1,15 @@
<?php
use App\Contracts\Migration;
use App\Models\Enums\FareType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
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
{
/**
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
*/
public function up()
{
Schema::table('fares', function (Blueprint $table) {
@@ -19,4 +19,16 @@ class FaresAddType extends Migration
->after('capacity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('fares', function (Blueprint $table) {
$table->dropColumn('type');
});
}
}

View File

@@ -1,6 +1,6 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -33,4 +33,13 @@ class IncreaseIdLengths extends Migration
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@@ -1,6 +1,6 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -15,4 +15,13 @@ class RemoveSubfleetTypeIndex extends Migration
$table->dropUnique(['type']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@@ -1,6 +1,6 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

View File

@@ -1,7 +1,7 @@
<?php
use App\Contracts\Migration;
use App\Models\Enums\PageType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -11,6 +11,11 @@ use Illuminate\Support\Facades\Schema;
*/
class CreatePages extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pages', function (Blueprint $table) {
@@ -28,6 +33,11 @@ class CreatePages extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pages');

View File

@@ -1,6 +1,6 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -9,7 +9,11 @@ class AirlineRemoveNullable extends Migration
public function up()
{
Schema::table('airlines', function (Blueprint $table) {
$table->dropUnique(['iata']);
$table->dropUnique('airlines_iata_unique');
});
}
public function down()
{
}
}

View File

@@ -1,6 +1,6 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -12,4 +12,8 @@ class PageIconNullable extends Migration
$table->string('icon')->change()->nullable();
});
}
public function down()
{
}
}

View File

@@ -1,15 +1,15 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\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
{
/**
* 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
*/
public function up()
{
Schema::table('pages', function (Blueprint $table) {
@@ -23,6 +23,9 @@ class PagesAddLink extends Migration
});
}
/**
* @return void
*/
public function down()
{
Schema::table('fares', function (Blueprint $table) {

View File

@@ -5,11 +5,11 @@ 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
{
/**
* Add two tables for holding user fields and the values
*/
public function up()
{
/*
@@ -39,4 +39,11 @@ class CreateUserFields extends Migration
$table->index(['user_field_id', 'user_id']);
});
}
/**
* @return void
*/
public function down()
{
}
}

View File

@@ -1,6 +1,6 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -19,6 +19,11 @@ class AircraftAddMtow extends Migration
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('aircraft', function (Blueprint $table) {

View File

@@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Schema;
class CreateModulesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('modules', function (Blueprint $table) {
@@ -22,6 +27,11 @@ class CreateModulesTable extends Migration
$this->addModule(['name' => 'TestModule']);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('modules');

View File

@@ -0,0 +1,52 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class ModifyPirepFares extends Migration
{
/**
* Modify the PIREP fares table so that we can save all of the fares for that particular PIREP
* Basically copy all of those fields over, and then use this table directly, instead of the
* relationship to the fares table
*
* @return void
*/
public function up()
{
/*
* Add the columns we need from the fares table so then this is now "fixed" in time
*/
Schema::table('pirep_fares', function (Blueprint $table) {
$table->unsignedInteger('fare_id')->change()->nullable()->default(0);
$table->string('code', 50);
$table->string('name', 50);
// count is already there
$table->unsignedDecimal('price')->nullable()->default(0.00);
$table->unsignedDecimal('cost')->nullable()->default(0.00);
$table->unsignedInteger('capacity')->nullable()->default(0);
});
/**
* Now iterate through the existing table and copy/update everything
* Some fares might already have been removed deleted so just insert some null/errored
* values for those
*/
$parent_fares = [];
$fares = DB::table('pirep_fares')->get();
foreach ($fares as $fare) {
if (empty($parent_fares[$fare->fare_id])) {
$parent_fares[$fare->fare_id] = DB::table('fares')->where('id', $fare->fare_id)->first();
}
}
}
public function down()
{
}
}

View File

@@ -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();
});
}
}

View File

@@ -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();
});
}
}

View File

@@ -1,20 +0,0 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a hub to the subfleet is
*/
class AddHubToSubfleets extends Migration
{
public function up()
{
Schema::table('subfleets', function (Blueprint $table) {
$table->string('hub_id', 4)
->nullable()
->after('airline_id');
});
}
}

View File

@@ -1,18 +0,0 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Change the vertical speed for the acars table to a double
*/
class ChangeAcarsVsType extends Migration
{
public function up()
{
Schema::table('acars', function (Blueprint $table) {
$table->float('vs')->change()->default(0.0)->nullable();
});
}
}

View File

@@ -1,19 +0,0 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Bring the sessions table in line with the latest
*/
class UpdateSessionsTable extends Migration
{
public function up()
{
Schema::table('sessions', function (Blueprint $table) {
$table->index('user_id');
$table->index('last_activity');
});
}
}

View File

@@ -1,21 +0,0 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `fuel_onboard` column for recording what is left in tanks
*/
class AircraftAddFuelonboard extends Migration
{
public function up()
{
Schema::table('aircraft', function (Blueprint $table) {
$table->unsignedDecimal('fuel_onboard')
->nullable()
->default(0.0)
->after('zfw');
});
}
}

View File

@@ -1,20 +0,0 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a SimBrief Type to subfleet
*/
class AddSbtypeToSubfleets extends Migration
{
public function up()
{
Schema::table('subfleets', function (Blueprint $table) {
$table->string('simbrief_type', 20)
->nullable()
->after('type');
});
}
}

View File

@@ -1,24 +0,0 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a hub to the subfleet is
*/
class AddAircraftToSimbrief extends Migration
{
public function up()
{
Schema::table('simbrief', function (Blueprint $table) {
$table->unsignedInteger('aircraft_id')
->nullable()
->after('pirep_id');
// Temp column to hold the calculated fare data for the API
// Remove this once the prefile to acars feature is completed
$table->mediumText('fare_data')->nullable()->after('ofp_xml');
});
}
}

View File

@@ -1,19 +0,0 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a hub to the subfleet is
*/
class AddKvpTable extends Migration
{
public function up()
{
Schema::create('kvp', function (Blueprint $table) {
$table->string('key')->index();
$table->string('value');
});
}
}

View File

@@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDisableactivitychecksToRoles extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('roles', function (Blueprint $table) {
$table->boolean('disable_activity_checks')
->default(false)
->after('read_only');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('roles', function (Blueprint $table) {
$table->dropColumn('disable_activity_checks');
});
}
}

View File

@@ -1,19 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class RemoveSettingRemoveBidOnAccept extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::table('settings')
->where(['key' => 'pireps.remove_bid_on_accept'])
->delete();
}
}

View File

@@ -1,30 +0,0 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `anumeric_callsign` column for Alphanumeric Callsign to be assigned for a flight
* Exp DLH78BF, THY8EA, OGE1978
* According to FAA and EASA, callsigns must be maximum 7 chars in which first 3 chars is
* airline ICAO code remaining rest can be used freely according to airline's choices
*/
class FlightsAddAlphanumericCallsign extends Migration
{
public function up()
{
Schema::table('flights', function (Blueprint $table) {
$table->string('callsign', 4)
->nullable()
->after('flight_number');
});
}
public function down()
{
Schema::table('flights', function (Blueprint $table) {
$table->dropColumn('callsign');
});
}
}

View File

@@ -1,21 +0,0 @@
<?php
use App\Contracts\Migration;
use App\Services\Installer\ConfigService;
/**
* Migrate the configuration files
*/
class MigrateConfigs extends Migration
{
public function up()
{
/** @var ConfigService $configSvc */
$configSvc = app(ConfigService::class);
$configSvc->rewriteConfigFiles();
}
public function down()
{
}
}

View File

@@ -1,26 +0,0 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Increase Airport ICAO size to 5 chars
* https://github.com/nabeelio/phpvms/issues/1052
*/
class IncreaseIcaoSizes extends Migration
{
public function up()
{
Schema::table('airports', function (Blueprint $table) {
$table->string('iata', 5)->change();
$table->string('icao', 5)->change();
});
Schema::table('pireps', function (Blueprint $table) {
$table->string('dpt_airport_id', 5)->change();
$table->string('arr_airport_id', 5)->change();
$table->string('alt_airport_id', 5)->change();
});
}
}

View File

@@ -1,19 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class RemoveSettingSimbriefExpireDays extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::table('settings')
->where(['key' => 'simbrief.expire_days'])
->delete();
}
}

View File

@@ -1,32 +0,0 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class DiscordFields extends Migration
{
public function up()
{
// Delete the old Discord fields and then a webhook will get added
DB::table('settings')
->where(['key' => 'notifications.discord_api_key'])
->delete();
DB::table('settings')
->where(['key' => 'notifications.discord_public_channel_id'])
->delete();
DB::table('settings')
->where(['key' => 'notifications.discord_public_channel_id'])
->delete();
// Add a field to the user to enter their own Discord ID
Schema::table('users', function (Blueprint $table) {
$table->string('discord_id')
->default('')
->after('rank_id');
});
}
}

View File

@@ -1,18 +0,0 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DiscordPrivateChannelId extends Migration
{
public function up()
{
// Add a field to the user to enter their own Discord ID
Schema::table('users', function (Blueprint $table) {
$table->string('discord_private_channel_id')
->default('')
->after('discord_id');
});
}
}

View File

@@ -1,5 +1,519 @@
acars:
- pirep_id: b68R5gwVzpVe
- id: aM8QpMPEB15e
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '17.934117958358'
lon: '-76.77856721815'
heading: '124'
altitude: '8.1663703232199'
vs: '0'
gs: '0.0064996252497234'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: eZ6VJ3xj8vge
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '17.934117498661'
lon: '-76.778566516289'
heading: '124'
altitude: '8.1664622222087'
vs: '0'
gs: '0'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: bo2QqDLl2lLa
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '17.933884143334'
lon: '-76.778210172233'
heading: '124'
altitude: '8.1707802663933'
vs: '0'
gs: '14.419195209695'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: aM8QpM4qV2Be
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '17.933705349611'
lon: '-76.777936938059'
heading: '124'
altitude: '8.170089899507'
vs: '0'
gs: '15.392330039049'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: dR6oxR9qjoOd
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '17.933130691906'
lon: '-76.777152737985'
heading: '158'
altitude: '8.1683570286331'
vs: '0'
gs: '10.450467475023'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: erkRwJODRvEa
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '17.932580370289'
lon: '-76.777450200122'
heading: '221'
altitude: '8.1695896791822'
vs: '0'
gs: '12.932334300694'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: b2kv53VMy7Ad
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '17.932012550651'
lon: '-76.778009113329'
heading: '296'
altitude: '8.1683852467213'
vs: '0'
gs: '10.502719192825'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: eXDoE14JxAve
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '17.932052237309'
lon: '-76.778111495187'
heading: '290'
altitude: '8.1719753739837'
vs: '0'
gs: '12.643743277153'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: b68R5gZ5YyOe
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '17.932664026837'
lon: '-76.779705339967'
heading: '293'
altitude: '8.2203963962548'
vs: '0'
gs: '64.870244840054'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: bqxYvGNN5N0a
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '17.934300220408'
lon: '-76.783954914814'
heading: '293'
altitude: '8.3302468103811'
vs: '0'
gs: '122.78529244208'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: en5rpBKw514d
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '17.935736496556'
lon: '-76.78765616448'
heading: '293'
altitude: '49.554739665916'
vs: '21'
gs: '146.79677958636'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: erkRwJA29l2a
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '17.976972983585'
lon: '-76.896548114872'
heading: '297'
altitude: '6228.684012199'
vs: '62'
gs: '281.03976876098'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: dR6oxR3r5nwd
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.061360208405'
lon: '-77.056156629983'
heading: '301'
altitude: '12522.331716891'
vs: '25'
gs: '371.70833265547'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: e1wr82J877Zb
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.17373613295'
lon: '-77.260347185993'
heading: '301'
altitude: '16802.15636323'
vs: '43'
gs: '421.37353688139'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: bqxYvGyExN2a
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.193907285814'
lon: '-77.29810465405'
heading: '297'
altitude: '17395.953175647'
vs: '40'
gs: '425.98105291451'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: aQW0wQDQk5Md
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.648921231143'
lon: '-78.014696613517'
heading: '323'
altitude: '37108.124381987'
vs: '22'
gs: '438.52028383384'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: e9rQ5lk3p63a
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.796585259338'
lon: '-78.194734005052'
heading: '260'
altitude: '39718.178225504'
vs: '19'
gs: '432.41969107334'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: aQW0wQP8vZqd
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.660552760063'
lon: '-78.407597067994'
heading: '242'
altitude: '40998.775690971'
vs: '-25'
gs: '449.51695639627'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: bqxYvGKgp32a
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.592775999582'
lon: '-78.638711340118'
heading: '298'
altitude: '41060.297106821'
vs: '0'
gs: '427.14806185954'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: bqxYvGg2r02a
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.718367591656'
lon: '-78.840980459275'
heading: '284'
altitude: '41065.55293844'
vs: '1'
gs: '424.89060056552'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: e0RV61wPj53b
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.77448809677'
lon: '-79.082727467209'
heading: '283'
altitude: '41069.809333539'
vs: '0'
gs: '425.02780492483'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: dwpmBOo3wWwe
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.813031600863'
lon: '-79.249543355636'
heading: '283'
altitude: '41072.545805172'
vs: '0'
gs: '425.04687332464'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: ejRqlxXoZPle
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.840653974635'
lon: '-79.370042672541'
heading: '283'
altitude: '40396.200981621'
vs: '-16'
gs: '428.08364925851'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: eVOPBYw4q9Xa
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.868358744495'
lon: '-79.491434926253'
heading: '283'
altitude: '39399.093383161'
vs: '-16'
gs: '427.57826037174'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: aOYyrOmVPzEd
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.896191929474'
lon: '-79.613169477385'
heading: '284'
altitude: '36491.730092364'
vs: '-55'
gs: '429.74732238829'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: dL98oLQgyzje
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.9242378342'
lon: '-79.736368411294'
heading: '284'
altitude: '32998.644142986'
vs: '-61'
gs: '434.90864533098'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: e9rQ5lqD2o8a
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
name: null
log: null
lat: '18.952608029755'
lon: '-79.861339775352'
heading: '284'
altitude: '29069.168636089'
vs: '-68'
gs: '441.90475491564'
transponder: null
autopilot: null
fuel_flow: null
sim_time: now
created_at: 'now'
updated_at: 'now'
- id: av2oANWY1vma
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
@@ -36,7 +550,8 @@ acars:
sim_time: now
created_at: 'now'
updated_at: 'now'
- pirep_id: b68R5gwVzpVe
- id: e1wr82gp8zGb
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
@@ -54,7 +569,8 @@ acars:
sim_time: now
created_at: 'now'
updated_at: 'now'
- pirep_id: b68R5gwVzpVe
- id: dG65jDL2gK0b
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
@@ -72,7 +588,8 @@ acars:
sim_time: now
created_at: 'now'
updated_at: 'now'
- pirep_id: b68R5gwVzpVe
- id: epYQ0ENmyvXa
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
@@ -90,7 +607,8 @@ acars:
sim_time: now
created_at: 'now'
updated_at: 'now'
- pirep_id: b68R5gwVzpVe
- id: erkRwJPrVoEa
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
@@ -108,7 +626,8 @@ acars:
sim_time: now
created_at: 'now'
updated_at: 'now'
- pirep_id: b68R5gwVzpVe
- id: e1wr82gZXqZb
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
@@ -126,7 +645,8 @@ acars:
sim_time: now
created_at: 'now'
updated_at: 'now'
- pirep_id: b68R5gwVzpVe
- id: eER95AJ4XLga
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
@@ -144,7 +664,8 @@ acars:
sim_time: now
created_at: 'now'
updated_at: 'now'
- pirep_id: b68R5gwVzpVe
- id: dPNZvP0O0Gza
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
@@ -162,7 +683,8 @@ acars:
sim_time: now
created_at: 'now'
updated_at: 'now'
- pirep_id: b68R5gwVzpVe
- id: aQW0wQYVm2Yd
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'
@@ -180,7 +702,8 @@ acars:
sim_time: now
created_at: 'now'
updated_at: 'now'
- pirep_id: b68R5gwVzpVe
- id: eXDoE11x32We
pirep_id: b68R5gwVzpVe
type: '0'
nav_type: null
order: '0'

View File

@@ -119,8 +119,8 @@ aircraft:
-
id: 1
subfleet_id: 1
icao: B744
iata: 744
icao: null
iata: null
airport_id: KJFK
landing_time: '2020-10-23 07:50:16'
name: 'Boeing 747-438'
@@ -136,8 +136,8 @@ aircraft:
-
id: 2
subfleet_id: 2
icao: B777
iata: 777
icao: null
iata: null
airport_id: LGRP
landing_time: null
name: 'Boeing 777-200'
@@ -153,8 +153,8 @@ aircraft:
-
id: 3
subfleet_id: 1
icao: B744
iata: 744
icao: null
iata: null
airport_id: KAUS
landing_time: '2020-10-24 08:50:13'
name: 'Boeing 747-412'
@@ -170,8 +170,8 @@ aircraft:
-
id: 4
subfleet_id: 1
icao: B744
iata: 744
icao: null
iata: null
airport_id: KAUS
landing_time: null
name: 'Boeing 747-436 RETIRED'
@@ -187,7 +187,7 @@ aircraft:
-
id: 5
subfleet_id: 4
icao: 'A320'
icao: A320
iata: '320'
airport_id: EGLL
landing_time: null

Some files were not shown because too many files have changed in this diff Show More