Compare commits

...

170 Commits

Author SHA1 Message Date
nabeelio
db34d0e3e7 Add test for METAR string 2021-03-15 09:14:39 -04:00
Nabeel S
fffbab7201 Merge branch 'dev' into patch-2 2021-03-15 08:30:29 -04:00
exciler
b9e7a2efc9 Add unit conversion handling for block_fuel like for fuel_used (#1076)
* Add unit conversion handling for block_fuel like for fuel_used, add further checks in PIREPTest->testUnitFields

* Remove accidentially added "use"

Co-authored-by: Andreas Palm <ap@ewsp.de>
2021-03-15 08:30:14 -04:00
B.Fatih KOZ
76a2a16fa6 Merge branch 'dev' into patch-2 2021-03-14 03:54:53 +03:00
Nabeel Shahzad
73f88fce0c Fix permissions with modules 2021-03-13 18:31:09 -05:00
B.Fatih KOZ
cfbd1c901a Merge branch 'dev' into patch-2 2021-03-10 04:53:25 +03:00
Nabeel S
e70ee5aa6f Add web cron ability #821 (#1073)
* Use database for kvp storage

* Read kvpstore

* Add web cron ability through API #821

* Style fixes

* Fix text
2021-03-09 11:36:56 -05:00
B.Fatih KOZ
617813bdbf Fix Metar Decoding / Wind check for Wind Chill
PR aims to fix the bug #1071 by checking both the wind speed and it's value for starting Wind Chill calculation.
2021-03-09 16:06:39 +03:00
nabeelio
f1c54bcc7c Add Postmark package #1067 2021-03-08 11:35:11 -05:00
nabeelio
d94d754961 Block user if they're not active #1066 2021-03-08 11:24:09 -05:00
nabeelio
9abfbd6c8c Remove unneeded import #1066 2021-03-08 11:21:55 -05:00
nabeelio
97fc1dd43d Don't block API logins #1066 2021-03-08 11:19:31 -05:00
Nabeel Shahzad
edc37f40fa Show either create/view simbrief button, not both 2021-03-06 16:48:50 -05:00
Nabeel S
950c7788be Restrict Simbrief to user who generated it (#1064)
* Restrict simbrief to user

* Style fixes

* Add tests

* Style fix
2021-03-06 13:49:42 -05:00
nabeelio
b3af50ac5a Add ignored solution provider 2021-03-05 08:00:34 -05:00
nabeelio
8a9b68d9ec Disable ignition runnable solutions 2021-03-05 07:59:50 -05:00
nabeelio
70a4cf9f90 Remove the laravel-backup library 2021-03-05 07:33:42 -05:00
Nabeel Shahzad
c3465851b2 Rename backups folder 2021-03-05 06:24:23 -05:00
Nabeel Shahzad
b13c4df338 laravel-backup changes 2021-03-05 06:00:36 -05:00
Nabeel Shahzad
c736a9b639 Disable encryption by default for backups 2021-03-05 05:44:04 -05:00
nabeelio
d2e1004e08 Undo composer downgrades 2021-03-04 17:17:39 -05:00
Nabeel S
3800c01d94 Update to Laravel 8 (#1058)
* Update Laravel and other dependencies

* Composer version in CI

* Remove the PHP exit from env file

* Add PHP 8 to testing matrix

* Update doctrine

* Update doctrine

* Update faker lib

* Rewrite TLD check to remove deprecated library

* Update version lib

* Remove PHP 8 for now

* Style fixes
2021-03-04 17:08:51 -05:00
Nabeel S
922e754c9e Check for valid reference object in recurring finance (#1056) 2021-03-02 16:19:54 -05:00
Nabeel S
936cd2efd3 Implement PIREP deletion #1014 (#1055)
* Implement PIREP deletion #1014

* Style fixes

* Add delete button to PIREP listing page

* Remove extra import
2021-03-02 15:43:34 -05:00
Nabeel S
e22d6d5996 Refactoring Simbrief fares and aircraft (#1054)
* Refactoring simbrief fares and aircraft

* Hide user full name/email

* Sort PIREP fields desc; fix cargo counts

* Change the sorting

* Extra logs

* Fix tests

* Return fare information through the API

* Style fixes

* Test fix

* Another test fix

* More fixes

* Set aircraft and fares in prefile

* Formatting
2021-03-02 12:29:04 -05:00
B.Fatih KOZ
efcb7e8895 Fix Advanced Fuel Calculations (#1053)
Due to an error on the settings check advanced fuel calculations was not working and defaulting to fuel used always.
2021-03-01 15:03:27 -05:00
Nabeel S
43fbe9e943 Update composer dependencies (#1047) 2021-02-26 12:23:50 -05:00
nabeelio
8fc0aec800 Set cache driver to array for tests 2021-02-25 13:50:37 -05:00
Nabeel Shahzad
bb84fa82a4 Default to file storage for sesions 2021-02-24 13:37:46 -05:00
B.Fatih KOZ
4fe323a763 Advanced Fuel Calculations (#1044)
* Advanced Fuel Calculations

PR aims to have realistic fuel debit calculations as in the real ops. When enabled, remaining fuel amounts from previous flight will be reduced from block fuel and airline will only pay for uplifted fuel amount.

If onboard fuel is enough for the flight or exceeds the required amount no fuel debit will be issued.

If this is the first flight of the aircraft or the tanks are dry, full block fuel will be treated as uplifted.

Disabled / uses current default (fuel_used will be debited)

Aircraft table also will hold the fuel_onboard value (not needed for calculations, just saving for displaying purposes)

* Style Fix

* Another Style Fix

Love StyleCi

* Fix Settings

Moved new setting under other pirep settings

* Fix Setting Check

* Fix EOF settings.yml

* Fix Settings
2021-02-24 12:22:52 -05:00
B.Fatih KOZ
e3b4a0ed2e SimBrief integration enhancements (#1045)
* SimBrief Integration Update

* Added SimBrief Type field to subfleets, can be used to assign simbrief airframes to subfleets and fix non existing or wrong types. If not used simbrief form will use aircraft's icao type code

* Added Passenger and Baggage weights to settings

* Added setting for using PhpVms Pilot/User  Ident as simbrief atc callsign

* SimBrief form code cleaned up a bit and improved. Now form supports both cargo and passenger fares to be used at the same time.

Generated passenger baggage weight will be reduced from aircraft's cargo capacity and remaining amount will be used for random cargo generation.

Also multiple cargo fares or any mix is possible now (like only cargo, only passenger, multiple cargo and passenger fares)

* StyleFix (SimBrief Controller)

* Fix Callsign Setting Check

* Code Cleanup

Reduced loops and removed if's in loops, getting fares from aircraft instead of flight/subfleets.

No need to go through getReconciledFaresForFlight anymore. Aircraft provides all fare info we need.

Removed unnecessary html elements, added some comments.

* Update Simbrief Controller

Fixed setting checks.

Removed non used $subfleet and from main form and $aircraft from aircraft selection form blade.

Added/fixed comments.

* StyleFix for Controller
2021-02-24 09:32:29 -05:00
Nabeel Shahzad
a4c431d39f Set missing value from default 2021-02-23 11:25:06 -05:00
Nabeel Shahzad
a52e0410a7 Force default to the value when syncing settings 2021-02-23 11:23:40 -05:00
B.Fatih KOZ
baf63361a0 Fix findUsersOnleave Function (#1042)
Query was checking status field instead of state field to find active users.
2021-02-22 11:23:50 -05:00
B.Fatih KOZ
b4d5c0fbcd Weather METAR/TAF enhancements (#964)
* Update AviationWeather.php

Added the ability to fetch latest TAF report of given icao from ADDS/NOAA

* Update Weather.php

Used updated Metar\AviationWeather service to improve the widget ability and provide raw TAF data for the view

* Style Fix 1

* Update weather.blade.php

Updated blade to match updated Metar\AviationWeather service and the Weather widget controller.

Also fixed the order of temp - dewpoint - humidity - visibility display according to aviation usage.

Widget now displays raw TAF data just below raw METAR data.

* Update Metar inferface and wrap TAF retrieval in cache

* Styles fix

* Add call to getTaf. Don't call AviationWeather directly

* Fix cache lookup strings

* Fix recursion error

* Update weather.blade.php

Used latest weather.blade , added $taf['raw'] after raw metar.

* Compatibility Update

Updated the widget controller to match latest dev (added raw_only to config)

* Update Weather Widget Blade

Made the widget blade compatible with the TAF reports, widget will display raw metar and taf after the decoder, if no metar or taf recieved it will be displayed in its own row. Also added the new option of raw_only to blade, if it is true, metar decoding will be skipped and only raw values will be displayed. ( Useful when displaying multiple wx widgets at the same page for departure, destination and alternate etc )

Co-authored-by: Nabeel Shahzad <nshahzad@live.com>
Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-02-19 12:45:39 -05:00
B.Fatih KOZ
6b7eab05e2 Assign subfleets from ranks when there are no subfleets on a flight
If no subfleets are assigned to a flight, vmsacars was not allowing the flight to be loaded and used 'cause the subfleets was returning null. With this pr, users will be able to use the aircrafts which they have access to by their ranks. ( Same logic was used in SimBrief Controller to populate the aircraft list for flight plan generation )

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-02-19 08:20:17 -05:00
Jannis D
4c8e31ac6f Update installer.php (#1038)
Co-authored-by: Jannis D <Mail@JannisD.de>
2021-02-19 08:13:08 -05:00
B.Fatih KOZ
fe41e61c02 Fix for SimBrief VATSIM Prefile errors (#1037)
Speed is now checked and leading zero is removed, also changed the initial altitude to full feet value like 23000 instead of just 230.
2021-02-18 18:02:33 -05:00
Nabeel Shahzad
bd85a04530 Fix internal event for ON_LEAVE 2021-02-17 18:57:16 -05:00
Nabeel S
cbb7d6e274 Fix pilot leave calculation #1022 (#1035)
* Fix pilot leave calculation #1022

* Remove unused imports

* Add logging where fares are being saved
2021-02-17 18:54:18 -05:00
Nabeel Shahzad
8907527872 Remove invalid bids #1034 2021-02-17 18:03:07 -05:00
Nabeel Shahzad
942c060c99 Added opcache package 2021-02-17 14:44:41 -05:00
Nabeel Shahzad
68a9421445 Shrink backup sizes 2021-02-17 14:38:47 -05:00
Nabeel Shahzad
4e652c91ae Account for localhost/testing sites in domain checks 2021-02-13 15:59:19 -05:00
Nabeel Shahzad
a6f62045c4 Extend cron check for 12 hours 2021-02-13 15:17:16 -05:00
Nabeel Shahzad
3f3b63da6f Fix session database configuration 2021-02-12 11:43:00 -05:00
Nabeel Shahzad
dd7812e5c5 Undo primary idx change 2021-02-11 08:57:43 -05:00
Nabeel S
447d02bd4f Update the sessions table (#1030)
* Update the sessions table

* Add index on user_id
2021-02-11 08:50:49 -05:00
Nabeel Shahzad
be9b698f14 Merge branch 'dev' of https://github.com/nabeelio/phpvms into dev 2021-02-10 15:47:42 -05:00
Nabeel S
d110c2d951 ACARS table vs int to double (#1028)
* mail config - "driver" to "default"

* Change VS type from int to double

* Migration fix

* Fix type
2021-02-10 13:39:40 -05:00
Nabeel Shahzad
4d20998368 mail config - "driver" to "default" 2021-02-10 13:18:02 -05:00
Nabeel Shahzad
4a20b41b25 Rename driver to default in mail config 2021-02-10 13:15:18 -05:00
Olli
8c2513eb3d Update style.css for better mobile experience (#1018)
This edit hides the dropdown menu while being closed on mobile view
2021-02-05 08:38:32 -05:00
Nabeel Shahzad
2dbd58e59e Merge branch 'dev' of https://github.com/nabeelio/phpvms into dev 2021-02-04 14:54:20 -05:00
Nabeel Shahzad
bf77f7dd96 Add 'phase' as response output, deprecate "status" 2021-02-04 14:54:16 -05:00
B.Fatih KOZ
5a570989de Failsafe for SimBrief random pax generation (#1015)
* Failsafe for SimBrief random pax generation

PR fixes the problem for 0 load generation where va admins do not set load factor and variance values for their flights and also leave the general settings empty. In such cases, both loadmin and loadmax was returning 0 , resulting zero load.

Thanks @macofallico for figuring this out.

* StyleFix
2021-02-01 15:27:22 -05:00
B.Fatih KOZ
6b3207377a Fix Profile Fields (#1013)
* Fix Profile Fields

PR fixes two issues ;

1. Profile Fields not showing up on user profile
2. Profile Fields not showing up on user.profile.edit

Profile.index was looking for "public" to be true, while controller was sending "private" and it was not boolean.

Also profile controller was not sending the fields to the blade. Both fixed and working now

* Update index.blade.php
2021-01-28 08:31:29 -05:00
B.Fatih KOZ
ac1d5e1555 Fix PilotHoursAwards (#1011)
!is_int was causing the check always return false even when user enters a proper value like 6000 or 30000 in admin/award settings.

We should use !is_numeric instead to see if it is a valid numeric value.
2021-01-26 19:48:43 -05:00
B.Fatih KOZ
0d45fc287b AwardController text correction (#1010)
Fixed the flash message texts
2021-01-26 16:31:54 -05:00
B.Fatih KOZ
4911f6799d Fix for ACARS config download button not working #919 (#1009)
* Fix For Acars Config Download Button No Working Bug #919

PR fixes the Acars Config Download button not showing up at user profile.

Also fixes the problem where Generate New Api Key button not following user selections and generating a new key even if user clicks cancel.

* Style Fix for ? and !

Fix the typo :)
2021-01-25 16:04:43 -05:00
Nabeel Shahzad
5821067231 Default settings to false 2021-01-25 07:06:27 -05:00
Nabeel S
fc7ad7eb6a Simbrief attachment not working #1005 (#1006)
* Refactoring for Simbrief not working #1005

* Style fixes

* Update tests for new briefing URL

* Check the OFP user

* Comment out user check temporarily
2021-01-25 06:54:17 -05:00
Nabeel S
101b3261f5 Move loadmin/max into the controller (#1003) 2021-01-22 09:02:15 -05:00
Nabeel Shahzad
fb0027b140 Update Discord message 2021-01-22 08:38:54 -05:00
Nabeel Shahzad
066702e490 Switch to http until I can get the certificates sorted 2021-01-22 08:30:25 -05:00
Nabeel Shahzad
b4e0515405 Add tar/zip reference to Discord build message 2021-01-22 08:29:22 -05:00
B.Fatih KOZ
f5ca8ce6e3 Fix For Load Factor and Variance Bug (#1002)
PR fixes the issue where load factor and variance being reported 0 to simbrief form, where user does not provide any values for each and wants to use general settings per flight.

Quick fix for issue #1001
2021-01-22 08:14:34 -05:00
Nabeel Shahzad
7e9196c7e6 Check if simbrief is valid 2021-01-21 11:57:44 -05:00
Nabeel S
a2916bf536 Cleanup visible flight logic (#1000)
* Cleanup visible flight logic

* Add transfer_time to API response
2021-01-21 11:11:11 -05:00
Nabeel Shahzad
0578f98b58 Force flight to visible before day checks 2021-01-21 10:57:51 -05:00
Nabeel Shahzad
2e0f0b00ef Ensure simbrief id is assigned 2021-01-21 09:21:39 -05:00
Daniel Ortez
d5d9010134 Fix error in webpack file (#994) 2021-01-20 09:24:27 -05:00
Nabeel Shahzad
bd8e13e78f Cleanup Simbrief Briefing pages 2021-01-17 21:52:22 -05:00
Nabeel Shahzad
c4dee07b7f Cleanup flight search code 2021-01-17 21:25:44 -05:00
dependabot[bot]
f8a44d8c6d Bump ini from 1.3.5 to 1.3.8 (#955)
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-01-17 16:01:04 -05:00
B.Fatih KOZ
617cea5df7 SimBrief Planning System Update (#991)
* SimBrief Planning System Update

Replaces outdated old pr.

Same improvements apply to both controller and simbrief_form.blade.

* Style Fix for SimBrief.Controller

* strict equals fix and some comments

changed equals to strict equals and put in some comments about the loadarray and manualrmk generation.

* Formatting/separate out secstohhmm

* Formatting

* Removed duplicates

We have the $wakecat, $equipment and $transponder in the controller, removed them from the blade.

Fixed a harmless typo in the IVAO Prefile DEPTIME line

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
Co-authored-by: Nabeel Shahzad <nabeel@nabeel.sh>
2021-01-17 15:59:32 -05:00
B.Fatih KOZ
3a99fe9e0e SimBrief Briefing Display Fix (#992)
Fixed Estimate Enroute Time (EET) display (it was using Scheduled Enroute Time)
2021-01-17 14:26:03 -05:00
B.Fatih KOZ
a952071cb4 Subfleet Hubs / Base Airports (#978)
* Update SubFleet Model

Add hub_id for storing subfleet's main base/hub airport, define a relationship with airport model to get details of the base/hub airport when needed.

* Update Admin / SubFleetController

Added the ability to read and pass hub airports to admin view for create/edit options.

* Update Admin/SubFleets.fields.blade

Added the dropdown for adding/editing main base/hub of a subfleet.

* Add migration for the hub_id column

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
Co-authored-by: Nabeel Shahzad <nshahzad@live.com>
2021-01-17 12:43:06 -05:00
dependabot[bot]
157e0d830c Bump axios from 0.18.1 to 0.21.1 (#979)
Bumps [axios](https://github.com/axios/axios) from 0.18.1 to 0.21.1.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v0.21.1/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.18.1...v0.21.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-01-17 12:27:54 -05:00
B.Fatih KOZ
a5b83185f5 Search Flights By Flight Type (#987)
Flight Controller : Added flight_type to return

Flight Repository : Made flight_type searchable and added its where criteria

Flight.Search.Blade : Added the flight types in a reasonable order as a dropdown (like schedule pax,charter pax,cargo,others)

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-01-17 12:23:23 -05:00
Maximiliano Fallico
29ff0758a7 Add filter/search by airline in admin (#990)
Add filter/search by Airline
2021-01-17 11:59:34 -05:00
Nabeel Shahzad
be74d99ae8 Run on pull request 2021-01-17 11:54:46 -05:00
Nabeel Shahzad
53de2e3229 Only run workflows on main repo 2021-01-17 11:52:49 -05:00
Nabeel S
80a90c6e3c Fix github badge 2021-01-16 22:15:32 -05:00
Nabeel S
854ed9b92c Remove travis-ci badge 2021-01-16 22:14:28 -05:00
Nabeel S
46b17b5c04 Use GitHub actions (#989) 2021-01-16 20:25:58 -05:00
Andrew Roberts
0068b1215a Remove existing fares when importing (#988)
Delete all existing fares and overwrite with new import when Delete Existing Data is checked/true.
2021-01-16 13:09:56 -05:00
B.Fatih KOZ
984c1e0cec SimBrief : Generate New Briefing (#986)
* Add SB Briefing Removal Route

Route will be called from simbrief.briefing.blade

* SimBrief Controller and Briefing Blade Update

Added the remove function to controller, which removes the simbrief ofp if no pirep_id is present, else it just nulls the flight_id for to be able to create a new SB pack

Also added the button to blade for it to work

* Style Fix

love styleci
2021-01-15 17:36:46 -05:00
Daniel Ortez
ad8b8e8945 Fix for deleting flights when importing (#984) 2021-01-14 07:07:35 -05:00
B.Fatih KOZ
2b0056b7c5 Added the ability to enable/disable flight table display below the map (#983)
* LiveMap Widget Upgrade

Added the ability to enable/disable flight table display below the map.

Default is on

* Update LiveMap.php

* Update LiveMap.php

* Update live_map.blade.php
2021-01-12 08:24:50 -05:00
B.Fatih KOZ
319a9fc8e1 Weather widget additions/fixes (#981)
Fixed the problem where values are not displayed when the reported wind,temp and dewpoint are 0 (zero).
Fixed the hPa number formatting, there is no need to add 2 more digits to it, it is a plain 4 digit value always (like 1013 or 1024, it is never reported nor used as 1013,58 or 1024,35 etc).
Corrected the display order, as it should be read (or say decoded).
Also added decoded Current and Recent Weather Situations, RVR and Runway Condition reports.

RVR report needs improvement in the Support / Metar.php too, it only reports nmi as the distance as far as i saw but it should be able to report meters too.
2021-01-07 09:09:05 -05:00
B.Fatih KOZ
a037597a21 Airline > Subfleet Relationship (#970) 2021-01-03 08:05:48 -05:00
Andrew Roberts
4026fe9149 Fix location of configservice (#977)
Pointing to wrong location of file which is throwing errors as a result
2021-01-03 07:39:02 -05:00
B.Fatih KOZ
18e1d63760 Update User.php (#968)
We should be able to send the private name with the api too.
2020-12-23 11:27:01 -05:00
Nabeel S
4bda494c6b Add helpers kvp() and kvp_save() (#966) 2020-12-21 11:30:44 -05:00
B.Fatih KOZ
a5513b6fbb Fixes for reported pressure in METAR parsing (#965)
* Update Metar.php

The reported pressure was always being assigned as hPa thus resulting display and conversion errors when the reported pressure was inHg.

Also the VFR/IFR (VMC/IMC) determination was using minimum 5 nmi and 3000 ft cloud base, it must be 5 km and 3000 ft.

With this state, this PR should fix issue #948 and partly fixes issue #963

* MetarTest Fix for inHg/hPa
2020-12-21 10:53:50 -05:00
B.Fatih KOZ
e4972eaae3 Download screen enhancements
Changed the group name according to its category , aircrafts will show icao type and registration , airports will be displayed with their icao codes names and countries. Rest will be showed with their names (exp airlines)

This will result a much better look on the downloads page for end users while looking for a specific type's files (like a repaint for a B738).
2020-12-18 14:34:05 -05:00
Nabeel Shahzad
e95e61d4b4 Fix tests #807 2020-12-07 10:19:43 -05:00
Nabeel Shahzad
f92912dff4 Fix test 2020-12-07 09:50:00 -05:00
Nabeel Shahzad
f62c607138 Change fuel calculation to fuel used #807 2020-12-07 09:46:07 -05:00
B.Fatih KOZ
d1a3155653 Fixed EET and ENDURANCE values at IVAO & VATSIM prefile (#954)
Fixed wrong EET and ENDURANCE values at IVAO & VATSIM prefile forms with a php function converting seconds to HHmm format. 

Also added View Route At SkyVector link (uses auto zoom to fpl route on High Enroute Charts) , thx Maco for his idea and original link.
2020-12-06 17:18:55 -05:00
B.Fatih KOZ
883e8786e0 Formatting on admin pirep page #952
* Fix For Issue #952 / Admin Pirep Display

Removed unnecessary div tags to fix the broken display problem, defined the div class with a php code

* Fix and Update for Admin Pirep Index

Fixed the page width problem and search error , added the ability to also search for Rejected and Accepted pireps.
2020-12-05 20:27:03 -05:00
B.Fatih KOZ
fb44b73f44 Fix METAR decoding (text correction only) (#950)
* Update Metar Decoding (Text Correction Only)

SKC means Sky Clear or Clear Skies.

Rest is ok

* Update MetarTest.php
2020-12-04 12:47:42 -05:00
B.Fatih KOZ
7379e93c46 Update simbrief_briefing.blade.php (#944)
1. Added ATC Prefile options for IVAO and VATSIM
2. Added TAF reports for Orig, Dest and Altn airports. (Technically TAF reports are required for flights more than 1 hour, so we need to see them on the briefing page too)
3. Adjusted the height of OFP division to match the page with the WX section changes
2020-12-04 11:20:12 -05:00
B.Fatih KOZ
d4bb5605de Update search.blade.php (#943)
Added the ability to select and search an airline's flights. Will be usefull in multiple airline installations/configs.

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2020-12-04 11:12:41 -05:00
B.Fatih KOZ
8ecc096bf7 Update Latest Pireps Widget (#945)
Added flight number, used aircraft registration (and icao type) instead of name
2020-12-04 11:04:47 -05:00
Nabeel S
6b5cf38224 Calculate percentage properly instead of adding to the base value #925 (#942)
* Calculate percentage properly instead of adding to the base value #925
2020-11-26 16:44:57 -05:00
Nabeel S
2ecf366670 Add missing columns from subfleet export #926 (#941) 2020-11-26 13:34:04 -05:00
Nabeel Shahzad
a7981c0a87 Redirect to the subfleet aircraft list on save #932 2020-11-26 13:15:56 -05:00
Nabeel Shahzad
9cf07c47c7 Fix notifications error for collect() #937 2020-11-26 13:08:32 -05:00
Nabeel S
8f4219bc95 Download path size too small; fix migrations #935 (#940) 2020-11-26 13:03:59 -05:00
Nabeel Shahzad
eae345efa7 Fix dropping of unique index when table prefix is present #934 2020-11-26 12:27:26 -05:00
Nabeel Shahzad
be15426b5b Fix public path in application bootstrap #887 2020-11-23 13:39:26 -05:00
Nabeel Shahzad
7e4c652330 Log for avatar upload 2020-11-22 09:59:09 -05:00
Nabeel S
ced2c150b7 Change the body size to medium text #920 (#930)
Change the body size to medium text (16MB) #920
2020-11-20 12:00:37 -05:00
Nabeel Shahzad
a2de532f72 Merge branch 'dev' of https://github.com/nabeelio/phpvms into dev 2020-11-02 11:57:27 -05:00
Nabeel Shahzad
a52d844719 Set flight_id to be fillable 2020-11-02 11:57:25 -05:00
Timothy Sturm
fd814bc79e * Fixed broken links on README
* Fixed broken links on README

* Misc. edits to markdown formatting, Title Grammer, and Stylizing the phpVMS brand.
2020-10-31 18:43:00 -04:00
Nabeel Shahzad
0fa00206ce Make sure stdclass is returned in flight fields 2020-10-29 12:38:40 -04:00
Nabeel Shahzad
a58237b04b Allow flight_id to be nullable 2020-10-27 21:47:19 -04:00
Nabeel S
dc7efc981c Refactor fares inheritance #905 (#906) 2020-10-27 18:46:15 -04:00
Yash Govekar
060bebf8fe Accept Pirep button not changing row inline #598 (#880) 2020-10-26 10:18:00 -04:00
Nabeel Shahzad
aaaf2e7c00 Make sure capacity is an integer 2020-10-24 16:04:09 -04:00
Nabeel S
1be68d1e63 Flight/Subfleet fares not returning in API #899 (#900)
Make sure proper fares are returned from the API #899
2020-10-24 15:11:08 -04:00
Nabeel Shahzad
b83f7dcac8 Updated seed data for dev 2020-10-24 09:26:14 -04:00
Nabeel S
c5de2fd8b1 Fix for base map/providers #895 (#897) 2020-10-23 08:08:41 -04:00
Nabeel S
b85d0e6a3e Expose Leaflet base options to templates #895 (#896) 2020-10-23 07:35:44 -04:00
Nabeel S
b37bd2cd7b Change award events handler to subscription #888 (#894) 2020-10-23 07:28:22 -04:00
Nabeel S
584d37f230 FlightRouteAwards - fix if last pirep is empty/other error conditions (#886) 2020-10-22 16:25:52 -04:00
Nabeel Shahzad
1c9d1c1733 Extra logs/skip module seed pending 2020-10-21 14:12:38 -04:00
Nabeel S
cd18442207 Fixes for installer/modules race condition (#883) 2020-10-21 13:28:54 -04:00
Yash Govekar
716ba38b6d Default values for automatically added airports #829 (#878) 2020-10-20 15:25:13 -04:00
Yash Govekar
c0514b381b Fixed exporting expenses (#877) 2020-10-19 15:22:06 -04:00
Yash Govekar
5803487d51 Installing and managing modules from admin panel (#847) 2020-10-19 10:10:28 -04:00
Snyk bot
ca220f1cdf fix: package.json & package-lock.json to reduce vulnerabilities (#873)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-AJV-584908
- https://snyk.io/vuln/SNYK-JS-JQUERY-565129
- https://snyk.io/vuln/SNYK-JS-JQUERY-567880
- https://snyk.io/vuln/SNYK-JS-SELECT2-456562
- https://snyk.io/vuln/SNYK-JS-SOCKJS-575261
- https://snyk.io/vuln/SNYK-JS-WEBPACKDEVSERVER-72405
- https://snyk.io/vuln/SNYK-JS-YARGSPARSER-560381
- https://snyk.io/vuln/npm:mem:20180117
2020-10-16 11:01:24 -04:00
Nabeel Shahzad
75a0a4c87a Update FareService.php 2020-10-13 18:12:52 -04:00
Nabeel Shahzad
3b6800077f Preload fares with PIREP 2020-10-13 18:12:14 -04:00
Nabeel Shahzad
bf878a98a4 Extra logging around fares 2020-10-13 18:10:31 -04:00
DaGeek
d001704880 Adding a new AwardClass for Flight Time (#869)
Adding a new AwardClass for Flight Time
2020-10-13 17:07:12 -04:00
DaGeek
5371989921 Cosmetic Fix to display Award Images in Admin View (#870)
Fix to correctly display the Award image in the admin UI
2020-10-13 15:41:16 -04:00
DaGeek
6c553569bf Create FlightRouteAwards.php (#865)
Award - FlightRoute- this allows the Admins to create an Award that will be granted if a Pilot completes a flight with a defined Departure and Arrival Airport
2020-10-12 18:54:42 -04:00
Nabeel Shahzad
9eb7dd6913 Update doc links 2020-10-12 15:15:05 -04:00
Nabeel S
dc007f6d9e Bids are missing subfleets in API response #867 (#868)
Bids are missing subfleets in API response #867
2020-10-12 12:49:11 -04:00
Nabeel S
193fbd369d Show awards on user profile #703 (#866) 2020-10-11 16:06:09 -04:00
Botric
151f188886 Update pirep_card.blade.php (#857)
Update pirep_card.blade.php
2020-10-10 15:24:28 -04:00
Nabeel S
69d89511be Inherited value can't be removed #811 (#863)
Inherited value can't be removed #811
2020-10-10 15:24:10 -04:00
Nabeel S
48087fb05f Metar: TEMPO and trend causing issue with values being overwritten (#862)
Metar: TEMPO and trend causing issue with values being overwritten
2020-10-10 14:55:12 -04:00
Nabeel S
c702b01a87 Add tests that rank shouldn't auto change (#840) 2020-10-10 14:50:00 -04:00
DaGeek
0a5194b92e Small Cosmetic Change to Rank & Home Airport Display (#852)
Cosmetic Change to Rank & Home Airport Display
2020-10-09 17:45:16 -04:00
Nabeel Shahzad
24aca506fc Update UserController.php 2020-10-06 19:26:52 -04:00
Nabeel Shahzad
365e33f5f8 Redirect show() to edit() 2020-10-06 19:10:42 -04:00
Nabeel Shahzad
7a75e0f5ad Fix missing $countries 2020-10-06 18:52:34 -04:00
Botric
93da2ca061 Cosmetic change to standardise boxes on profile (#853) 2020-10-04 12:48:12 -04:00
vgpastor
5363e4aa0f Add API Key visual protection (#851)
Add API Key visual protection
2020-10-03 11:13:28 -04:00
Nabeel S
95a40d3565 Make sure proper subfleets are returned as part of the user profile #848 (#849)
* Make sure proper subfleets are returned as part of the user profile #848

* Formatting
2020-09-30 12:58:45 -04:00
Nabeel S
98aa362935 Fix subfleets not returning proper fare counts #831 (#846)
Fix subfleets not returning proper fare counts #831
2020-09-29 13:21:24 -04:00
Yash Govekar
b6603bd178 Updated Route Service Provider that was mismatching API and ADMIN Section (#845) 2020-09-29 13:09:00 -04:00
Yash Govekar
2c539d349d Fix controller namespace in module generation #714
Updated Module Files
2020-09-28 16:04:51 -04:00
Nabeel Shahzad
5df28eb027 Fix module main service provider name 2020-09-27 12:13:24 -04:00
yashris
0dbf8b8652 Public JS files Updated! (#839) 2020-09-27 09:03:46 -04:00
yashris
5856f88a0c Updated index.js inside Map folder (#837) 2020-09-24 09:56:52 -04:00
Nabeel Shahzad
5f9b9399e9 Use $current_airport 2020-09-23 14:39:10 -04:00
Nabeel S
77fe6679ce Update module generation #714 (#716)
* Update module generation #714

* Fix method signatures

* Fix paths within stubs, use single provider.stub file

* Add separate index controller

* Update module generation #714

* Fix method signatures

* Fix paths within stubs, use single provider.stub file

* Update module generation

Disable/lower the cache time as found as a workaround in https://github.com/nWidart/laravel-modules/issues/995

* Update editorconfig for line endings

* Formatting

* Formatting
2020-09-20 19:10:52 -04:00
Nabeel Shahzad
435fa32663 Fix aircraft field name #824 2020-09-15 15:41:53 -04:00
Nabeel Shahzad
78ca06e9dc Add optional() around aircraft info #824 2020-09-14 16:17:03 -04:00
Nabeel Shahzad
2dd3dd5814 Make sure we're getting only active expenses 2020-09-12 15:17:10 -04:00
Nabeel Shahzad
ac7a5a65e5 Update cron path 2020-09-11 16:57:50 -04:00
Nabeel Shahzad
c5ab0978db Force visible flag to true for imports #818 2020-09-11 09:18:27 -04:00
dependabot[bot]
8398d94c0a Bump js-yaml from 3.11.0 to 3.13.1 (#810)
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.11.0 to 3.13.1.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.11.0...3.13.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-09-10 17:06:01 -04:00
Nabeel S
1db3295213 Disable autocomplete in admin forms #816 (#817) 2020-09-10 16:42:11 -04:00
377 changed files with 53775 additions and 11164 deletions

View File

@@ -1,6 +1,10 @@
#
root = true
[*]
end_of_line = lf
insert_final_newline = true
[*.js]
indent_style = space
indent_size = 2
@@ -23,4 +27,4 @@ indent_style = tab
# Matches the exact files either package.json or .travis.yml
[{package.json, .travis.yml}]
indent_style = space
indent_size = 2
indent_size = 2

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

@@ -1,52 +1,12 @@
#!/usr/bin/env bash
if [ "$TRAVIS" != "true" ]; then
exit 0
fi
cd $TRAVIS_BUILD_DIR
if test "$TRAVIS_TAG"; then
VERSION=$TRAVIS_TAG
# Pass in the tag as the version to write out
php artisan phpvms:version --write --write-full-version "${VERSION}"
FULL_VERSION=$(php artisan phpvms:version)
else
echo "On branch $TRAVIS_BRANCH"
if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_BRANCH" != "dev" ]; then
echo "Not on valid branch, exiting"
exit 0
fi
# Write the version out but place the branch ID in there
# This is only for the dev branch
BASE_VERSION=$(php artisan phpvms:version --base-only)
# This now includes the pre-release version, so "-dev" by default
VERSION=${BASE_VERSION}
# Don't pass in a version here, just write out the latest hash
php artisan phpvms:version --write "${VERSION}"
FULL_VERSION=$(php artisan phpvms:version)
fi
FILE_NAME="phpvms-${VERSION}"
TAR_NAME="$FILE_NAME.tar.gz"
ZIP_NAME="$FILE_NAME.zip"
echo "Version: ${VERSION}"
echo "Full Version: ${FULL_VERSION}"
echo "Package name: ${TAR_NAME}"
echo "==========================="
echo "Current directory: ${BASE_DIR}"
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
@@ -107,44 +67,20 @@ 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 .
ls -al $BASE_DIR/../
tar -czf $TAR_NAME -C $BASE_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
echo "Moving to dist"
mkdir -p $BASE_DIR/dist
cd $BASE_DIR/dist
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,7 +1,3 @@
<?php
exit();
?>
APP_ENV="dev"
APP_KEY="base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY="
APP_URL="http://localhost"

36
.github/scripts/version.sh vendored Normal file
View File

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

249
.github/workflows/build.yml vendored Normal file
View File

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

View File

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

View File

@@ -1,18 +1,15 @@
# phpvms <sup>7</sup>
# phpVMS <sup>7</sup>
[![Build Status](https://travis-ci.org/nabeelio/phpvms.svg)](https://travis-ci.org/nabeelio/phpvms) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d668bebb0a3c46bda381af16ce3d9450)](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=nabeelio/phpvms&amp;utm_campaign=Badge_Grade) [![Latest Stable Version](https://poser.pugx.org/nabeel/phpvms/v/stable)](https://packagist.org/packages/nabeel/phpvms) ![StyleCI](https://github.styleci.io/repos/93688482/shield?branch=dev) [![License](https://poser.pugx.org/nabeel/phpvms/license)](https://packagist.org/packages/nabeel/phpvms)
[![Build](https://github.com/nabeelio/phpvms/workflows/Build/badge.svg?branch=dev)](https://github.com/nabeelio/phpvms/actions) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d668bebb0a3c46bda381af16ce3d9450)](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=nabeelio/phpvms&amp;utm_campaign=Badge_Grade) [![Latest Stable Version](https://poser.pugx.org/nabeel/phpvms/v/stable)](https://packagist.org/packages/nabeel/phpvms) ![StyleCI](https://github.styleci.io/repos/93688482/shield?branch=dev) [![License](https://poser.pugx.org/nabeel/phpvms/license)](https://packagist.org/packages/nabeel/phpvms)
The next phpvms version built on the laravel framework. work in progress. The latest documentation, with installation instructions is available
[on the phpVMS documentation](http://docs.phpvms.net/) page.
The next phpvms version built on the laravel framework. work in progress. The latest documentation, with installation instructions is available [on the phpVMS documentation](https://docs.phpvms.net/) page.
# installation
## Installation
A full distribution, with all of the composer dependencies, is available at this
[GitHub Releases](https://github.com/nabeelio/phpvms/releases) link.
## Requirements
### Requirements
- PHP 7.3+, extensions:
- cURL
@@ -24,22 +21,22 @@ A full distribution, with all of the composer dependencies, is available at this
- Database:
- MySQL 5.5+ (or MySQL variant, including MariaDB and Percona)
[View more details on requirements](http://docs.phpvms.net/setup/requirements)
[View more details on requirements](https://docs.phpvms.net/requirements)
## Installer
### Installer
1. Upload to your server
1. Visit the site, and follow the link to the installer
[View installation details](http://docs.phpvms.net/setup/installation)
[View installation details](https://docs.phpvms.net/installation/installation)
# development environment
## Development Environment
A full development environment can be brought up using Docker:
```bash
composer install
yarn install
npm install
docker-compose build
docker-compose up
```
@@ -50,7 +47,7 @@ Then go to `http://localhost`. If you're using dnsmasq, the `app` container is l
127.0.0.1 phpvms.test
```
## Building JS/CSS assets
### Building JS/CSS assets
Yarn is required, run:

View File

@@ -92,8 +92,9 @@ class CreateDatabase extends Command
}
if ($this->option('reset') === true) {
$cmd = ['rm', '-rf', config($dbkey.'database')];
$this->runCommand($cmd);
if (file_exists($dbPath)) {
unlink(config($dbkey.'database'));
}
}
if (!file_exists($dbPath)) {

View File

@@ -3,7 +3,7 @@
namespace App\Console\Commands;
use App\Contracts\Command;
use Modules\Installer\Services\ConfigService;
use App\Services\Installer\ConfigService;
/**
* Create a fresh development install

View File

@@ -1,10 +1,10 @@
<?php
namespace Modules\Importer\Console\Commands;
namespace App\Console\Commands;
use App\Contracts\Command;
use App\Services\ImporterService;
use Illuminate\Support\Facades\Log;
use Modules\Importer\Services\ImporterService;
class ImportFromClassicCommand extends Command
{

View File

@@ -3,7 +3,7 @@
namespace App\Console\Commands;
use App\Contracts\Command;
use DB;
use Illuminate\Support\Facades\DB;
use Symfony\Component\Yaml\Yaml;
/**
@@ -25,6 +25,20 @@ class YamlExport extends Command
exit();
}
// A "preset" for exporting the base set of data
if ($tables[0] === 'base') {
$tables = [
'airlines',
'aircraft',
'subfleets',
'subfleet_fare',
'subfleet_rank',
'bids',
'fares',
'flights',
];
}
$export_tables = [];
foreach ($tables as $table) {
$export_tables[$table] = [];

View File

@@ -13,7 +13,11 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
* Define the application's command schedule. How this works... according to the command
* time, an event gets send out with the appropriate time (e.g, hourly sends an hourly event)
*
* Then the CronServiceProvider has the list of cronjobs which then run according to the events
* and then calls those at the proper times.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
@@ -27,10 +31,13 @@ class Kernel extends ConsoleKernel
$schedule->command(Hourly::class)->hourly();
// When spatie-backups runs
$schedule->command('backup:clean')->daily()->at('01:00');
$schedule->command('backup:run')->daily()->at('02:00');
/*if (config('backup.backup.enabled', false) === true) {
$schedule->command('backup:clean')->daily()->at('01:00');
$schedule->command('backup:run')->daily()->at('02:00');
}*/
// Update the last time the cron was run
/** @var CronService $cronSvc */
$cronSvc = app(CronService::class);
$cronSvc->updateLastRunTime();
}

View File

@@ -36,7 +36,10 @@ abstract class Award
* You don't really need to mess with anything below here
*/
/** @var \App\Models\Award|null */
protected $award;
/** @var \App\Models\User|null */
protected $user;
public function __construct(AwardModel $award = null, User $user = null)

View File

@@ -3,9 +3,9 @@
namespace App\Contracts;
use App\Models\Airline;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
use Log;
use Validator;
/**
* Common functionality used across all of the importers
@@ -51,9 +51,9 @@ class ImportExport
*
* @param $code
*
* @return \Illuminate\Database\Eloquent\Model
* @return Airline
*/
public function getAirline($code)
public function getAirline($code): Airline
{
$airline = Airline::firstOrCreate([
'icao' => $code,

View File

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

View File

@@ -3,8 +3,11 @@
namespace App\Contracts;
use App\Support\Database;
use DB;
use Exception;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
/**
* Class Migration
@@ -25,6 +28,29 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
{
}
/**
* Add a module and enable it
*
* @param array $attrs
*/
public function addModule(array $attrs)
{
$module = array_merge([
'enabled' => true,
'created_at' => DB::raw('NOW()'),
'updated_at' => DB::raw('NOW()'),
], $attrs);
try {
DB::table('modules')->insert($module);
} catch (Exception $e) {
// setting already exists, just ignore it
if ($e->getCode() === 23000) {
return;
}
}
}
/**
* Seed a YAML file into the database
*
@@ -35,7 +61,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
try {
$path = base_path($file);
Database::seed_from_yaml_file($path, false);
} catch (\Exception $e) {
} catch (Exception $e) {
Log::error('Unable to load '.$file.' file');
Log::error($e);
}
@@ -52,7 +78,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
foreach ($rows as $row) {
try {
DB::table($table)->insert($row);
} catch (\Exception $e) {
} catch (Exception $e) {
// setting already exists, just ignore it
if ($e->getCode() === 23000) {
continue;
@@ -60,4 +86,22 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
}
}
}
/**
* Add an award from the migrations (for example, if you're adding an award module)
*
* @param array $award See \App\Models\Awardv
*
* @throws \Illuminate\Validation\ValidationException
*/
public function addAward(array $award)
{
$validator = Validator::make($award, \App\Models\Award::$rules);
if ($validator->fails()) {
throw new ValidationException($validator);
}
$awardModel = new \App\Models\Award($award);
$awardModel->save();
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Contracts\Modules;
/**
* Base class for module service providers
* Add-on module service providers must extend this class. Docs on Service Providers:
* https://laravel.com/docs/7.x/providers
*
* For a sample service provider, view the sample module one:
* https://github.com/nabeelio/phpvms-module/blob/master/Providers/SampleServiceProvider.php
*/
abstract class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
/**
* A boot method is required, even if it doesn't do anything.
* https://laravel.com/docs/7.x/providers#the-boot-method
*
* This is normally where you'd register the routes or other startup tasks for your module
*/
public function boot(): void
{
}
/**
* This is required to register the links in either the public or admin toolbar
* For example, adding a frontend link:
*
* $this->moduleSvc->addFrontendLink('Sample', '/sample', '', $logged_in=true);
*
* Or an admin link:
*
* $this->moduleSvc->addAdminLink('Sample', '/admin/sample');
*/
public function registerLinks(): void
{
}
/**
* Deferred providers:
* https://laravel.com/docs/7.x/providers#deferred-providers
*
* @return array
*/
public function provides(): array
{
return [];
}
}

View File

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

View File

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

View File

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

View File

@@ -5,6 +5,7 @@ namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Services\SimBriefService;
use Illuminate\Support\Facades\Log;
/**
* Clear any expired SimBrief flight briefs that aren't attached to a PIREP
@@ -23,6 +24,7 @@ class ClearExpiredSimbrief extends Listener
*/
public function handle(CronNightly $event): void
{
Log::info('Nightly: Removing expired Simbrief entries');
$this->simbriefSvc->removeExpiredEntries();
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,14 +3,10 @@
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Modules\Awards\Awards\PilotFlightAwards;
class CreateAwardsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('awards', function (Blueprint $table) {
@@ -23,7 +19,6 @@ class CreateAwardsTable extends Migration
// EG, the airports has an internal expense for gate costs
$table->string('ref_model')->nullable();
$table->text('ref_model_params')->nullable();
//$table->string('ref_model_id', 36)->nullable();
$table->timestamps();
@@ -38,13 +33,20 @@ class CreateAwardsTable extends Migration
$table->index(['user_id', 'award_id']);
});
/**
* Add a default, sample award
*/
$award = [
'name' => 'Pilot 50 flights',
'description' => 'When a pilot has 50 flights, give this award',
'ref_model' => PilotFlightAwards::class,
'ref_model_params' => 50,
];
$this->addAward($award);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('awards');

View File

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

View File

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

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,7 +15,7 @@ class CreateFilesTable extends Migration
public function up()
{
Schema::create('files', function (Blueprint $table) {
$table->string('id', \App\Contracts\Model::ID_MAX_LENGTH);
$table->string('id', Model::ID_MAX_LENGTH);
$table->string('name');
$table->string('description')->nullable();
$table->string('disk')->nullable();

View File

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

View File

@@ -1,21 +1,19 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
/**
* Kinda of gross operations to change the pilot ID column
* 1. Add an `pilot_id` column, which will get populated with the current ID
* 2. Drop the `id` column, and then recreate it as a string field
* 3. Iterate through all of the users and set their `id` to the `pilot_id`
* 4. Change the other tables column types that reference `user_id`
*/
class UsersAddPilotId extends Migration
{
/**
* Kinda of gross operations to change the pilot ID column
* 1. Add an `pilot_id` column, which will get populated with the current ID
* 2. Drop the `id` column, and then recreate it as a string field
* 3. Iterate through all of the users and set their `id` to the `pilot_id`
* 4. Change the other tables column types that reference `user_id`
*
* @return void
*/
public function up()
{
Schema::table('users', static function (Blueprint $table) {
@@ -29,11 +27,6 @@ class UsersAddPilotId extends Migration
DB::table('users')->update(['pilot_id' => DB::raw('`id`')]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {

View File

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

View File

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

View File

@@ -5,27 +5,15 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `flight_id` column to the PIREPs table
*/
class PirepsAddFlightId extends Migration
{
/**
* Add a `flight_id` column to the PIREPs table
*/
public function up()
{
Schema::table('pireps', function (Blueprint $table) {
$table->string('flight_id', Model::ID_MAX_LENGTH)->nullable()->after('aircraft_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pireps', function (Blueprint $table) {
$table->dropColumn('flight_id');
});
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,15 +1,15 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a `link` column and make the body optional. Also add a "new_window" bool
* which determines if we open this link in a new window or not
*/
class PagesAddLink extends Migration
{
/**
* Add a `link` column and make the body optional. Also add a "new_window" bool
* which determines if we open this link in a new window or not
*/
public function up()
{
Schema::table('pages', function (Blueprint $table) {
@@ -23,9 +23,6 @@ class PagesAddLink extends Migration
});
}
/**
* @return void
*/
public function down()
{
Schema::table('fares', function (Blueprint $table) {

View File

@@ -5,11 +5,11 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add two tables for holding user fields and the values
*/
class CreateUserFields extends Migration
{
/**
* Add two tables for holding user fields and the values
*/
public function up()
{
/*
@@ -39,11 +39,4 @@ class CreateUserFields extends Migration
$table->index(['user_field_id', 'user_id']);
});
}
/**
* @return void
*/
public function down()
{
}
}

View File

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

View File

@@ -0,0 +1,29 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateModulesTable extends Migration
{
public function up()
{
Schema::create('modules', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->boolean('enabled')->default(1);
$table->timestamps();
});
$this->addModule(['name' => 'Awards']);
$this->addModule(['name' => 'Sample']);
$this->addModule(['name' => 'VMSAcars']);
$this->addModule(['name' => 'Vacentral']);
$this->addModule(['name' => 'TestModule']);
}
public function down()
{
Schema::dropIfExists('modules');
}
}

View File

@@ -0,0 +1,18 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Change the pages body column type to a Medium Text, max size of 16MB
*/
class ModifyPagesSize extends Migration
{
public function up()
{
Schema::table('pages', function (Blueprint $table) {
$table->mediumText('body')->change()->nullable();
});
}
}

View File

@@ -0,0 +1,19 @@
<?php
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Change the downloads link size
*/
class ModifyDownloadLinkSize extends Migration
{
public function up()
{
Schema::table('files', function (Blueprint $table) {
$table->mediumText('disk')->change()->nullable();
$table->mediumText('path')->change()->nullable();
});
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,15 +1,21 @@
<?php
use App\Services\Installer\MigrationService;
use App\Services\Installer\SeederService;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
private $seederService;
/** @var MigrationService */
private $migrationSvc;
/** @var SeederService */
private $seederSvc;
public function __construct()
{
$this->seederService = app(SeederService::class);
$this->migrationSvc = app(MigrationService::class);
$this->seederSvc = app(SeederService::class);
}
/**
@@ -19,6 +25,12 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
$this->seederService->syncAllSeeds();
// Make sure any migrations that need to be run are run/cleared out
if ($this->migrationSvc->migrationsAvailable()) {
$this->migrationSvc->runAllMigrations();
}
// Then sync all of the seeds
$this->seederSvc->syncAllSeeds();
}
}

View File

@@ -1 +1,2 @@
local.yml
vmsacars.yml

View File

@@ -1,30 +1,10 @@
#airlines:
# - id: 1
# icao: VMS
# iata: VM
# name: phpvms airlines
# country: us
# active: 1
# created_at: now
# updated_at: now
roles:
id_column: name
data:
- name: fleet-only
display_name: Edit Fleet
awards:
- id: 1
name: Pilot 50 flights
description: When a pilot has 50 flights, give this award
image_url:
ref_model: Modules\Awards\Awards\PilotFlightAwards
ref_model_params: 50
created_at: now
updated_at: now
news:
- id: 1
user_id: 1
@@ -136,34 +116,91 @@ airports:
ground_handling_cost: 50
#
aircraft:
- id: 1
-
id: 1
subfleet_id: 1
icao: B744
iata: 744
airport_id: KJFK
name: Boeing 747-438
landing_time: '2020-10-23 07:50:16'
name: 'Boeing 747-438'
registration: 001Z
flight_time: 360
hex_code: null
mtow: '0.00'
zfw: '0.00'
flight_time: 540
status: A
- id: 2
state: 0
created_at: null
updated_at: '2020-10-23 07:50:16'
-
id: 2
subfleet_id: 2
icao: B777
iata: 777
airport_id: LGRP
name: Boeing 777-200
landing_time: null
name: 'Boeing 777-200'
registration: C202
hex_code: null
mtow: '0.00'
zfw: '0.00'
flight_time: 260
status: A
- id: 3
state: 0
created_at: null
updated_at: null
-
id: 3
subfleet_id: 1
icao: B744
iata: 744
airport_id: KAUS
name: Boeing 747-412
landing_time: '2020-10-24 08:50:13'
name: 'Boeing 747-412'
registration: S2333
flight_time: 0
hex_code: null
mtow: '0.00'
zfw: '0.00'
flight_time: 180
status: A
- id: 4
state: 0
created_at: null
updated_at: '2020-10-24 08:50:13'
-
id: 4
subfleet_id: 1
icao: B744
iata: 744
airport_id: KAUS
name: Boeing 747-436 RETIRED
registration:
landing_time: null
name: 'Boeing 747-436 RETIRED'
registration: null
hex_code: null
mtow: '0.00'
zfw: '0.00'
flight_time: 45
status: R
state: 0
created_at: null
updated_at: null
-
id: 5
subfleet_id: 4
icao: 'A320'
iata: '320'
airport_id: EGLL
landing_time: null
name: 'Airbus A320'
registration: N786DL
hex_code: b47165dd
mtow: '78800.00'
zfw: '62500.00'
flight_time: 0
status: A
state: 0
created_at: '2020-10-22 13:38:50'
updated_at: '2020-10-22 13:38:50'
expenses:
- name: Per-Flight (no muliplier)
@@ -220,68 +257,192 @@ expenses:
updated_at: now
fares:
- id: 1
code: Y
-
id: 1
code: 'Y'
name: Economy
price: 100
price: '100.00'
cost: '0.00'
capacity: 200
- id: 2
type: 0
notes: null
active: 1
created_at: null
updated_at: null
-
id: 2
code: B
name: Business
price: 500
price: '500.00'
cost: '0.00'
capacity: 10
- id: 3
type: 0
notes: null
active: 1
created_at: null
updated_at: null
-
id: 3
code: F
name: First-Class
price: 800
price: '800.00'
cost: '0.00'
capacity: 5
type: 0
notes: null
active: 1
created_at: null
updated_at: null
subfleets:
- id: 1
-
id: 1
airline_id: 1
name: 747-43X RB211-524G
type: 744-3X-RB211
cost_block_hour: 1000
ground_handling_multiplier: 200
- id: 2
name: '747-43X RB211-524G'
cost_block_hour: '1000.00'
cost_delay_minute: '0.00'
fuel_type: null
ground_handling_multiplier: '200.00'
cargo_capacity: null
fuel_capacity: null
gross_weight: null
created_at: null
updated_at: null
-
id: 2
airline_id: 1
name: 777-222ER GE90-76B
type: 772-22ER-GE90-76B
cost_block_hour: 500
ground_handling_multiplier: 150
- id: 3
name: '777-222ER GE90-76B'
cost_block_hour: '500.00'
cost_delay_minute: '0.00'
fuel_type: null
ground_handling_multiplier: '150.00'
cargo_capacity: null
fuel_capacity: null
gross_weight: null
created_at: null
updated_at: null
-
id: 3
airline_id: 1
name: 777-367 ER GE90-115B
type: 772-36ER-GE90-115B
cost_block_hour: 100
ground_handling_multiplier: 150
name: '777-367 ER GE90-115B'
cost_block_hour: '100.00'
cost_delay_minute: '0.00'
fuel_type: null
ground_handling_multiplier: '150.00'
cargo_capacity: null
fuel_capacity: null
gross_weight: null
created_at: null
updated_at: null
-
id: 4
airline_id: 1
type: A320
name: A320
cost_block_hour: '2300.00'
cost_delay_minute: null
fuel_type: 1
ground_handling_multiplier: '100.00'
cargo_capacity: null
fuel_capacity: null
gross_weight: null
created_at: '2020-10-22 13:36:49'
updated_at: '2020-10-22 13:36:49'
# add a few mods to aircraft and fares
subfleet_fare:
# Fare classes on the 747
- subfleet_id: 1
-
subfleet_id: 1
fare_id: 1
price: 200
capacity: 400
- subfleet_id: 1
price: '200'
cost: null
capacity: '400'
created_at: null
updated_at: null
-
subfleet_id: 1
fare_id: 2
price: 120%
- subfleet_id: 1
fare_id: 3
price: 1000
capacity: 110%
# Fare classes on the 777
- subfleet_id: 2
fare_id: 1
- subfleet_id: 2
fare_id: 3
capacity: 10
subfleet_rank:
- rank_id: 1
cost: null
capacity: null
created_at: null
updated_at: null
-
subfleet_id: 1
fare_id: 3
price: '1000'
cost: null
capacity: 110%
created_at: null
updated_at: null
-
subfleet_id: 2
fare_id: 1
price: null
cost: null
capacity: null
created_at: null
updated_at: null
-
subfleet_id: 2
fare_id: 3
price: null
cost: null
capacity: '10'
created_at: null
updated_at: null
-
subfleet_id: 4
fare_id: 1
price: null
cost: null
capacity: '123'
created_at: null
updated_at: null
-
subfleet_id: 4
fare_id: 2
price: null
cost: null
capacity: '8'
created_at: null
updated_at: null
-
subfleet_id: 4
fare_id: 3
price: null
cost: null
capacity: '2'
created_at: null
updated_at: null
subfleet_rank:
-
rank_id: 1
subfleet_id: 1
acars_pay: null
manual_pay: null
-
rank_id: 1
subfleet_id: 4
acars_pay: null
manual_pay: null
-
rank_id: 2
subfleet_id: 4
acars_pay: null
manual_pay: null
-
rank_id: 3
subfleet_id: 4
acars_pay: null
manual_pay: null
-
rank_id: 4
subfleet_id: 4
acars_pay: null
manual_pay: null
flights:
- id: flightid_1
@@ -359,6 +520,35 @@ flights:
route: 'MLY5 KEMBO UG442 SIA UG633 OTEKO UR640 NALRO GUBEL3'
created_at: NOW
updated_at: NOW
-
id: q8mvZ5vdExoy0mQG
airline_id: 1
flight_number: 3003
route_code: null
route_leg: null
dpt_airport_id: KSEA
arr_airport_id: KPAE
alt_airport_id: null
dpt_time: '8:00'
arr_time: '8:45'
level: null
distance: '27.51'
flight_time: 45
flight_type: J
load_factor: null
load_factor_variance: null
route: null
pilot_pay: null
notes: null
scheduled: 0
days: null
start_date: null
end_date: null
has_bid: 1
active: 1
visible: 1
created_at: now
updated_at: now
flight_fields:
- name: Departure Terminal
@@ -389,12 +579,24 @@ flight_subfleet:
flight_id: flightid_4
bids:
- id: 100
-
id: 100
user_id: 1
flight_id: flightid_1
- id: 101
created_at: now
updated_at: now
-
id: 101
user_id: 1
flight_id: flightid_3
created_at: now
updated_at: now
-
id: 102
user_id: 1
flight_id: q8mvZ5vdExoy0mQG
created_at: now
updated_at: now
pireps:
- id: pirepid_1

View File

@@ -92,3 +92,10 @@ user_field_values:
user_field_id: 2
user_id: 1
value: 'Nobody did'
user_awards:
- id: 1
user_id: 1
award_id: 1
created_at: now
updated_at: now

View File

@@ -0,0 +1,10 @@
- name: 'Awards'
enabled: 1
- name: 'Sample'
enabled: 1
- name: 'VMSAcars'
enabled: 1
- name: 'Vacentral'
enabled: 1
- name: 'TestModule'
enabled: 1

View File

@@ -51,3 +51,6 @@
- name: maintenance
display_name: Maintenance
description: Run maintenance tasks
- name: modules
display_name: Modules
description: Add/Edit Modules

View File

@@ -130,6 +130,20 @@
options: ''
type: int
description: 'Initial zoom level on the map'
- key: airports.default_ground_handling_cost
name: 'Default Ground Handling Cost'
group: airports
value: 250
options:
type: int
description: If an airport's Ground Handling Cost Cost isn't added, set this value by default
- key: airports.default_jet_a_fuel_cost
name: 'Default Jet A Fuel Cost'
group: airports
value: 0.7
options:
type: text
description: If an airport's Jet A Fuel Cost isn't added, set this value by default
- key: bids.disable_flight_on_bid
name: 'Disable flight on bid'
group: bids
@@ -166,12 +180,12 @@
type: number
description: 'How much the load factor can vary per-flight'
- key: simbrief.api_key
name: 'SimBrief API Key'
name: 'Simbrief API Key'
group: simbrief
value: ''
options: ''
type: string
description: 'Your SimBrief API key'
description: 'Your Simbrief API key'
- key: simbrief.only_bids
name: 'Only allow for bids'
group: simbrief
@@ -180,12 +194,47 @@
type: boolean
description: 'Only allow briefs to be created for bidded flights'
- key: simbrief.expire_days
name: 'SimBrief Expire Time'
name: 'Simbrief Expire Time'
group: simbrief
value: 5
options: ''
type: number
description: 'Days after how long to remove unused briefs'
- key: simbrief.noncharter_pax_weight
name: 'Non-Charter Passenger Weight'
group: simbrief
value: 185
options: ''
type: number
description: 'Passenger weight for non-charter flights excluding baggage (lbs)'
- key: simbrief.noncharter_baggage_weight
name: 'Non-Charter Baggage Weight'
group: simbrief
value: 35
options: ''
type: number
description: 'Passenger baggage weight for non-charter flights (lbs)'
- key: simbrief.charter_pax_weight
name: 'Charter Passenger Weight'
group: simbrief
value: 168
options: ''
type: number
description: 'Passenger weight for charter flights excluding baggage (lbs)'
- key: simbrief.charter_baggage_weight
name: 'Charter Baggage Weight'
group: simbrief
value: 28
options: ''
type: number
description: 'Passenger baggage weight for charter flights (lbs)'
- key: simbrief.callsign
name: 'Use ATC Callsign'
group: simbrief
value: false
options: ''
type: boolean
description: 'Use pilot ident as Simbrief ATC Callsign'
- key: pireps.duplicate_check_time
name: 'PIREP duplicate time check'
group: pireps
@@ -214,6 +263,27 @@
options: ''
type: boolean
description: 'When a PIREP is accepted, remove the bid, if it exists'
- key: pireps.advanced_fuel
name: 'Advanced Fuel Calculations'
group: pireps
value: false
options: ''
type: boolean
description: 'Enables remaining fuel amounts to be considered for fuel expenses'
- key: pireps.delete_cancelled_hours
name: 'Delete cancelled PIREPs'
group: pireps
value: 12
options: ''
type: int
description: 'The time in hours to delete a cancelled PIREP'
- key: pireps.delete_rejected_hours
name: 'Delete rejected PIREPs'
group: pireps
value: 12
options: ''
type: int
description: 'The time in hours to delete a rejected PIREP'
- key: pilots.id_length
name: 'Pilot ID Length'
group: pilots
@@ -291,3 +361,9 @@
options: ''
type: 'text'
description: 'Discord public channel ID for broadcasat notifications'
- key: 'cron.random_id'
name: 'Cron Randomized ID'
group: 'cron'
value: ''
type: 'hidden'
description: ''

View File

@@ -18,7 +18,7 @@ class ValidationException extends AbstractHttpException
parent::__construct(
400,
'Validation exception'
'Validation Error'
);
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Exceptions;
class CronInvalid extends AbstractHttpException
{
public const MESSAGE = 'Cron ID is disabled or invalid';
public function __construct()
{
parent::__construct(400, static::MESSAGE);
}
/**
* Return the RFC 7807 error type (without the URL root)
*/
public function getErrorType(): string
{
return 'cron-invalid';
}
/**
* Get the detailed error string
*/
public function getErrorDetails(): string
{
return $this->getMessage();
}
/**
* Return an array with the error details, merged with the RFC7807 response
*/
public function getErrorMetadata(): array
{
return [];
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Exceptions;
class ModuleExistsException extends AbstractHttpException
{
private $module_name;
public function __construct($module_name)
{
$this->module_name = $module_name;
parent::__construct(
409,
'Module '.$module_name.' Already Exists!'
);
}
/**
* Return the RFC 7807 error type (without the URL root)
*/
public function getErrorType(): string
{
return 'module-already-exists';
}
/**
* Get the detailed error string
*/
public function getErrorDetails(): string
{
return $this->getMessage();
}
/**
* Return an array with the error details, merged with the RFC7807 response
*/
public function getErrorMetadata(): array
{
return [];
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Exceptions;
class ModuleInstallationError extends AbstractHttpException
{
public function __construct()
{
parent::__construct(
500,
'Installation of Module Failed!'
);
}
/**
* Return the RFC 7807 error type (without the URL root)
*/
public function getErrorType(): string
{
return 'module-installation-error';
}
/**
* Get the detailed error string
*/
public function getErrorDetails(): string
{
return $this->getMessage();
}
/**
* Return an array with the error details, merged with the RFC7807 response
*/
public function getErrorMetadata(): array
{
return [];
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Exceptions;
class ModuleInvalidFileType extends AbstractHttpException
{
public function __construct()
{
parent::__construct(
415,
'The Module File Type is Invalid!'
);
}
/**
* Return the RFC 7807 error type (without the URL root)
*/
public function getErrorType(): string
{
return 'module-file-type-invalid';
}
/**
* Get the detailed error string
*/
public function getErrorDetails(): string
{
return $this->getMessage();
}
/**
* Return an array with the error details, merged with the RFC7807 response
*/
public function getErrorMetadata(): array
{
return [];
}
}

View File

@@ -160,6 +160,7 @@ class AircraftController extends Controller
*/
public function update($id, UpdateAircraftRequest $request)
{
/** @var \App\Models\Aircraft $aircraft */
$aircraft = $this->aircraftRepo->findWithoutFail($id);
if (empty($aircraft)) {
@@ -171,7 +172,7 @@ class AircraftController extends Controller
$this->aircraftRepo->update($attrs, $id);
Flash::success('Aircraft updated successfully.');
return redirect(route('admin.aircraft.index'));
return redirect(route('admin.aircraft.index').'?subfleet='.$aircraft->subfleet_id);
}
/**
@@ -183,6 +184,7 @@ class AircraftController extends Controller
*/
public function destroy($id)
{
/** @var \App\Models\Aircraft $aircraft */
$aircraft = $this->aircraftRepo->findWithoutFail($id);
if (empty($aircraft)) {

View File

@@ -186,13 +186,13 @@ class AwardController extends Controller
{
$award = $this->awardRepository->findWithoutFail($id);
if (empty($award)) {
Flash::error('Fare not found');
Flash::error('Award not found');
return redirect(route('admin.awards.index'));
}
$this->awardRepository->delete($id);
Flash::success('Fare deleted successfully.');
Flash::success('Award deleted successfully.');
return redirect(route('admin.awards.index'));
}

View File

@@ -12,6 +12,7 @@ use App\Repositories\FareRepository;
use App\Services\ExportService;
use App\Services\ImportService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Laracasts\Flash\Flash;
use Prettus\Repository\Criteria\RequestCriteria;
@@ -162,6 +163,8 @@ class FareController extends Controller
return redirect(route('admin.fares.index'));
}
Log::info('Deleting fare "'.$fare->name.'", id='.$fare->id);
$this->fareRepo->delete($id);
Flash::success('Fare deleted successfully.');

View File

@@ -6,6 +6,7 @@ use App\Contracts\Controller;
use App\Repositories\KvpRepository;
use App\Services\CronService;
use App\Services\VersionService;
use App\Support\Utils;
use Codedge\Updater\UpdaterManager;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
@@ -34,7 +35,12 @@ class MaintenanceController extends Controller
public function index()
{
// Get the cron URL
$cron_id = setting('cron.random_id');
$cron_url = empty($cron_id) ? 'Not enabled' : url(route('api.maintenance.cron', $cron_id));
return view('admin.maintenance.index', [
'cron_url' => $cron_url,
'cron_path' => $this->cronSvc->getCronExecString(),
'cron_problem_exists' => $this->cronSvc->cronProblemExists(),
'new_version' => $this->kvpRepo->get('new_version_available', false),
@@ -117,4 +123,33 @@ class MaintenanceController extends Controller
return redirect('/update/downloader');
}
/**
* Enable the cron, or if it's enabled, change the ID that is used
*
* @param Request $request
*/
public function cron_enable(Request $request)
{
$id = Utils::generateNewId(24);
setting_save('cron.random_id', $id);
Flash::success('Web cron refreshed!');
return redirect(route('admin.maintenance.index'));
}
/**
* Disable the web cron
*
* @param Request $request
*
* @return mixed
*/
public function cron_disable(Request $request)
{
setting_save('cron.random_id', '');
Flash::success('Web cron disabled!');
return redirect(route('admin.maintenance.index'));
}
}

View File

@@ -0,0 +1,122 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Contracts\Controller;
use App\Services\ModuleService;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\View\View;
class ModulesController extends Controller
{
private $moduleSvc;
public function __construct(ModuleService $moduleSvc)
{
$this->moduleSvc = $moduleSvc;
}
/**
* Display a listing of the Module.
*
* @return mixed
*/
public function index()
{
$modules = $this->moduleSvc->getAllModules();
$new_modules = $this->moduleSvc->scan();
return view('admin.modules.index', [
'modules' => $modules,
'new_modules' => $new_modules,
]);
}
/**
* Show the form for creating a new Module.
*
* @return Application|Factory|View
*/
public function create()
{
return view('admin.modules.create');
}
/**
* Store a newly Uploaded Module in the Storage.
*
* @param Request $request
*
* @return Application|RedirectResponse|Redirector
*/
public function store(Request $request)
{
$this->moduleSvc->installModule($request->file('module_file'));
return $this->index();
}
/**
* Show the form for editing the specified Module.
*
* @param $id
*
* @return Application|Factory|View
*/
public function edit($id)
{
$module = $this->moduleSvc->getModule($id);
return view('admin.modules.edit', [
'module' => $module,
]);
}
/**
* Update the specified Module in storage.
*
* @param $id
* @param Request $request
*
* @return Application|RedirectResponse|Redirector
*/
public function update($id, Request $request)
{
$this->moduleSvc->updateModule($id, $request->has('enabled'));
flash()->success('Module Status Changed!');
return redirect(route('admin.modules.index'));
}
/**
* Enabling Module Present in the Modules Folder
*
* @param Request $request
*
* @return Application|RedirectResponse|Redirector
*/
public function enable(Request $request)
{
$this->moduleSvc->addModule($request->input('name'));
return redirect(route('admin.modules.index'));
}
/**
* Verify and Remove the specified Module from storage.
*
* @param mixed $id
* @param Request $request
*
* @return mixed
*/
public function destroy($id, Request $request)
{
$delete = $this->moduleSvc->deleteModule($id, $request->all());
if ($delete == true) {
flash()->success('Module Deleted Successfully!');
return redirect(route('admin.modules.index'));
}
flash()->error('Verification Failed!');
return redirect(route('admin.modules.edit', $id));
}
}

View File

@@ -394,10 +394,10 @@ class PirepController extends Controller
return redirect(route('admin.pireps.index'));
}
$this->pirepRepo->delete($id);
$this->pirepSvc->delete($pirep);
Flash::success('Pirep deleted successfully.');
return redirect(route('admin.pireps.index'));
return redirect()->back();
}
/**

View File

@@ -62,7 +62,7 @@ class SettingsController extends Controller
*/
public function index()
{
$settings = Setting::orderBy('order', 'asc')->get();
$settings = Setting::where('type', '!=', 'hidden')->orderBy('order')->get();
$settings = $settings->groupBy('group');
return view('admin.settings.index', [

View File

@@ -7,6 +7,7 @@ use App\Http\Controllers\Admin\Traits\Importable;
use App\Http\Requests\CreateSubfleetRequest;
use App\Http\Requests\UpdateSubfleetRequest;
use App\Models\Airline;
use App\Models\Airport;
use App\Models\Enums\FareType;
use App\Models\Enums\FuelType;
use App\Models\Enums\ImportExportType;
@@ -133,6 +134,7 @@ class SubfleetController extends Controller
{
return view('admin.subfleets.create', [
'airlines' => Airline::all()->pluck('name', 'id'),
'hubs' => Airport::where('hub', 1)->pluck('name', 'id'),
'fuel_types' => FuelType::labels(),
]);
}
@@ -203,6 +205,7 @@ class SubfleetController extends Controller
return view('admin.subfleets.edit', [
'airlines' => Airline::all()->pluck('name', 'id'),
'hubs' => Airport::where('hub', 1)->pluck('name', 'id'),
'fuel_types' => FuelType::labels(),
'avail_fares' => $avail_fares,
'avail_ranks' => $avail_ranks,

View File

@@ -8,6 +8,7 @@ use App\Http\Requests\UpdateUserRequest;
use App\Models\Rank;
use App\Models\Role;
use App\Models\User;
use App\Models\UserAward;
use App\Repositories\AirlineRepository;
use App\Repositories\AirportRepository;
use App\Repositories\PirepRepository;
@@ -20,6 +21,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Log;
use Laracasts\Flash\Flash;
use League\ISO3166\ISO3166;
use Prettus\Repository\Exceptions\RepositoryException;
class UserController extends Controller
@@ -69,7 +71,7 @@ class UserController extends Controller
return view('admin.users.index', [
'users' => $users,
'country' => new \League\ISO3166\ISO3166(),
'country' => new ISO3166(),
]);
}
@@ -82,13 +84,18 @@ class UserController extends Controller
{
$airlines = $this->airlineRepo->selectBoxList();
$airports = $this->airportRepo->selectBoxList(false);
$countries = collect((new ISO3166())->all())
->mapWithKeys(function ($item, $key) {
return [strtolower($item['alpha2']) => $item['name']];
});
return view('admin.users.create', [
'user' => null,
'pireps' => null,
'airlines' => $airlines,
'timezones' => Timezonelist::toArray(),
'country' => new \League\ISO3166\ISO3166(),
'country' => new ISO3166(),
'countries' => $countries,
'airports' => $airports,
'ranks' => Rank::all()->pluck('name', 'id'),
'roles' => Role::all()->pluck('name', 'id'),
@@ -122,31 +129,7 @@ class UserController extends Controller
*/
public function show($id)
{
$user = $this->userRepo->findWithoutFail($id);
if (empty($user)) {
Flash::error('User not found');
return redirect(route('admin.users.index'));
}
$pireps = $this->pirepRepo
->whereOrder(['user_id' => $id], 'created_at', 'desc')
->paginate();
$airlines = $this->airlineRepo->selectBoxList();
$airports = $this->airportRepo->selectBoxList(false);
return view('admin.users.show', [
'user' => $user,
'pireps' => $pireps,
'airlines' => $airlines,
'timezones' => Timezonelist::toArray(),
'country' => new \League\ISO3166\ISO3166(),
'airports' => $airports,
'ranks' => Rank::all()->pluck('name', 'id'),
'roles' => Role::all()->pluck('name', 'id'),
]);
return $this->edit($id);
}
/**
@@ -154,12 +137,14 @@ class UserController extends Controller
*
* @param int $id
*
* @throws RepositoryException
*
* @return mixed
*/
public function edit($id)
{
$user = $this->userRepo
->with(['fields', 'rank'])
->with(['awards', 'fields', 'rank'])
->findWithoutFail($id);
if (empty($user)) {
@@ -171,7 +156,7 @@ class UserController extends Controller
->whereOrder(['user_id' => $id], 'created_at', 'desc')
->paginate();
$countries = collect((new \League\ISO3166\ISO3166())->all())
$countries = collect((new ISO3166())->all())
->mapWithKeys(function ($item, $key) {
return [strtolower($item['alpha2']) => $item['name']];
});
@@ -182,6 +167,7 @@ class UserController extends Controller
return view('admin.users.edit', [
'user' => $user,
'pireps' => $pireps,
'country' => new ISO3166(),
'countries' => $countries,
'timezones' => Timezonelist::toArray(),
'airports' => $airports,
@@ -280,6 +266,28 @@ class UserController extends Controller
return redirect(route('admin.users.index'));
}
/**
* Remove the award from a user
*
* @param \Illuminate\Http\Request $request
* @param mixed $id
* @param mixed $award_id
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy_user_award($id, $award_id, Request $request)
{
$userAward = UserAward::where(['user_id' => $id, 'award_id' => $award_id]);
if (empty($userAward)) {
Flash::error('The user award could not be found');
return redirect()->back();
}
$userAward->delete();
return redirect()->back();
}
/**
* Regenerate the user's API key
*

View File

@@ -7,8 +7,10 @@ use App\Exceptions\AssetNotFound;
use App\Http\Resources\Flight as FlightResource;
use App\Http\Resources\Navdata as NavdataResource;
use App\Models\SimBrief;
use App\Models\User;
use App\Repositories\Criteria\WhereCriteria;
use App\Repositories\FlightRepository;
use App\Services\FareService;
use App\Services\FlightService;
use Exception;
use Illuminate\Http\Request;
@@ -18,19 +20,26 @@ use Prettus\Repository\Exceptions\RepositoryException;
class FlightController extends Controller
{
/** @var \App\Services\FareService */
private $fareSvc;
/** @var \App\Repositories\FlightRepository */
private $flightRepo;
/** @var \App\Services\FlightService */
private $flightSvc;
/**
* FlightController constructor.
*
* @param FareService $fareSvc
* @param FlightRepository $flightRepo
* @param FlightService $flightSvc
*/
public function __construct(
FareService $fareSvc,
FlightRepository $flightRepo,
FlightService $flightSvc
) {
$this->fareSvc = $fareSvc;
$this->flightRepo = $flightRepo;
$this->flightSvc = $flightSvc;
}
@@ -54,9 +63,13 @@ class FlightController extends Controller
*/
public function get($id)
{
/** @var \App\Models\User $user */
$user = Auth::user();
/** @var \App\Models\Flight $flight */
$flight = $this->flightRepo->with([
'airline',
'fares',
'subfleets',
'subfleets.aircraft',
'subfleets.fares',
@@ -66,7 +79,8 @@ class FlightController extends Controller
},
])->find($id);
$this->flightSvc->filterSubfleets(Auth::user(), $flight);
$flight = $this->flightSvc->filterSubfleets($user, $flight);
$flight = $this->fareSvc->getReconciledFaresForFlight($flight);
return new FlightResource($flight);
}
@@ -109,6 +123,7 @@ class FlightController extends Controller
$flights = $this->flightRepo
->with([
'airline',
'fares',
'subfleets',
'subfleets.aircraft',
'subfleets.fares',
@@ -124,7 +139,8 @@ class FlightController extends Controller
// TODO: Remove any flights here that a user doesn't have permissions to
foreach ($flights as $flight) {
$this->flightSvc->filterSubfleets(Auth::user(), $flight);
$this->flightSvc->filterSubfleets($user, $flight);
$this->fareSvc->getReconciledFaresForFlight($flight);
}
return FlightResource::collection($flights);
@@ -137,20 +153,25 @@ class FlightController extends Controller
*
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
*/
public function briefing($id)
public function briefing(string $id)
{
/** @var User $user */
$user = Auth::user();
$w = [
'user_id' => $user->id,
'flight_id' => $id,
'id' => $id,
];
/** @var SimBrief $simbrief */
$simbrief = SimBrief::where($w)->first();
if ($simbrief === null) {
throw new AssetNotFound(new Exception('Flight briefing not found'));
}
/*if ($simbrief->user_id !== $user->id) {
throw new Unauthorized(new Exception('User cannot access another user\'s simbrief'));
}*/
return response($simbrief->acars_xml, 200, [
'Content-Type' => 'application/xml',
]);

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