Compare commits

...

211 Commits

Author SHA1 Message Date
B.Fatih KOZ
ced2012578 Update simbrief_briefing.blade.php (#1497)
Change in blade forms to SimBrief provided direct links.
2022-11-30 07:47:10 -06:00
fagidutt
00918f54aa Fix division by Zero in pireps/show.blade.php (#1493)
* Fix division by Zero in pireps/show.blade.php

Division by Zero caused by possible null distance fixed by adding check.

* Update show.blade.php

* Update show.blade.php

* Update show.blade.php

Final form :)
2022-11-03 12:11:57 -04:00
Nabeel S
41bd325f9a Revert "Bug fix #1414 (#1487)" (#1492)
This reverts commit b4311b861f.
2022-10-30 22:58:26 -04:00
Yash Govekar
b4311b861f Bug fix #1414 (#1487)
* Update module migrate command to avoid errors.

* Fixed issue #1414
2022-10-24 11:11:00 -04:00
B.Fatih KOZ
2f9e8583f2 Flight Visibility Visuals (#1485)
Added "visible" field display and form checkbox to control it easily from admin side (instead of going through database)
2022-10-14 13:27:46 -04:00
John Cheng
2155979eb9 Patch currency subunit conversion (#1484)
* added parentheses around the conversion

* updated finance test

updated the following test:
- journal operations

fixed the following tests:
- pirep finances
- pirep finances specific expense
- pirep finances expenses multi airline
2022-10-09 08:13:11 -05:00
Toni Vicente
f30a3bc1ef fix typo lang es-es (#1480) 2022-08-30 09:42:50 -04:00
B.Fatih KOZ
3461672f10 Fixes (#1481)
Fare Service : Return the note, do not force it to an empty string

Airport Importer : Make IATA nullable (as in the model)
2022-08-29 15:39:58 -04:00
B.Fatih KOZ
b4d5114ea2 Apply color customization (#1479) 2022-08-29 12:43:50 -04:00
Nabeel S
231e54ea5e Map color options (#1478)
* Add colors to the maps options

* Update assets build
2022-08-22 14:05:19 -04:00
B.Fatih KOZ
b1ae0240be Roles Update (#1474)
Adds member count to roles\index and member list to roles\edit pages.

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2022-08-21 10:59:19 -04:00
B.Fatih KOZ
64e470abec Add Radio Callsign To Airlines (#1475)
Adds a new db field for radio telephony callsign for airlines.

Also adds necessary field to admin template.
2022-08-21 10:48:18 -04:00
Nabeel S
695ab3a90d Dependency updates (#1473)
* Update PHP dependencies

* Update NPM modules

* Fix dependency versions
2022-08-15 12:55:36 -04:00
B.Fatih KOZ
0e1b55c6d7 Add baggage weight to acdata (#1464)
Follow up for improved SimBrief API, sending separate pax and bag weights is possible now.

Core v7 already had them separated ;)

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2022-08-15 11:32:52 -04:00
B.Fatih KOZ
ba5b4e23c7 Fix dead links (#1455)
* Fix dead links

Fixed one dead link, removed another one and changed load factor and variance fields to accept only numbers between 0-100.

* Update fields.blade.php

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2022-08-15 11:26:34 -04:00
B.Fatih KOZ
ef38d39ec4 Add "Notes" to Airports (#1467)
* Notes for Airports

Adds capability of having notes/remarks for airports, includes

* New database field
* Airport Model change
* CSV Import/Export capability for notes
* Admin Airports list page change
* Admin Airports edit page change
* Default Template Airport show page change

* Update Airport Tests

* Add the new field to source csv
* Check if the import works

* Update AirportFactory.php

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2022-08-15 11:23:39 -04:00
B.Fatih KOZ
ccebc69be2 Add ability to export members of a subfleet only (#1471)
* Export Subfleet Members

* Style Fix

* Fix php-cs style complaints

* Disable php-cs-fixer and fix styles
2022-08-15 10:45:10 -04:00
Jordan Havard
6becc6de63 Fix docker dev links (#1470)
Updated `docker-compose.local.yml` to `docker-compose.dev.yml` to reflect the correct docker files
2022-08-15 09:43:50 -04:00
Nabeel Shahzad
ca1cd01f3d Style fixes 2022-03-28 13:55:42 -04:00
Nabeel Shahzad
e2226b7400 Make sure fare is set to active 2022-03-28 13:23:27 -04:00
Nabeel Shahzad
991f661144 Don't map local env to dev so dev seeds won't run 2022-03-24 16:55:21 -04:00
Nabeel Shahzad
d1b7905e95 StyleCI fix 2022-03-18 16:57:48 -04:00
Nabeel Shahzad
ca8d96d2b6 Check for null/0 value on progress percent 2022-03-18 16:43:34 -04:00
Nabeel S
12848091a2 Laravel 9 Update (#1413)
Update to Laravel 9 and PHP 8+

Co-authored-by: B.Fatih KOZ <fatih.koz@gmail.com>
2022-03-14 11:45:18 -04:00
B.Fatih KOZ
00bf18c225 Fix Cron Deleting Paused Pireps (#1434) 2022-03-07 09:55:30 -05:00
Toni Vicente
b81dd97822 Changed es directory es by es-es (#1421)
This structure will allow for other variants derived from the Spanish of Spain.

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2022-02-28 13:34:01 -05:00
B.Fatih KOZ
7a40a9d128 Add DRAFT state in conditional check (#1422)
Add DRAFT state in conditional check
2022-02-28 09:52:57 -05:00
B.Fatih KOZ
9d368e8efa Allow bids on same flight by multiple users
Dash out unnecessary check, let multiple users to bid on same flight according to settings.
2022-02-25 14:40:53 -05:00
Toni Vicente
219a7cf6f9 fixed incorrect translation & Make TOC only readeable (#1408)
* fixed incorrect translation

Bloque de combustible -> Combustible en calzos

* Make TOC only redeable

make toc only readable for the user
2022-02-22 09:35:21 -05:00
Nabeel Shahzad
54bc5ccb30 Update example cron path to point to bin/cron 2022-02-21 10:36:54 -05:00
Nabeel Shahzad
648659aea5 Check if PIREP doesn't exist before cancelling 2022-02-16 19:13:47 -05:00
B.Fatih KOZ
08f82f8a2e Admin and Discord Notification Improvements (#1407)
* Backend changes

Sorting for : Airlines, Subfleets, Type Ratings and exported Flights

Blade : Added WYSIWYG editor to flight remarks/notes field

Notifications :

Mails > Added enabled/disabled settings for mails. Discord > Dashed out PirepPreFiled, re-enabled PirepStatusChanged with reduced messages

* Update PirepStatusChanged.php

* Update NotificationEventsHandler.php

* in_array fix

* Fix Discord Notifications

* Discord Notifications

Removed the pirep url from message as it is mostly private at phpvms side.

Also removed the Flight Ident from fields 'cause it is being used in the title.

Added the user avatar as thumbnail, and pirep filed message uses the airline logo as the main image.

Even though the outgoing pirep status messages are reduced, it is still possible to enable/disable them from admin settings.

Pirep Filed is always being sent (if the webhook is defined)

* StyleFix
2022-02-14 16:24:22 -05:00
Nabeel Shahzad
60cec870f6 Add aircraft ident to API response 2022-02-14 12:53:12 -05:00
Nabeel S
78fd8367a1 Add separate cron runner that doesn't use proc_open (#1405)
* Add alternative to using the artisan schedule runner

* StyleCI fixes

* Add additional cron time periods

* Style fixes

* Typo

* Update the web cron to use the new system

* Write out JSON for which tasks were run

* Rename cron.php to just cron
2022-02-11 16:24:06 -05:00
B.Fatih KOZ
607ea6f5e5 Add Notes to Users (#1406)
* Fix migration

Add Notes

* Migration to add mediumtext field
* Model update
* Admin blade update

* Hide notes by default

* Fix fields layout
2022-02-11 15:58:16 -05:00
Nabeel Shahzad
9e080d544a Fix Discord webhook URLs 2022-02-09 13:20:57 -05:00
Nabeel S
cb38f2ad90 Refactor broadcast notifications (#1402)
* Refactor broadcast notifications

* StyleCI fixes

* Fix the planned_distance accidental changes
2022-02-08 15:07:02 -05:00
Nabeel S
6cfbd91328 Update package versions (#1399)
* Update dependencies

* Symfony components downgrade

* Restrict symfony versions with meta package

* Downgrade valuestore

* Symfony versions

* More downgrades

* Package versions

* Package versions
2022-02-08 11:12:39 -05:00
B.Fatih KOZ
9253d39848 Custom Code for Pilot IDents (#1398)
* Custom Code for Pilot IDents

Adds a new setting to customize the ident or to use a fixed icao code in a multi airline environment.

If settings is null/empty, airline icao will be used as like before.

* StyleFix
2022-02-07 17:47:57 -05:00
arthurpar06
737b2f137f Fix French translations (#1394)
Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2022-02-07 16:15:25 -05:00
B.Fatih KOZ
c518175244 Update User Model (#1396)
Current GDPR compliant Private Name attribute is not compatible with multi byte strings, and when encountered it fails and returns an empty string for the name_private attribute.

`substr($last_name, 0, 1)` or just `$last_name[0]` is not multi byte compatible, therefore only solution is to use `mb_substr`.

It also supports encoding definitions like `mb_substr($last_name, 0, 1, 'UTF-8')`

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2022-02-07 16:10:58 -05:00
B.Fatih KOZ
08624042f2 Make name and e-mail based searches with like for easier administration. (#1397)
* Update UserRepository.php

Make `name` and `e-mail` based searches with `like` for easier administration and search.

* Update search.blade.php

Remove old dashed out code

* Update index.blade.php

Add proper state selections
2022-02-07 16:02:17 -05:00
B.Fatih KOZ
94735103aa French Translation (#1392)
Author: Jacques M.
( Jbaltazar67 from phpVMS Forum/Discord )
2022-02-04 15:39:10 -05:00
Nabeel Shahzad
e4782c40f3 Fix tests 2022-02-04 15:03:05 -05:00
Nabeel Shahzad
670cb5d811 Check for bid existing or not 2022-02-04 14:21:59 -05:00
Nabeel Shahzad
88ffee16be Remove PII from debug info for user 2022-02-04 14:17:07 -05:00
Nabeel Shahzad
cc5a6db427 Nullable return type 2022-02-04 14:15:42 -05:00
Nabeel Shahzad
74a1b4d753 Add subfleet data when single bid is retrieved 2022-02-04 14:13:40 -05:00
Nabeel S
8a94d8db7b Add LGA flight 2022-01-29 14:49:38 -05:00
Nabeel S
c2cc067329 ICAO typo for sample data 2022-01-28 16:35:24 -05:00
Nabeel Shahzad
723f66a382 More data updates 2022-01-27 13:30:49 -05:00
Nabeel Shahzad
27be992395 Update seeds for a shorter test flight 2022-01-27 12:14:28 -05:00
Sam
6160d57790 Fix docker image name (#1382)
closes #1381
2022-01-11 09:46:53 -05:00
B.Fatih KOZ
7fabd57e13 Fix flight and subfleet import with edited fares (#1379)
* Fix fare import

* StyleFix
2022-01-11 08:17:32 -05:00
B.Fatih KOZ
09453becf8 Award Checks Update (#1376)
Add active/passive check for awards and update the handler to pass only active ones to the process when needed.
2022-01-10 15:49:50 -05:00
B.Fatih KOZ
023313c681 Check settings and filter aircraft list if needed (#1377)
Check settings and filter aircraft list if needed.
2022-01-10 13:29:30 -05:00
B.Fatih KOZ
d3b7d25abd Add ability to export flights of an airline only(#1375)
* Airline Flight Export

Add ability to export flights of an airline only

* StyleFix
2022-01-10 09:27:40 -05:00
B.Fatih KOZ
7799867302 Fix Weather Widget blade (#1372)
Old blade was failing due to missing items in a metar like below

`SVMC 031703Z AUTO NIL`
2022-01-04 14:51:39 -05:00
B.Fatih KOZ
fd7c1b8314 Update RegisterController.php (#1373)
Get only active and displayed UserFields.
2022-01-04 14:29:41 -05:00
B.Fatih KOZ
c12cf0964a Fix setting name (#1371) 2021-12-14 18:10:39 -05:00
Nabeel S
2202d5bf99 Setting for how often the live map updates #1369 (#1370) 2021-12-14 12:48:21 -05:00
B.Fatih KOZ
064682b71f Type Rating update (#1366)
* Update Typerating.php

Add `'active'` to fillable

* Update fields.blade.php

Fixed grid, positioning of checkbox label and removed extra row
2021-12-08 12:40:10 -05:00
Nabeel Shahzad
3c9d419ebb Clarify logs for pirep cancel/updates 2021-12-07 13:24:18 -05:00
Nabeel S
a3f110c0c0 Add PHP 8.1 to shims and build (#1365)
* Add PHP 8.1 to shims and build

* Lock psr/container version

* Lock psr version

* Restrict symfony component versions

* Downgrade event-dispatcher-contracts

* Update more package versions

* php-cs fixes

* style fix

* cs-fixer file fix

* Exclude resources dir from cs fixer

* Ignore cs fixer env check

* Update league/csv
2021-12-03 09:23:59 -05:00
B.Fatih KOZ
c45d52dffa Aircraft level Hub definitions (#1363)
* Aircraft level Hub definitions

* Add ability to define a hub for an aircraft apart from its subfleet.

* Update csv import/export capability for hub_id field

* Fix importertest source csv

* Fix source csv for updating too

* Update aircraft_empty_cols.csv

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-11-30 14:54:29 -05:00
B.Fatih KOZ
4d21ca0982 Update RegisterController.php (#1358)
Only active fields should be passed to view during registration.

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-11-30 14:40:18 -05:00
B.Fatih KOZ
52e716d6ee Type Ratings | New Feature (#1360)
* Type Ratings

Adding "Type Rating" definition and assignment possibility to v7 core.

* Update ProfileController.php

* StyleFix 1

* Update settings.yml

Change description text as requested
2021-11-30 14:36:17 -05:00
B.Fatih KOZ
66d83c0ce6 Add flight_time to searchable fields (#1356) 2021-11-18 15:05:04 -05:00
B.Fatih KOZ
4ea8357952 Fix SimBrief Controller | flight relationships (#1350)
* Update SimBriefController.php

Fix the fares relationship which was causing trouble when a flight had assigned fares

* Fix model name used in relationship

`Simbrief` should be `SimBrief`
2021-11-16 16:26:43 -05:00
B.Fatih KOZ
b9c29fbe08 More $pirep->ident usage fixes (#1353)
* Fix idents with double code

* Fix ident usage

* Fix ident usage

* Fix ident usage
2021-11-16 11:39:47 -05:00
B.Fatih KOZ
4e7149a51c Fix Admin pirep card | $pirep->ident usage (#1349)
Removed `$pirep->airline->code`

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-11-09 09:55:58 -05:00
B.Fatih KOZ
4c60e5da69 Eager loading update for frontend controllers and widgets (#1348)
* Update AirportController.php

Eager load `files`

* Update DashboardController.php

 Eager load `journal` for user , and `aircraft, arr_airport, comments, dpt_airport` for last_pirep.

* Update FlightController.php

Eager load + `alt_airport, subfleets` (with their airlines) for flights and `current_airport` for user 
(though current_airport can be removed and we can base the in blade checks on `$user->curr_airport_id` to reduce db reads and model loading)

* Update HomeController.php

Eager load `home_airport` for users

* Update PirepController.php

Eager load `airline, aircraft, fares, transactions, dpt_airport, arr_airport, comments, simbrief, user with rank` for pirep details

* Update ProfileController.php

Eager load `airline, awards, current_airport, fields.field, home_airport, last_pirep, rank` for user

* Update UserController.php

Eager load `airline, current_airport, fields.field, home_airport, rank` for users and count `awards`

* Update AirportController.php

* Update DashboardController.php

* Update PirepController.php

* Update ProfileController.php

* Update LatestNews.php

Eager load `user` for news

* Update LatestPilots.php

Eager load `home_airport` for latest users

* StyleFix 1

* StlyeFix 1.5

* Update SimBriefController.php

Eager load airline with flight

* Update SimBriefController.php

* Update SimBriefController.php
2021-11-09 09:51:02 -05:00
B.Fatih KOZ
2dbe19fdcc Fix pirep->ident usage issues (#1347)
* Update table.blade.php

* Update show.blade.php

* Update pirep_card.blade.php

* Update latest_pireps.blade.php

* Update ProfileController.php

Removed non used airports, added necessary relationships for eager loading.

Also removed `fields` 'cause it is already being loaded when `fields.field` is used. No need to query it twice.

* Update ProfileController.php
2021-11-08 16:08:19 -05:00
B.Fatih KOZ
358f0b663e Fix Aircraft Model | Add trait for relationship (#1345)
* Add trait for relationship

* StlyeFix
2021-11-03 12:51:34 -04:00
B.Fatih KOZ
9146c4a68f Update UserFieldValue Model (#1344)
* Add `name` attribute

* Pre-StyleFix

* Update UserFieldValue.php

* Used optional()

* Update Pirep.php

* Update Flight.php

* Update User.php
2021-11-03 08:46:07 -04:00
B.Fatih KOZ
addfa68016 Add Aircraft > Simbrief relationship (#1343) 2021-11-02 10:54:36 -04:00
B.Fatih KOZ
571768b39d Match Flight and Pirep ident attributes (#1342)
* Flight ident change

* Pirep ident change

* Update Pirep.php
2021-11-02 09:23:52 -04:00
B.Fatih KOZ
9956929df7 Add callsign to flight search (#1341)
Make callsign searchable

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-11-02 09:00:29 -04:00
B.Fatih KOZ
f498ad3bba Airline <> Aircraft Relationships (#1338)
* Aircraft relationship

* Airline relationship

* Flight and Pirep Relationships

* Style and logic fix
2021-11-02 08:40:50 -04:00
Toni Vicente
471464272f Improve ES translations (#1340)
Fix spells and better words in context
2021-10-31 16:19:16 -04:00
Nabeel S
85703e1aff Update composer dependencies (#1337) 2021-10-25 11:38:32 -04:00
B.Fatih KOZ
930d4cfa08 Update Aircraft Model (Landing Time Attribute) (#1336)
* Update Aircraft.php

Return `landing_time` attribute in Carbon format if it is not empty

* StyleFix
2021-10-25 10:11:52 -04:00
B.Fatih KOZ
91d68308aa Fix translations (#1335)
* English

* German

* Italian

* Portuguese
2021-10-22 13:27:14 -04:00
B.Fatih KOZ
4eca1f671f Fix WX Widget row (#1334)
* Fix WX Widget row

* Change degree symbol to html
2021-10-22 10:31:24 -04:00
Toni Vicente
1e7e8cc5e5 Temperature (#1332)
Add temp "es" string
@lang temp to widget wheather blade
2021-10-21 12:28:58 -04:00
B.Fatih KOZ
c65b5c1b05 Fix logical operator | Admin -> Pireps (#1331)
Reject button was not showing up for pending pireps due to usage of `@elseif`. Now both Accept and Reject buttons should be visible for pending pireps.
2021-10-18 10:13:32 -04:00
B.Fatih KOZ
87886f2419 Fix Admin / Flight Search (Blade) (#1325) 2021-10-01 08:50:22 -04:00
B.Fatih KOZ
9a28cf22ff Add Custom Fares (#1323)
* Update EventServiceProvider.php

Add FareListener

* Create Fares.php

* Create FareListener.php

* Update ExpenseListener.php

* Update PirepFinanceService.php

Add listener for the fares, process them like the custom expenses and apply if there are any returned
2021-09-30 11:10:05 -04:00
B.Fatih KOZ
7a29630f57 Admin blade improvements (#1321)
* Update search.blade.php

Used select2 for airports, fixed grid layout

* Update actions.blade.php

Fixed button placing

* Update pirep_card.blade.php

Added user id before the name, made name optional so if page hits an hard deleted user's pirep it will not fail. Also improved the flight level check.
2021-09-29 10:37:05 -04:00
Nabeel S
0b27635fcb Docker/compose updates (#1280)
* Docker/compose updates

* Fix container name

* Add zip to the ext install

* Don't mount the env.php file

* Use newer "docker compose" command

* Install composer

* Remove chown
2021-09-29 10:14:46 -04:00
B.Fatih KOZ
f3b032e56b Add airline_id to created subfleet/subfleets during flight import. (#1320)
Add airline_id to created subfleet/subfleets during flight import.
2021-09-28 20:17:12 -04:00
B.Fatih KOZ
f99af4cfc3 Fix logical operator (#1318)
That `if` should return `true` when both conditions are met (pirep not accepted and not rejected yet), so **AND** must be used there ;) Sorry for the trouble.

Now it works and listens more carefully.
2021-09-23 17:07:38 -04:00
B.Fatih KOZ
14e33574fc Default PirepState logic and location change (#1317)
* Update PirepService.php

Moved `$default_state` logic below `PirepFiled` event, so admins can have some flexibility to define their own default states by listening that event.

Any ideas ?

Hopefully closes #1312

* Update PirepService.php

Added the missing `$pirep->refresh();`
2021-09-23 15:04:24 -04:00
B.Fatih KOZ
bd892f5407 Fix Admin/Subfleet Edit (#1315)
As like the db and model, admins should be able to not choosing a hub for their fleets here.
2021-09-21 13:29:47 -04:00
B.Fatih KOZ
96e63f1572 Make hub_id optional in subfleet import (#1314)
`hub_id` is not a mandatory field (both in model and database), so it should be `nullable` here too.
2021-09-21 09:14:36 -04:00
B.Fatih KOZ
a0309b6303 Maintenance Status for Aircraft (#1311)
* Update AircraftStatus.php

* EN

* DE

* ES

* IT

* PT-BR
2021-09-16 15:15:50 -04:00
B.Fatih KOZ
e13a019a40 Flight Type Translations (#1306)
* Flights EN

* Flights DE

* Flights ES

* Flights IT

* Flights PT-BR
2021-09-10 08:17:19 -04:00
B.Fatih KOZ
91f928ecf4 Add missing base fare values from template (#1302)
Add missing base fare values

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-09-08 12:22:17 -04:00
Nabeel Shahzad
226ae6d109 Style fixes 2021-09-08 10:51:04 -04:00
lesmar54
90d1708aab Fixes to CSV import Exports (#1299)
* Update SubfleetImporter.php

Correction to the import to include Simbrief Code

* Update SubfleetImporter.php

Added in the missing fields HUB-ID and SIMBrief as these are input on the main screen

* Update AircraftImporter.php

Part of the missing data fields in csv import export

* Update FlightImporter.php

Part of the missing fields in csv import and export

* Update AircraftImporter.php

* Update FlightImporter.php

* Update aircraft.csv

Test data amended as part of the missing csv fields

* Update subfleets.csv

Part of the fix for missing fields in csv files used for import/export

* Update flights.csv

* Update FlightImporter.php

* Update subfleets.csv

Removed unused fields

* Update FlightImporter.php

* Update FlightImporter.php

* Update FlightImporter.php

* amended for new csv file layouts
2021-09-08 09:50:34 -04:00
B.Fatih KOZ
6eef246b6a Improve Map features (GeoJson) (#1290)
* Update GeoService.php

Replace double name usage with more valuable info

* Update GeoService.php

Changed `GS` with `Spd` 'cause it may be IAS or GS according to the phase of the flight.

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-08-30 13:00:27 -04:00
B.Fatih KOZ
fc8ca69729 Fix Private Profile fields not being editable (#1289)
* Update ProfileController.php

* Update UserRepository.php

* Update UserRepository.php

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-08-30 12:55:33 -04:00
B.Fatih KOZ
57277c558d Fix Fare not properly set in controller (#1291)
* Update FareService.php

* Update PirepController.php

Move the logic to controller as requested

* Update FareService.php

Reverting back the service changes as requested

* StyleFix
2021-08-30 12:50:04 -04:00
B.Fatih KOZ
b0f52ed1d0 Remove SimBrief with Bid (#1283)
* Update BidService.php

* Update BidService.php

Delete directly ;)
2021-08-13 14:39:18 -04:00
Khendal
d64e674c21 Update pirep_card.blade.php (#1282)
Added Pilot name in card to know who have submitted the pirep.
2021-08-13 11:51:52 -04:00
B.Fatih KOZ
40c911ff17 Add web middleware to laravel-widgets (#1281)
Title says it all ... Added web middleware to laravel-widgets config so the widget auto-reload / auto-refresh options can work with full functionality.
2021-08-12 08:40:41 -04:00
B.Fatih KOZ
b6abe8dd5b Bid check for flights/show (#1278)
* Update FlightController.php

Add missing $bid to flight/show so when needed Load In Acars button can be placed there too.

* Update show.blade.php

Add Load In Acars button to flight details page (flights/show.blade.php)
2021-08-10 13:23:43 -04:00
Nabeel Shahzad
54c3c8f346 Fix user id check in template 2021-08-09 18:12:48 -04:00
Nabeel S
c250fce84b Cast the user ID to int in the sb model (#1277) 2021-08-09 13:54:40 -04:00
Nabeel S
4125cdd373 Launch ACARS link on the simbrief page #1272 (#1276) 2021-08-09 12:01:27 -04:00
Nabeel S
6eb883de73 Dependency updates (#1274)
* Dependency updates

* Downgrade league/commonmark to 1.6
2021-08-08 11:48:45 -04:00
Nabeel Shahzad
49528c9644 Remove tar-to-zip dep 2021-08-07 12:58:31 -04:00
Nabeel Shahzad
4475813a12 remove dotfiles again 2021-08-07 12:51:13 -04:00
Nabeel Shahzad
681e39650b Try to fix dots in tar 2021-08-07 12:24:15 -04:00
Nabeel Shahzad
bbbe8a8bd3 remove base dir 2021-08-07 12:16:16 -04:00
Nabeel Shahzad
0acab21712 Fix cd 2021-08-07 11:54:33 -04:00
Nabeel Shahzad
a17840d690 Another zip fix attempt 2021-08-07 11:46:43 -04:00
Nabeel Shahzad
fe87f21599 Restrict zip to current dir 2021-08-07 11:37:26 -04:00
Nabeel Shahzad
2756c34702 Try fixing zip 2021-08-07 11:34:06 -04:00
Nabeel S
564f9ec06e Add ability to launch acars for flight/bid #1272 (#1273)
* Add ability to launch acars for flight/bid #1272

* Check for module active/inactive status

* Just some formatting
2021-08-06 14:53:04 -04:00
Nabeel S
95e1df619e Trap exception/check for module existing on disk #1211 (#1271)
* Trap exception/check for module existing on disk #1211

* Style fixes
2021-08-06 13:30:24 -04:00
B.Fatih KOZ
4a04d73d08 Update DownloadController.php (#1267)
* Update DownloadController.php

* StyleFix

* Another StyleFix !

* Update DownloadController.php

* Last StyleFix and Update

* Apply StyleCI fix

Co-authored-by: Nabeel Shahzad <nabeel@nabeel.sh>
2021-08-02 14:43:38 -04:00
Nabeel S
88a8ffe48a Check for blank values on import and omit them (#1266)
* Check for blank values on import and omit them

* Add paused status to the pirep changed
2021-07-22 15:56:03 -04:00
Nabeel Shahzad
78d3c6b577 Fix where for paused 2021-07-22 12:47:55 -04:00
Nabeel S
f42a41286d Add a 'paused' state (#1265)
* Add a 'paused' state

* Check paused status
2021-07-22 11:59:52 -04:00
Nabeel S
f8ded4e410 Update dependencies (#1262)
* Update dependencies

* Rebuild assets with updated deps
2021-07-21 10:43:36 -04:00
B.Fatih KOZ
6304f3cab4 Fix PirepService (#1261)
`$fv['name']` should be used instead of `$fv->name` due to the nature of source data.

Fixes #1260
2021-07-16 13:24:31 -04:00
Nabeel Shahzad
4eb73ab5f3 Update 3rd party services config 2021-07-13 14:38:42 -04:00
Nabeel Shahzad
2af72d137d Have emails go into the logs by default, make note to users to change that #1259 2021-07-12 17:18:28 -04:00
Nabeel Shahzad
f68e068f87 Use MAIL_MAILER #1259 2021-07-12 13:50:36 -04:00
Nabeel Shahzad
89f9706520 Include all dotfiles in zip 2021-07-12 12:47:24 -04:00
Nabeel Shahzad
cde6fb314b Add footer requirement into license explicitly 2021-06-20 09:07:13 -04:00
Nabeel Shahzad
1a944f320c Make the license extra clear 2021-06-19 15:58:56 -04:00
Nabeel Shahzad
d7ad2bdd11 Fix PIREP rejected message #1246 2021-06-18 13:21:59 -04:00
Nabeel Shahzad
24fca650f8 Use old notification handler for admin notifications 2021-06-18 11:33:02 -04:00
Nabeel S
35359b8646 Create endpoint to load bid by ID (#1248)
* Create endpoint to load bid by ID

* Fix endpoint
2021-06-17 19:42:56 -04:00
B.Fatih KOZ
b6a2fe405d Update AcarsRepository (#1245)
* Update AcarsRepository.php

Use `where` instead of `whereDate` , as you know whereDate only checks the date, it skips the time part completely, thus not providing correct live pireps collection.

* Switch from created_at to updated_at

Also remove the UTC conversion 'cause `updated_at` field is not being populated with UTC values.
2021-06-14 07:05:28 -04:00
Nabeel Shahzad
bd9c429cfc Don't force status to airborne 2021-06-13 15:28:57 -04:00
Nabeel Shahzad
b18f1bbe6c Fix paginate on airlines 2021-06-11 09:40:42 -04:00
Andrew Roberts
a5a21fb2fd Fix missing colon on ./vendor volume (#1243)
docker up throwing error due to missing colon on the ./vendor folder
2021-06-11 08:46:37 -04:00
Nabeel Shahzad
845514da2c Fix tests 2021-06-10 13:13:09 -04:00
Nabeel Shahzad
531489bfde Remove pagination from getting airlines 2021-06-10 12:41:23 -04:00
Nabeel Shahzad
601a17e1e6 Blank out links for ACARS 2021-06-10 11:08:25 -04:00
Nabeel Shahzad
3be8b1c4b9 undo links 2021-06-10 10:09:28 -04:00
Nabeel Shahzad
b4e33bb37e Update akaunting money library 2021-06-10 09:08:41 -04:00
Nabeel Shahzad
a8e6f1191b Fix the missing links array 2021-06-10 08:46:56 -04:00
Nabeel Shahzad
3a0140c2d0 Don't use backup for cache key on dependencies 2021-06-09 16:29:57 -04:00
Nabeel Shahzad
547b159570 Zip file generation 2021-06-09 16:22:25 -04:00
Nabeel Shahzad
cab5c03c0b Generate zip file differently 2021-06-09 16:17:06 -04:00
B.Fatih KOZ
777a696b35 Use Profile Route for Author URL (Discord Messages) (#1227)
* Update PirepStatusChanged.php

Use profile route for author url instead of pirep

* Update PirepSubmitted.php

Use profile route for author url instead of pirep

* Update PirepPrefiled.php

Use profile route for author instead of pirep

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-06-09 11:43:08 -04:00
B.Fatih KOZ
90344fb6e6 Simbrief Edit & Download Latest OFP (#1228)
* SimBrief OFP Edit

Changes aim to have ability of editing generated SimBrief Flight Plans and re-downloading.

* Move url to config

* Blade update and $uri change

* Update simbrief_form.blade.php

Used `$flight->id` along with `$user->ident` to have a more unique static id value. No details given for that fields uniqueness requirements, this will be ok I think though. 
Also we are passing user's simbrief userid with api to find the flight plan, both combined, no chance to get another users plan and/or any other plan of same user.

* Update SimBriefController.php

Move `static_id` to controller

* Update simbrief_form.blade.php

Read `static_id` from controller

* StyleFix

* Update phpvms.php

* Update SimBriefService.php

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-06-09 11:38:14 -04:00
Nabeel S
7481dab012 Remove extraneous data from API response; force API to en (#1241)
* Remove extraneous data from API response; force API to en

* Style fixes

* Remove

* Fix the meta block

* Style fixes
2021-06-09 11:20:25 -04:00
Nabeel Shahzad
dead1cfd0f Style fixes 2021-06-08 17:49:42 -04:00
Nabeel Shahzad
544462f420 Fix environment mapping 2021-06-08 17:46:15 -04:00
B.Fatih KOZ
a31201dfd3 Fix secstohhmm typecast for PHP 8 (#1230)
* Update helpers.php

Looks like php8 is not liking numeric strings as we like them.

Fixes #1229

* StyleFix

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-06-08 11:00:18 -04:00
Andrew Roberts
9d336c1140 Fix typo (#1234) 2021-06-08 10:45:17 -04:00
Nabeel S
96d33c11c8 Fix data not showing up for live map (#1223)
* Fix data not showing up for live map

* StyleCI fixes
2021-06-04 16:57:27 -04:00
Robin
48cada2053 Fixed German Translation (#1222)
* New Language: German

* Update German K

* Fixed German Translation

Co-authored-by: derrobin154 <derrobin154@gmail.com>
Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-06-04 16:53:11 -04:00
Nabeel Shahzad
2a05013f66 Discord: Only add fields and footer if they're not empty 2021-06-04 15:16:36 -04:00
Nabeel Shahzad
4267648da5 Fields/fares not being saved properly 2021-06-04 15:06:19 -04:00
Nabeel Shahzad
5ada327236 Log request/response for Discord 2021-06-04 13:57:16 -04:00
Nabeel S
82825ef77b Add setting for recording IP address (#1221)
* Add setting for recording IP address

* Record IP on registration
2021-06-04 13:20:33 -04:00
Nabeel S
db532e0f16 Remove the IP address from being recorded (#1220) 2021-06-04 12:10:40 -04:00
Nabeel S
9b2e466b7e Discord notifications for PIREP and News events #433 (#1215)
* Discord notifications for events #433

* Style fixes

* Check for blank webhook urls and disable

* Cleanup items after review

* Changes and fixes

* Style fixes

* Don't load env for testing

* Fix status text

* Refactor saving fields/fares so events get the latest data

* Cleanup

* Style fixes
2021-06-04 10:51:59 -04:00
B.Fatih KOZ
17447c6903 Block aircraft with Simbrief (#1213)
* Block Aircraft with SimBrief

Changes aim to have the ability to block an aircraft's usage if it is used to generate a SimBrief OFP.

Unused/Expired briefings will be deleted by cron like before but will now be checked by HourlyCron, so admins can define more precise restrictions for them (and the blockage period of their aircraft)

Owner of the SimBrief OFP will be able to start a flight with acars using that particular aircraft, but pilots will get an Aircraft Not Available error (similar to Aircraft State check)

To prevent SimBrief OFP packs being marked as expired/unused, during pirep prefile, pirep_id will be saved to SimBrief model along with flight_id.

And when a flight is finished (pirep file), flight_id will be removed from SimBrief model as before. Only pirep_id will remain and aircraft will be available for another OFP generation.

* Update PirepController

In case a pirep is being saved/submitted with manual entry (but the va is using simbrief effectively) same logic should be applied during save/submit button selection.
Save will act like a pirep prefile , Submit will be pirep file.

* Manual Pirep Checks

Manual pireps, prefiled from a generated simbrief should be checked too. Also pirep.show blade's submit button should provide the same simbrief checks.

* Update PirepService.php

* Change settings and move sb cron to hourly

* StyleFix (SimBriefService)

* Another StyleFix (SimBriefService)

* Update SimBriefController

Removed null check of pirep_id for aircraft list generation to prevent live flights' aircraft being listed for another ofp generation.
( Active acars flights will have both flight_id and pirep_id at simbrief table)

* Update PirepService.php

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-06-03 16:17:16 -04:00
B.Fatih KOZ
ad86e996d7 Fix Aircraft Dropdown Grouping (#1216)
* Update PirepController

Frontend : Use `$subfleet->type`  instead of `name` for grouping aircraft list.

* Update PirepController (Admin)

Use `$subfleet->type` instead of `name` here too , for grouping aircraft list according to their subfleets.

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-06-03 14:41:31 -04:00
Robin
5a5fd02dac New Language: German (#1218)
* New Language: German

* Update German K

Co-authored-by: derrobin154 <derrobin154@gmail.com>
2021-06-03 11:46:32 -04:00
Nabeel Shahzad
97f095e4e9 Set default env name to "production" and debug to false 2021-05-29 18:13:36 -04:00
Jesper Falk
a2f91b6754 Add GD PHP Extension for docker container (#1212) 2021-05-28 08:48:52 -04:00
Nabeel Shahzad
a9e5554dea Trap migration error for modules if they don't exist 2021-05-27 16:14:13 -04:00
B.Fatih KOZ
5b10dca868 Fix SimBriefService (#1209)
* Fix removeExpiredEntires()

* Fix SimBriefTest

No need to add `'pirep_id' => ''` , just let it be `null` (like the core code does) and no need to convert Carbon to DateTimeString.
2021-05-27 09:27:38 -04:00
B.Fatih KOZ
11cebb3e6e Show only used Flight Types at Flight Search (#1207)
* Update Flight Controller

Show only used flight types in the search form instead of all IATA Flight Types.

* PrePR StyleFix

* StyleFix

* Use Model instead of DB

Also used the same $where array

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-05-25 16:14:42 -04:00
B.Fatih KOZ
96c17d33bc Add ability to search Flights by Code (#1205)
* Edit Search Form

Add ability to search via flight/route code (technically it was possible but the field was not present in the blade)

* Add Code (EN)

* Add Code (ES)

* Add Code (IT)

* Add Code (PT-BR)

* FlightCode => Code

* FlightCode => Code

* FlightCode => Code

* FlightCode => Code

* FlightCode => Code
2021-05-25 15:33:02 -04:00
Nabeel Shahzad
9abc892698 Update README 2021-05-25 15:11:09 -04:00
Nabeel Shahzad
67a51da220 Cleanup the docker-compose for local testing 2021-05-25 15:07:04 -04:00
Nabeel Shahzad
7e586a273a File/dir ownership in container 2021-05-25 13:37:53 -04:00
Nabeel Shahzad
8a591c11a5 Fix docker-compose for use non-locally 2021-05-25 13:14:08 -04:00
B.Fatih KOZ
728b033675 Fix Admin: UserController and Flight Edit (#1204)
* Fix Admin / UserController

Use Role Repository and `selectBoxList` method instead of the model itself.

* Fix Flight Fields

Added empty/blank option for clearing out the days when needed

* StyleFix
2021-05-24 19:13:44 -04:00
B.Fatih KOZ
68a6ed24cb Fix Flight Importer (#1202)
* Handle Route and Level fields too during import.
* Also removed the check for `visible => true` from `firstorNew` 'cause va admin may be importing to update not visible flights too.
  (by default all new flights are visible, so no affect on new flights)

Closes #1201
2021-05-24 15:19:06 -04:00
Nabeel S
7d8a34645e Add --force flag to migrations (#1203) 2021-05-24 10:58:10 -04:00
B.Fatih KOZ
4985da991b Remove Scripts (#1200)
* Remove Scripts

Remove scripts from create blade which are designed for edit blade in the first place (thus looking for flight object and its properties). 
No need to have an eyecandy date picker or a days selector, previous working version of create.blade was more than enough to manually add fights.

* Add placeholder for date fields
2021-05-23 20:47:15 -04:00
Nabeel Shahzad
c94358350a Add queue worker setting so those aren't run in cron if there's a worker 2021-05-21 12:31:32 -04:00
Nabeel S
d3ec0f4de3 5 char ICAO support #1052 (#1198) 2021-05-21 10:52:47 -04:00
Nabeel S
ede5b74383 Make fuel_used an optional field in PIREP file (#1197) 2021-05-21 10:02:07 -04:00
Nabeel S
e7bbd6cccb Use queues for notifications #1154 (#1174)
* Use queues for notifications #1154

* Styles

* Update defaults

* Include queueworker
2021-05-20 11:54:07 -04:00
Nabeel S
edcea258ce Remove the autoupdater #1133 (#1195)
* Remove the autoupdater #1133

* Remove self-updater package

* Package still needed :|
2021-05-20 11:37:27 -04:00
Nabeel Shahzad
5adc0b4072 Remove unused import 2021-05-20 09:20:12 -04:00
Nabeel Shahzad
fe7120e21a Add PHP 7.4 polyfill 2021-05-20 08:55:55 -04:00
B.Fatih KOZ
30be7c245c Fix Advanced Fuel Calculations (#1190)
* Fix Advanced Fuel Calculations

Current code works fine with a fresh submitted pirep but when a re-calculation is needed, fuel amount will not be correct if the aircraft was flown later on.
Commit provides fix for such re-calculation scenarios.

* StyleFix for the Comment Line !
2021-05-19 19:01:33 -04:00
Nabeel S
7cb9ae4ec3 intl dependency/polyfill updates (#1194) 2021-05-19 13:57:28 -04:00
Olli
6f1a5f1dc2 Update Flight Controller to fix an issue (#1192)
Closes #1180 and #1156. But now the script isn't beeing loaded

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
2021-05-19 13:42:40 -04:00
Nabeel Shahzad
e3c3c81d19 Include missing scripts in flight create 2021-05-19 13:33:13 -04:00
Nabeel S
352f1ee9f8 Days::in should use in_mask; tests coverage #1180 (#1193) 2021-05-19 11:20:50 -04:00
Nabeel Shahzad
dff4273c72 Force empty to be 0 for in_mask #1180 2021-05-19 10:22:15 -04:00
Nabeel S
77a4acb569 Update dependencies (#1188) 2021-05-14 13:02:47 -04:00
B.Fatih KOZ
ff6827b368 Fix Installer Completed Blade (#1185)
We do not have a config.php anymore, page should refer to env.php for base level configuration.
2021-05-14 12:31:24 -04:00
B.Fatih KOZ
594d0eb222 Check Aircraft Availability (#1177)
* Check Aircraft Availability before Prefile

Check if the aircraft is available for flight (State : Parked / On Ground). If not throw new exception AircraftNotAvailable

* Add Exception

AircraftNotAvailable exception, used by PirepService during prefile checks.
2021-05-13 15:26:53 -04:00
Nabeel S
ee61de62fa Update to PHP 8 (#1118)
* Update to PHP 8

* Update composer file

* Remove PHP 8 incompatible library

* Remove PHP 8 incompatible library
2021-05-11 18:46:21 -04:00
B.Fatih KOZ
f2be14402f PirepCancelled Event (Cron Expired Pirep Deletion) (#1178)
* PirepCancelled Event (Cron Expired Pirep Deletion)

While deleting frozen in progress pireps we should at least send a PirepCancelled event for those who are listening.

(or we may have a new PirepDeleted event to be issued in such cases, I think PirepCancelled is enough though)

* StyleFix

* Another StyleFix

* Missing Log

Of course it will not be possible to write log entries without the Log itself.
2021-05-09 18:30:50 -04:00
B.Fatih KOZ
a186bfae2a Fix AirportController (Frontend) (#1176)
1. Inbound and Outbound flights were displaying all flights (active and inactive) , fixed to fetch only active flights.
2. Flash message and redirect to Dashboard was not working, instead we were getting 404 Not Found error.
2021-05-08 15:42:18 -04:00
Nabeel S
6e6ba85080 Fix for duplicated/wrong expenses being applied #915 (#1173)
* Fix for duplicated/wrong expenses being applied #915

* Style fixes
2021-05-06 12:42:56 -04:00
B.Fatih KOZ
d2272e32a6 100LL and MOGAS Fuel Cost (#1172)
* Add defaults for 100LL and MOGAS prices

Add missing defaults for 100LL and MOGAS Fuel prices.

* Calculate Fuel Cost according to Fuel Type

Calculate pirep fuel costs according to aircraft (subfleet) fuel type, use JetA as fail safe default.

* Fix for Failing AwardTest

At least attempting to fix

* Fix fuel types logic

* Style

* Invert the logic

Co-authored-by: Nabeel Shahzad <nabeel@nabeel.sh>
2021-05-06 08:16:33 -04:00
Nabeel S
b6c0946795 Delete users without PIREPS; pilot leave fix (#1171)
* Delete users without PIREPS; pilot leave fix

* Style fixes
2021-05-05 09:56:28 -04:00
Andrew Roberts
fca04e6b0c Allow session lifetime to be set in env variables (#1170)
* Allow session lifetime to be set in env variables

Currently the session live time defaults to 2 hours, adding an env variable will allow us to change this on a per site basis

* Add whitespace for consistency
2021-05-05 08:51:18 -04:00
Andrew Roberts
5094fce4b0 Disable autocomplete on admin email field (#1169)
* Disable autocomplete on admin email field

Fixes #1165

* Disable autocomplete on admin name and password

For sake of completeness and due to some over zealous autocompleters, also disable it on name and password fields
2021-05-04 13:26:16 -04:00
Nabeel S
fe0ef60b6c Block refiling of PIREPs (#1167)
* Block refiling of PIREPs

* Style fixes

* Package updates
2021-05-03 10:00:10 -04:00
B.Fatih KOZ
5094375e13 Fixes For GDPR/Deleted Users (#1164)
* Fix DeletedUsers being displayed at Homepage

Deleted users should not be displayed at homepage / newest pilots list. PR fixes that problem.

* Do Not Display Deleted Users with LatestPireps

As the main page, Latest Pilots widget should not display GDPR/Soft deleted users too.

* StyleFix
2021-05-03 08:46:21 -04:00
Nabeel Shahzad
ec6cb42bfd User guard for null 2021-04-23 13:47:54 -04:00
Nabeel S
14d0e99a37 Delete the user in a GDPR compatible way (#1151)
* Delete the user in a GDPR compatible way

* Block user from calls

* Style fix
2021-04-23 10:33:13 -04:00
B.Fatih KOZ
f8c7bc31f5 Add Airline ICAO to Subfleet selectBoxList (#1153)
* Add Airline ICAO to Subfleet selectBoxList

Subfleet dropdown at flight search will look like `Boeing B737-800 WL | THY`

* StyleFix
2021-04-23 09:44:37 -04:00
Nabeel Shahzad
2545328233 Fix APP_URL being called SITE_URL 2021-04-20 23:28:57 -04:00
710 changed files with 44920 additions and 49787 deletions

View File

@@ -15,7 +15,10 @@ declare -a remove_files=(
.idea
.travis
docker
node_modules
vendor/willdurand/geocoder/tests
_ide_helper.php
.env
.dockerignore
.dpl
.editorconfig
@@ -23,6 +26,7 @@ declare -a remove_files=(
.eslintrc
.php_cs
.php_cs.cache
.php-cs-fixer.php
.phpstorm.meta.php
.styleci.yml
.phpunit.result.cache
@@ -30,15 +34,15 @@ declare -a remove_files=(
intellij_style.xml
config.php
docker-compose.yml
docker-compose.local.yml
Makefile
phpcs.xml
phpunit.xml
phpvms.iml
Procfile
phpstan.neon
node_modules
symfony.lock
composer.phar
vendor/willdurand/geocoder/tests
)
for file in "${remove_files[@]}"; do
@@ -69,13 +73,25 @@ mkdir -p storage/framework/views
cd /tmp
echo "Current directory contents"
ls -al $BASE_DIR
echo "Parent directory contents"
ls -al $BASE_DIR/../
tar -czf $TAR_NAME -C $BASE_DIR .
echo "Calling find"
find $BASE_DIR/../ -type d -maxdepth 2
tar -czf $TAR_NAME -C $BASE_DIR --xform 's:^\./::' . [--show-transformed-names|--show-stored-names]
sha256sum $TAR_NAME >"$TAR_NAME.sha256"
tar2zip $TAR_NAME
cd $BASE_DIR;
zip -r $ZIP_NAME ./
sha256sum $ZIP_NAME >"$ZIP_NAME.sha256"
mv $ZIP_NAME /tmp
mv "$ZIP_NAME.sha256" /tmp
ls -al /tmp
echo "Moving to dist"

View File

@@ -2,12 +2,12 @@ name: 'Build'
on: ['push', 'pull_request', 'workflow_dispatch', 'release']
jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
if: github.repository == 'nabeelio/phpvms'
strategy:
fail-fast: true
matrix:
php-versions: ['7.3', '7.4']
php-versions: ['8.0', '8.1']
name: PHP ${{ matrix.php-versions }}
env:
extensions: intl, pcov, mbstring
@@ -41,7 +41,6 @@ jobs:
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
# Configure PHP
- name: Setup PHP
@@ -70,6 +69,7 @@ jobs:
run: |
php --version
mysql --version
sleep 15
# Downgrade composer version to 1.x
composer install --dev --no-interaction --verbose
cp .github/scripts/env.php env.php
@@ -79,7 +79,8 @@ jobs:
- name: Run Tests
run: |
vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --diff --using-cache=no
export PHP_CS_FIXER_IGNORE_ENV=1
#vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -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
@@ -87,7 +88,7 @@ jobs:
artifacts:
name: 'Create dev build'
needs: build
runs-on: 'ubuntu-18.04'
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
steps:
- name: Checkout
@@ -96,7 +97,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.0'
- uses: olegtarasov/get-tag@v2.1
id: tagName
@@ -117,7 +118,6 @@ jobs:
- 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/*
@@ -150,7 +150,7 @@ jobs:
release:
name: 'Create Release'
needs: build
runs-on: 'ubuntu-18.04'
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
@@ -159,7 +159,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: 8.0
- uses: olegtarasov/get-tag@v2.1
id: tagName
@@ -180,7 +180,6 @@ jobs:
- 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/*

12
.gitignore vendored
View File

@@ -22,6 +22,7 @@ storage/*.sqlite
.env.*.php
.env.php
.env
.env.*
.env.bak
env.php
.env.generated
@@ -76,3 +77,14 @@ error_log
/config.php
/config.bak.php
/VERSION
sync.sh
###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###
###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

69
.php-cs-fixer.php Normal file
View File

@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
$header = <<<'EOF'
This file is part of PHP CS Fixer.
(c) Fabien Potencier <fabien@symfony.com>
Dariusz Rumiński <dariusz.ruminski@gmail.com>
This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
EOF;
$finder = PhpCsFixer\Finder::create()
->ignoreVCSIgnored(true)
->exclude('tests/data')
->exclude('storage')
->exclude('resources')
->in(__DIR__)
->append([
__DIR__.'/dev-tools/doc.php',
// __DIR__.'/php-cs-fixer', disabled, as we want to be able to run bootstrap file even on lower PHP version, to show nice message
__FILE__,
])
;
$config = new PhpCsFixer\Config();
$config
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'strict_param' => true,
'no_php4_constructor' => true,
'no_extra_blank_lines' => true,
'no_superfluous_elseif' => true,
'single_line_comment_style' => false,
'simple_to_complex_string_variable' => true,
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'operators' => [
'=>' => 'align_single_space_minimal'
]
],
/*
'blank_line_before_statement' => [
'statements' => [
'declare',
'for',
'return',
'throw',
'try',
],
],
*/
])
->setFinder($finder);
return $config;

37
.php_cs
View File

@@ -1,37 +0,0 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in('app')
->in('config');
return PhpCsFixer\Config::create()
->setHideProgress(true)
->setUsingCache(false)
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'strict_param' => true,
'no_php4_constructor' => true,
'no_extra_blank_lines' => true,
'no_superfluous_elseif' => true,
'single_line_comment_style' => false,
'simple_to_complex_string_variable' => true,
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'align_double_arrow' => true,
],
/*
'blank_line_before_statement' => [
'statements' => [
'declare',
'for',
'return',
'throw',
'try',
],
],
*/
])
->setFinder($finder);

View File

@@ -1,29 +1,35 @@
FROM php:7.4-fpm-alpine
FROM php:8.1-fpm-alpine3.15
WORKDIR /var/www/
RUN apk add gmp-dev icu-dev
RUN curl --silent --show-error https://getcomposer.org/installer | php
# Setup composer
COPY --from=composer:2.2.7 /usr/bin/composer /usr/local/bin/composer
RUN apk add gmp-dev icu-dev zlib-dev libpng-dev libzip-dev zip
# Copy any config files in
COPY resources/docker/php/ext-opcache.ini $PHP_INI_DIR/conf.d/
COPY resources/docker/php/www.conf /usr/local/etc/php-fpm.d/www.conf
RUN ln -sf /dev/stderr /var/log/fpm-error.log
RUN docker-php-ext-install \
calendar \
intl \
pdo_mysql \
gd \
gmp \
opcache && \
docker-php-ext-enable pdo_mysql opcache
bcmath \
opcache \
zip && \
docker-php-ext-enable pdo_mysql opcache bcmath zip intl
COPY . /var/www/
RUN php composer.phar install \
RUN composer install \
--ignore-platform-reqs \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist
#RUN chown -R www-data:www-data /var/www
EXPOSE 9000

View File

@@ -1,5 +1,3 @@
BSD 3-Clause License
Copyright (c) 2017, phpvms - http://www.phpvms.net
All rights reserved.
@@ -17,6 +15,9 @@ modification, are permitted provided that the following conditions are met:
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
* A "powered by phpvms" is required in page footers, unless the license has
purchased to omit it.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE

View File

@@ -80,11 +80,7 @@ test:
.PHONY: phpcs
phpcs:
@vendor/bin/php-cs-fixer fix --config=.php_cs -v --diff --diff-format=udiff --dry-run
#.PHONY: phpstan
#phpstan:
# vendor/bin/phpstan analyse -c phpstan.neon -v --level 2 app
@PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --dry-run --diff --using-cache=no
.PHONY: replay-acars
replay-acars:
@@ -95,11 +91,6 @@ replay-acars:
sass-watch:
sass --watch public/assets/admin/sass/paper-dashboard.scss:public/assets/admin/css/paper-dashboard.css
.PHONY: schema
schema:
#php artisan infyom:scaffold Aircraft --fieldsFile=database/schema/aircraft.json
echo ""
.PHONY: deploy-package
deploy-package:
./.travis/deploy_script.sh
@@ -109,17 +100,9 @@ reset-installer:
@php artisan database:create --reset
@php artisan migrate:refresh --seed
.PHONY: docker
docker:
@mkdir -p $(CURR_PATH)/tmp/mysql
-docker rm -f phpvms
docker build -t phpvms .
docker run --name=phpvms \
-v $(CURR_PATH):/var/www/ \
-v $(CURR_PATH)/tmp/mysql:/var/lib/mysql \
-p 8080:80 \
phpvms
.PHONY: docker-test
docker-test:
@docker compose -f docker-compose.dev.yml up
.PHONY: docker-clean
docker-clean:

View File

@@ -11,7 +11,7 @@ A full distribution, with all of the composer dependencies, is available at this
### Requirements
- PHP 7.3+, extensions:
- PHP 8.0+, extensions:
- cURL
- JSON
- mbstring
@@ -30,15 +30,16 @@ A full distribution, with all of the composer dependencies, is available at this
[View installation details](https://docs.phpvms.net/installation/installation)
## Development Environment
## Development Environment with Docker
A full development environment can be brought up using Docker:
A full development environment can be brought up using Docker, without having to install composer/npm locally
```bash
composer install
npm install
docker-compose build
docker-compose up
make docker-test
# **OR** with docker-compose directly
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
```
Then go to `http://localhost`. If you're using dnsmasq, the `app` container is listening on `phpvms.test`, or you can add to your `/etc/hosts` file:
@@ -47,6 +48,8 @@ Then go to `http://localhost`. If you're using dnsmasq, the `app` container is l
127.0.0.1 phpvms.test
```
The `docker-compose.local.yml` overrides the `app` section in `docker-compose.yml`. The standard `docker-compose.yml` can be used if you want to deploy from the image, or as a template for your own Dockerized deployments.
### Building JS/CSS assets
Yarn is required, run:

View File

@@ -17,25 +17,25 @@ class AcarsReplay extends Command
*
* @var string
*/
protected $apiKey = 'testadminapikey';
protected string $apiKey = 'testadminapikey';
/**
* For automatic updates, how many seconds to sleep between updates
*
* @var int
*/
protected $sleepTime = 10;
protected int $sleepTime = 10;
/**
* @var array key == update[callsign]
* value == PIREP ID
*/
protected $pirepList = [];
protected array $pirepList = [];
/**
* @var Client
*/
protected $httpClient;
protected Client $httpClient;
/**
* Return an instance of an HTTP client all ready to post

View File

@@ -2,11 +2,11 @@
namespace App\Console\Commands;
use App;
use App\Contracts\Command;
use App\Services\Installer\ConfigService;
use App\Services\Installer\SeederService;
use DatabaseSeeder;
use Illuminate\Support\Facades\App;
/**
* Create the config files
@@ -16,8 +16,8 @@ class CreateConfigs extends Command
protected $signature = 'phpvms:config {db_host} {db_name} {db_user} {db_pass}';
protected $description = 'Create the config files';
private $databaseSeeder;
private $seederSvc;
private DatabaseSeeder $databaseSeeder;
private SeederService $seederSvc;
public function __construct(DatabaseSeeder $databaseSeeder, SeederService $seederSvc)
{

View File

@@ -11,7 +11,11 @@ class CreateDatabase extends Command
{
protected $signature = 'database:create {--reset} {--migrate} {--conn=?}';
protected $description = 'Create a database';
protected $os;
/**
* @var Detector
*/
protected Detector $os;
/**
* CreateDatabase constructor.

View File

@@ -24,7 +24,8 @@ class DevCommands extends Command
{
protected $signature = 'phpvms {cmd} {param?}';
protected $description = 'Developer commands';
protected $dbSvc;
protected DatabaseService $dbSvc;
/**
* DevCommands constructor.

View File

@@ -13,7 +13,7 @@ class DevInstall extends Command
protected $signature = 'phpvms:dev-install {--reset-db} {--reset-configs}';
protected $description = 'Run a developer install and run the sample migration';
private $databaseSeeder;
private \DatabaseSeeder $databaseSeeder;
public function __construct(\DatabaseSeeder $databaseSeeder)
{

View File

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

View File

@@ -10,7 +10,7 @@ class ImportCsv extends Command
protected $signature = 'phpvms:csv-import {type} {file}';
protected $description = 'Import from a CSV file';
private $importer;
private ImportService $importer;
/**
* Import constructor.

View File

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

View File

@@ -8,7 +8,11 @@ use GuzzleHttp\Client;
class TestApi extends Command
{
protected $signature = 'phpvms:test-api {apikey} {url}';
protected $httpClient;
/**
* @var Client
*/
protected Client $httpClient;
/**
* Run dev related commands

View File

@@ -10,8 +10,14 @@ class Version extends Command
{
protected $signature = 'phpvms:version {--write} {--base-only} {--write-full-version} {version?}';
private $versionSvc;
/**
* @var VersionService
*/
private VersionService $versionSvc;
/**
* @param VersionService $versionSvc
*/
public function __construct(VersionService $versionSvc)
{
parent::__construct();

View File

@@ -12,7 +12,11 @@ class YamlImport extends Command
{
protected $signature = 'phpvms:yaml-import {files*}';
protected $description = 'Developer commands';
protected $dbSvc;
/**
* @var DatabaseService
*/
protected DatabaseService $dbSvc;
/**
* YamlImport constructor.

90
app/Console/Cron.php Normal file
View File

@@ -0,0 +1,90 @@
<?php
/**
* This runs any of the cron tasks that are set to run according to the Laravel schedule
*/
namespace App\Console;
use App\Console\Cron\FifteenMinute;
use App\Console\Cron\FiveMinute;
use App\Console\Cron\Hourly;
use App\Console\Cron\JobQueue;
use App\Console\Cron\Monthly;
use App\Console\Cron\Nightly;
use App\Console\Cron\ThirtyMinute;
use App\Console\Cron\Weekly;
use App\Contracts\Command;
use Illuminate\Console\Scheduling\Schedule;
class Cron
{
/** @var Schedule */
private $scheduler;
/**
* @var string[] The cron tasks which get called/run
*/
private $cronTasks = [
JobQueue::class,
FiveMinute::class,
FifteenMinute::class,
ThirtyMinute::class,
Hourly::class,
Nightly::class,
Weekly::class,
Monthly::class,
];
/**
* @var array Stores the instantiated cron tasks
*/
private $cronRunners = [];
/**
* @param Schedule $scheduler
*/
public function __construct(Schedule $scheduler)
{
$this->scheduler = $scheduler;
foreach ($this->cronTasks as $task) {
/** @var Command $cronTask */
$cronTask = app($task);
$signature = $cronTask->getSignature();
if (empty($signature)) {
continue;
}
$this->cronRunners[$signature] = $cronTask;
}
}
/**
* Try to figure out which commands are supposed to run right now
*
* @return array string of tasks that were run
*/
public function run(): array
{
$events = $this->scheduler->dueEvents(app());
if (empty($events)) {
return [];
}
$run = [];
/** @var \Illuminate\Console\Scheduling\Event $event */
foreach ($events as $event) {
foreach ($this->cronRunners as $signature => $task) {
if (!str_contains($event->command, $signature)) {
continue;
}
$task->callEvent();
$run[] = $signature;
}
}
return $run;
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Console\Cron;
use App\Contracts\CronCommand;
use App\Events\CronFifteenMinute;
/**
* The actual cron tasks are in app/Cron
*/
class FifteenMinute extends CronCommand
{
protected $signature = 'cron:fifteen';
protected $description = 'Run the 15 minute cron tasks';
protected $schedule;
public function handle(): void
{
$this->callEvent();
}
public function callEvent()
{
event(new CronFifteenMinute());
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Console\Cron;
use App\Contracts\CronCommand;
use App\Events\CronFiveMinute;
/**
* This just calls the CronNightly event, so all of the
* listeners, etc can just be called to run those tasks
*
* The actual cron tasks are in app/Cron
*/
class FiveMinute extends CronCommand
{
protected $signature = 'cron:five';
protected $description = 'Run the 5 minute cron tasks';
protected $schedule;
public function handle(): void
{
$this->callEvent();
}
public function callEvent()
{
event(new CronFiveMinute());
}
}

View File

@@ -2,14 +2,14 @@
namespace App\Console\Cron;
use App\Contracts\Command;
use App\Contracts\CronCommand;
use App\Events\CronHourly;
/**
* This just calls the CronHourly event, so all of the
* listeners, etc can just be called to run those tasks
*/
class Hourly extends Command
class Hourly extends CronCommand
{
protected $signature = 'cron:hourly';
protected $description = 'Run the hourly cron tasks';
@@ -17,7 +17,11 @@ class Hourly extends Command
public function handle(): void
{
$this->redirectLoggingToFile('cron');
$this->callEvent();
}
public function callEvent()
{
event(new CronHourly());
}
}

View File

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

View File

@@ -2,7 +2,7 @@
namespace App\Console\Cron;
use App\Contracts\Command;
use App\Contracts\CronCommand;
use App\Events\CronMonthly;
/**
@@ -11,7 +11,7 @@ use App\Events\CronMonthly;
*
* The actual cron tasks are in app/Cron
*/
class Monthly extends Command
class Monthly extends CronCommand
{
protected $signature = 'cron:monthly';
protected $description = 'Run the monthly cron tasks';
@@ -19,7 +19,11 @@ class Monthly extends Command
public function handle(): void
{
$this->redirectLoggingToFile('cron');
$this->callEvent();
}
public function callEvent()
{
event(new CronMonthly());
}
}

View File

@@ -2,7 +2,7 @@
namespace App\Console\Cron;
use App\Contracts\Command;
use App\Contracts\CronCommand;
use App\Events\CronNightly;
/**
@@ -11,7 +11,7 @@ use App\Events\CronNightly;
*
* The actual cron tasks are in app/Cron
*/
class Nightly extends Command
class Nightly extends CronCommand
{
protected $signature = 'cron:nightly';
protected $description = 'Run the nightly cron tasks';
@@ -19,7 +19,11 @@ class Nightly extends Command
public function handle(): void
{
$this->redirectLoggingToFile('cron');
$this->callEvent();
}
public function callEvent()
{
event(new CronNightly());
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Console\Cron;
use App\Contracts\CronCommand;
use App\Events\CronThirtyMinute;
/**
* The actual cron tasks are in app/Cron
*/
class ThirtyMinute extends CronCommand
{
protected $signature = 'cron:thirty';
protected $description = 'Run the 30 minute cron tasks';
protected $schedule;
public function handle(): void
{
$this->callEvent();
}
public function callEvent()
{
event(new CronThirtyMinute());
}
}

View File

@@ -2,7 +2,7 @@
namespace App\Console\Cron;
use App\Contracts\Command;
use App\Contracts\CronCommand;
use App\Events\CronWeekly;
/**
@@ -11,7 +11,7 @@ use App\Events\CronWeekly;
*
* The actual cron tasks are in app/Cron
*/
class Weekly extends Command
class Weekly extends CronCommand
{
protected $signature = 'cron:weekly';
protected $description = 'Run the weekly cron tasks';
@@ -19,7 +19,11 @@ class Weekly extends Command
public function handle(): void
{
$this->redirectLoggingToFile('cron');
$this->callEvent();
}
public function callEvent()
{
event(new CronWeekly());
}
}

View File

@@ -2,9 +2,13 @@
namespace App\Console;
use App\Console\Cron\FifteenMinute;
use App\Console\Cron\FiveMinute;
use App\Console\Cron\Hourly;
use App\Console\Cron\JobQueue;
use App\Console\Cron\Monthly;
use App\Console\Cron\Nightly;
use App\Console\Cron\ThirtyMinute;
use App\Console\Cron\Weekly;
use App\Services\CronService;
use Illuminate\Console\Scheduling\Schedule;
@@ -25,10 +29,23 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule): void
{
// If not using the queue worker then run those via cron
if (!config('queue.worker', false)) {
$schedule->command(JobQueue::class)
->everyMinute()
->withoutOverlapping();
}
/*
* NOTE: IF MORE TASKS ARE ADDED, THEY ALSO MUST BE ADDED TO THE CRON.PHP
*/
$schedule->command(FiveMinute::class)->everyFiveMinutes();
$schedule->command(FifteenMinute::class)->everyFifteenMinutes();
$schedule->command(ThirtyMinute::class)->everyThirtyMinutes();
$schedule->command(Nightly::class)->dailyAt('01:00');
$schedule->command(Hourly::class)->hourly();
$schedule->command(Weekly::class)->weeklyOn(0);
$schedule->command(Monthly::class)->monthlyOn(1);
$schedule->command(Hourly::class)->hourly();
// When spatie-backups runs
/*if (config('backup.backup.enabled', false) === true) {

View File

@@ -37,10 +37,10 @@ abstract class Award
*/
/** @var \App\Models\Award|null */
protected $award;
protected ?AwardModel $award;
/** @var \App\Models\User|null */
protected $user;
protected ?User $user;
public function __construct(AwardModel $award = null, User $user = null)
{
@@ -69,9 +69,9 @@ abstract class Award
/**
* Add the award to this user, if they don't already have it
*
* @return bool|UserAward
* @return bool|UserAward|null
*/
protected function addAward()
protected function addAward(): bool|UserAward|null
{
$w = [
'user_id' => $this->user->id,

View File

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

View File

@@ -84,19 +84,21 @@ abstract class Controller extends \Illuminate\Routing\Controller
*
* @param $message
* @param null|mixed $count
* @param mixed $attrs
*
* @return \Illuminate\Http\JsonResponse
*/
public function message($message, $count = null)
public function message($message, $count = null, $attrs = [])
{
$attrs = [
$ret = [
'message' => $message,
'attrs' => $attrs,
];
if ($count !== null) {
$attrs['count'] = $count;
$ret['count'] = $count;
}
return response()->json($attrs);
return response()->json($ret);
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Contracts;
abstract class CronCommand extends Command
{
/**
* @return mixed
*/
abstract public function callEvent();
/**
* Adjust the logging depending on where we're running from
*/
public function __construct()
{
parent::__construct();
$this->redirectLoggingToFile('cron');
}
}

View File

@@ -7,14 +7,14 @@ namespace App\Contracts;
*/
abstract class Enum
{
protected static $cache = [];
protected static $codes = [];
protected static $labels = [];
protected static array $cache = [];
protected static array $codes = [];
protected static array $labels = [];
/**
* @var int
*/
protected $value;
protected int $value;
/**
* Create an instance of this Enum
@@ -29,9 +29,9 @@ abstract class Enum
/**
* Return the value that's been set if this is an instance
*
* @return mixed
* @return int|null
*/
final public function getValue()
final public function getValue(): ?int
{
return $this->value;
}
@@ -41,9 +41,9 @@ abstract class Enum
*
* @param $value
*
* @return mixed
* @return string
*/
final public static function label($value)
final public static function label($value): string
{
if (isset(static::$labels[$value])) {
$val = static::$labels[$value];
@@ -53,6 +53,8 @@ abstract class Enum
return $val;
}
return $value;
}
/**
@@ -87,11 +89,11 @@ abstract class Enum
*
* @return false|int|string
*/
public static function convertToCode($value)
public static function convertToCode($value): bool|int|string|null
{
$value = (int) $value;
if (!array_key_exists($value, static::$codes)) {
return;
return null;
}
return static::$codes[$value];

View File

@@ -0,0 +1,9 @@
<?php
namespace App\Contracts;
use Illuminate\Database\Eloquent\Factories\Factory as EloquentFactory;
abstract class Factory extends EloquentFactory
{
}

View File

@@ -166,10 +166,36 @@ class ImportExport
return [];
}
if (strpos($split_values[0], '?') !== false) {
// This contains the query string, which turns it into a multi-level array
$query_str = explode('?', $split_values[0]);
$parent = trim($query_str[0]);
$children = [];
$kvp = explode('&', trim($query_str[1]));
foreach ($kvp as $items) {
if (!$items) {
continue;
}
$this->kvpToArray($items, $children);
}
$ret[$parent] = $children;
return $ret;
}
// This is not a query string, return it back untouched
return [$split_values[0]];
}
foreach ($split_values as $value) {
$value = trim($value);
if ($value === '') {
continue;
}
// This isn't in the query string format, so it's
// just a straight key-value pair set
if (strpos($value, '?') === false) {

View File

@@ -4,7 +4,6 @@ namespace App\Contracts;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Log;
class Notification extends \Illuminate\Notifications\Notification implements ShouldQueue
{
@@ -17,25 +16,13 @@ class Notification extends \Illuminate\Notifications\Notification implements Sho
{
// Look in the notifications.channels config and see where this particular
// notification can go. Map it to $channels
$klass = static::class;
/*$klass = static::class;
$notif_config = config('notifications.channels', []);
if (!array_key_exists($klass, $notif_config)) {
Log::error('Notification type '.$klass.' missing from notifications config, defaulting to mail');
return;
}
$this->channels = $notif_config[$klass];
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)
{
return $this->channels;
$this->channels = $notif_config[$klass];*/
}
}

View File

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

View File

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

View File

@@ -3,7 +3,6 @@
namespace App\Contracts;
use ArrayAccess;
use PhpUnitsOfMeasure\Exception\UnknownUnitOfMeasure;
/**
* Abstract unit wrapper
@@ -11,45 +10,89 @@ use PhpUnitsOfMeasure\Exception\UnknownUnitOfMeasure;
class Unit implements ArrayAccess
{
/**
* The unit this is kept as
* The localized unit the user wants it displayed in
*/
public $unit;
public string $localUnit;
/**
* All of the units of this class
* The unit that this value is stored in locally
*/
public $units;
public string $internalUnit;
/**
* All of the units of this class which are reported in an API response
*/
public array $units;
/**
* Holds an instance of the PhpUnit type
*
* @var \PhpUnitsOfMeasure\AbstractPhysicalQuantity
*/
protected $instance;
protected mixed $instance;
/**
* Units that are included as part of the REST response
*/
public $responseUnits = [];
public array $responseUnits = [];
/**
* @return mixed
* Factory method for creating a new unit type
*
* @param mixed $value
* @param string $unit
*
* @throws \Exception
*
* @return Unit
*/
public function value()
public static function make(mixed $value, string $unit): self
{
return $this->__toString();
if ($value instanceof self) {
return $value;
}
return new static($value, $unit);
}
/**
* Return the value in an internal format
*
* @param int|null $round Optional value to round to
*
* @return float|null
*/
public function internal(?int $round = null): ?float
{
return $this->toUnit($this->internalUnit, $round);
}
/**
* Return the value in the localized format
*
* @param int|null $round Optional value to round to
*
* @return float|null
*/
public function local(?int $round = null): ?float
{
return $this->toUnit($this->localUnit, $round);
}
/**
* Just call toUnit() on the PhpUnitOfMeasure instance
*
* @param string $unit
* @param string $unit
* @param int|null $round Optional value to round to
*
* @return mixed
* @return float|null
*/
public function toUnit($unit)
public function toUnit(string $unit, ?int $round = null): ?float
{
return $this->instance->toUnit($unit);
$val = $this->instance->toUnit($unit);
if ($round === null) {
return $val;
}
return round($val, $round);
}
/**
@@ -59,7 +102,7 @@ class Unit implements ArrayAccess
{
$response = [];
foreach ($this->responseUnits as $unit) {
$response[$unit] = $this[$unit] ?? 0;
$response[$unit] = round($this->instance->toUnit($unit), 2);
}
return $response;
@@ -72,7 +115,7 @@ class Unit implements ArrayAccess
*
* @return bool
*/
public function offsetExists($offset)
public function offsetExists($offset): bool
{
return $this->offsetGet($offset) !== null;
}
@@ -80,19 +123,15 @@ class Unit implements ArrayAccess
/**
* Implements ArrayAccess
*
* @param $offset
* @param $unit
*
* @return mixed
* @return float|null
*/
public function offsetGet($offset)
public function offsetGet($unit): ?float
{
try {
$value = $this->instance->toUnit($offset);
if (!$value) {
return;
}
} catch (UnknownUnitOfMeasure $e) {
return;
$value = $this->instance->toUnit($unit);
if (!$value) {
return null;
}
return round($value, 2);
@@ -124,6 +163,6 @@ class Unit implements ArrayAccess
*/
public function __toString()
{
return (string) $this->offsetGet($this->unit);
return (string) $this->offsetGet($this->localUnit);
}
}

View File

@@ -1,9 +1,9 @@
<?php
namespace App\Cron\Nightly;
namespace App\Cron\Hourly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Events\CronHourly;
use App\Services\SimBriefService;
use Illuminate\Support\Facades\Log;
@@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Log;
*/
class ClearExpiredSimbrief extends Listener
{
private $simbriefSvc;
private SimBriefService $simbriefSvc;
public function __construct(SimBriefService $simbriefSvc)
{
@@ -20,11 +20,11 @@ class ClearExpiredSimbrief extends Listener
}
/**
* @param \App\Events\CronNightly $event
* @param CronHourly $event
*/
public function handle(CronNightly $event): void
public function handle(CronHourly $event): void
{
Log::info('Nightly: Removing expired Simbrief entries');
Log::info('Hourly: Removing expired Simbrief entries');
$this->simbriefSvc->removeExpiredEntries();
}
}

View File

@@ -5,6 +5,7 @@ namespace App\Cron\Hourly;
use App\Contracts\Listener;
use App\Events\CronHourly;
use App\Models\Enums\PirepState;
use App\Models\Enums\PirepStatus;
use App\Models\Pirep;
use App\Services\PirepService;
use Carbon\Carbon;
@@ -38,7 +39,10 @@ class DeletePireps extends Listener
protected function deletePireps(int $expire_time_hours, int $state)
{
$dt = Carbon::now('UTC')->subHours($expire_time_hours);
$pireps = Pirep::where('created_at', '<', $dt)->where(['state' => $state])->get();
$pireps = Pirep::where('created_at', '<', $dt)
->where(['state' => $state])
->where('status', '<>', PirepStatus::PAUSED)
->get();
/** @var PirepService $pirepSvc */
$pirepSvc = app(PirepService::class);

View File

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

View File

@@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Log;
*/
class ApplyExpenses extends Listener
{
private $financeSvc;
private RecurringFinanceService $financeSvc;
/**
* ApplyExpenses constructor.

View File

@@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Log;
*/
class ApplyExpenses extends Listener
{
private $financeSvc;
private RecurringFinanceService $financeSvc;
/**
* ApplyExpenses constructor.

View File

@@ -7,12 +7,9 @@ use App\Events\CronNightly;
use App\Services\VersionService;
use Illuminate\Support\Facades\Log;
/**
* Determine if any pilots should be set to ON LEAVE status
*/
class NewVersionCheck extends Listener
{
private $versionSvc;
private VersionService $versionSvc;
/**
* @param VersionService $versionSvc

View File

@@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Log;
*/
class PilotLeave extends Listener
{
private $userSvc;
private UserService $userSvc;
/**
* PilotLeave constructor.

View File

@@ -6,14 +6,14 @@ use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Models\Journal;
use App\Repositories\JournalRepository;
use Log;
use Illuminate\Support\Facades\Log;
/**
* This recalculates the balances on all of the journals
*/
class RecalculateBalances extends Listener
{
private $journalRepo;
private JournalRepository $journalRepo;
/**
* Nightly constructor.

View File

@@ -13,8 +13,8 @@ use Illuminate\Support\Facades\Log;
*/
class RecalculateStats extends Listener
{
private $aircraftSvc;
private $userSvc;
private AircraftService $aircraftSvc;
private UserService $userSvc;
public function __construct(AircraftService $aircraftSvc, UserService $userSvc)
{

View File

@@ -1,23 +1,43 @@
<?php
use Faker\Generator as Faker;
/** @noinspection PhpIllegalPsrClassPathInspection */
$factory->define(App\Models\Acars::class, function (Faker $faker) {
return [
'id' => null,
'pirep_id' => null,
'log' => $faker->text(100),
'lat' => $faker->latitude,
'lon' => $faker->longitude,
'distance' => $faker->randomFloat(2, 0, 6000),
'heading' => $faker->numberBetween(0, 359),
'altitude' => $faker->numberBetween(20, 400),
'vs' => $faker->numberBetween(-5000, 5000),
'gs' => $faker->numberBetween(300, 500),
'transponder' => $faker->numberBetween(200, 9999),
'autopilot' => $faker->text(10),
'fuel' => $faker->randomFloat(2, 100, 1000),
'fuel_flow' => $faker->randomFloat(2, 100, 1000),
'sim_time' => $faker->dateTime('now', 'UTC'),
];
});
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Acars;
use DateTime;
class AcarsFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Acars::class;
/**
* @return array <string, mixed>
*/
public function definition(): array
{
return [
'id' => null,
'pirep_id' => null,
'log' => $this->faker->text(100),
'lat' => $this->faker->latitude,
'lon' => $this->faker->longitude,
'distance' => $this->faker->randomFloat(2, 0, 6000),
'heading' => $this->faker->numberBetween(0, 359),
'altitude' => $this->faker->numberBetween(20, 400),
'vs' => $this->faker->numberBetween(-5000, 5000),
'gs' => $this->faker->numberBetween(300, 500),
'transponder' => $this->faker->numberBetween(200, 9999),
'autopilot' => $this->faker->text(10),
'fuel' => $this->faker->randomFloat(2, 100, 1000),
'fuel_flow' => $this->faker->randomFloat(2, 100, 1000),
'sim_time' => $this->faker->dateTime('now', 'UTC')->format(DateTime::ATOM),
];
}
}

View File

@@ -1,33 +1,51 @@
<?php
/** @noinspection PhpIllegalPsrClassPathInspection */
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Aircraft;
use App\Models\Airport;
use App\Models\Enums\AircraftState;
use App\Models\Enums\AircraftStatus;
use App\Models\Subfleet;
use App\Support\ICAO;
use Faker\Generator as Faker;
use DateTime;
$factory->define(App\Models\Aircraft::class, function (Faker $faker) {
return [
'id' => null,
'subfleet_id' => function () {
return factory(Subfleet::class)->create()->id;
},
'airport_id' => function () {
return factory(Airport::class)->create()->id;
},
'iata' => $faker->unique()->text(5),
'icao' => $faker->unique()->text(5),
'name' => $faker->text(50),
'registration' => $faker->unique()->text(10),
'hex_code' => ICAO::createHexCode(),
'mtow' => $faker->randomFloat(2, 0, 50000),
'zfw' => $faker->randomFloat(2, 0, 50000),
'status' => AircraftStatus::ACTIVE,
'state' => AircraftState::PARKED,
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
'updated_at' => function (array $pirep) {
return $pirep['created_at'];
},
];
});
class AircraftFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Aircraft::class;
/**
* Define the model's default state.
*
* @throws \Exception
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'id' => null,
'subfleet_id' => fn () => Subfleet::factory()->create()->id,
'airport_id' => fn () => Airport::factory()->create()->id,
'iata' => $this->faker->unique()->text(5),
'icao' => $this->faker->unique()->text(5),
'name' => $this->faker->text(50),
'registration' => $this->faker->unique()->text(10),
'hex_code' => ICAO::createHexCode(),
'mtow' => $this->faker->randomFloat(2, 0, 50000),
'zfw' => $this->faker->randomFloat(2, 0, 50000),
'status' => AircraftStatus::ACTIVE,
'state' => AircraftState::PARKED,
'created_at' => $this->faker->dateTimeBetween('-1 week')->format(DateTime::ATOM),
'updated_at' => fn (array $pirep) => $pirep['created_at'],
];
}
}

View File

@@ -1,25 +1,41 @@
<?php
use Faker\Generator as Faker;
/** @noinspection PhpIllegalPsrClassPathInspection */
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Airline;
use Hashids\Hashids;
/*
* Add any number of airports. Don't really care if they're real or not
*/
$factory->define(App\Models\Airline::class, function (Faker $faker) {
return [
'id' => null,
'icao' => function (array $apt) {
$hashids = new Hashids(microtime(), 5);
$mt = str_replace('.', '', microtime(true));
class AirlineFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Airline::class;
return $hashids->encode($mt);
},
'iata' => function (array $apt) {
return $apt['icao'];
},
'name' => $faker->sentence(3),
'country' => $faker->country,
'active' => 1,
];
});
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'id' => null,
'icao' => function (array $apt): string {
$hashids = new Hashids(microtime(), 5);
$mt = str_replace('.', '', microtime(true));
return $hashids->encode($mt);
},
'iata' => fn (array $apt) => $apt['icao'],
'name' => $this->faker->sentence(3),
'country' => $this->faker->country,
'active' => 1,
];
}
}

View File

@@ -1,17 +1,36 @@
<?php
use Faker\Generator as Faker;
/** @noinspection PhpIllegalPsrClassPathInspection */
/*
* Create an ICAO for use in the factory.
*/
if (!function_exists('createFactoryICAO')) {
function createFactoryICAO(): string
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Airport;
class AirportFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Airport::class;
protected array $usedIcaos = [];
/**
* Generate a fake ICAO
*
* @throws \Exception
*
* @return string
*/
protected function createFactoryICAO(): string
{
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$max = strlen($characters) - 1;
$string = '';
for ($i = 0; $i < 4; $i++) {
for ($i = 0; $i < 5; $i++) {
try {
$string .= $characters[random_int(0, $max)];
} catch (Exception $e) {
@@ -20,37 +39,35 @@ if (!function_exists('createFactoryICAO')) {
return $string;
}
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'id' => function () {
do {
$airport = $this->createFactoryICAO();
} while (in_array($airport, $this->usedIcaos, true));
return $airport;
},
'icao' => fn (array $apt) => $apt['id'],
'iata' => fn (array $apt) => $apt['id'],
'name' => $this->faker->sentence(3),
'country' => $this->faker->country,
'timezone' => $this->faker->timezone,
'lat' => $this->faker->latitude,
'lon' => $this->faker->longitude,
'hub' => false,
'notes' => null,
'ground_handling_cost' => $this->faker->randomFloat(2, 0, 500),
'fuel_100ll_cost' => $this->faker->randomFloat(2, 1, 10),
'fuel_jeta_cost' => $this->faker->randomFloat(2, 1, 10),
'fuel_mogas_cost' => $this->faker->randomFloat(2, 1, 10),
];
}
}
/*
* Add any number of airports. Don't really care if they're real or not
*/
$factory->define(App\Models\Airport::class, function (Faker $faker) {
$usedIcaos = [];
return [
'id' => function () use ($usedIcaos) {
do {
$airport = createFactoryICAO();
} while (in_array($airport, $usedIcaos, true));
return $airport;
},
'icao' => function (array $apt) {
return $apt['id'];
},
'iata' => function (array $apt) {
return $apt['id'];
},
'name' => $faker->sentence(3),
'country' => $faker->country,
'timezone' => $faker->timezone,
'lat' => $faker->latitude,
'lon' => $faker->longitude,
'hub' => false,
'ground_handling_cost' => $faker->randomFloat(2, 0, 500),
'fuel_100ll_cost' => $faker->randomFloat(2, 1, 10),
'fuel_jeta_cost' => $faker->randomFloat(2, 1, 10),
'fuel_mogas_cost' => $faker->randomFloat(2, 1, 10),
];
});

View File

@@ -0,0 +1,34 @@
<?php
/** @noinspection PhpIllegalPsrClassPathInspection */
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Award;
class AwardFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Award::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'id' => null,
'name' => $this->faker->name,
'description' => $this->faker->text(10),
'ref_model' => null,
'ref_model_params' => null,
];
}
}

View File

@@ -1,13 +0,0 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\Models\Award::class, function (Faker $faker) {
return [
'id' => null,
'name' => $faker->name,
'description' => $faker->text(10),
'ref_model' => null,
'ref_model_params' => null,
];
});

View File

@@ -1,18 +1,39 @@
<?php
use App\Models\Enums\ExpenseType;
use Faker\Generator as Faker;
/** @noinspection PhpIllegalPsrClassPathInspection */
$factory->define(App\Models\Expense::class, function (Faker $faker) {
return [
'id' => null,
'airline_id' => null,
'name' => $faker->text(20),
'amount' => $faker->randomFloat(2, 100, 1000),
'type' => ExpenseType::FLIGHT,
'multiplier' => false,
'ref_model' => \App\Models\Expense::class,
'ref_model_id' => null,
'active' => true,
];
});
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Enums\ExpenseType;
use App\Models\Expense;
class ExpenseFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Expense::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'id' => null,
'airline_id' => null,
'name' => $this->faker->text(20),
'amount' => $this->faker->randomFloat(2, 100, 1000),
'type' => ExpenseType::FLIGHT,
'multiplier' => false,
'ref_model' => \App\Models\Expense::class,
'ref_model_id' => null,
'active' => true,
];
}
}

View File

@@ -1,16 +1,35 @@
<?php
use Faker\Generator as Faker;
/** @noinspection PhpIllegalPsrClassPathInspection */
$factory->define(App\Models\Fare::class, function (Faker $faker) {
return [
'id' => null,
'code' => $faker->unique()->text(50),
'name' => $faker->text(50),
'price' => $faker->randomFloat(2, 100, 1000),
'cost' => function (array $fare) {
return round($fare['price'] / 2);
},
'capacity' => $faker->randomFloat(0, 20, 500),
];
});
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Fare;
class FareFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Fare::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'id' => null,
'code' => $this->faker->unique()->text(50),
'name' => $this->faker->text(50),
'price' => $this->faker->randomFloat(2, 100, 1000),
'cost' => fn (array $fare) => round($fare['price'] / 2),
'capacity' => $this->faker->randomFloat(0, 20, 500),
];
}
}

View File

@@ -1,44 +1,58 @@
<?php
/**
* Create flights
*/
use Faker\Generator as Faker;
$factory->define(App\Models\Flight::class, function (Faker $faker) {
return [
'id' => $faker->unique()->numberBetween(10, 10000000),
'airline_id' => function () {
return factory(\App\Models\Airline::class)->create()->id;
},
'flight_number' => $faker->unique()->numberBetween(10, 1000000),
'route_code' => $faker->randomElement(['', $faker->text(5)]),
'route_leg' => $faker->randomElement(['', $faker->numberBetween(0, 1000)]),
'dpt_airport_id' => function () {
return factory(\App\Models\Airport::class)->create()->id;
},
'arr_airport_id' => function () {
return factory(\App\Models\Airport::class)->create()->id;
},
'alt_airport_id' => function () {
return factory(\App\Models\Airport::class)->create()->id;
},
'distance' => $faker->numberBetween(1, 1000),
'route' => null,
'level' => 0,
'dpt_time' => $faker->time(),
'arr_time' => $faker->time(),
'flight_time' => $faker->numberBetween(60, 360),
'load_factor' => $faker->randomElement([15, 20, 50, 90, 100]),
'load_factor_variance' => $faker->randomElement([15, 20, 50, 90, 100]),
'has_bid' => false,
'active' => true,
'visible' => true,
'days' => 0,
'start_date' => null,
'end_date' => null,
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
'updated_at' => static function (array $flight) {
return $flight['created_at'];
},
];
});
/** @noinspection PhpIllegalPsrClassPathInspection */
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Flight;
use DateTime;
class FlightFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Flight::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'id' => $this->faker->unique()->numberBetween(10, 10000000),
'airline_id' => fn () => \App\Models\Airline::factory()->create()->id,
'flight_number' => $this->faker->unique()->numberBetween(10, 1000000),
'route_code' => $this->faker->randomElement(['', $this->faker->text(5)]),
'route_leg' => $this->faker->randomElement(
['', $this->faker->numberBetween(0, 1000)]
),
'dpt_airport_id' => static fn () => \App\Models\Airport::factory()->create()->id,
'arr_airport_id' => static fn () => \App\Models\Airport::factory()->create()->id,
'alt_airport_id' => static fn () => \App\Models\Airport::factory()->create()->id,
'distance' => $this->faker->numberBetween(1, 1000),
'route' => null,
'level' => 0,
'dpt_time' => $this->faker->time(),
'arr_time' => $this->faker->time(),
'flight_time' => $this->faker->numberBetween(60, 360),
'load_factor' => $this->faker->randomElement([15, 20, 50, 90, 100]),
'load_factor_variance' => $this->faker->randomElement([15, 20, 50, 90, 100]),
'has_bid' => false,
'active' => true,
'visible' => true,
'days' => 0,
'start_date' => null,
'end_date' => null,
'created_at' => $this->faker->dateTimeBetween('-1 week')->format(
DateTime::ATOM
),
'updated_at' => static fn (array $flight) => $flight['created_at'],
];
}
}

View File

@@ -1,9 +1,30 @@
<?php
use Faker\Generator as Faker;
/** @noinspection PhpIllegalPsrClassPathInspection */
$factory->define(App\Models\Journal::class, function (Faker $faker) {
return [
'currency' => 'USD',
];
});
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Journal;
class JournalFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Journal::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'currency' => 'USD',
];
}
}

View File

@@ -1,20 +1,39 @@
<?php
/** @noinspection PhpIllegalPsrClassPathInspection */
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Journal;
use App\Models\JournalTransaction;
use Carbon\Carbon;
use Faker\Generator as Faker;
use Ramsey\Uuid\Uuid;
$factory->define(App\Models\JournalTransaction::class, function (Faker $faker) {
return [
'transaction_group' => Uuid::uuid4()->toString(),
'journal_id' => function () {
return factory(Journal::class)->create()->id;
},
'credit' => $faker->numberBetween(100, 10000),
'debit' => $faker->numberBetween(100, 10000),
'currency' => 'USD',
'memo' => $faker->sentence(6),
'post_date' => Carbon::now('UTC'),
];
});
class JournalTransactionsFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = JournalTransaction::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'transaction_group' => Uuid::uuid4()->toString(),
'journal_id' => fn () => Journal::factory()->create()->id,
'credit' => $this->faker->numberBetween(100, 10000),
'debit' => $this->faker->numberBetween(100, 10000),
'currency' => 'USD',
'memo' => $this->faker->sentence(6),
'post_date' => Carbon::now('UTC')->toDateTimeString(),
];
}
}

View File

@@ -1,15 +1,36 @@
<?php
use App\Models\Enums\NavaidType;
use Faker\Generator as Faker;
/** @noinspection PhpIllegalPsrClassPathInspection */
$factory->define(App\Models\Navdata::class, function (Faker $faker) {
return [
'id' => str_replace(' ', '', str_replace('.', '', $faker->unique()->text(5))),
'name' => str_replace('.', '', $faker->unique()->word),
'type' => $faker->randomElement([NavaidType::VOR, NavaidType::NDB]),
'lat' => $faker->latitude,
'lon' => $faker->longitude,
'freq' => $faker->randomFloat(2, 100, 1000),
];
});
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Enums\NavaidType;
use App\Models\Navdata;
class NavdataFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Navdata::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'id' => str_replace(' ', '', str_replace('.', '', $this->faker->unique()->text(5))),
'name' => str_replace('.', '', $this->faker->unique()->word),
'type' => $this->faker->randomElement([NavaidType::VOR, NavaidType::NDB]),
'lat' => $this->faker->latitude,
'lon' => $this->faker->longitude,
'freq' => $this->faker->randomFloat(2, 100, 1000),
];
}
}

View File

@@ -1,14 +1,33 @@
<?php
use Faker\Generator as Faker;
/** @noinspection PhpIllegalPsrClassPathInspection */
$factory->define(App\Models\News::class, function (Faker $faker) {
return [
'id' => null,
'user_id' => function () {
return factory(\App\Models\User::class)->create()->id;
},
'subject' => $faker->text(),
'body' => $faker->sentence,
];
});
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\News;
class NewsFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = News::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'id' => null,
'user_id' => fn () => \App\Models\User::factory()->create()->id,
'subject' => $this->faker->text(),
'body' => $this->faker->sentence,
];
}
}

View File

@@ -1,69 +1,74 @@
<?php
/** @noinspection PhpIllegalPsrClassPathInspection */
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Airline;
use App\Models\Enums\PirepSource;
use App\Models\Enums\PirepState;
use App\Models\Enums\PirepStatus;
use App\Models\Flight;
use App\Models\Pirep;
use Carbon\Carbon;
use Faker\Generator as Faker;
/*
* Create a new PIREP
*/
$factory->define(App\Models\Pirep::class, function (Faker $faker) {
$airline = factory(\App\Models\Airline::class)->create();
$flight = factory(\App\Models\Flight::class)->create([
'airline_id' => $airline->id,
]);
class PirepFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Pirep::class;
return [
'id' => $faker->unique()->numberBetween(10, 10000000),
'airline_id' => function () use ($airline) {
return $airline->id;
},
'user_id' => function () {
return factory(\App\Models\User::class)->create()->id;
},
'aircraft_id' => function () {
return factory(\App\Models\Aircraft::class)->create()->id;
},
'flight_id' => function () use ($flight) {
return $flight->id;
},
'flight_number' => function () use ($flight) {
return $flight->flight_number;
},
'route_code' => null,
'route_leg' => null,
'dpt_airport_id' => function () use ($flight) {
return $flight->dpt_airport_id;
},
'arr_airport_id' => function () use ($flight) {
return $flight->arr_airport_id;
},
'level' => $faker->numberBetween(20, 400),
'distance' => $faker->randomFloat(2, 0, 6000),
'planned_distance' => $faker->randomFloat(2, 0, 6000),
'flight_time' => $faker->numberBetween(60, 360),
'planned_flight_time' => $faker->numberBetween(60, 360),
'zfw' => $faker->randomFloat(2),
'block_fuel' => $faker->randomFloat(2, 0, 1000),
'fuel_used' => function (array $pirep) {
return round($pirep['block_fuel'] * .9, 2); // 90% of the fuel loaded was used
},
'block_on_time' => Carbon::now('UTC'),
'block_off_time' => function (array $pirep) {
return $pirep['block_on_time']->subMinutes($pirep['flight_time']);
},
'route' => $faker->text(200),
'notes' => $faker->text(200),
'source' => $faker->randomElement([PirepSource::MANUAL, PirepSource::ACARS]),
'source_name' => 'TestFactory',
'state' => PirepState::PENDING,
'status' => PirepStatus::SCHEDULED,
'submitted_at' => Carbon::now('UTC')->toDateTimeString(),
'created_at' => Carbon::now('UTC')->toDateTimeString(),
'updated_at' => function (array $pirep) {
return $pirep['created_at'];
},
];
});
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
/** @var Airline $airline */
$airline = Airline::factory()->create();
/** @var Flight $flight */
$flight = Flight::factory()->create(['airline_id' => $airline->id]);
return [
'id' => $this->faker->unique()->numberBetween(10, 10000000),
'airline_id' => fn () => $airline->id,
'user_id' => fn () => \App\Models\User::factory()->create()->id,
'aircraft_id' => fn () => \App\Models\Aircraft::factory()->create()->id,
'flight_id' => fn () => $flight->id,
'flight_number' => fn () => $flight->flight_number,
'route_code' => null,
'route_leg' => null,
'dpt_airport_id' => fn () => $flight->dpt_airport_id,
'arr_airport_id' => fn () => $flight->arr_airport_id,
'level' => $this->faker->numberBetween(20, 400),
'distance' => $this->faker->randomFloat(2, 0, 6000),
'planned_distance' => $this->faker->randomFloat(2, 0, 6000),
'flight_time' => $this->faker->numberBetween(60, 360),
'planned_flight_time' => $this->faker->numberBetween(60, 360),
'zfw' => $this->faker->randomFloat(2),
'block_fuel' => $this->faker->randomFloat(2, 0, 1000),
'fuel_used' => fn (array $pirep) => round($pirep['block_fuel'] * .9, 2),
'block_on_time' => Carbon::now('UTC'),
'block_off_time' => fn (array $pirep) => $pirep['block_on_time']->subMinutes(
$pirep['flight_time']
),
'route' => $this->faker->text(200),
'notes' => $this->faker->text(200),
'source' => $this->faker->randomElement(
[PirepSource::MANUAL, PirepSource::ACARS]
),
'source_name' => 'TestFactory',
'state' => PirepState::PENDING,
'status' => PirepStatus::SCHEDULED,
'submitted_at' => Carbon::now('UTC')->toDateTimeString(),
'created_at' => Carbon::now('UTC')->toDateTimeString(),
'updated_at' => fn (array $pirep) => $pirep['created_at'],
];
}
}

View File

@@ -1,23 +1,37 @@
<?php
use Faker\Generator as Faker;
/** @noinspection PhpIllegalPsrClassPathInspection */
/*
* id: 2
name: Junior First Officer
hours: 10
auto_approve_acars: 1
auto_approve_manual: 1
*/
$factory->define(App\Models\Rank::class, function (Faker $faker) {
return [
'id' => null,
'name' => $faker->unique()->text(50),
'hours' => $faker->numberBetween(10, 50),
'acars_base_pay_rate' => $faker->numberBetween(10, 100),
'manual_base_pay_rate' => $faker->numberBetween(10, 100),
'auto_approve_acars' => 0,
'auto_approve_manual' => 0,
'auto_promote' => 0,
];
});
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Rank;
class RankFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Rank::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'id' => null,
'name' => $this->faker->unique()->text(50),
'hours' => $this->faker->numberBetween(10, 50),
'acars_base_pay_rate' => $this->faker->numberBetween(10, 100),
'manual_base_pay_rate' => $this->faker->numberBetween(10, 100),
'auto_approve_acars' => 0,
'auto_approve_manual' => 0,
'auto_promote' => 0,
];
}
}

View File

@@ -1,13 +1,34 @@
<?php
use Faker\Generator as Faker;
/** @noinspection PhpIllegalPsrClassPathInspection */
$factory->define(App\Models\Role::class, function (Faker $faker) {
return [
'id' => null,
'name' => $faker->name,
'display_name' => $faker->name,
'read_only' => false,
'disable_activity_checks' => $faker->boolean(),
];
});
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Role;
class RoleFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Role::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'id' => null,
'name' => $this->faker->name,
'display_name' => $this->faker->name,
'read_only' => false,
'disable_activity_checks' => $this->faker->boolean(),
];
}
}

View File

@@ -0,0 +1,38 @@
<?php
/** @noinspection PhpIllegalPsrClassPathInspection */
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\SimBrief;
use Carbon\Carbon;
class SimBriefFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = SimBrief::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
'id' => $this->faker->unique()->numberBetween(10, 10000000),
'user_id' => null,
'flight_id' => null,
'pirep_id' => null,
'acars_xml' => '',
'ofp_xml' => '',
'created_at' => Carbon::now('UTC')->toDateTimeString(),
'updated_at' => fn (array $sb) => $sb['created_at'],
];
}
}

View File

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

View File

@@ -1,15 +1,34 @@
<?php
use Faker\Generator as Faker;
/** @noinspection PhpIllegalPsrClassPathInspection */
$factory->define(App\Models\Subfleet::class, function (Faker $faker) {
return [
'id' => null,
'airline_id' => function () {
return factory(\App\Models\Airline::class)->create()->id;
},
'name' => $faker->unique()->text(50),
'type' => $faker->unique()->text(7),
'ground_handling_multiplier' => $faker->numberBetween(50, 200),
];
});
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Subfleet;
class SubfleetFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Subfleet::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'id' => null,
'airline_id' => fn () => \App\Models\Airline::factory()->create()->id,
'name' => $this->faker->unique()->text(50),
'type' => $this->faker->unique()->text(7),
'ground_handling_multiplier' => $this->faker->numberBetween(50, 200),
];
}
}

View File

@@ -1,28 +1,54 @@
<?php
/** @noinspection PhpIllegalPsrClassPathInspection */
namespace App\Database\Factories;
use App\Contracts\Factory;
use App\Models\Airline;
use App\Models\Enums\UserState;
use Faker\Generator as Faker;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
$factory->define(App\Models\User::class, function (Faker $faker) {
static $password;
class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;
return [
'id' => null,
'pilot_id' => null,
'name' => $faker->name,
'email' => $faker->safeEmail,
'password' => $password ?: $password = Hash::make('secret'),
'api_key' => $faker->sha1,
'airline_id' => function () {
return factory(Airline::class)->create()->id;
},
'rank_id' => 1,
'flights' => $faker->numberBetween(0, 1000),
'flight_time' => $faker->numberBetween(0, 10000),
'transfer_time' => $faker->numberBetween(0, 10000),
'state' => UserState::ACTIVE,
'remember_token' => $faker->unique()->text(5),
];
});
/**
* @var string
*/
private static string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
if (empty(self::$password)) {
self::$password = Hash::make('secret');
}
return [
'id' => null,
'pilot_id' => null,
'name' => $this->faker->name,
'email' => $this->faker->safeEmail,
'password' => self::$password,
'api_key' => $this->faker->sha1,
'airline_id' => fn () => Airline::factory()->create()->id,
'rank_id' => 1,
'flights' => $this->faker->numberBetween(0, 1000),
'flight_time' => $this->faker->numberBetween(0, 10000),
'transfer_time' => $this->faker->numberBetween(0, 10000),
'state' => UserState::ACTIVE,
'remember_token' => $this->faker->unique()->text(5),
];
}
}

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use App\Services\Installer\SeederService;
use Illuminate\Database\Schema\Blueprint;
class CreateSettingsTable extends Migration
{
return new class() extends Migration {
private $seederSvc;
public function __construct()
@@ -50,4 +49,4 @@ class CreateSettingsTable extends Migration
{
Schema::dropIfExists('settings');
}
}
};

View File

@@ -5,8 +5,7 @@ use App\Models\Pirep;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
return new class() extends Migration {
/**
* Run the migrations.
*
@@ -55,4 +54,4 @@ class CreateUsersTable extends Migration
{
Schema::dropIfExists('users');
}
}
};

View File

@@ -2,9 +2,9 @@
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RolesPermissionsTables extends Migration
{
return new class() extends Migration {
public function up()
{
// Create table for storing roles
@@ -82,4 +82,4 @@ class RolesPermissionsTables extends Migration
Schema::dropIfExists('role_user');
Schema::dropIfExists('roles');
}
}
};

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
@@ -19,4 +18,4 @@ class CreatePasswordResetsTable extends Migration
{
Schema::dropIfExists('password_resets');
}
}
};

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSessionsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('sessions', function (Blueprint $table) {
@@ -22,4 +21,4 @@ class CreateSessionsTable extends Migration
{
Schema::dropIfExists('sessions');
}
}
};

View File

@@ -3,8 +3,7 @@
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAirlinesTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('airlines', function (Blueprint $table) {
@@ -31,4 +30,4 @@ class CreateAirlinesTable extends Migration
{
Schema::dropIfExists('airlines');
}
}
};

View File

@@ -5,8 +5,7 @@ use App\Models\Enums\AircraftState;
use App\Models\Enums\AircraftStatus;
use Illuminate\Database\Schema\Blueprint;
class CreateAircraftsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('aircraft', function (Blueprint $table) {
@@ -34,4 +33,4 @@ class CreateAircraftsTable extends Migration
{
Schema::dropIfExists('aircraft');
}
}
};

View File

@@ -3,8 +3,7 @@
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateFaresTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('fares', function (Blueprint $table) {
@@ -24,4 +23,4 @@ class CreateFaresTable extends Migration
{
Schema::dropIfExists('fares');
}
}
};

View File

@@ -3,8 +3,7 @@
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAirportsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('airports', function (Blueprint $table) {
@@ -33,4 +32,4 @@ class CreateAirportsTable extends Migration
{
Schema::dropIfExists('airports');
}
}
};

View File

@@ -5,8 +5,7 @@ use App\Contracts\Model;
use App\Models\Enums\FlightType;
use Illuminate\Database\Schema\Blueprint;
class CreateFlightTables extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('flights', function (Blueprint $table) {
@@ -98,4 +97,4 @@ class CreateFlightTables extends Migration
Schema::drop('flight_subfleet');
Schema::drop('flights');
}
}
};

View File

@@ -3,8 +3,7 @@
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateRanksTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('ranks', function (Blueprint $table) {
@@ -29,4 +28,4 @@ class CreateRanksTable extends Migration
{
Schema::dropIfExists('ranks');
}
}
};

View File

@@ -3,8 +3,7 @@
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSubfleetTables extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('subfleets', function (Blueprint $table) {
@@ -51,4 +50,4 @@ class CreateSubfleetTables extends Migration
Schema::dropIfExists('subfleet_fare');
Schema::dropIfExists('subfleet_rank');
}
}
};

View File

@@ -7,8 +7,7 @@ use App\Models\Enums\PirepState;
use App\Models\Enums\PirepStatus;
use Illuminate\Database\Schema\Blueprint;
class CreatePirepTables extends Migration
{
return new class() extends Migration {
/**
* Run the migrations.
*
@@ -106,4 +105,4 @@ class CreatePirepTables extends Migration
Schema::dropIfExists('pirep_fields');
Schema::dropIfExists('pirep_field_values');
}
}
};

View File

@@ -5,8 +5,7 @@ use App\Contracts\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBidsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('bids', function (Blueprint $table) {
@@ -24,4 +23,4 @@ class CreateBidsTable extends Migration
{
Schema::dropIfExists('bids');
}
}
};

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateJobsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
@@ -23,4 +22,4 @@ class CreateJobsTable extends Migration
{
Schema::dropIfExists('jobs');
}
}
};

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
@@ -22,4 +21,4 @@ class CreateFailedJobsTable extends Migration
{
Schema::dropIfExists('failed_jobs');
}
}
};

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNavdataTables extends Migration
{
return new class() extends Migration {
public function up()
{
/*
@@ -30,4 +29,4 @@ class CreateNavdataTables extends Migration
{
Schema::dropIfExists('navdata');
}
}
};

View File

@@ -5,8 +5,7 @@ use App\Contracts\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAcarsTables extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('acars', function (Blueprint $table) {
@@ -43,4 +42,4 @@ class CreateAcarsTables extends Migration
{
Schema::dropIfExists('acars');
}
}
};

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateStatsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('stats', function (Blueprint $table) {
@@ -24,4 +23,4 @@ class CreateStatsTable extends Migration
{
Schema::dropIfExists('stats');
}
}
};

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNewsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('news', function (Blueprint $table) {
@@ -21,4 +20,4 @@ class CreateNewsTable extends Migration
{
Schema::drop('news');
}
}
};

View File

@@ -5,8 +5,7 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Modules\Awards\Awards\PilotFlightAwards;
class CreateAwardsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('awards', function (Blueprint $table) {
@@ -52,4 +51,4 @@ class CreateAwardsTable extends Migration
Schema::dropIfExists('awards');
Schema::dropIfExists('user_awards');
}
}
};

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExpensesTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('expenses', function (Blueprint $table) {
@@ -34,4 +33,4 @@ class CreateExpensesTable extends Migration
{
Schema::dropIfExists('expenses');
}
}
};

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateJournalTransactionsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('journal_transactions', function (Blueprint $table) {
@@ -33,4 +32,4 @@ class CreateJournalTransactionsTable extends Migration
{
Schema::dropIfExists('journal_transactions');
}
}
};

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateJournalsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('journals', function (Blueprint $table) {
@@ -23,4 +22,4 @@ class CreateJournalsTable extends Migration
{
Schema::dropIfExists('journals');
}
}
};

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateLedgersTable extends Migration
{
return new class() extends Migration {
/**
* Run the migrations.
*
@@ -30,4 +29,4 @@ class CreateLedgersTable extends Migration
{
Schema::dropIfExists('ledgers');
}
}
};

View File

@@ -5,8 +5,7 @@ use App\Contracts\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFilesTable extends Migration
{
return new class() extends Migration {
/**
* Create the files table. Acts as a morphable
*
@@ -40,4 +39,4 @@ class CreateFilesTable extends Migration
{
Schema::dropIfExists('files');
}
}
};

View File

@@ -5,8 +5,7 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class AddReadonlyToRoles extends Migration
{
return new class() extends Migration {
public function up(): void
{
Schema::table('roles', static function (Blueprint $table) {
@@ -25,4 +24,4 @@ class AddReadonlyToRoles extends Migration
$table->dropColumn('read_only');
});
}
}
};

View File

@@ -12,8 +12,7 @@ use Illuminate\Support\Facades\Schema;
* 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
{
return new class() extends Migration {
public function up()
{
Schema::table('users', static function (Blueprint $table) {
@@ -33,4 +32,4 @@ class UsersAddPilotId extends Migration
$table->dropColumn('pilot_id');
});
}
}
};

View File

@@ -4,8 +4,7 @@ use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNotificationsTable extends Migration
{
return new class() extends Migration {
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
@@ -22,4 +21,4 @@ class CreateNotificationsTable extends Migration
{
Schema::dropIfExists('notifications');
}
}
};

View File

@@ -9,8 +9,7 @@ use Illuminate\Support\Facades\Schema;
/**
* Change the PIREP state column to be a TINYINT
*/
class PirepsChangeStateType extends Migration
{
return new class() extends Migration {
public function up()
{
// Migrate the old rejected state
@@ -23,4 +22,4 @@ class PirepsChangeStateType extends Migration
$table->unsignedSmallInteger('state')->change();
});
}
}
};

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