Compare commits
93 Commits
snyk-fix-6
...
patch-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db34d0e3e7 | ||
|
|
fffbab7201 | ||
|
|
b9e7a2efc9 | ||
|
|
76a2a16fa6 | ||
|
|
73f88fce0c | ||
|
|
cfbd1c901a | ||
|
|
e70ee5aa6f | ||
|
|
617813bdbf | ||
|
|
f1c54bcc7c | ||
|
|
d94d754961 | ||
|
|
9abfbd6c8c | ||
|
|
97fc1dd43d | ||
|
|
edc37f40fa | ||
|
|
950c7788be | ||
|
|
b3af50ac5a | ||
|
|
8a9b68d9ec | ||
|
|
70a4cf9f90 | ||
|
|
c3465851b2 | ||
|
|
b13c4df338 | ||
|
|
c736a9b639 | ||
|
|
d2e1004e08 | ||
|
|
3800c01d94 | ||
|
|
922e754c9e | ||
|
|
936cd2efd3 | ||
|
|
e22d6d5996 | ||
|
|
efcb7e8895 | ||
|
|
43fbe9e943 | ||
|
|
8fc0aec800 | ||
|
|
bb84fa82a4 | ||
|
|
4fe323a763 | ||
|
|
e3b4a0ed2e | ||
|
|
a4c431d39f | ||
|
|
a52e0410a7 | ||
|
|
baf63361a0 | ||
|
|
b4d5c0fbcd | ||
|
|
6b7eab05e2 | ||
|
|
4c8e31ac6f | ||
|
|
fe41e61c02 | ||
|
|
bd85a04530 | ||
|
|
cbb7d6e274 | ||
|
|
8907527872 | ||
|
|
942c060c99 | ||
|
|
68a9421445 | ||
|
|
4e652c91ae | ||
|
|
a6f62045c4 | ||
|
|
3f3b63da6f | ||
|
|
dd7812e5c5 | ||
|
|
447d02bd4f | ||
|
|
be9b698f14 | ||
|
|
d110c2d951 | ||
|
|
4d20998368 | ||
|
|
4a20b41b25 | ||
|
|
8c2513eb3d | ||
|
|
2dbd58e59e | ||
|
|
bf77f7dd96 | ||
|
|
5a570989de | ||
|
|
6b3207377a | ||
|
|
ac1d5e1555 | ||
|
|
0d45fc287b | ||
|
|
4911f6799d | ||
|
|
5821067231 | ||
|
|
fc7ad7eb6a | ||
|
|
101b3261f5 | ||
|
|
fb0027b140 | ||
|
|
066702e490 | ||
|
|
b4e0515405 | ||
|
|
f5ca8ce6e3 | ||
|
|
7e9196c7e6 | ||
|
|
a2916bf536 | ||
|
|
0578f98b58 | ||
|
|
2e0f0b00ef | ||
|
|
d5d9010134 | ||
|
|
bd8e13e78f | ||
|
|
c4dee07b7f | ||
|
|
f8a44d8c6d | ||
|
|
617cea5df7 | ||
|
|
3a99fe9e0e | ||
|
|
a952071cb4 | ||
|
|
157e0d830c | ||
|
|
a5b83185f5 | ||
|
|
29ff0758a7 | ||
|
|
be74d99ae8 | ||
|
|
53de2e3229 | ||
|
|
80a90c6e3c | ||
|
|
854ed9b92c | ||
|
|
46b17b5c04 | ||
|
|
0068b1215a | ||
|
|
984c1e0cec | ||
|
|
ad8b8e8945 | ||
|
|
2b0056b7c5 | ||
|
|
319a9fc8e1 | ||
|
|
a037597a21 | ||
|
|
4026fe9149 |
78
.travis/deploy_script.sh → .github/scripts/build.sh
vendored
Executable file → Normal file
78
.travis/deploy_script.sh → .github/scripts/build.sh
vendored
Executable file → Normal file
@@ -1,52 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/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 "Version: ${VERSION}"
|
||||||
echo "Full Version: ${FULL_VERSION}"
|
echo "Full Version: ${FULL_VERSION}"
|
||||||
echo "Package name: ${TAR_NAME}"
|
echo "Package name: ${TAR_NAME}"
|
||||||
|
echo "Current directory: ${BASE_DIR}"
|
||||||
echo "==========================="
|
|
||||||
|
|
||||||
echo "Cleaning files"
|
echo "Cleaning files"
|
||||||
|
|
||||||
rm -rf vendor
|
|
||||||
composer install --no-dev --prefer-dist --no-interaction --verbose
|
|
||||||
|
|
||||||
# Leftover individual files to delete
|
# Leftover individual files to delete
|
||||||
declare -a remove_files=(
|
declare -a remove_files=(
|
||||||
.git
|
.git
|
||||||
@@ -107,44 +67,20 @@ mkdir -p storage/framework/cache
|
|||||||
mkdir -p storage/framework/sessions
|
mkdir -p storage/framework/sessions
|
||||||
mkdir -p storage/framework/views
|
mkdir -p storage/framework/views
|
||||||
|
|
||||||
# Regenerate the autoloader and classes
|
|
||||||
composer dump-autoload
|
|
||||||
make clean
|
|
||||||
|
|
||||||
cd /tmp
|
cd /tmp
|
||||||
ls -al $TRAVIS_BUILD_DIR/../
|
|
||||||
|
|
||||||
tar -czf $TAR_NAME -C $TRAVIS_BUILD_DIR .
|
ls -al $BASE_DIR/../
|
||||||
|
|
||||||
|
tar -czf $TAR_NAME -C $BASE_DIR .
|
||||||
sha256sum $TAR_NAME >"$TAR_NAME.sha256"
|
sha256sum $TAR_NAME >"$TAR_NAME.sha256"
|
||||||
tar2zip $TAR_NAME
|
tar2zip $TAR_NAME
|
||||||
sha256sum $ZIP_NAME >"$ZIP_NAME.sha256"
|
sha256sum $ZIP_NAME >"$ZIP_NAME.sha256"
|
||||||
|
|
||||||
ls -al /tmp
|
ls -al /tmp
|
||||||
|
|
||||||
echo "Uploading to S3"
|
echo "Moving to dist"
|
||||||
mkdir -p $TRAVIS_BUILD_DIR/build
|
mkdir -p $BASE_DIR/dist
|
||||||
cd $TRAVIS_BUILD_DIR/build
|
cd $BASE_DIR/dist
|
||||||
|
|
||||||
mv "/tmp/$TAR_NAME" "/tmp/$ZIP_NAME" "/tmp/$TAR_NAME.sha256" "/tmp/$ZIP_NAME.sha256" .
|
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
|
|
||||||
@@ -1,7 +1,3 @@
|
|||||||
<?php
|
|
||||||
exit();
|
|
||||||
?>
|
|
||||||
|
|
||||||
APP_ENV="dev"
|
APP_ENV="dev"
|
||||||
APP_KEY="base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY="
|
APP_KEY="base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY="
|
||||||
APP_URL="http://localhost"
|
APP_URL="http://localhost"
|
||||||
0
.travis/my.cnf → .github/scripts/my.cnf
vendored
0
.travis/my.cnf → .github/scripts/my.cnf
vendored
36
.github/scripts/version.sh
vendored
Normal file
36
.github/scripts/version.sh
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/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
|
||||||
249
.github/workflows/build.yml
vendored
Normal file
249
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,249 @@
|
|||||||
|
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']
|
||||||
|
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') }}
|
||||||
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
|
# 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 }}'
|
||||||
162
.travis.yml
162
.travis.yml
@@ -1,162 +0,0 @@
|
|||||||
#
|
|
||||||
# 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
|
|
||||||
# Downgrade composer version to 1.x
|
|
||||||
- composer self-update --1
|
|
||||||
- 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'
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# 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://github.com/nabeelio/phpvms/actions) [](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](https://docs.phpvms.net/) page.
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ A full development environment can be brought up using Docker:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer install
|
composer install
|
||||||
yarn install
|
npm install
|
||||||
docker-compose build
|
docker-compose build
|
||||||
docker-compose up
|
docker-compose up
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Contracts\Command;
|
use App\Contracts\Command;
|
||||||
use Modules\Installer\Services\ConfigService;
|
use App\Services\Installer\ConfigService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a fresh development install
|
* Create a fresh development install
|
||||||
|
|||||||
@@ -13,7 +13,11 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|||||||
class Kernel extends ConsoleKernel
|
class Kernel extends ConsoleKernel
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Define the application's command schedule.
|
* 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.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||||
*
|
*
|
||||||
@@ -27,10 +31,13 @@ class Kernel extends ConsoleKernel
|
|||||||
$schedule->command(Hourly::class)->hourly();
|
$schedule->command(Hourly::class)->hourly();
|
||||||
|
|
||||||
// When spatie-backups runs
|
// When spatie-backups runs
|
||||||
$schedule->command('backup:clean')->daily()->at('01:00');
|
/*if (config('backup.backup.enabled', false) === true) {
|
||||||
$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
|
// Update the last time the cron was run
|
||||||
|
/** @var CronService $cronSvc */
|
||||||
$cronSvc = app(CronService::class);
|
$cronSvc = app(CronService::class);
|
||||||
$cronSvc->updateLastRunTime();
|
$cronSvc->updateLastRunTime();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,13 +12,24 @@ abstract class Metar
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Implement retrieving the METAR - return the METAR string. Needs to be protected,
|
* Implement retrieving the METAR - return the METAR string. Needs to be protected,
|
||||||
* since this shouldn't be directly called. Call `get_metar($icao)` instead
|
* since this shouldn't be directly called. Call `metar($icao)`. If not implemented,
|
||||||
|
* return a blank string
|
||||||
*
|
*
|
||||||
* @param $icao
|
* @param $icao
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
abstract protected function metar($icao): string;
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download the METAR, wrap in caching
|
* Download the METAR, wrap in caching
|
||||||
@@ -27,9 +38,9 @@ abstract class Metar
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_metar($icao): string
|
public function metar($icao): string
|
||||||
{
|
{
|
||||||
$cache = config('cache.keys.WEATHER_LOOKUP');
|
$cache = config('cache.keys.METAR_WEATHER_LOOKUP');
|
||||||
$key = $cache['key'].$icao;
|
$key = $cache['key'].$icao;
|
||||||
|
|
||||||
if (Cache::has($key)) {
|
if (Cache::has($key)) {
|
||||||
@@ -40,7 +51,7 @@ abstract class Metar
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$raw_metar = $this->metar($icao);
|
$raw_metar = $this->get_metar($icao);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error('Error getting METAR: '.$e->getMessage(), $e->getTrace());
|
Log::error('Error getting METAR: '.$e->getMessage(), $e->getTrace());
|
||||||
return '';
|
return '';
|
||||||
@@ -52,4 +63,37 @@ abstract class Metar
|
|||||||
|
|
||||||
return $raw_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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
52
app/Cron/Hourly/DeletePireps.php
Normal file
52
app/Cron/Hourly/DeletePireps.php
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<?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
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Remove expired bids
|
||||||
|
*
|
||||||
|
* @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()->subHours($expire_time_hours);
|
||||||
|
$pireps = Pirep::whereDate('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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ use App\Contracts\Listener;
|
|||||||
use App\Events\CronMonthly;
|
use App\Events\CronMonthly;
|
||||||
use App\Models\Enums\ExpenseType;
|
use App\Models\Enums\ExpenseType;
|
||||||
use App\Services\Finance\RecurringFinanceService;
|
use App\Services\Finance\RecurringFinanceService;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Go through and apply any finances that are daily
|
* Go through and apply any finances that are daily
|
||||||
@@ -35,6 +36,7 @@ class ApplyExpenses extends Listener
|
|||||||
*/
|
*/
|
||||||
public function handle(CronMonthly $event): void
|
public function handle(CronMonthly $event): void
|
||||||
{
|
{
|
||||||
|
Log::info('Monthly: Applying monthly expenses');
|
||||||
$this->financeSvc->processExpenses(ExpenseType::MONTHLY);
|
$this->financeSvc->processExpenses(ExpenseType::MONTHLY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Contracts\Listener;
|
|||||||
use App\Events\CronNightly;
|
use App\Events\CronNightly;
|
||||||
use App\Models\Enums\ExpenseType;
|
use App\Models\Enums\ExpenseType;
|
||||||
use App\Services\Finance\RecurringFinanceService;
|
use App\Services\Finance\RecurringFinanceService;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Go through and apply any finances that are daily
|
* Go through and apply any finances that are daily
|
||||||
@@ -35,6 +36,7 @@ class ApplyExpenses extends Listener
|
|||||||
*/
|
*/
|
||||||
public function handle(CronNightly $event): void
|
public function handle(CronNightly $event): void
|
||||||
{
|
{
|
||||||
|
Log::info('Nightly: Applying daily expenses');
|
||||||
$this->financeSvc->processExpenses(ExpenseType::DAILY);
|
$this->financeSvc->processExpenses(ExpenseType::DAILY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Cron\Nightly;
|
|||||||
use App\Contracts\Listener;
|
use App\Contracts\Listener;
|
||||||
use App\Events\CronNightly;
|
use App\Events\CronNightly;
|
||||||
use App\Services\SimBriefService;
|
use App\Services\SimBriefService;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear any expired SimBrief flight briefs that aren't attached to a PIREP
|
* Clear any expired SimBrief flight briefs that aren't attached to a PIREP
|
||||||
@@ -23,6 +24,7 @@ class ClearExpiredSimbrief extends Listener
|
|||||||
*/
|
*/
|
||||||
public function handle(CronNightly $event): void
|
public function handle(CronNightly $event): void
|
||||||
{
|
{
|
||||||
|
Log::info('Nightly: Removing expired Simbrief entries');
|
||||||
$this->simbriefSvc->removeExpiredEntries();
|
$this->simbriefSvc->removeExpiredEntries();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Cron\Nightly;
|
|||||||
use App\Contracts\Listener;
|
use App\Contracts\Listener;
|
||||||
use App\Events\CronNightly;
|
use App\Events\CronNightly;
|
||||||
use App\Services\VersionService;
|
use App\Services\VersionService;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if any pilots should be set to ON LEAVE status
|
* Determine if any pilots should be set to ON LEAVE status
|
||||||
@@ -28,6 +29,7 @@ class NewVersionCheck extends Listener
|
|||||||
*/
|
*/
|
||||||
public function handle(CronNightly $event): void
|
public function handle(CronNightly $event): void
|
||||||
{
|
{
|
||||||
|
Log::info('Nightly: Checking for new version');
|
||||||
$this->versionSvc->isNewVersionAvailable();
|
$this->versionSvc->isNewVersionAvailable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,8 @@ namespace App\Cron\Nightly;
|
|||||||
|
|
||||||
use App\Contracts\Listener;
|
use App\Contracts\Listener;
|
||||||
use App\Events\CronNightly;
|
use App\Events\CronNightly;
|
||||||
use App\Models\Enums\UserState;
|
|
||||||
use App\Models\User;
|
|
||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
use Carbon\Carbon;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if any pilots should be set to ON LEAVE status
|
* Determine if any pilots should be set to ON LEAVE status
|
||||||
@@ -18,6 +16,8 @@ class PilotLeave extends Listener
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* PilotLeave constructor.
|
* PilotLeave constructor.
|
||||||
|
*
|
||||||
|
* @param UserService $userSvc
|
||||||
*/
|
*/
|
||||||
public function __construct(UserService $userSvc)
|
public function __construct(UserService $userSvc)
|
||||||
{
|
{
|
||||||
@@ -34,13 +34,9 @@ class PilotLeave extends Listener
|
|||||||
*/
|
*/
|
||||||
public function handle(CronNightly $event): void
|
public function handle(CronNightly $event): void
|
||||||
{
|
{
|
||||||
if (setting('pilots.auto_leave_days') === 0) {
|
Log::info('Cron: Running pilot leave check');
|
||||||
return;
|
$users = $this->userSvc->findUsersOnLeave();
|
||||||
}
|
Log::info('Found '.count($users).' users on leave');
|
||||||
|
|
||||||
$date = Carbon::now()->subDay(setting('pilots.auto_leave_days'));
|
|
||||||
$users = User::where('status', UserState::ACTIVE)
|
|
||||||
->whereDate('updated_at', '<', $date);
|
|
||||||
|
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
Log::info('Setting user '.$user->ident.' to ON LEAVE status');
|
Log::info('Setting user '.$user->ident.' to ON LEAVE status');
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class RecalculateBalances extends Listener
|
|||||||
*/
|
*/
|
||||||
public function handle(CronNightly $event): void
|
public function handle(CronNightly $event): void
|
||||||
{
|
{
|
||||||
Log::info('Recalculating balances');
|
Log::info('Nightly: Recalculating balances');
|
||||||
|
|
||||||
$journals = Journal::all();
|
$journals = Journal::all();
|
||||||
foreach ($journals as $journal) {
|
foreach ($journals as $journal) {
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ class RecalculateStats extends Listener
|
|||||||
*/
|
*/
|
||||||
public function handle(CronNightly $event): void
|
public function handle(CronNightly $event): void
|
||||||
{
|
{
|
||||||
Log::info('Recalculating user stats');
|
Log::info('Nightly: Recalculating user stats');
|
||||||
$this->userSvc->recalculateAllUserStats();
|
$this->userSvc->recalculateAllUserStats();
|
||||||
|
|
||||||
Log::info('Recalcuating aircraft status');
|
Log::info('Nightly: Recalcuating aircraft status');
|
||||||
$this->aircraftSvc->recalculateStats();
|
$this->aircraftSvc->recalculateStats();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ class SetActiveFlights extends Listener
|
|||||||
*/
|
*/
|
||||||
public function handle(CronNightly $event): void
|
public function handle(CronNightly $event): void
|
||||||
{
|
{
|
||||||
|
Log::info('Nightly: Setting active flights');
|
||||||
|
|
||||||
$this->checkFlights();
|
$this->checkFlights();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,23 +44,18 @@ class SetActiveFlights extends Listener
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set to visible by default
|
||||||
|
$flight->visible = true;
|
||||||
|
|
||||||
// dates aren't set, so just save if there were any changes above
|
// dates aren't set, so just save if there were any changes above
|
||||||
// and move onto the next one
|
// and move onto the next one
|
||||||
if ($flight->start_date === null || $flight->end_date === null) {
|
if ($flight->start_date === null || $flight->end_date === null) {
|
||||||
if ($flight->days !== null && $flight->days > 0) {
|
if ($flight->days !== null && $flight->days > 0) {
|
||||||
$visible = Days::isToday($flight->days);
|
$flight->visible = Days::isToday($flight->days);
|
||||||
if ($flight->visible !== $visible) {
|
if (!$flight->visible) {
|
||||||
Log::info('Flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden'));
|
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
|
||||||
|
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
|
||||||
$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();
|
$flight->save();
|
||||||
@@ -71,20 +68,11 @@ class SetActiveFlights extends Listener
|
|||||||
// and then make sure if days of the week are specified, check that too
|
// 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 ($today->gte($flight->start_date) && $today->lte($flight->end_date)) {
|
||||||
if ($flight->days !== null && $flight->days > 0) {
|
if ($flight->days !== null && $flight->days > 0) {
|
||||||
$visible = Days::isToday($flight->days);
|
$flight->visible = Days::isToday($flight->days);
|
||||||
if ($flight->visible !== $visible) {
|
if (!$flight->visible) {
|
||||||
Log::info('Toggling flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden').'');
|
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
|
||||||
|
|
||||||
$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')]));
|
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Log::info('Toggling flight '.$flight->ident.' to visible');
|
|
||||||
$flight->visible = true;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$flight->visible = false;
|
$flight->visible = false;
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?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();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
19
app/Database/migrations/2021_03_05_044305_add_kvp_table.php
Normal file
19
app/Database/migrations/2021_03_05_044305_add_kvp_table.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -119,8 +119,8 @@ aircraft:
|
|||||||
-
|
-
|
||||||
id: 1
|
id: 1
|
||||||
subfleet_id: 1
|
subfleet_id: 1
|
||||||
icao: null
|
icao: B744
|
||||||
iata: null
|
iata: 744
|
||||||
airport_id: KJFK
|
airport_id: KJFK
|
||||||
landing_time: '2020-10-23 07:50:16'
|
landing_time: '2020-10-23 07:50:16'
|
||||||
name: 'Boeing 747-438'
|
name: 'Boeing 747-438'
|
||||||
@@ -136,8 +136,8 @@ aircraft:
|
|||||||
-
|
-
|
||||||
id: 2
|
id: 2
|
||||||
subfleet_id: 2
|
subfleet_id: 2
|
||||||
icao: null
|
icao: B777
|
||||||
iata: null
|
iata: 777
|
||||||
airport_id: LGRP
|
airport_id: LGRP
|
||||||
landing_time: null
|
landing_time: null
|
||||||
name: 'Boeing 777-200'
|
name: 'Boeing 777-200'
|
||||||
@@ -153,8 +153,8 @@ aircraft:
|
|||||||
-
|
-
|
||||||
id: 3
|
id: 3
|
||||||
subfleet_id: 1
|
subfleet_id: 1
|
||||||
icao: null
|
icao: B744
|
||||||
iata: null
|
iata: 744
|
||||||
airport_id: KAUS
|
airport_id: KAUS
|
||||||
landing_time: '2020-10-24 08:50:13'
|
landing_time: '2020-10-24 08:50:13'
|
||||||
name: 'Boeing 747-412'
|
name: 'Boeing 747-412'
|
||||||
@@ -170,8 +170,8 @@ aircraft:
|
|||||||
-
|
-
|
||||||
id: 4
|
id: 4
|
||||||
subfleet_id: 1
|
subfleet_id: 1
|
||||||
icao: null
|
icao: B744
|
||||||
iata: null
|
iata: 744
|
||||||
airport_id: KAUS
|
airport_id: KAUS
|
||||||
landing_time: null
|
landing_time: null
|
||||||
name: 'Boeing 747-436 RETIRED'
|
name: 'Boeing 747-436 RETIRED'
|
||||||
@@ -187,7 +187,7 @@ aircraft:
|
|||||||
-
|
-
|
||||||
id: 5
|
id: 5
|
||||||
subfleet_id: 4
|
subfleet_id: 4
|
||||||
icao: A320
|
icao: 'A320'
|
||||||
iata: '320'
|
iata: '320'
|
||||||
airport_id: EGLL
|
airport_id: EGLL
|
||||||
landing_time: null
|
landing_time: null
|
||||||
|
|||||||
@@ -180,12 +180,12 @@
|
|||||||
type: number
|
type: number
|
||||||
description: 'How much the load factor can vary per-flight'
|
description: 'How much the load factor can vary per-flight'
|
||||||
- key: simbrief.api_key
|
- key: simbrief.api_key
|
||||||
name: 'SimBrief API Key'
|
name: 'Simbrief API Key'
|
||||||
group: simbrief
|
group: simbrief
|
||||||
value: ''
|
value: ''
|
||||||
options: ''
|
options: ''
|
||||||
type: string
|
type: string
|
||||||
description: 'Your SimBrief API key'
|
description: 'Your Simbrief API key'
|
||||||
- key: simbrief.only_bids
|
- key: simbrief.only_bids
|
||||||
name: 'Only allow for bids'
|
name: 'Only allow for bids'
|
||||||
group: simbrief
|
group: simbrief
|
||||||
@@ -194,12 +194,47 @@
|
|||||||
type: boolean
|
type: boolean
|
||||||
description: 'Only allow briefs to be created for bidded flights'
|
description: 'Only allow briefs to be created for bidded flights'
|
||||||
- key: simbrief.expire_days
|
- key: simbrief.expire_days
|
||||||
name: 'SimBrief Expire Time'
|
name: 'Simbrief Expire Time'
|
||||||
group: simbrief
|
group: simbrief
|
||||||
value: 5
|
value: 5
|
||||||
options: ''
|
options: ''
|
||||||
type: number
|
type: number
|
||||||
description: 'Days after how long to remove unused briefs'
|
description: 'Days after how long to remove unused briefs'
|
||||||
|
- key: simbrief.noncharter_pax_weight
|
||||||
|
name: 'Non-Charter Passenger Weight'
|
||||||
|
group: simbrief
|
||||||
|
value: 185
|
||||||
|
options: ''
|
||||||
|
type: number
|
||||||
|
description: 'Passenger weight for non-charter flights excluding baggage (lbs)'
|
||||||
|
- key: simbrief.noncharter_baggage_weight
|
||||||
|
name: 'Non-Charter Baggage Weight'
|
||||||
|
group: simbrief
|
||||||
|
value: 35
|
||||||
|
options: ''
|
||||||
|
type: number
|
||||||
|
description: 'Passenger baggage weight for non-charter flights (lbs)'
|
||||||
|
- key: simbrief.charter_pax_weight
|
||||||
|
name: 'Charter Passenger Weight'
|
||||||
|
group: simbrief
|
||||||
|
value: 168
|
||||||
|
options: ''
|
||||||
|
type: number
|
||||||
|
description: 'Passenger weight for charter flights excluding baggage (lbs)'
|
||||||
|
- key: simbrief.charter_baggage_weight
|
||||||
|
name: 'Charter Baggage Weight'
|
||||||
|
group: simbrief
|
||||||
|
value: 28
|
||||||
|
options: ''
|
||||||
|
type: number
|
||||||
|
description: 'Passenger baggage weight for charter flights (lbs)'
|
||||||
|
- key: simbrief.callsign
|
||||||
|
name: 'Use ATC Callsign'
|
||||||
|
group: simbrief
|
||||||
|
value: false
|
||||||
|
options: ''
|
||||||
|
type: boolean
|
||||||
|
description: 'Use pilot ident as Simbrief ATC Callsign'
|
||||||
- key: pireps.duplicate_check_time
|
- key: pireps.duplicate_check_time
|
||||||
name: 'PIREP duplicate time check'
|
name: 'PIREP duplicate time check'
|
||||||
group: pireps
|
group: pireps
|
||||||
@@ -228,6 +263,27 @@
|
|||||||
options: ''
|
options: ''
|
||||||
type: boolean
|
type: boolean
|
||||||
description: 'When a PIREP is accepted, remove the bid, if it exists'
|
description: 'When a PIREP is accepted, remove the bid, if it exists'
|
||||||
|
- key: pireps.advanced_fuel
|
||||||
|
name: 'Advanced Fuel Calculations'
|
||||||
|
group: pireps
|
||||||
|
value: false
|
||||||
|
options: ''
|
||||||
|
type: boolean
|
||||||
|
description: 'Enables remaining fuel amounts to be considered for fuel expenses'
|
||||||
|
- key: pireps.delete_cancelled_hours
|
||||||
|
name: 'Delete cancelled PIREPs'
|
||||||
|
group: pireps
|
||||||
|
value: 12
|
||||||
|
options: ''
|
||||||
|
type: int
|
||||||
|
description: 'The time in hours to delete a cancelled PIREP'
|
||||||
|
- key: pireps.delete_rejected_hours
|
||||||
|
name: 'Delete rejected PIREPs'
|
||||||
|
group: pireps
|
||||||
|
value: 12
|
||||||
|
options: ''
|
||||||
|
type: int
|
||||||
|
description: 'The time in hours to delete a rejected PIREP'
|
||||||
- key: pilots.id_length
|
- key: pilots.id_length
|
||||||
name: 'Pilot ID Length'
|
name: 'Pilot ID Length'
|
||||||
group: pilots
|
group: pilots
|
||||||
@@ -305,3 +361,9 @@
|
|||||||
options: ''
|
options: ''
|
||||||
type: 'text'
|
type: 'text'
|
||||||
description: 'Discord public channel ID for broadcasat notifications'
|
description: 'Discord public channel ID for broadcasat notifications'
|
||||||
|
- key: 'cron.random_id'
|
||||||
|
name: 'Cron Randomized ID'
|
||||||
|
group: 'cron'
|
||||||
|
value: ''
|
||||||
|
type: 'hidden'
|
||||||
|
description: ''
|
||||||
|
|||||||
37
app/Exceptions/CronInvalid.php
Normal file
37
app/Exceptions/CronInvalid.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exceptions;
|
||||||
|
|
||||||
|
class CronInvalid extends AbstractHttpException
|
||||||
|
{
|
||||||
|
public const MESSAGE = 'Cron ID is disabled or invalid';
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct(400, static::MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the RFC 7807 error type (without the URL root)
|
||||||
|
*/
|
||||||
|
public function getErrorType(): string
|
||||||
|
{
|
||||||
|
return 'cron-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 [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -186,13 +186,13 @@ class AwardController extends Controller
|
|||||||
{
|
{
|
||||||
$award = $this->awardRepository->findWithoutFail($id);
|
$award = $this->awardRepository->findWithoutFail($id);
|
||||||
if (empty($award)) {
|
if (empty($award)) {
|
||||||
Flash::error('Fare not found');
|
Flash::error('Award not found');
|
||||||
|
|
||||||
return redirect(route('admin.awards.index'));
|
return redirect(route('admin.awards.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->awardRepository->delete($id);
|
$this->awardRepository->delete($id);
|
||||||
Flash::success('Fare deleted successfully.');
|
Flash::success('Award deleted successfully.');
|
||||||
|
|
||||||
return redirect(route('admin.awards.index'));
|
return redirect(route('admin.awards.index'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Contracts\Controller;
|
|||||||
use App\Repositories\KvpRepository;
|
use App\Repositories\KvpRepository;
|
||||||
use App\Services\CronService;
|
use App\Services\CronService;
|
||||||
use App\Services\VersionService;
|
use App\Services\VersionService;
|
||||||
|
use App\Support\Utils;
|
||||||
use Codedge\Updater\UpdaterManager;
|
use Codedge\Updater\UpdaterManager;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
@@ -34,7 +35,12 @@ class MaintenanceController extends Controller
|
|||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
// Get the cron URL
|
||||||
|
$cron_id = setting('cron.random_id');
|
||||||
|
$cron_url = empty($cron_id) ? 'Not enabled' : url(route('api.maintenance.cron', $cron_id));
|
||||||
|
|
||||||
return view('admin.maintenance.index', [
|
return view('admin.maintenance.index', [
|
||||||
|
'cron_url' => $cron_url,
|
||||||
'cron_path' => $this->cronSvc->getCronExecString(),
|
'cron_path' => $this->cronSvc->getCronExecString(),
|
||||||
'cron_problem_exists' => $this->cronSvc->cronProblemExists(),
|
'cron_problem_exists' => $this->cronSvc->cronProblemExists(),
|
||||||
'new_version' => $this->kvpRepo->get('new_version_available', false),
|
'new_version' => $this->kvpRepo->get('new_version_available', false),
|
||||||
@@ -117,4 +123,33 @@ class MaintenanceController extends Controller
|
|||||||
|
|
||||||
return redirect('/update/downloader');
|
return redirect('/update/downloader');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable the cron, or if it's enabled, change the ID that is used
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
*/
|
||||||
|
public function cron_enable(Request $request)
|
||||||
|
{
|
||||||
|
$id = Utils::generateNewId(24);
|
||||||
|
setting_save('cron.random_id', $id);
|
||||||
|
|
||||||
|
Flash::success('Web cron refreshed!');
|
||||||
|
return redirect(route('admin.maintenance.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the web cron
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function cron_disable(Request $request)
|
||||||
|
{
|
||||||
|
setting_save('cron.random_id', '');
|
||||||
|
|
||||||
|
Flash::success('Web cron disabled!');
|
||||||
|
return redirect(route('admin.maintenance.index'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -394,10 +394,10 @@ class PirepController extends Controller
|
|||||||
return redirect(route('admin.pireps.index'));
|
return redirect(route('admin.pireps.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->pirepRepo->delete($id);
|
$this->pirepSvc->delete($pirep);
|
||||||
|
|
||||||
Flash::success('Pirep deleted successfully.');
|
Flash::success('Pirep deleted successfully.');
|
||||||
return redirect(route('admin.pireps.index'));
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class SettingsController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$settings = Setting::orderBy('order', 'asc')->get();
|
$settings = Setting::where('type', '!=', 'hidden')->orderBy('order')->get();
|
||||||
$settings = $settings->groupBy('group');
|
$settings = $settings->groupBy('group');
|
||||||
|
|
||||||
return view('admin.settings.index', [
|
return view('admin.settings.index', [
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use App\Http\Controllers\Admin\Traits\Importable;
|
|||||||
use App\Http\Requests\CreateSubfleetRequest;
|
use App\Http\Requests\CreateSubfleetRequest;
|
||||||
use App\Http\Requests\UpdateSubfleetRequest;
|
use App\Http\Requests\UpdateSubfleetRequest;
|
||||||
use App\Models\Airline;
|
use App\Models\Airline;
|
||||||
|
use App\Models\Airport;
|
||||||
use App\Models\Enums\FareType;
|
use App\Models\Enums\FareType;
|
||||||
use App\Models\Enums\FuelType;
|
use App\Models\Enums\FuelType;
|
||||||
use App\Models\Enums\ImportExportType;
|
use App\Models\Enums\ImportExportType;
|
||||||
@@ -133,6 +134,7 @@ class SubfleetController extends Controller
|
|||||||
{
|
{
|
||||||
return view('admin.subfleets.create', [
|
return view('admin.subfleets.create', [
|
||||||
'airlines' => Airline::all()->pluck('name', 'id'),
|
'airlines' => Airline::all()->pluck('name', 'id'),
|
||||||
|
'hubs' => Airport::where('hub', 1)->pluck('name', 'id'),
|
||||||
'fuel_types' => FuelType::labels(),
|
'fuel_types' => FuelType::labels(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -203,6 +205,7 @@ class SubfleetController extends Controller
|
|||||||
|
|
||||||
return view('admin.subfleets.edit', [
|
return view('admin.subfleets.edit', [
|
||||||
'airlines' => Airline::all()->pluck('name', 'id'),
|
'airlines' => Airline::all()->pluck('name', 'id'),
|
||||||
|
'hubs' => Airport::where('hub', 1)->pluck('name', 'id'),
|
||||||
'fuel_types' => FuelType::labels(),
|
'fuel_types' => FuelType::labels(),
|
||||||
'avail_fares' => $avail_fares,
|
'avail_fares' => $avail_fares,
|
||||||
'avail_ranks' => $avail_ranks,
|
'avail_ranks' => $avail_ranks,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use App\Exceptions\AssetNotFound;
|
|||||||
use App\Http\Resources\Flight as FlightResource;
|
use App\Http\Resources\Flight as FlightResource;
|
||||||
use App\Http\Resources\Navdata as NavdataResource;
|
use App\Http\Resources\Navdata as NavdataResource;
|
||||||
use App\Models\SimBrief;
|
use App\Models\SimBrief;
|
||||||
|
use App\Models\User;
|
||||||
use App\Repositories\Criteria\WhereCriteria;
|
use App\Repositories\Criteria\WhereCriteria;
|
||||||
use App\Repositories\FlightRepository;
|
use App\Repositories\FlightRepository;
|
||||||
use App\Services\FareService;
|
use App\Services\FareService;
|
||||||
@@ -152,20 +153,25 @@ class FlightController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function briefing($id)
|
public function briefing(string $id)
|
||||||
{
|
{
|
||||||
|
/** @var User $user */
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$w = [
|
$w = [
|
||||||
'user_id' => $user->id,
|
'id' => $id,
|
||||||
'flight_id' => $id,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** @var SimBrief $simbrief */
|
||||||
$simbrief = SimBrief::where($w)->first();
|
$simbrief = SimBrief::where($w)->first();
|
||||||
|
|
||||||
if ($simbrief === null) {
|
if ($simbrief === null) {
|
||||||
throw new AssetNotFound(new Exception('Flight briefing not found'));
|
throw new AssetNotFound(new Exception('Flight briefing not found'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*if ($simbrief->user_id !== $user->id) {
|
||||||
|
throw new Unauthorized(new Exception('User cannot access another user\'s simbrief'));
|
||||||
|
}*/
|
||||||
|
|
||||||
return response($simbrief->acars_xml, 200, [
|
return response($simbrief->acars_xml, 200, [
|
||||||
'Content-Type' => 'application/xml',
|
'Content-Type' => 'application/xml',
|
||||||
]);
|
]);
|
||||||
|
|||||||
35
app/Http/Controllers/Api/MaintenanceController.php
Normal file
35
app/Http/Controllers/Api/MaintenanceController.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Contracts\Controller;
|
||||||
|
use App\Exceptions\CronInvalid;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
|
class MaintenanceController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the cron job from the web
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @param string $id The ID passed in for the cron
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function cron(Request $request, string $id)
|
||||||
|
{
|
||||||
|
$cron_id = setting('cron.random_id');
|
||||||
|
if (empty($cron_id) || $id !== $cron_id) {
|
||||||
|
throw new CronInvalid();
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = '';
|
||||||
|
Artisan::call('schedule:run');
|
||||||
|
$output .= trim(Artisan::output());
|
||||||
|
|
||||||
|
return response([
|
||||||
|
'content' => $output,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,8 +22,6 @@ use App\Models\Acars;
|
|||||||
use App\Models\Enums\AcarsType;
|
use App\Models\Enums\AcarsType;
|
||||||
use App\Models\Enums\PirepFieldSource;
|
use App\Models\Enums\PirepFieldSource;
|
||||||
use App\Models\Enums\PirepSource;
|
use App\Models\Enums\PirepSource;
|
||||||
use App\Models\Enums\PirepState;
|
|
||||||
use App\Models\Enums\PirepStatus;
|
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
use App\Models\PirepComment;
|
use App\Models\PirepComment;
|
||||||
use App\Repositories\AcarsRepository;
|
use App\Repositories\AcarsRepository;
|
||||||
@@ -38,9 +36,6 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class PirepController
|
|
||||||
*/
|
|
||||||
class PirepController extends Controller
|
class PirepController extends Controller
|
||||||
{
|
{
|
||||||
private $acarsRepo;
|
private $acarsRepo;
|
||||||
@@ -93,6 +88,10 @@ class PirepController extends Controller
|
|||||||
$attrs['created_at'] = Carbon::createFromTimeString($attrs['created_at']);
|
$attrs['created_at'] = Carbon::createFromTimeString($attrs['created_at']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('submitted_at', $attrs)) {
|
||||||
|
$attrs['submitted_at'] = Carbon::createFromTimeString($attrs['submitted_at']);
|
||||||
|
}
|
||||||
|
|
||||||
if (array_key_exists('updated_at', $attrs)) {
|
if (array_key_exists('updated_at', $attrs)) {
|
||||||
$attrs['updated_at'] = Carbon::createFromTimeString($attrs['updated_at']);
|
$attrs['updated_at'] = Carbon::createFromTimeString($attrs['updated_at']);
|
||||||
}
|
}
|
||||||
@@ -306,14 +305,8 @@ class PirepController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$attrs['state'] = PirepState::PENDING;
|
|
||||||
$attrs['status'] = PirepStatus::ARRIVED;
|
|
||||||
$attrs['submitted_at'] = Carbon::now('UTC');
|
|
||||||
|
|
||||||
$pirep = $this->pirepRepo->update($attrs, $pirep_id);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$pirep = $this->pirepSvc->create($pirep);
|
$pirep = $this->pirepSvc->file($pirep, $attrs);
|
||||||
$this->updateFields($pirep, $request);
|
$this->updateFields($pirep, $request);
|
||||||
$this->updateFares($pirep, $request);
|
$this->updateFares($pirep, $request);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@@ -106,7 +106,8 @@ class UserController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function bids(Request $request)
|
public function bids(Request $request)
|
||||||
{
|
{
|
||||||
$user = $this->userSvc->getUser($this->getUserId($request));
|
$user_id = $this->getUserId($request);
|
||||||
|
$user = $this->userSvc->getUser($user_id);
|
||||||
|
|
||||||
// Add a bid
|
// Add a bid
|
||||||
if ($request->isMethod('PUT') || $request->isMethod('POST')) {
|
if ($request->isMethod('PUT') || $request->isMethod('POST')) {
|
||||||
|
|||||||
@@ -28,7 +28,10 @@ class DashboardController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
//dd(config('backup'));
|
||||||
$last_pirep = null;
|
$last_pirep = null;
|
||||||
|
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Frontend;
|
|||||||
|
|
||||||
use App\Contracts\Controller;
|
use App\Contracts\Controller;
|
||||||
use App\Models\Bid;
|
use App\Models\Bid;
|
||||||
|
use App\Models\Enums\FlightType;
|
||||||
use App\Repositories\AirlineRepository;
|
use App\Repositories\AirlineRepository;
|
||||||
use App\Repositories\AirportRepository;
|
use App\Repositories\AirportRepository;
|
||||||
use App\Repositories\Criteria\WhereCriteria;
|
use App\Repositories\Criteria\WhereCriteria;
|
||||||
@@ -105,7 +106,13 @@ class FlightController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$flights = $this->flightRepo->searchCriteria($request)
|
$flights = $this->flightRepo->searchCriteria($request)
|
||||||
->with(['dpt_airport', 'arr_airport', 'airline'])
|
->with([
|
||||||
|
'dpt_airport',
|
||||||
|
'arr_airport',
|
||||||
|
'airline',
|
||||||
|
'simbrief' => function ($query) use ($user) {
|
||||||
|
$query->where('user_id', $user->id);
|
||||||
|
}, ])
|
||||||
->orderBy('flight_number', 'asc')
|
->orderBy('flight_number', 'asc')
|
||||||
->orderBy('route_leg', 'asc')
|
->orderBy('route_leg', 'asc')
|
||||||
->paginate();
|
->paginate();
|
||||||
@@ -114,12 +121,15 @@ class FlightController extends Controller
|
|||||||
->pluck('flight_id')->toArray();
|
->pluck('flight_id')->toArray();
|
||||||
|
|
||||||
return view('flights.index', [
|
return view('flights.index', [
|
||||||
|
'user' => $user,
|
||||||
'airlines' => $this->airlineRepo->selectBoxList(true),
|
'airlines' => $this->airlineRepo->selectBoxList(true),
|
||||||
'airports' => $this->airportRepo->selectBoxList(true),
|
'airports' => $this->airportRepo->selectBoxList(true),
|
||||||
'flights' => $flights,
|
'flights' => $flights,
|
||||||
'saved' => $saved_flights,
|
'saved' => $saved_flights,
|
||||||
'subfleets' => $this->subfleetRepo->selectBoxList(true),
|
'subfleets' => $this->subfleetRepo->selectBoxList(true),
|
||||||
'flight_number' => $request->input('flight_number'),
|
'flight_number' => $request->input('flight_number'),
|
||||||
|
'flight_types' => FlightType::select(true),
|
||||||
|
'flight_type' => $request->input('flight_type'),
|
||||||
'arr_icao' => $request->input('arr_icao'),
|
'arr_icao' => $request->input('arr_icao'),
|
||||||
'dep_icao' => $request->input('dep_icao'),
|
'dep_icao' => $request->input('dep_icao'),
|
||||||
'subfleet_id' => $request->input('subfleet_id'),
|
'subfleet_id' => $request->input('subfleet_id'),
|
||||||
@@ -144,11 +154,18 @@ class FlightController extends Controller
|
|||||||
$flights = collect();
|
$flights = collect();
|
||||||
$saved_flights = [];
|
$saved_flights = [];
|
||||||
foreach ($user->bids as $bid) {
|
foreach ($user->bids as $bid) {
|
||||||
|
// Remove any invalid bids (flight doesn't exist or something)
|
||||||
|
if (!$bid->flight) {
|
||||||
|
$bid->delete();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$flights->add($bid->flight);
|
$flights->add($bid->flight);
|
||||||
$saved_flights[] = $bid->flight->id;
|
$saved_flights[] = $bid->flight->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('flights.bids', [
|
return view('flights.bids', [
|
||||||
|
'user' => $user,
|
||||||
'airlines' => $this->airlineRepo->selectBoxList(true),
|
'airlines' => $this->airlineRepo->selectBoxList(true),
|
||||||
'airports' => $this->airportRepo->selectBoxList(true),
|
'airports' => $this->airportRepo->selectBoxList(true),
|
||||||
'flights' => $flights,
|
'flights' => $flights,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use App\Http\Requests\CreatePirepRequest;
|
|||||||
use App\Http\Requests\UpdatePirepRequest;
|
use App\Http\Requests\UpdatePirepRequest;
|
||||||
use App\Models\Enums\PirepSource;
|
use App\Models\Enums\PirepSource;
|
||||||
use App\Models\Enums\PirepState;
|
use App\Models\Enums\PirepState;
|
||||||
use App\Models\Enums\PirepStatus;
|
use App\Models\Fare;
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
use App\Models\SimBrief;
|
use App\Models\SimBrief;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
@@ -253,23 +253,48 @@ class PirepController extends Controller
|
|||||||
/**
|
/**
|
||||||
* They have a SimBrief ID, load that up and figure out the flight that it's from
|
* They have a SimBrief ID, load that up and figure out the flight that it's from
|
||||||
*/
|
*/
|
||||||
|
$fare_values = [];
|
||||||
|
$simbrief = null;
|
||||||
$simbrief_id = null;
|
$simbrief_id = null;
|
||||||
|
$aircraft = null;
|
||||||
if ($request->has('sb_id')) {
|
if ($request->has('sb_id')) {
|
||||||
$simbrief_id = $request->input('sb_id');
|
$simbrief_id = $request->input('sb_id');
|
||||||
$brief = SimBrief::find($simbrief_id);
|
$simbrief = SimBrief::find($simbrief_id);
|
||||||
$pirep = Pirep::fromSimBrief($brief);
|
$pirep = Pirep::fromSimBrief($simbrief);
|
||||||
|
|
||||||
|
$aircraft = $simbrief->aircraft;
|
||||||
|
$aircraft_list[$aircraft->subfleet->name] = [];
|
||||||
|
$aircraft_list[$aircraft->subfleet->name][$aircraft->id] = $aircraft->name.' - '.$aircraft->registration;
|
||||||
|
|
||||||
|
// Convert the fare data into the expected output format
|
||||||
|
if (!empty($simbrief->fare_data)) {
|
||||||
|
$fare_values = json_decode($simbrief->fare_data, true);
|
||||||
|
$fares = [];
|
||||||
|
$fare_data = json_decode($simbrief->fare_data, true);
|
||||||
|
foreach ($fare_data as $fare) {
|
||||||
|
$fares[] = new Fare($fare);
|
||||||
|
}
|
||||||
|
|
||||||
|
$aircraft->subfleet->fares = collect($fares);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Set more fields from the Simbrief to the PIREP form
|
||||||
|
} else {
|
||||||
|
$aircraft_list = $this->aircraftList(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('pireps.create', [
|
return view('pireps.create', [
|
||||||
'aircraft' => null,
|
'aircraft' => $aircraft,
|
||||||
'pirep' => $pirep,
|
'pirep' => $pirep,
|
||||||
'read_only' => false,
|
'read_only' => false,
|
||||||
'airline_list' => $this->airlineRepo->selectBoxList(true),
|
'airline_list' => $this->airlineRepo->selectBoxList(true),
|
||||||
'aircraft_list' => $this->aircraftList(true),
|
'aircraft_list' => $aircraft_list,
|
||||||
'airport_list' => $this->airportRepo->selectBoxList(true),
|
'airport_list' => $this->airportRepo->selectBoxList(true),
|
||||||
'pirep_fields' => $this->pirepFieldRepo->all(),
|
'pirep_fields' => $this->pirepFieldRepo->all(),
|
||||||
'field_values' => [],
|
'field_values' => [],
|
||||||
|
'fare_values' => $fare_values,
|
||||||
'simbrief_id' => $simbrief_id,
|
'simbrief_id' => $simbrief_id,
|
||||||
|
'simbrief' => $simbrief,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,12 +518,8 @@ class PirepController extends Controller
|
|||||||
$this->pirepSvc->submit($pirep);
|
$this->pirepSvc->submit($pirep);
|
||||||
Flash::success('PIREP submitted!');
|
Flash::success('PIREP submitted!');
|
||||||
} elseif ($attrs['submit'] === 'delete' || $attrs['submit'] === 'cancel') {
|
} elseif ($attrs['submit'] === 'delete' || $attrs['submit'] === 'cancel') {
|
||||||
$this->pirepRepo->update([
|
$this->pirepSvc->delete($pirep);
|
||||||
'state' => PirepState::CANCELLED,
|
Flash::success('PIREP deleted!');
|
||||||
'status' => PirepStatus::CANCELLED,
|
|
||||||
], $pirep->id);
|
|
||||||
|
|
||||||
Flash::success('PIREP cancelled!');
|
|
||||||
return redirect(route('frontend.pireps.index'));
|
return redirect(route('frontend.pireps.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class ProfileController extends Controller
|
|||||||
{
|
{
|
||||||
// Is the ACARS module enabled?
|
// Is the ACARS module enabled?
|
||||||
$acars_enabled = false;
|
$acars_enabled = false;
|
||||||
$acars = Module::find('VMSACARS');
|
$acars = Module::find('VMSAcars');
|
||||||
if ($acars) {
|
if ($acars) {
|
||||||
$acars_enabled = $acars->isEnabled();
|
$acars_enabled = $acars->isEnabled();
|
||||||
}
|
}
|
||||||
@@ -95,6 +95,7 @@ class ProfileController extends Controller
|
|||||||
'user' => $user,
|
'user' => $user,
|
||||||
'userFields' => $userFields,
|
'userFields' => $userFields,
|
||||||
'airports' => $airports,
|
'airports' => $airports,
|
||||||
|
'acars' => $this->acarsEnabled(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +122,7 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
$airlines = $this->airlineRepo->selectBoxList();
|
$airlines = $this->airlineRepo->selectBoxList();
|
||||||
$airports = $this->airportRepo->selectBoxList(false, setting('pilots.home_hubs_only'));
|
$airports = $this->airportRepo->selectBoxList(false, setting('pilots.home_hubs_only'));
|
||||||
$userFields = $this->userRepo->getUserFields($user, false);
|
$userFields = $this->userRepo->getUserFields($user, true);
|
||||||
|
|
||||||
return view('profile.edit', [
|
return view('profile.edit', [
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
|
|||||||
@@ -3,22 +3,38 @@
|
|||||||
namespace App\Http\Controllers\Frontend;
|
namespace App\Http\Controllers\Frontend;
|
||||||
|
|
||||||
use App\Exceptions\AssetNotFound;
|
use App\Exceptions\AssetNotFound;
|
||||||
|
use App\Models\Aircraft;
|
||||||
|
use App\Models\Enums\FareType;
|
||||||
|
use App\Models\Enums\FlightType;
|
||||||
|
use App\Models\Fare;
|
||||||
|
use App\Models\Flight;
|
||||||
use App\Models\SimBrief;
|
use App\Models\SimBrief;
|
||||||
|
use App\Models\User;
|
||||||
use App\Repositories\FlightRepository;
|
use App\Repositories\FlightRepository;
|
||||||
|
use App\Services\FareService;
|
||||||
use App\Services\SimBriefService;
|
use App\Services\SimBriefService;
|
||||||
|
use App\Services\UserService;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
class SimBriefController
|
class SimBriefController
|
||||||
{
|
{
|
||||||
|
private $fareSvc;
|
||||||
private $flightRepo;
|
private $flightRepo;
|
||||||
private $simBriefSvc;
|
private $simBriefSvc;
|
||||||
|
private $userSvc;
|
||||||
|
|
||||||
public function __construct(FlightRepository $flightRepo, SimBriefService $simBriefSvc)
|
public function __construct(
|
||||||
{
|
FareService $fareSvc,
|
||||||
|
FlightRepository $flightRepo,
|
||||||
|
SimBriefService $simBriefSvc,
|
||||||
|
UserService $userSvc
|
||||||
|
) {
|
||||||
|
$this->fareSvc = $fareSvc;
|
||||||
$this->flightRepo = $flightRepo;
|
$this->flightRepo = $flightRepo;
|
||||||
$this->simBriefSvc = $simBriefSvc;
|
$this->simBriefSvc = $simBriefSvc;
|
||||||
|
$this->userSvc = $userSvc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,8 +48,15 @@ class SimBriefController
|
|||||||
*/
|
*/
|
||||||
public function generate(Request $request)
|
public function generate(Request $request)
|
||||||
{
|
{
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
$flight_id = $request->input('flight_id');
|
$flight_id = $request->input('flight_id');
|
||||||
$flight = $this->flightRepo->find($flight_id);
|
$aircraft_id = $request->input('aircraft_id');
|
||||||
|
|
||||||
|
/** @var Flight $flight */
|
||||||
|
$flight = $this->flightRepo->with(['fares', 'subfleets'])->find($flight_id);
|
||||||
|
|
||||||
if (!$flight) {
|
if (!$flight) {
|
||||||
flash()->error('Unknown flight');
|
flash()->error('Unknown flight');
|
||||||
return redirect(route('frontend.flights.index'));
|
return redirect(route('frontend.flights.index'));
|
||||||
@@ -45,7 +68,22 @@ class SimBriefController
|
|||||||
return redirect(route('frontend.flights.index'));
|
return redirect(route('frontend.flights.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = Auth::user();
|
// No aircraft selected, show selection form
|
||||||
|
if (!$aircraft_id) {
|
||||||
|
// If no subfleets defined for flight get them from user
|
||||||
|
if ($flight->subfleets->count() > 0) {
|
||||||
|
$subfleets = $flight->subfleets;
|
||||||
|
} else {
|
||||||
|
$subfleets = $this->userSvc->getAllowableSubfleets($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('flights.simbrief_aircraft', [
|
||||||
|
'flight' => $flight,
|
||||||
|
'subfleets' => $subfleets,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if a Simbrief profile already exists
|
||||||
$simbrief = SimBrief::select('id')->where([
|
$simbrief = SimBrief::select('id')->where([
|
||||||
'flight_id' => $flight_id,
|
'flight_id' => $flight_id,
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
@@ -55,8 +93,119 @@ class SimBriefController
|
|||||||
return redirect(route('frontend.simbrief.briefing', [$simbrief->id]));
|
return redirect(route('frontend.simbrief.briefing', [$simbrief->id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SimBrief profile does not exists and everything else is ok
|
||||||
|
// Select aircraft which will be used for calculations and details
|
||||||
|
/** @var Aircraft $aircraft */
|
||||||
|
$aircraft = Aircraft::where('id', $aircraft_id)->first();
|
||||||
|
|
||||||
|
// Figure out the proper fares to use for this flight/aircraft
|
||||||
|
$all_fares = $this->fareSvc->getFareWithOverrides($aircraft->subfleet->fares, $flight->fares);
|
||||||
|
|
||||||
|
// TODO: Reconcile the fares for this aircraft w/ proper for the flight/subfleet
|
||||||
|
|
||||||
|
// Get passenger and baggage weights with failsafe defaults
|
||||||
|
if ($flight->flight_type === FlightType::CHARTER_PAX_ONLY) {
|
||||||
|
$pax_weight = setting('simbrief.charter_pax_weight', 168);
|
||||||
|
$bag_weight = setting('simbrief.charter_baggage_weight', 28);
|
||||||
|
} else {
|
||||||
|
$pax_weight = setting('simbrief.noncharter_pax_weight', 185);
|
||||||
|
$bag_weight = setting('simbrief.noncharter_baggage_weight', 35);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the load factors with failsafe for loadmax if nothing is defined
|
||||||
|
$lfactor = $flight->load_factor ?? setting('flights.default_load_factor');
|
||||||
|
$lfactorv = $flight->load_factor_variance ?? setting('flights.load_factor_variance');
|
||||||
|
|
||||||
|
$loadmin = $lfactor - $lfactorv;
|
||||||
|
$loadmin = $loadmin < 0 ? 0 : $loadmin;
|
||||||
|
|
||||||
|
$loadmax = $lfactor + $lfactorv;
|
||||||
|
$loadmax = $loadmax > 100 ? 100 : $loadmax;
|
||||||
|
|
||||||
|
if ($loadmax === 0) {
|
||||||
|
$loadmax = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load fares for passengers
|
||||||
|
|
||||||
|
$loaddist = []; // The load distribution string
|
||||||
|
|
||||||
|
$pax_load_sheet = [];
|
||||||
|
$tpaxfig = 0;
|
||||||
|
|
||||||
|
/** @var Fare $fare */
|
||||||
|
foreach ($all_fares as $fare) {
|
||||||
|
if ($fare->type !== FareType::PASSENGER || empty($fare->capacity)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = floor(($fare->capacity * rand($loadmin, $loadmax)) / 100);
|
||||||
|
$tpaxfig += $count;
|
||||||
|
$pax_load_sheet[] = [
|
||||||
|
'id' => $fare->id,
|
||||||
|
'code' => $fare->code,
|
||||||
|
'name' => $fare->name,
|
||||||
|
'type' => $fare->type,
|
||||||
|
'capacity' => (int) $fare->capacity,
|
||||||
|
'count' => $count,
|
||||||
|
];
|
||||||
|
|
||||||
|
$loaddist[] = $fare->code.' '.$count;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate total weights
|
||||||
|
if (setting('units.weight') === 'kg') {
|
||||||
|
$tpaxload = round(($pax_weight * $tpaxfig) / 2.205);
|
||||||
|
$tbagload = round(($bag_weight * $tpaxfig) / 2.205);
|
||||||
|
} else {
|
||||||
|
$tpaxload = round($pax_weight * $tpaxfig);
|
||||||
|
$tbagload = round($bag_weight * $tpaxfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load up fares for cargo
|
||||||
|
|
||||||
|
$tcargoload = 0;
|
||||||
|
$cargo_load_sheet = [];
|
||||||
|
foreach ($all_fares as $fare) {
|
||||||
|
if ($fare->type !== FareType::CARGO || empty($fare->capacity)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = ceil((($fare->capacity - $tbagload) * rand($loadmin, $loadmax)) / 100);
|
||||||
|
$tcargoload += $count;
|
||||||
|
$cargo_load_sheet[] = [
|
||||||
|
'id' => $fare->id,
|
||||||
|
'code' => $fare->code,
|
||||||
|
'name' => $fare->name,
|
||||||
|
'type' => $fare->type,
|
||||||
|
'capacity' => $fare->capacity,
|
||||||
|
'count' => $count,
|
||||||
|
];
|
||||||
|
|
||||||
|
$loaddist[] = $fare->code.' '.$count;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tpayload = $tpaxload + $tbagload + $tcargoload;
|
||||||
|
|
||||||
|
$request->session()->put('simbrief_fares', array_merge($pax_load_sheet, $cargo_load_sheet));
|
||||||
|
|
||||||
|
// Show the main simbrief form
|
||||||
return view('flights.simbrief_form', [
|
return view('flights.simbrief_form', [
|
||||||
'flight' => $flight,
|
'user' => Auth::user(),
|
||||||
|
'flight' => $flight,
|
||||||
|
'aircraft' => $aircraft,
|
||||||
|
'pax_weight' => $pax_weight,
|
||||||
|
'bag_weight' => $bag_weight,
|
||||||
|
'loadmin' => $loadmin,
|
||||||
|
'loadmax' => $loadmax,
|
||||||
|
'pax_load_sheet' => $pax_load_sheet,
|
||||||
|
'cargo_load_sheet' => $cargo_load_sheet,
|
||||||
|
'tpaxfig' => $tpaxfig,
|
||||||
|
'tpaxload' => $tpaxload,
|
||||||
|
'tbagload' => $tbagload,
|
||||||
|
'tpayload' => $tpayload,
|
||||||
|
'tcargoload' => $tcargoload,
|
||||||
|
'loaddist' => implode(' ', $loaddist),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,11 +224,53 @@ class SimBriefController
|
|||||||
return redirect(route('frontend.flights.index'));
|
return redirect(route('frontend.flights.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$str = $simbrief->xml->aircraft->equip;
|
||||||
|
$wc = stripos($str, '-');
|
||||||
|
$tr = stripos($str, '/');
|
||||||
|
$wakecat = substr($str, 0, $wc);
|
||||||
|
$equipment = substr($str, $wc + 1, $tr - 2);
|
||||||
|
$transponder = substr($str, $tr + 1);
|
||||||
|
|
||||||
return view('flights.simbrief_briefing', [
|
return view('flights.simbrief_briefing', [
|
||||||
'simbrief' => $simbrief,
|
'simbrief' => $simbrief,
|
||||||
|
'wakecat' => $wakecat,
|
||||||
|
'equipment' => $equipment,
|
||||||
|
'transponder' => $transponder,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the flight_id from the SimBrief Briefing (to a create a new one)
|
||||||
|
* or if no pirep_id is attached to the briefing delete it completely
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
*
|
||||||
|
* @throws \Exception
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
|
*/
|
||||||
|
public function generate_new(Request $request)
|
||||||
|
{
|
||||||
|
$simbrief = SimBrief::find($request->id);
|
||||||
|
|
||||||
|
// Invalid Simbrief ID/profile, go back to the main flight index
|
||||||
|
if (!$simbrief) {
|
||||||
|
return redirect(route('frontend.flights.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup the current Simbrief entry and redirect to the new generation form
|
||||||
|
// If there isn't a PIREP ID, then delete the entry, otherwise, remove the flight
|
||||||
|
$flight_id = $simbrief->flight_id;
|
||||||
|
if (!$simbrief->pirep_id) {
|
||||||
|
$simbrief->delete();
|
||||||
|
} else {
|
||||||
|
$simbrief->flight_id = null;
|
||||||
|
$simbrief->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect(route('frontend.simbrief.generate').'?flight_id='.$flight_id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a prefile of this PIREP with a given OFP. Then redirect the
|
* Create a prefile of this PIREP with a given OFP. Then redirect the
|
||||||
* user to the newly prefiled PIREP
|
* user to the newly prefiled PIREP
|
||||||
@@ -119,6 +310,7 @@ class SimBriefController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the OFP was generated. Pass in two items, the flight_id and ofp_id
|
* Check whether the OFP was generated. Pass in two items, the flight_id and ofp_id
|
||||||
|
* This does the actual "attachment" of the Simbrief to the flight
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
*
|
*
|
||||||
@@ -126,10 +318,14 @@ class SimBriefController
|
|||||||
*/
|
*/
|
||||||
public function check_ofp(Request $request)
|
public function check_ofp(Request $request)
|
||||||
{
|
{
|
||||||
|
/** @var User $user */
|
||||||
|
$user = Auth::user();
|
||||||
$ofp_id = $request->input('ofp_id');
|
$ofp_id = $request->input('ofp_id');
|
||||||
$flight_id = $request->input('flight_id');
|
$flight_id = $request->input('flight_id');
|
||||||
|
$aircraft_id = $request->input('aircraft_id');
|
||||||
|
$fares = $request->session()->get('simbrief_fares', []);
|
||||||
|
|
||||||
$simbrief = $this->simBriefSvc->checkForOfp(Auth::user()->id, $ofp_id, $flight_id);
|
$simbrief = $this->simBriefSvc->downloadOfp($user->id, $ofp_id, $flight_id, $aircraft_id, $fares);
|
||||||
if ($simbrief === null) {
|
if ($simbrief === null) {
|
||||||
$error = new AssetNotFound(new Exception('Simbrief OFP not found'));
|
$error = new AssetNotFound(new Exception('Simbrief OFP not found'));
|
||||||
return $error->getResponse();
|
return $error->getResponse();
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class ApiAuth implements Middleware
|
|||||||
return $this->unauthorized('User not found with key "'.$api_key.'"');
|
return $this->unauthorized('User not found with key "'.$api_key.'"');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->state !== UserState::ACTIVE) {
|
if ($user->state !== UserState::ACTIVE && $user->state !== UserState::ON_LEAVE) {
|
||||||
return $this->unauthorized('User is not ACTIVE, please contact an administrator');
|
return $this->unauthorized('User is not ACTIVE, please contact an administrator');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class Fare extends Resource
|
|||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'capacity' => $this->capacity,
|
'capacity' => $this->capacity,
|
||||||
'cost' => $this->cost,
|
'cost' => $this->cost,
|
||||||
|
'count' => $this->count ?? 0,
|
||||||
'price' => $this->price,
|
'price' => $this->price,
|
||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
'notes' => $this->notes,
|
'notes' => $this->notes,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class Pirep extends Resource
|
|||||||
{
|
{
|
||||||
$res = parent::toArray($request);
|
$res = parent::toArray($request);
|
||||||
$res['ident'] = $this->ident;
|
$res['ident'] = $this->ident;
|
||||||
|
$res['phase'] = $this->status;
|
||||||
$res['status_text'] = PirepStatus::label($this->status);
|
$res['status_text'] = PirepStatus::label($this->status);
|
||||||
|
|
||||||
// Set these to the response units
|
// Set these to the response units
|
||||||
@@ -37,6 +38,13 @@ class Pirep extends Resource
|
|||||||
$distance = new Distance($res['distance'], config('phpvms.internal_units.distance'));
|
$distance = new Distance($res['distance'], config('phpvms.internal_units.distance'));
|
||||||
$res['distance'] = $distance->getResponseUnits();
|
$res['distance'] = $distance->getResponseUnits();
|
||||||
|
|
||||||
|
if (!array_key_exists('block_fuel', $res)) {
|
||||||
|
$res['block_fuel'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$block_fuel = new Fuel($res['block_fuel'], config('phpvms.internal_units.fuel'));
|
||||||
|
$res['block_fuel'] = $block_fuel->getResponseUnits();
|
||||||
|
|
||||||
if (!array_key_exists('fuel_used', $res)) {
|
if (!array_key_exists('fuel_used', $res)) {
|
||||||
$res['fuel_used'] = 0;
|
$res['fuel_used'] = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,27 @@ class SimBrief extends Resource
|
|||||||
{
|
{
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
return [
|
$data = [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'url' => url(route('api.flights.briefing', ['id' => $this->flight_id])),
|
'url' => url(route('api.flights.briefing', ['id' => $this->id])),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!empty($this->fare_data)) {
|
||||||
|
$fares = [];
|
||||||
|
$fare_data = json_decode($this->fare_data, true);
|
||||||
|
foreach ($fare_data as $fare) {
|
||||||
|
$fares[] = new \App\Models\Fare($fare);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->aircraft->subfleet->fares = collect($fares);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Invalid fare data
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['subfleet'] = new Subfleet($this->aircraft->subfleet);
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,8 @@ class User extends Resource
|
|||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'pilot_id' => $this->pilot_id,
|
'pilot_id' => $this->pilot_id,
|
||||||
'ident' => $this->ident,
|
'ident' => $this->ident,
|
||||||
'name' => $this->name,
|
'name' => $this->name_private,
|
||||||
'name_private' => $this->name_private,
|
'name_private' => $this->name_private,
|
||||||
'email' => $this->email,
|
|
||||||
'avatar' => $this->resolveAvatarUrl(),
|
'avatar' => $this->resolveAvatarUrl(),
|
||||||
'rank_id' => $this->rank_id,
|
'rank_id' => $this->rank_id,
|
||||||
'home_airport' => $this->home_airport_id,
|
'home_airport' => $this->home_airport_id,
|
||||||
@@ -25,6 +24,7 @@ class User extends Resource
|
|||||||
'last_pirep_id' => $this->last_pirep_id,
|
'last_pirep_id' => $this->last_pirep_id,
|
||||||
'flights' => $this->flights,
|
'flights' => $this->flights,
|
||||||
'flight_time' => $this->flight_time,
|
'flight_time' => $this->flight_time,
|
||||||
|
'transfer_time' => $this->transfer_time,
|
||||||
'timezone' => $this->timezone,
|
'timezone' => $this->timezone,
|
||||||
'state' => $this->state,
|
'state' => $this->state,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -97,6 +97,11 @@ class Airline extends Model
|
|||||||
$this->attributes['icao'] = strtoupper($icao);
|
$this->attributes['icao'] = strtoupper($icao);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function subfleets()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Subfleet::class, 'airline_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function flights()
|
public function flights()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Flight::class, 'airline_id');
|
return $this->belongsTo(Flight::class, 'airline_id');
|
||||||
|
|||||||
@@ -20,12 +20,14 @@ class Fare extends Model
|
|||||||
public $table = 'fares';
|
public $table = 'fares';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
'id',
|
||||||
'code',
|
'code',
|
||||||
'name',
|
'name',
|
||||||
'type',
|
'type',
|
||||||
'price',
|
'price',
|
||||||
'cost',
|
'cost',
|
||||||
'capacity',
|
'capacity',
|
||||||
|
'count',
|
||||||
'notes',
|
'notes',
|
||||||
'active',
|
'active',
|
||||||
];
|
];
|
||||||
@@ -34,6 +36,7 @@ class Fare extends Model
|
|||||||
'price' => 'float',
|
'price' => 'float',
|
||||||
'cost' => 'float',
|
'cost' => 'float',
|
||||||
'capacity' => 'integer',
|
'capacity' => 'integer',
|
||||||
|
'count' => 'integer',
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
'active' => 'boolean',
|
'active' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|||||||
23
app/Models/Kvp.php
Normal file
23
app/Models/Kvp.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Contracts\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property string key
|
||||||
|
* @property string value
|
||||||
|
*/
|
||||||
|
class Kvp extends Model
|
||||||
|
{
|
||||||
|
public $table = 'kvp';
|
||||||
|
public $timestamps = false;
|
||||||
|
public $incrementing = false;
|
||||||
|
|
||||||
|
protected $keyType = 'string';
|
||||||
|
|
||||||
|
public $fillable = [
|
||||||
|
'key',
|
||||||
|
'value',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -305,7 +305,9 @@ class Pirep extends Model
|
|||||||
public function getFieldsAttribute()
|
public function getFieldsAttribute()
|
||||||
{
|
{
|
||||||
$custom_fields = PirepField::all();
|
$custom_fields = PirepField::all();
|
||||||
$field_values = PirepFieldValue::where('pirep_id', $this->id)->get();
|
$field_values = PirepFieldValue::where('pirep_id', $this->id)
|
||||||
|
->orderBy('created_at', 'asc')
|
||||||
|
->get();
|
||||||
|
|
||||||
// Merge the field values into $fields
|
// Merge the field values into $fields
|
||||||
foreach ($custom_fields as $field) {
|
foreach ($custom_fields as $field) {
|
||||||
@@ -321,7 +323,23 @@ class Pirep extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $field_values->sortBy('source');
|
return $field_values;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the amount of block fuel
|
||||||
|
*
|
||||||
|
* @param $value
|
||||||
|
*/
|
||||||
|
public function setBlockFuelAttribute($value): void
|
||||||
|
{
|
||||||
|
if ($value instanceof Fuel) {
|
||||||
|
$this->attributes['block_fuel'] = $value->toUnit(
|
||||||
|
config('phpvms.internal_units.fuel')
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->attributes['block_fuel'] = $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,6 +4,14 @@ namespace App\Models;
|
|||||||
|
|
||||||
use App\Contracts\Model;
|
use App\Contracts\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property int id
|
||||||
|
* @property string pirep_id
|
||||||
|
* @property int fare_id
|
||||||
|
* @property int count
|
||||||
|
* @property Pirep pirep
|
||||||
|
* @property Fare fare
|
||||||
|
*/
|
||||||
class PirepFare extends Model
|
class PirepFare extends Model
|
||||||
{
|
{
|
||||||
public $table = 'pirep_fares';
|
public $table = 'pirep_fares';
|
||||||
|
|||||||
@@ -10,14 +10,17 @@ use Illuminate\Support\Collection;
|
|||||||
* @property int $user_id The user that generated this
|
* @property int $user_id The user that generated this
|
||||||
* @property string $flight_id Optional, if attached to a flight, removed if attached to PIREP
|
* @property string $flight_id Optional, if attached to a flight, removed if attached to PIREP
|
||||||
* @property string $pirep_id Optional, if attached to a PIREP, removed if attached to flight
|
* @property string $pirep_id Optional, if attached to a PIREP, removed if attached to flight
|
||||||
|
* @property string $aircraft_id The aircraft this is for
|
||||||
* @property string $acars_xml
|
* @property string $acars_xml
|
||||||
* @property string $ofp_xml
|
* @property string $ofp_xml
|
||||||
* @property string $ofp_html
|
* @property string $ofp_html
|
||||||
|
* @property string $fare_data JSON string of the fare data that was generated
|
||||||
* @property Collection $images
|
* @property Collection $images
|
||||||
* @property Collection $files
|
* @property Collection $files
|
||||||
* @property Flight $flight
|
* @property Flight $flight
|
||||||
* @property User $user
|
* @property User $user
|
||||||
* @property SimBriefXML $xml
|
* @property SimBriefXML $xml
|
||||||
|
* @property Aircraft $aircraft
|
||||||
* @property string $acars_flightplan_url
|
* @property string $acars_flightplan_url
|
||||||
*/
|
*/
|
||||||
class SimBrief extends Model
|
class SimBrief extends Model
|
||||||
@@ -29,9 +32,11 @@ class SimBrief extends Model
|
|||||||
'id',
|
'id',
|
||||||
'user_id',
|
'user_id',
|
||||||
'flight_id',
|
'flight_id',
|
||||||
|
'aircraft_id',
|
||||||
'pirep_id',
|
'pirep_id',
|
||||||
'acars_xml',
|
'acars_xml',
|
||||||
'ofp_xml',
|
'ofp_xml',
|
||||||
|
'fare_data',
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
];
|
];
|
||||||
@@ -80,6 +85,11 @@ class SimBrief extends Model
|
|||||||
* Relationships
|
* Relationships
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public function aircraft()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Aircraft::class, 'aircraft_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function flight()
|
public function flight()
|
||||||
{
|
{
|
||||||
if (!empty($this->attributes['flight_id'])) {
|
if (!empty($this->attributes['flight_id'])) {
|
||||||
|
|||||||
@@ -8,28 +8,29 @@ use App\Models\Traits\ExpensableTrait;
|
|||||||
use App\Models\Traits\FilesTrait;
|
use App\Models\Traits\FilesTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Subfleet
|
|
||||||
*
|
|
||||||
* @property int id
|
* @property int id
|
||||||
* @property string type
|
* @property string type
|
||||||
|
* @property string simbrief_type
|
||||||
* @property string name
|
* @property string name
|
||||||
|
* @property int airline_id
|
||||||
|
* @property int hub_id
|
||||||
* @property string ground_handling_multiplier
|
* @property string ground_handling_multiplier
|
||||||
* @property Fare[] fares
|
* @property Fare[] fares
|
||||||
* @property float cost_block_hour
|
* @property float cost_block_hour
|
||||||
* @property float cost_delay_minute
|
* @property float cost_delay_minute
|
||||||
* @property Airline airline
|
* @property Airline airline
|
||||||
* @property int airline_id
|
* @property Airport hub
|
||||||
*/
|
*/
|
||||||
class Subfleet extends Model
|
class Subfleet extends Model
|
||||||
{
|
{
|
||||||
use ExpensableTrait;
|
use ExpensableTrait;
|
||||||
use FilesTrait;
|
use FilesTrait;
|
||||||
|
|
||||||
public $table = 'subfleets';
|
|
||||||
|
|
||||||
public $fillable = [
|
public $fillable = [
|
||||||
'airline_id',
|
'airline_id',
|
||||||
|
'hub_id',
|
||||||
'type',
|
'type',
|
||||||
|
'simbrief_type',
|
||||||
'name',
|
'name',
|
||||||
'fuel_type',
|
'fuel_type',
|
||||||
'cost_block_hour',
|
'cost_block_hour',
|
||||||
@@ -40,6 +41,8 @@ class Subfleet extends Model
|
|||||||
'gross_weight',
|
'gross_weight',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public $table = 'subfleets';
|
||||||
|
|
||||||
public $casts = [
|
public $casts = [
|
||||||
'airline_id' => 'integer',
|
'airline_id' => 'integer',
|
||||||
'turn_time' => 'integer',
|
'turn_time' => 'integer',
|
||||||
@@ -55,6 +58,7 @@ class Subfleet extends Model
|
|||||||
public static $rules = [
|
public static $rules = [
|
||||||
'type' => 'required',
|
'type' => 'required',
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
|
'hub_id' => 'nullable',
|
||||||
'ground_handling_multiplier' => 'nullable|numeric',
|
'ground_handling_multiplier' => 'nullable|numeric',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -81,6 +85,11 @@ class Subfleet extends Model
|
|||||||
return $this->belongsTo(Airline::class, 'airline_id');
|
return $this->belongsTo(Airline::class, 'airline_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hub()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Airport::class, 'id', 'hub_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function fares()
|
public function fares()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Fare::class, 'subfleet_fare')
|
return $this->belongsToMany(Fare::class, 'subfleet_fare')
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Providers;
|
|||||||
|
|
||||||
use App\Services\ModuleService;
|
use App\Services\ModuleService;
|
||||||
use App\Support\Utils;
|
use App\Support\Utils;
|
||||||
|
use Illuminate\Pagination\Paginator;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Support\Facades\View;
|
use Illuminate\Support\Facades\View;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
@@ -13,6 +14,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
Schema::defaultStringLength(191);
|
Schema::defaultStringLength(191);
|
||||||
|
Paginator::useBootstrap();
|
||||||
View::share('moduleSvc', app(ModuleService::class));
|
View::share('moduleSvc', app(ModuleService::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use App\Cron\Hourly\DeletePireps;
|
||||||
use App\Cron\Hourly\RemoveExpiredBids;
|
use App\Cron\Hourly\RemoveExpiredBids;
|
||||||
use App\Cron\Hourly\RemoveExpiredLiveFlights;
|
use App\Cron\Hourly\RemoveExpiredLiveFlights;
|
||||||
use App\Cron\Nightly\ApplyExpenses;
|
use App\Cron\Nightly\ApplyExpenses;
|
||||||
@@ -41,6 +42,7 @@ class CronServiceProvider extends ServiceProvider
|
|||||||
],
|
],
|
||||||
|
|
||||||
CronHourly::class => [
|
CronHourly::class => [
|
||||||
|
DeletePireps::class,
|
||||||
RemoveExpiredBids::class,
|
RemoveExpiredBids::class,
|
||||||
RemoveExpiredLiveFlights::class,
|
RemoveExpiredLiveFlights::class,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -19,5 +19,9 @@ class DirectiveServiceProvider extends ServiceProvider
|
|||||||
Blade::directive('minutestohours', function ($expr) {
|
Blade::directive('minutestohours', function ($expr) {
|
||||||
return "<?php echo \App\Support\Units\Time::minutesToHours($expr); ?>";
|
return "<?php echo \App\Support\Units\Time::minutesToHours($expr); ?>";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Blade::directive('secstohhmm', function ($expr) {
|
||||||
|
return "<?php echo secstohhmm($expr); ?>";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
Route::get('simbrief/{id}', 'SimBriefController@briefing')->name('simbrief.briefing');
|
Route::get('simbrief/{id}', 'SimBriefController@briefing')->name('simbrief.briefing');
|
||||||
Route::get('simbrief/{id}/prefile', 'SimBriefController@prefile')->name('simbrief.prefile');
|
Route::get('simbrief/{id}/prefile', 'SimBriefController@prefile')->name('simbrief.prefile');
|
||||||
Route::get('simbrief/{id}/cancel', 'SimBriefController@cancel')->name('simbrief.cancel');
|
Route::get('simbrief/{id}/cancel', 'SimBriefController@cancel')->name('simbrief.cancel');
|
||||||
|
Route::get('simbrief/{id}/generate_new', 'SimBriefController@generate_new')->name('simbrief.generate_new');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group([
|
Route::group([
|
||||||
@@ -391,6 +392,12 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
Route::match(['post'], 'maintenance/forcecheck', 'MaintenanceController@forcecheck')
|
Route::match(['post'], 'maintenance/forcecheck', 'MaintenanceController@forcecheck')
|
||||||
->name('maintenance.forcecheck')->middleware('ability:admin,maintenance');
|
->name('maintenance.forcecheck')->middleware('ability:admin,maintenance');
|
||||||
|
|
||||||
|
Route::match(['post'], 'maintenance/cron_enable', 'MaintenanceController@cron_enable')
|
||||||
|
->name('maintenance.cron_enable')->middleware('ability:admin,maintenance');
|
||||||
|
|
||||||
|
Route::match(['post'], 'maintenance/cron_disable', 'MaintenanceController@cron_disable')
|
||||||
|
->name('maintenance.cron_disable')->middleware('ability:admin,maintenance');
|
||||||
|
|
||||||
// subfleet
|
// subfleet
|
||||||
Route::get('subfleets/export', 'SubfleetController@export')
|
Route::get('subfleets/export', 'SubfleetController@export')
|
||||||
->name('subfleets.export')->middleware('ability:admin,fleet');
|
->name('subfleets.export')->middleware('ability:admin,fleet');
|
||||||
@@ -458,7 +465,7 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
Route::group([
|
Route::group([
|
||||||
'as' => 'modules.',
|
'as' => 'modules.',
|
||||||
'prefix' => 'modules',
|
'prefix' => 'modules',
|
||||||
'middleware' => ['ability:admin, modules'],
|
'middleware' => ['ability:admin,modules'],
|
||||||
], function () {
|
], function () {
|
||||||
|
|
||||||
//Modules Index
|
//Modules Index
|
||||||
@@ -507,6 +514,8 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
Route::get('pireps/{pirep_id}', 'PirepController@get');
|
Route::get('pireps/{pirep_id}', 'PirepController@get');
|
||||||
Route::get('pireps/{pirep_id}/acars/geojson', 'AcarsController@acars_geojson');
|
Route::get('pireps/{pirep_id}/acars/geojson', 'AcarsController@acars_geojson');
|
||||||
|
|
||||||
|
Route::get('cron/{id}', 'MaintenanceController@cron')->name('maintenance.cron');
|
||||||
|
|
||||||
Route::get('news', 'NewsController@index');
|
Route::get('news', 'NewsController@index');
|
||||||
Route::get('status', 'StatusController@status');
|
Route::get('status', 'StatusController@status');
|
||||||
Route::get('version', 'StatusController@status');
|
Route::get('version', 'StatusController@status');
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class FlightRepository extends Repository implements CacheableInterface
|
|||||||
'arr_airport_id',
|
'arr_airport_id',
|
||||||
'distance',
|
'distance',
|
||||||
'dpt_airport_id',
|
'dpt_airport_id',
|
||||||
|
'flight_type',
|
||||||
'flight_number' => 'like',
|
'flight_number' => 'like',
|
||||||
'route_code' => 'like',
|
'route_code' => 'like',
|
||||||
'route_leg' => 'like',
|
'route_leg' => 'like',
|
||||||
@@ -93,6 +94,10 @@ class FlightRepository extends Repository implements CacheableInterface
|
|||||||
$where['flight_number'] = $request->input('flight_number');
|
$where['flight_number'] = $request->input('flight_number');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->filled('flight_type') && $request->input('flight_type') !== '0') {
|
||||||
|
$where['flight_type'] = $request->input('flight_type');
|
||||||
|
}
|
||||||
|
|
||||||
if ($request->filled('route_code')) {
|
if ($request->filled('route_code')) {
|
||||||
$where['route_code'] = $request->input('route_code');
|
$where['route_code'] = $request->input('route_code');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,12 +46,32 @@ class AirportService extends Service
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$raw_metar = $this->metarProvider->get_metar($icao);
|
$raw_metar = $this->metarProvider->metar($icao);
|
||||||
if ($raw_metar && $raw_metar !== '') {
|
if ($raw_metar && $raw_metar !== '') {
|
||||||
return new Metar($raw_metar);
|
return new Metar($raw_metar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the METAR for a given airport
|
||||||
|
*
|
||||||
|
* @param $icao
|
||||||
|
*
|
||||||
|
* @return Metar|null
|
||||||
|
*/
|
||||||
|
public function getTaf($icao)
|
||||||
|
{
|
||||||
|
$icao = trim($icao);
|
||||||
|
if ($icao === '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$raw_taf = $this->metarProvider->taf($icao);
|
||||||
|
if ($raw_taf && $raw_taf !== '') {
|
||||||
|
return new Metar($raw_taf, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lookup an airport's information from a remote provider. This handles caching
|
* Lookup an airport's information from a remote provider. This handles caching
|
||||||
* the data internally
|
* the data internally
|
||||||
|
|||||||
@@ -50,7 +50,10 @@ class BidService extends Service
|
|||||||
$bids = Bid::with([
|
$bids = Bid::with([
|
||||||
'flight',
|
'flight',
|
||||||
'flight.fares',
|
'flight.fares',
|
||||||
'flight.simbrief',
|
'flight.simbrief' => function ($query) use ($user) {
|
||||||
|
$query->where('user_id', $user->id);
|
||||||
|
},
|
||||||
|
'flight.simbrief.aircraft',
|
||||||
'flight.subfleets',
|
'flight.subfleets',
|
||||||
'flight.subfleets.aircraft',
|
'flight.subfleets.aircraft',
|
||||||
'flight.subfleets.fares',
|
'flight.subfleets.fares',
|
||||||
|
|||||||
@@ -92,6 +92,6 @@ class CronService extends Service
|
|||||||
|
|
||||||
// More than 5 minutes... there's a problem
|
// More than 5 minutes... there's a problem
|
||||||
$diff = $dt_now->diff($dt);
|
$diff = $dt_now->diff($dt);
|
||||||
return $diff->i > 5;
|
return $diff->i > 60 * 12; // Hasn't run for 12 hours
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,6 +172,24 @@ class FareService extends Service
|
|||||||
return $fare;
|
return $fare;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all the fares for an aircraft. check the pivot
|
||||||
|
* table to see if the price/cost/capacity has been overridden
|
||||||
|
* and return the correct amounts.
|
||||||
|
*
|
||||||
|
* @param Subfleet $subfleet
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getForSubfleet(Subfleet $subfleet)
|
||||||
|
{
|
||||||
|
$fares = $subfleet->fares->map(function ($fare) {
|
||||||
|
return $this->getFares($fare);
|
||||||
|
});
|
||||||
|
|
||||||
|
return $fares;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attach a fare to an flight
|
* Attach a fare to an flight
|
||||||
*
|
*
|
||||||
@@ -240,24 +258,6 @@ class FareService extends Service
|
|||||||
return $subfleet;
|
return $subfleet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* return all the fares for an aircraft. check the pivot
|
|
||||||
* table to see if the price/cost/capacity has been overridden
|
|
||||||
* and return the correct amounts.
|
|
||||||
*
|
|
||||||
* @param Subfleet $subfleet
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getForSubfleet(Subfleet $subfleet)
|
|
||||||
{
|
|
||||||
$fares = $subfleet->fares->map(function ($fare) {
|
|
||||||
return $this->getFares($fare);
|
|
||||||
});
|
|
||||||
|
|
||||||
return $fares;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the fare from a subfleet
|
* Delete the fare from a subfleet
|
||||||
*
|
*
|
||||||
@@ -286,9 +286,7 @@ class FareService extends Service
|
|||||||
*/
|
*/
|
||||||
public function getForPirep(Pirep $pirep)
|
public function getForPirep(Pirep $pirep)
|
||||||
{
|
{
|
||||||
$found_fares = PirepFare::where('pirep_id', $pirep->id)->get();
|
return PirepFare::where('pirep_id', $pirep->id)->get();
|
||||||
|
|
||||||
return $found_fares;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -313,6 +311,8 @@ class FareService extends Service
|
|||||||
$fare['pirep_id'] = $pirep->id;
|
$fare['pirep_id'] = $pirep->id;
|
||||||
// other fields: ['fare_id', 'count']
|
// other fields: ['fare_id', 'count']
|
||||||
|
|
||||||
|
Log::info('Saving fare pirep='.$pirep->id.', fare='.$fare['count']);
|
||||||
|
|
||||||
$field = new PirepFare($fare);
|
$field = new PirepFare($fare);
|
||||||
$field->save();
|
$field->save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,10 +152,29 @@ class PirepFinanceService extends Service
|
|||||||
public function payFuelCosts(Pirep $pirep): void
|
public function payFuelCosts(Pirep $pirep): void
|
||||||
{
|
{
|
||||||
$ap = $pirep->dpt_airport;
|
$ap = $pirep->dpt_airport;
|
||||||
$fuel_used = $pirep->fuel_used;
|
if (setting('pireps.advanced_fuel', false)) {
|
||||||
|
$ac = $pirep->aircraft;
|
||||||
|
// Reading second row by skip(1) to reach the previous accepted pirep. Current pirep is at the first row
|
||||||
|
$prev_flight = Pirep::where('aircraft_id', $ac->id)->where('state', 2)->where('status', 'ONB')->orderby('submitted_at', 'desc')->skip(1)->first();
|
||||||
|
if ($prev_flight) {
|
||||||
|
// If there is a pirep use its values to calculate the remaining fuel
|
||||||
|
// and calculate the uplifted fuel amount for this pirep
|
||||||
|
$fuel_amount = $pirep->block_fuel - ($prev_flight->block_fuel - $prev_flight->fuel_used);
|
||||||
|
// Aircraft has more than enough fuel in its tanks, no uplift necessary
|
||||||
|
if ($fuel_amount < 0) {
|
||||||
|
$fuel_amount = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// No pirep found for aircraft, debit full block fuel
|
||||||
|
$fuel_amount = $pirep->block_fuel;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Setting is false, switch back to basic calculation
|
||||||
|
$fuel_amount = $pirep->fuel_used;
|
||||||
|
}
|
||||||
|
|
||||||
$debit = Money::createFromAmount($fuel_used * $ap->fuel_jeta_cost);
|
$debit = Money::createFromAmount($fuel_amount * $ap->fuel_jeta_cost);
|
||||||
Log::info('Finance: Fuel cost, (fuel='.$fuel_used.', cost='.$ap->fuel_jeta_cost.') D='
|
Log::info('Finance: Fuel cost, (fuel='.$fuel_amount.', cost='.$ap->fuel_jeta_cost.') D='
|
||||||
.$debit->getAmount());
|
.$debit->getAmount());
|
||||||
|
|
||||||
$this->financeSvc->debitFromJournal(
|
$this->financeSvc->debitFromJournal(
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ class RecurringFinanceService extends Service
|
|||||||
$obj = $expense->getReferencedObject();
|
$obj = $expense->getReferencedObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($obj)) {
|
||||||
|
return [null, null];
|
||||||
|
}
|
||||||
|
|
||||||
if ($klass === 'Airport') {
|
if ($klass === 'Airport') {
|
||||||
$memo = "Airport Expense: {$expense->name} ({$expense->ref_model_id})";
|
$memo = "Airport Expense: {$expense->name} ({$expense->ref_model_id})";
|
||||||
$transaction_group = "Airport: {$expense->ref_model_id}";
|
$transaction_group = "Airport: {$expense->ref_model_id}";
|
||||||
@@ -128,6 +132,9 @@ class RecurringFinanceService extends Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
[$memo, $ta_group] = $this->getMemoAndGroup($expense);
|
[$memo, $ta_group] = $this->getMemoAndGroup($expense);
|
||||||
|
if (empty($memo) || empty($ta_group)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$this->financeSvc->debitFromJournal(
|
$this->financeSvc->debitFromJournal(
|
||||||
$journal,
|
$journal,
|
||||||
|
|||||||
@@ -137,6 +137,13 @@ class FlightService extends Service
|
|||||||
{
|
{
|
||||||
/** @var \Illuminate\Support\Collection $subfleets */
|
/** @var \Illuminate\Support\Collection $subfleets */
|
||||||
$subfleets = $flight->subfleets;
|
$subfleets = $flight->subfleets;
|
||||||
|
|
||||||
|
// If no subfleets assigned to a flight get users allowed subfleets
|
||||||
|
if ($subfleets === null || $subfleets->count() === 0) {
|
||||||
|
$subfleets = $this->userSvc->getAllowableSubfleets($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If subfleets are still empty return the flight
|
||||||
if ($subfleets === null || $subfleets->count() === 0) {
|
if ($subfleets === null || $subfleets->count() === 0) {
|
||||||
return $flight;
|
return $flight;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ use App\Contracts\ImportExport;
|
|||||||
use App\Contracts\Service;
|
use App\Contracts\Service;
|
||||||
use App\Models\Airport;
|
use App\Models\Airport;
|
||||||
use App\Models\Expense;
|
use App\Models\Expense;
|
||||||
|
use App\Models\Fare;
|
||||||
|
use App\Models\Flight;
|
||||||
|
use App\Models\FlightFieldValue;
|
||||||
use App\Repositories\FlightRepository;
|
use App\Repositories\FlightRepository;
|
||||||
use App\Services\ImportExport\AircraftImporter;
|
use App\Services\ImportExport\AircraftImporter;
|
||||||
use App\Services\ImportExport\AirportImporter;
|
use App\Services\ImportExport\AirportImporter;
|
||||||
@@ -209,7 +212,7 @@ class ImportService extends Service
|
|||||||
public function importFares($csv_file, bool $delete_previous = true)
|
public function importFares($csv_file, bool $delete_previous = true)
|
||||||
{
|
{
|
||||||
if ($delete_previous) {
|
if ($delete_previous) {
|
||||||
// TODO: Delete all from: fares
|
Fare::truncate();
|
||||||
}
|
}
|
||||||
|
|
||||||
$importer = new FareImporter();
|
$importer = new FareImporter();
|
||||||
@@ -229,7 +232,8 @@ class ImportService extends Service
|
|||||||
public function importFlights($csv_file, bool $delete_previous = true)
|
public function importFlights($csv_file, bool $delete_previous = true)
|
||||||
{
|
{
|
||||||
if ($delete_previous) {
|
if ($delete_previous) {
|
||||||
// TODO: Delete all from: flights, flight_field_values
|
Flight::truncate();
|
||||||
|
FlightFieldValue::truncate();
|
||||||
}
|
}
|
||||||
|
|
||||||
$importer = new FlightImporter();
|
$importer = new FlightImporter();
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ class SeederService extends Service
|
|||||||
'order' => $order,
|
'order' => $order,
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'group' => $group,
|
'group' => $group,
|
||||||
'value' => '',
|
'value' => $attrs['value'],
|
||||||
'default' => $attrs['value'],
|
'default' => $attrs['value'],
|
||||||
'options' => '',
|
'options' => '',
|
||||||
'type' => 'hidden',
|
'type' => 'hidden',
|
||||||
|
|||||||
@@ -9,13 +9,16 @@ use Exception;
|
|||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the raw METAR string from the NOAA Aviation Weather Service
|
* Return the raw METAR/TAF string from the NOAA Aviation Weather Service
|
||||||
*/
|
*/
|
||||||
class AviationWeather extends Metar
|
class AviationWeather extends Metar
|
||||||
{
|
{
|
||||||
private const METAR_URL =
|
private const METAR_URL =
|
||||||
'https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&hoursBeforeNow=3&mostRecent=true&stationString=';
|
'https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&hoursBeforeNow=3&mostRecent=true&stationString=';
|
||||||
|
|
||||||
|
private const TAF_URL =
|
||||||
|
'https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=tafs&requestType=retrieve&format=xml&hoursBeforeNow=3&mostRecent=true&stationString=';
|
||||||
|
|
||||||
private $httpClient;
|
private $httpClient;
|
||||||
|
|
||||||
public function __construct(HttpClient $httpClient)
|
public function __construct(HttpClient $httpClient)
|
||||||
@@ -33,7 +36,7 @@ class AviationWeather extends Metar
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function metar($icao): string
|
protected function get_metar($icao): string
|
||||||
{
|
{
|
||||||
if ($icao === '') {
|
if ($icao === '') {
|
||||||
return '';
|
return '';
|
||||||
@@ -67,7 +70,53 @@ class AviationWeather extends Metar
|
|||||||
return $xml->data->METAR->raw_text->__toString();
|
return $xml->data->METAR->raw_text->__toString();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error('Error reading METAR: '.$e->getMessage());
|
Log::error('Error reading METAR: '.$e->getMessage());
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do the actual retrieval of the TAF
|
||||||
|
*
|
||||||
|
* @param $icao
|
||||||
|
*
|
||||||
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function get_taf($icao): string
|
||||||
|
{
|
||||||
|
if ($icao === '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$tafurl = static::TAF_URL.$icao;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$tafres = $this->httpClient->get($tafurl, []);
|
||||||
|
$tafxml = simplexml_load_string($tafres);
|
||||||
|
|
||||||
|
$tafattrs = $tafxml->data->attributes();
|
||||||
|
if (!isset($tafattrs['num_results'])) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$tafnum_results = $tafattrs['num_results'];
|
||||||
|
if (empty($tafnum_results)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$tafnum_results = (int) $tafnum_results;
|
||||||
|
if ($tafnum_results === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($tafxml->data->TAF->raw_text) === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tafxml->data->TAF->raw_text->__toString();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Log::error('Error reading TAF: '.$e->getMessage());
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,10 @@ use App\Models\Enums\PirepState;
|
|||||||
use App\Models\Enums\PirepStatus;
|
use App\Models\Enums\PirepStatus;
|
||||||
use App\Models\Navdata;
|
use App\Models\Navdata;
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
|
use App\Models\PirepComment;
|
||||||
|
use App\Models\PirepFare;
|
||||||
use App\Models\PirepFieldValue;
|
use App\Models\PirepFieldValue;
|
||||||
|
use App\Models\SimBrief;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Repositories\AircraftRepository;
|
use App\Repositories\AircraftRepository;
|
||||||
use App\Repositories\AirportRepository;
|
use App\Repositories\AirportRepository;
|
||||||
@@ -40,17 +43,16 @@ class PirepService extends Service
|
|||||||
private $airportSvc;
|
private $airportSvc;
|
||||||
private $geoSvc;
|
private $geoSvc;
|
||||||
private $pirepRepo;
|
private $pirepRepo;
|
||||||
|
private $simBriefSvc;
|
||||||
private $userSvc;
|
private $userSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param AircraftRepository $aircraftRepo
|
* @param AircraftRepository $aircraftRepo
|
||||||
* @param GeoService $geoSvc
|
* @param GeoService $geoSvc
|
||||||
* @param PirepRepository $pirepRepo
|
|
||||||
* @param UserService $userSvc
|
|
||||||
* @param AirportRepository $airportRepo
|
* @param AirportRepository $airportRepo
|
||||||
* @param AirportService $airportSvc
|
* @param AirportService $airportSvc
|
||||||
* @param GeoService $geoSvc
|
|
||||||
* @param PirepRepository $pirepRepo
|
* @param PirepRepository $pirepRepo
|
||||||
|
* @param SimBriefService $simBriefSvc
|
||||||
* @param UserService $userSvc
|
* @param UserService $userSvc
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -59,14 +61,16 @@ class PirepService extends Service
|
|||||||
AircraftRepository $aircraftRepo,
|
AircraftRepository $aircraftRepo,
|
||||||
GeoService $geoSvc,
|
GeoService $geoSvc,
|
||||||
PirepRepository $pirepRepo,
|
PirepRepository $pirepRepo,
|
||||||
|
SimBriefService $simBriefSvc,
|
||||||
UserService $userSvc
|
UserService $userSvc
|
||||||
) {
|
) {
|
||||||
$this->airportRepo = $airportRepo;
|
$this->airportRepo = $airportRepo;
|
||||||
$this->airportSvc = $airportSvc;
|
$this->airportSvc = $airportSvc;
|
||||||
$this->aircraftRepo = $aircraftRepo;
|
$this->aircraftRepo = $aircraftRepo;
|
||||||
$this->geoSvc = $geoSvc;
|
$this->geoSvc = $geoSvc;
|
||||||
$this->userSvc = $userSvc;
|
|
||||||
$this->pirepRepo = $pirepRepo;
|
$this->pirepRepo = $pirepRepo;
|
||||||
|
$this->simBriefSvc = $simBriefSvc;
|
||||||
|
$this->userSvc = $userSvc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,7 +119,7 @@ class PirepService extends Service
|
|||||||
|
|
||||||
// See if this user is at the current airport
|
// See if this user is at the current airport
|
||||||
/* @noinspection NotOptimalIfConditionsInspection */
|
/* @noinspection NotOptimalIfConditionsInspection */
|
||||||
if (setting('pilots.only_flights_from_current')
|
if (setting('pilots.only_flights_from_current', false)
|
||||||
&& $user->curr_airport_id !== $pirep->dpt_airport_id) {
|
&& $user->curr_airport_id !== $pirep->dpt_airport_id) {
|
||||||
throw new UserNotAtAirport($user, $pirep->dpt_airport);
|
throw new UserNotAtAirport($user, $pirep->dpt_airport);
|
||||||
}
|
}
|
||||||
@@ -206,6 +210,72 @@ class PirepService extends Service
|
|||||||
return $pirep;
|
return $pirep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finalize a PIREP (meaning it's been filed)
|
||||||
|
*
|
||||||
|
* @param Pirep $pirep
|
||||||
|
* @param array $attrs
|
||||||
|
* @param array PirepFieldValue[] $field_values
|
||||||
|
*
|
||||||
|
* @throws \Exception
|
||||||
|
*
|
||||||
|
* @return Pirep
|
||||||
|
*/
|
||||||
|
public function file(Pirep $pirep, array $attrs = [], array $field_values = []): Pirep
|
||||||
|
{
|
||||||
|
if (empty($field_values)) {
|
||||||
|
$field_values = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$attrs['state'] = PirepState::PENDING;
|
||||||
|
$attrs['status'] = PirepStatus::ARRIVED;
|
||||||
|
$attrs['submitted_at'] = Carbon::now('UTC');
|
||||||
|
|
||||||
|
$this->pirepRepo->update($attrs, $pirep->id);
|
||||||
|
$pirep->refresh();
|
||||||
|
|
||||||
|
// Check if there is a simbrief_id, change it to be set to the PIREP
|
||||||
|
// at the end of the flight when it's been filed
|
||||||
|
if (array_key_exists('simbrief_id', $attrs)) {
|
||||||
|
/** @var SimBrief $simbrief */
|
||||||
|
$simbrief = SimBrief::find($attrs['simbrief_id']);
|
||||||
|
if ($simbrief) {
|
||||||
|
$this->simBriefSvc->attachSimbriefToPirep($pirep, $simbrief);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the block times. If a block on (arrival) time isn't
|
||||||
|
// specified, then use the time that it was submitted. It won't
|
||||||
|
// be the most accurate, but that might be OK
|
||||||
|
if (!$pirep->block_on_time) {
|
||||||
|
if ($pirep->submitted_at) {
|
||||||
|
$pirep->block_on_time = $pirep->submitted_at;
|
||||||
|
} else {
|
||||||
|
$pirep->block_on_time = Carbon::now('UTC');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that there's a submit time
|
||||||
|
if (!$pirep->submitted_at) {
|
||||||
|
$pirep->submitted_at = Carbon::now('UTC');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy some fields over from Flight if we have it
|
||||||
|
if ($pirep->flight) {
|
||||||
|
$pirep->planned_distance = $pirep->flight->distance;
|
||||||
|
$pirep->planned_flight_time = $pirep->flight->flight_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pirep->save();
|
||||||
|
$pirep->refresh();
|
||||||
|
|
||||||
|
if (count($field_values) > 0) {
|
||||||
|
$this->updateCustomFields($pirep->id, $field_values);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $pirep;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find if there are duplicates to a given PIREP. Ideally, the passed
|
* Find if there are duplicates to a given PIREP. Ideally, the passed
|
||||||
* in PIREP hasn't been saved or gone through the create() method
|
* in PIREP hasn't been saved or gone through the create() method
|
||||||
@@ -306,18 +376,6 @@ class PirepService extends Service
|
|||||||
return $pirep;
|
return $pirep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Alias to submit()
|
|
||||||
*
|
|
||||||
* @param \App\Models\Pirep $pirep
|
|
||||||
*
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
public function file(Pirep $pirep)
|
|
||||||
{
|
|
||||||
return $this->submit($pirep);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit the PIREP. Figure out its default state
|
* Submit the PIREP. Figure out its default state
|
||||||
*
|
*
|
||||||
@@ -380,6 +438,29 @@ class PirepService extends Service
|
|||||||
return $pirep;
|
return $pirep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the PIREP and all of the associated data. Does a force delete to make sure that we
|
||||||
|
* don't run into problems with foreign keys. Models/tables affected:
|
||||||
|
*
|
||||||
|
* acars
|
||||||
|
* bids
|
||||||
|
* pirep_comments
|
||||||
|
* pirep_fares
|
||||||
|
* pirep_field_values
|
||||||
|
* simbrief
|
||||||
|
*
|
||||||
|
* @param Pirep $pirep
|
||||||
|
*/
|
||||||
|
public function delete(Pirep $pirep): void
|
||||||
|
{
|
||||||
|
$w = ['pirep_id' => $pirep->id];
|
||||||
|
PirepComment::where($w)->forceDelete();
|
||||||
|
PirepFare::where($w)->forceDelete();
|
||||||
|
PirepFieldValue::where($w)->forceDelete();
|
||||||
|
SimBrief::where($w)->forceDelete();
|
||||||
|
$pirep->forceDelete();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update any custom PIREP fields
|
* Update any custom PIREP fields
|
||||||
*
|
*
|
||||||
@@ -483,6 +564,7 @@ class PirepService extends Service
|
|||||||
$pirep->aircraft->flight_time = $pirep->aircraft->flight_time + $pirep->flight_time;
|
$pirep->aircraft->flight_time = $pirep->aircraft->flight_time + $pirep->flight_time;
|
||||||
$pirep->aircraft->airport_id = $pirep->arr_airport_id;
|
$pirep->aircraft->airport_id = $pirep->arr_airport_id;
|
||||||
$pirep->aircraft->landing_time = $pirep->updated_at;
|
$pirep->aircraft->landing_time = $pirep->updated_at;
|
||||||
|
$pirep->aircraft->fuel_onboard = $pirep->block_fuel - $pirep->fuel_used;
|
||||||
$pirep->aircraft->save();
|
$pirep->aircraft->save();
|
||||||
|
|
||||||
$pirep->refresh();
|
$pirep->refresh();
|
||||||
|
|||||||
@@ -29,11 +29,18 @@ class SimBriefService extends Service
|
|||||||
* @param string $user_id User who generated this
|
* @param string $user_id User who generated this
|
||||||
* @param string $ofp_id The SimBrief OFP ID
|
* @param string $ofp_id The SimBrief OFP ID
|
||||||
* @param string $flight_id The flight ID
|
* @param string $flight_id The flight ID
|
||||||
|
* @param string $ac_id The aircraft ID
|
||||||
|
* @param array $fares Full list of fares for the flightß
|
||||||
*
|
*
|
||||||
* @return SimBrief|null
|
* @return SimBrief|null
|
||||||
*/
|
*/
|
||||||
public function checkForOfp(string $user_id, string $ofp_id, string $flight_id)
|
public function downloadOfp(
|
||||||
{
|
string $user_id,
|
||||||
|
string $ofp_id,
|
||||||
|
string $flight_id,
|
||||||
|
string $ac_id,
|
||||||
|
array $fares = []
|
||||||
|
) {
|
||||||
$uri = str_replace('{id}', $ofp_id, config('phpvms.simbrief_url'));
|
$uri = str_replace('{id}', $ofp_id, config('phpvms.simbrief_url'));
|
||||||
|
|
||||||
$opts = [
|
$opts = [
|
||||||
@@ -57,11 +64,17 @@ class SimBriefService extends Service
|
|||||||
$ofp = simplexml_load_string($body, SimBriefXML::class);
|
$ofp = simplexml_load_string($body, SimBriefXML::class);
|
||||||
|
|
||||||
$attrs = [
|
$attrs = [
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
'flight_id' => $flight_id,
|
'flight_id' => $flight_id,
|
||||||
'ofp_xml' => $ofp->asXML(),
|
'aircraft_id' => $ac_id,
|
||||||
|
'ofp_xml' => $ofp->asXML(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// encode the fares data to JSONß
|
||||||
|
if (!empty($fares)) {
|
||||||
|
$attrs['fare_data'] = json_encode($fares);
|
||||||
|
}
|
||||||
|
|
||||||
// Try to download the XML file for ACARS. If it doesn't work, try to modify the main OFP
|
// Try to download the XML file for ACARS. If it doesn't work, try to modify the main OFP
|
||||||
$acars_xml = $this->getAcarsOFP($ofp);
|
$acars_xml = $this->getAcarsOFP($ofp);
|
||||||
if (empty($acars_xml)) {
|
if (empty($acars_xml)) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ use App\Repositories\SubfleetRepository;
|
|||||||
use App\Repositories\UserRepository;
|
use App\Repositories\UserRepository;
|
||||||
use App\Support\Units\Time;
|
use App\Support\Units\Time;
|
||||||
use App\Support\Utils;
|
use App\Support\Utils;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use function is_array;
|
use function is_array;
|
||||||
@@ -254,6 +255,41 @@ class UserService extends Service
|
|||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all of the users that are determined to be on leave. Only goes through the
|
||||||
|
* currently active users. If the user doesn't have a PIREP, then the creation date
|
||||||
|
* of the user record is used to determine the difference
|
||||||
|
*/
|
||||||
|
public function findUsersOnLeave(): array
|
||||||
|
{
|
||||||
|
$leave_days = setting('pilots.auto_leave_days');
|
||||||
|
if ($leave_days === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$return_users = [];
|
||||||
|
|
||||||
|
$date = Carbon::now('UTC');
|
||||||
|
$users = User::with(['last_pirep'])->where('state', UserState::ACTIVE)->get();
|
||||||
|
|
||||||
|
/** @var User $user */
|
||||||
|
foreach ($users as $user) {
|
||||||
|
// If they haven't submitted a PIREP, use the date that the user was created
|
||||||
|
if (!$user->last_pirep) {
|
||||||
|
$diff_date = $user->created_at;
|
||||||
|
} else {
|
||||||
|
$diff_date = $user->last_pirep->submitted_at;
|
||||||
|
}
|
||||||
|
|
||||||
|
// See if the difference is larger than what the setting calls for
|
||||||
|
if ($date->diffInDays($diff_date) > $leave_days) {
|
||||||
|
$return_users[] = $user;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return_users;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the subfleets this user is allowed access to,
|
* Return the subfleets this user is allowed access to,
|
||||||
* based on their current rank
|
* based on their current rank
|
||||||
@@ -426,7 +462,7 @@ class UserService extends Service
|
|||||||
$user->state = UserState::ON_LEAVE;
|
$user->state = UserState::ON_LEAVE;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
event(new UserStateChanged($user, UserState::ACTIVE));
|
event(new UserStateChanged($user, UserState::ON_LEAVE));
|
||||||
|
|
||||||
$user->refresh();
|
$user->refresh();
|
||||||
return $user;
|
return $user;
|
||||||
|
|||||||
@@ -1772,7 +1772,7 @@ class Metar implements \ArrayAccess
|
|||||||
*/
|
*/
|
||||||
private function calculate_wind_chill($temperature_f): void
|
private function calculate_wind_chill($temperature_f): void
|
||||||
{
|
{
|
||||||
if ($temperature_f < 51 && $this->result['wind_speed'] !== 0) {
|
if ($temperature_f < 51 && $this->result['wind_speed'] && $this->result['wind_speed'] !== 0) {
|
||||||
$windspeed = $this->result['wind_speed']->toUnit('mph');
|
$windspeed = $this->result['wind_speed']->toUnit('mph');
|
||||||
if ($windspeed > 3) {
|
if ($windspeed > 3) {
|
||||||
$chill_f = 35.74 + 0.6215 * $temperature_f - 35.75 * ($windspeed ** 0.16);
|
$chill_f = 35.74 + 0.6215 * $temperature_f - 35.75 * ($windspeed ** 0.16);
|
||||||
|
|||||||
@@ -5,9 +5,8 @@ namespace App\Support;
|
|||||||
use App\Contracts\Model;
|
use App\Contracts\Model;
|
||||||
use Hashids\Hashids;
|
use Hashids\Hashids;
|
||||||
use Illuminate\Contracts\Container\BindingResolutionException;
|
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use LayerShifter\TLDExtract\Extract;
|
|
||||||
use Nwidart\Modules\Facades\Module;
|
use Nwidart\Modules\Facades\Module;
|
||||||
|
use Pdp\Rules;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global utilities
|
* Global utilities
|
||||||
@@ -110,22 +109,36 @@ class Utils
|
|||||||
*/
|
*/
|
||||||
public static function getRootDomain(string $url): string
|
public static function getRootDomain(string $url): string
|
||||||
{
|
{
|
||||||
if (Str::contains($url, ['https://', 'http://'])) {
|
if (!str_starts_with($url, 'http')) {
|
||||||
$url = str_replace('https://', '', $url);
|
$url = 'http://'.$url;
|
||||||
$url = str_replace('http://', '', $url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$extract = new Extract();
|
$parsed_url = parse_url($url, PHP_URL_HOST);
|
||||||
$result = $extract->parse($url);
|
if (empty($parsed_url)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$val = $result->getRegistrableDomain();
|
if (str_ends_with($parsed_url, 'localhost')) {
|
||||||
|
return 'localhost';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str_ends_with($parsed_url, '/')) {
|
||||||
|
$parsed_url = substr($parsed_url, 0, strlen($parsed_url) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rules = Rules::createFromPath(resource_path('tld/public_suffix_list.dat'));
|
||||||
|
$domain = $rules->resolve($parsed_url);
|
||||||
|
|
||||||
|
$val = $domain->getRegistrableDomain();
|
||||||
if (!empty($val)) {
|
if (!empty($val)) {
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Couldn't validate a domain, see if this is an IP address?
|
// Couldn't validate a domain, see if this is an IP address?
|
||||||
if (filter_var($url, FILTER_VALIDATE_IP)) {
|
if (filter_var($parsed_url, FILTER_VALIDATE_IP)) {
|
||||||
return $url;
|
return $parsed_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class LiveMap extends Widget
|
|||||||
protected $config = [
|
protected $config = [
|
||||||
'height' => '800px',
|
'height' => '800px',
|
||||||
'width' => '100%',
|
'width' => '100%',
|
||||||
|
'table' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ use App\Services\AirportService;
|
|||||||
class Weather extends Widget
|
class Weather extends Widget
|
||||||
{
|
{
|
||||||
protected $config = [
|
protected $config = [
|
||||||
'icao' => null,
|
'icao' => null,
|
||||||
|
'raw_only' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,10 +23,12 @@ class Weather extends Widget
|
|||||||
/** @var \App\Services\AirportService $airportSvc */
|
/** @var \App\Services\AirportService $airportSvc */
|
||||||
$airportSvc = app(AirportService::class);
|
$airportSvc = app(AirportService::class);
|
||||||
$metar = $airportSvc->getMetar($this->config['icao']);
|
$metar = $airportSvc->getMetar($this->config['icao']);
|
||||||
|
$taf = $airportSvc->getTaf($this->config['icao']);
|
||||||
|
|
||||||
return view('widgets.weather', [
|
return view('widgets.weather', [
|
||||||
'config' => $this->config,
|
'config' => $this->config,
|
||||||
'metar' => $metar,
|
'metar' => $metar,
|
||||||
|
'taf' => $taf,
|
||||||
'unit_alt' => setting('units.altitude'),
|
'unit_alt' => setting('units.altitude'),
|
||||||
'unit_dist' => setting('units.distance'),
|
'unit_dist' => setting('units.distance'),
|
||||||
'unit_temp' => setting('units.temperature'),
|
'unit_temp' => setting('units.temperature'),
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ if (!function_exists('setting')) {
|
|||||||
*/
|
*/
|
||||||
function setting($key, $default = null)
|
function setting($key, $default = null)
|
||||||
{
|
{
|
||||||
|
/** @var \App\Repositories\SettingRepository $settingRepo */
|
||||||
$settingRepo = app(SettingRepository::class);
|
$settingRepo = app(SettingRepository::class);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -181,6 +182,7 @@ if (!function_exists('setting')) {
|
|||||||
if (!function_exists('setting_save')) {
|
if (!function_exists('setting_save')) {
|
||||||
function setting_save($key, $value)
|
function setting_save($key, $value)
|
||||||
{
|
{
|
||||||
|
/** @var \App\Repositories\SettingRepository $settingRepo */
|
||||||
$settingRepo = app(SettingRepository::class);
|
$settingRepo = app(SettingRepository::class);
|
||||||
$settingRepo->save($key, $value);
|
$settingRepo->save($key, $value);
|
||||||
return $value;
|
return $value;
|
||||||
@@ -355,6 +357,20 @@ if (!function_exists('show_datetime_format')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('secstohhmm')) {
|
||||||
|
/**
|
||||||
|
* Convert seconds to hhmm format
|
||||||
|
*
|
||||||
|
* @param $seconds
|
||||||
|
*/
|
||||||
|
function secstohhmm($seconds)
|
||||||
|
{
|
||||||
|
$seconds = round($seconds);
|
||||||
|
$hhmm = sprintf('%02d%02d', ($seconds / 3600), ($seconds / 60 % 60));
|
||||||
|
echo $hhmm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!function_exists('_fmt')) {
|
if (!function_exists('_fmt')) {
|
||||||
/**
|
/**
|
||||||
* Replace strings
|
* Replace strings
|
||||||
|
|||||||
@@ -14,63 +14,65 @@
|
|||||||
"ext-simplexml": "*",
|
"ext-simplexml": "*",
|
||||||
"ext-bcmath": "*",
|
"ext-bcmath": "*",
|
||||||
"ext-pdo": "*",
|
"ext-pdo": "*",
|
||||||
|
"ext-intl": "*",
|
||||||
"composer/composer": "~1.0",
|
"composer/composer": "~1.0",
|
||||||
"composer/installers": "~1.0",
|
"composer/installers": "~1.0",
|
||||||
"laravel/framework": "~7.0",
|
"laravel/framework": "~8.0",
|
||||||
"akaunting/money": "^1.0",
|
"akaunting/money": "^1.0",
|
||||||
"anhskohbo/no-captcha": "^3.0",
|
"anhskohbo/no-captcha": "^3.0",
|
||||||
"appstract/laravel-opcache": "^4.0",
|
"appstract/laravel-opcache": "^4.0",
|
||||||
"arrilot/laravel-widgets": "~3.13.0",
|
"arrilot/laravel-widgets": "~3.13.0",
|
||||||
"codedge/laravel-selfupdater": "~3.0.0",
|
"codedge/laravel-selfupdater": "~3.2.0",
|
||||||
"doctrine/dbal": "~2.9.2",
|
"doctrine/dbal": "^3.0.0",
|
||||||
"facade/ignition": "^2.0",
|
"facade/ignition": "^2.5",
|
||||||
"fideloper/proxy": "^4.3",
|
"fideloper/proxy": "^4.4",
|
||||||
"guzzlehttp/guzzle": "~6.5",
|
"guzzlehttp/guzzle": "~6.5",
|
||||||
"hashids/hashids": "^2.0.0",
|
"hashids/hashids": "^4.1.0",
|
||||||
"igaster/laravel-theme": "^2.0",
|
"igaster/laravel-theme": "^2.0",
|
||||||
"intervention/image": "2.4.*",
|
"intervention/image": "2.4.*",
|
||||||
"irazasyed/laravel-gamp": "^1.6",
|
"irazasyed/laravel-gamp": "^1.8",
|
||||||
"jmikola/geojson": "1.0.*",
|
"jmikola/geojson": "1.0.*",
|
||||||
"joshbrw/laravel-module-installer": "0.1.*",
|
"joshbrw/laravel-module-installer": "^2.0",
|
||||||
"laracasts/flash": "^3.1",
|
"laracasts/flash": "^3.1",
|
||||||
"laravel/helpers": "^1.2",
|
"laravel/helpers": "^1.4",
|
||||||
"laravelcollective/html": "~6.2.0",
|
"laravelcollective/html": "~6.2.0",
|
||||||
"layershifter/tld-extract": "^2.0",
|
"jeremykendall/php-domain-parser": "~5.7.2",
|
||||||
"league/csv": "9.2.*",
|
"league/csv": "9.2.*",
|
||||||
"league/geotools": "0.8.*",
|
"league/geotools": "0.8.*",
|
||||||
"league/iso3166": "2.1.*",
|
"league/iso3166": "^3.0.0",
|
||||||
"markrogoyski/math-php": "^0.38.0",
|
"markrogoyski/math-php": "^1.10",
|
||||||
"myclabs/deep-copy": "~1.9.0",
|
"myclabs/deep-copy": "~1.10.0",
|
||||||
"nabeel/vacentral": "~2.0",
|
"nabeel/vacentral": "~2.0",
|
||||||
"nwidart/laravel-modules": "^8.0",
|
"nwidart/laravel-modules": "^8.2",
|
||||||
"php-units-of-measure/php-units-of-measure": "~2.1.0",
|
"php-units-of-measure/php-units-of-measure": "~2.1.0",
|
||||||
"phpvms/sample-module": "^1.0",
|
"phpvms/sample-module": "^1.0",
|
||||||
"pragmarx/version": "^1.2.2",
|
"pragmarx/version": ">=v1.2.3",
|
||||||
"prettus/l5-repository": "~2.6.0",
|
"prettus/l5-repository": "~2.7.0",
|
||||||
"santigarcor/laratrust": "~6.0",
|
"santigarcor/laratrust": "~6.3",
|
||||||
"sebastiaanluca/laravel-helpers": "~5.0",
|
"sebastiaanluca/laravel-helpers": "~6.0",
|
||||||
"semver/semver": "~1.1.0",
|
"semver/semver": "~1.1.0",
|
||||||
"spatie/laravel-backup": "~6.9.0",
|
"spatie/valuestore": "~1.2",
|
||||||
"spatie/valuestore": "~1.2.3",
|
"symfony/polyfill-iconv": "~1.22.0",
|
||||||
"symfony/polyfill-iconv": "~1.17.0",
|
|
||||||
"tivie/php-os-detector": "~1.1.0",
|
"tivie/php-os-detector": "~1.1.0",
|
||||||
"vlucas/phpdotenv": "v4.0",
|
"vlucas/phpdotenv": "^5.3.0",
|
||||||
"webpatser/laravel-uuid": "~3.0",
|
"webpatser/laravel-uuid": "~4.0",
|
||||||
"oomphinc/composer-installers-extender": "^1.1",
|
"oomphinc/composer-installers-extender": "^2.0",
|
||||||
"laravel/ui": "^2.0",
|
"laravel/ui": "^3.2.0",
|
||||||
"madnest/madzipper": "^1.0"
|
"madnest/madzipper": "^1.1.0",
|
||||||
|
"elcobvg/laravel-opcache": "^0.4.1",
|
||||||
|
"laravel/legacy-factories": "^1.1",
|
||||||
|
"fakerphp/faker": "^1.13",
|
||||||
|
"wildbit/swiftmailer-postmark": "^3.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"barryvdh/laravel-debugbar": "^3.0",
|
"barryvdh/laravel-debugbar": "^3.5",
|
||||||
"barryvdh/laravel-ide-helper": "^2.6",
|
"barryvdh/laravel-ide-helper": "^2.9",
|
||||||
"bpocallaghan/generators": "~6.0",
|
"bpocallaghan/generators": "~7.0",
|
||||||
"filp/whoops": "~2.0",
|
"filp/whoops": "~2.0",
|
||||||
"fzaninotto/faker": "~1.9.0",
|
|
||||||
"friendsofphp/php-cs-fixer": "^2.16",
|
"friendsofphp/php-cs-fixer": "^2.16",
|
||||||
"mockery/mockery": "0.9.*",
|
"mockery/mockery": "^1.4.0",
|
||||||
"nunomaduro/collision": "^4.0",
|
"nunomaduro/collision": "^5.3.0",
|
||||||
"phpunit/phpunit": "~9.0",
|
"phpunit/phpunit": "~9.0",
|
||||||
"squizlabs/php_codesniffer": "3.*",
|
|
||||||
"sempro/phpunit-pretty-print": "^1.2"
|
"sempro/phpunit-pretty-print": "^1.2"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
|||||||
4743
composer.lock
generated
4743
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,204 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use App\Notifications\Notifiables\Backups;
|
|
||||||
use Spatie\Backup\Notifications\Notifications\BackupHasFailed;
|
|
||||||
use Spatie\Backup\Notifications\Notifications\BackupWasSuccessful;
|
|
||||||
use Spatie\Backup\Notifications\Notifications\CleanupHasFailed;
|
|
||||||
use Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful;
|
|
||||||
use Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound;
|
|
||||||
use Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound;
|
|
||||||
use Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy;
|
|
||||||
use Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays;
|
|
||||||
use Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes;
|
|
||||||
|
|
||||||
return [
|
|
||||||
'backup' => [
|
|
||||||
'name' => config('app.name', 'phpvms-backup'),
|
|
||||||
'source' => [
|
|
||||||
'files' => [
|
|
||||||
'include' => [
|
|
||||||
base_path(),
|
|
||||||
],
|
|
||||||
'exclude' => [
|
|
||||||
base_path('vendor'),
|
|
||||||
base_path('node_modules'),
|
|
||||||
],
|
|
||||||
'follow_links' => false,
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The names of the connections to the databases that should be backed up
|
|
||||||
* MySQL, PostgreSQL, SQLite and Mongo databases are supported.
|
|
||||||
*
|
|
||||||
* The content of the database dump may be customized for each connection
|
|
||||||
* by adding a 'dump' key to the connection settings in config/database.php.
|
|
||||||
* E.g.
|
|
||||||
* 'mysql' => [
|
|
||||||
* ...
|
|
||||||
* 'dump' => [
|
|
||||||
* 'excludeTables' => [
|
|
||||||
* 'table_to_exclude_from_backup',
|
|
||||||
* 'another_table_to_exclude'
|
|
||||||
* ]
|
|
||||||
* ],
|
|
||||||
* ],
|
|
||||||
*
|
|
||||||
* If you are using only InnoDB tables on a MySQL server, you can
|
|
||||||
* also supply the useSingleTransaction option to avoid table locking.
|
|
||||||
*
|
|
||||||
* E.g.
|
|
||||||
* 'mysql' => [
|
|
||||||
* ...
|
|
||||||
* 'dump' => [
|
|
||||||
* 'useSingleTransaction' => true,
|
|
||||||
* ],
|
|
||||||
* ],
|
|
||||||
*
|
|
||||||
* For a complete list of available customization options, see https://github.com/spatie/db-dumper
|
|
||||||
*/
|
|
||||||
'databases' => [
|
|
||||||
'mysql',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The database dump can be compressed to decrease diskspace usage.
|
|
||||||
*
|
|
||||||
* Out of the box Laravel-backup supplies
|
|
||||||
* Spatie\DbDumper\Compressors\GzipCompressor::class.
|
|
||||||
*
|
|
||||||
* You can also create custom compressor. More info on that here:
|
|
||||||
* https://github.com/spatie/db-dumper#using-compression
|
|
||||||
*
|
|
||||||
* If you do not want any compressor at all, set it to null.
|
|
||||||
*/
|
|
||||||
'database_dump_compressor' => null,
|
|
||||||
|
|
||||||
'destination' => [
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The filename prefix used for the backup zip file.
|
|
||||||
*/
|
|
||||||
'filename_prefix' => '',
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The disk names on which the backups will be stored.
|
|
||||||
*/
|
|
||||||
'disks' => [
|
|
||||||
'local',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The directory where the temporary files will be stored.
|
|
||||||
*/
|
|
||||||
'temporary_directory' => storage_path('app/backup-temp'),
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
* You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
|
|
||||||
* For Slack you need to install guzzlehttp/guzzle and laravel/slack-notification-channel.
|
|
||||||
*
|
|
||||||
* You can also use your own notification classes, just make sure the class is named after one of
|
|
||||||
* the `Spatie\Backup\Events` classes.
|
|
||||||
*/
|
|
||||||
'notifications' => [
|
|
||||||
'notifications' => [
|
|
||||||
BackupHasFailed::class => ['mail'],
|
|
||||||
UnhealthyBackupWasFound::class => ['mail'],
|
|
||||||
CleanupHasFailed::class => ['mail'],
|
|
||||||
BackupWasSuccessful::class => ['mail'],
|
|
||||||
HealthyBackupWasFound::class => ['mail'],
|
|
||||||
CleanupWasSuccessful::class => ['mail'],
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Here you can specify the notifiable to which the notifications should be sent. The default
|
|
||||||
* notifiable will use the variables specified in this config file.
|
|
||||||
*/
|
|
||||||
'notifiable' => Backups::class,
|
|
||||||
'slack' => [
|
|
||||||
'webhook_url' => '',
|
|
||||||
/*
|
|
||||||
* If this is set to null the default channel of the webhook will be used.
|
|
||||||
*/
|
|
||||||
'channel' => null,
|
|
||||||
'username' => null,
|
|
||||||
'icon' => null,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Here you can specify which backups should be monitored.
|
|
||||||
* If a backup does not meet the specified requirements the
|
|
||||||
* UnHealthyBackupWasFound event will be fired.
|
|
||||||
*/
|
|
||||||
'monitor_backups' => [
|
|
||||||
[
|
|
||||||
'name' => config(config('app.name'), 'phpvms-backup'),
|
|
||||||
'disks' => ['local'],
|
|
||||||
'health_checks' => [
|
|
||||||
MaximumAgeInDays::class => 1,
|
|
||||||
MaximumStorageInMegabytes::class => 5000,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
|
||||||
[
|
|
||||||
'name' => 'name of the second app',
|
|
||||||
'disks' => ['local', 's3'],
|
|
||||||
'health_checks' => [
|
|
||||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
|
||||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
*/
|
|
||||||
],
|
|
||||||
|
|
||||||
'cleanup' => [
|
|
||||||
/*
|
|
||||||
* The strategy that will be used to cleanup old backups. The default strategy
|
|
||||||
* will keep all backups for a certain amount of days. After that period only
|
|
||||||
* a daily backup will be kept. After that period only weekly backups will
|
|
||||||
* be kept and so on.
|
|
||||||
*
|
|
||||||
* No matter how you configure it the default strategy will never
|
|
||||||
* delete the newest backup.
|
|
||||||
*/
|
|
||||||
'strategy' => DefaultStrategy::class,
|
|
||||||
|
|
||||||
'default_strategy' => [
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The number of days for which backups must be kept.
|
|
||||||
*/
|
|
||||||
'keep_all_backups_for_days' => 7,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The number of days for which daily backups must be kept.
|
|
||||||
*/
|
|
||||||
'keep_daily_backups_for_days' => 7,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The number of weeks for which one weekly backup must be kept.
|
|
||||||
*/
|
|
||||||
'keep_weekly_backups_for_weeks' => 4,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The number of months for which one monthly backup must be kept.
|
|
||||||
*/
|
|
||||||
'keep_monthly_backups_for_months' => 4,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The number of years for which one yearly backup must be kept.
|
|
||||||
*/
|
|
||||||
'keep_yearly_backups_for_years' => 2,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* After cleaning up the backups remove the oldest backup until
|
|
||||||
* this amount of megabytes has been reached.
|
|
||||||
*/
|
|
||||||
'delete_oldest_backups_when_using_more_megabytes_than' => 5000,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
@@ -9,14 +9,18 @@ return [
|
|||||||
'key' => 'airports.lookup:',
|
'key' => 'airports.lookup:',
|
||||||
'time' => 60 * 30,
|
'time' => 60 * 30,
|
||||||
],
|
],
|
||||||
'WEATHER_LOOKUP' => [
|
'METAR_WEATHER_LOOKUP' => [
|
||||||
'key' => 'airports.weather.', // append icao
|
'key' => 'airports.weather.metar.', // append icao
|
||||||
'time' => 60 * 60, // Cache for 60 minutes
|
'time' => 60 * 60, // Cache for 60 minutes
|
||||||
],
|
],
|
||||||
'RANKS_PILOT_LIST' => [
|
'RANKS_PILOT_LIST' => [
|
||||||
'key' => 'ranks.pilot_list',
|
'key' => 'ranks.pilot_list',
|
||||||
'time' => 60 * 10,
|
'time' => 60 * 10,
|
||||||
],
|
],
|
||||||
|
'TAF_WEATHER_LOOKUP' => [
|
||||||
|
'key' => 'airports.weather.taf.', // append icao
|
||||||
|
'time' => 60 * 60, // Cache for 60 minutes
|
||||||
|
],
|
||||||
'USER_API_KEY' => [
|
'USER_API_KEY' => [
|
||||||
'key' => 'user.apikey',
|
'key' => 'user.apikey',
|
||||||
'time' => 60 * 5, // 5 min
|
'time' => 60 * 5, // 5 min
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Facade\Ignition\SolutionProviders\MissingPackageSolutionProvider;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -54,7 +56,7 @@ return [
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
'ignored_solution_providers' => [
|
'ignored_solution_providers' => [
|
||||||
//
|
MissingPackageSolutionProvider::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -68,7 +70,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'enable_runnable_solutions' => env('IGNITION_ENABLE_RUNNABLE_SOLUTIONS', null),
|
'enable_runnable_solutions' => false,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -19,10 +19,12 @@ return [
|
|||||||
'fileinfo',
|
'fileinfo',
|
||||||
'openssl',
|
'openssl',
|
||||||
'pdo',
|
'pdo',
|
||||||
|
'intl',
|
||||||
'mbstring',
|
'mbstring',
|
||||||
'tokenizer',
|
'tokenizer',
|
||||||
'json',
|
'json',
|
||||||
'curl',
|
'curl',
|
||||||
|
'dom',
|
||||||
],
|
],
|
||||||
|
|
||||||
// Make sure these are writable
|
// Make sure these are writable
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'driver' => env('MAIL_DRIVER', 'smtp'),
|
'default' => env('MAIL_DRIVER', 'smtp'),
|
||||||
|
|
||||||
'mailers' => [
|
'mailers' => [
|
||||||
'smtp' => [
|
'smtp' => [
|
||||||
'transport' => 'smtp',
|
'transport' => 'smtp',
|
||||||
@@ -71,4 +70,21 @@ return [
|
|||||||
'address' => env('MAIL_FROM_ADDRESS', 'no-reply@phpvms.net'),
|
'address' => env('MAIL_FROM_ADDRESS', 'no-reply@phpvms.net'),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Markdown Mail Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you are using Markdown based email rendering, you may configure your
|
||||||
|
| theme and component paths here, allowing you to customize the design
|
||||||
|
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'markdown' => [
|
||||||
|
'theme' => 'default',
|
||||||
|
'paths' => [
|
||||||
|
resource_path('views/vendor/mail'),
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ return [
|
|||||||
'expire_on_close' => false,
|
'expire_on_close' => false,
|
||||||
'encrypt' => false,
|
'encrypt' => false,
|
||||||
'files' => storage_path('framework/sessions'),
|
'files' => storage_path('framework/sessions'),
|
||||||
'connection' => null,
|
'connection' => 'mysql',
|
||||||
'table' => 'sessions',
|
'table' => 'sessions',
|
||||||
'store' => null,
|
'store' => null,
|
||||||
'lottery' => [1, 100],
|
'lottery' => [1, 100],
|
||||||
|
|||||||
26
index.php
26
index.php
@@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* phpVMS (root folder)
|
|
||||||
*/
|
|
||||||
$path_to_phpvms_folder = __DIR__;
|
|
||||||
|
|
||||||
require $path_to_phpvms_folder.'/bootstrap/autoload.php';
|
|
||||||
|
|
||||||
$app = require_once $path_to_phpvms_folder.'/bootstrap/app.php';
|
|
||||||
|
|
||||||
$app->setPublicPath(__DIR__.'/public');
|
|
||||||
$app->setPublicUrlPath(env('APP_PUBLIC_URL', '/'));
|
|
||||||
|
|
||||||
// Uncomment this line if you're having issues with the redirecting not working properly
|
|
||||||
//$app->setPublicUrlPath(env('APP_PUBLIC_URL', '/public'));
|
|
||||||
|
|
||||||
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
|
|
||||||
|
|
||||||
$response = $kernel->handle(
|
|
||||||
$request = Illuminate\Http\Request::capture()
|
|
||||||
);
|
|
||||||
|
|
||||||
$response->send();
|
|
||||||
|
|
||||||
$kernel->terminate($request, $response);
|
|
||||||
@@ -42,7 +42,7 @@ class PilotHoursAwards extends Award
|
|||||||
*/
|
*/
|
||||||
public function check($flight_minutes = null): bool
|
public function check($flight_minutes = null): bool
|
||||||
{
|
{
|
||||||
if (!is_int($flight_minutes)) {
|
if (!is_numeric($flight_minutes)) {
|
||||||
Log::error('PilotHourAwards: Flight time "'.$flight_minutes.'" is not a valid flight time');
|
Log::error('PilotHourAwards: Flight time "'.$flight_minutes.'" is not a valid flight time');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
11
package-lock.json
generated
11
package-lock.json
generated
@@ -1983,6 +1983,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/bootstrap-sass/-/bootstrap-sass-3.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/bootstrap-sass/-/bootstrap-sass-3.4.1.tgz",
|
||||||
"integrity": "sha512-p5rxsK/IyEDQm2CwiHxxUi0MZZtvVFbhWmyMOt4lLkA4bujDA1TGoKT0i1FKIWiugAdP+kK8T5KMDFIKQCLYIA=="
|
"integrity": "sha512-p5rxsK/IyEDQm2CwiHxxUi0MZZtvVFbhWmyMOt4lLkA4bujDA1TGoKT0i1FKIWiugAdP+kK8T5KMDFIKQCLYIA=="
|
||||||
},
|
},
|
||||||
|
"bootstrap3": {
|
||||||
|
"version": "npm:bootstrap@3.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-3.4.1.tgz",
|
||||||
|
"integrity": "sha512-yN5oZVmRCwe5aKwzRj6736nSmKDX7pLYwsXiCj/EYmo16hODaBiT4En5btW/jhBF/seV+XMx3aYwukYC3A49DA=="
|
||||||
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
@@ -5125,9 +5130,9 @@
|
|||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||||
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
|
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
|
||||||
},
|
},
|
||||||
"inquirer": {
|
"inquirer": {
|
||||||
"version": "7.3.3",
|
"version": "7.3.3",
|
||||||
|
|||||||
86
phpunit.xml
86
phpunit.xml
@@ -1,50 +1,44 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit bootstrap="bootstrap/autoload.php"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="bootstrap/autoload.php" colors="true" processIsolation="false" stopOnFailure="true" convertErrorsToExceptions="false" convertNoticesToExceptions="false" convertWarningsToExceptions="false" beStrictAboutOutputDuringTests="false" beStrictAboutTestsThatDoNotTestAnything="false"
|
||||||
colors="true"
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||||
processIsolation="false"
|
<coverage processUncoveredFiles="true">
|
||||||
stopOnFailure="true"
|
<include>
|
||||||
convertErrorsToExceptions="false"
|
<directory suffix=".php">./app</directory>
|
||||||
convertNoticesToExceptions="false"
|
</include>
|
||||||
convertWarningsToExceptions="false"
|
</coverage>
|
||||||
beStrictAboutOutputDuringTests="false"
|
<testsuites>
|
||||||
beStrictAboutTestsThatDoNotTestAnything="false">
|
<testsuite name="Application Test Suite">
|
||||||
<testsuites>
|
<directory suffix="Test.php">./tests</directory>
|
||||||
<testsuite name="Application Test Suite">
|
</testsuite>
|
||||||
<directory suffix="Test.php">./tests</directory>
|
</testsuites>
|
||||||
</testsuite>
|
<extensions>
|
||||||
</testsuites>
|
<extension class="Tests\Bootstrap"/>
|
||||||
<extensions>
|
</extensions>
|
||||||
<extension class="Tests\Bootstrap"/>
|
<!--<listeners>
|
||||||
</extensions>
|
|
||||||
<!--<listeners>
|
|
||||||
<listener class="NunoMaduro\Collision\Adapters\Phpunit\Listener"/>
|
<listener class="NunoMaduro\Collision\Adapters\Phpunit\Listener"/>
|
||||||
</listeners>-->
|
</listeners>-->
|
||||||
<filter>
|
<php>
|
||||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
<env name="PHPUNIT_PRETTY_PRINT_PROGRESS" value="true"/>
|
||||||
<directory suffix=".php">./app</directory>
|
<ini name="error_reporting" value="E_ALL"/>
|
||||||
</whitelist>
|
<ini name="display_errors" value="On"/>
|
||||||
</filter>
|
<ini name="display_startup_errors" value="On"/>
|
||||||
<php>
|
<server name="APP_ENV" value="testing"/>
|
||||||
<env name="PHPUNIT_PRETTY_PRINT_PROGRESS" value="true" />
|
<server name="APP_KEY" value="base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI="/>
|
||||||
<ini name="error_reporting" value="E_ALL"/>
|
<server name="APP_DEBUG" value="true"/>
|
||||||
<ini name="display_errors" value="On"/>
|
<server name="APP_LOG_LEVEL" value="error"/>
|
||||||
<ini name="display_startup_errors" value="On"/>
|
<server name="APP_URL" value="http://localhost"/>
|
||||||
<server name="APP_ENV" value="testing"/>
|
<server name="BCRYPT_ROUNDS" value="4"/>
|
||||||
<server name="APP_KEY" value="base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI="/>
|
<server name="CACHE_DRIVER" value="array"/>
|
||||||
<server name="APP_DEBUG" value="true"/>
|
<server name="DB_CONNECTION" value="memory"/>
|
||||||
<server name="APP_LOG_LEVEL" value="error"/>
|
<server name="DB_PREFIX" value="vmstest_"/>
|
||||||
<server name="BCRYPT_ROUNDS" value="4"/>
|
<server name="MAIL_MAILER" value="array"/>
|
||||||
<server name="CACHE_DRIVER" value="none"/>
|
<server name="QUEUE_DRIVER" value="sync"/>
|
||||||
<server name="DB_CONNECTION" value="memory"/>
|
<server name="SESSION_DRIVER" value="array"/>
|
||||||
<server name="DB_PREFIX" value="vmstest_"/>
|
<server name="TELESCOPE_ENABLED" value="false"/>
|
||||||
<server name="MAIL_MAILER" value="array"/>
|
<server name="APP_CONFIG_CACHE" value="bootstrap/cache/config.phpunit.php"/>
|
||||||
<server name="QUEUE_DRIVER" value="sync"/>
|
<server name="APP_SERVICES_CACHE" value="bootstrap/cache/services.phpunit.php"/>
|
||||||
<server name="SESSION_DRIVER" value="array"/>
|
<server name="APP_PACKAGES_CACHE" value="bootstrap/cache/packages.phpunit.php"/>
|
||||||
<server name="TELESCOPE_ENABLED" value="false"/>
|
<server name="APP_ROUTES_CACHE" value="bootstrap/cache/routes.phpunit.php"/>
|
||||||
<server name="APP_CONFIG_CACHE" value="bootstrap/cache/config.phpunit.php"/>
|
<server name="APP_EVENTS_CACHE" value="bootstrap/cache/events.phpunit.php"/>
|
||||||
<server name="APP_SERVICES_CACHE" value="bootstrap/cache/services.phpunit.php"/>
|
</php>
|
||||||
<server name="APP_PACKAGES_CACHE" value="bootstrap/cache/packages.phpunit.php"/>
|
|
||||||
<server name="APP_ROUTES_CACHE" value="bootstrap/cache/routes.phpunit.php"/>
|
|
||||||
<server name="APP_EVENTS_CACHE" value="bootstrap/cache/events.phpunit.php"/>
|
|
||||||
</php>
|
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|||||||
@@ -130,3 +130,11 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
width: 250px;
|
width: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* fix the dropdown menu on mobile view
|
||||||
|
*/
|
||||||
|
.dropdown-menu:not(.show) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,9 @@
|
|||||||
* https://docs.phpvms.net
|
* https://docs.phpvms.net
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Http\Kernel;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NOTE!!
|
* NOTE!!
|
||||||
*
|
*
|
||||||
@@ -16,14 +19,12 @@
|
|||||||
*/
|
*/
|
||||||
$path_to_phpvms_folder = __DIR__.'/../';
|
$path_to_phpvms_folder = __DIR__.'/../';
|
||||||
if (file_exists($path_to_phpvms_folder.'bootstrap/autoload.php')) {
|
if (file_exists($path_to_phpvms_folder.'bootstrap/autoload.php')) {
|
||||||
require $path_to_phpvms_folder.'bootstrap/autoload.php';
|
// noop
|
||||||
$app = require_once $path_to_phpvms_folder.'bootstrap/app.php';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look up one more folder up (outside of the Laravel root) and in the `phpvms` subfolder
|
// Look up one more folder up (outside of the Laravel root) and in the `phpvms` subfolder
|
||||||
elseif (file_exists($path_to_phpvms_folder.'phpvms/bootstrap/autoload.php')) {
|
elseif (file_exists($path_to_phpvms_folder.'phpvms/bootstrap/autoload.php')) {
|
||||||
require $path_to_phpvms_folder.'phpvms/bootstrap/autoload.php';
|
$path_to_phpvms_folder = $path_to_phpvms_folder.'phpvms';
|
||||||
$app = require_once $path_to_phpvms_folder.'phpvms/bootstrap/app.php';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bail out
|
// Bail out
|
||||||
@@ -32,14 +33,30 @@ else {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require $path_to_phpvms_folder.'/bootstrap/autoload.php';
|
||||||
|
$app = require_once $path_to_phpvms_folder.'/bootstrap/app.php';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Check If Application Is Under Maintenance
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If the application is maintenance / demo mode via the "down" command we
|
||||||
|
| will require this file so that any prerendered template can be shown
|
||||||
|
| instead of starting the framework, which could cause an exception.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (file_exists($path_to_phpvms_folder.'/storage/framework/maintenance.php')) {
|
||||||
|
require $path_to_phpvms_folder.'/storage/framework/maintenance.php';
|
||||||
|
}
|
||||||
|
|
||||||
$app->setPublicPath(__DIR__);
|
$app->setPublicPath(__DIR__);
|
||||||
|
|
||||||
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
|
$kernel = $app->make(Kernel::class);
|
||||||
|
|
||||||
$response = $kernel->handle(
|
$response = tap($kernel->handle(
|
||||||
$request = Illuminate\Http\Request::capture()
|
$request = Request::capture()
|
||||||
);
|
))->send();
|
||||||
|
|
||||||
$response->send();
|
|
||||||
|
|
||||||
$kernel->terminate($request, $response);
|
$kernel->terminate($request, $response);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ return [
|
|||||||
|
|
||||||
// Overrides config/mail.php
|
// Overrides config/mail.php
|
||||||
'mail' => [
|
'mail' => [
|
||||||
'driver' => 'mail', # Default is to use the mail() fn
|
'default' => 'mail', # Default is to use the mail() fn
|
||||||
'mailers' => [
|
'mailers' => [
|
||||||
'smtp' => [
|
'smtp' => [
|
||||||
'transport' => 'smtp',
|
'transport' => 'smtp',
|
||||||
@@ -107,7 +107,8 @@ return [
|
|||||||
|
|
||||||
// Overrides config/session.php
|
// Overrides config/session.php
|
||||||
'session' => [
|
'session' => [
|
||||||
'default' => 'file',
|
'driver' => 'file',
|
||||||
|
'connection' => 'mysql',
|
||||||
'lifetime' => 60 * 24, # 24 hours
|
'lifetime' => 60 * 24, # 24 hours
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
<?php exit(); ?>
|
#
|
||||||
|
# THIS FILE MUST BE KEPT SECRET! IT IS BLOCKED IN THE HTACCESS FILE
|
||||||
|
# HOWEVER, THIS DIRECTORY SHOULDN'T BE EXPOSED TO THE PUBLIC AT ALL
|
||||||
|
# SEE THE DOCS FOR PROPER (SECURE) INSTALLATION:
|
||||||
|
# https://docs.phpvms.net/installation/uploading
|
||||||
|
#
|
||||||
|
|
||||||
APP_KEY=base64:$APP_KEY$
|
APP_KEY=base64:$APP_KEY$
|
||||||
|
|||||||
13618
resources/tld/public_suffix_list.dat
Normal file
13618
resources/tld/public_suffix_list.dat
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
@if($cron_problem_exists)
|
@if($cron_problem_exists)
|
||||||
<div class="alert alert-danger" role="alert">
|
<div class="alert alert-danger" role="alert">
|
||||||
There was a problem running the cron; make sure it's setup and check logs at
|
The cron has not run in more than 12 hours; make sure it's setup and check logs at
|
||||||
<span class="text-monospace bg-gradient-dark">storage/logs/cron.log</span>.
|
<span class="text-monospace bg-gradient-dark">storage/logs/cron.log</span>.
|
||||||
<a href="{{ docs_link('cron') }}" target="_blank">See the docs</a>
|
<a href="{{ docs_link('cron') }}" target="_blank">See the docs</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{{ Form::open(['route' => 'admin.flights.index', 'method' => 'GET', 'class'=>'form-inline pull-right']) }}
|
{{ Form::open(['route' => 'admin.flights.index', 'method' => 'GET', 'class'=>'form-inline pull-right']) }}
|
||||||
|
|
||||||
|
{{ Form::label('airlines', 'Airline:') }}
|
||||||
|
{{ Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) }}
|
||||||
{{ Form::label('flight_number', 'Flight Number:') }}
|
{{ Form::label('flight_number', 'Flight Number:') }}
|
||||||
{{ Form::text('flight_number', null, ['class' => 'form-control']) }}
|
{{ Form::text('flight_number', null, ['class' => 'form-control']) }}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user