Merge pull request #690 from nabeelio/7.0.0-beta.4

7.0.0-beta.4
This commit is contained in:
Nabeel S 2020-05-09 12:31:35 -04:00 committed by GitHub
commit 78ee1a9769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
678 changed files with 22691 additions and 3726 deletions

1
.gitignore vendored
View File

@ -29,6 +29,7 @@ env.php
#Homestead.yaml
Homestead.json
LocalValetDriver.php
docker-compose-profiler.yml
# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer
.rocketeer/

View File

@ -4,13 +4,13 @@
language: php
php:
- '7.2'
- '7.3'
- '7.4'
- '7.3'
- '7.2'
env:
- DB=mysql
- DB=mariadb
#env:
# - DB=mysql
# - DB=mariadb
cache:
# Cache lives for 10 min
@ -23,13 +23,14 @@ cache:
services:
- mysql
addons:
mariadb: '10.2'
#addons:
# mariadb: '10.2'
install:
- php --version
- mysql --version
- composer install --dev --no-interaction --verbose
- npm i tar-to-zip -g
- cp .travis/env.travis.php env.php
- cp .travis/phpunit.travis.xml phpunit.xml
@ -136,7 +137,7 @@ jobs:
on:
all_branches: true
repo: nabeelio/phpvms
php: '7.2'
php: '7.4'
tags: false
# RELEASE STAGE
@ -157,4 +158,4 @@ jobs:
on:
tags: true
repo: nabeelio/phpvms
php: '7.2'
php: '7.4'

View File

@ -1,132 +1,150 @@
#!/usr/bin/env bash
if [ "$TRAVIS" = "true" ]; then
cd $TRAVIS_BUILD_DIR
if test "$TRAVIS_TAG"; then
PKG_NAME=$TRAVIS_TAG
VERSION=$TRAVIS_TAG
# Pass in the tag as the version to write out
php artisan phpvms:version --write $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
PKG_NAME=${BASE_VERSION}
# Don't pass in a version here, just write out the latest hash
php artisan phpvms:version --write >VERSION
VERSION=$(cat VERSION)
fi
echo "Version: $VERSION"
echo "Package name: $TAR_NAME"
FILE_NAME="phpvms-$PKG_NAME"
TAR_NAME="$FILE_NAME.tar.gz"
echo "Cleaning files"
rm -rf vendor
composer install --no-dev --prefer-dist --no-interaction --verbose
# Leftover individual files to delete
declare -a remove_files=(
.git
.github
.sass-cache
.idea
.travis
docker
_ide_helper.php
.dockerignore
.dpl
.editorconfig
.eslintignore
.eslintrc
.php_cs
.php_cs.cache
.phpstorm.meta.php
.styleci.yml
.phpunit.result.cache
env.php
intellij_style.xml
config.php
docker-compose.yml
Makefile
phpcs.xml
phpunit.xml
phpvms.iml
Procfile
phpstan.neon
node_modules
composer.phar
vendor/willdurand/geocoder/tests
)
for file in "${remove_files[@]}"; do
rm -rf $file
done
find ./vendor -type d -name ".git" -print0 | xargs rm -rf
find . -type d -name "sass-cache" -print0 | xargs rm -rf
# clear any app specific stuff that might have been loaded in
find bootstrap/cache -mindepth 1 -maxdepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/app -mindepth 1 -maxdepth 1 -not -name '.gitignore' -not -name public -not -name import -print0 -exec rm -rf {} +
find storage/app/public -mindepth 1 -maxdepth 1 -not -name '.gitignore' -not -name avatars -not -name uploads -print0 -exec rm -rf {} +
find storage/app/public/avatars -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/app/public/uploads -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/debugbar -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/docker -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/framework/cache -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/framework/sessions -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/framework/views -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/logs -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
mkdir -p storage/app/public/avatars
mkdir -p storage/app/public/uploads
mkdir -p storage/framework/cache
mkdir -p storage/framework/sessions
mkdir -p storage/framework/views
# Regenerate the autoloader and classes
composer dump-autoload
make clean
cd /tmp
tar -czf $TAR_NAME -C $TRAVIS_BUILD_DIR/../ phpvms
sha256sum $TAR_NAME >"$TAR_NAME.sha256"
echo "Uploading to S3"
mkdir -p $TRAVIS_BUILD_DIR/build
cd $TRAVIS_BUILD_DIR/build
mv "/tmp/$TAR_NAME" "/tmp/$TAR_NAME.sha256" .
artifacts upload --target-paths "/" $TAR_NAME $TRAVIS_BUILD_DIR/VERSION $TAR_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
curl -X POST --data "{\"content\": \"A new build is available at http://downloads.phpvms.net/$TAR_NAME ($VERSION)\"}" -H "Content-Type: application/json" $DISCORD_WEBHOOK_URL
if [ "$TRAVIS" != "true" ]; then
exit 0
fi
cd $TRAVIS_BUILD_DIR
if test "$TRAVIS_TAG"; then
VERSION=$TRAVIS_TAG
# Pass in the tag as the version to write out
php artisan phpvms:version --write --write-full-version "${VERSION}"
FULL_VERSION=$(php artisan phpvms:version)
else
echo "On branch $TRAVIS_BRANCH"
if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_BRANCH" != "dev" ]; then
echo "Not on valid branch, exiting"
exit 0
fi
# Write the version out but place the branch ID in there
# This is only for the dev branch
BASE_VERSION=$(php artisan phpvms:version --base-only)
# This now includes the pre-release version, so "-dev" by default
VERSION=${BASE_VERSION}
# Don't pass in a version here, just write out the latest hash
php artisan phpvms:version --write "${VERSION}"
FULL_VERSION=$(php artisan phpvms:version)
fi
FILE_NAME="phpvms-${VERSION}"
TAR_NAME="$FILE_NAME.tar.gz"
ZIP_NAME="$FILE_NAME.zip"
echo "Version: ${VERSION}"
echo "Full Version: ${FULL_VERSION}"
echo "Package name: ${TAR_NAME}"
echo "==========================="
echo "Cleaning files"
rm -rf vendor
composer install --no-dev --prefer-dist --no-interaction --verbose
# Leftover individual files to delete
declare -a remove_files=(
.git
.github
.sass-cache
.idea
.travis
docker
_ide_helper.php
.dockerignore
.dpl
.editorconfig
.eslintignore
.eslintrc
.php_cs
.php_cs.cache
.phpstorm.meta.php
.styleci.yml
.phpunit.result.cache
env.php
intellij_style.xml
config.php
docker-compose.yml
Makefile
phpcs.xml
phpunit.xml
phpvms.iml
Procfile
phpstan.neon
node_modules
composer.phar
vendor/willdurand/geocoder/tests
)
for file in "${remove_files[@]}"; do
rm -rf $file
done
find ./vendor -type d -name ".git" -print0 | xargs rm -rf
find . -type d -name "sass-cache" -print0 | xargs rm -rf
# clear any app specific stuff that might have been loaded in
find bootstrap/cache -mindepth 1 -maxdepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/app -mindepth 1 -maxdepth 1 -not -name '.gitignore' -not -name public -not -name import -print0 -exec rm -rf {} +
find storage/app/public -mindepth 1 -maxdepth 1 -not -name '.gitignore' -not -name avatars -not -name uploads -print0 -exec rm -rf {} +
find storage/app/public/avatars -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/app/public/uploads -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/debugbar -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/docker -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/framework/cache -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/framework/sessions -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/framework/views -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/logs -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
mkdir -p storage/app/public/avatars
mkdir -p storage/app/public/uploads
mkdir -p storage/framework/cache
mkdir -p storage/framework/sessions
mkdir -p storage/framework/views
# Regenerate the autoloader and classes
composer dump-autoload
make clean
cd /tmp
ls -al $TRAVIS_BUILD_DIR/../
tar -czf $TAR_NAME -C $TRAVIS_BUILD_DIR .
sha256sum $TAR_NAME >"$TAR_NAME.sha256"
tar2zip $TAR_NAME
sha256sum $ZIP_NAME >"$ZIP_NAME.sha256"
ls -al /tmp
echo "Uploading to S3"
mkdir -p $TRAVIS_BUILD_DIR/build
cd $TRAVIS_BUILD_DIR/build
mv "/tmp/$TAR_NAME" "/tmp/$ZIP_NAME" "/tmp/$TAR_NAME.sha256" "/tmp/$ZIP_NAME.sha256" .
artifacts upload --target-paths "/" $ZIP_NAME $TAR_NAME $TRAVIS_BUILD_DIR/VERSION $TAR_NAME.sha256 $ZIP_NAME.sha256
# Upload the version for a tagged release. Move to a version file in different
# tags. Within phpVMS, we have an option of which version to track in the admin
if test "$TRAVIS_TAG"; then
echo "Uploading release version file"
cp "$TRAVIS_BUILD_DIR/VERSION" release_version
artifacts upload --target-paths "/" release_version
else
echo "Uploading ${TRAVIS_BRANCH}_version file"
cp $TRAVIS_BUILD_DIR/VERSION ${TRAVIS_BRANCH}_version
artifacts upload --target-paths "/" ${TRAVIS_BRANCH}_version
fi
#if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_BRANCH" != "dev" ]; then
# echo "Skipping Discord branch update broadcast"
#else
curl -X POST \
--data "{\"content\": \"A new build is available at http://downloads.phpvms.net/$TAR_NAME (${FULL_VERSION})\"}" \
-H "Content-Type: application/json" \
$DISCORD_WEBHOOK_URL
#fi

View File

@ -1,9 +1,706 @@
## Beta 2 (7.0.0-beta.2)
# Changelog
- Switching to semver
- PHP 7.2 minimum
- Lots of fixes, view the [Github Milestone](https://github.com/nabeelio/phpvms/milestone/2?closed=1) for details
## [7.0.0-beta.4](https://github.com/nabeelio/phpvms/tree/7.0.0-beta.4) (2020-05-09)
## Beta 1 (v7.0.0-beta)
[Full Changelog](https://github.com/nabeelio/phpvms/compare/7.0.0-beta.3...7.0.0-beta.4)
- Initial Release
**Implemented enhancements:**
- Move currency selection to admin settings [\#671](https://github.com/nabeelio/phpvms/issues/671)
- Center live map to custom location [\#661](https://github.com/nabeelio/phpvms/issues/661)
- Pilot Names - Pilots ID [\#656](https://github.com/nabeelio/phpvms/issues/656)
- Simbrief sample data [\#651](https://github.com/nabeelio/phpvms/issues/651)
- Simbrief only available for bids [\#642](https://github.com/nabeelio/phpvms/issues/642)
- PIREP prefile download [\#634](https://github.com/nabeelio/phpvms/issues/634)
- Importer - group imported aircraft by type [\#628](https://github.com/nabeelio/phpvms/issues/628)
- API: When looking up flight, return the load factor [\#611](https://github.com/nabeelio/phpvms/issues/611)
- API: On prefile, return required fields [\#610](https://github.com/nabeelio/phpvms/issues/610)
- Center on active flights [\#605](https://github.com/nabeelio/phpvms/issues/605)
- Profiling/performance improvments [\#602](https://github.com/nabeelio/phpvms/issues/602)
- Aircraft stats resync [\#585](https://github.com/nabeelio/phpvms/issues/585)
- Cron Job [\#553](https://github.com/nabeelio/phpvms/issues/553)
- Importing a CSV with additional airports clears all previous airports [\#490](https://github.com/nabeelio/phpvms/issues/490)
- Use continuation token instead of page/offset [\#469](https://github.com/nabeelio/phpvms/issues/469)
- Combine the Util classes in Facade and Support [\#467](https://github.com/nabeelio/phpvms/issues/467)
- ACARS/Live flight events [\#436](https://github.com/nabeelio/phpvms/issues/436)
- Allow logo upload for airline [\#417](https://github.com/nabeelio/phpvms/issues/417)
- Google Analytics Settings [\#382](https://github.com/nabeelio/phpvms/issues/382)
- Let update only be run if logged in/admin [\#372](https://github.com/nabeelio/phpvms/issues/372)
- Airport Lookup - possible additions [\#364](https://github.com/nabeelio/phpvms/issues/364)
- Set flight type for expenses for flight [\#348](https://github.com/nabeelio/phpvms/issues/348)
- Extend search schedule options [\#297](https://github.com/nabeelio/phpvms/issues/297)
- Change currency from settings \#671 [\#672](https://github.com/nabeelio/phpvms/pull/672)
- Add privatized version of name \#656 [\#658](https://github.com/nabeelio/phpvms/pull/658)
- Add Simbrief entries as sample data for load \#651 [\#652](https://github.com/nabeelio/phpvms/pull/652)
- Option for SB only on bids; add the new file type \#642 [\#643](https://github.com/nabeelio/phpvms/pull/643)
- Account ICAO for subfleet, airline/location if columns exist \#628 [\#632](https://github.com/nabeelio/phpvms/pull/632)
- Performance improvements \#602 [\#607](https://github.com/nabeelio/phpvms/pull/607)
- Center on active flights \#605 [\#606](https://github.com/nabeelio/phpvms/pull/606)
- Installer fixes, remove bcmath, fix design [\#596](https://github.com/nabeelio/phpvms/pull/596)
- Remove airport length restrictions \#590 [\#592](https://github.com/nabeelio/phpvms/pull/592)
- Remove 4 char restriction from ICAO; use decimal type for lat/lon \#590 [\#591](https://github.com/nabeelio/phpvms/pull/591)
- Recalcuate aircraft stats in nightly cron and importer \#585 \#443 [\#587](https://github.com/nabeelio/phpvms/pull/587)
- \(Importer\) Set the pay rate for the ranks \#443 [\#586](https://github.com/nabeelio/phpvms/pull/586)
- Fix rowmapper generator, check for fields, map users \#443 [\#583](https://github.com/nabeelio/phpvms/pull/583)
- Add bcmath to the required extensions list \#558 [\#564](https://github.com/nabeelio/phpvms/pull/564)
- Add the argc\_argv flag for the cgi exec \#553 [\#556](https://github.com/nabeelio/phpvms/pull/556)
- Add logo to the flights page if its set \#417 [\#550](https://github.com/nabeelio/phpvms/pull/550)
- Add additional events for PIREP states \#436 [\#548](https://github.com/nabeelio/phpvms/pull/548)
- Cleanup Utils \#467 [\#547](https://github.com/nabeelio/phpvms/pull/547)
- Add checkbox to clear previous data when importing \#490 [\#546](https://github.com/nabeelio/phpvms/pull/546)
- Distro zip file from tar file \#449 [\#543](https://github.com/nabeelio/phpvms/pull/543)
- Spanish files translation [\#542](https://github.com/nabeelio/phpvms/pull/542)
- Add link to download ACARS config from profile [\#539](https://github.com/nabeelio/phpvms/pull/539)
- Format all blade templates to 2 spaces \#530 [\#531](https://github.com/nabeelio/phpvms/pull/531)
- Add menu bar for mobile [\#529](https://github.com/nabeelio/phpvms/pull/529)
- Fix live and route map errors \#527 [\#528](https://github.com/nabeelio/phpvms/pull/528)
- Set PIREPs page to public [\#526](https://github.com/nabeelio/phpvms/pull/526)
- Try to clear caches before updating [\#522](https://github.com/nabeelio/phpvms/pull/522)
- Reduce number of queries for update check [\#520](https://github.com/nabeelio/phpvms/pull/520)
- Add getRootDomain\(\) to Utils [\#514](https://github.com/nabeelio/phpvms/pull/514)
- Search flights by subfleet \#484 [\#506](https://github.com/nabeelio/phpvms/pull/506)
- Add base Dockerfile for Dockerhub upload [\#504](https://github.com/nabeelio/phpvms/pull/504)
- Add reference to docs on doc site [\#502](https://github.com/nabeelio/phpvms/pull/502)
- Add new command to export a specific PIREP for debugging [\#501](https://github.com/nabeelio/phpvms/pull/501)
- Flight search for departure/arrival airports not using column names [\#496](https://github.com/nabeelio/phpvms/pull/496)
- Split the importer module out from the installer module [\#468](https://github.com/nabeelio/phpvms/pull/468)
**Fixed bugs:**
- Aircraft hours not counting [\#683](https://github.com/nabeelio/phpvms/issues/683)
- Error creating first user/airline [\#677](https://github.com/nabeelio/phpvms/issues/677)
- submitting PIREP: Page Not Found [\#676](https://github.com/nabeelio/phpvms/issues/676)
- Filing manual report causes SimBrief Error [\#668](https://github.com/nabeelio/phpvms/issues/668)
- Error on finance page in admin [\#667](https://github.com/nabeelio/phpvms/issues/667)
- API: User bids aren't loading SimBrief data for flight [\#664](https://github.com/nabeelio/phpvms/issues/664)
- .: Links to pilot profiles :. [\#655](https://github.com/nabeelio/phpvms/issues/655)
- Some domains \(ex, .co.uk\) not properly parsed [\#647](https://github.com/nabeelio/phpvms/issues/647)
- API: Load bids through the bids.flight fields, not the flights field on the user [\#639](https://github.com/nabeelio/phpvms/issues/639)
- Login page not using theme [\#638](https://github.com/nabeelio/phpvms/issues/638)
- CSV import error says "csv not found" [\#636](https://github.com/nabeelio/phpvms/issues/636)
- Importer - schedules not importing properly [\#630](https://github.com/nabeelio/phpvms/issues/630)
- Disable using of php opcache [\#625](https://github.com/nabeelio/phpvms/issues/625)
- API: Flight fields are an array when empty [\#618](https://github.com/nabeelio/phpvms/issues/618)
- "Pending Pireps" in admin is blank [\#616](https://github.com/nabeelio/phpvms/issues/616)
- Flight fields show all fields, not custom added ones [\#614](https://github.com/nabeelio/phpvms/issues/614)
- Mixed content causes error [\#612](https://github.com/nabeelio/phpvms/issues/612)
- Fares not appearing in API response for user/subfleets [\#608](https://github.com/nabeelio/phpvms/issues/608)
- Not selecting active for aircraft shows nullable error [\#603](https://github.com/nabeelio/phpvms/issues/603)
- Airports page repeats airport name \(infinite loop\) [\#599](https://github.com/nabeelio/phpvms/issues/599)
- Calculate Distance button not working [\#595](https://github.com/nabeelio/phpvms/issues/595)
- Support Seaports with 3 letter IATA/ID codes [\#590](https://github.com/nabeelio/phpvms/issues/590)
- Hubs only show for registration [\#580](https://github.com/nabeelio/phpvms/issues/580)
- Error when updating user in admin [\#576](https://github.com/nabeelio/phpvms/issues/576)
- Updater not working because Source repository \[github\] is not defined [\#575](https://github.com/nabeelio/phpvms/issues/575)
- Flights Page Search Subfleet Column [\#574](https://github.com/nabeelio/phpvms/issues/574)
- Duplicate key entry for ACARS data [\#572](https://github.com/nabeelio/phpvms/issues/572)
- No hint path defined for updater [\#570](https://github.com/nabeelio/phpvms/issues/570)
- My Bids Page Error [\#561](https://github.com/nabeelio/phpvms/issues/561)
- I can't change Current Theme [\#554](https://github.com/nabeelio/phpvms/issues/554)
- Pilots cannot use the dashboard or flights without admin rights [\#480](https://github.com/nabeelio/phpvms/issues/480)
- Database prefix not being applied [\#442](https://github.com/nabeelio/phpvms/issues/442)
- Install not working [\#411](https://github.com/nabeelio/phpvms/issues/411)
- typo in dependency on 'leaflet.geodesic' [\#687](https://github.com/nabeelio/phpvms/pull/687)
- Emails/notifications not sending \#675 [\#686](https://github.com/nabeelio/phpvms/pull/686)
- Aircraft hours not showing/incrementing \#683 [\#684](https://github.com/nabeelio/phpvms/pull/684)
- METAR: KM as unit in visibility \#680 [\#682](https://github.com/nabeelio/phpvms/pull/682)
- Blank/null IATA code isn't unique when added \#679 [\#681](https://github.com/nabeelio/phpvms/pull/681)
- Fix airline creation in installer \#677 [\#678](https://github.com/nabeelio/phpvms/pull/678)
- Journal not created when airline is created \#667 [\#670](https://github.com/nabeelio/phpvms/pull/670)
- Check for SB being avail before filing \#668 [\#669](https://github.com/nabeelio/phpvms/pull/669)
- Load Simbrief and flight data when getting bids \#664 [\#665](https://github.com/nabeelio/phpvms/pull/665)
- Fix pilots page not showing up \#655 [\#660](https://github.com/nabeelio/phpvms/pull/660)
- Fix PirepComment response; 201 to 200 [\#654](https://github.com/nabeelio/phpvms/pull/654)
- Domain detection failing for .co.uk, etc \#647 [\#648](https://github.com/nabeelio/phpvms/pull/648)
- Auth routes not using themes \#638 [\#645](https://github.com/nabeelio/phpvms/pull/645)
- Don't return bids by default, fix user flight column \#639 [\#640](https://github.com/nabeelio/phpvms/pull/640)
- Account for admin role, don't error out on null rows \#632 [\#637](https://github.com/nabeelio/phpvms/pull/637)
- Fix airline mapping for aircraft \#628 [\#633](https://github.com/nabeelio/phpvms/pull/633)
- Increase ID column size; seed ID generator with uniqid\(\) \#630 [\#631](https://github.com/nabeelio/phpvms/pull/631)
- Disable using apc/opcache by default if found \#625 [\#629](https://github.com/nabeelio/phpvms/pull/629)
- Fix saving of fare \#621 [\#624](https://github.com/nabeelio/phpvms/pull/624)
- API: Flight fields are an array when empty \#618 [\#619](https://github.com/nabeelio/phpvms/pull/619)
- Remove the flight fields link from admin \#614 [\#615](https://github.com/nabeelio/phpvms/pull/615)
- HTTP/HTTPS mixed content errors \#612 [\#613](https://github.com/nabeelio/phpvms/pull/613)
- Fare information not included in subfleet response \#608 [\#609](https://github.com/nabeelio/phpvms/pull/609)
- Aircraft status field blank causes error \#603 [\#604](https://github.com/nabeelio/phpvms/pull/604)
- METAR parsing infinite loop bugfix \#599 [\#600](https://github.com/nabeelio/phpvms/pull/600)
- Table prefixes not being added to indexes [\#597](https://github.com/nabeelio/phpvms/pull/597)
- Import expense and ledger entries \#443 [\#588](https://github.com/nabeelio/phpvms/pull/588)
- User country mapping; ignore unused groups \#443 [\#584](https://github.com/nabeelio/phpvms/pull/584)
- Change fuel used to optional \#512 [\#582](https://github.com/nabeelio/phpvms/pull/582)
- Respect home hubs setting for registration \#580 [\#581](https://github.com/nabeelio/phpvms/pull/581)
- Upstream null version; build version tags not being saved properly \#575 [\#578](https://github.com/nabeelio/phpvms/pull/578)
- Fix edit pilot error \(Facade\Utils missing\) \#576 [\#577](https://github.com/nabeelio/phpvms/pull/577)
- Upsert on ACARS positions \#572 [\#573](https://github.com/nabeelio/phpvms/pull/573)
- Fix the namespace path on updater templates \#570 [\#571](https://github.com/nabeelio/phpvms/pull/571)
- Route not found error for Pirep::resource\(\) call \#559 [\#565](https://github.com/nabeelio/phpvms/pull/565)
- Add extra check for $acars being set \#560 [\#563](https://github.com/nabeelio/phpvms/pull/563)
- Missing $subfleet error on bids page \#561 [\#562](https://github.com/nabeelio/phpvms/pull/562)
- Refresh theme cache on settings page load \#554 [\#557](https://github.com/nabeelio/phpvms/pull/557)
- Fix migrations when table prefix is involved \#442 [\#555](https://github.com/nabeelio/phpvms/pull/555)
- Use optional\(\) around the airport fields [\#537](https://github.com/nabeelio/phpvms/pull/537)
- PIREPS resource except for show [\#536](https://github.com/nabeelio/phpvms/pull/536)
- Fix import during flight cron \#532 [\#535](https://github.com/nabeelio/phpvms/pull/535)
- Fix PIREP edit endpoint [\#534](https://github.com/nabeelio/phpvms/pull/534)
- Add a public\_url\(\) helper \#513 [\#519](https://github.com/nabeelio/phpvms/pull/519)
- Correct text for no subfleets \#507 [\#518](https://github.com/nabeelio/phpvms/pull/518)
- Error page not showing when database isn't configured [\#517](https://github.com/nabeelio/phpvms/pull/517)
- Check user permissions on the routes \#508 [\#516](https://github.com/nabeelio/phpvms/pull/516)
- Show admin dropdown for admin-access ability [\#515](https://github.com/nabeelio/phpvms/pull/515)
- New subfleet not being attached to an airline on import \#479 [\#505](https://github.com/nabeelio/phpvms/pull/505)
- Importing not updating existing items \#486 [\#503](https://github.com/nabeelio/phpvms/pull/503)
- Set a default model value for airports on PIREP [\#500](https://github.com/nabeelio/phpvms/pull/500)
- Fix GeoService errors when viewing PIREP \#498 [\#499](https://github.com/nabeelio/phpvms/pull/499)
- Properly set the distance/planned\_distance [\#497](https://github.com/nabeelio/phpvms/pull/497)
- 491 Installation Error [\#495](https://github.com/nabeelio/phpvms/pull/495)
- Return the flight fares if there are no subfleet fares \#488 [\#489](https://github.com/nabeelio/phpvms/pull/489)
- Error if there are no roles when editing a user \#480 [\#483](https://github.com/nabeelio/phpvms/pull/483)
- Allow nullable field and calculate distance if nulled [\#482](https://github.com/nabeelio/phpvms/pull/482)
- Pilots cannot use the dashboard or flights without admin rights [\#481](https://github.com/nabeelio/phpvms/pull/481)
- Fix BindingResolutionError when debug toolbar isn't present [\#465](https://github.com/nabeelio/phpvms/pull/465)
- Fix CSV imports giving Storage class not found \#454 [\#462](https://github.com/nabeelio/phpvms/pull/462)
- Use PhpExecutableFinder\(\) closes \#457 \#458 [\#460](https://github.com/nabeelio/phpvms/pull/460)
- Avoid proc\_open use \#455 [\#456](https://github.com/nabeelio/phpvms/pull/456)
- Stricter checks on ACARS API data [\#451](https://github.com/nabeelio/phpvms/pull/451)
- Remove bootstrap cache [\#448](https://github.com/nabeelio/phpvms/pull/448)
**Closed issues:**
- Dashboard error when METAR visibility in KM [\#680](https://github.com/nabeelio/phpvms/issues/680)
- Error adding multiple airlines without IATA codes [\#679](https://github.com/nabeelio/phpvms/issues/679)
- Pages [\#641](https://github.com/nabeelio/phpvms/issues/641)
- Create a "fare type" for cargo [\#621](https://github.com/nabeelio/phpvms/issues/621)
- Split Sample module out into separate repo [\#593](https://github.com/nabeelio/phpvms/issues/593)
- No way to add files to fleet [\#567](https://github.com/nabeelio/phpvms/issues/567)
- Map Center Coords [\#566](https://github.com/nabeelio/phpvms/issues/566)
- Pilot Profile Page Error [\#560](https://github.com/nabeelio/phpvms/issues/560)
- File New Pirep [\#559](https://github.com/nabeelio/phpvms/issues/559)
- I can't add new flight [\#558](https://github.com/nabeelio/phpvms/issues/558)
- Pilot Pay route modifier [\#487](https://github.com/nabeelio/phpvms/issues/487)
- Auto-update [\#449](https://github.com/nabeelio/phpvms/issues/449)
- Setting to not automatically calculate distances [\#446](https://github.com/nabeelio/phpvms/issues/446)
- Classic importer [\#443](https://github.com/nabeelio/phpvms/issues/443)
- SimBrief integration - pirep prefile [\#405](https://github.com/nabeelio/phpvms/issues/405)
- PIREP rejection doesn't move pilot back to previous airport [\#392](https://github.com/nabeelio/phpvms/issues/392)
- Load Factor for flights [\#352](https://github.com/nabeelio/phpvms/issues/352)
**Merged pull requests:**
- Upgrade packages with security alerts [\#653](https://github.com/nabeelio/phpvms/pull/653)
- Add public/private pages \#641 [\#644](https://github.com/nabeelio/phpvms/pull/644)
- SimBrief integration \#405 [\#635](https://github.com/nabeelio/phpvms/pull/635)
- Add fare type for pax/cargo/mixed flights \#621 [\#623](https://github.com/nabeelio/phpvms/pull/623)
- Add fixed pilot pay for a flight \#487 [\#622](https://github.com/nabeelio/phpvms/pull/622)
- Add load factor and variance to flights \#352 [\#620](https://github.com/nabeelio/phpvms/pull/620)
- Module/plugin installation working \#593 [\#594](https://github.com/nabeelio/phpvms/pull/594)
- Add Google Analytics tracking ID to settings and to main template \#382 [\#551](https://github.com/nabeelio/phpvms/pull/551)
- Set expenses on specific flight types \#348 [\#549](https://github.com/nabeelio/phpvms/pull/549)
- Auto update \#449 [\#545](https://github.com/nabeelio/phpvms/pull/545)
- Auto-update functionality \#449 [\#544](https://github.com/nabeelio/phpvms/pull/544)
- ACARS XML config file download [\#540](https://github.com/nabeelio/phpvms/pull/540)
- Make the fuel used optional [\#512](https://github.com/nabeelio/phpvms/pull/512)
- Add PHP 7.4 support [\#464](https://github.com/nabeelio/phpvms/pull/464)
- Replace importer with AJAX powered; better error handling \#443 [\#447](https://github.com/nabeelio/phpvms/pull/447)
- Fix missing newsRepo variable [\#445](https://github.com/nabeelio/phpvms/pull/445)
- Refactor and add importer to Installer module \#443 [\#444](https://github.com/nabeelio/phpvms/pull/444)
- 391 Notification refactorings [\#441](https://github.com/nabeelio/phpvms/pull/441)
## [7.0.0-beta.3](https://github.com/nabeelio/phpvms/tree/7.0.0-beta.3) (2020-02-08)
[Full Changelog](https://github.com/nabeelio/phpvms/compare/7.0.0-beta.2...7.0.0-beta.3)
**Implemented enhancements:**
- Fix formatting in blade files [\#530](https://github.com/nabeelio/phpvms/issues/530)
- Make PIREP view page public [\#525](https://github.com/nabeelio/phpvms/issues/525)
- Fix map line colors [\#523](https://github.com/nabeelio/phpvms/issues/523)
- Null-able fuel values on PIREP [\#510](https://github.com/nabeelio/phpvms/issues/510)
- include subfleet in search options [\#484](https://github.com/nabeelio/phpvms/issues/484)
- PHP 7.4 in Travis [\#463](https://github.com/nabeelio/phpvms/issues/463)
- Move cron problem report to main page [\#458](https://github.com/nabeelio/phpvms/issues/458)
**Fixed bugs:**
- Method GET for /pireps/\<id\>/edit not supported [\#533](https://github.com/nabeelio/phpvms/issues/533)
- Cron error for removing expired flights [\#532](https://github.com/nabeelio/phpvms/issues/532)
- Live map marker click not working [\#527](https://github.com/nabeelio/phpvms/issues/527)
- Redirect to installer properly [\#513](https://github.com/nabeelio/phpvms/issues/513)
- Admin panel link not shown for users in role group [\#509](https://github.com/nabeelio/phpvms/issues/509)
- Users without "admin" role can modify roles [\#508](https://github.com/nabeelio/phpvms/issues/508)
- Edit flights page - text error [\#507](https://github.com/nabeelio/phpvms/issues/507)
- Installation error with external databases [\#494](https://github.com/nabeelio/phpvms/issues/494)
- Pirep not in KG [\#493](https://github.com/nabeelio/phpvms/issues/493)
- Installation Error step2 [\#491](https://github.com/nabeelio/phpvms/issues/491)
- Fares assigned to flights not working/overwritten by Subfleet [\#488](https://github.com/nabeelio/phpvms/issues/488)
- Status not changing when importing CSV for aircraft [\#486](https://github.com/nabeelio/phpvms/issues/486)
- Default Theme unusable on Mobile [\#485](https://github.com/nabeelio/phpvms/issues/485)
- Fatal Error in subfleet page when importing routes with new aircraft [\#479](https://github.com/nabeelio/phpvms/issues/479)
- Flights CSV import fails if no distance stipulated [\#478](https://github.com/nabeelio/phpvms/issues/478)
- Subfleet CSV import [\#476](https://github.com/nabeelio/phpvms/issues/476)
- Cron - DateTime::construct\(\) expects parameter 2 to be DateTimeZone, int given [\#461](https://github.com/nabeelio/phpvms/issues/461)
- if PHP\_CLI not found in cron maintenance, put generic `php` exec there [\#457](https://github.com/nabeelio/phpvms/issues/457)
- Importing schedule bug [\#454](https://github.com/nabeelio/phpvms/issues/454)
- The updater/installer should clear all caches [\#408](https://github.com/nabeelio/phpvms/issues/408)
**Closed issues:**
- Error 500 when trying to access Dashboard. [\#498](https://github.com/nabeelio/phpvms/issues/498)
- Import multiple aircraft of different subtypes in one sheet [\#477](https://github.com/nabeelio/phpvms/issues/477)
- Split out installer/importer from updater [\#453](https://github.com/nabeelio/phpvms/issues/453)
- ACARS update fields can be nulled [\#450](https://github.com/nabeelio/phpvms/issues/450)
- Retryable HTTP client [\#430](https://github.com/nabeelio/phpvms/issues/430)
- Pireps page: 'Pending' doesn't show pending PIREPs [\#427](https://github.com/nabeelio/phpvms/issues/427)
- Email when news sent out [\#391](https://github.com/nabeelio/phpvms/issues/391)
- Save cron last run time [\#386](https://github.com/nabeelio/phpvms/issues/386)
**Merged pull requests:**
- 7.0.0-beta3 Release [\#541](https://github.com/nabeelio/phpvms/pull/541)
## [7.0.0-beta.2](https://github.com/nabeelio/phpvms/tree/7.0.0-beta.2) (2019-11-19)
[Full Changelog](https://github.com/nabeelio/phpvms/compare/v7.0.0-beta...7.0.0-beta.2)
**Implemented enhancements:**
- CSS Love needed for the Flights Page [\#418](https://github.com/nabeelio/phpvms/issues/418)
- Add Subfleet, Custom Fields and Fares during initial schedule entry [\#410](https://github.com/nabeelio/phpvms/issues/410)
- PIREP from flight/bid; orig: Bid not removed after flight accepted [\#406](https://github.com/nabeelio/phpvms/issues/406)
- Auto airport lookup [\#404](https://github.com/nabeelio/phpvms/issues/404)
- API Changes [\#389](https://github.com/nabeelio/phpvms/issues/389)
- "Maintenance" section in admin [\#376](https://github.com/nabeelio/phpvms/issues/376)
- Auto-calculate Distance on Add Flight page [\#355](https://github.com/nabeelio/phpvms/issues/355)
- Change PIREP fuel field type [\#340](https://github.com/nabeelio/phpvms/issues/340)
- Fuel in pireps [\#295](https://github.com/nabeelio/phpvms/issues/295)
- Add field to set aircraft location [\#277](https://github.com/nabeelio/phpvms/issues/277)
- Suggestion: edit pilot ID [\#265](https://github.com/nabeelio/phpvms/issues/265)
- Combine subfleet and aircraft export [\#233](https://github.com/nabeelio/phpvms/issues/233)
- Allow URL for downloads [\#229](https://github.com/nabeelio/phpvms/issues/229)
- Move settings into database seeder [\#224](https://github.com/nabeelio/phpvms/issues/224)
- Allow specifying transfer hours on registration [\#129](https://github.com/nabeelio/phpvms/issues/129)
- Backend changes separating id from pilot\_id [\#324](https://github.com/nabeelio/phpvms/pull/324)
**Fixed bugs:**
- Flight ID's and Airport ICAO's not clickable on airport page [\#419](https://github.com/nabeelio/phpvms/issues/419)
- Distance lookup needs bcmath extension [\#407](https://github.com/nabeelio/phpvms/issues/407)
- Missing flight level field on frontend [\#401](https://github.com/nabeelio/phpvms/issues/401)
- Set distance to 0 if no value [\#400](https://github.com/nabeelio/phpvms/issues/400)
- Upload livery via admin [\#398](https://github.com/nabeelio/phpvms/issues/398)
- Block deleting airline if there are assets associated with it [\#367](https://github.com/nabeelio/phpvms/issues/367)
- Cron not calculating number of flights [\#357](https://github.com/nabeelio/phpvms/issues/357)
- Error Seeing data of pilot profile [\#351](https://github.com/nabeelio/phpvms/issues/351)
- Fresh install doesn't create rank [\#346](https://github.com/nabeelio/phpvms/issues/346)
- Fuel cost only allows whole numbers for price [\#342](https://github.com/nabeelio/phpvms/issues/342)
- API calls in subfolder going to root domain [\#339](https://github.com/nabeelio/phpvms/issues/339)
- Errors versión 7.0.0 \(compilación 181025-6f7735\) [\#332](https://github.com/nabeelio/phpvms/issues/332)
- Error on Install [\#303](https://github.com/nabeelio/phpvms/issues/303)
- Having a "Error 505" when trying to install PHPVMS [\#302](https://github.com/nabeelio/phpvms/issues/302)
- Error when viewing profile or trying to add flights [\#291](https://github.com/nabeelio/phpvms/issues/291)
- "Hubs as home airport" doesn't work [\#288](https://github.com/nabeelio/phpvms/issues/288)
- Undocumented Extension Required - PHP 7.2 GMP [\#285](https://github.com/nabeelio/phpvms/issues/285)
- ErrorException Trying to get property 'name' of non-object [\#281](https://github.com/nabeelio/phpvms/issues/281)
**Closed issues:**
- Add settings.yaml changes to update available check [\#437](https://github.com/nabeelio/phpvms/issues/437)
- Write current version to DB [\#428](https://github.com/nabeelio/phpvms/issues/428)
- Message for configuring cron [\#424](https://github.com/nabeelio/phpvms/issues/424)
- Opt in for telemetry on install [\#415](https://github.com/nabeelio/phpvms/issues/415)
- Error when saving a PIREP without filling some fields and attempting to edit it [\#414](https://github.com/nabeelio/phpvms/issues/414)
- Update htaccess file [\#412](https://github.com/nabeelio/phpvms/issues/412)
- Allow typing in drop down menus [\#409](https://github.com/nabeelio/phpvms/issues/409)
- Malformed email error on file [\#402](https://github.com/nabeelio/phpvms/issues/402)
- Residual design issues from Bootstrap update [\#397](https://github.com/nabeelio/phpvms/issues/397)
- Don't allow PIREP cancel if not in PENDING phase [\#395](https://github.com/nabeelio/phpvms/issues/395)
- Pageable Criteria [\#390](https://github.com/nabeelio/phpvms/issues/390)
- Update CSS Libraries [\#387](https://github.com/nabeelio/phpvms/issues/387)
- Laravel 6 [\#384](https://github.com/nabeelio/phpvms/issues/384)
- Profile menu dropdown [\#383](https://github.com/nabeelio/phpvms/issues/383)
- Update vaCentral Library [\#380](https://github.com/nabeelio/phpvms/issues/380)
- Implement Laravel 5.7 Notifications [\#378](https://github.com/nabeelio/phpvms/issues/378)
- Generate random cache prefix on install [\#374](https://github.com/nabeelio/phpvms/issues/374)
- Move transaction/journal code out of controller [\#370](https://github.com/nabeelio/phpvms/issues/370)
- Add Contract for Airport information lookup [\#363](https://github.com/nabeelio/phpvms/issues/363)
- RFC7807 - Standardize API error messages [\#361](https://github.com/nabeelio/phpvms/issues/361)
- Imposible delete bid [\#360](https://github.com/nabeelio/phpvms/issues/360)
- Change theme from settings [\#359](https://github.com/nabeelio/phpvms/issues/359)
- Integration with PACX \[Feature\] [\#338](https://github.com/nabeelio/phpvms/issues/338)
- Why don't you create a free ACARS for PHPVMS7 testing? [\#336](https://github.com/nabeelio/phpvms/issues/336)
- Error add Roles [\#334](https://github.com/nabeelio/phpvms/issues/334)
- Error during installation [\#333](https://github.com/nabeelio/phpvms/issues/333)
- spatie - laravel-backup [\#330](https://github.com/nabeelio/phpvms/issues/330)
- Refactor data seeding [\#329](https://github.com/nabeelio/phpvms/issues/329)
- Notify/download latest version file as part of cron [\#327](https://github.com/nabeelio/phpvms/issues/327)
- Notify if migration/updates are pending [\#326](https://github.com/nabeelio/phpvms/issues/326)
- PIREP ID change [\#318](https://github.com/nabeelio/phpvms/issues/318)
- Missing folders on install [\#316](https://github.com/nabeelio/phpvms/issues/316)
- Pull in VMACars plugin [\#315](https://github.com/nabeelio/phpvms/issues/315)
- Account for fuel in the finances [\#313](https://github.com/nabeelio/phpvms/issues/313)
- Show module in the external website [\#310](https://github.com/nabeelio/phpvms/issues/310)
- Profile picture distorted [\#309](https://github.com/nabeelio/phpvms/issues/309)
- Implement cachable in models [\#307](https://github.com/nabeelio/phpvms/issues/307)
- update [\#305](https://github.com/nabeelio/phpvms/issues/305)
- Error with installer - Permission denied [\#298](https://github.com/nabeelio/phpvms/issues/298)
- No Staff Groups/ Authorised Permissions [\#296](https://github.com/nabeelio/phpvms/issues/296)
- .css and .js 404 [\#294](https://github.com/nabeelio/phpvms/issues/294)
- Error on Install [\#292](https://github.com/nabeelio/phpvms/issues/292)
- Ability to change interval of cron jobs [\#289](https://github.com/nabeelio/phpvms/issues/289)
- ACARS api add response [\#287](https://github.com/nabeelio/phpvms/issues/287)
- No bids returned in json [\#286](https://github.com/nabeelio/phpvms/issues/286)
- Importing \*.csv with special characters [\#282](https://github.com/nabeelio/phpvms/issues/282)
- laravel-theme doesn't seem to be respecting the theme.json extends [\#279](https://github.com/nabeelio/phpvms/issues/279)
- Flight for current location not being restricted [\#263](https://github.com/nabeelio/phpvms/issues/263)
- Self diagnosis [\#253](https://github.com/nabeelio/phpvms/issues/253)
- Add /api/pireps/validate endpoint [\#247](https://github.com/nabeelio/phpvms/issues/247)
- Cosmetic issues [\#245](https://github.com/nabeelio/phpvms/issues/245)
- GDPR Compliance [\#244](https://github.com/nabeelio/phpvms/issues/244)
- Read all settings into the page session [\#243](https://github.com/nabeelio/phpvms/issues/243)
- Open Airspace [\#241](https://github.com/nabeelio/phpvms/issues/241)
- Option to cancel PIREP [\#238](https://github.com/nabeelio/phpvms/issues/238)
- Navdata sources [\#231](https://github.com/nabeelio/phpvms/issues/231)
- Refactor export, use streamed response [\#227](https://github.com/nabeelio/phpvms/issues/227)
- Add expense multiplier to subfleet [\#206](https://github.com/nabeelio/phpvms/issues/206)
- Expenses [\#136](https://github.com/nabeelio/phpvms/issues/136)
- Finances [\#130](https://github.com/nabeelio/phpvms/issues/130)
- phpVMS Classic Importer [\#114](https://github.com/nabeelio/phpvms/issues/114)
- Setup cron tasks [\#95](https://github.com/nabeelio/phpvms/issues/95)
- Warning in admin if Installer module is still present [\#77](https://github.com/nabeelio/phpvms/issues/77)
- flight planning [\#60](https://github.com/nabeelio/phpvms/issues/60)
**Merged pull requests:**
- Merge 7.0.0-beta.2 to master [\#440](https://github.com/nabeelio/phpvms/pull/440)
- Refactor the upgrade pending check to see if there are settings/permi… [\#438](https://github.com/nabeelio/phpvms/pull/438)
- Fixes [\#435](https://github.com/nabeelio/phpvms/pull/435)
- \#406 Refactor bids [\#432](https://github.com/nabeelio/phpvms/pull/432)
- fixes for issue \#419 [\#429](https://github.com/nabeelio/phpvms/pull/429)
- Wrap values in travis env [\#426](https://github.com/nabeelio/phpvms/pull/426)
- Show a message about setting up the cron and if there was an error ru… [\#425](https://github.com/nabeelio/phpvms/pull/425)
- 359 Select theme in settings [\#423](https://github.com/nabeelio/phpvms/pull/423)
- Fix blank aircraft field causing error closes \#414 [\#422](https://github.com/nabeelio/phpvms/pull/422)
- Bundle CSS changes [\#421](https://github.com/nabeelio/phpvms/pull/421)
- Some minor CSS fixes as discussed on Discord [\#420](https://github.com/nabeelio/phpvms/pull/420)
- Move telemetry option into settings; checkbox in install refs \#415 [\#416](https://github.com/nabeelio/phpvms/pull/416)
- Issue fixes [\#413](https://github.com/nabeelio/phpvms/pull/413)
- Catch error messages in notifying [\#403](https://github.com/nabeelio/phpvms/pull/403)
- Design and file upload issues [\#399](https://github.com/nabeelio/phpvms/pull/399)
- Don't allow cancels from certain states [\#396](https://github.com/nabeelio/phpvms/pull/396)
- Fix map checkout call [\#394](https://github.com/nabeelio/phpvms/pull/394)
- 389 API Changes [\#393](https://github.com/nabeelio/phpvms/pull/393)
- CSS Libraries and style updates [\#388](https://github.com/nabeelio/phpvms/pull/388)
- 384 Laravel 6 changes [\#385](https://github.com/nabeelio/phpvms/pull/385)
- 380 vacentral library [\#381](https://github.com/nabeelio/phpvms/pull/381)
- Use Notification/Notifiable [\#379](https://github.com/nabeelio/phpvms/pull/379)
- Add maintenance section to admin, clear caches \#376 [\#377](https://github.com/nabeelio/phpvms/pull/377)
- Refactor all JS API calls \#360 [\#375](https://github.com/nabeelio/phpvms/pull/375)
- Set the baseURL for ajax requests [\#373](https://github.com/nabeelio/phpvms/pull/373)
- Move airline transaction code into service layer [\#371](https://github.com/nabeelio/phpvms/pull/371)
- 229 url for downloads [\#369](https://github.com/nabeelio/phpvms/pull/369)
- \#355 Calculate distance button [\#366](https://github.com/nabeelio/phpvms/pull/366)
- Add Contract interface for airport lookup functionality [\#365](https://github.com/nabeelio/phpvms/pull/365)
- Refactor error handling internally to follow RFC7807 [\#362](https://github.com/nabeelio/phpvms/pull/362)
- Additional logging for the stats recalculation [\#358](https://github.com/nabeelio/phpvms/pull/358)
- Add missing expiry time for PIREP API [\#356](https://github.com/nabeelio/phpvms/pull/356)
- Fix/metar reading [\#354](https://github.com/nabeelio/phpvms/pull/354)
- Fix/metar reading [\#353](https://github.com/nabeelio/phpvms/pull/353)
- Add setting to include transfer hours in calculations [\#350](https://github.com/nabeelio/phpvms/pull/350)
- Remove ext-cal from requirements list [\#349](https://github.com/nabeelio/phpvms/pull/349)
- Multiple ticket crash fixes [\#347](https://github.com/nabeelio/phpvms/pull/347)
- Issue/327 versioning [\#345](https://github.com/nabeelio/phpvms/pull/345)
- Update issue templates [\#344](https://github.com/nabeelio/phpvms/pull/344)
- Add step fields to enable decimal points on fields \#342 [\#343](https://github.com/nabeelio/phpvms/pull/343)
- Issue fixes [\#341](https://github.com/nabeelio/phpvms/pull/341)
- Issue/329 refactor seeding [\#337](https://github.com/nabeelio/phpvms/pull/337)
- Fix issue where user stats aren't incremented on PIREP auto accept [\#335](https://github.com/nabeelio/phpvms/pull/335)
- Account for fuel in the finance calculations \#313 [\#331](https://github.com/nabeelio/phpvms/pull/331)
- Middleware to detect is update is pending; move Routes into HTTP [\#328](https://github.com/nabeelio/phpvms/pull/328)
- Change exporter to use utf-8 close \#282 [\#325](https://github.com/nabeelio/phpvms/pull/325)
- Rename Interfaces to Contracts to better match Laravel conventions [\#323](https://github.com/nabeelio/phpvms/pull/323)
- Cleanup SI Unit classes; METAR fixes [\#322](https://github.com/nabeelio/phpvms/pull/322)
- Bump lodash from 4.17.11 to 4.17.13 [\#321](https://github.com/nabeelio/phpvms/pull/321)
- Update composer library versions [\#320](https://github.com/nabeelio/phpvms/pull/320)
- Add missing folders under storage/public \#316 [\#319](https://github.com/nabeelio/phpvms/pull/319)
- Add interface to additional roles/permissions \#296 [\#314](https://github.com/nabeelio/phpvms/pull/314)
- Fix pax count fields; add fuel used field \#295 [\#312](https://github.com/nabeelio/phpvms/pull/312)
- Apply fixes from StyleCI [\#311](https://github.com/nabeelio/phpvms/pull/311)
- Laravel 5.8 Update [\#308](https://github.com/nabeelio/phpvms/pull/308)
- Add more search criteria/dev environment via docker-compose \#297 [\#306](https://github.com/nabeelio/phpvms/pull/306)
- Add gmp to requirements in install \#285 [\#301](https://github.com/nabeelio/phpvms/pull/301)
- Revert "Update issue templates" [\#300](https://github.com/nabeelio/phpvms/pull/300)
- Update issue templates [\#299](https://github.com/nabeelio/phpvms/pull/299)
## [v7.0.0-beta](https://github.com/nabeelio/phpvms/tree/v7.0.0-beta) (2018-10-25)
[Full Changelog](https://github.com/nabeelio/phpvms/compare/v7.0.0-alpha2...v7.0.0-beta)
**Implemented enhancements:**
- Follow flight checkbox on live map [\#246](https://github.com/nabeelio/phpvms/issues/246)
- PIREP restrictions based on settings [\#221](https://github.com/nabeelio/phpvms/issues/221)
- Save PIREP as draft [\#220](https://github.com/nabeelio/phpvms/issues/220)
- Shorten fields on flights table [\#205](https://github.com/nabeelio/phpvms/issues/205)
- Show bids in profile [\#203](https://github.com/nabeelio/phpvms/issues/203)
- Don't change rank if current rank is higher than the one found [\#196](https://github.com/nabeelio/phpvms/issues/196)
- pagination sizes [\#162](https://github.com/nabeelio/phpvms/issues/162)
- Allow overriding templates [\#161](https://github.com/nabeelio/phpvms/issues/161)
- Replace old pjax library with newer one [\#133](https://github.com/nabeelio/phpvms/issues/133)
- Awards [\#113](https://github.com/nabeelio/phpvms/issues/113)
- Setting to restrict airport selection to hubs [\#104](https://github.com/nabeelio/phpvms/issues/104)
- Pilot leave status [\#96](https://github.com/nabeelio/phpvms/issues/96)
- schedule import [\#15](https://github.com/nabeelio/phpvms/issues/15)
**Fixed bugs:**
- Error saving PIREP [\#252](https://github.com/nabeelio/phpvms/issues/252)
- Updater with modules not working [\#249](https://github.com/nabeelio/phpvms/issues/249)
- User registration country and timezone not saving [\#223](https://github.com/nabeelio/phpvms/issues/223)
- Importer inserts invalid data on empty columns/rows [\#222](https://github.com/nabeelio/phpvms/issues/222)
- Import/export - missing fields [\#219](https://github.com/nabeelio/phpvms/issues/219)
- Country flag not showing on user list [\#218](https://github.com/nabeelio/phpvms/issues/218)
- fares/subfleet unique field blocks saving [\#214](https://github.com/nabeelio/phpvms/issues/214)
- module navigation not working \(admin\) [\#201](https://github.com/nabeelio/phpvms/issues/201)
- Bid not removed when pirep if filled [\#200](https://github.com/nabeelio/phpvms/issues/200)
- Not saving Flight Time [\#199](https://github.com/nabeelio/phpvms/issues/199)
**Closed issues:**
- SettingsController/Repo are saving as "on" instead of 1/true [\#272](https://github.com/nabeelio/phpvms/issues/272)
- Auto Accept New Pilot isn't working [\#269](https://github.com/nabeelio/phpvms/issues/269)
- Suggestion: button to copy aircraft [\#267](https://github.com/nabeelio/phpvms/issues/267)
- Combine aircraft and subfleet import/export into one [\#256](https://github.com/nabeelio/phpvms/issues/256)
- cron - recalculate hours [\#254](https://github.com/nabeelio/phpvms/issues/254)
- Install Directory is missing from git repo [\#251](https://github.com/nabeelio/phpvms/issues/251)
- Warning: require\(C:\xampp\Virtual Airline Website\bootstrap/../vendor/autoload.php\): failed to open stream: No such file or directory in C:\xampp\Virtual Airline Website\bootstrap\autoload.php on line 17 [\#248](https://github.com/nabeelio/phpvms/issues/248)
- Settings [\#239](https://github.com/nabeelio/phpvms/issues/239)
- HTTP caching [\#237](https://github.com/nabeelio/phpvms/issues/237)
- Module artisan command bug [\#234](https://github.com/nabeelio/phpvms/issues/234)
- Add /api/news [\#232](https://github.com/nabeelio/phpvms/issues/232)
- Start date/end date, along with day of week options [\#230](https://github.com/nabeelio/phpvms/issues/230)
- Replace weather lookup [\#228](https://github.com/nabeelio/phpvms/issues/228)
- File/avatar uploads [\#226](https://github.com/nabeelio/phpvms/issues/226)
- Change fleet page to load subfleets first [\#217](https://github.com/nabeelio/phpvms/issues/217)
- Add sort options [\#216](https://github.com/nabeelio/phpvms/issues/216)
- Auto loader on Line 17 [\#215](https://github.com/nabeelio/phpvms/issues/215)
- Add flight fields [\#213](https://github.com/nabeelio/phpvms/issues/213)
- Recaptcha in registration [\#212](https://github.com/nabeelio/phpvms/issues/212)
- Browser tests [\#211](https://github.com/nabeelio/phpvms/issues/211)
- Axios HTTP library [\#210](https://github.com/nabeelio/phpvms/issues/210)
- Replace skinning with laravel-theme [\#209](https://github.com/nabeelio/phpvms/issues/209)
- Refactor getting expenses in FinanceData [\#208](https://github.com/nabeelio/phpvms/issues/208)
- Change all money to hold in cents, not dollars [\#204](https://github.com/nabeelio/phpvms/issues/204)
- Pilot pay - rank base and subfleet multiplier [\#197](https://github.com/nabeelio/phpvms/issues/197)
- Flight schedule importer/exporter [\#194](https://github.com/nabeelio/phpvms/issues/194)
- use find/replace in bootstrapWith\(\) call [\#163](https://github.com/nabeelio/phpvms/issues/163)
- Awards [\#155](https://github.com/nabeelio/phpvms/issues/155)
- System Changes/Additions [\#135](https://github.com/nabeelio/phpvms/issues/135)
- Airport & Aircraft Changes [\#134](https://github.com/nabeelio/phpvms/issues/134)
- Handle flight specific fares & multipliers [\#125](https://github.com/nabeelio/phpvms/issues/125)
- Flight set day of week [\#122](https://github.com/nabeelio/phpvms/issues/122)
- Airport page [\#85](https://github.com/nabeelio/phpvms/issues/85)
- Bulk upload charts to airport [\#84](https://github.com/nabeelio/phpvms/issues/84)
- Pull some values from existing .env file [\#79](https://github.com/nabeelio/phpvms/issues/79)
- METAR Information [\#61](https://github.com/nabeelio/phpvms/issues/61)
- flights page [\#57](https://github.com/nabeelio/phpvms/issues/57)
- fuel costs to airports and fuel type on subfleet [\#41](https://github.com/nabeelio/phpvms/issues/41)
- generate aircraft hex code on create [\#33](https://github.com/nabeelio/phpvms/issues/33)
**Merged pull requests:**
- More acceptable translation to opt-in \(es\) [\#284](https://github.com/nabeelio/phpvms/pull/284)
- Fix 404s to requirements/setup in README.md [\#283](https://github.com/nabeelio/phpvms/pull/283)
- Hide expired live flight from live map and remove from DB [\#280](https://github.com/nabeelio/phpvms/pull/280)
- \[WIP\] Laravel 5.7 Update [\#278](https://github.com/nabeelio/phpvms/pull/278)
- Make admin input outline darker [\#276](https://github.com/nabeelio/phpvms/pull/276)
- capture & display pilot transfer hours [\#275](https://github.com/nabeelio/phpvms/pull/275)
- Optimize query with eager loading [\#274](https://github.com/nabeelio/phpvms/pull/274)
- Fix SettingsController saving boolean value as 'on' [\#273](https://github.com/nabeelio/phpvms/pull/273)
- Hide inactive pilot from pilot list page [\#271](https://github.com/nabeelio/phpvms/pull/271)
- Fix flight search restriction [\#270](https://github.com/nabeelio/phpvms/pull/270)
- Apply fixes from StyleCI [\#268](https://github.com/nabeelio/phpvms/pull/268)
- Fix METAR issue [\#264](https://github.com/nabeelio/phpvms/pull/264)
- Apply fixes from StyleCI [\#262](https://github.com/nabeelio/phpvms/pull/262)
- Apply fixes from StyleCI [\#261](https://github.com/nabeelio/phpvms/pull/261)
- Enable eager loading [\#259](https://github.com/nabeelio/phpvms/pull/259)
- Implement cron to remove expired bids [\#258](https://github.com/nabeelio/phpvms/pull/258)
- Fix timezone list HTML Escaped [\#257](https://github.com/nabeelio/phpvms/pull/257)
- Update 07/13/2018 es-translations [\#255](https://github.com/nabeelio/phpvms/pull/255)
- ES translation [\#250](https://github.com/nabeelio/phpvms/pull/250)
- flights filtered per va [\#242](https://github.com/nabeelio/phpvms/pull/242)
- Avatar Issue [\#236](https://github.com/nabeelio/phpvms/pull/236)
- Install bug [\#235](https://github.com/nabeelio/phpvms/pull/235)
## [v7.0.0-alpha2](https://github.com/nabeelio/phpvms/tree/v7.0.0-alpha2) (2018-02-23)
[Full Changelog](https://github.com/nabeelio/phpvms/compare/v7.0.0-alpha1...v7.0.0-alpha2)
**Implemented enhancements:**
- Get user PIREPs [\#192](https://github.com/nabeelio/phpvms/issues/192)
- Use time conversion class [\#190](https://github.com/nabeelio/phpvms/issues/190)
- Require inputs in Imperial units [\#189](https://github.com/nabeelio/phpvms/issues/189)
- Make planned\_distance in prefile optional [\#185](https://github.com/nabeelio/phpvms/issues/185)
- If there's no /pirep/route calls, when it's filed, write the route [\#184](https://github.com/nabeelio/phpvms/issues/184)
- Create a /api/flight/{id}/route call [\#183](https://github.com/nabeelio/phpvms/issues/183)
- Make all APIs behind auth [\#173](https://github.com/nabeelio/phpvms/issues/173)
- Add bid [\#172](https://github.com/nabeelio/phpvms/issues/172)
- Setting for only showing aircraft that are at the departure airport [\#171](https://github.com/nabeelio/phpvms/issues/171)
- Font for input [\#169](https://github.com/nabeelio/phpvms/issues/169)
- Read default value from settings table [\#106](https://github.com/nabeelio/phpvms/issues/106)
**Fixed bugs:**
- Volume units to lbs/kg, not gal/liter [\#193](https://github.com/nabeelio/phpvms/issues/193)
- Add country to airline missing [\#191](https://github.com/nabeelio/phpvms/issues/191)
- SKIN\_NAME missing on error pages [\#187](https://github.com/nabeelio/phpvms/issues/187)
- Airport timezone not being saved [\#182](https://github.com/nabeelio/phpvms/issues/182)
- Rank checkboxes not being saved [\#181](https://github.com/nabeelio/phpvms/issues/181)
- Make sure cancelled PIREPs don't show [\#180](https://github.com/nabeelio/phpvms/issues/180)
- Ignore cancelled PIREPs in duplicate check [\#179](https://github.com/nabeelio/phpvms/issues/179)
- Make sure all fields are returned in PIREP object [\#178](https://github.com/nabeelio/phpvms/issues/178)
- autopopulate SOURCE field in ACARS [\#177](https://github.com/nabeelio/phpvms/issues/177)
- Make sure pireps.restrict\_aircraft\_to\_rank is respected [\#170](https://github.com/nabeelio/phpvms/issues/170)
- Don't change rank if current rank is non-auto promoting [\#168](https://github.com/nabeelio/phpvms/issues/168)
- PIREP hours can't be changed [\#167](https://github.com/nabeelio/phpvms/issues/167)
- Changing a flight status does not save [\#150](https://github.com/nabeelio/phpvms/issues/150)
- Additional PIREP fields don't save correctly [\#146](https://github.com/nabeelio/phpvms/issues/146)
**Closed issues:**
- Cleanup icons [\#195](https://github.com/nabeelio/phpvms/issues/195)
- remove raw\_data field from pirep table [\#188](https://github.com/nabeelio/phpvms/issues/188)
- Remove Resource::withoutWrapping\(\) to follow jsonapi spec [\#186](https://github.com/nabeelio/phpvms/issues/186)
- Add an `artisan phpvms:dev-install` command [\#176](https://github.com/nabeelio/phpvms/issues/176)
- Pagination settings [\#175](https://github.com/nabeelio/phpvms/issues/175)
- Implement setting for flights at pilot's current airport [\#174](https://github.com/nabeelio/phpvms/issues/174)
- Minimum PHP supported version to 7.1 [\#166](https://github.com/nabeelio/phpvms/issues/166)
- Update to Laravel 5.6 [\#165](https://github.com/nabeelio/phpvms/issues/165)
- Updater [\#164](https://github.com/nabeelio/phpvms/issues/164)
- Allow adding rank in subfleet page [\#160](https://github.com/nabeelio/phpvms/issues/160)
- Docs [\#153](https://github.com/nabeelio/phpvms/issues/153)
## [v7.0.0-alpha1](https://github.com/nabeelio/phpvms/tree/v7.0.0-alpha1) (2018-02-04)
[Full Changelog](https://github.com/nabeelio/phpvms/compare/f158c11dea7c0a4af27c93382333b67fdc531e3a...v7.0.0-alpha1)
**Implemented enhancements:**
- Widgetized components [\#127](https://github.com/nabeelio/phpvms/issues/127)
- Set aircraft location on landing [\#112](https://github.com/nabeelio/phpvms/issues/112)
- save user IP on login [\#110](https://github.com/nabeelio/phpvms/issues/110)
- When rejecting PIREP, add a comment/reason [\#107](https://github.com/nabeelio/phpvms/issues/107)
- Check for duplicate PIREPs and add setting [\#105](https://github.com/nabeelio/phpvms/issues/105)
- create vendor.js with webpack [\#91](https://github.com/nabeelio/phpvms/issues/91)
- move from bower to webpack [\#90](https://github.com/nabeelio/phpvms/issues/90)
- Pilots list and profile [\#82](https://github.com/nabeelio/phpvms/issues/82)
- pirep auto-accept for certain rankings [\#24](https://github.com/nabeelio/phpvms/issues/24)
- Investigate removing the Repository pattern to simplify [\#6](https://github.com/nabeelio/phpvms/issues/6)
**Fixed bugs:**
- Error when sending /api/pireps/prefile [\#149](https://github.com/nabeelio/phpvms/issues/149)
- Extra numbers on flights page [\#148](https://github.com/nabeelio/phpvms/issues/148)
- Unable to select any aircraft from fleet on file PIREP page [\#147](https://github.com/nabeelio/phpvms/issues/147)
- Error thrown when editing a saved flight [\#145](https://github.com/nabeelio/phpvms/issues/145)
- When you delete flight from admin, filed pirep will throw error [\#144](https://github.com/nabeelio/phpvms/issues/144)
- Avoid calling MySQL executable for creating database [\#132](https://github.com/nabeelio/phpvms/issues/132)
- Aircraft can be added without specifying a subfleet [\#128](https://github.com/nabeelio/phpvms/issues/128)
- Non error flash messages not showing [\#126](https://github.com/nabeelio/phpvms/issues/126)
- Removing subfleet from flight [\#124](https://github.com/nabeelio/phpvms/issues/124)
- User still has API access if they're not ACTIVE [\#119](https://github.com/nabeelio/phpvms/issues/119)
- Delete bids when flight is deleted [\#103](https://github.com/nabeelio/phpvms/issues/103)
- JSON error messages [\#92](https://github.com/nabeelio/phpvms/issues/92)
- add subfleet to flight broken [\#88](https://github.com/nabeelio/phpvms/issues/88)
- logout functionality not working from frontpage [\#26](https://github.com/nabeelio/phpvms/issues/26)
**Closed issues:**
- `fuel\_used` in pirep/file [\#159](https://github.com/nabeelio/phpvms/issues/159)
- Add additional fields for PIREP and flights [\#158](https://github.com/nabeelio/phpvms/issues/158)
- Stub file [\#157](https://github.com/nabeelio/phpvms/issues/157)
- Add config.php in root on install [\#156](https://github.com/nabeelio/phpvms/issues/156)
- New registrations are auto-accepted and put as active [\#151](https://github.com/nabeelio/phpvms/issues/151)
- new version alert [\#143](https://github.com/nabeelio/phpvms/issues/143)
- Footer copyright text [\#142](https://github.com/nabeelio/phpvms/issues/142)
- Version build number to use string/assigned date [\#141](https://github.com/nabeelio/phpvms/issues/141)
- Handle duplicate flight number [\#139](https://github.com/nabeelio/phpvms/issues/139)
- Restrict shown aircraft to user's rank [\#138](https://github.com/nabeelio/phpvms/issues/138)
- Docs [\#137](https://github.com/nabeelio/phpvms/issues/137)
- Checksum for tarball [\#123](https://github.com/nabeelio/phpvms/issues/123)
- API Items need [\#120](https://github.com/nabeelio/phpvms/issues/120)
- ACARS API [\#118](https://github.com/nabeelio/phpvms/issues/118)
- List of cron jobs required [\#117](https://github.com/nabeelio/phpvms/issues/117)
- Add create/edit fields for columns [\#111](https://github.com/nabeelio/phpvms/issues/111)
- Add PIREP cancel endpoint and cleanup job [\#109](https://github.com/nabeelio/phpvms/issues/109)
- ACARS table should save the route [\#102](https://github.com/nabeelio/phpvms/issues/102)
- /api/fleet and /api/user/fleet [\#101](https://github.com/nabeelio/phpvms/issues/101)
- Assign subfleets to ranks [\#100](https://github.com/nabeelio/phpvms/issues/100)
- show dates/times in proper timezone [\#97](https://github.com/nabeelio/phpvms/issues/97)
- editable fields not working [\#94](https://github.com/nabeelio/phpvms/issues/94)
- Settings page needs to be completed [\#93](https://github.com/nabeelio/phpvms/issues/93)
- Airport page pagination & search [\#87](https://github.com/nabeelio/phpvms/issues/87)
- Mark airport as hub [\#86](https://github.com/nabeelio/phpvms/issues/86)
- Terms and Conditions & COPPA during registration [\#81](https://github.com/nabeelio/phpvms/issues/81)
- Look at alternative to Entrust [\#78](https://github.com/nabeelio/phpvms/issues/78)
- Check if .env file exists in installer [\#76](https://github.com/nabeelio/phpvms/issues/76)
- upload travis artifact to phpvms ftp as "latest.zip" [\#75](https://github.com/nabeelio/phpvms/issues/75)
- Track hours on airframes [\#73](https://github.com/nabeelio/phpvms/issues/73)
- PIREP accept/reject in admin should call PIREP service [\#72](https://github.com/nabeelio/phpvms/issues/72)
- Error with MySQL syntax when creating database. [\#71](https://github.com/nabeelio/phpvms/issues/71)
- pirep comments [\#70](https://github.com/nabeelio/phpvms/issues/70)
- findWithoutFail Method does not exist [\#69](https://github.com/nabeelio/phpvms/issues/69)
- Commit error 403 [\#67](https://github.com/nabeelio/phpvms/issues/67)
- Keep Showing 404.... [\#66](https://github.com/nabeelio/phpvms/issues/66)
- wrap migrate command [\#65](https://github.com/nabeelio/phpvms/issues/65)
- Create 404 page [\#63](https://github.com/nabeelio/phpvms/issues/63)
- link to admin in nav if you have permissions [\#62](https://github.com/nabeelio/phpvms/issues/62)
- Error while creating database [\#56](https://github.com/nabeelio/phpvms/issues/56)
- shared hosting stuff [\#55](https://github.com/nabeelio/phpvms/issues/55)
- gravatar url for profile [\#54](https://github.com/nabeelio/phpvms/issues/54)
- news and notams module [\#52](https://github.com/nabeelio/phpvms/issues/52)
- try atoum vs phpunit [\#51](https://github.com/nabeelio/phpvms/issues/51)
- Cache Airports calls [\#49](https://github.com/nabeelio/phpvms/issues/49)
- add custom fields table for flights [\#48](https://github.com/nabeelio/phpvms/issues/48)
- Events system [\#43](https://github.com/nabeelio/phpvms/issues/43)
- add fuel costs types to the airports table [\#40](https://github.com/nabeelio/phpvms/issues/40)
- adjust "created" date for airline [\#39](https://github.com/nabeelio/phpvms/issues/39)
- add gross\_weight to PIREPs [\#38](https://github.com/nabeelio/phpvms/issues/38)
- subfleet to flight pivot values [\#37](https://github.com/nabeelio/phpvms/issues/37)
- API authentication/middleware [\#36](https://github.com/nabeelio/phpvms/issues/36)
- REST API [\#35](https://github.com/nabeelio/phpvms/issues/35)
- use uuids on a few tables [\#34](https://github.com/nabeelio/phpvms/issues/34)
- subfleet \(ranks, expenses\) [\#32](https://github.com/nabeelio/phpvms/issues/32)
- How to install this? [\#31](https://github.com/nabeelio/phpvms/issues/31)
- experiment with changing PDO mode [\#30](https://github.com/nabeelio/phpvms/issues/30)
- forgot password [\#27](https://github.com/nabeelio/phpvms/issues/27)
- rankings [\#23](https://github.com/nabeelio/phpvms/issues/23)
- module system [\#22](https://github.com/nabeelio/phpvms/issues/22)
- pireps [\#21](https://github.com/nabeelio/phpvms/issues/21)
- admin user management [\#20](https://github.com/nabeelio/phpvms/issues/20)
- modify DatabaseSeeder to look at env [\#19](https://github.com/nabeelio/phpvms/issues/19)
- look at flarum method of install [\#18](https://github.com/nabeelio/phpvms/issues/18)
- navdata ingestion [\#17](https://github.com/nabeelio/phpvms/issues/17)
- settings panel [\#16](https://github.com/nabeelio/phpvms/issues/16)
- routing and scheduling [\#14](https://github.com/nabeelio/phpvms/issues/14)
- airport details page [\#13](https://github.com/nabeelio/phpvms/issues/13)
- currency format config [\#12](https://github.com/nabeelio/phpvms/issues/12)
- aircraft details page [\#11](https://github.com/nabeelio/phpvms/issues/11)
- user dashboard and profile pages [\#10](https://github.com/nabeelio/phpvms/issues/10)
- admin panel work [\#9](https://github.com/nabeelio/phpvms/issues/9)
- theme/skins engine [\#8](https://github.com/nabeelio/phpvms/issues/8)
- Integrate roles and permissions [\#7](https://github.com/nabeelio/phpvms/issues/7)
- rebuild tables [\#5](https://github.com/nabeelio/phpvms/issues/5)
- front-end template [\#4](https://github.com/nabeelio/phpvms/issues/4)
- Laravel 5.4 [\#3](https://github.com/nabeelio/phpvms/issues/3)
- look up role-based permissions [\#2](https://github.com/nabeelio/phpvms/issues/2)
- installer [\#1](https://github.com/nabeelio/phpvms/issues/1)
**Merged pull requests:**
- Fixed a few field entries [\#116](https://github.com/nabeelio/phpvms/pull/116)
- Remove unique email entry [\#115](https://github.com/nabeelio/phpvms/pull/115)
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*

View File

@ -74,13 +74,13 @@ reload-db:
tests: test
.PHONY: test
test:
test: phpcs
#php artisan database:create --reset
vendor/bin/phpunit --debug --verbose
.PHONY: phpcs
phpcs:
@vendor/bin/php-cs-fixer fix --config=.php_cs -v --diff --dry-run
@vendor/bin/php-cs-fixer fix --config=.php_cs -v --diff --diff-format=udiff --dry-run
#.PHONY: phpstan
#phpstan:

View File

@ -3,7 +3,7 @@
namespace App\Console\Commands;
use App\Contracts\Command;
use App\Facades\Utils;
use App\Support\Units\Time;
use GuzzleHttp\Client;
use Illuminate\Database\Eloquent\Collection;
@ -64,7 +64,7 @@ class AcarsReplay extends Command
protected function startPirep($flight): string
{
// convert the planned flight time to be completely in minutes
$pft = Utils::hoursToMinutes(
$pft = Time::hoursToMinutes(
$flight->planned_hrsenroute,
$flight->planned_minenroute
);

View File

@ -0,0 +1,41 @@
<?php
namespace App\Console\Commands;
use App\Contracts\Command;
use Nwidart\Modules\Facades\Module;
class ClearCaches extends Command
{
protected $signature = 'phpvms:caches';
protected $description = 'Clear all caches';
/**
* {@inheritdoc}
*/
public function handle()
{
self::clearCaches();
}
public static function clearCaches()
{
self::clearBootstrapCache();
self::clearModuleCache();
}
/**
* Clear the bootstrap/cache dir
*/
private static function clearBootstrapCache()
{
}
/**
* Rescan for new modules
*/
private static function clearModuleCache()
{
Module::scan();
}
}

View File

@ -7,6 +7,7 @@ use App\Models\Acars;
use App\Models\Airline;
use App\Models\Pirep;
use App\Models\User;
use App\Notifications\Messages\UserRegistered;
use App\Repositories\AcarsRepository;
use App\Services\AirportService;
use App\Services\AwardService;
@ -60,6 +61,7 @@ class DevCommands extends Command
'metar' => 'getMetar',
'recalculate-stats' => 'recalculateStats',
'reset-install' => 'resetInstall',
'new-user-email' => 'newUserEmail',
'xml-to-yaml' => 'xmlToYaml',
];
@ -290,6 +292,16 @@ class DevCommands extends Command
$this->info('Done!');
}
/**
* Test sending a user a registered email
*/
protected function newUserEmail()
{
$user_id = $this->argument('param');
$user = User::find($user_id);
$user->notify(new UserRegistered($user));
}
public function liveFlights(): void
{
$acarsRepo = app(AcarsRepository::class);

View File

@ -34,7 +34,7 @@ class Version extends Command
// If a version is being passed in, the update the build, etc data against this
if ($this->argument('version')) {
$version = \SemVer\SemVer\Version::fromString($this->argument('version'));
if ($this->option('write_full_version')) {
if ($this->option('write-full-version')) {
$cfg['current']['major'] = $version->getMajor();
$cfg['current']['minor'] = $version->getMinor();
$cfg['current']['patch'] = $version->getPatch();
@ -51,14 +51,15 @@ class Version extends Command
}
// Always write out the build ID/build number which is the commit hash
$build_number = $this->versionSvc->getBuildId($cfg);
$build_number = $this->versionSvc->generateBuildId($cfg);
$cfg['current']['commit'] = $build_number;
$cfg['build']['number'] = $build_number;
file_put_contents($version_file, Yaml::dump($cfg, 4, 2));
}
$version = $this->versionSvc->getCurrentVersion(!$this->option('base-only'));
$incl_build = empty($this->option('base-only')) ? true : false;
$version = $this->versionSvc->getCurrentVersion($incl_build);
echo $version."\n";
}
}

View File

@ -2,10 +2,10 @@
namespace App\Contracts;
use App\Facades\Utils;
use App\Models\Award as AwardModel;
use App\Models\User;
use App\Models\UserAward;
use App\Support\Utils;
use Exception;
use Illuminate\Support\Facades\Log;

View File

@ -0,0 +1,10 @@
<?php
namespace App\Contracts;
use Illuminate\View\View;
abstract class Composer
{
abstract public function compose(View $view);
}

View File

@ -6,6 +6,7 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Http\Request;
use Laracasts\Flash\Flash;
/**
* Class Controller
@ -26,7 +27,7 @@ abstract class Controller extends \Illuminate\Routing\Controller
*/
public function flashError($message, $route)
{
flash()->error($message);
Flash::error($message);
return redirect(route($route))->withInput();
}

View File

@ -46,7 +46,12 @@ abstract class Enum
final public static function label($value)
{
if (isset(static::$labels[$value])) {
return trans(static::$labels[$value]);
$val = static::$labels[$value];
if (strpos($val, '.') !== false) {
return trans($val);
}
return $val;
}
}

View File

@ -2,15 +2,16 @@
namespace App\Contracts;
/**
* Class FormRequest
*/
use Illuminate\Validation\Rule;
class FormRequest extends \Illuminate\Foundation\Http\FormRequest
{
/**
* Authorized by default
*
* @return bool
*/
public function authorize()
public function authorize(): bool
{
return true;
}
@ -18,8 +19,22 @@ class FormRequest extends \Illuminate\Foundation\Http\FormRequest
/**
* @return array
*/
public function rules()
public function rules(): array
{
return [];
}
/**
* Set a given column as being unique
*
* @param $table
*
* @return array
*/
public function unique($table)
{
return [
Rule::unique($table)->ignore($this->id, 'id'),
];
}
}

View File

@ -13,7 +13,7 @@ abstract class Model extends \Illuminate\Database\Eloquent\Model
/**
* Max length of ID for string columns
*/
public const ID_MAX_LENGTH = 12;
public const ID_MAX_LENGTH = 16;
/**
* For the factories, skip the mutators. Only apply to one instance

View File

@ -5,6 +5,9 @@ namespace App\Contracts;
use Illuminate\Validation\Validator;
use Prettus\Repository\Eloquent\BaseRepository;
/**
* @mixin \Prettus\Repository\Eloquent\BaseRepository
*/
abstract class Repository extends BaseRepository
{
/**

View File

@ -1,14 +1,11 @@
<?php
namespace App\Http\Resources;
use App\Contracts\Unit;
use Illuminate\Http\Resources\Json\Resource;
namespace App\Contracts;
/**
* Class Response
* Base class for a resource/response
*/
class Response extends Resource
class Resource extends \Illuminate\Http\Resources\Json\Resource
{
/**
* Iterate through the list of $fields and check if they're a "Unit"

View File

@ -59,7 +59,7 @@ class Unit implements ArrayAccess
{
$response = [];
foreach ($this->responseUnits as $unit) {
$response[$unit] = $this[$unit];
$response[$unit] = $this[$unit] ?? 0;
}
return $response;

View File

@ -0,0 +1,28 @@
<?php
namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Services\SimBriefService;
/**
* Clear any expired SimBrief flight briefs that aren't attached to a PIREP
*/
class ClearExpiredSimbrief extends Listener
{
private $simbriefSvc;
public function __construct(SimBriefService $simbriefSvc)
{
$this->simbriefSvc = $simbriefSvc;
}
/**
* @param \App\Events\CronNightly $event
*/
public function handle(CronNightly $event): void
{
$this->simbriefSvc->removeExpiredEntries();
}
}

View File

@ -4,6 +4,7 @@ namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Services\AircraftService;
use App\Services\UserService;
use Illuminate\Support\Facades\Log;
@ -12,11 +13,13 @@ use Illuminate\Support\Facades\Log;
*/
class RecalculateStats extends Listener
{
private $aircraftSvc;
private $userSvc;
public function __construct(UserService $userService)
public function __construct(AircraftService $aircraftSvc, UserService $userSvc)
{
$this->userSvc = $userService;
$this->aircraftSvc = $aircraftSvc;
$this->userSvc = $userSvc;
}
/**
@ -29,10 +32,10 @@ class RecalculateStats extends Listener
*/
public function handle(CronNightly $event): void
{
Log::info('Recalculating balances');
Log::info('Recalculating user stats');
$this->userSvc->recalculateAllUserStats();
Log::info('Done recalculating stats');
Log::info('Recalcuating aircraft status');
$this->aircraftSvc->recalculateStats();
}
}

View File

@ -22,20 +22,22 @@ $factory->define(App\Models\Flight::class, function (Faker $faker) {
'alt_airport_id' => function () {
return factory(App\Models\Airport::class)->create()->id;
},
'distance' => $faker->numberBetween(1, 1000),
'route' => null,
'level' => 0,
'dpt_time' => $faker->time(),
'arr_time' => $faker->time(),
'flight_time' => $faker->numberBetween(60, 360),
'has_bid' => false,
'active' => true,
'visible' => true,
'days' => 0,
'start_date' => null,
'end_date' => null,
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
'updated_at' => static function (array $flight) {
'distance' => $faker->numberBetween(1, 1000),
'route' => null,
'level' => 0,
'dpt_time' => $faker->time(),
'arr_time' => $faker->time(),
'flight_time' => $faker->numberBetween(60, 360),
'load_factor' => $faker->randomElement([15, 20, 50, 90, 100]),
'load_factor_variance' => $faker->randomElement([15, 20, 50, 90, 100]),
'has_bid' => false,
'active' => true,
'visible' => true,
'days' => 0,
'start_date' => null,
'end_date' => null,
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
'updated_at' => static function (array $flight) {
return $flight['created_at'];
},
];

View File

@ -0,0 +1,21 @@
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use Carbon\Carbon;
use Faker\Generator as Faker;
$factory->define(App\Models\SimBrief::class, function (Faker $faker) {
return [
'id' => $faker->unique()->numberBetween(10, 10000000),
'user_id' => null,
'flight_id' => null,
'pirep_id' => null,
'acars_xml' => '',
'ofp_xml' => '',
'created_at' => Carbon::now('UTC')->toDateTimeString(),
'updated_at' => function (array $sb) {
return $sb['created_at'];
},
];
});

View File

@ -8,7 +8,7 @@ $factory->define(App\Models\User::class, function (Faker $faker) {
return [
'id' => null,
'pilot_id' => 0,
'pilot_id' => null,
'name' => $faker->name,
'email' => $faker->safeEmail,
'password' => $password ?: $password = Hash::make('secret'),

View File

@ -1,6 +1,7 @@
<?php
use App\Contracts\Migration;
use App\Models\Pirep;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@ -24,7 +25,7 @@ class CreateUsersTable extends Migration
$table->string('country', 2)->nullable();
$table->string('home_airport_id', 5)->nullable();
$table->string('curr_airport_id', 5)->nullable();
$table->string('last_pirep_id', \App\Models\Pirep::ID_MAX_LENGTH)->nullable();
$table->string('last_pirep_id', Pirep::ID_MAX_LENGTH)->nullable();
$table->unsignedBigInteger('flights')->default(0);
$table->unsignedBigInteger('flight_time')->nullable()->default(0);
$table->unsignedBigInteger('transfer_time')->nullable()->default(0);

View File

@ -1,6 +1,7 @@
<?php
use App\Contracts\Migration;
use App\Contracts\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@ -14,8 +15,8 @@ class CreateAcarsTables extends Migration
public function up()
{
Schema::create('acars', function (Blueprint $table) {
$table->string('id', 12);
$table->string('pirep_id', \App\Contracts\Model::ID_MAX_LENGTH);
$table->string('id', Model::ID_MAX_LENGTH);
$table->string('pirep_id', Model::ID_MAX_LENGTH);
$table->unsignedTinyInteger('type');
$table->unsignedInteger('nav_type')->nullable();
$table->unsignedInteger('order')->default(0);

View File

@ -2,6 +2,7 @@
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateStatsTable extends Migration
{
@ -22,28 +23,6 @@ class CreateStatsTable extends Migration
$table->primary('id');
$table->timestamps();
});
/*$this->addCounterGroups([
'flights' => 1,
]);
$stats = [
[
'id' => $this->formatSettingId('flights.total_flights'),
'order' => $this->getNextOrderNumber('flights'),
'value' => 0,
'type' => 'int',
'description' => 'Total number of flights in the VA',
],
[
'id' => $this->formatSettingId('flights.total_time'),
'order' => $this->getNextOrderNumber('flights'),
'value' => 0,
'type' => 'int',
'description' => 'Total number of hours in the VA',
],
];
$this->addData('stats', $stats);*/
}
/**
@ -53,6 +32,6 @@ class CreateStatsTable extends Migration
*/
public function down()
{
Schema::dropIfExists('settings');
Schema::dropIfExists('stats');
}
}

View File

@ -2,6 +2,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class AddReadonlyToRoles extends Migration

View File

@ -18,7 +18,7 @@ class UsersAddPilotId extends Migration
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
Schema::table('users', static function (Blueprint $table) {
$table->unsignedBigInteger('pilot_id')
->after('id')
->unique()
@ -26,8 +26,7 @@ class UsersAddPilotId extends Migration
->index('users_pilot_id');
});
// Migrate the current pilot IDs
DB::update('UPDATE `users` SET `pilot_id`=`id`');
DB::table('users')->update(['pilot_id' => DB::raw('`id`')]);
}
/**

View File

@ -16,8 +16,9 @@ class PirepsChangeStateType extends Migration
public function up()
{
// Migrate the old rejected state
DB::update('UPDATE `pireps` SET `state`='.PirepState::REJECTED
.' WHERE state=-1');
DB::table('pireps')
->where(['state' => -1])
->update(['state' => PirepState::REJECTED]);
// Change the column type to an unsigned small int (tinyint not supported on all)
Schema::table('pireps', function (Blueprint $table) {

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ExpensesAddFlightType extends Migration
{
/**
* Add a `flight_type` column to the expenses table
*/
public function up()
{
Schema::table('expenses', function (Blueprint $table) {
$table->string('flight_type', 50)
->nullable()
->after('type');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('expenses', function (Blueprint $table) {
$table->dropColumn('flight_type');
});
}
}

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
/**
* Turn the airport coordinates and other lat/lon coords into decimal type
*/
class ModifyAirportsCoordinates extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('acars', function ($table) {
$table->decimal('lat', 10, 5)->change()->default(0.0)->nullable();
$table->decimal('lon', 11, 5)->change()->default(0.0)->nullable();
});
Schema::table('airports', function ($table) {
$table->decimal('lat', 10, 5)->change()->default(0.0)->nullable();
$table->decimal('lon', 11, 5)->change()->default(0.0)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
/**
* Allow the flight field value to be nullable
*/
class FlightFieldNullable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('flight_field_values', function ($table) {
$table->text('value')->change()->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class FlightsAddLoadFactor extends Migration
{
/**
* Add a `load_factor` and `load_factor_variance` columns to the expenses table
*/
public function up()
{
Schema::table('flights', function (Blueprint $table) {
$table->decimal('load_factor', 5, 2)
->nullable()
->after('flight_type');
$table->decimal('load_factor_variance', 5, 2)
->nullable()
->after('load_factor');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('flights', function (Blueprint $table) {
$table->dropColumn('load_factor');
$table->dropColumn('load_factor_variance');
});
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class FlightsAddPilotPay extends Migration
{
/**
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
*/
public function up()
{
Schema::table('flights', function (Blueprint $table) {
$table->decimal('pilot_pay')
->nullable()
->after('route');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('flights', function (Blueprint $table) {
$table->dropColumn('pilot_pay');
});
}
}

View File

@ -0,0 +1,34 @@
<?php
use App\Models\Enums\FareType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class FaresAddType extends Migration
{
/**
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
*/
public function up()
{
Schema::table('fares', function (Blueprint $table) {
$table->unsignedTinyInteger('type')
->default(FareType::PASSENGER)
->nullable()
->after('capacity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('fares', function (Blueprint $table) {
$table->dropColumn('type');
});
}
}

View File

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Increase string ID lengths because of collisions
*/
class IncreaseIdLengths extends Migration
{
public function up()
{
$tables = [
'acars' => ['id', 'pirep_id'],
'bids' => ['flight_id'],
'flights' => ['id'],
'pireps' => ['id', 'flight_id'],
'flight_fare' => ['flight_id'],
'flight_field_values' => ['flight_id'],
'flight_subfleet' => ['flight_id'],
'pirep_comments' => ['pirep_id'],
'pirep_fares' => ['pirep_id'],
'pirep_field_values' => ['pirep_id'],
'users' => ['last_pirep_id'],
];
foreach ($tables as $table_name => $columns) {
Schema::table($table_name, function (Blueprint $table) use ($columns) {
foreach ($columns as $column) {
$table->string($column, 36)->change();
}
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Remove the unique index from subfleets.type
*/
class RemoveSubfleetTypeIndex extends Migration
{
public function up()
{
Schema::table('subfleets', function (Blueprint $table) {
$table->dropUnique(['type']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a table to store the Simbrief data
*/
class AddSimbriefTable extends Migration
{
public function up()
{
Schema::create('simbrief', function (Blueprint $table) {
$table->string('id', 36); // The OFP ID
$table->unsignedInteger('user_id');
$table->string('flight_id', 36)->nullable();
$table->string('pirep_id', 36)->nullable();
$table->mediumText('acars_xml');
$table->mediumText('ofp_xml');
$table->timestamps();
$table->primary('id');
$table->index(['user_id', 'flight_id']);
$table->index('pirep_id');
$table->unique('pirep_id'); // Can only belong to a single PIREP
});
}
public function down()
{
Schema::drop('simbrief');
}
}

View File

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Create the pages
* https://github.com/nabeelio/phpvms/issues/641
*/
class CreatePages extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pages', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('slug');
$table->string('icon');
$table->unsignedSmallInteger('type');
$table->boolean('public');
$table->boolean('enabled');
$table->mediumText('body');
$table->timestamps();
$table->index('slug');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pages');
}
}

View File

@ -0,0 +1,19 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AirlineRemoveNullable extends Migration
{
public function up()
{
Schema::table('airlines', function (Blueprint $table) {
$table->dropUnique('airlines_iata_unique');
});
}
public function down()
{
}
}

View File

@ -0,0 +1,19 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class PageIconNullable extends Migration
{
public function up()
{
Schema::table('pages', function (Blueprint $table) {
$table->string('icon')->change()->nullable();
});
}
public function down()
{
}
}

1
app/Database/seeds/dev/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
local.yml

View File

@ -124,7 +124,16 @@ airports:
lat: 25.2528
lon: 55.3644
ground_handling_cost: 50
- id: OMAA
iata: AUH
icao: OMAA
name: Abu Dhabi International Airport
location: Abu Dhabi
country:
timezone: Asia/Dubai
lat: 24.433
lon: 54.6511
ground_handling_cost: 50
#
aircraft:
- id: 1
@ -132,24 +141,28 @@ aircraft:
airport_id: KJFK
name: Boeing 747-438
registration: 001Z
flight_time: 360
status: A
- id: 2
subfleet_id: 2
airport_id: LGRP
name: Boeing 777-200
registration: C202
flight_time: 260
status: A
- id: 3
subfleet_id: 1
airport_id: KAUS
name: Boeing 747-412
registration: S2333
flight_time: 0
status: A
- id: 4
subfleet_id: 1
airport_id: KAUS
name: Boeing 747-436 RETIRED
registration:
flight_time: 45
status: R
expenses:
@ -283,6 +296,7 @@ flights:
arr_time: 11PM EST
flight_time: 240
flight_type: J
load_factor: 100
created_at: NOW
updated_at: NOW
- id: flightid_3
@ -294,6 +308,7 @@ flights:
arr_airport_id: KJFK
flight_time: 480
flight_type: J
load_factor: 63
dpt_time: 9AM CST
arr_time: 1030AM CST
route: PITZZ4 MNURE WLEEE4
@ -308,6 +323,37 @@ flights:
arr_airport_id: MWCR
flight_time: 70
flight_type: 'J'
load_factor: 80
dpt_time: '0800'
arr_time: '0900'
route: 'MLY5 KEMBO UG442 SIA UG633 OTEKO UR640 NALRO GUBEL3'
created_at: NOW
updated_at: NOW
- id: flightid_5
airline_id: 1
flight_number: 112
route_code:
route_leg:
dpt_airport_id: OMAA
arr_airport_id: OMDB
flight_time: 30
flight_type: 'J'
load_factor:
dpt_time: '0800'
arr_time: '0900'
route: 'MLY5 KEMBO UG442 SIA UG633 OTEKO UR640 NALRO GUBEL3'
created_at: NOW
updated_at: NOW
- id: flightid_6
airline_id: 1
flight_number: 113
route_code:
route_leg:
dpt_airport_id: OMDB
arr_airport_id: OMAA
flight_time: 30
flight_type: 'J'
load_factor: 100
dpt_time: '0800'
arr_time: '0900'
route: 'MLY5 KEMBO UG442 SIA UG633 OTEKO UR640 NALRO GUBEL3'
@ -467,12 +513,8 @@ pirep_fares:
pirep_fields:
- id: 1
name: departure terminal
slug: departure-terminal
required: 1
- id: 2
name: arrival terminal
slug: arrival-terminal
name: Cost Index
slug: cost-index
required: 0
pirep_field_values:

File diff suppressed because one or more lines are too long

View File

@ -30,6 +30,9 @@
- name: finances
display_name: Finances
description: Create/view finance related items
- name: pages
display_name: Pages
description: Add/edit/delete pages
- name: pireps
display_name: PIREPs
description: Accept/reject/edit PIREPs

View File

@ -40,6 +40,19 @@
options: ''
type: boolean
description: 'Send some data (php version, mysql version) to phpVMS. See AnalyticsSvc code for details'
- key: general.google_analytics_id
name: 'Google Analytics Tracking ID'
group: general
value: ''
options: ''
type: text
description: 'Enter your Google Analytics Tracking ID'
- key: units.currency
name: 'Currency'
group: units
value: USD
type: select
description: 'The currency to use'
- key: units.distance
name: 'Distance Units'
group: units
@ -131,6 +144,41 @@
options: ''
type: int
description: 'Number of hours to expire bids after'
- key: flights.default_load_factor
name: 'Load Factor'
group: flights
value: 82
options: ''
type: number
description: 'The default load factor for a flight, as a percent'
- key: flights.load_factor_variance
name: 'Load Factor Variance'
group: flights
value: 5
options: ''
type: number
description: 'How much the load factor can vary per-flight'
- key: simbrief.api_key
name: 'SimBrief API Key'
group: simbrief
value: ''
options: ''
type: string
description: 'Your SimBrief API key'
- key: simbrief.only_bids
name: 'Only allow for bids'
group: simbrief
value: true
options: ''
type: boolean
description: 'Only allow briefs to be created for bidded flights'
- key: simbrief.expire_days
name: 'SimBrief Expire Time'
group: simbrief
value: 5
options: ''
type: number
description: 'Days after how long to remove unused briefs'
- key: pireps.duplicate_check_time
name: 'PIREP duplicate time check'
group: pireps

View File

@ -0,0 +1,15 @@
<?php
namespace App\Events;
use App\Models\Pirep;
class PirepCancelled extends BaseEvent
{
public $pirep;
public function __construct(Pirep $pirep)
{
$this->pirep = $pirep;
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Events;
use App\Models\Pirep;
class PirepPrefiled extends BaseEvent
{
public $pirep;
public function __construct(Pirep $pirep)
{
$this->pirep = $pirep;
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Events;
use App\Models\Pirep;
class PirepUpdated extends BaseEvent
{
public $pirep;
public function __construct(Pirep $pirep)
{
$this->pirep = $pirep;
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Exceptions;
use Exception;
class PageNotFound extends AbstractHttpException
{
private $exception;
public function __construct(Exception $exception)
{
$this->exception = $exception;
parent::__construct(
404,
$exception->getMessage()
);
}
/**
* Return the RFC 7807 error type (without the URL root)
*/
public function getErrorType(): string
{
return 'not-found';
}
/**
* 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 [];
}
}

View File

@ -1,222 +0,0 @@
<?php
namespace App\Facades;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Facade;
class Utils extends Facade
{
/**
* @return string
*/
protected static function getFacadeAccessor(): string
{
return 'utils';
}
/**
* Simple check on the first character if it's an object or not
*
* @param $obj
*
* @return bool
*/
public static function isObject($obj): bool
{
if (!$obj) {
return false;
}
if ($obj[0] === '{' || $obj[0] === '[') {
return true;
}
return false;
}
/**
* Download a URI. If a file is given, it will save the downloaded
* content into that file
*
* @param string $uri
* @param null $file
*
* @throws \RuntimeException
* @throws \GuzzleHttp\Exception\GuzzleException
*
* @return string
*/
public static function downloadUrl($uri, $file = null): string
{
$opts = [];
if ($file !== null) {
$opts['sink'] = $file;
}
$client = new Client();
$response = $client->request('GET', $uri, $opts);
$body = $response->getBody()->getContents();
if ($response->getHeader('content-type') === 'application/json') {
$body = \GuzzleHttp\json_decode($body);
}
return $body;
}
/**
* Returns a 40 character API key that a user can use
*
* @return string
*/
public static function generateApiKey(): string
{
$key = substr(sha1(time().mt_rand()), 0, 20);
return $key;
}
/**
* @param string $minutes
*
* @return array
*/
public static function minutesToTimeParts($minutes): array
{
$hours = floor($minutes / 60);
$minutes %= 60;
return ['h' => $hours, 'm' => $minutes];
}
public static function minutesToTimeString($minutes): string
{
$hm = self::minutesToTimeParts($minutes);
return $hm['h'].'h '.$hm['m'].'m';
}
/**
* Convert seconds to an array of hours, minutes, seconds
*
* @param int $seconds
*
* @throws \Exception
*
* @return array['h', 'm', 's']
*/
public static function secondsToTimeParts($seconds): array
{
$dtF = new \DateTimeImmutable('@0', new \DateTimeZone('UTC'));
$dtT = new \DateTimeImmutable("@$seconds", new \DateTimeZone('UTC'));
$t = $dtF->diff($dtT);
$retval = [];
$retval['h'] = (int) $t->format('%h');
$retval['m'] = (int) $t->format('%i');
$retval['s'] = (int) $t->format('%s');
return $retval;
}
/**
* Convert seconds to HH MM format
*
* @param int $seconds
* @param bool $incl_sec
*
* @throws \Exception
*
* @return string
*/
public static function secondsToTimeString($seconds, $incl_sec = false): string
{
$hms = self::secondsToTimeParts($seconds);
$format = $hms['h'].'h '.$hms['m'].'m';
if ($incl_sec) {
$format .= ' '.$hms['s'].'s';
}
return $format;
}
/**
* @param $minutes
*
* @return float|int
*/
public static function minutesToSeconds($minutes)
{
return $minutes * 60;
}
/**
* Convert the seconds to minutes and then round it up
*
* @param $seconds
*
* @return float|int
*/
public static function secondsToMinutes($seconds)
{
return ceil($seconds / 60);
}
/**
* Convert hours to minutes. Pretty complex
*
* @param $minutes
*
* @return float|int
*/
public static function minutesToHours($minutes)
{
return $minutes / 60;
}
/**
* @param $hours
* @param null $minutes
*
* @return float|int
*/
public static function hoursToMinutes($hours, $minutes = null)
{
$total = (int) $hours * 60;
if ($minutes) {
$total += (int) $minutes;
}
return $total;
}
/**
* Bitwise operator for setting days of week to integer field
*
* @param int $datefield initial datefield
* @param array $day_enums Array of values from config("enum.days")
*
* @return int
*/
public static function setDays(int $datefield, array $day_enums): int
{
foreach ($day_enums as $day) {
$datefield |= $day;
}
return $datefield;
}
/**
* Bit check if a day exists within a integer bitfield
*
* @param int $datefield datefield from database
* @param int $day_enum Value from config("enum.days")
*
* @return bool
*/
public static function hasDay(int $datefield, int $day_enum): bool
{
return ($datefield & $day_enum) === $datefield;
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Http\Composers;
use App\Contracts\Composer;
use App\Repositories\PageRepository;
use Exception;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
class PageLinksComposer extends Composer
{
protected $pageRepo;
/**
* PageLinksComposer constructor.
*
* @param \App\Repositories\PageRepository $pageRepo
*/
public function __construct(PageRepository $pageRepo)
{
$this->pageRepo = $pageRepo;
}
/**
* @param \Illuminate\View\View $view
*/
public function compose(View $view)
{
try {
// If not logged in, then only get the public pages
$w = ['enabled' => true];
if (!Auth::check()) {
$w = ['public' => true];
}
$pages = $this->pageRepo->findWhere($w, ['id', 'name', 'slug', 'icon']);
} catch (Exception $e) {
$pages = [];
}
$view->with('page_links', $pages);
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Http\Composers;
use App\Contracts\Composer;
use App\Services\VersionService;
use Illuminate\View\View;
class VersionComposer extends Composer
{
protected $versionSvc;
public function __construct(VersionService $versionSvc)
{
$this->versionSvc = $versionSvc;
}
public function compose(View $view)
{
$view->with('version', $this->versionSvc->getCurrentVersion(false));
$view->with('version_full', $this->versionSvc->getCurrentVersion(true));
}
}

View File

@ -3,11 +3,12 @@
namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Http\Controllers\Admin\Traits\Importable;
use App\Http\Requests\CreateAircraftRequest;
use App\Http\Requests\ImportRequest;
use App\Http\Requests\UpdateAircraftRequest;
use App\Models\Aircraft;
use App\Models\Enums\AircraftStatus;
use App\Models\Enums\ImportExportType;
use App\Models\Expense;
use App\Models\Subfleet;
use App\Repositories\AircraftRepository;
@ -15,15 +16,12 @@ use App\Repositories\AirportRepository;
use App\Services\ExportService;
use App\Services\ImportService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Laracasts\Flash\Flash;
/**
* Class AircraftController
*/
class AircraftController extends Controller
{
use Importable;
private $aircraftRepo;
private $airportRepo;
private $importSvc;
@ -82,7 +80,7 @@ class AircraftController extends Controller
return view('admin.aircraft.create', [
'airports' => $this->airportRepo->selectBoxList(),
'subfleets' => Subfleet::all()->pluck('name', 'id'),
'statuses' => AircraftStatus::select(true),
'statuses' => AircraftStatus::select(false),
'subfleet_id' => $request->query('subfleet'),
]);
}
@ -90,7 +88,11 @@ class AircraftController extends Controller
/**
* Store a newly created Aircraft in storage.
*
* @param \App\Http\Requests\CreateAircraftRequest $request
*
* @throws \Prettus\Validator\Exceptions\ValidatorException
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function store(CreateAircraftRequest $request)
{
@ -142,14 +144,15 @@ class AircraftController extends Controller
'aircraft' => $aircraft,
'airports' => $this->airportRepo->selectBoxList(),
'subfleets' => Subfleet::all()->pluck('name', 'id'),
'statuses' => AircraftStatus::select(true),
'statuses' => AircraftStatus::select(false),
]);
}
/**
* Update the specified Aircraft in storage.
*
* @param mixed $id
* @param mixed $id
* @param UpdateAircraftRequest $request
*
* @throws \Prettus\Validator\Exceptions\ValidatorException
*
@ -218,8 +221,6 @@ class AircraftController extends Controller
/**
* @param Request $request
*
* @throws \Illuminate\Validation\ValidationException
*
* @return mixed
*/
public function import(Request $request)
@ -230,16 +231,7 @@ class AircraftController extends Controller
];
if ($request->isMethod('post')) {
ImportRequest::validate($request);
$path = Storage::putFileAs(
'import',
$request->file('csv_file'),
'import_aircraft.csv'
);
$path = storage_path('app/'.$path);
Log::info('Uploaded aircraft import file to '.$path);
$logs = $this->importSvc->importAircraft($path);
$logs = $this->importFile($request, ImportExportType::AIRCRAFT);
}
return view('admin.aircraft.import', [

View File

@ -63,7 +63,7 @@ class AirlinesController extends Controller
public function store(CreateAirlineRequest $request)
{
$input = $request->all();
$airlines = $this->airlineRepo->create($input);
$this->airlineSvc->createAirline($input);
Flash::success('Airlines saved successfully.');
return redirect(route('admin.airlines.index'));

View File

@ -3,10 +3,11 @@
namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Http\Controllers\Admin\Traits\Importable;
use App\Http\Requests\CreateAirportRequest;
use App\Http\Requests\ImportRequest;
use App\Http\Requests\UpdateAirportRequest;
use App\Models\Airport;
use App\Models\Enums\ImportExportType;
use App\Models\Expense;
use App\Repositories\AirportRepository;
use App\Repositories\Criteria\WhereCriteria;
@ -14,12 +15,12 @@ use App\Services\ExportService;
use App\Services\ImportService;
use App\Support\Timezonelist;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Laracasts\Flash\Flash;
class AirportController extends Controller
{
use Importable;
private $airportRepo;
private $importSvc;
@ -223,16 +224,7 @@ class AirportController extends Controller
];
if ($request->isMethod('post')) {
ImportRequest::validate($request);
$path = Storage::putFileAs(
'import',
$request->file('csv_file'),
'import_airports.csv'
);
$path = storage_path('app/'.$path);
Log::info('Uploaded airport import file to '.$path);
$logs = $this->importSvc->importAirports($path);
$logs = $this->importFile($request, ImportExportType::AIRPORT);
}
return view('admin.airports.import', [

View File

@ -3,21 +3,23 @@
namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Http\Requests\ImportRequest;
use App\Http\Controllers\Admin\Traits\Importable;
use App\Models\Enums\ExpenseType;
use App\Models\Enums\FlightType;
use App\Models\Enums\ImportExportType;
use App\Models\Expense;
use App\Repositories\AirlineRepository;
use App\Repositories\ExpenseRepository;
use App\Services\ExportService;
use App\Services\ImportService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Laracasts\Flash\Flash;
use Prettus\Repository\Criteria\RequestCriteria;
class ExpenseController extends Controller
{
use Importable;
private $airlineRepo;
private $expenseRepo;
private $importSvc;
@ -68,6 +70,7 @@ class ExpenseController extends Controller
return view('admin.expenses.create', [
'airlines_list' => $this->airlineRepo->selectBoxList(true),
'expense_types' => ExpenseType::select(),
'flight_types' => FlightType::select(),
]);
}
@ -134,6 +137,7 @@ class ExpenseController extends Controller
'expense' => $expense,
'airlines_list' => $this->airlineRepo->selectBoxList(true),
'expense_types' => ExpenseType::select(),
'flight_types' => FlightType::select(),
]);
}
@ -153,14 +157,12 @@ class ExpenseController extends Controller
if (empty($expenses)) {
Flash::error('Expense not found');
return redirect(route('admin.expenses.index'));
}
$this->expenseRepo->update($request->all(), $id);
Flash::success('Expense updated successfully.');
return redirect(route('admin.expenses.index'));
}
@ -223,16 +225,7 @@ class ExpenseController extends Controller
];
if ($request->isMethod('post')) {
ImportRequest::validate($request);
$path = Storage::putFileAs(
'import',
$request->file('csv_file'),
'import_expenses.csv'
);
$path = storage_path('app/'.$path);
Log::info('Uploaded expenses import file to '.$path);
$logs = $this->importSvc->importExpenses($path);
$logs = $this->importFile($request, ImportExportType::EXPENSES);
}
return view('admin.expenses.import', [

View File

@ -3,20 +3,22 @@
namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Http\Controllers\Admin\Traits\Importable;
use App\Http\Requests\CreateFareRequest;
use App\Http\Requests\ImportRequest;
use App\Http\Requests\UpdateFareRequest;
use App\Models\Enums\FareType;
use App\Models\Enums\ImportExportType;
use App\Repositories\FareRepository;
use App\Services\ExportService;
use App\Services\ImportService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Laracasts\Flash\Flash;
use Prettus\Repository\Criteria\RequestCriteria;
class FareController extends Controller
{
use Importable;
private $fareRepo;
private $importSvc;
@ -57,7 +59,9 @@ class FareController extends Controller
*/
public function create()
{
return view('admin.fares.create');
return view('admin.fares.create', [
'fare_types' => FareType::select(),
]);
}
/**
@ -93,7 +97,9 @@ class FareController extends Controller
return redirect(route('admin.fares.index'));
}
return view('admin.fares.show')->with('fare', $fare);
return view('admin.fares.show', [
'fare' => $fare,
]);
}
/**
@ -111,7 +117,10 @@ class FareController extends Controller
return redirect(route('admin.fares.index'));
}
return view('admin.fares.edit')->with('fare', $fare);
return view('admin.fares.edit', [
'fare' => $fare,
'fare_types' => FareType::select(),
]);
}
/**
@ -196,16 +205,7 @@ class FareController extends Controller
];
if ($request->isMethod('post')) {
ImportRequest::validate($request);
$path = Storage::putFileAs(
'import',
$request->file('csv_file'),
'import_fares.csv'
);
$path = storage_path('app/'.$path);
Log::info('Uploaded fares import file to '.$path);
$logs = $this->importSvc->importFares($path);
$logs = $this->importFile($request, ImportExportType::FARES);
}
return view('admin.fares.import', [

View File

@ -3,9 +3,11 @@
namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Http\Controllers\Admin\Traits\Importable;
use App\Http\Requests\CreateFlightRequest;
use App\Http\Requests\UpdateFlightRequest;
use App\Models\Enums\FlightType;
use App\Models\Enums\ImportExportType;
use App\Models\Flight;
use App\Models\FlightField;
use App\Models\FlightFieldValue;
@ -23,14 +25,12 @@ use App\Services\ImportService;
use App\Support\Units\Time;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Laracasts\Flash\Flash;
/**
* Class FlightController
*/
class FlightController extends Controller
{
use Importable;
private $airlineRepo;
private $airportRepo;
private $fareRepo;
@ -325,15 +325,7 @@ class FlightController extends Controller
];
if ($request->isMethod('post')) {
$path = Storage::putFileAs(
'import',
$request->file('csv_file'),
'import_flights.csv'
);
$path = storage_path('app/'.$path);
Log::info('Uploaded flights import file to '.$path);
$logs = $this->importSvc->importFlights($path);
$logs = $this->importFile($request, ImportExportType::FLIGHTS);
}
return view('admin.flights.import', [

View File

@ -3,18 +3,32 @@
namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Repositories\KvpRepository;
use App\Services\CronService;
use App\Services\VersionService;
use Codedge\Updater\UpdaterManager;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;
use Laracasts\Flash\Flash;
class MaintenanceController extends Controller
{
private $cronSvc;
private $kvpRepo;
private $updateManager;
private $versionSvc;
public function __construct(CronService $cronSvc)
{
public function __construct(
CronService $cronSvc,
KvpRepository $kvpRepo,
UpdaterManager $updateManager,
VersionService $versionSvc
) {
$this->cronSvc = $cronSvc;
$this->kvpRepo = $kvpRepo;
$this->updateManager = $updateManager;
$this->versionSvc = $versionSvc;
}
public function index()
@ -22,6 +36,8 @@ class MaintenanceController extends Controller
return view('admin.maintenance.index', [
'cron_path' => $this->cronSvc->getCronExecString(),
'cron_problem_exists' => $this->cronSvc->cronProblemExists(),
'new_version' => true, //$this->kvpRepo->get('new_version_available', false),
'new_version_tag' => $this->kvpRepo->get('latest_version_tag'),
]);
}
@ -30,7 +46,7 @@ class MaintenanceController extends Controller
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @return mixed
*/
public function cache(Request $request)
{
@ -57,4 +73,43 @@ class MaintenanceController extends Controller
Flash::success('Cache cleared!');
return redirect(route('admin.maintenance.index'));
}
/**
* Force an update check
*
* @param \Illuminate\Http\Request $request
*
* @return mixed
*/
public function forcecheck(Request $request)
{
$this->versionSvc->isNewVersionAvailable();
$new_version_avail = $this->kvpRepo->get('new_version_available', false);
$new_version_tag = $this->kvpRepo->get('latest_version_tag');
Log::info('Force check, available='.$new_version_avail.', tag='.$new_version_tag);
if (!$new_version_avail) {
Flash::success('No new version available');
} else {
Flash::success('New version available: '.$new_version_tag);
}
return redirect(route('admin.maintenance.index'));
}
/**
* Update the phpVMS install
*
* @param \Illuminate\Http\Request $request
*
* @return mixed
*/
public function update(Request $request)
{
$new_version_tag = $this->kvpRepo->get('latest_version_tag');
Log::info('Attempting to update to '.$new_version_tag);
return redirect('/update/downloader');
}
}

View File

@ -0,0 +1,152 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Http\Requests\CreatePageRequest;
use App\Http\Requests\UpdatePageRequest;
use App\Repositories\PageRepository;
use Illuminate\Http\Request;
use Laracasts\Flash\Flash;
class PagesController extends Controller
{
private $pageRepo;
/**
* @param PageRepository $pageRepo
*/
public function __construct(PageRepository $pageRepo)
{
$this->pageRepo = $pageRepo;
}
/**
* @param Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index(Request $request)
{
$pages = $this->pageRepo->all();
return view('admin.pages.index', [
'pages' => $pages,
]);
}
/**
* Show the form for creating a new Airlines.
*/
public function create()
{
return view('admin.pages.create');
}
/**
* Store a newly created Airlines in storage.
*
* @param \App\Http\Requests\CreatePageRequest $request
*
* @throws \Prettus\Validator\Exceptions\ValidatorException
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function store(CreatePageRequest $request)
{
$input = $request->all();
$this->pageRepo->create($input);
Flash::success('Page saved successfully.');
return redirect(route('admin.pages.index'));
}
/**
* Display the specified page
*
* @param int $id
*
* @return mixed
*/
public function show($id)
{
$pages = $this->pageRepo->findWithoutFail($id);
if (empty($pages)) {
Flash::error('Page not found');
return redirect(route('admin.page.index'));
}
return view('admin.pages.show', [
'pages' => $pages,
]);
}
/**
* Show the form for editing the specified pages
*
* @param int $id
*
* @return mixed
*/
public function edit($id)
{
$page = $this->pageRepo->findWithoutFail($id);
if (empty($page)) {
Flash::error('Page not found');
return redirect(route('admin.pages.index'));
}
return view('admin.pages.edit', [
'page' => $page,
]);
}
/**
* Update the specified Airlines in storage.
*
* @param int $id
* @param UpdatePageRequest $request
*
* @throws \Prettus\Validator\Exceptions\ValidatorException
*
* @return mixed
*/
public function update($id, UpdatePageRequest $request)
{
$page = $this->pageRepo->findWithoutFail($id);
if (empty($page)) {
Flash::error('page not found');
return redirect(route('admin.pages.index'));
}
$this->pageRepo->update($request->all(), $id);
Flash::success('pages updated successfully.');
return redirect(route('admin.pages.index'));
}
/**
* Remove the specified Airlines from storage.
*
* @param int $id
*
* @return mixed
*/
public function destroy($id)
{
$pages = $this->pageRepo->findWithoutFail($id);
if (empty($pages)) {
Flash::error('Page not found');
return redirect(route('admin.pages.index'));
}
$this->pageRepo->delete($id);
Flash::success('page deleted successfully.');
return redirect(route('admin.pages.index'));
}
}

View File

@ -3,7 +3,6 @@
namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Facades\Utils;
use App\Http\Requests\CreatePirepRequest;
use App\Http\Requests\UpdatePirepRequest;
use App\Models\Enums\PirepSource;
@ -260,7 +259,7 @@ class PirepController extends Controller
$hours = (int) $attrs['hours'];
$minutes = (int) $attrs['minutes'];
$pirep->flight_time = Utils::hoursToMinutes($hours) + $minutes;
$pirep->flight_time = Time::hoursToMinutes($hours) + $minutes;
$this->saveCustomFields($pirep, $request);
$this->saveFares($pirep, $request);

View File

@ -4,12 +4,23 @@ namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Models\Setting;
use App\Services\FinanceService;
use Igaster\LaravelTheme\Facades\Theme;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class SettingsController extends Controller
{
private $financeSvc;
/**
* @param FinanceService $financeSvc
*/
public function __construct(FinanceService $financeSvc)
{
$this->financeSvc = $financeSvc;
}
/**
* Get a list of themes formatted for a select box
*
@ -17,6 +28,7 @@ class SettingsController extends Controller
*/
private function getThemes(): array
{
Theme::rebuildCache();
$themes = Theme::all();
$theme_list = [];
foreach ($themes as $t) {
@ -29,6 +41,22 @@ class SettingsController extends Controller
return $theme_list;
}
/**
* Return the currency list
*
* @return array
*/
private function getCurrencyList(): array
{
$curr = [];
foreach (config('money') as $currency => $attrs) {
$name = $attrs['name'].' ('.$attrs['symbol'].'/'.$currency.')';
$curr[$currency] = $name;
}
return $curr;
}
/**
* Display the settings. Group them by the setting group
*/
@ -38,6 +66,7 @@ class SettingsController extends Controller
$settings = $settings->groupBy('group');
return view('admin.settings.index', [
'currencies' => $this->getCurrencyList(),
'grouped_settings' => $settings,
'themes' => $this->getThemes(),
]);
@ -67,6 +96,8 @@ class SettingsController extends Controller
$setting->save();
}
$this->financeSvc->changeJournalCurrencies();
flash('Settings saved!');
return redirect('/admin/settings');

View File

@ -3,11 +3,13 @@
namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Http\Controllers\Admin\Traits\Importable;
use App\Http\Requests\CreateSubfleetRequest;
use App\Http\Requests\ImportRequest;
use App\Http\Requests\UpdateSubfleetRequest;
use App\Models\Airline;
use App\Models\Enums\FareType;
use App\Models\Enums\FuelType;
use App\Models\Enums\ImportExportType;
use App\Models\Expense;
use App\Models\Subfleet;
use App\Repositories\AircraftRepository;
@ -19,13 +21,13 @@ use App\Services\FareService;
use App\Services\FleetService;
use App\Services\ImportService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Laracasts\Flash\Flash;
use Prettus\Repository\Criteria\RequestCriteria;
class SubfleetController extends Controller
{
use Importable;
private $aircraftRepo;
private $fareRepo;
private $fareSvc;
@ -97,6 +99,7 @@ class SubfleetController extends Controller
foreach ($avail_fares as $fare) {
$retval[$fare->id] = $fare->name.
' (price: '.$fare->price.
', type: '.FareType::label($fare->type).
', cost: '.$fare->cost.
', capacity: '.$fare->capacity.')';
}
@ -161,7 +164,9 @@ class SubfleetController extends Controller
*/
public function show($id)
{
$subfleet = $this->subfleetRepo->findWithoutFail($id);
$subfleet = $this->subfleetRepo
->with(['fares'])
->findWithoutFail($id);
if (empty($subfleet)) {
Flash::error('Subfleet not found');
@ -184,7 +189,9 @@ class SubfleetController extends Controller
*/
public function edit($id)
{
$subfleet = $this->subfleetRepo->findWithoutFail($id);
$subfleet = $this->subfleetRepo
->with(['fares', 'ranks'])
->findWithoutFail($id);
if (empty($subfleet)) {
Flash::error('Subfleet not found');
@ -293,17 +300,7 @@ class SubfleetController extends Controller
];
if ($request->isMethod('post')) {
ImportRequest::validate($request);
$path = Storage::putFileAs(
'import',
$request->file('csv_file'),
'import_subfleets.csv'
);
$path = storage_path('app/'.$path);
Log::info('Uploaded subfleets import file to '.$path);
$logs = $this->importSvc->importSubfleets($path);
$logs = $this->importFile($request, ImportExportType::SUBFLEETS);
}
return view('admin.subfleets.import', [

View File

@ -0,0 +1,59 @@
<?php
namespace App\Http\Controllers\Admin\Traits;
use App\Http\Requests\ImportRequest;
use App\Models\Enums\ImportExportType;
use App\Services\ImportService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use InvalidArgumentException;
trait Importable
{
/**
* Import a file, passing in the import/export type
*
* @param Request $request Request object
* @param int $importType Refer to \App\Models\Enums\ImportExportType
*
* @throws \Illuminate\Validation\ValidationException
*
* @return mixed
*/
public function importFile(Request $request, int $importType)
{
ImportRequest::validate($request);
$path = Storage::putFileAs(
'import',
$request->file('csv_file'),
'import_'.ImportExportType::label($importType).'.csv'
);
/** @var ImportService */
$importSvc = app(ImportService::class);
$path = storage_path('app/'.$path);
Log::info('Uploaded airport import file to '.$path);
$delete_previous = get_truth_state($request->get('delete'));
switch ($importType) {
case ImportExportType::AIRCRAFT:
return $importSvc->importAircraft($path, $delete_previous);
case ImportExportType::AIRPORT:
return $importSvc->importAirports($path, $delete_previous);
case ImportExportType::EXPENSES:
return $importSvc->importExpenses($path, $delete_previous);
case ImportExportType::FARES:
return $importSvc->importFares($path, $delete_previous);
case ImportExportType::FLIGHTS:
return $importSvc->importFlights($path, $delete_previous);
case ImportExportType::SUBFLEETS:
return $importSvc->importSubfleets($path, $delete_previous);
}
throw new InvalidArgumentException('Unknown import type!');
}
}

View File

@ -3,7 +3,6 @@
namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Facades\Utils;
use App\Http\Requests\CreateUserRequest;
use App\Http\Requests\UpdateUserRequest;
use App\Models\Rank;
@ -15,6 +14,7 @@ use App\Repositories\PirepRepository;
use App\Repositories\UserRepository;
use App\Services\UserService;
use App\Support\Timezonelist;
use App\Support\Utils;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;

View File

@ -119,11 +119,15 @@ class AcarsController extends Controller
public function acars_get($id, Request $request)
{
$this->pirepRepo->find($id);
$acars = Acars::with(['pirep'])
->where([
'pirep_id' => $id,
'type' => AcarsType::FLIGHT_PATH,
])
->orderBy('sim_time', 'asc')
->get();
return new AcarsRouteResource(Acars::where([
'pirep_id' => $id,
'type' => AcarsType::FLIGHT_PATH,
])->orderBy('sim_time', 'asc')->get());
return new AcarsRouteResource($acars);
}
/**
@ -154,7 +158,7 @@ class AcarsController extends Controller
$position['pirep_id'] = $id;
$position['type'] = AcarsType::FLIGHT_PATH;
if (array_key_exists('sim_time', $position)) {
if (isset($position['sim_time'])) {
if ($position['sim_time'] instanceof \DateTime) {
$position['sim_time'] = Carbon::instance($position['sim_time']);
} else {
@ -162,7 +166,7 @@ class AcarsController extends Controller
}
}
if (array_key_exists('created_at', $position)) {
if (isset($position['created_at'])) {
if ($position['created_at'] instanceof \DateTime) {
$position['created_at'] = Carbon::instance($position['created_at']);
} else {
@ -171,8 +175,16 @@ class AcarsController extends Controller
}
try {
$update = Acars::create($position);
$update->save();
if (isset($position['id'])) {
Acars::updateOrInsert(
['id' => $position['id']],
$position
);
} else {
$update = Acars::create($position);
$update->save();
}
$count++;
} catch (QueryException $ex) {
Log::info('Error on adding ACARS position: '.$ex->getMessage());
@ -215,17 +227,25 @@ class AcarsController extends Controller
$log['pirep_id'] = $id;
$log['type'] = AcarsType::LOG;
if (array_key_exists('sim_time', $log)) {
if (isset($log['sim_time'])) {
$log['sim_time'] = Carbon::createFromTimeString($log['sim_time']);
}
if (array_key_exists('created_at', $log)) {
if (isset($log['created_at'])) {
$log['created_at'] = Carbon::createFromTimeString($log['created_at']);
}
try {
$acars = Acars::create($log);
$acars->save();
if (isset($log['id'])) {
Acars::updateOrInsert(
['id' => $log['id']],
$log
);
} else {
$acars = Acars::create($log);
$acars->save();
}
$count++;
} catch (QueryException $ex) {
Log::info('Error on adding ACARS position: '.$ex->getMessage());
@ -262,17 +282,25 @@ class AcarsController extends Controller
$log['type'] = AcarsType::LOG;
$log['log'] = $log['event'];
if (array_key_exists('sim_time', $log)) {
if (isset($log['sim_time'])) {
$log['sim_time'] = Carbon::createFromTimeString($log['sim_time']);
}
if (array_key_exists('created_at', $log)) {
if (isset($log['created_at'])) {
$log['created_at'] = Carbon::createFromTimeString($log['created_at']);
}
try {
$acars = Acars::create($log);
$acars->save();
if (isset($log['id'])) {
Acars::updateOrInsert(
['id' => $log['id']],
$log
);
} else {
$acars = Acars::create($log);
$acars->save();
}
$count++;
} catch (QueryException $ex) {
Log::info('Error on adding ACARS position: '.$ex->getMessage());

View File

@ -3,11 +3,14 @@
namespace App\Http\Controllers\Api;
use App\Contracts\Controller;
use App\Exceptions\AssetNotFound;
use App\Http\Resources\Flight as FlightResource;
use App\Http\Resources\Navdata as NavdataResource;
use App\Models\SimBrief;
use App\Repositories\Criteria\WhereCriteria;
use App\Repositories\FlightRepository;
use App\Services\FlightService;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Prettus\Repository\Criteria\RequestCriteria;
@ -51,7 +54,18 @@ class FlightController extends Controller
*/
public function get($id)
{
$flight = $this->flightRepo->find($id);
$user = Auth::user();
$flight = $this->flightRepo->with([
'airline',
'subfleets',
'subfleets.aircraft',
'subfleets.fares',
'field_values',
'simbrief' => function ($query) use ($user) {
return $query->where('user_id', $user->id);
},
])->find($id);
$this->flightSvc->filterSubfleets(Auth::user(), $flight);
return new FlightResource($flight);
@ -64,6 +78,7 @@ class FlightController extends Controller
*/
public function search(Request $request)
{
$user = Auth::user();
$where = [
'active' => true,
'visible' => true,
@ -88,7 +103,18 @@ class FlightController extends Controller
$this->flightRepo->pushCriteria(new WhereCriteria($request, $where));
$this->flightRepo->pushCriteria(new RequestCriteria($request));
$flights = $this->flightRepo->paginate();
$flights = $this->flightRepo
->with([
'airline',
'subfleets',
'subfleets.aircraft',
'subfleets.fares',
'field_values',
'simbrief' => function ($query) use ($user) {
return $query->where('user_id', $user->id);
},
])
->paginate();
} catch (RepositoryException $e) {
return response($e, 503);
}
@ -101,6 +127,32 @@ class FlightController extends Controller
return FlightResource::collection($flights);
}
/**
* Output the flight briefing from simbrief or whatever other format
*
* @param string $id The flight ID
*
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
*/
public function briefing($id)
{
$user = Auth::user();
$w = [
'user_id' => $user->id,
'flight_id' => $id,
];
$simbrief = SimBrief::where($w)->first();
if ($simbrief === null) {
throw new AssetNotFound(new Exception('Flight briefing not found'));
}
return response($simbrief->acars_xml, 200, [
'Content-Type' => 'application/xml',
]);
}
/**
* Get a flight's route
*

View File

@ -3,10 +3,10 @@
namespace App\Http\Controllers\Api;
use App\Contracts\Controller;
use App\Exceptions\AircraftNotAtAirport;
use App\Events\PirepPrefiled;
use App\Events\PirepUpdated;
use App\Exceptions\AircraftPermissionDenied;
use App\Exceptions\PirepCancelled;
use App\Exceptions\UserNotAtAirport;
use App\Http\Requests\Acars\CommentRequest;
use App\Http\Requests\Acars\FieldsRequest;
use App\Http\Requests\Acars\FileRequest;
@ -20,7 +20,6 @@ use App\Http\Resources\PirepComment as PirepCommentResource;
use App\Http\Resources\PirepFieldCollection;
use App\Models\Acars;
use App\Models\Enums\AcarsType;
use App\Models\Enums\FlightType;
use App\Models\Enums\PirepFieldSource;
use App\Models\Enums\PirepSource;
use App\Models\Enums\PirepState;
@ -111,7 +110,7 @@ class PirepController extends Controller
protected function checkCancelled(Pirep $pirep)
{
if ($pirep->cancelled) {
throw new PirepCancelled();
throw new PirepCancelled($pirep);
}
}
@ -163,13 +162,27 @@ class PirepController extends Controller
}
/**
* @param $pirep_id
* @param string $id The PIREP ID
*
* @return PirepResource
*/
public function get($pirep_id)
public function get($id)
{
return new PirepResource($this->pirepRepo->find($pirep_id));
$with = [
'acars',
'arr_airport',
'dpt_airport',
'comments',
'flight',
'simbrief',
'user',
];
$pirep = $this->pirepRepo
->with($with)
->find($id);
return new PirepResource($pirep);
}
/**
@ -197,49 +210,9 @@ class PirepController extends Controller
$user = Auth::user();
$attrs = $this->parsePirep($request);
$attrs['user_id'] = $user->id;
$attrs['source'] = PirepSource::ACARS;
$attrs['state'] = PirepState::IN_PROGRESS;
if (!array_key_exists('status', $attrs)) {
$attrs['status'] = PirepStatus::INITIATED;
}
$pirep = new Pirep($attrs);
// See if this user is at the current airport
/* @noinspection NotOptimalIfConditionsInspection */
if (setting('pilots.only_flights_from_current')
&& $user->curr_airport_id !== $pirep->dpt_airport_id) {
throw new UserNotAtAirport($user, $pirep->dpt_airport);
}
// See if this user is allowed to fly this aircraft
if (setting('pireps.restrict_aircraft_to_rank', false)
&& !$this->userSvc->aircraftAllowed($user, $pirep->aircraft_id)) {
throw new AircraftPermissionDenied($user, $pirep->aircraft);
}
// See if this aircraft is at the departure airport
/* @noinspection NotOptimalIfConditionsInspection */
if (setting('pireps.only_aircraft_at_dpt_airport')
&& $pirep->aircraft_id !== $pirep->dpt_airport_id) {
throw new AircraftNotAtAirport($pirep->aircraft);
}
// Find if there's a duplicate, if so, let's work on that
$dupe_pirep = $this->pirepSvc->findDuplicate($pirep);
if ($dupe_pirep !== false) {
$pirep = $dupe_pirep;
$this->checkCancelled($pirep);
}
// Default to a scheduled passenger flight
if (!array_key_exists('flight_type', $attrs)) {
$attrs['flight_type'] = FlightType::SCHED_PAX;
}
$pirep->save();
$pirep = $this->pirepSvc->prefile($user, $attrs);
Log::info('PIREP PREFILED');
Log::info($pirep->id);
@ -247,7 +220,9 @@ class PirepController extends Controller
$this->updateFields($pirep, $request);
$this->updateFares($pirep, $request);
return new PirepResource($pirep);
event(new PirepPrefiled($pirep));
return $this->get($pirep->id);
}
/**
@ -291,7 +266,9 @@ class PirepController extends Controller
$this->updateFields($pirep, $request);
$this->updateFares($pirep, $request);
return new PirepResource($pirep);
event(new PirepUpdated($pirep));
return $this->get($pirep->id);
}
/**
@ -354,7 +331,7 @@ class PirepController extends Controller
$this->pirepSvc->submit($pirep);
return new PirepResource($pirep);
return $this->get($pirep->id);
}
/**
@ -494,7 +471,7 @@ class PirepController extends Controller
{
$pirep = Pirep::find($id);
return AcarsRouteResource::collection(Acars::where([
return AcarsRouteResource::collection(Acars::with('pirep')->where([
'pirep_id' => $id,
'type' => AcarsType::ROUTE,
])->orderBy('order', 'asc')->get());
@ -536,8 +513,12 @@ class PirepController extends Controller
$position['pirep_id'] = $id;
$position['type'] = AcarsType::ROUTE;
$acars = Acars::create($position);
$acars->save();
if (isset($position['id'])) {
Acars::updateOrInsert(['id' => $position['id']], $position);
} else {
$acars = Acars::create($position);
$acars->save();
}
$count++;
}

View File

@ -77,7 +77,7 @@ class UserController extends Controller
*/
public function index(Request $request)
{
return new UserResource(Auth::user());
return $this->get(Auth::user()->id);
}
/**
@ -89,7 +89,11 @@ class UserController extends Controller
*/
public function get($id)
{
return new UserResource($this->userRepo->find($id));
$user = $this->userRepo
->with(['airline', 'bids', 'rank'])
->find($id);
return new UserResource($user);
}
/**

View File

@ -3,7 +3,7 @@
namespace App\Http\Controllers\Auth;
use App\Contracts\Controller;
use App\Facades\Utils;
use App\Http\Requests\CreateUserRequest;
use App\Models\Enums\UserState;
use App\Models\User;
use App\Repositories\AirlineRepository;
@ -59,7 +59,7 @@ class RegisterController extends Controller
*/
public function showRegistrationForm()
{
$airports = $this->airportRepo->selectBoxList(false, true);
$airports = $this->airportRepo->selectBoxList(false, setting('pilots.home_hubs_only'));
$airlines = $this->airlineRepo->selectBoxList();
return view('auth.register', [
@ -81,7 +81,7 @@ class RegisterController extends Controller
{
$rules = [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'email' => 'required|email|max:255|unique:users, email',
'airline_id' => 'required',
'home_airport_id' => 'required',
'password' => 'required|min:5|confirmed',
@ -98,30 +98,24 @@ class RegisterController extends Controller
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @param array $opts
*
* @throws \RuntimeException
* @throws \Exception
*
* @return User
*/
protected function create(array $data)
protected function create(array $opts)
{
// Default options
$opts = array_merge([
'api_key' => Utils::generateApiKey(),
], $data);
$opts['curr_airport_id'] = $data['home_airport_id'];
$opts['password'] = Hash::make($data['password']);
$opts['password'] = Hash::make($opts['password']);
// Convert transfer hours into minutes
if (isset($opts['transfer_time'])) {
$opts['transfer_time'] *= 60;
}
$user = User::create($opts);
$user = $this->userService->createUser($user);
$user = $this->userService->createUser($opts);
Log::info('User registered: ', $user->toArray());
@ -137,26 +131,8 @@ class RegisterController extends Controller
*
* @return mixed
*/
public function register(Request $request)
public function register(CreateUserRequest $request)
{
$rules = [
'name' => 'required',
'email' => 'required|email|unique:users,email',
'airline_id' => 'required',
'home_airport_id' => 'required',
'password' => 'required|confirmed',
'timezone' => 'required',
'country' => 'required',
'transfer_time' => 'integer|min:0',
'toc_accepted' => 'accepted',
];
if (config('captcha.enabled')) {
$rules['g-recaptcha-response'] = 'required|captcha';
}
$this->validate(request(), $rules);
$user = $this->create($request->all());
if ($user->state === UserState::PENDING) {
return view('auth.pending');

View File

@ -9,11 +9,12 @@ use App\Repositories\AirportRepository;
use App\Repositories\Criteria\WhereCriteria;
use App\Repositories\FlightRepository;
use App\Repositories\SubfleetRepository;
use App\Repositories\UserRepository;
use App\Services\GeoService;
use Flash;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Laracasts\Flash\Flash;
use Prettus\Repository\Criteria\RequestCriteria;
use Prettus\Repository\Exceptions\RepositoryException;
@ -24,28 +25,30 @@ class FlightController extends Controller
private $flightRepo;
private $subfleetRepo;
private $geoSvc;
private $userRepo;
/**
* FlightController constructor.
*
* @param AirlineRepository $airlineRepo
* @param AirportRepository $airportRepo
* @param FlightRepository $flightRepo
* @param GeoService $geoSvc
* @param SubfleetRepository $subfleetRepo
* @param UserRepository $userRepo
*/
public function __construct(
AirlineRepository $airlineRepo,
AirportRepository $airportRepo,
FlightRepository $flightRepo,
GeoService $geoSvc,
SubfleetRepository $subfleetRepo
SubfleetRepository $subfleetRepo,
UserRepository $userRepo
) {
$this->airlineRepo = $airlineRepo;
$this->airportRepo = $airportRepo;
$this->flightRepo = $flightRepo;
$this->geoSvc = $geoSvc;
$this->subfleetRepo = $subfleetRepo;
$this->userRepo = $userRepo;
}
/**
@ -114,6 +117,8 @@ class FlightController extends Controller
'arr_icao' => $request->input('arr_icao'),
'dep_icao' => $request->input('dep_icao'),
'subfleet_id' => $request->input('subfleet_id'),
'simbrief' => !empty(setting('simbrief.api_key')),
'simbrief_bids' => setting('simbrief.only_bids'),
]);
}
@ -126,17 +131,25 @@ class FlightController extends Controller
*/
public function bids(Request $request)
{
$user = Auth::user();
$user = $this->userRepo
->with(['bids', 'bids.flight'])
->find(Auth::user()->id);
$flights = $user->flights()->paginate();
$saved_flights = $flights->pluck('id')->toArray();
$flights = collect();
$saved_flights = [];
foreach ($user->bids as $bid) {
$flights->add($bid->flight);
$saved_flights[] = $bid->flight->id;
}
return view('flights.index', [
'title' => trans_choice('flights.mybid', 2),
'airlines' => $this->airlineRepo->selectBoxList(true),
'airports' => $this->airportRepo->selectBoxList(true),
'flights' => $flights,
'saved' => $saved_flights,
return view('flights.bids', [
'airlines' => $this->airlineRepo->selectBoxList(true),
'airports' => $this->airportRepo->selectBoxList(true),
'flights' => $flights,
'saved' => $saved_flights,
'subfleets' => $this->subfleetRepo->selectBoxList(true),
'simbrief' => !empty(setting('simbrief.api_key')),
'simbrief_bids' => setting('simbrief.only_bids'),
]);
}

View File

@ -5,11 +5,8 @@ namespace App\Http\Controllers\Frontend;
use App\Contracts\Controller;
use App\Models\User;
use Illuminate\Database\QueryException;
use Log;
use Illuminate\Support\Facades\Log;
/**
* Class HomeController
*/
class HomeController extends Controller
{
/**

View File

@ -0,0 +1,38 @@
<?php
namespace App\Http\Controllers\Frontend;
use App\Contracts\Controller;
use App\Exceptions\PageNotFound;
use App\Repositories\PageRepository;
use Exception;
class PageController extends Controller
{
private $pageRepo;
/**
* @param \App\Repositories\PageRepository $pageRepo
*/
public function __construct(PageRepository $pageRepo)
{
$this->pageRepo = $pageRepo;
}
/**
* Show the page
*
* @param $slug
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function show($slug)
{
$page = $this->pageRepo->findWhere(['slug' => $slug])->first();
if (!$page) {
throw new PageNotFound(new Exception('Page not found'));
}
return view('pages.index', ['page' => $page]);
}
}

View File

@ -3,13 +3,13 @@
namespace App\Http\Controllers\Frontend;
use App\Contracts\Controller;
use App\Facades\Utils;
use App\Http\Requests\CreatePirepRequest;
use App\Http\Requests\UpdatePirepRequest;
use App\Models\Enums\PirepSource;
use App\Models\Enums\PirepState;
use App\Models\Enums\PirepStatus;
use App\Models\Pirep;
use App\Models\SimBrief;
use App\Repositories\AircraftRepository;
use App\Repositories\AirlineRepository;
use App\Repositories\AirportRepository;
@ -20,6 +20,7 @@ use App\Repositories\PirepRepository;
use App\Services\FareService;
use App\Services\GeoService;
use App\Services\PirepService;
use App\Services\SimBriefService;
use App\Services\UserService;
use App\Support\Units\Fuel;
use App\Support\Units\Time;
@ -29,9 +30,6 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Laracasts\Flash\Flash;
/**
* Class PirepController
*/
class PirepController extends Controller
{
private $aircraftRepo;
@ -200,7 +198,7 @@ class PirepController extends Controller
*/
public function show($id)
{
$pirep = $this->pirepRepo->find($id);
$pirep = $this->pirepRepo->with(['simbrief'])->find($id);
if (empty($pirep)) {
Flash::error('Pirep not found');
return redirect(route('frontend.pirep.index'));
@ -246,10 +244,20 @@ class PirepController extends Controller
// See if request has a ?flight_id, so we can pre-populate the fields from the flight
// Makes filing easier, but we can also more easily find a bid and close it
if ($request->has('flight_id')) {
$flight = $this->flightRepo->find($request->get('flight_id'));
$flight = $this->flightRepo->find($request->input('flight_id'));
$pirep = Pirep::fromFlight($flight);
}
/**
* They have a SimBrief ID, load that up and figure out the flight that it's from
*/
$simbrief_id = null;
if ($request->has('sb_id')) {
$simbrief_id = $request->input('sb_id');
$brief = SimBrief::find($simbrief_id);
$pirep = Pirep::fromSimBrief($brief);
}
return view('pireps.create', [
'aircraft' => null,
'pirep' => $pirep,
@ -259,6 +267,7 @@ class PirepController extends Controller
'airport_list' => $this->airportRepo->selectBoxList(true),
'pirep_fields' => $this->pirepFieldRepo->all(),
'field_values' => [],
'simbrief_id' => $simbrief_id,
]);
}
@ -324,7 +333,7 @@ class PirepController extends Controller
// Any special fields
$hours = (int) $request->input('hours', 0);
$minutes = (int) $request->input('minutes', 0);
$pirep->flight_time = Utils::hoursToMinutes($hours) + $minutes;
$pirep->flight_time = Time::hoursToMinutes($hours) + $minutes;
// Set the correct fuel units
$pirep->block_fuel = new Fuel((float) $request->input('block_fuel'), setting('units.fuel'));
@ -339,6 +348,15 @@ class PirepController extends Controller
$this->saveFares($pirep, $request);
$this->pirepSvc->saveRoute($pirep);
if ($request->has('sb_id')) {
$brief = SimBrief::find($request->input('sb_id'));
if ($brief !== null) {
/** @var SimBriefService $sbSvc */
$sbSvc = app(SimBriefService::class);
$sbSvc->attachSimbriefToPirep($pirep, $brief);
}
}
// Depending on the button they selected, set an initial state
// Can be saved as a draft or just submitted
if ($attrs['submit'] === 'save') {
@ -376,6 +394,11 @@ class PirepController extends Controller
$pirep->aircraft->load('subfleet.fares');
}
$simbrief_id = null;
if ($pirep->simbrief) {
$simbrief_id = $pirep->simbrief->id;
}
$time = new Time($pirep->flight_time);
$pirep->hours = $time->hours;
$pirep->minutes = $time->minutes;
@ -403,6 +426,7 @@ class PirepController extends Controller
'airline_list' => $this->airlineRepo->selectBoxList(),
'airport_list' => $this->airportRepo->selectBoxList(),
'pirep_fields' => $this->pirepFieldRepo->all(),
'simbrief_id' => $simbrief_id,
]);
}

View File

@ -3,13 +3,13 @@
namespace App\Http\Controllers\Frontend;
use App\Contracts\Controller;
use App\Facades\Utils;
use App\Models\User;
use App\Repositories\AirlineRepository;
use App\Repositories\AirportRepository;
use App\Repositories\UserRepository;
use App\Support\Countries;
use App\Support\Timezonelist;
use App\Support\Utils;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
@ -79,7 +79,7 @@ class ProfileController extends Controller
/**
* @param $id
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
* @return mixed
*/
public function show($id)
{

View File

@ -0,0 +1,166 @@
<?php
namespace App\Http\Controllers\Frontend;
use App\Exceptions\AssetNotFound;
use App\Models\SimBrief;
use App\Repositories\FlightRepository;
use App\Services\SimBriefService;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class SimBriefController
{
private $flightRepo;
private $simBriefSvc;
public function __construct(FlightRepository $flightRepo, SimBriefService $simBriefSvc)
{
$this->flightRepo = $flightRepo;
$this->simBriefSvc = $simBriefSvc;
}
/**
* Show the main OFP form
*
* @param Request $request
*
* @throws \Exception
*
* @return mixed
*/
public function generate(Request $request)
{
$flight_id = $request->input('flight_id');
$flight = $this->flightRepo->find($flight_id);
if (!$flight) {
flash()->error('Unknown flight');
return redirect(route('frontend.flights.index'));
}
$apiKey = setting('simbrief.api_key');
if (empty($apiKey)) {
flash()->error('Invalid SimBrief API key!');
return redirect(route('frontend.flights.index'));
}
$user = Auth::user();
$simbrief = SimBrief::select('id')->where([
'flight_id' => $flight_id,
'user_id' => $user->id,
])->first();
if ($simbrief) {
return redirect(route('frontend.simbrief.briefing', [$simbrief->id]));
}
return view('flights.simbrief_form', [
'flight' => $flight,
]);
}
/**
* Show the briefing
*
* @param string $id The OFP ID
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
*/
public function briefing($id)
{
$simbrief = SimBrief::find($id);
if (!$simbrief) {
flash()->error('SimBrief briefing not found');
return redirect(route('frontend.flights.index'));
}
return view('flights.simbrief_briefing', [
'simbrief' => $simbrief,
]);
}
/**
* Create a prefile of this PIREP with a given OFP. Then redirect the
* user to the newly prefiled PIREP
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function prefile(Request $request)
{
$sb = SimBrief::find($request->id);
if (!$sb) {
return redirect(route('frontend.flights.index'));
}
// Redirect to the prefile page, with the flight_id and a simbrief_id
$rd = route('frontend.pireps.create').'?sb_id='.$sb->id;
return redirect($rd);
}
/**
* Cancel the SimBrief request
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function cancel(Request $request)
{
$sb = SimBrief::find($request->id);
if (!$sb) {
$sb->delete();
}
return redirect(route('frontend.simbrief.prefile', ['id' => $request->id]));
}
/**
* Check whether the OFP was generated. Pass in two items, the flight_id and ofp_id
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\JsonResponse
*/
public function check_ofp(Request $request)
{
$ofp_id = $request->input('ofp_id');
$flight_id = $request->input('flight_id');
$simbrief = $this->simBriefSvc->checkForOfp(Auth::user()->id, $ofp_id, $flight_id);
if ($simbrief === null) {
$error = new AssetNotFound(new Exception('Simbrief OFP not found'));
return $error->getResponse();
}
return response()->json([
'id' => $simbrief->id,
]);
}
/**
* Generate the API code
*
* @param \Illuminate\Http\Request $request
*
* @throws \Exception
*
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function api_code(Request $request)
{
$apiKey = setting('simbrief.api_key', null);
if (empty($apiKey)) {
flash()->error('Invalid SimBrief API key!');
return redirect(route('frontend.flights.index'));
}
$api_code = md5($apiKey.$request->input('api_req'));
return response()->json([
'api_code' => $api_code,
]);
}
}

View File

@ -7,24 +7,19 @@ use App\Models\Enums\UserState;
use App\Repositories\Criteria\WhereCriteria;
use App\Repositories\UserRepository;
use Illuminate\Http\Request;
use Log;
use Illuminate\Support\Facades\Log;
use League\ISO3166\ISO3166;
use Prettus\Repository\Exceptions\RepositoryException;
/**
* Class UserController
*/
class UserController extends Controller
{
private $userRepo;
/**
* UserController constructor.
*
* @param UserRepository $userRepo
*/
public function __construct(
UserRepository $userRepo
) {
public function __construct(UserRepository $userRepo)
{
$this->userRepo = $userRepo;
}
@ -49,11 +44,11 @@ class UserController extends Controller
$users = $this->userRepo
->with(['airline', 'current_airport'])
->orderBy('name', 'desc')
->orderBy('pilot_id', 'asc')
->paginate();
return view('users.index', [
'country' => new \League\ISO3166\ISO3166(),
'country' => new ISO3166(),
'users' => $users,
]);
}

View File

@ -7,6 +7,8 @@ use App\Http\Middleware\EncryptCookies;
use App\Http\Middleware\InstalledCheck;
use App\Http\Middleware\JsonResponse;
use App\Http\Middleware\RedirectIfAuthenticated;
use App\Http\Middleware\SetActiveTheme;
use App\Http\Middleware\TrustProxies;
use App\Http\Middleware\UpdatePending;
use Illuminate\Auth\Middleware\Authenticate;
use Illuminate\Auth\Middleware\Authorize;
@ -23,6 +25,7 @@ use Illuminate\View\Middleware\ShareErrorsFromSession;
class Kernel extends HttpKernel
{
protected $middleware = [
TrustProxies::class,
CheckForMaintenanceMode::class,
TrimStrings::class,
ConvertEmptyStringsToNull::class,
@ -52,6 +55,7 @@ class Kernel extends HttpKernel
'can' => Authorize::class,
'guest' => RedirectIfAuthenticated::class,
'json' => JsonResponse::class,
'theme' => SetActiveTheme::class,
'throttle' => ThrottleRequests::class,
'update_pending' => UpdatePending::class,
];

View File

@ -23,7 +23,7 @@ class InstalledCheck implements Middleware
&& !$request->is(['install', 'install/*'])
&& !$request->is(['update', 'update/*'])
) {
return view('system.errors.not_installed');
return response(view('system.errors.not_installed'));
}
return $next($request);

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
/**
* Set the client as trusted
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
$request->setTrustedProxies([$request->getClientIp()], $this->getTrustedHeaderNames());
$this->setTrustedProxyIpAddresses($request);
return $next($request);
}
}

View File

@ -8,11 +8,9 @@ class CommentRequest extends FormRequest
{
public function rules(): array
{
$rules = [
return [
'comment' => 'required',
'created_at' => 'sometimes|date',
];
return $rules;
}
}

View File

@ -4,9 +4,6 @@ namespace App\Http\Requests\Acars;
use App\Contracts\FormRequest;
/**
* Class PrefileRequest
*/
class FieldsRequest extends FormRequest
{
public function rules(): array

View File

@ -16,7 +16,7 @@ class FileRequest extends FormRequest
public function rules(): array
{
$rules = [
return [
'distance' => 'required|numeric',
'flight_time' => 'required|integer',
'fuel_used' => 'required|numeric',
@ -25,8 +25,8 @@ class FileRequest extends FormRequest
'aircraft_id' => 'sometimes|exists:aircraft,id',
'flight_number' => 'sometimes',
'flight_type' => 'sometimes',
'dpt_airport_id' => 'sometimes|size:4',
'arr_airport_id' => 'sometimes|size:4',
'dpt_airport_id' => 'sometimes',
'arr_airport_id' => 'sometimes',
'route_code' => 'sometimes',
'route_leg' => 'sometimes',
'planned_distance' => 'sometimes|numeric',
@ -48,7 +48,5 @@ class FileRequest extends FormRequest
'fares.*.id' => 'required',
'fares.*.count' => 'required|numeric',
];
return $rules;
}
}

View File

@ -16,14 +16,12 @@ class LogRequest extends FormRequest
public function rules(): array
{
$rules = [
return [
'logs' => 'required|array',
'logs.*.log' => 'required',
'logs.*.lat' => 'sometimes|numeric',
'logs.*.lon' => 'sometimes|numeric',
'logs.*.created_at' => 'sometimes|date',
];
return $rules;
}
}

View File

@ -19,7 +19,7 @@ class PositionRequest extends FormRequest
public function rules(): array
{
$rules = [
return [
'positions' => 'required|array',
'positions.*.lat' => 'required|numeric',
'positions.*.lon' => 'required|numeric',
@ -36,7 +36,5 @@ class PositionRequest extends FormRequest
'positions.*.sim_time' => 'sometimes|date',
'positions.*.created_at' => 'sometimes|date',
];
return $rules;
}
}

View File

@ -8,15 +8,15 @@ class PrefileRequest extends FormRequest
{
public function rules(): array
{
$rules = [
return [
'airline_id' => 'required|exists:airlines,id',
'aircraft_id' => 'required|exists:aircraft,id',
'flight_id' => 'sometimes|exists:flights,id',
'flight_number' => 'required',
'dpt_airport_id' => 'required|size:4',
'arr_airport_id' => 'required|size:4',
'dpt_airport_id' => 'required',
'arr_airport_id' => 'required',
'source_name' => 'required',
'alt_airport_id' => 'sometimes|size:4',
'alt_airport_id' => 'sometimes',
'status' => 'sometimes',
'level' => 'nullable|numeric',
'flight_type' => 'sometimes',
@ -41,7 +41,5 @@ class PrefileRequest extends FormRequest
'fares.*.id' => 'required',
'fares.*.count' => 'required|numeric',
];
return $rules;
}
}

View File

@ -16,7 +16,7 @@ class RouteRequest extends FormRequest
public function rules(): array
{
$rules = [
return [
'route' => 'required|array',
'route.*.name' => 'required',
'route.*.order' => 'required|int',
@ -24,7 +24,5 @@ class RouteRequest extends FormRequest
'route.*.lat' => 'required|numeric',
'route.*.lon' => 'required|numeric',
];
return $rules;
}
}

View File

@ -16,13 +16,13 @@ class UpdateRequest extends FormRequest
public function rules(): array
{
$rules = [
return [
'airline_id' => 'nullable|exists:airlines,id',
'aircraft_id' => 'nullable|exists:aircraft,id',
'flight_id' => 'sometimes|nullable|exists:flights,id',
'flight_number' => 'sometimes|required',
'dpt_airport_id' => 'sometimes|required|size:4',
'arr_airport_id' => 'sometimes|required|size:4',
'dpt_airport_id' => 'sometimes|required',
'arr_airport_id' => 'sometimes|required',
'route_code' => 'nullable',
'route_leg' => 'nullable',
'distance' => 'sometimes|numeric',
@ -50,7 +50,5 @@ class UpdateRequest extends FormRequest
'fares.*.id' => 'required',
'fares.*.count' => 'required|numeric',
];
return $rules;
}
}

View File

@ -2,8 +2,8 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Aircraft;
use Illuminate\Foundation\Http\FormRequest;
class CreateAircraftRequest extends FormRequest
{

View File

@ -2,17 +2,12 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Airline;
use Illuminate\Foundation\Http\FormRequest;
class CreateAirlineRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
public function rules(): array
{
$rules = Airline::$rules;
$rules['iata'] .= '|unique:airlines';

View File

@ -2,24 +2,11 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Airport;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class CreateAirportRequest
*/
class CreateAirportRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*

View File

@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Award;
use Illuminate\Foundation\Http\FormRequest;
class CreateAwardRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Award::$rules;
}

View File

@ -2,21 +2,11 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Fare;
use Illuminate\Foundation\Http\FormRequest;
class CreateFareRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*

View File

@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Flight;
use Illuminate\Foundation\Http\FormRequest;
class CreateFlightRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Flight::$rules;
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Page;
class CreatePageRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return Page::$rules;
}
}

View File

@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\PirepField;
use Illuminate\Foundation\Http\FormRequest;
class CreatePirepFieldRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return PirepField::$rules;
}

View File

@ -2,29 +2,18 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Pirep;
use App\Repositories\PirepFieldRepository;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
class CreatePirepRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
// Don't run validations if it's just being saved
$action = strtolower(request('submit', 'submit'));

View File

@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Rank;
use Illuminate\Foundation\Http\FormRequest;
class CreateRankRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Rank::$rules;
}

View File

@ -2,16 +2,11 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Role;
use Illuminate\Foundation\Http\FormRequest;
class CreateRoleRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return Role::$rules;

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