Compare commits

..

778 Commits

Author SHA1 Message Date
Nabeel S
a335ed8e9b Merge pull request #440 from nabeelio/dev
Merge 7.0.0-beta.2 to master
2019-11-19 11:45:13 -05:00
Nabeel Shahzad
02973a0f22 Use GITHUB_TOKEN variable in release 2019-11-19 11:21:12 -05:00
Nabeel S
bffa5ebde2 Refactor the upgrade pending check to see if there are settings/permissions yaml changes (#438) 2019-11-19 10:54:42 -05:00
Nabeel S
3ec64c989b Fixes (#435)
* Add flight level field to PIREP field closes #401

* Default value for distance 0 closes #400

* Block airline deletion if assets exist #367

* Formatting

* Move some of the base exception classes

* Fix skin references to use settings table

* Set default for theme name if setting is wrong
2019-11-19 10:06:07 -05:00
Nabeel Shahzad
c643833496 Update stalebot 2019-11-06 11:42:01 -05:00
Nabeel Shahzad
759979fc10 Random cache prefix closes #374 2019-11-06 11:31:33 -05:00
Nabeel Shahzad
8859682366 Set debug=true for new installs 2019-11-06 11:29:25 -05:00
Nabeel S
f5183babf6 #406 Refactor bids (#432)
* Add flight_id column to pireps table

* Refactor PIREPs and bids closes 406

* Formatting
2019-11-05 11:44:31 -05:00
voipmeister
db087d0ccb fixes for issue #419 (#429)
* fixes for issue #419

* no spaces

* no spaces
2019-11-01 08:33:43 -04:00
Nabeel S
70d43e6e53 Wrap values in travis env (#426)
* Wrap values in travis env

* Inline CronService
2019-10-30 10:23:31 -04:00
Nabeel S
a45770732a Show a message about setting up the cron and if there was an error running it (#425) 2019-10-30 09:55:32 -04:00
Nabeel S
ec4f10d43a 359 Select theme in settings (#423)
* Update composer package versions

* Laravel version

* Change theme in the admin settings page closes #359

* Fix comment
2019-10-30 09:05:18 -04:00
Nabeel S
eff9f6fec6 Fix blank aircraft field causing error closes #414 (#422) 2019-10-29 13:57:17 -04:00
Nabeel Shahzad
96394228ea Select box formatting 2019-10-29 13:09:23 -04:00
Nabeel S
ae68550448 Move telemetry option into settings; checkbox in install refs #415 (#416) 2019-10-29 13:07:53 -04:00
Nabeel S
a2ea9b29ba Bundle CSS changes (#421)
* Bundle CSS changes

* Edit language

* Clickable flight IDs #419

* Fix dropdown menu going offscreen

* formatting
2019-10-29 13:03:04 -04:00
Benjamín Buske
1725ea5a9e Some minor CSS fixes as discussed on Discord (#420)
* Minor CSS Changes

Minor CSS changes to the original. 

#1: Added button to show own bids. 
#2: Added padding to Search buttons and fields  
#3: Fixed search fields leaving the search box

* Minor CSS Changes to Search Fields

Search Fields have been changed from round to square for better look.
2019-10-28 13:21:21 -04:00
Nabeel Shahzad
12679e85a8 Updated changelog 2019-10-23 15:29:34 -04:00
Nabeel Shahzad
79d4928e18 Fix for http auth in htaccess 2019-10-23 12:36:21 -04:00
Nabeel S
7a34756188 Issue fixes (#413)
* Auto lookup missing airports closes #404

* Ensure flight ICAOs are capitalized closes #404

* Update htaccess in root closes #412

* Update htaccess in root closes #412

* StyleCI fix
2019-10-23 12:01:31 -04:00
Nabeel Shahzad
97baf98d04 Formatting 2019-09-20 09:11:34 -04:00
Nabeel Shahzad
eb27c94637 Fix for bad unit conversions in API responses 2019-09-20 09:05:09 -04:00
Nabeel S
5f9e7d5754 Catch error messages in notifying (#403)
* Catch error messages in notifying

* Formatting
2019-09-17 19:11:02 -04:00
Nabeel S
6e9dcf8a31 Design and file upload issues (#399)
* Fix some styling issues/edit button on PIREP overview page

* Fix validation for file/url upload

* Formatting
2019-09-16 15:17:51 -04:00
Nabeel S
aedb1f22b6 Don't allow cancels from certain states (#396)
* Don't allow cancels from certain states

* Unused imports

* Don't reset the state doubly

* Move SetUserActive into listener; code cleanup

* Unused imports

* Add missing files into htaccess

* Move Command contract to correct folder
2019-09-16 13:08:26 -04:00
Nabeel Shahzad
41baefbf4a Fix styler 2019-09-14 11:18:09 -04:00
Nabeel Shahzad
3c21047c15 Fix playback file path 2019-09-14 11:15:42 -04:00
Nabeel Shahzad
52332c250b Fix the route() calls for L6 2019-09-13 18:20:50 -04:00
Nabeel Shahzad
0c89d36a16 Remove remnants of Timezonelist library 2019-09-13 17:54:46 -04:00
Nabeel S
4ac781a20d Fix map checkout call (#394) 2019-09-13 15:10:47 -04:00
Nabeel S
d68d8791bd 389 API Changes (#393)
* Update PHPUnit to 8

* Fix API endpoints closes #389

* Update pagination method in Repository contract to look at the page number closes #390

* Remove unused imports

* Fix tests in FlightTests

* Typecast page

* Don't register factories

* Remove Factory loading

* Remove unused imports
2019-09-13 11:21:40 -04:00
Nabeel S
23eb9dcbda 384 Laravel 6 changes (#385)
* 384 Laravel 6 changes

* Library versions

* Update package versions

* Add keyType to models

* Remove unused dependencies

* StyleCI fixes

* Fix models for test

* Fix tests output and update test runner

* Unused imports

* Update exceptions handler

* Fix login page
2019-09-13 08:05:02 -04:00
Nabeel S
7a76ac4226 CSS Libraries and style updates (#388)
* Update now-ui frontend lib to latest instead of the beta

* Update to bootstrap 4 lib

* Fix flights and profile pages
2019-09-12 11:48:41 -04:00
Nabeel S
37fc761567 380 vacentral library (#381)
* Update vaCentral library for new API server format

* Formatting

* Remove missing/unused import
2019-09-05 16:55:51 -04:00
Nabeel Shahzad
1b82ef6c88 Fix mix error for admin.css 2019-09-04 08:03:39 -04:00
Nabeel S
7ace8bccd6 Use Notification/Notifiable (#379)
* Add migrations for notifiables

* Configure spatie-backup to run as part of cron

* Convert Mailer to Notification; add pirep notifications

* Styling
2019-08-30 15:59:17 -04:00
Nabeel S
b213f2bb4c Add maintenance section to admin, clear caches #376 (#377)
* Add maintenance section to admin, clear caches #376

* Formatting
2019-08-30 15:59:08 -04:00
Nabeel S
0d1f38cf85 Refactor all JS API calls #360 (#375)
* Refactor all JS API calls #360

* Remove unused imports

* Lint JS

* Fix doubled api key

* Formatting

* Added extra logging to distance lookup

* Remove the .editorconfig file in distrib

* shell check fixes

* Remove the .editorconfig file in distrib
2019-08-30 08:08:00 -04:00
Nabeel Shahzad
e62e4a865d Rename mix_public() to public_mix() for consistency with public_asset() 2019-08-28 10:52:35 -04:00
Nabeel S
09f3e3cfdf Set the baseURL for ajax requests (#373)
* Set the baseURL for ajax requests

* Use async/await on AJAX calls

* Add mix_public() cache generated asset cache busting

* Move storage container into separate class

* Fix some styling
2019-08-27 15:08:42 -04:00
Nabeel S
fd2f4f2150 Move airline transaction code into service layer (#371)
* Move airline transaction code into service layer

* Remove unused import
2019-08-26 14:55:59 -04:00
Nabeel S
651174bda8 229 url for downloads (#369)
* Allow file uploads for subfleet

* Allow URL to be used for a download

* Remove old FileUploadRequest

* Move file removal logic to service layer

* Remove unused import

* Remove unused packages
2019-08-26 14:43:50 -04:00
Nabeel S
bbec276da8 #355 Calculate distance button (#366)
* #355 Calculate distance button in add/edit Flight page

* Styling

* Move add/edit flight logic out of controller and into service layer

* Styling

* Formatting

* Run styleci against modules dir

* Styleci config

* Style fixes in /modules
2019-08-26 12:32:46 -04:00
Nabeel Shahzad
25999d55a3 Update dep versions 2019-08-26 09:09:12 -04:00
Nabeel S
6018a6dcaa Add Contract interface for airport lookup functionality (#365)
* Add Contract interface for airport lookup functionality

* style ci fixes
2019-08-22 14:32:49 -04:00
Nabeel Shahzad
94ba5d8680 Disable the requests throttler 2019-08-22 12:45:15 -04:00
Nabeel Shahzad
3d6a29795b Carry headers through the handler 2019-08-22 12:26:46 -04:00
Nabeel Shahzad
dd2b297cc5 Carry headers when rethrowing errors to REST 2019-08-22 12:12:44 -04:00
Nabeel Shahzad
7fdaf62ef5 Add 'status' field to error response 2019-08-21 08:19:49 -04:00
Nabeel S
182aabf426 Refactor error handling internally to follow RFC7807 (#362)
* Refactor error handling internally to follow RFC7807

* style fixes
2019-08-21 08:17:44 -04:00
Nabeel Shahzad
91a5eb535d Add abstract class for route finding mechanism 2019-08-20 08:48:45 -04:00
Nabeel Shahzad
b6189bab7e Remove the table prefix on importer 2019-08-10 21:12:18 -04:00
Nabeel S
dc51897314 Additional logging for the stats recalculation (#358)
* Additional logging for the stats recalculation

* style fix
2019-08-10 20:42:35 -04:00
Nabeel S
c1103afe8f Add missing expiry time for PIREP API (#356) 2019-08-09 22:49:25 -04:00
Nabeel Shahzad
39fbdcb787 Add the airline back into seed data 2019-08-09 13:57:56 -04:00
Nabeel S
47be7507f0 Fix/metar reading (#354)
* Account for empty ICAO; added tests

* Fix null returns

* Fix typo in volume units display

* Add version field for bug report template

* Some more changes to the bug report template
2019-08-08 17:41:53 -04:00
Nabeel S
5cafebe4d6 Fix/metar reading (#353)
* Fix reading of the METAR information for AviationWeather. Fix the DI

* StyleCI fixes
2019-08-08 14:52:34 -04:00
Nabeel Shahzad
becf6c95f0 StyleCI fixes 2019-08-08 13:44:18 -04:00
Nabeel Shahzad
380c9d13b6 Error handling around reset install; clear cache 2019-08-08 13:42:43 -04:00
Nabeel S
a08c9db284 Add setting to include transfer hours in calculations (#350)
* Add setting to include transfer hours in calculations

* Add some extra tests to check versions

* A couple of more version test cases
2019-08-08 12:50:43 -04:00
Nabeel S
ff6ba4c29a Remove ext-cal from requirements list (#349)
* Remove ext-cal from requirements list

* Fix the travis phpunit config
2019-08-08 12:50:32 -04:00
Nabeel Shahzad
f6465bea58 Add error logging around metar parsing call 2019-08-07 13:25:40 -04:00
Nabeel S
5cce1b3040 Multiple ticket crash fixes (#347)
* Fix for initial seed data not being run during install closes #346

* StyleCI keepin' me honest

* Tooltips for ranks
2019-08-07 12:32:49 -04:00
Nabeel S
e12188b7d3 Issue/327 versioning (#345)
* Switch to semver format

* Rewrite new version check to use Github Releases and cron

* Styling

* Remove v from in front of version

* New version check test fix

* Uncomment test case
2019-08-06 17:48:00 -04:00
Nabeel S
092b9fc9dc Add step fields to enable decimal points on fields #342 (#343)
* Add step fields to enable decimal points on fields #342

* Update js-yaml version due to vulnerability scan

* Don't seed dev files when env == local

* Fix

* Fix  to be static

* Add visibilty keyword
2019-08-06 15:54:21 -04:00
Nabeel S
6292b05ad5 Update issue templates (#344) 2019-08-06 15:26:37 -04:00
Nabeel Shahzad
732a0c4088 Merge branch 'dev' of github.com:nabeelio/phpvms into dev 2019-08-06 07:39:41 -04:00
Nabeel S
753804b71b Issue fixes (#341)
* Better error handling around ACARS position updates

* Add step for decimals on fuel block/used fields closes #340

* Styling

* Rename AcarsController to LiveMapController; update JS dependencies
2019-08-05 13:07:22 -04:00
Nabeel S
9f3ba05880 Issue/329 refactor seeding (#337)
* Fix Contracts class names

* Refactoring of the file seeds so it's not a mess

* StyleCI fixes
2019-08-05 08:27:53 -04:00
Nabeel Shahzad
3a97071fcf Fix Contracts class names 2019-08-02 09:02:23 -04:00
Nabeel Shahzad
d4c172e734 Fix the role creation #334 2019-08-02 08:05:03 -04:00
Nabeel S
95147e31bf Fix issue where user stats aren't incremented on PIREP auto accept (#335)
* Fix issue where user stats aren't incremented on PIREP auto accept

* Formatting
2019-08-01 15:23:59 -04:00
Nabeel Shahzad
63485d5a0f Make hours and minutes fields required 2019-08-01 13:15:33 -04:00
Nabeel Shahzad
aa57997ff5 PIREP fields not showing up and blocking PIREP submission 2019-08-01 13:13:11 -04:00
Nabeel Shahzad
f31d6a00ec Remove log tail 2019-08-01 13:12:54 -04:00
Nabeel Shahzad
e307da36b5 Brute force directory creation 2019-08-01 13:12:33 -04:00
Nabeel Shahzad
be5dd68c81 Directories still not being retained #333 2019-08-01 13:04:10 -04:00
Nabeel Shahzad
e9e2e12e4e Fix avatars dir name #333 2019-08-01 12:47:17 -04:00
Nabeel S
981a5915e3 Merge pull request #331 from nabeelio/313/fuel-finances
Account for fuel in the finance calculations #313
2019-07-23 10:29:05 -04:00
Nabeel Shahzad
224cfaf603 Remove debugging that stops execution 2019-07-23 10:17:51 -04:00
Nabeel Shahzad
71f5d33af7 Formatting in FlightExporter 2019-07-23 09:42:31 -04:00
Nabeel Shahzad
70f470d64e Formatting 2019-07-23 09:08:05 -04:00
Nabeel Shahzad
fcc6295a77 Remove unused/dead code 2019-07-23 09:00:39 -04:00
Nabeel Shahzad
c5007f2928 Formatting 2019-07-23 08:43:40 -04:00
Nabeel Shahzad
62a10224a0 Account for fuel in the finance calculations #313 2019-07-23 08:41:20 -04:00
Nabeel S
ee1c8ee3fa Merge pull request #328 from nabeelio/328/pending-updates
Middleware to detect is update is pending; move Routes into HTTP
2019-07-18 11:07:22 -04:00
Nabeel Shahzad
823325d049 Styling 2019-07-18 10:54:28 -04:00
Nabeel Shahzad
b2cf7acfb6 Middleware to detect is update is pending; move Routes into HTTP 2019-07-18 10:51:05 -04:00
Nabeel Shahzad
c6547ac7fc Style fix 2019-07-18 09:55:10 -04:00
Nabeel Shahzad
748601064c Fix Validator import 2019-07-18 09:54:03 -04:00
Nabeel Shahzad
a9c5be1c70 Add opcache option; change detection during install for cache driver 2019-07-18 09:26:33 -04:00
Nabeel S
a0a6ab027f Merge pull request #325 from nabeelio/282-import-special-chars
Change exporter to use utf-8 close #282
2019-07-17 14:01:49 -04:00
Nabeel Shahzad
e97ae78e47 Fix for tests 2019-07-17 13:54:44 -04:00
Nabeel Shahzad
89a01afc7c Fix throws pathing for tests 2019-07-17 13:40:56 -04:00
Nabeel Shahzad
9475a737f0 Change exporter to use utf-8 close #282 2019-07-17 13:36:16 -04:00
Nabeel S
0225a84a81 Merge pull request #324 from nabeelio/265-editable-pilot-id
Backend changes separating id from pilot_id
2019-07-17 12:49:22 -04:00
Nabeel Shahzad
bb15119bf0 Append rules for Create/Update 2019-07-17 11:00:30 -04:00
Nabeel Shahzad
95ae3aacb3 Unique email check 2019-07-17 10:59:11 -04:00
Nabeel Shahzad
482a9cb04f formatting 2019-07-17 10:04:22 -04:00
Nabeel Shahzad
f5dcd06838 Remove the NotNull checks 2019-07-17 09:57:05 -04:00
Nabeel Shahzad
9c8c06ef28 Fix metar clouds test 2019-07-17 09:56:16 -04:00
Nabeel Shahzad
567ff91de0 Add pilot ID change fields to the admin screen 2019-07-17 09:48:20 -04:00
Nabeel Shahzad
337fe5cfaa Rename "Administration" to "Admin" 2019-07-17 08:58:10 -04:00
Nabeel Shahzad
ec81a6d157 Fix errors in the METAR parsing for clouds; display error for pressure units 2019-07-17 08:57:45 -04:00
Nabeel Shahzad
15e6226511 Fix the avatars directory #316 2019-07-17 08:56:38 -04:00
Nabeel Shahzad
80560ec20c Formatting 2019-07-16 14:06:13 -04:00
Nabeel Shahzad
3e1d9080df Backend changes separating id from pilot_id 2019-07-16 13:54:14 -04:00
Nabeel S
454776ecd4 Merge pull request #323 from nabeelio/fix/rename-interfaces
Rename Interfaces to Contracts to better match Laravel conventions
2019-07-15 15:59:34 -04:00
Nabeel Shahzad
dd946d4cdd Reorder imports 2019-07-15 15:51:35 -04:00
Nabeel Shahzad
a720f12e0b Rename Interfaces to Contracts to better match Laravel conventions 2019-07-15 15:44:31 -04:00
Nabeel S
31f16d693b Merge pull request #322 from nabeelio/fix-unit-classes
Cleanup SI Unit classes; METAR fixes
2019-07-15 15:36:54 -04:00
Nabeel Shahzad
ed91ddb5a8 Formatting again 2019-07-15 15:19:22 -04:00
Nabeel Shahzad
08a2be165c Formatting 2019-07-15 15:18:49 -04:00
Nabeel Shahzad
c04bfb78c6 Formatting 2019-07-15 15:17:51 -04:00
Nabeel Shahzad
06d8f11ca3 Cleanup SI Unit classes and interface for REST responses; fixes to a few METAR parsing issues 2019-07-15 15:14:40 -04:00
Nabeel S
466d04caf7 Merge pull request #321 from nabeelio/dependabot/npm_and_yarn/lodash-4.17.13
Bump lodash from 4.17.11 to 4.17.13
2019-07-15 08:02:10 -04:00
dependabot[bot]
02674f6ecb Bump lodash from 4.17.11 to 4.17.13
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.13.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.13)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-13 00:09:08 +00:00
Nabeel S
d8795e66da Merge pull request #320 from nabeelio/laravel-update
Update composer library versions
2019-07-09 08:03:17 -04:00
Nabeel Shahzad
8cdf47f7b3 Update composer library versions 2019-07-08 14:41:10 -04:00
Nabeel S
331b9133a8 Merge pull request #319 from nabeelio/issue/316-missing-folders
Add missing folders under storage/public #316
2019-07-08 13:51:53 -04:00
Nabeel Shahzad
783c06d811 Add missing folders under storage/public #316 2019-07-08 13:31:28 -04:00
Nabeel Shahzad
8a4516f1ba Remove gmp requirement from installer 2019-06-21 19:29:25 -04:00
Nabeel Shahzad
6543728478 Merge pull request #314 from nabeelio/issue/296-permissions
Add interface to additional roles/permissions #296
2019-06-21 14:51:43 -04:00
Nabeel Shahzad
54347c6706 Set default for read_only to false 2019-06-20 23:24:08 -04:00
Nabeel Shahzad
b169337fb6 Styling 2019-06-20 23:19:35 -04:00
Nabeel Shahzad
b28ace970c Add interface to additional roles/permissions 2019-06-20 16:52:37 -04:00
Nabeel Shahzad
29ca9711f8 Merge pull request #312 from nabeelio/issue/295-fuel-in-pireps
Fix pax count fields; add fuel used field #295
2019-06-19 15:14:29 -05:00
Nabeel Shahzad
313c0b0c80 Show fuel units in form 2019-06-19 16:05:29 -04:00
Nabeel Shahzad
f9ecabdccc Fix start order 2019-06-19 16:05:24 -04:00
Nabeel Shahzad
abb1eb332d styling 2019-06-19 15:30:47 -04:00
Nabeel Shahzad
faf51de9a9 Fix pax count fields; add fuel used field #295 2019-06-19 15:29:27 -04:00
Nabeel Shahzad
ae464b7601 Add stale check for github issues 2019-06-19 13:15:31 -04:00
Nabeel Shahzad
79c60d34c2 Some admin cleanup 2019-06-19 13:07:03 -04:00
Nabeel Shahzad
fb9c1c3681 Check for calendar extension in installer 2019-06-19 13:02:06 -04:00
Nabeel Shahzad
4653eb20ad don't remove the docker resources 2019-06-19 12:43:09 -04:00
Nabeel Shahzad
c7376a59f0 Move around docker storage folders/config 2019-06-19 12:41:42 -04:00
Nabeel Shahzad
09307443f9 ordering 2019-06-18 19:48:03 -04:00
Nabeel Shahzad
4259533958 Move artisan calls into the install phase 2019-06-18 19:32:05 -04:00
Nabeel Shahzad
da87a35a69 Reordering ops for travis 2019-06-18 19:30:08 -04:00
Nabeel Shahzad
7a468b2c16 Fix php-cs-fixer for build 2019-06-18 19:16:29 -04:00
Nabeel Shahzad
a39549d597 Merge pull request #311 from nabeelio/analysis-zDr9J5
Apply fixes from StyleCI
2019-06-18 17:58:33 -05:00
Nabeel Shahzad
a176ed2dae Apply fixes from StyleCI 2019-06-18 22:58:09 +00:00
Nabeel Shahzad
4ae17f65c8 Upgrade for vulnerabilities 2019-06-18 18:56:35 -04:00
Nabeel Shahzad
be441dacd9 Update for vulnerabilities 2019-06-18 18:54:19 -04:00
Nabeel Shahzad
5210c78d5e Update Laravel version 2019-06-18 18:51:56 -04:00
Nabeel Shahzad
e1bdef98d6 Keep uploaded avatar images within the same aspect ratio #309 2019-05-13 07:52:07 -05:00
Nabeel Shahzad
defd78e5c2 Add the avatars/files folders to the permissions check list 2019-05-12 23:45:07 -05:00
Nabeel Shahzad
27944b8235 don't create env/config files by default 2019-05-12 23:42:35 -05:00
Nabeel Shahzad
f0ef723854 Add blank env and config files, check those permissions in the installer 2019-05-12 18:36:41 -05:00
Nabeel Shahzad
889ed06acc Put note about permissions for directories 2019-05-12 18:33:22 -05:00
Nabeel Shahzad
267a0e21ba Merge pull request #308 from nabeelio/laravel-58
Laravel 5.8 Update
2019-05-12 18:20:34 -05:00
Nabeel Shahzad
7e461f401b Remove .php_cs from dist 2019-05-12 18:13:42 -05:00
Nabeel Shahzad
2ca1f33e68 Formatting 2019-05-12 18:05:36 -05:00
Nabeel Shahzad
dbd7c5e90b Style fixes 2019-05-12 17:49:58 -05:00
Nabeel Shahzad
d65b74d7a0 Formatting 2019-05-12 17:37:22 -05:00
Nabeel Shahzad
8d6621e2a8 Add additional rules 2019-05-12 17:25:52 -05:00
Nabeel Shahzad
88957f4071 Add php-cs-fixer to build 2019-05-12 13:26:44 -05:00
Nabeel Shahzad
75eaec2f11 phpcs standards 2019-05-12 12:08:31 -05:00
Nabeel Shahzad
a79f28caa4 Bump minimum required php version to 7.2 2019-05-12 11:40:03 -05:00
Nabeel Shahzad
25a9ca9b90 styleci fixes 2019-05-12 11:35:03 -05:00
Nabeel Shahzad
d5a3328130 Style fix 2019-05-12 11:31:48 -05:00
Nabeel Shahzad
18c5cf766d Force env vars in travis tests for phpunit 2019-05-12 11:31:16 -05:00
Nabeel Shahzad
1c935998fb Fix nginx command 2019-05-12 11:20:42 -05:00
Nabeel Shahzad
1b1cf2a891 Add redis; use alpine images 2019-05-12 10:51:06 -05:00
Nabeel Shahzad
047a72f3da Force cache to array 2019-05-12 10:50:52 -05:00
Nabeel Shahzad
87aa6ed1da Fix tests for 5.8 2019-05-12 10:50:38 -05:00
Nabeel Shahzad
7f0fb16dc3 Update to Laravel 5.8 2019-05-12 10:10:31 -05:00
Nabeel Shahzad
82f6dfbece Fix not found debug() call 2019-05-11 17:39:58 -05:00
Nabeel Shahzad
b8d4f4e5c4 Merge pull request #306 from nabeelio/issue-297/search-options
Add more search criteria/dev environment via docker-compose #297
2019-05-11 14:47:37 -05:00
Nabeel Shahzad
df814edafe Add the symfony/polyfill-iconv package 2019-05-11 14:11:15 -05:00
Nabeel Shahzad
1ec866d4dc Style fixes 2019-05-11 11:38:56 -05:00
Nabeel Shahzad
7fce5421b4 Reset the criterea before a new search 2019-05-11 11:37:06 -05:00
Nabeel Shahzad
65bd6888e8 Only mount storage folder 2019-05-11 09:20:05 -05:00
Nabeel Shahzad
2ca4393c5a Adjust tail command 2019-05-11 09:14:31 -05:00
Nabeel Shahzad
099600cf4c Fix the PHP Docker image 2019-05-10 19:46:50 -05:00
Nabeel Shahzad
4dd3fc5244 Show if there are database errors 2019-05-10 19:31:11 -05:00
Nabeel Shahzad
a90d9aac39 Save the data files locally 2019-05-10 18:55:24 -05:00
Nabeel Shahzad
81652cf70e Add swagger docs for search 2019-05-10 18:54:10 -05:00
Nabeel Shahzad
5f0db96fc4 Working docker-compose files for development 2019-05-10 18:40:07 -05:00
Nabeel Shahzad
2b45b9fd70 Fix the searchable fields 2019-05-10 16:24:34 -05:00
Nabeel Shahzad
5b061ba636 Add greater than/less than search options #297 2019-05-10 16:03:04 -05:00
Nabeel Shahzad
1dae81b707 Package updates for vulnerabilities 2019-05-08 11:31:57 -05:00
Nabeel Shahzad
3ceb5fbe5b node package vulnerability updates 2019-05-08 11:30:45 -05:00
Nabeel Shahzad
5fac731a57 Remove the github issue templates 2019-05-08 11:27:49 -05:00
Nabeel Shahzad
d00115fc1a Restrict builds to main phpvms repo 2019-05-08 11:20:43 -05:00
Nabeel Shahzad
d2c20f97fd Specify to run on all branches 2019-05-08 11:18:50 -05:00
Nabeel Shahzad
400e4854e8 Docs and matrix to strings 2019-05-08 11:17:38 -05:00
Nabeel Shahzad
12c66e2681 Install 'artifacts' from the shell script 2019-05-08 11:03:52 -05:00
Nabeel Shahzad
56c2115144 Use artifacts plugin 2019-05-08 10:50:46 -05:00
Nabeel Shahzad
de6420ad59 Configure test matrix 2019-05-08 10:41:27 -05:00
Nabeel Shahzad
93b03bb5ab Travis fixes 2019-05-08 10:36:04 -05:00
Nabeel Shahzad
86b68fb515 Add PHP 7.4 to travis 2019-05-08 10:27:05 -05:00
Nabeel Shahzad
52ed248f7d Only generate test autoloaders in dev mode 2019-05-08 07:07:24 -05:00
Nabeel Shahzad
bc58a2b076 Merge pull request #301 from nabeelio/fix/285
Add gmp to requirements in install #285
2019-05-05 09:43:41 -05:00
Nabeel Shahzad
fd96bb49f6 Add gmp to requirements in install #285 2019-04-07 22:36:17 -05:00
Nabeel Shahzad
30a53670fe Merge branch 'dev' of github.com:nabeelio/phpvms into dev 2019-04-07 22:29:13 -05:00
Nabeel Shahzad
204f3a7397 Add github issue templates 2019-04-07 22:29:00 -05:00
Nabeel Shahzad
3a6e3e0e24 Style fixes 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
3bea54136b PHPUnit version fixing 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
655dc39c63 Downgrade PHPUnit again for PHP 7.1 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
e2637ce0a7 Downgrade PHPUnit again for PHP 7.1 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
c8c3e2bb79 Update PHPUnit version 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
ec662243d8 Style fixes 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
93b738be79 Fix for phpunit on 7.1 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
54c4e017cc Add PHP 7.3 to travis build 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
1d0e6cc10e Update composer require t ype 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
29a578ea6a Move the MigrationService to the main package 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
905be6ffc3 Direct composer packages called 'phpvms-plugin' to the modules/ folder 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
2d002e5cc5 Update npm packages 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
2132b50ede Dependency updates 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
8d8857e552 Turn closure into static 2019-04-07 22:27:10 -05:00
Nabeel Shahzad
6816c77845 Cleanup array_merge call 2019-04-07 22:27:09 -05:00
Nabeel Shahzad
2f2eb2e5b2 Mark ID as fillable for ACARS 2019-04-07 22:27:09 -05:00
Nabeel Shahzad
d2257095da Remove block_time from seed file 2019-04-07 22:27:09 -05:00
Nabeel Shahzad
53d4380339 Merge pull request #300 from nabeelio/revert-299-issue-templates
Revert "Update issue templates"
2019-04-07 22:26:20 -05:00
Nabeel Shahzad
4e9ea9aa3c Revert "Update issue templates" 2019-04-07 22:26:09 -05:00
Nabeel Shahzad
a6a52ef7bb Merge pull request #299 from nabeelio/issue-templates
Update issue templates
2019-04-07 22:25:50 -05:00
Nabeel Shahzad
239483dfc4 Update issue templates 2019-04-07 22:25:27 -05:00
Nabeel Shahzad
e4b8707e34 Style fixes 2019-04-07 22:12:45 -05:00
Nabeel Shahzad
c0afb2ea8f PHPUnit version fixing 2019-04-07 21:59:12 -05:00
Nabeel Shahzad
e367bd9a2e Downgrade PHPUnit again for PHP 7.1 2019-04-07 19:46:08 -05:00
Nabeel Shahzad
62871c8a7d Downgrade PHPUnit again for PHP 7.1 2019-04-07 19:37:30 -05:00
Nabeel Shahzad
9bc6fd23b9 Update PHPUnit version 2019-04-07 19:25:06 -05:00
Nabeel Shahzad
9d762df946 Style fixes 2019-04-07 19:23:44 -05:00
Nabeel Shahzad
e48f25d0ba Fix for phpunit on 7.1 2019-04-07 19:17:44 -05:00
Nabeel Shahzad
20a6e0ffb6 Add PHP 7.3 to travis build 2019-04-07 19:10:52 -05:00
Nabeel Shahzad
4b39b44dab Update composer require t ype 2019-04-07 19:07:16 -05:00
Nabeel Shahzad
8c358948e5 Move the MigrationService to the main package 2019-04-07 18:53:24 -05:00
Nabeel Shahzad
3cafe20736 Direct composer packages called 'phpvms-plugin' to the modules/ folder 2019-04-07 18:51:34 -05:00
Nabeel Shahzad
0014a4254d Update npm packages 2019-04-07 18:51:08 -05:00
Nabeel Shahzad
9f226fe574 Dependency updates 2019-04-07 18:43:13 -05:00
Nabeel Shahzad
e23caec9f3 Turn closure into static 2019-04-07 18:09:29 -05:00
Nabeel Shahzad
64bee1b238 Cleanup array_merge call 2019-04-07 17:35:55 -05:00
Nabeel Shahzad
1b1eb1539e Mark ID as fillable for ACARS 2018-12-27 09:35:40 -06:00
Nabeel Shahzad
4bc0a786ab Remove block_time from seed file 2018-12-27 09:23:35 -06:00
Nabeel Shahzad
6f7735afa7 Formatting 2018-10-25 18:10:37 -05:00
Nabeel Shahzad
3aef1a0aae Merge branch 'dev' of github.com:nabeelio/phpvms into dev 2018-10-25 17:56:03 -05:00
Nabeel Shahzad
cd327502d9 API: Call submit() for the PIREP 2018-10-08 09:01:35 -05:00
Nabeel Shahzad
900e8ffe26 Merge pull request #284 from arv187/es-translations
More acceptable translation to opt-in (es)
2018-10-02 13:50:42 -05:00
Nabeel Shahzad
270556eb1c Merge pull request #283 from tripph/master
Fix 404s to requirements/setup in README.md
2018-10-02 13:40:16 -05:00
arv187
e319f8eba4 More acceptable translation to opt-in (es) 2018-10-02 20:25:18 +02:00
Tripp Hill
48b14091c4 Fixed link to installation details page, was 404'd 2018-10-01 18:42:38 -04:00
Tripp Hill
88122c14d2 Fixed link to requirements page, 404'd before 2018-10-01 18:40:53 -04:00
Nabeel Shahzad
3911d95107 Set the currect aircraft location #277 2018-09-21 22:40:30 -04:00
Nabeel Shahzad
61c7a3d54d Merge pull request #280 from nkevins/expired_flight_cleaning
Hide expired live flight from live map and remove from DB
2018-09-20 18:44:42 -05:00
Kevin
075d4b3069 Add missing php extension 2018-09-21 06:46:44 +08:00
Nabeel Shahzad
c5498937dc Merge pull request #278 from nabeelio/laravel-57
[WIP] Laravel 5.7 Update
2018-09-20 14:20:25 -05:00
Nabeel Shahzad
f8b21c99e2 Use ClassMapGenerator from composer, symfony 4.x removed theirs 2018-09-20 14:08:42 -05:00
Nabeel Shahzad
8b6c44de6f StyleCI fixes 2018-09-20 13:55:58 -05:00
Nabeel Shahzad
b852bdc411 Merge pull request #276 from nkevins/admin_css_update
Make admin input outline darker
2018-09-20 13:55:21 -05:00
Nabeel Shahzad
2e0cc10ded Move redirect configs into phpvms config 2018-09-20 13:55:08 -05:00
Nabeel Shahzad
7707d8816e Laravel 5.7 versions 2018-09-20 13:55:08 -05:00
Nabeel Shahzad
a3239e78db Default install doesn't enable debug mode 2018-09-20 13:55:07 -05:00
Nabeel Shahzad
bbce735e31 Fix ordering for styleci 2018-09-20 13:55:07 -05:00
Nabeel Shahzad
262aad2d7a Add the Laravel 5.7 email verification 2018-09-20 13:55:07 -05:00
Nabeel Shahzad
99e472f99c Dependencies updated for Laravel 5.7 2018-09-20 13:55:07 -05:00
Kevin
d40c9ba91f Hide expired live flight from live map and remove from DB 2018-09-21 02:27:39 +08:00
Nabeel Shahzad
ab5480fdc9 Add explicit TOC accepted checkbox #244 2018-09-20 11:14:18 -05:00
Nabeel Shahzad
fbcaa382f4 add the opt-in button for emails #244 2018-09-20 10:00:23 -05:00
Nabeel Shahzad
aebb517791 Form close 2018-09-20 09:38:56 -05:00
Nabeel Shahzad
2de900eaa8 Minor JS cleanup 2018-09-20 09:36:15 -05:00
Nabeel Shahzad
e878168d4c Add eslint and styleci files 2018-09-10 09:25:45 -05:00
Nabeel Shahzad
d04565919b Allow admin to set a user's airport to be anywhere 2018-09-08 14:07:31 -05:00
Nabeel Shahzad
146fe05bdc Remove return nulls 2018-09-08 11:40:03 -05:00
Nabeel Shahzad
daffd1017f Add alt airport to pirep tables 2018-09-08 11:38:30 -05:00
Kevin
b66f10510e Make admin input border darker 2018-09-05 21:13:16 +08:00
Nabeel Shahzad
9e55f8ecf0 Merge pull request #275 from nkevins/transfer_hours
capture & display pilot transfer hours
2018-09-05 08:01:06 -04:00
Kevin Susanto
bac6396b19 Fix styleci checking 2018-09-05 09:27:16 +08:00
Kevin
b73182f830 Capturing pilot transfer hours 2018-09-05 08:09:33 +08:00
Nabeel Shahzad
ec873f2b82 Merge pull request #273 from nkevins/fix_repo_saving
Fix SettingsController saving boolean value as 'on'
2018-09-04 17:35:40 -04:00
Nabeel Shahzad
24fb55872f Merge pull request #274 from nkevins/fix_eager_loading
Optimize query with eager loading
2018-09-04 17:35:23 -04:00
Kevin
f7ae027156 Optimize query with eager loading 2018-09-04 20:02:16 +08:00
Kevin Susanto
f46e5090ae Fix SettingsController saving boolean value as 'on' 2018-09-04 16:11:51 +08:00
Nabeel Shahzad
c95fe3c971 Merge pull request #271 from nkevins/hide_inactive_pilot
Hide inactive pilot from pilot list page
2018-09-03 00:21:19 -04:00
Kevin
5992dad5a3 Hide inactive pilot from pilot list page 2018-09-03 08:12:11 +08:00
Nabeel Shahzad
646987764f Styleci annoying 2018-09-02 15:10:43 -04:00
Nabeel Shahzad
ebac18ebef Make sure created ICAO in factory is unique otherwise tests fail 2018-09-02 15:07:54 -04:00
Nabeel Shahzad
f2f0873b2e Merge branch 'dev' of github.com:nabeelio/phpvms into dev 2018-09-02 14:52:21 -04:00
Nabeel Shahzad
f14f7c1a5e Move the settings into a yml seed file and sync during install/update 2018-09-02 13:18:32 -04:00
Nabeel Shahzad
fbe3804658 Merge pull request #270 from nkevins/fix_search_flight_restriction
Fix flight search restriction
2018-09-02 11:04:41 -05:00
Nabeel Shahzad
1c1c0d55f4 Force truth state on pilot acceptance value #269 2018-09-02 10:47:37 -04:00
Kevin
20d8a2d0a7 Fix flight search restriction 2018-09-02 22:20:52 +08:00
Nabeel Shahzad
e71f12311a Merge pull request #268 from nabeelio/analysis-z4KMan
Apply fixes from StyleCI
2018-09-01 22:37:01 -05:00
Nabeel Shahzad
19a206f4ac Apply fixes from StyleCI 2018-09-02 03:31:16 +00:00
Nabeel Shahzad
8171d681a6 Fix METAR parsing for runway visibility 2018-09-01 16:58:38 -04:00
Nabeel Shahzad
aba23f99bd Merge pull request #264 from nkevins/fix_metar_issue
Fix METAR issue
2018-08-28 19:07:31 -05:00
Kevin
525e8ba8bb Adding cloud height assertion 2018-08-29 07:58:57 +08:00
Kevin
75ef658d8f Fix metar parsing issue 2018-08-29 07:27:53 +08:00
Nabeel Shahzad
e5935507c8 Merge pull request #262 from nabeelio/analysis-Xl4mPr
Apply fixes from StyleCI
2018-08-26 13:52:07 -05:00
Nabeel Shahzad
3c32f2d89d Apply fixes from StyleCI 2018-08-26 18:51:47 +00:00
Nabeel Shahzad
e95b3eb366 Code cleanup from inspection results 2018-08-26 13:50:08 -05:00
Nabeel Shahzad
0f3424f41e Fix datetime parser 2018-08-26 12:25:51 -05:00
Nabeel Shahzad
046dac5db5 Merge pull request #261 from nabeelio/analysis-8Kyry9
Apply fixes from StyleCI
2018-08-26 12:19:08 -05:00
Nabeel Shahzad
9596d88b48 Apply fixes from StyleCI 2018-08-26 16:40:04 +00:00
Nabeel Shahzad
20f46adbc4 Merge pull request #259 from nkevins/enable_eager_loading
Enable eager loading
2018-08-26 09:07:35 -05:00
Kevin
7b8e20f348 Enable eager loading 2018-08-26 21:43:47 +08:00
Nabeel Shahzad
996ebde501 Merge pull request #258 from nkevins/add_remove_expired_bids
Implement cron to remove expired bids
2018-08-24 12:16:50 -05:00
Kevin
36d91265d3 Adding newline at end of file 2018-08-25 01:14:35 +08:00
Kevin
796053cfa5 Implement cron to remove expired bids 2018-08-25 01:07:14 +08:00
Nabeel Shahzad
1c32ef838d Merge pull request #257 from nkevins/fix_timezone_list_encoded
Fix timezone list HTML Escaped
2018-08-24 10:39:59 -05:00
Kevin
a62c938099 Update attrSet initializer to empty string 2018-08-24 23:39:08 +08:00
Kevin
a9536064d3 Fix timezone list HTML Escaped 2018-08-24 23:16:23 +08:00
Nabeel Shahzad
543026da18 Nav data import fixed - thanks Kevin S! 2018-08-23 09:27:54 -05:00
Nabeel Shahzad
e77488c66a Fix CronWeekly console task to actually read Weekly 2018-08-23 08:26:39 -05:00
Nabeel Shahzad
91a64113fb Add faker package back 2018-08-20 13:22:42 -05:00
Nabeel Shahzad
25cead3288 Clean temp/cache folder 2018-08-20 12:01:13 -05:00
Nabeel Shahzad
80556dcda3 Remove the tests folder 2018-08-20 11:35:47 -05:00
Nabeel Shahzad
ffccb01670 Try to remove an requires-devs scripts 2018-08-20 11:24:32 -05:00
Nabeel Shahzad
299f391455 Cleanup of deploy script 2018-08-20 10:39:44 -05:00
Nabeel Shahzad
666c5d50d4 Add assets and banner message for EU cookie laws 2018-08-20 10:25:40 -05:00
Nabeel Shahzad
56c1f5ce4d Remove circleci config 2018-08-20 10:17:06 -05:00
Nabeel Shahzad
79806c3b42 Asset rebuild 2018-08-20 09:59:38 -05:00
Nabeel Shahzad
66a9b361cb Cosmetics 2018-08-20 09:48:39 -05:00
Nabeel Shahzad
89baf34824 Initial user stats recalculation #254 2018-08-20 09:42:54 -05:00
Nabeel Shahzad
5ee053cace Fix PIREP field error on file 2018-08-20 09:20:03 -05:00
Nabeel Shahzad
2dee3190ce Update dependencies 2018-08-20 09:19:44 -05:00
Nabeel Shahzad
1f50d2b7f7 check for empty route 2018-08-04 11:47:56 -05:00
Nabeel Shahzad
c40a8c893d Readd bids.disable_flight_on_bid, fixes tests 2018-07-24 15:58:11 -05:00
Nabeel Shahzad
b2cc818b7a Extra logging about cron 2018-07-24 14:58:12 -05:00
Nabeel Shahzad
0ce86e9e44 Rewrite add/remove bids code w additional tests 2018-07-24 14:50:50 -05:00
Nabeel Shahzad
e680f33326 Add more tests for days of week 2018-07-24 11:21:52 -05:00
Nabeel Shahzad
69eebd9370 Remove extra }} 2018-07-18 08:33:09 -05:00
Nabeel Shahzad
fb17159743 Merge branch 'dev' of https://github.com/nabeelio/phpvms into dev 2018-07-16 20:10:47 -05:00
Nabeel Shahzad
0f1a4bbf33 Change lat/lon fields to text 2018-07-16 09:23:50 -05:00
Nabeel Shahzad
68b00f776a Translation fixes 2018-07-15 15:06:25 -05:00
Nabeel Shahzad
87206ed2b4 Merge pull request #255 from arv187/es-translations
Update 07/13/2018 es-translations
2018-07-13 10:46:27 -05:00
arv187
5b233da11b update 07/13/2018
Add new files.
2018-07-13 17:30:54 +02:00
Nabeel Shahzad
28f10eaf41 Validator fix for airport import/export 2018-07-13 07:45:29 -05:00
Nabeel Shahzad
26061deced Fix flight visibility for day 2018-07-13 07:43:27 -05:00
arv187
3f3f0dd81d Merge remote-tracking branch 'upstream/dev' into es-translations 2018-07-13 14:15:32 +02:00
Nabeel Shahzad
4596ddae58 Undo null check for flight 2018-07-12 22:40:39 -05:00
Nabeel Shahzad
91b1fd5dca Add "visible" field to factory 2018-07-12 22:36:13 -05:00
Nabeel Shahzad
1b51bc8c04 Log error 2018-07-12 22:32:56 -05:00
Nabeel Shahzad
0af85a3fff Only show flights if they're also marked as visible 2018-07-12 22:29:50 -05:00
Nabeel Shahzad
4ca58ed754 Extra logging for cron and add flight visible field 2018-07-12 22:23:45 -05:00
Nabeel Shahzad
f640381978 Export extra fields for airports 2018-07-12 22:21:39 -05:00
Nabeel Shahzad
761c845300 Clean up some comments 2018-07-12 21:47:27 -05:00
Nabeel Shahzad
1b62cb7109 Fix extra brackets 2018-07-12 21:37:18 -05:00
Nabeel Shahzad
ad7aa7c8ce Missing flight log translation 2018-07-12 21:29:14 -05:00
Nabeel Shahzad
9cc640b866 Fix PIREP field and non-existant airport errors when editing PIREPs 2018-07-12 21:20:10 -05:00
Nabeel Shahzad
85615300e0 Wrap ifs 2018-07-11 08:35:26 -05:00
Nabeel Shahzad
5caecf9c5f update vacentral lib to fix airport lookup 2018-07-11 08:07:58 -05:00
Nabeel Shahzad
a1868075ed update composer 2018-07-11 08:06:07 -05:00
Nabeel Shahzad
81ecb5673f Merge branch 'dev' of https://github.com/nabeelio/phpvms into dev 2018-07-05 14:07:56 -05:00
Nabeel Shahzad
7c414e5419 (API) Delete the PIREP route before it's posted again 2018-07-05 14:07:54 -05:00
arv187
8b368a3808 upload spanish translation to es-translations branch 2018-06-28 01:08:56 +02:00
Nabeel Shahzad
fef36f89f4 Merge pull request #250 from arv187/master
ES translation
2018-06-27 17:36:59 -05:00
arv187
e9aaa85fc7 ES translation 2018-06-28 00:16:58 +02:00
Nabeel Shahzad
9125cc3d87 Fix updater 2018-06-22 09:26:08 -05:00
Nabeel Shahzad
230d3bebd3 Fix the api controller generation 2018-06-22 08:31:15 -05:00
Nabeel Shahzad
5b227c3a60 fix log 2018-06-21 09:53:14 -05:00
Nabeel Shahzad
316bc14526 Composer update 2018-06-20 11:39:28 -05:00
Nabeel Shahzad
9bc3a67c9a Move some database calls into a support class 2018-06-20 11:18:30 -05:00
Nabeel Shahzad
a083f9c671 Fix PIREP submission and field slug problems on PIREP edit 2018-05-30 14:00:20 -05:00
Nabeel Shahzad
b7a6cb4fbc Add missing flighttime translation 2018-05-29 14:21:44 -05:00
Nabeel Shahzad
d76b264238 Fix saving PIREPs as draft 2018-05-29 11:04:28 -05:00
Nabeel Shahzad
e02ae682a8 lang fixes 2018-05-29 09:16:07 -05:00
Nabeel Shahzad
59b99497a7 Route sorting 2018-05-28 18:15:51 -05:00
Nabeel Shahzad
42fb13294b Lang fixes 2018-05-25 15:37:53 -05:00
Nabeel Shahzad
a515921143 Add opt-in as part of GDPR #244 2018-05-24 22:17:41 -05:00
Nabeel Shahzad
019cf9b4fb Set IDs to unique ints so tests don't occasionally fail 2018-05-21 12:23:26 -05:00
Nabeel Shahzad
17cece598b Fix typos and missing lang 2018-05-21 12:05:22 -05:00
Nabeel Shahzad
8179611cac Remove unneeded migratoin 2018-05-21 12:00:14 -05:00
Nabeel Shahzad
0a7f002217 More organizing for translations 2018-05-21 11:55:40 -05:00
Nabeel Shahzad
36dcd61feb Move downloads into separate files 2018-05-21 11:27:57 -05:00
Nabeel Shahzad
072a7ffe12 split out email files 2018-05-21 11:25:51 -05:00
Nabeel Shahzad
9173558a0b Moved nav to files 2018-05-21 10:32:38 -05:00
Nabeel Shahzad
7cba92d420 move toc files 2018-05-21 10:28:50 -05:00
Nabeel Shahzad
3288467aa1 Move user files 2018-05-21 09:58:31 -05:00
Nabeel Shahzad
2b074ee894 Move widgets/home 2018-05-21 09:58:31 -05:00
Nabeel Shahzad
33ef3dd252 Move widgets into separate file 2018-05-21 09:58:21 -05:00
Nabeel Shahzad
bd84877f0e Move airports into separate file 2018-05-21 09:58:21 -05:00
Nabeel Shahzad
1258b87671 Move profile into separate file 2018-05-21 09:57:49 -05:00
Nabeel Shahzad
ba1bf4581d Move flights into separate file 2018-05-21 09:57:48 -05:00
Nabeel Shahzad
440a0c5425 Move dashboard into separate file 2018-05-21 09:57:46 -05:00
Nabeel Shahzad
74b53b4ba7 Move PIREPs to separate file 2018-05-21 09:57:45 -05:00
Nabeel Shahzad
1a3065b1ca Reformat error and auth translations 2018-05-21 09:57:43 -05:00
Nabeel Shahzad
fb6fc118e3 Move installer_messages.* to installer.* 2018-05-21 09:57:41 -05:00
Nabeel Shahzad
b63c9a8cd4 Move frontend.auth.* to auth.* 2018-05-21 09:57:41 -05:00
Nabeel Shahzad
203b6496fc Move frontend.global.* to common.* 2018-05-21 09:57:40 -05:00
Nabeel Shahzad
a747657642 remove dbal/predis from composer reqs 2018-05-21 09:57:38 -05:00
Nabeel Shahzad
ba9c64f420 Remove airplane image and restore original homepage for now 2018-05-21 09:57:38 -05:00
lordwilbur
c2bcebdb29 rebuilt assets again... 2018-05-21 09:57:38 -05:00
lordwilbur
f4ca576178 rebuilt assets 2018-05-21 09:57:38 -05:00
lordwilbur
459f69f609 frontend translation + other stuff 2018-05-21 09:57:34 -05:00
lordwilbur
06f8322eeb - fixed an error on finance in admin panel
- flight ident now use this format: VA IATA(if empty ICAO) + Flight Number + - + Flight Code (without C) + - + Flight Leg (without L)
- added function __trans_choice in helpers.php for translation
- fixed error in flight edit/insert panel not showing/inserting Tuesday in days
- fixed an error occurring when metar retrieved is empty
- edited now-ui-kit.css to align login fields correctly
- added /public/assets/frontend/js/core/jquery-3.3.1.min.js to fix a missed resource error in authentication pages
- added translations file for en and it locales
- translated all the frontend templates
2018-05-21 09:57:34 -05:00
lordwilbur
84f64f45d9 frontend translation + other stuff 2018-05-21 09:57:32 -05:00
lordwilbur
6899ea1964 - fixed an error on finance in admin panel
- flight ident now use this format: VA IATA(if empty ICAO) + Flight Number + - + Flight Code (without C) + - + Flight Leg (without L)
- added function __trans_choice in helpers.php for translation
- fixed error in flight edit/insert panel not showing/inserting Tuesday in days
- fixed an error occurring when metar retrieved is empty
- edited now-ui-kit.css to align login fields correctly
- added /public/assets/frontend/js/core/jquery-3.3.1.min.js to fix a missed resource error in authentication pages
- added translations file for en and it locales
- translated all the frontend templates
2018-05-21 09:57:26 -05:00
lordwilbur
81c148fc4d More translations 2018-05-21 09:57:10 -05:00
lordwilbur
89ebcbdb10 added predis/predis to composer 2018-05-21 09:57:10 -05:00
lordwilbur
a38bad9648 rebuilt assets again... 2018-05-21 09:57:10 -05:00
lordwilbur
7432ea5cc7 rebuilt assets 2018-05-21 09:57:10 -05:00
lordwilbur
1c84dd1e44 changed Flight model to match update of route_leg column in db. 2018-05-21 09:57:10 -05:00
lordwilbur
078f361a39 added doctrine/dbal to composer.json 2018-05-21 09:57:10 -05:00
lordwilbur
0b1670aae5 frontend translation + other stuff 2018-05-21 09:57:10 -05:00
lordwilbur
10867b2641 - fixed an error on finance in admin panel
- flight ident now use this format: VA IATA(if empty ICAO) + Flight Number + - + Flight Code (without C) + - + Flight Leg (without L)
- added function __trans_choice in helpers.php for translation
- fixed error in flight edit/insert panel not showing/inserting Tuesday in days
- fixed an error occurring when metar retrieved is empty
- edited now-ui-kit.css to align login fields correctly
- added /public/assets/frontend/js/core/jquery-3.3.1.min.js to fix a missed resource error in authentication pages
- added translations file for en and it locales
- translated all the frontend templates
2018-05-21 09:56:53 -05:00
lordwilbur
a346b0df2e frontend translation + other stuff 2018-05-21 09:54:18 -05:00
lordwilbur
ba8a819c7d - fixed an error on finance in admin panel
- flight ident now use this format: VA IATA(if empty ICAO) + Flight Number + - + Flight Code (without C) + - + Flight Leg (without L)
- added function __trans_choice in helpers.php for translation
- fixed error in flight edit/insert panel not showing/inserting Tuesday in days
- fixed an error occurring when metar retrieved is empty
- edited now-ui-kit.css to align login fields correctly
- added /public/assets/frontend/js/core/jquery-3.3.1.min.js to fix a missed resource error in authentication pages
- added translations file for en and it locales
- translated all the frontend templates
2018-05-21 09:53:08 -05:00
Nabeel Shahzad
77a2fd70c3 Merge pull request #242 from LordWilbur/vaflights
flights filtered per va
2018-05-19 14:04:39 -05:00
lordwilbur
1c0c7e0012 removed $flights variable 2018-05-19 09:05:24 +02:00
lordwilbur
e026a8d333 corrected code and replicated in Api/FlightController.php 2018-05-19 02:37:11 +02:00
lordwilbur
650d9884b0 removed tabs
added setting
corrected code
2018-05-19 02:03:06 +02:00
lordwilbur
0d53c5487d pilot unable to place bids on flight if pilots.only_flights_from_current = true and departure airport is not the same pilot's current airport. 2018-05-19 00:55:08 +02:00
lordwilbur
993513c22b flights filtered per va 2018-05-19 00:28:34 +02:00
Nabeel Shahzad
959db2e247 circleci 2018-05-17 08:06:38 -05:00
Nabeel Shahzad
c64dec1080 CircleCI build script 2018-05-17 08:02:52 -05:00
Nabeel Shahzad
da0a7cbe81 Add ACARS live time/coords/default zoom into admin settings 2018-05-16 10:54:01 -05:00
Nabeel Shahzad
a63a784dec Update to use leaflet-providers 2018-05-14 14:17:47 -05:00
Nabeel Shahzad
40c7fd8977 Add leaflet-providers 2018-05-14 14:14:27 -05:00
Nabeel Shahzad
3e96b195a6 Add short timeout to HTTP calls by default; cache METAR lookups 2018-05-14 11:22:20 -05:00
Nabeel Shahzad
c8a9ebd26d Data cleanup; set flight ident in response 2018-05-13 16:59:35 -05:00
Nabeel Shahzad
63897a5666 More cleanup of admin template 2018-05-11 16:02:43 -05:00
Nabeel Shahzad
9332f64284 Cleanup admin pirep form and read-only state 2018-05-11 13:53:24 -05:00
Nabeel Shahzad
3f1bb26ee5 Fix PIREPs not showing in admin 2018-05-11 13:43:33 -05:00
Nabeel Shahzad
9ca8825868 Merge branch 'dev' of https://github.com/nabeelio/phpvms into dev 2018-05-11 13:05:37 -05:00
Nabeel Shahzad
b8424f712d Acars log ordering 2018-05-11 13:05:34 -05:00
Nabeel Shahzad
bc7fccfb95 Cleanup the cancelled PIREP logic 2018-05-11 12:08:55 -05:00
Nabeel Shahzad
605bf477ad More date casting on API 2018-05-10 15:28:42 -05:00
Nabeel Shahzad
df88cb141a Allow draft for PIREPs, separate out the save/submit and delete functionality 2018-05-10 10:35:10 -05:00
Nabeel Shahzad
5230fc9600 change artisan calls 2018-05-10 10:22:45 -05:00
Nabeel Shahzad
62aa825c0f Use artisan for the reload-db dev command 2018-05-10 10:17:41 -05:00
Nabeel Shahzad
42c6a11780 Don't show in progress PIREPs in admin and order the map data 2018-05-09 17:58:51 -05:00
Nabeel Shahzad
4fa024045d refactorings of pirep/acars api calls; separate field calls 2018-05-09 12:45:24 -05:00
Nabeel Shahzad
9542c23717 Fix tests formatting of DateTime/Carbon objects 2018-05-09 09:15:07 -05:00
Nabeel Shahzad
7d2d932f50 remove field block_time 2018-05-08 21:26:57 -05:00
Nabeel Shahzad
bd7bd7e802 Cleanup of sample data and date/time parsing 2018-05-08 20:59:19 -05:00
Nabeel Shahzad
4fc30ec4bc Allow the created_at/updated_at fields to be edited 2018-05-08 17:30:44 -05:00
Nabeel Shahzad
00458ee754 unit test airport id length fix 2018-05-07 15:11:59 -05:00
Nabeel Shahzad
3f1f83438d remove observed_date test from metar code 2018-05-07 14:37:08 -05:00
Nabeel Shahzad
f593c7d92f Fix some more table column sizes 2018-05-07 14:07:41 -05:00
Nabeel Shahzad
feeb4946d1 Add some indexes and tests for airports 2018-05-07 14:07:41 -05:00
Nabeel Shahzad
f671d3f624 Update deploy scripts to remove some extra packages 2018-05-07 14:07:41 -05:00
Nabeel Shahzad
0cd7b3b71f live map updates 2018-05-04 13:59:47 -05:00
Nabeel Shahzad
d80e70e2b1 Fix Unit type conversions in tests 2018-05-03 16:13:25 -05:00
Nabeel Shahzad
f8965f1785 Fix tests for new datatypes 2018-05-03 15:36:26 -05:00
Nabeel Shahzad
23f1a8225a update livemap to use rivets.js bindings for data updates 2018-05-03 15:07:16 -05:00
Nabeel Shahzad
cbb5182cea Add distance/fuel fields to ACARS tables 2018-05-03 15:06:50 -05:00
Nabeel Shahzad
ff8f29be24 Update dev tools to add incremental inserts 2018-05-03 15:06:28 -05:00
José Bustos
64302252c0 Resize settings
Resize method only works with numbers as a parameter, is not necessary to put px at the end.
2018-05-02 18:59:57 -05:00
José Bustos
d768b9cc0e Avatar field on database
corrected the path to user avatar based on get avatar attribute on user model
2018-05-02 18:59:57 -05:00
José Bustos
4bc7d7735d Src avatar
Changed src call for user avatar, this will return the correct url based on avatar attribute of User Model
2018-05-02 18:59:57 -05:00
José Bustos
8aa629fc56 Grammar Error
corrected string
2018-05-02 18:59:57 -05:00
José Bustos
ec273d2928 Add getAvatarAttribute()
refactoring other methods this will work
2018-05-02 18:59:57 -05:00
Jose Miguel Bustos Espinoza
06d767279b Added input fields to upload avatar. 2018-05-02 18:59:57 -05:00
Jose Miguel Bustos Espinoza
b1209712d1 Added isset verification on avatar index at array, to put nullable validator. 2018-05-02 18:59:57 -05:00
Jose Miguel Bustos Espinoza
ecf2307542 Allow files upload in edit profile form for avatar file. 2018-05-02 18:59:57 -05:00
Jose Miguel Bustos Espinoza
24a2467338 Added avatar src in case of avatar exists, else will show default gravatar. 2018-05-02 18:59:57 -05:00
Jose Miguel Bustos Espinoza
4c65bf8142 Added avatar resize config 2018-05-02 18:59:57 -05:00
Jose Miguel Bustos Espinoza
31d0683592 Added avatar upload method into resource controller 2018-05-02 18:59:57 -05:00
Jose Miguel Bustos Espinoza
41f4c76006 Remote getAvatarAttribue() beacuse it cause conflict with final avatar path. 2018-05-02 18:59:57 -05:00
José Bustos
d0485f98a9 Installation of intervetion/image package to manage pilots avatars and others images. 2018-05-02 18:59:57 -05:00
Nabeel Shahzad
ec565fa0de Regen assets 2018-05-02 17:27:56 -05:00
Nabeel Shahzad
4f9c028676 Map fixes/updates 2018-05-02 15:28:57 -05:00
Nabeel Shahzad
5dff563c75 Fixes for API and live map 2018-05-02 15:14:18 -05:00
Nabeel Shahzad
9183e0b2aa Add phar file to gitignore 2018-05-02 09:54:21 -05:00
Nabeel Shahzad
6701ce8c1a comment out superfluous debug statements 2018-05-01 22:53:41 -05:00
Nabeel Shahzad
3a81e2ec27 Fix block_off/on_time and fix the metar date parsing 2018-05-01 22:52:31 -05:00
Nabeel Shahzad
b96f1cd7c4 api fixes/updates 2018-05-01 20:58:05 -05:00
Nabeel Shahzad
50abda71cb Fix if submitted_at blank 2018-04-30 17:51:18 -05:00
Nabeel Shahzad
73ffc9cf44 Fix flight type parameter 2018-04-30 17:29:50 -05:00
Nabeel Shahzad
7decac105f Add another sample flight/airports for testing 2018-04-29 11:29:31 -05:00
Nabeel Shahzad
89f067807b comment out the flight dupe check on import 2018-04-25 12:05:12 -05:00
Nabeel Shahzad
5cd9c608a7 Add score to model and fields 2018-04-25 11:56:05 -05:00
Nabeel Shahzad
531e86f5e7 Fix flight duplicate detection in add/edit/import; fix active checkbox 2018-04-25 11:53:32 -05:00
José Bustos
fb6d5a6a0a Install bug
It shows a blank page on install route in apache, it could be an rewrite error at line 
RewriteBase /
exactly, removing that line sould be fix.
2018-04-24 22:08:13 -05:00
Nabeel Shahzad
fe5400a3bb Add extra fields needed for internal active flags 2018-04-24 12:52:11 -05:00
Nabeel Shahzad
9502dd9835 Fix active/inactive check on flight page 2018-04-24 11:16:16 -05:00
Nabeel Shahzad
203ee72052 google font api from ssl 2018-04-24 11:02:02 -05:00
Nabeel Shahzad
29d206bba3 Merge branch 'dev' 2018-04-23 11:45:22 -05:00
Nabeel Shahzad
110fde34ea Fix subfleet addition error (pikaday missing) 2018-04-23 11:06:17 -05:00
Nabeel Shahzad
2c2b569c6c Fix setting the subfleet pay 2018-04-23 10:36:11 -05:00
Nabeel Shahzad
6c83b539c8 Merge branch 'dev' of github.com:nabeelio/phpvms into dev 2018-04-23 10:25:11 -05:00
Nabeel Shahzad
b7a1c2cb41 Add gitignore into uploads folder 2018-04-23 09:18:07 -05:00
Nabeel Shahzad
cff7e2c4da some cleanup as-per phpstan 2018-04-23 08:46:28 -05:00
Nabeel Shahzad
59302ded0f Fix another flight day test 2018-04-16 16:57:22 -05:00
Nabeel Shahzad
ea32353890 Fix flight on days deactivation test 2018-04-16 16:46:51 -05:00
Nabeel Shahzad
0965465601 add whereNotInOrder() to repository 2018-04-16 16:33:41 -05:00
Nabeel Shahzad
2319a8c9f4 Added more flight phases from ADREP 2018-04-16 09:33:45 -05:00
Nabeel Shahzad
63c5d69e10 Some fixes to trends parsing 2018-04-15 14:14:40 -05:00
Nabeel Shahzad
e369695da5 Fix link highlight color 2018-04-15 12:37:19 -05:00
Nabeel Shahzad
775900bb14 Filter out draft PIREPs 2018-04-15 12:37:04 -05:00
Nabeel Shahzad
9d3d284df7 Check start/end/days of week in cron and active/deactivate flights accordingly 2018-04-12 16:12:32 -05:00
Nabeel Shahzad
395642f69c Add /api/news route 2018-04-11 20:01:41 -05:00
Nabeel Shahzad
8d2fd22e3e Shrink min-height on the card boxes 2018-04-11 13:28:47 -05:00
Nabeel Shahzad
e668a5089e Fix create pirep errors 2018-04-10 07:22:21 -05:00
Nabeel Shahzad
f54f19100c Add a PIREP flag for ready_only; some more METAR cleanup 2018-04-09 22:04:59 -05:00
Nabeel Shahzad
4a19f609fc fix heading stylings within containers 2018-04-09 20:14:29 -05:00
Nabeel Shahzad
e109e00aa8 More styling, banner when nothing is added 2018-04-09 20:04:21 -05:00
Nabeel Shahzad
e1c8174b3f More styling fixes in admin/flight add/edit form 2018-04-09 19:32:38 -05:00
Nabeel Shahzad
0986cddae1 admin styling 2018-04-09 15:16:01 -05:00
Nabeel Shahzad
86d28aafd6 added a few columns for scheduling, styling in admin 2018-04-08 20:51:27 -05:00
Nabeel Shahzad
f842e86885 styling fixes 2018-04-08 16:00:22 -05:00
Nabeel Shahzad
5a30ba683e dependency updates 2018-04-08 09:52:41 -05:00
Nabeel Shahzad
c102a0d858 Refactor all of the unit conversion code 2018-04-07 20:52:12 -05:00
Nabeel Shahzad
eae5989845 Replace METAR data with custom class 2018-04-07 09:05:06 -05:00
Nabeel Shahzad
f4f41cd900 Fix check for block_off_time 2018-04-06 17:25:57 -05:00
Nabeel Shahzad
078f8038e4 quick comment over the ClassLoader 2018-04-06 17:23:55 -05:00
Nabeel Shahzad
d5fba47dc6 Move migration base class entirely into the interface 2018-04-06 17:21:10 -05:00
Nabeel Shahzad
3e89a53fc1 Move cron scripts to root namespace 2018-04-06 17:14:01 -05:00
Nabeel Shahzad
7179910bc6 Backend state for saving PIREP as a draft 2018-04-06 17:12:35 -05:00
Nabeel Shahzad
12a442970e PIREP form styling and improvments 2018-04-06 17:10:45 -05:00
Nabeel Shahzad
42264eb180 More refactoring of metar parser 2018-04-04 23:37:10 -05:00
Nabeel Shahzad
a31b704203 add metar lib and adding some modifications 2018-04-04 20:59:52 -05:00
Nabeel Shahzad
129c551fa0 Reorganized PIREP page 2018-04-04 17:42:43 -05:00
Nabeel Shahzad
d8dad44e43 Add compositional interface for METAR parser class 2018-04-04 17:14:46 -05:00
Nabeel Shahzad
e27f6f1b14 Add addtl fields to pirep - block_off and block_on times, calculate block_off time if not there 2018-04-04 13:03:10 -05:00
Nabeel Shahzad
052813ba4a Fixes in how METARs are parsed 2018-04-04 09:04:14 -05:00
Nabeel Shahzad
7a3a2f3e9a Remove the url generator 2018-04-04 08:46:46 -05:00
Nabeel Shahzad
9ff3c1ab10 remove single entry for pagination testing 2018-04-03 22:45:45 -05:00
Nabeel Shahzad
a0422899a5 redesigning the pirep page a bit 2018-04-03 22:44:11 -05:00
Nabeel Shahzad
6fb66a1d80 Fixing some styling on the frontend 2018-04-03 19:21:42 -05:00
Nabeel Shahzad
4d3fb5b873 removed/update composer dependencies 2018-04-03 18:15:10 -05:00
Nabeel Shahzad
af28156498 Add user balance to dashboard 2018-04-03 12:06:06 -05:00
Nabeel Shahzad
99555539a7 Fix timezone/country not being saved on register #223 2018-04-03 09:43:32 -05:00
Nabeel Shahzad
04d63ca931 Remove medialibrary stuff 2018-04-03 08:16:39 -05:00
Nabeel Shahzad
2351dbe717 Move caching into Metar base class, clean up of caller in the widget 2018-04-02 22:44:31 -05:00
Nabeel Shahzad
717118cfb4 Add METAR interface and use local library for decoding 2018-04-02 22:35:25 -05:00
Nabeel Shahzad
3dba586f83 Add downloads page 2018-04-02 18:37:41 -05:00
Nabeel Shahzad
36a7886668 Add laravel-medialibrary for avatars 2018-04-02 17:49:04 -05:00
Nabeel Shahzad
0f98e729ce Save file asset 2018-04-02 17:34:58 -05:00
Nabeel Shahzad
ccfa904300 change file controller name 2018-04-02 13:42:24 -05:00
Nabeel Shahzad
9e1e0142e9 Route downloads through controller; file IDs as hash to prevent guessing; download count; download list on airport page 2018-04-02 12:55:37 -05:00
Nabeel Shahzad
3ddee56359 Add description field for files 2018-04-02 11:46:33 -05:00
Nabeel Shahzad
bbfad3a0ef Allow uploads for top level airline 2018-04-02 11:08:38 -05:00
Nabeel Shahzad
026a83591d Fixes to file uploading; include disk name, remove clunky redirect code 2018-04-02 11:04:32 -05:00
Nabeel Shahzad
6c516cf4bf metar template change #61 2018-04-02 07:11:02 -05:00
Nabeel Shahzad
c000034cab Some changes to WX template layout and cache the API call out #61 2018-04-02 07:06:00 -05:00
Nabeel Shahzad
f84ff8de92 Add a column for the user avatar #226 2018-04-02 06:47:31 -05:00
Nabeel Shahzad
bb73af3806 Add weather to the dashboard for the current airport 2018-04-02 06:47:05 -05:00
Nabeel Shahzad
cfd0853d79 Convert expense type to char, translations for ExpenseType 2018-04-01 22:26:20 -05:00
Nabeel Shahzad
2a01a935c0 Add enums to language strings file 2018-04-01 21:44:04 -05:00
Nabeel Shahzad
02fa97504e Rename Off-block to Departed 2018-04-01 20:47:44 -05:00
Nabeel Shahzad
eb06c07fdb Update PIREP statuses 2018-04-01 20:37:10 -05:00
Nabeel Shahzad
0f521c3af9 Change PIREP states to follow AIDX guidelines 2018-04-01 20:18:12 -05:00
Nabeel Shahzad
ee077ffa16 Add public/uploads to installer permissions check 2018-04-01 19:28:15 -05:00
Nabeel Shahzad
e358b8706f Backend for file uploads attached to any generic model, initially on aircraft and airports #226 2018-04-01 18:02:12 -05:00
Nabeel Shahzad
793b3e7134 change ref_class to ref_model 2018-04-01 14:32:01 -05:00
Nabeel Shahzad
0bed38c78b Add airport overview page and links to it #225 2018-03-31 15:57:30 -05:00
Nabeel Shahzad
46f9b3d9b9 Typo #96 2018-03-30 22:36:01 -05:00
Nabeel Shahzad
1275d7ebc4 Set user on ON_LEAVE automatically after days in settings() #96 2018-03-30 22:28:19 -05:00
Nabeel Shahzad
3744dbfd5d few more checks on aircraft fields 2018-03-30 21:56:55 -05:00
Nabeel Shahzad
8fb239fb8f tests on all airport fields 2018-03-30 21:51:13 -05:00
Nabeel Shahzad
9eb8ed1804 fix aircraft status field type in model 2018-03-30 21:45:11 -05:00
Nabeel Shahzad
a3bfcf01b7 Fix mock storage for airports 2018-03-30 21:25:54 -05:00
Nabeel Shahzad
71da25eca5 Add mock stock to test the csv round-trip 2018-03-30 21:19:48 -05:00
Nabeel Shahzad
217da07007 Fix column headers 2018-03-30 20:57:30 -05:00
Nabeel Shahzad
70e5ccda6f Add IATA and ZFW to aircraft import/export and tables 2018-03-30 20:21:18 -05:00
Nabeel Shahzad
777167f46e Fix flag icons not showing 2018-03-30 19:05:15 -05:00
Nabeel Shahzad
f2952c6567 Fix blank/empty field being returned as invalid object #222 2018-03-30 18:53:43 -05:00
Nabeel Shahzad
2c726f6c52 Fix error with days input missing from flight create/edit 2018-03-30 18:25:27 -05:00
Nabeel Shahzad
1cbfdbdac5 don't attempt to convert flight type in flight exporter 2018-03-30 18:08:03 -05:00
Nabeel Shahzad
63544088cd Add validation to importers to fix invalid/empty columns #222 2018-03-30 17:27:29 -05:00
Nabeel Shahzad
bd30b1f900 Check for departure airport restrictions #221 2018-03-30 11:08:53 -05:00
Nabeel Shahzad
35fb6f0e52 Fix 404 for airport lookup 2018-03-30 08:12:11 -05:00
Nabeel Shahzad
36063e2ca6 Fix api call to airport lookup 2018-03-29 20:32:08 -05:00
Nabeel Shahzad
08d3578d38 Add cost_block_hour tests; extra logging 2018-03-29 14:55:25 -05:00
Nabeel Shahzad
2090f05236 Composer dep updates 2018-03-29 14:24:36 -05:00
Nabeel Shahzad
7fbcfa391b block on/off times in FormRequest check 2018-03-29 14:12:25 -05:00
Nabeel Shahzad
2ab4db3a2e Add edit for flight type; block_on_time and block_off_time for PIREP API 2018-03-29 14:10:49 -05:00
Nabeel Shahzad
be6fead812 Switch to yarn; add select2 2018-03-29 13:49:04 -05:00
Nabeel Shahzad
badfcb0e76 Switch to yarn; add select2 2018-03-29 13:48:50 -05:00
Nabeel Shahzad
cf43685740 Add/implement subfleet cost_block_hour and block_time for PIREP API 2018-03-29 13:42:16 -05:00
Nabeel Shahzad
0bf1286c3a Fix error in flight importer 2018-03-29 11:47:37 -05:00
Nabeel Shahzad
184123194b Fix column type for flight_type 2018-03-29 11:38:39 -05:00
Nabeel Shahzad
bc013e31c8 Fix charter cargo name 2018-03-29 11:36:08 -05:00
Nabeel Shahzad
b31384f429 Expand flight types to match IATA SSIM 2018-03-29 11:34:36 -05:00
Nabeel Shahzad
ec553f06c8 Switch to yarn instead of npm 2018-03-29 11:32:49 -05:00
Nabeel Shahzad
95fed87ad4 Fix js deps and airport lookup 2018-03-28 23:04:53 -05:00
Nabeel Shahzad
d5452d6517 split out some more vendor files 2018-03-28 15:51:44 -05:00
Nabeel Shahzad
e366ca9375 More organization of web assets 2018-03-28 14:01:38 -05:00
Nabeel Shahzad
12caa3b214 Some more messing with webpack 2018-03-28 13:39:57 -05:00
Nabeel Shahzad
226c3d0ce2 more asset file cleanup 2018-03-27 18:45:25 -05:00
Nabeel Shahzad
a1a8c6f141 strip unnecessary imports from js app files 2018-03-27 18:18:25 -05:00
Nabeel Shahzad
1518b8d4f7 vendor files 2018-03-27 16:34:55 -05:00
Nabeel Shahzad
999b11deb5 Move sass files out of public to resources/sass 2018-03-27 16:34:37 -05:00
Nabeel Shahzad
30a8028827 delete extra files and pull into vendor file 2018-03-27 15:46:54 -05:00
Nabeel Shahzad
8ad83a5f9f asset cleanup 2018-03-27 14:46:32 -05:00
Nabeel Shahzad
504b33ba2a Add AirspaceMap widget; airport overview page 2018-03-27 11:40:37 -05:00
Nabeel Shahzad
5cbb480f6e Remove Google libs 2018-03-26 15:49:07 -05:00
Nabeel Shahzad
46f49048c8 Remove composer deps 2018-03-26 15:45:57 -05:00
Nabeel Shahzad
5cad037d7d version file name 2018-03-26 15:28:28 -05:00
Nabeel Shahzad
75874e1ed0 Don't delete the import folder in build 2018-03-26 15:26:47 -05:00
Nabeel Shahzad
9387ad1891 fix version file generation 2018-03-26 15:20:25 -05:00
Nabeel Shahzad
ca831170f4 Add different version files based on branch/tag 2018-03-26 15:07:24 -05:00
Nabeel Shahzad
c51b074e32 Keep composer install without wiping 2018-03-26 14:56:03 -05:00
Nabeel Shahzad
c9b58a4d9d Change order of cleanup 2018-03-26 14:48:01 -05:00
Nabeel Shahzad
99142f9fec Fixed merge 2018-03-26 09:35:01 -05:00
Nabeel Shahzad
46e956475a Fix comments 2018-03-26 09:33:45 -05:00
Nabeel Shahzad
5ecfc2d437 Switch to autodiscover for console commands 2018-03-25 16:52:13 -05:00
Nabeel Shahzad
ca2f8e1aa5 Move helper generation to new command 2018-03-25 16:50:48 -05:00
Nabeel Shahzad
204f0b7a10 Build package without dev dependencies 2018-03-25 16:20:49 -05:00
Nabeel Shahzad
699883f2fc Update dependencies, remove ide_helper generating always 2018-03-25 16:19:24 -05:00
Nabeel Shahzad
eefce8bab6 updated composer deps 2018-03-25 09:57:15 -05:00
Nabeel Shahzad
02ae2353d4 Stylesheet changes 2018-03-25 09:38:58 -05:00
Nabeel Shahzad
0671742703 Load subfleet page first, can add aircraft from there #217 2018-03-23 20:30:31 -05:00
Nabeel Shahzad
1eb7e5d59a Fix issue with flight fields not adding correctly 2018-03-23 20:29:37 -05:00
Nabeel Shahzad
33daaf4a35 Add an InternalError type that piggybacks ValidationError 2018-03-23 17:29:54 -05:00
Nabeel Shahzad
f5c492bb7e Sort aircraft by registration 2018-03-23 16:41:09 -05:00
Nabeel Shahzad
c81fc5f25b only output airline icao in subfleet export 2018-03-23 16:38:56 -05:00
Nabeel Shahzad
eb64f268d3 Fix flight field bugs 2018-03-23 15:02:26 -05:00
Nabeel Shahzad
f8f5a71564 Move subfleet add/remove to fleet service for a flight 2018-03-23 14:10:18 -05:00
Nabeel Shahzad
1161106d9c Fix airport field row being inserted and check against airport ID 2018-03-23 12:27:28 -05:00
Nabeel Shahzad
c6f423087d fix failed to error 2018-03-23 10:37:34 -05:00
Nabeel Shahzad
182cb2d33b Change flight_number field to uint 2018-03-22 23:11:59 -05:00
Nabeel Shahzad
49dfa7fc17 Sort flights by flight_number 2018-03-22 22:50:41 -05:00
Nabeel Shahzad
28a44631fc add field values to flight api 2018-03-22 22:48:54 -05:00
Nabeel Shahzad
29b84f9281 Reverse the iata/icao columns for airport import 2018-03-22 22:21:54 -05:00
Nabeel Shahzad
7105e82922 Add days of week to flights table; add to import/export for flights 2018-03-22 21:21:35 -05:00
Nabeel Shahzad
8b53ca2fdc Fix types and codes import 2018-03-22 19:59:35 -05:00
Nabeel Shahzad
112a72ac6f Subfleet exporter #194 2018-03-22 17:59:10 -05:00
Nabeel Shahzad
46d8fb125a Add fare import/exporter #194 2018-03-22 17:48:57 -05:00
Nabeel Shahzad
a44204b185 Import/export expenses #194 2018-03-22 17:17:37 -05:00
Nabeel Shahzad
4e3a9fd9ea Export airports 2018-03-22 13:04:13 -05:00
Nabeel Shahzad
d4f79b1331 Add aircraft export 2018-03-22 12:55:56 -05:00
Nabeel Shahzad
78e70fec3b Fix directory creation path 2018-03-22 12:48:27 -05:00
Nabeel Shahzad
fbfd71adcf Cleanup Exporter; use firstOrCreate for any missing data we can infer/setup defaults for 2018-03-22 12:43:58 -05:00
Nabeel Shahzad
9657e8bd40 Rename import/export, fix tests with parser 2018-03-21 19:12:36 -05:00
Nabeel Shahzad
276b93fc57 Export flights to CSV in admin #194 2018-03-21 17:07:30 -05:00
Nabeel Shahzad
95a7365fee remove unique on update #214 2018-03-21 12:35:06 -05:00
Nabeel Shahzad
dad44db0bc Fix table reference for uniques 2018-03-21 10:34:04 -05:00
Nabeel Shahzad
0dca866f11 Fix unique validation 2018-03-21 09:55:02 -05:00
Nabeel Shahzad
bb5bb4d4c7 Fixed scoping rules in Model classes 2018-03-20 19:40:19 -05:00
Nabeel Shahzad
b9beb6c804 Add importers in console and admin for flights/aircraft/subfleets and airport #194 2018-03-20 19:17:11 -05:00
Nabeel Shahzad
782121829a Fix seeder for flight_subfleet 2018-03-20 16:12:33 -05:00
Nabeel Shahzad
5d5565e5a8 rename flight subfleet join table 2018-03-20 16:11:24 -05:00
Nabeel Shahzad
9e43955fbb rename yaml import/export 2018-03-20 16:10:52 -05:00
Nabeel Shahzad
25a299fb74 Add flight fields for templated fields on edit flight #213 2018-03-20 13:47:47 -05:00
Nabeel Shahzad
485c6e86bb add separate flight_fields table and move over to flight_field_values 2018-03-20 13:06:06 -05:00
Nabeel Shahzad
a9454c319a Add helper field() method to Pirep model 2018-03-20 11:46:48 -05:00
Nabeel Shahzad
712cb185b4 Add a helper method in the Flight model to more easily get a custom value 2018-03-20 11:36:28 -05:00
Nabeel Shahzad
4e59bd0442 view flight bids in flights screen #203 2018-03-20 11:28:06 -05:00
Nabeel Shahzad
06e1cd15c0 Fix database connection test in installer 2018-03-20 09:29:45 -05:00
Nabeel Shahzad
273ccc648d Set some more methods as final in interfaces 2018-03-19 21:01:32 -05:00
Nabeel Shahzad
ccf56ddec1 Fix formatting and interfaces in nearly every file 2018-03-19 20:50:40 -05:00
Nabeel Shahzad
04c5b9e7bf Move Enum base class to App\Interfaces 2018-03-18 21:24:41 -05:00
Nabeel Shahzad
36ea12e135 Move the model callbacks into Observables; reduce caching since it held balances incorrectly 2018-03-18 20:37:35 -05:00
Nabeel Shahzad
6b002f24a8 Store full datetime in post_date; recalculate finances on every pirep 2018-03-17 22:20:08 -05:00
Nabeel Shahzad
6fa724d7b7 Reduce the number of flights created in tests to reduce collisions 2018-03-17 18:45:18 -05:00
Nabeel Shahzad
02a6d0d056 Change the PilotFlightAwards parameter name to be more descriptive #155 2018-03-17 18:38:09 -05:00
Nabeel Shahzad
28d180e850 Change the parameter name into the award check() method #155 2018-03-17 18:19:05 -05:00
Nabeel Shahzad
3a1ee94acf Ordering in ClassLoader 2018-03-17 18:07:42 -05:00
Nabeel Shahzad
776cea7055 Add error handler when trying to invoke in ClassLoader 2018-03-17 18:07:13 -05:00
Nabeel Shahzad
4b7cd6ce6e Splice the logger to use the cron stack for the console 2018-03-17 18:05:51 -05:00
Nabeel Shahzad
67ef6872af Call the AwardListener in the proper UserStatsChanged event #155 2018-03-17 12:55:50 -05:00
Nabeel Shahzad
3c39aeee43 Change rank field from image_link to image_url for consistency 2018-03-17 12:19:26 -05:00
Nabeel Shahzad
e9baf4acb5 Add/edit the award class in Admin #155 2018-03-17 12:17:38 -05:00
Nabeel Shahzad
a21e2dd412 Clean up Award controller in admin #155 2018-03-17 11:39:51 -05:00
Nabeel Shahzad
7feecb507d Add ability to pass in parameters to an Award class #155 2018-03-17 11:35:34 -05:00
Nabeel Shahzad
26f00ccaae Add the event listener for the awards #155 2018-03-17 00:55:39 -05:00
Nabeel Shahzad
31b9195a6e Implement the other functionality for awards #154 2018-03-17 00:18:03 -05:00
Nabeel Shahzad
45a22e26be Merge #154 Awards into dev 2018-03-17 00:03:17 -05:00
Nabeel Shahzad
7dd6a7e7f3 Awards base class and scaffolding #155 2018-03-16 23:59:53 -05:00
Nabeel Shahzad
067fb0f9f0 Implement events for cron expenses; add processing of daily/monthly expenses #136 2018-03-16 20:12:56 -05:00
Nabeel Shahzad
d34de098e5 Add separate redirect config after registration 2018-03-16 11:42:01 -05:00
Nabeel Shahzad
428d016e26 Customize redirect after login 2018-03-16 11:41:18 -05:00
Nabeel Shahzad
15d483b332 Add config to change redirect after login 2018-03-16 11:40:09 -05:00
Nabeel Shahzad
92bb56e344 Add recaptcha implementation #212 2018-03-16 11:38:06 -05:00
Nabeel Shahzad
b9380b2c3a Dependencies for captcha #212 2018-03-16 10:50:04 -05:00
Nabeel Shahzad
ccbc109db2 Add setting to automatically remove bid on PIREP accept #200 2018-03-15 18:20:07 -05:00
Nabeel Shahzad
58fbbd98a4 url param was missing 2018-03-14 19:54:58 -05:00
Nabeel Shahzad
2aae789e2a Make sure inline scripts in admin all have the full base url 2018-03-14 18:14:35 -05:00
Nabeel Shahzad
e5ff927f7d Add bid was missing url() call to put the URL correctly 2018-03-14 10:40:57 -05:00
Nabeel Shahzad
afd7aebe20 Allow the fares to be submitted via API for ACARS #125 2018-03-14 10:34:41 -05:00
Nabeel Shahzad
7148f27d33 Find/replace the LoadConfiguration class #163 2018-03-14 09:46:02 -05:00
Nabeel Shahzad
6975167a77 formatting to js standard 2018-03-14 09:07:41 -05:00
Nabeel Shahzad
57cddee3fd Cleanup the api_key and csrf_token setters 2018-03-13 01:55:14 -05:00
Nabeel Shahzad
684ee545cf include csrf token and fix escaping for admin scripts 2018-03-13 01:48:47 -05:00
Nabeel Shahzad
bff80c2dc7 Change user bid to POST 2018-03-13 01:26:27 -05:00
Nabeel Shahzad
acb289f6d0 Make sure login uses Form to get the csrf token 2018-03-12 22:17:58 -05:00
Nabeel Shahzad
05655632cc Update ssri npm package bc of vulnerability 2018-03-12 20:20:59 -05:00
Nabeel Shahzad
1896e1cc35 Configure axios library and read the api-key dynamically 2018-03-12 20:14:55 -05:00
Nabeel Shahzad
0f9ce8bbb9 Frontend maps to use the commonjs compiled files 2018-03-12 18:10:35 -05:00
Nabeel Shahzad
8076c2d8c1 Fixing XSS vulnerability by using the proper output tags 2018-03-12 17:58:12 -05:00
Nabeel Shahzad
17f9464208 first pass splitting js into commonjs modules 2018-03-12 17:30:52 -05:00
Nabeel Shahzad
843cf26140 Add Axios dependency 2018-03-12 11:00:12 -05:00
Nabeel Shahzad
a3264c1cd1 re-enable csrf token for forms 2018-03-12 10:33:46 -05:00
Nabeel Shahzad
46452edf55 Include Theme as facade 2018-03-11 22:26:19 -05:00
Nabeel Shahzad
d90e118f56 Move vaCentral config to its own config file and ServiceProvider 2018-03-11 18:14:34 -05:00
Nabeel Shahzad
7cc3fc6a3a Remove the phpvms.skin config, use theme instead 2018-03-11 18:05:53 -05:00
Nabeel Shahzad
98ebd5e358 Remove the skin_view() call from base Controller class 2018-03-11 18:03:15 -05:00
Nabeel Shahzad
f05e37767f Update skinning with more flexible theme module 2018-03-11 18:00:42 -05:00
Nabeel Shahzad
03c15473b9 remove with() 2018-03-11 17:22:25 -05:00
Nabeel Shahzad
df8f6372f1 Fix issue with SKIN_NAME being undefined 2018-03-11 10:55:20 -05:00
Nabeel Shahzad
2ec7bc1caa dependency updates 2018-03-11 10:39:49 -05:00
Nabeel Shahzad
4f8f82f69f find proper rank when assigning subfleet 2018-03-09 13:03:43 -06:00
Nabeel Shahzad
724daabc5a Fix error with adding rank 2018-03-09 10:24:22 -06:00
Nabeel Shahzad
83f0f1bfe3 Fix notification events callers 2018-03-09 08:52:55 -06:00
Nabeel Shahzad
aac355b077 Fix boot magic name in trait 2018-03-08 08:56:27 -06:00
Nabeel Shahzad
f13c961863 Fix flight page errors and some naming fixes 2018-03-08 08:51:36 -06:00
Nabeel Shahzad
fefc6bc22a Add back in --base-only to version generation 2018-03-08 08:16:42 -06:00
Nabeel Shahzad
d42bfc7aae Fix version number generation 2018-03-07 10:24:29 -06:00
Nabeel Shahzad
dc2570a408 Rename the PirepService class 2018-03-06 17:36:06 -06:00
Nabeel Shahzad
a325470b8f Aircraft can have its own expenses #130 2018-03-06 17:32:56 -06:00
Nabeel Shahzad
c7925db0e7 Add field to charge an expense to a user #130 2018-03-06 17:15:42 -06:00
Nabeel Shahzad
dad923489b Set tags on transactions #130 2018-03-06 06:40:49 -06:00
Nabeel Shahzad
453ca5b180 Cleanup the transaction memos 2018-03-06 06:17:45 -06:00
Nabeel Shahzad
9d3953f3ac Refactor expenses; move finance service classes; add daily/monthly skeletons #130 #136 2018-03-05 22:49:42 -06:00
Nabeel Shahzad
db10ebf807 Add expenses on airports as well #130 #136 2018-03-05 22:10:00 -06:00
Nabeel Shahzad
88a8fd2bbd Remove subfleet_expenses and combine into main expenses table; select expense type on subfleet #130 #136 2018-03-05 21:24:49 -06:00
Nabeel Shahzad
8c05ad134e Move images to right directory 2018-03-05 21:23:17 -06:00
Nabeel Shahzad
505931736c Finance overview page added to admin with monthly breakdown #130 2018-03-05 19:55:48 -06:00
Nabeel Shahzad
01af6f6855 finance link on menu 2018-03-05 14:36:14 -06:00
Nabeel Shahzad
8b163348a2 Cleanup comments 2018-03-05 14:19:14 -06:00
Nabeel Shahzad
53e4bf533f Add finance controller; morphable expense type so they can be applied to any model #130 2018-03-05 14:18:54 -06:00
Nabeel Shahzad
33c2ee702b Cleanup subfleet expense name; reload page on recalculate #130 2018-03-05 13:15:47 -06:00
Nabeel Shahzad
a7a70ce423 Added refresh finances button to transactions list #130 2018-03-05 13:07:10 -06:00
Nabeel Shahzad
96e8fbfa78 Add subfleet specific expenses, fixed bug for pirep fares #130 #136 2018-03-05 12:21:38 -06:00
Nabeel Shahzad
bf94a20e57 Set the default email driver to the default php mail 2018-03-05 09:21:40 -06:00
Nabeel Shahzad
65940c6df2 Updated composer reqs 2018-03-05 09:18:31 -06:00
Nabeel Shahzad
56f5276bae update symfony version deps 2018-03-04 15:07:28 -06:00
Nabeel Shahzad
454b2b488b Add transaction group filter 2018-03-04 09:45:23 -06:00
Nabeel Shahzad
2eb0f76f32 Fix sample data removing extra expenses #130 2018-03-02 17:52:20 -06:00
Nabeel Shahzad
9424bf7c46 Fix finding expenses call #130 2018-03-02 17:48:36 -06:00
Nabeel Shahzad
fa5237179b Remove balance field from user table #130 2018-03-02 17:31:58 -06:00
Nabeel Shahzad
586769fbf0 Fix tests and docs/better checks #130 2018-03-02 17:29:11 -06:00
Nabeel Shahzad
2df09c533b show transactions in pirep 2018-03-02 16:09:48 -06:00
Nabeel Shahzad
9d65515290 Add index of ref class+id #130 2018-03-02 13:15:18 -06:00
Nabeel Shahzad
607367feb2 Replace the ref_class_id 2018-03-02 13:14:20 -06:00
Nabeel Shahzad
9f89447070 Add pilot pay to journals; cleanup payment code #130 2018-03-02 13:12:39 -06:00
Nabeel Shahzad
284db21a3a Hide API key from admin 2018-03-02 09:26:25 -06:00
Nabeel Shahzad
02374dcd57 Update balance in callbacks 2018-03-01 22:00:11 -06:00
Nabeel Shahzad
92a18448eb YAML table exporter 2018-03-01 21:59:58 -06:00
Nabeel Shahzad
a3305249a6 Test for credits and debits with fixed amounts 2018-03-01 19:15:55 -06:00
Nabeel Shahzad
f9208c9d72 Don't throw exception is journal exists #130 2018-03-01 18:59:24 -06:00
Nabeel Shahzad
2c52a2f7e6 Post fares/expenses on PIREP to Airline journal #130 2018-03-01 16:20:13 -06:00
Nabeel Shahzad
f1b9ea94dc Use morphed column types 2018-03-01 09:51:48 -06:00
Nabeel Shahzad
d22eed50ad Add test to get the balance group #130 2018-02-28 21:54:58 -06:00
Nabeel Shahzad
498e795e4b Fixes and tests for the journal and journaled transactions #130 2018-02-28 21:52:36 -06:00
Nabeel Shahzad
1794549a20 Move journal transaction code to repository #130 2018-02-28 19:04:56 -06:00
Nabeel Shahzad
d1fcecf873 Change to getValue() on Money class 2018-02-28 18:17:15 -06:00
Nabeel Shahzad
f557e9f965 Add ledger and journal tables #130 2018-02-28 18:01:32 -06:00
Nabeel Shahzad
7ffef849d2 Remove useless tests 2018-02-28 15:42:43 -06:00
Nabeel Shahzad
448a9846c9 Implement airport hub restriction closes #104 2018-02-28 15:37:24 -06:00
Nabeel Shahzad
3188f356eb Add setting for home airport restriction #104 2018-02-28 15:27:46 -06:00
Nabeel Shahzad
e7868868c4 Fix the module stubs and sample module for admin closes #201 2018-02-28 15:16:36 -06:00
Nabeel Shahzad
208b6e73dc Don't overwrite pagination counts, let it default to the config #162 2018-02-28 15:06:57 -06:00
Nabeel Shahzad
6993cba55a Don't change rank if it seems like it's been manually changed by an admin #196 2018-02-28 15:01:23 -06:00
Nabeel Shahzad
e03abc1a64 Moved away from the phpmoney library since it requires intl extension 2018-02-28 13:54:14 -06:00
Nabeel Shahzad
777bd5e26d Return the pay in Money() format 2018-02-28 13:34:49 -06:00
Nabeel Shahzad
a6afcc944c Add Money composition class to Support 2018-02-27 21:38:05 -06:00
Nabeel Shahzad
ae0c3c5f27 Get the pilot pay, reconcile with values for subfleet overrides 2018-02-27 16:16:40 -06:00
Nabeel Shahzad
bb4fdc5b7f cleanup if on table 2018-02-27 14:30:31 -06:00
Nabeel Shahzad
dfa6d6da51 Split rank pay rate into separate rates for acars and manual flights 2018-02-27 14:29:45 -06:00
Nabeel Shahzad
81b867fa20 Add bid expire time 2018-02-27 14:23:09 -06:00
Nabeel Shahzad
3aa4b8a410 Cleanup and move subfleet/rank settings to FleetService class 2018-02-27 14:12:03 -06:00
Nabeel Shahzad
f0977b48e5 alt_airports missing in flight create 2018-02-27 13:38:11 -06:00
Nabeel Shahzad
baccf7e3ad Fix the flight time not showing closes #199 2018-02-27 13:37:29 -06:00
Nabeel Shahzad
97764866f2 Rename user_bids table to bids 2018-02-27 13:25:32 -06:00
Nabeel Shahzad
c89926399b Delete a bid by either the bid_id or the flight_id 2018-02-27 13:14:58 -06:00
Nabeel Shahzad
a38b4e063b Return the flight object with the bid 2018-02-27 13:11:48 -06:00
Nabeel Shahzad
4c22a098c1 remove QSA, seems to cause problems 2018-02-27 12:32:58 -06:00
Nabeel Shahzad
18aa573a16 remove extra libs 2018-02-26 20:30:50 -06:00
Nabeel Shahzad
d61ade4482 move currency to config file; change units to their own group in settings 2018-02-26 20:23:48 -06:00
Nabeel Shahzad
920b92c096 Update node and package deps 2018-02-26 19:44:10 -06:00
Nabeel Shahzad
10a2084163 Shrink left nav margins in admin 2018-02-26 19:43:42 -06:00
Nabeel Shahzad
e6d78f3e22 cleanup some templates 2018-02-26 19:23:22 -06:00
Nabeel Shahzad
cdd5fc749c Add the acars and manual payrates in the rank/subfleet forms 2018-02-26 19:14:10 -06:00
Nabeel Shahzad
f6ec647eb6 Add base payrate field for ranks 2018-02-26 17:56:30 -06:00
Nabeel Shahzad
4a73a5a6b3 Add table/models and admin for expenses #136 2018-02-26 15:16:12 -06:00
Nabeel Shahzad
286ed78436 Add RewriteBase and QSA to htaccess 2018-02-26 12:35:15 -06:00
Nabeel Shahzad
4393523929 Fix some error conditions in installer; hide passwords in logs 2018-02-25 15:27:20 -06:00
Nabeel Shahzad
d9abaa2f06 Cleanup config files if the db setup fails 2018-02-25 15:13:04 -06:00
Nabeel Shahzad
88e4c26b8f db host placeholder 2018-02-25 15:02:50 -06:00
Nabeel Shahzad
f20cfb53a6 laravel/composer deps updates 2018-02-25 11:23:52 -06:00
Nabeel Shahzad
82b5ff620d put a minimal config for installer into config dir 2018-02-25 11:12:27 -06:00
Nabeel Shahzad
44f839e104 Fix module provider sub 2018-02-25 11:12:01 -06:00
Nabeel Shahzad
3bbcd2a20d fix pirep ids in sample; rename navs to flight reports 2018-02-24 16:05:00 -06:00
Nabeel Shahzad
d0b3b27975 Remove the flight_id column from the pireps table 2018-02-24 15:51:04 -06:00
Nabeel Shahzad
7345dd8076 change some of the sample data 2018-02-24 15:47:43 -06:00
Nabeel Shahzad
2e57f84657 Add sample data for pirep fares #125 2018-02-24 15:45:43 -06:00
Nabeel Shahzad
58e0f50c48 specify fares, js to dynamically change fare form; get applicable fares for the flight/pirep #125 2018-02-24 15:38:25 -06:00
Nabeel Shahzad
910c0e0eab Convert aircraft active to more detailed status #134 2018-02-23 16:37:10 -06:00
Nabeel Shahzad
709aec83e2 Add multiplier to factory #134 2018-02-23 16:07:53 -06:00
Nabeel Shahzad
db94f5b405 Add a ground_handling_multiplier to the subfleet table #134 2018-02-23 16:00:14 -06:00
Nabeel Shahzad
4142d5d28a Add ground_handling_cost to airport #134 2018-02-23 15:48:50 -06:00
Nabeel Shahzad
b8b4fe7a8a Add percentages as part of sample data #125 2018-02-23 15:34:14 -06:00
Nabeel Shahzad
d5aef6fb87 Allow setting percent for fare overrides against base fare #125 2018-02-23 15:12:09 -06:00
Servetas George
78724e981c Awards Administration 2018-01-28 21:19:35 +02:00
1613 changed files with 57477 additions and 185169 deletions

26
.editorconfig Normal file
View File

@@ -0,0 +1,26 @@
#
root = true
[*.js]
indent_style = space
indent_size = 2
[*.php]
indent_style = space
indent_size = 4
[*.blade.php]
indent_style = space
indent_size = 2
[*.stub]
indent_style = space
indent_size = 4
[Makefile]
indent_style = tab
# Matches the exact files either package.json or .travis.yml
[{package.json, .travis.yml}]
indent_style = space
indent_size = 2

7
.eslintignore Normal file
View File

@@ -0,0 +1,7 @@
.travis/*
.idea/*
.vscode/*
node_modules/*
public/*
gulpfile.js
webpack.mix.js

28
.eslintrc Normal file
View File

@@ -0,0 +1,28 @@
{
"extends": "airbnb",
"env": {
"es6": true,
"browser": true
},
"parserOptions": {
"ecmaVersion": 8
},
"rules": {
"camelcase": 0,
"no-console": 0,
"func-names": 0,
"prefer-object-spread": 0,
"no-param-reassign": [
2,
{
"props": false
}
],
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
]
}
}

30
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,30 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**Version**
Please enter the version
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context and attach logs (from `storage/logs/laravel-<date>.log`)

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

10
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
---
daysUntilStale: 60
daysUntilClose: false
exemptLabels:
- pinned
- security
exemptMilestones: true
staleLabel: wontfix
markComment: false
closeComment: false

5
.gitignore vendored
View File

@@ -1,9 +1,12 @@
_ide_helper.php
.php_cs.cache
.phpstorm.meta.php
.phpunit.result.cache
/vendor
node_modules/
npm-debug.log
composer.phar
yarn-error.log
*.bak
# Laravel 4 specific

View File

@@ -4,8 +4,8 @@ Options -Indexes
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Deny all these files/folders
RedirectMatch 403 ^/.git/.*?$
@@ -20,6 +20,7 @@ RedirectMatch 403 ^/storage/.*?$
RedirectMatch 403 ^/tests/.*?$
RedirectMatch 403 ^/vendor/.*?$
RedirectMatch 403 ^/.bowerrc$
RedirectMatch 403 ^/.env
RedirectMatch 403 ^/artisan$
RedirectMatch 403 ^/composer.json
RedirectMatch 403 ^/composer.lock
@@ -32,12 +33,6 @@ RedirectMatch 403 ^/package.json
RedirectMatch 403 ^/package-lock.json
RedirectMatch 403 ^/phpunit.xml
RedirectMatch 403 ^/webpack.mix.js
RedirectMatch 403 ^/yarn.lock
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteRule ^(.*)$ public/$1 [L]

37
.php_cs Normal file
View File

@@ -0,0 +1,37 @@
<?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);

30
.styleci.yml Normal file
View File

@@ -0,0 +1,30 @@
preset: recommended
risky: true
enabled:
- align_double_arrow_minimal
# - align_equals_minimal
# - date_time_immutable
- ereg_to_preg
- function_to_constant
# - mb_str_functions
- modernize_types_casting
# - native_function_invocation
- no_blank_lines_after_return
- no_homoglyph_names
- no_php4_constructor
- no_useless_else
- phpdoc_add_missing_param_annotation
disabled:
- align_double_arrow
- blank_line_before_return
# - hash_to_slash_comment
- phpdoc_summary
- phpdoc_var_without_name
# - unalign_equals
finder:
exclude:
- node_modules
- storage
- vendor
name: "*.php"
not-name: "*.blade.php"

View File

@@ -1,11 +1,22 @@
#
# Travis CI config file
#
language: php
php:
#- '7.0'
- '7.1'
- '7.2'
#- nightly
- '7.2'
- '7.3'
matrix:
include:
- php: '7.2'
- php: '7.3'
fast_finish: true
cache:
# Cache lives for 10 min
# Default of 3m might not be long enough for all the runs
timeout: 600
directories:
- "$HOME/.composer/cache"
- "$HOME/.npm"
@@ -13,45 +24,58 @@ cache:
services:
- mysql
before_script:
install:
- composer install --dev --no-interaction --verbose
- cp .travis/env.travis.php env.php
- composer install --no-interaction --verbose
- cp .travis/phpunit.travis.xml phpunit.xml
before_script:
- php artisan database:create --reset
- php artisan migrate:refresh --seed
script:
- php artisan database:create --reset
- php artisan migrate:refresh --seed
- cp .travis/phpunit.travis.xml phpunit.xml
- vendor/bin/phpunit --debug --verbose
- vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --diff --using-cache=no
- vendor/bin/phpunit --debug --verbose
after_failure:
- cat storage/logs/*.log
- cat storage/logs/*.log
jobs:
include:
# Just packages up a release
- stage: package
script: skip
before_deploy:
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/6b10798/install | bash
# Configure the conditional deployment
# https://docs.travis-ci.com/user/deployment/#examples-of-conditional-deployment
deploy:
- provider: script
skip_cleanup: true
script: ./.travis/deploy_script.sh
on:
all_branches: true
php: '7.1'
repo: nabeelio/phpvms
php: '7.2'
tags: false
# RELEASE STAGE
# Only runs when there's a tag applied to this release (tag should be the version)
# This uses Github Releases and posts it there (provider: releases)
# https://docs.travis-ci.com/user/deployment/releases
- stage: release
script: skip
before_deploy:
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/6b10798/install | bash
- ./.travis/deploy_script.sh
deploy:
provider: releases
skip_cleanup: true
api_key:
secure: kAOYEThsSF8wM7vx+e+xWKhlvsNzhgKn1bk0zLBb7RLUM5pHIGKV/j0KrCNspwIUEPF0O594H6hCyswlpIZfxW2mTnmPqfbKxG/H2rLEAoOV0/MqzeC/gffxm7Eop6Sn4T/UC9kLSgqRynllbYtJDK6aWESdnvK3Fka0Cnpn7l/2phEf2J/nOF6QT/utpws1E0MUGqrKvX1/UYIu8np5e5aYLPOXnqahK8qzJFL4CyNBv+fhXuXfmOF4UbNbSPnrg/kY0QpUtFpz9ebvg5BjfMXJT0P4Q1BjgKBN76A7vz+ZfPmW6SqKv3o1yisXAgBWzylXh8B6pK+cUk4uXbagcGcIdkGOI6pQ5sLq+JOkBhVjSfogERePkt44KPif4EMsLRw/Jp4pTMy/vmgrON/jkbA+jXsOARTG5vAwIq4lyZzZXWUfirYwXeCfasgf+xTdo9C0cOE0jlqojO7SdF2CinDk9BduYpBTectea8Xx+YP5R1JCZNORDYynlLHKMW/8PJyAG+AsbcfKNTobQAfxw1nHa7GoKP1j4MSx1UtbulZdhmeRX/nUTFIvfgEDrl4cdBlt0/o5SuyN92DiCnvJZaYHcgXwYMvoqdXxBCnBKsM/1BZcykWi7Zt/q8krWYCOfCzBN4TDdmrKsEOUkCSOL9mI6gERHGmcGZN05PxU950=
api_key: $GITHUB_TOKEN
file_glob: true
file: build/*
on:
tags: true
repo: nabeelio/phpvms
php: '7.1'
php: '7.2'

27
.travis/Formatting.xml Normal file
View File

@@ -0,0 +1,27 @@
<code_scheme name="PHPVMS" version="173">
<option name="RIGHT_MARGIN" value="100" />
<PHPCodeStyleSettings>
<option name="ALIGN_KEY_VALUE_PAIRS" value="true" />
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
<option name="LOWER_CASE_NULL_CONST" value="true" />
<option name="ALIGN_CLASS_CONSTANTS" value="true" />
<option name="FORCE_SHORT_DECLARATION_ARRAY_STYLE" value="true" />
</PHPCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="JAVA">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JSON">
<indentOptions>
<option name="INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="PHP">
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
<option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" />
</codeStyleSettings>
</code_scheme>

View File

@@ -14,7 +14,7 @@ if [ "$TRAVIS" = "true" ]; then
exit 0;
fi;
BASE_VERSION=`php artisan phpvms:version --base-only`
BASE_VERSION=$(php artisan phpvms:version --base-only)
PKG_NAME=${BASE_VERSION}-${TRAVIS_BRANCH}
fi
@@ -23,45 +23,118 @@ if [ "$TRAVIS" = "true" ]; then
echo "Writing $TAR_NAME"
php artisan phpvms:version --write > VERSION
VERSION=`cat VERSION`
VERSION=$(cat VERSION)
echo "Version: $VERSION"
echo "Cleaning files"
make clean
rm -rf vendor
composer install --no-dev --prefer-dist --no-interaction --verbose
# Clean up the dependencies to remove some of the dev packages
# declare -a remove_packages=(
# 'barryvdh/laravel-ide-helper'
# 'bpocallaghan/generators'
# 'codedungeon/phpunit-result-printer'
# 'fzaninotto/faker'
# 'nikic/php-parser'
# 'phpstan/phpstan'
# 'phpunit/phpunit',
# 'weebly/phpstan-laravel'
# )
#
# for pkg in "${remove_packages[@]}"
# do
# composer --optimize-autoloader --no-interaction remove $pkg
# done
# Leftover individual files to delete
declare -a remove_files=(
.git
.github
.sass-cache
.idea
.travis
docker
tests
_ide_helper.php
.dpl
.editorconfig
.eslintignore
.eslintrc
.php_cs
.php_cs.cache
.phpstorm.meta.php
.styleci.yml
.phpunit.result.cache
env.php
intellij_style.xml
config.php
docker-compose.yml
Makefile
phpcs.xml
phpunit.xml
phpvms.iml
Procfile
phpstan.neon
node_modules
composer.phar
vendor/willdurand/geocoder/tests
)
for file in "${remove_files[@]}"
do
rm -rf $file
done
rm -rf env.php config.php
find ./vendor -type d -name ".git" -print0 | xargs rm -rf
find . -type d -name "sass-cache" -print0 | xargs rm -rf
# clear any app specific stuff that might have been loaded in
find storage/app/public -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/app -mindepth 1 -not -name '.gitignore' -not -name public -print0 -exec rm -rf {} +
find storage/app -mindepth 1 -maxdepth 1 -not -name '.gitignore' -not -name public -not -name import -print0 -exec rm -rf {} +
find storage/app/public -mindepth 1 -maxdepth 1 -not -name '.gitignore' -not -name avatars -not -name uploads -print0 -exec rm -rf {} +
find storage/app/public/avatars -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/app/public/uploads -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/debugbar -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/docker -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/framework/cache -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/framework/sessions -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/framework/views -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/logs -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
# Remove any development files
rm -rf .sass-cache
rm -rf .idea phpvms.iml .travis .dpl
rm -rf .phpstorm.meta.php _ide_helper.php phpunit.xml Procfile
mkdir -p storage/app/public/avatars
mkdir -p storage/app/public/uploads
mkdir -p storage/framework/cache
mkdir -p storage/framework/sessions
mkdir -p storage/framework/views
# remove large sized files
rm -rf .git
rm -rf node_modules
rm -rf composer.phar
# Regenerate the autoloader and classes
composer dump-autoload
make clean
# delete files in vendor that are rather large
rm -rf vendor/willdurand/geocoder/tests
echo "creating tarball"
echo "Creating Tarball"
cd /tmp
tar -czf $TAR_NAME -C $TRAVIS_BUILD_DIR/../ phpvms
sha256sum $TAR_NAME > "$TAR_NAME.sha256"
echo "uploading to s3"
echo "Uploading to S3"
mkdir -p $TRAVIS_BUILD_DIR/build
cd $TRAVIS_BUILD_DIR/build
mv "/tmp/$TAR_NAME" "/tmp/$TAR_NAME.sha256" .
artifacts upload --target-paths "/" $TAR_NAME $TRAVIS_BUILD_DIR/VERSION $TAR_NAME.sha256
# Upload the version for a tagged release. Move to a version file in different
# tags. Within phpVMS, we have an option of which version to track in the admin
if test "$TRAVIS_TAG"; then
echo "Uploading release version file"
cp "$TRAVIS_BUILD_DIR/VERSION" release_version
artifacts upload --target-paths "/" release_version
else
echo "Uploading ${TRAVIS_BRANCH}_version file"
cp $TRAVIS_BUILD_DIR/VERSION ${TRAVIS_BRANCH}_version
artifacts upload --target-paths "/" ${TRAVIS_BRANCH}_version
fi
curl -X POST --data "{\"content\": \"A new build is available at http://downloads.phpvms.net/$TAR_NAME ($VERSION)\"}" -H "Content-Type: application/json" $DISCORD_WEBHOOK_URL
fi

View File

@@ -1,14 +0,0 @@
APP_ENV=prod
APP_KEY=base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=phpvms
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=array

View File

@@ -2,29 +2,28 @@
exit();
?>
APP_ENV=dev
APP_KEY=base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY=
APP_URL=http://localhost
APP_SKIN=default
APP_DEBUG=true
APP_LOCALE=en
APP_ENV="dev"
APP_KEY="base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY="
APP_URL="http://localhost"
APP_SKIN="default"
APP_DEBUG="true"
APP_LOCALE="en"
PHPVMS_INSTALLED=true
VACENTRAL_API_KEY=
PHPVMS_INSTALLED="true"
APP_LOG=daily
APP_LOG_LEVEL=debug
APP_LOG_MAX_FILES=3
APP_LOG="daily"
APP_LOG_LEVEL="debug"
APP_LOG_MAX_FILES="3"
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=phpvms
DB_USERNAME=root
DB_CONNECTION="mysql"
DB_HOST="127.0.0.1"
DB_PORT="3306"
DB_DATABASE="phpvms"
DB_USERNAME="root"
DB_PASSWORD=
CACHE_DRIVER=file
CACHE_DRIVER="file"
CACHE_PREFIX=
SESSION_DRIVER=file
QUEUE_DRIVER=database
SESSION_DRIVER="file"
QUEUE_DRIVER="database"

View File

@@ -13,6 +13,9 @@
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<extensions>
<extension class="Tests\Bootstrap"/>
</extensions>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
@@ -25,5 +28,18 @@
<ini name="error_reporting" value="E_ALL"/>
<ini name="display_errors" value="On"/>
<ini name="display_startup_errors" value="On"/>
<server name="APP_ENV" value="testing"/>
<server name="APP_KEY" value="base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI="/>
<server name="APP_DEBUG" value="true"/>
<server name="APP_LOG_LEVEL" value="debug"/>
<server name="DB_CONNECTION" value="memory"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="QUEUE_DRIVER" value="sync"/>
<server name="APP_CONFIG_CACHE" value="bootstrap/cache/config.phpunit.php"/>
<server name="APP_SERVICES_CACHE" value="bootstrap/cache/services.phpunit.php"/>
<server name="APP_PACKAGES_CACHE" value="bootstrap/cache/packages.phpunit.php"/>
<server name="APP_ROUTES_CACHE" value="bootstrap/cache/routes.phpunit.php"/>
<server name="APP_EVENTS_CACHE" value="bootstrap/cache/events.phpunit.php"/>
</php>
</phpunit>

View File

@@ -1,49 +1,9 @@
## Alpha 2 (2018-02-23, v7.0.0-alpha2)
## Beta 2 (7.0.0-beta.2)
!! Please do a full reinstall, with recreating the database
- Switching to semver
- PHP 7.2 minimum
- Lots of fixes, view the [Github Milestone](https://github.com/nabeelio/phpvms/milestone/2?closed=1) for details
- Bump minimum PHP version to 7.1, since 7.0 is already deprecated - [#166](https://github.com/nabeelio/phpvms/issues/166)
- Upgraded to Laravel 5.6
- Installer: Updated to create `config.php` file, to override config file values without having to modify the config files themselves
- Installer: Moved most options into the `config.php`, out of the `env.php` file
- Admin: Set the country for the airline [#191](https://github.com/nabeelio/phpvms/issues/191)
- Admin: Add ranks from the subfleet edit page
- Admin: Added flight time field to flight add/edit page
- Admin: PIREP hours can't be changed after it's no longer in a pending state
- Admin: Removed the tail number field
- DB: `airport.tz` to `airport.timezone`
- DB: Removed `aircaft.tail_number`
- DB: Decimal type field sizes shrunk to the default sizes
- DB: Removed the `raw_data` field from the PIREPs table
- API: All units expected in imperial (distance in nautical miles, fuel in lbs, mass in lbs)
- API: Added ability to add/remove bids for users
- API: Added a setting to only show aircraft that are at the departure airport of a flight [#171](https://github.com/nabeelio/phpvms/issues/171)
- API: Most calls, with exception of ACARS, are now private and require an API key to access [#173](https://github.com/nabeelio/phpvms/issues/173)
- API: Create an `/api/flight/:id/route` call to return the route information for a flight [#183](https://github.com/nabeelio/phpvms/issues/183)
- API: Allow a `fields` object to set custom PIREP fields, also returns the current values
- API: `level` not required in prefile anymore
- Setting: Restrict to aircraft that are at a flight's departure airport [#171](https://github.com/nabeelio/phpvms/issues/171)
- Setting: Implementation of filtering flights that are only at the user's current airport [#174](https://github.com/nabeelio/phpvms/issues/174)
- Templates: Add a `SKIN_NAME` template variable to reference the current skin, vs hardcoding the skin name in the templates
- Console: Added `php artisan phpvms:dev-install` command which creates the config files and creates the database/inserts sample data in one command [#176](https://github.com/nabeelio/phpvms/issues/176)
- Rank aircraft restrictions are properly working now [#170](https://github.com/nabeelio/phpvms/issues/170)
#### Fixes
- PIREP fields being set when filing manually is working
- ACARS data wasn't being ordered properly, causing issues on the map [77055991](https://github.com/nabeelio/phpvms/commit/77055991af36877552e1921466987d3066774d6b)
- Field for the rank's image changed to string input [b5dbde8](https://github.com/nabeelio/phpvms/commit/b5dbde84c4c786799f474117381b8227642f0777)
- Set a default value for a setting [#106](https://github.com/nabeelio/phpvms/issues/106)
- Admin: Rank image field fixed
- API: Only active airlines are returned
- API; Return errors if user isn't allowed on the submitted aircraft [#170](https://github.com/nabeelio/phpvms/issues/170)
- API: Fixed typo from `subfleet` to `subfleets` in the `/api/flights` call(s) [f6b2102](https://github.com/nabeelio/phpvms/commit/f6b2102e4827da6177eb4eee0c3ce0d38eb78ce3)
- API: Wrapped all calls in a `data` field
- API: `planned_distance` and `planned_flight_time` fields are now optional
- Setting: Subfleets returned in the flight calls respect the `pireps.restrict_aircraft_to_rank` setting [#170](https://github.com/nabeelio/phpvms/issues/170)
------
## Alpha 1 (2018-02-04, v7.0.0-alpha1)
## Beta 1 (v7.0.0-beta)
- Initial Release

View File

@@ -29,6 +29,13 @@ clean:
clean-routes:
@php artisan route:clear
.PHONY: clear
clear:
@php artisan cache:clear
@php artisan config:clear
@php artisan route:clear
@php artisan view:clear
.PHONY: build
build:
@php $(COMPOSER) install --no-interaction
@@ -36,8 +43,7 @@ build:
# This is to build all the stylesheets, etc
.PHONY: build-assets
build-assets:
npm update
npm run dev
yarn run production
.PHONY: install
install: build
@@ -60,10 +66,9 @@ reset: clean
.PHONY: reload-db
reload-db:
@php artisan database:create --reset
@php artisan migrate:fresh --seed
@php artisan phpvms:import app/Database/seeds/sample.yml
@php artisan phpvms:import app/Database/seeds/acars.yml
#php artisan phpvms:navdata
@php artisan migrate --seed
@echo "Done!"
@make clean
.PHONY: tests
tests: test
@@ -73,6 +78,14 @@ test:
#php artisan database:create --reset
vendor/bin/phpunit --debug --verbose
.PHONY: phpcs
phpcs:
@vendor/bin/php-cs-fixer fix --config=.php_cs -v --diff --dry-run
#.PHONY: phpstan
#phpstan:
# vendor/bin/phpstan analyse -c phpstan.neon -v --level 2 app
.PHONY: replay-acars
replay-acars:
#@php artisan phpvms:replay AAL10,AAL3113,BAW172,DAL988,FIN6,MSR986 --manual

View File

@@ -1,5 +1,5 @@
dnsmasq: /usr/local/sbin/dnsmasq --keep-in-foreground
#dnsmasq: /usr/local/sbin/dnsmasq --keep-in-foreground
php-fpm: /usr/local/sbin/php-fpm --nodaemonize
nginx: /usr/local/bin/nginx -g 'daemon off;'
#mysql: /usr/local/bin/mysqld
mysql: docker-compose --file ~/docker/mysql/docker-compose.yml up
#mailhog: /usr/local/bin/mailhog

View File

@@ -1,17 +1,16 @@
# phpvms <sup>7</sup>
[![Build Status](https://travis-ci.org/nabeelio/phpvms.svg)](https://travis-ci.org/nabeelio/phpvms) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d668bebb0a3c46bda381af16ce3d9450)](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=nabeelio/phpvms&amp;utm_campaign=Badge_Grade) [![Total Downloads](https://poser.pugx.org/nabeel/phpvms/downloads)](https://packagist.org/packages/nabeel/phpvms) [![Latest Stable Version](https://poser.pugx.org/nabeel/phpvms/v/stable)](https://packagist.org/packages/nabeel/phpvms) [![Latest Unstable Version](https://poser.pugx.org/nabeel/phpvms/v/unstable)](https://packagist.org/packages/nabeel/phpvms) [![License](https://poser.pugx.org/nabeel/phpvms/license)](https://packagist.org/packages/nabeel/phpvms)
[![Build Status](https://travis-ci.org/nabeelio/phpvms.svg)](https://travis-ci.org/nabeelio/phpvms) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d668bebb0a3c46bda381af16ce3d9450)](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=nabeelio/phpvms&amp;utm_campaign=Badge_Grade) [![Latest Stable Version](https://poser.pugx.org/nabeel/phpvms/v/stable)](https://packagist.org/packages/nabeel/phpvms) ![StyleCI](https://github.styleci.io/repos/93688482/shield?branch=dev) [![License](https://poser.pugx.org/nabeel/phpvms/license)](https://packagist.org/packages/nabeel/phpvms)
The next phpvms version built on the laravel framework. work in progress. If you're looking for
the old, phpVMS classic, it's [available here](https://github.com/nabeelio/phpvms_v2).
The next phpvms version built on the laravel framework. work in progress. The latest documentation, with installation instructions is available
[on the phpVMS documentation](http://docs.phpvms.net/) page.
# installation
A full distribution, with all of the composer dependencies, is available at this
[GitHub Releases](https://github.com/nabeelio/phpvms/releases) link.
The latest documentation, with installation instructions is available
[on the phpVMS documentation](http://docs.phpvms.net/) page.
## Requirements
@@ -25,11 +24,38 @@ The latest documentation, with installation instructions is available
- Database:
- MySQL 5.5+ (or MySQL variant, including MariaDB and Percona)
[View more details on requirements](http://docs.phpvms.net/basics/requirements)
[View more details on requirements](http://docs.phpvms.net/setup/requirements)
## Installer
1. Upload to your server
2. Visit the site, and follow the link to the installer
1. Visit the site, and follow the link to the installer
[View installation details](http://docs.phpvms.net/basics/installation)
[View installation details](http://docs.phpvms.net/setup/installation)
# development environment
A full development environment can be brought up using Docker:
```bash
composer install
yarn install
docker-compose build
docker-compose up
```
Then go to `http://localhost`. If you're using dnsmasq, the `app` container is listening on `phpvms.test`, or you can add to your `/etc/hosts` file:
```
127.0.0.1 phpvms.test
```
## Building JS/CSS assets
Yarn is required, run:
```bash
make build-assets
```
This will build all of the assets according to the webpack file.

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Awards;
use App\Contracts\Award;
/**
* Simple example of an awards class, where you can apply an award when a user
* has 100 flights. All award classes need to extend the AwardInterface
*/
class PilotFlightAwards extends Award
{
/**
* Set the name of this award class to make it easier to see when
* assigning to a specific award
*
* @var string
*/
public $name = 'Pilot Flights';
/**
* The description to show under the parameters field, so the admin knows
* what the parameter actually controls. You can leave this blank if there
* isn't a parameter.
*
* @var string
*/
public $param_description = 'The number of flights at which to give this award';
/**
* If the user has over N flights, then we can give them this award. This method
* only needs to return a true or false of whether it should be awarded or not.
*
* If no parameter is passed in, just default it to 100. You should check if there
* is a parameter or not. You can call it whatever you want, since that would make
* sense with the $param_description.
*
* @param int|null $number_of_flights The parameters passed in from the UI
*
* @return bool
*/
public function check($number_of_flights = null): bool
{
if (!$number_of_flights) {
$number_of_flights = 100;
}
return $this->user->flights >= $number_of_flights;
}
}

View File

@@ -7,31 +7,22 @@ use Illuminate\Contracts\Foundation\Application;
/**
* Class LoadConfiguration
* @package App\Bootstrap
*
* I'm overriding this to take advantage of the configuration caching
* and not needing to read the files from disk every time.
*
* Hopefully it won't affect anything within core framework but this
* should be ok. Will just have to be cognizant of any changes to the
* LoadConfiguration parent class, or if the Kernel changes the boot
* order -NS
*/
class LoadConfiguration extends \Illuminate\Foundation\Bootstrap\LoadConfiguration
{
/**
* Load the configuration items from all of the files.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Contracts\Config\Repository $repository
* @return void
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Contracts\Config\Repository $repository
*
* @throws \Exception
*/
protected function loadConfigurationFiles(Application $app, RepositoryContract $repository)
{
parent::loadConfigurationFiles($app, $repository);
/**
/*
* Read in the base config, only if it exists
*/
if (file_exists($app->basePath().'/config.php')) {

View File

@@ -1,65 +0,0 @@
<?php
namespace App\Console;
use Illuminate\Console\Command;
use Symfony\Component\Process\Process;
class BaseCommand extends Command
{
/**
* Streaming file read
* @param $filename
* @return \Generator
*/
public function readFile($filename)
{
$fp = fopen($filename, 'rb');
while (($line = fgets($fp)) !== false) {
$line = rtrim($line, "\r\n");
if ($line[0] === ';') {
continue;
}
yield $line;
}
fclose($fp);
}
/**
* @param $cmd
* @param bool $return
* @return string
*/
public function runCommand($cmd, $return=false, $verbose=true)
{
if (\is_array($cmd)) {
$cmd = join(' ', $cmd);
}
if($verbose) {
$this->info('Running "' . $cmd . '"');
}
$val = '';
$process = new Process($cmd);
$process->run(function ($type, $buffer) use ($return, $val) {
if ($return) {
$val .= $buffer;
} else {
echo $buffer;
}
/*if (Process::ERR === $type) {
echo $buffer;
} else {
echo $buffer;
}*/
});
return $val;
}
}

View File

@@ -2,24 +2,26 @@
namespace App\Console\Commands;
use App\Console\BaseCommand;
use App\Contracts\Command;
use App\Facades\Utils;
use GuzzleHttp\Client;
use Illuminate\Database\Eloquent\Collection;
class AcarsReplay extends BaseCommand
class AcarsReplay extends Command
{
protected $signature = 'phpvms:replay {files} {--manual} {--write-all} {--no-submit}';
protected $description = 'Replay an ACARS file';
/**
* API Key to post as
*
* @var string
*/
protected $apiKey = 'testadminapikey';
/**
* For automatic updates, how many seconds to sleep between updates
*
* @var int
*/
protected $sleepTime = 10;
@@ -35,7 +37,6 @@ class AcarsReplay extends BaseCommand
*/
protected $httpClient;
/**
* Return an instance of an HTTP client all ready to post
*/
@@ -45,148 +46,159 @@ class AcarsReplay extends BaseCommand
$this->httpClient = new Client([
'base_uri' => config('app.url'),
'headers' => [
'headers' => [
'Authorization' => $this->apiKey,
]
],
]);
}
/*protected function getArguments()
{
return [
['--files', InputOption::VALUE_OPTIONAL]
];
}*/
/**
* Make a request to start a PIREP
*
* @param \stdClass $flight
*
* @throws \RuntimeException
*
* @return string
*/
protected function startPirep($flight): string
{
# convert the planned flight time to be completely in minutes
$pft = Utils::hoursToMinutes($flight->planned_hrsenroute,
$flight->planned_minenroute);
// convert the planned flight time to be completely in minutes
$pft = Utils::hoursToMinutes(
$flight->planned_hrsenroute,
$flight->planned_minenroute
);
$flight_number = substr($flight->callsign, 3);
$response = $this->httpClient->post('/api/pireps/prefile', [
'json' => [
'airline_id' => 1,
'flight_number' => $flight_number,
'aircraft_id' => 1,
'dpt_airport_id' => $flight->planned_depairport,
'arr_airport_id' => $flight->planned_destairport,
'level' => $flight->planned_altitude,
'planned_flight_time' => $pft,
'route' => $flight->planned_route,
]
'airline_id' => 1,
'flight_number' => $flight_number,
'aircraft_id' => 1,
'dpt_airport_id' => $flight->planned_depairport,
'arr_airport_id' => $flight->planned_destairport,
'level' => $flight->planned_altitude,
'planned_flight_time' => $pft,
'route' => $flight->planned_route,
],
]);
$body = \json_decode($response->getBody()->getContents());
return $body->id;
}
/**
* Mark the PIREP as filed
*
* @param $pirep_id
*
* @throws \RuntimeException
*
* @return mixed
*/
protected function filePirep($pirep_id)
{
$response = $this->httpClient->post('/api/pireps/'.$pirep_id.'/file', [
'json'=> []
'json' => [],
]);
$body = \json_decode($response->getBody()->getContents());
return $body;
}
/**
* @param $pirep_id
* @param $data
*
* @throws \RuntimeException
*
* @return array
*/
protected function postUpdate($pirep_id, $data)
{
$uri = '/api/pireps/' . $pirep_id . '/acars/position';
$uri = '/api/pireps/'.$pirep_id.'/acars/position';
$position = [
'log' => '',
'lat' => $data->latitude,
'lon' => $data->longitude,
'heading' => $data->heading,
'altitude' => $data->altitude,
'gs' => $data->groundspeed,
'log' => '',
'lat' => $data->latitude,
'lon' => $data->longitude,
'heading' => $data->heading,
'altitude' => $data->altitude,
'gs' => $data->groundspeed,
'transponder' => $data->transponder,
];
$upd = [
'positions' => [
$position
]
$position,
],
];
$this->info("Update: $data->callsign, $position[lat] x $position[lon] \t\t"
. "hdg: $position[heading]\t\talt: $position[altitude]\t\tgs: $position[gs]");
."hdg: $position[heading]\t\talt: $position[altitude]\t\tgs: $position[gs]");
$response = $this->httpClient->post($uri, [
'json' => $upd
'json' => $upd,
]);
$body = \json_decode($response->getBody()->getContents());
return [
$data->callsign,
$position['lat'],
$position['lon'],
$position['heading'],
$position['altitude'],
$position['gs']
$position['gs'],
];
}
/**
* Parse this file and run the updates
*
* @param array $files
*
* @throws \RuntimeException
*/
protected function updatesFromFile(array $files)
{
/**
* @var $flights Collection
*/
$flights = collect($files)->transform(function ($f)
{
$file = storage_path('/replay/' . $f . '.json');
$flights = collect($files)->transform(function ($f) {
$file = $f;
if (file_exists($file)) {
$this->info('Loading ' . $file);
$this->info('Loading '.$file);
$contents = file_get_contents($file);
$contents = \json_decode($contents);
return collect($contents->updates);
} else {
$this->error($file . ' not found, skipping');
return false;
}
$this->error($file.' not found, skipping');
return false;
})
# remove any of errored file entries
// remove any of errored file entries
->filter(function ($value, $key) {
return $value !== false;
});
$this->info('Starting playback');
/**
/*
* File the initial pirep to get a "preflight" status
*/
$flights->each(function ($updates, $idx)
{
$flights->each(function ($updates, $idx) {
$update = $updates->first();
$pirep_id = $this->startPirep($update);
$this->pirepList[$update->callsign] = $pirep_id;
$this->info('Prefiled ' . $update->callsign . ', ID: ' . $pirep_id);
$this->info('Prefiled '.$update->callsign.', ID: '.$pirep_id);
});
/**
/*
* Iterate through all of the flights, retrieving the updates
* from each individual flight. Remove the update. Continue through
* until there are no updates left, at which point we remove the flight
@@ -201,15 +213,15 @@ class AcarsReplay extends BaseCommand
$this->postUpdate($pirep_id, $update);
# we're done and don't put the "no-submit" option
if($updates->count() === 0 && !$this->option('no-submit')) {
// we're done and don't put the "no-submit" option
if ($updates->count() === 0 && !$this->option('no-submit')) {
$this->filePirep($pirep_id);
}
})->filter(function ($updates, $idx) {
return $updates->count() > 0;
});
if(!$this->option('write-all')) {
if (!$this->option('write-all')) {
if (!$this->option('manual')) {
sleep($this->sleepTime);
} else {
@@ -222,9 +234,11 @@ class AcarsReplay extends BaseCommand
/**
* Execute the console command.
*
* @throws \RuntimeException
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$files = $this->argument('files');
$manual_mode = $this->option('manual');
@@ -232,6 +246,7 @@ class AcarsReplay extends BaseCommand
if ($this->option('write-all')) {
$this->info('In "dump-all" mode, just writing it all in');
} else {
/* @noinspection NestedPositiveIfStatementsInspection */
if (!$manual_mode) {
$this->info('Going to send updates every 10s');
} else {

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Console\Commands;
use App\Contracts\Command;
use Illuminate\Support\Facades\Artisan;
class ComposerCommand extends Command
{
protected $signature = 'phpvms:composer {cmd}';
protected $description = 'Composer related tasks';
/**
* Run composer update related commands
*/
public function handle()
{
switch (trim($this->argument('cmd'))) {
case 'post-update':
$this->postUpdate();
break;
default:
$this->error('Command exists');
}
}
/**
* Any composer post update tasks
*/
protected function postUpdate(): void
{
if (config('app.env') === 'dev') {
/* @noinspection NestedPositiveIfStatementsInspection */
if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
Artisan::call('ide-helper:generate');
Artisan::call('ide-helper:meta');
}
}
}
}

View File

@@ -2,48 +2,56 @@
namespace App\Console\Commands;
use App\Console\BaseCommand;
use Log;
use App\Contracts\Command;
use Illuminate\Support\Facades\Log;
use Tivie\OS\Detector;
class CreateDatabase extends BaseCommand
class CreateDatabase extends Command
{
protected $signature = 'database:create {--reset} {--conn=?}';
protected $description = 'Create a database';
protected $os;
/**
* CreateDatabase constructor.
*/
public function __construct()
{
parent::__construct();
$this->os = new \Tivie\OS\Detector();
$this->os = new Detector();
}
/**
* Create the mysql database
*
* @param $dbkey
*
* @return bool
*/
protected function create_mysql($dbkey)
{
$host = config($dbkey . 'host');
$port = config($dbkey . 'port');
$name = config($dbkey . 'database');
$user = config($dbkey . 'username');
$pass = config($dbkey . 'password');
$host = config($dbkey.'host');
$port = config($dbkey.'port');
$name = config($dbkey.'database');
$user = config($dbkey.'username');
$pass = config($dbkey.'password');
$dbSvc = new \App\Console\Services\Database();
$dsn = $dbSvc->createDsn($host, $port);
Log::info('Connection string: ' . $dsn);
Log::info('Connection string: '.$dsn);
try {
$conn = $dbSvc->createPDO($dsn, $user, $pass);
} catch (\PDOException $e) {
Log::error($e);
return false;
}
if ($this->option('reset') === true) {
$sql = "DROP DATABASE IF EXISTS `$name`";
try {
Log::info('Dropping database: '.$sql);
$conn->exec($sql);
@@ -59,12 +67,14 @@ class CreateDatabase extends BaseCommand
$conn->exec($sql);
} catch (\PDOException $e) {
Log::error($e);
return false;
}
}
/**
* Create the sqlite database
*
* @param $dbkey
*/
protected function create_sqlite($dbkey)
@@ -75,14 +85,14 @@ class CreateDatabase extends BaseCommand
}
if ($this->option('reset') === true) {
$cmd = ['rm', '-rf', config($dbkey . 'database')];
$cmd = ['rm', '-rf', config($dbkey.'database')];
$this->runCommand($cmd);
}
if (!file_exists(config($dbkey . 'database'))) {
if (!file_exists(config($dbkey.'database'))) {
$cmd = [
$exec,
config($dbkey . 'database'),
config($dbkey.'database'),
'""',
];
@@ -108,21 +118,17 @@ class CreateDatabase extends BaseCommand
}
}*/
$this->info('Using connection "' . config('database.default') . '"');
$this->info('Using connection "'.config('database.default').'"');
$conn = config('database.default');
$dbkey = 'database.connections.' . $conn . '.';
$dbkey = 'database.connections.'.$conn.'.';
if (config($dbkey . 'driver') === 'mysql') {
if (config($dbkey.'driver') === 'mysql') {
$this->create_mysql($dbkey);
}
elseif (config($dbkey . 'driver') === 'sqlite') {
} elseif (config($dbkey.'driver') === 'sqlite') {
$this->create_sqlite($dbkey);
}
// TODO: Eventually
elseif (config($dbkey . 'driver') === 'postgres') {
} // TODO: Eventually
elseif (config($dbkey.'driver') === 'postgres') {
$this->create_postgres($dbkey);
}
}

View File

@@ -2,19 +2,40 @@
namespace App\Console\Commands;
use App\Console\BaseCommand;
use App\Contracts\Command;
use App\Models\Acars;
use App\Models\Airline;
use App\Models\Pirep;
use App\Models\User;
use DB;
use App\Repositories\AcarsRepository;
use App\Services\AirportService;
use App\Services\AwardService;
use App\Services\DatabaseService;
use App\Services\UserService;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use PDO;
use Symfony\Component\Yaml\Yaml;
class DevCommands extends BaseCommand
class DevCommands extends Command
{
protected $signature = 'phpvms {cmd} {param?}';
protected $description = 'Developer commands';
protected $dbSvc;
/**
* DevCommands constructor.
*
* @param DatabaseService $dbSvc
*/
public function __construct(DatabaseService $dbSvc)
{
parent::__construct();
$this->dbSvc = $dbSvc;
}
/**
* Run dev related commands
@@ -29,14 +50,20 @@ class DevCommands extends BaseCommand
}
$commands = [
'clear-acars' => 'clearAcars',
'clear-users' => 'clearUsers',
'compile-assets' => 'compileAssets',
'db-attrs' => 'dbAttrs',
'xml-to-yaml' => 'xmlToYaml',
'clear-acars' => 'clearAcars',
'clear-users' => 'clearUsers',
'compile-assets' => 'compileAssets',
'db-attrs' => 'dbAttrs',
'list-awards' => 'listAwardClasses',
'live-flights' => 'liveFlights',
'manual-insert' => 'manualInsert',
'metar' => 'getMetar',
'recalculate-stats' => 'recalculateStats',
'reset-install' => 'resetInstall',
'xml-to-yaml' => 'xmlToYaml',
];
if(!array_key_exists($command, $commands)) {
if (!array_key_exists($command, $commands)) {
$this->error('Command not found!');
exit();
}
@@ -44,12 +71,29 @@ class DevCommands extends BaseCommand
$this->{$commands[$command]}();
}
/**
* List all award classes
*/
protected function listAwardClasses()
{
$awardSvc = app(AwardService::class);
$awards = $awardSvc->findAllAwardClasses();
$headers = ['Award Name', 'Class'];
$formatted_awards = [];
foreach ($awards as $award) {
$formatted_awards[] = [$award->name, \get_class($award)];
}
$this->table($headers, $formatted_awards);
}
/**
* Delete all the data from the ACARS and PIREP tables
*/
protected function clearAcars()
{
if(config('database.default') === 'mysql') {
if (config('database.default') === 'mysql') {
DB::statement('SET foreign_key_checks=0');
}
@@ -103,7 +147,7 @@ class DevCommands extends BaseCommand
$server_version = $pdo->getAttribute(PDO::ATTR_SERVER_VERSION);
$emulate_prepares = version_compare($server_version, $emulate_prepares_below_version, '<');
$this->info('Server Version: '. $server_version);
$this->info('Server Version: '.$server_version);
$this->info('Emulate Prepares: '.$emulate_prepares);
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, $emulate_prepares);
@@ -115,7 +159,7 @@ class DevCommands extends BaseCommand
protected function xmlToYaml()
{
$file = $this->argument('param');
$this->info('Reading '. $file);
$this->info('Reading '.$file);
$xml_str = file_get_contents($file);
$xml = new \SimpleXMLElement($xml_str);
@@ -129,7 +173,7 @@ class DevCommands extends BaseCommand
foreach ($xml->database->table_data->row as $row) {
$yaml_row = [];
foreach($row->field as $field) {
foreach ($row->field as $field) {
$fname = (string) $field['name'];
$fvalue = (string) $field;
@@ -137,13 +181,120 @@ class DevCommands extends BaseCommand
}
$yaml[$table_name][] = $yaml_row;
++$count;
$count++;
}
$this->info('Exporting '.$count.' rows');
$file_name = $table_name.'.yml';
file_put_contents(storage_path($file_name), Yaml::dump($yaml, 4, 2));
$this->info('Writing yaml to storage: '. $file_name);
$this->info('Writing yaml to storage: '.$file_name);
}
protected function getMetar(): void
{
$icao = $this->argument('param');
if (!$icao) {
$this->error('Enter an ICAO!');
exit();
}
$airportSvc = app(AirportService::class);
$metar = $airportSvc->getMetar($icao);
$this->info($metar->raw);
}
/**
* Insert the rows from the file, manually advancing each row
*/
protected function manualInsert(): void
{
$file = $this->argument('param');
$this->info('Reading '.$file);
if (!file_exists($file)) {
$this->error('File '.$file.' doesn\'t exist');
exit;
}
$yml = Yaml::parse(file_get_contents($file));
foreach ($yml as $table => $rows) {
$this->info('Importing table '.$table);
$this->info('Number of rows: '.\count($rows));
foreach ($rows as $row) {
try {
$this->dbSvc->insert_row($table, $row);
} catch (\Exception $e) {
$this->error($e);
}
$this->confirm('Insert next row?', true);
}
}
}
/**
* Recalculate the stats for all users
*/
protected function recalculateStats(): void
{
$userSvc = app(UserService::class);
$userSvc->recalculateAllUserStats();
}
/**
* Delete all of the tables, etc from the database, for a clean install
*/
protected function resetInstall(): void
{
$confirm = $this->ask('This will erase your entire install and database, are you sure? y/n ');
if (strtolower($confirm) !== 'y') {
exit(0);
}
try {
if (config('database.default') === 'mysql') {
DB::statement('SET foreign_key_checks=0');
}
$this->info('Dropping all tables');
$tables = DB::connection()->getDoctrineSchemaManager()->listTableNames();
foreach ($tables as $table) {
Schema::dropIfExists($table);
}
} catch (QueryException $e) {
$this->error('DB error: '.$e->getMessage());
}
$this->info('Deleting config file');
try {
unlink('config.php');
} catch (\Exception $e) {
}
$this->info('Deleting env file');
try {
unlink('env.php');
} catch (\Exception $e) {
}
$this->info('Clearing caches');
Artisan::call('cache:clear');
Artisan::call('route:clear');
Artisan::call('config:clear');
Artisan::call('view:clear');
$this->info('Done!');
}
public function liveFlights(): void
{
$acarsRepo = app(AcarsRepository::class);
$flights = $acarsRepo->getPositions(setting('acars.live_time'))->toArray();
dd($flights);
}
}

View File

@@ -2,63 +2,56 @@
namespace App\Console\Commands;
use App\Console\BaseCommand;
use App\Contracts\Command;
use Modules\Installer\Services\ConfigService;
/**
* Create a fresh development install
* @package App\Console\Commands
*/
class DevInstall extends BaseCommand
class DevInstall extends Command
{
protected $signature = 'phpvms:dev-install {--reset-db}';
protected $signature = 'phpvms:dev-install {--reset-db} {--reset-configs}';
protected $description = 'Run a developer install and run the sample migration';
private $databaseSeeder;
public function __construct(\DatabaseSeeder $databaseSeeder)
{
parent::__construct();
$this->databaseSeeder = $databaseSeeder;
}
/**
* Run dev related commands
*
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileException
*/
public function handle()
{
if(!$this->option('reset-db')) {
if ($this->option('reset-configs')) {
$this->rewriteConfigs();
}
# Reload the configuration
// Reload the configuration
\App::boot();
$this->info('Recreating database');
\Artisan::call('database:create', [
$this->call('database:create', [
'--reset' => true,
]);
$this->info(\Artisan::output());
#
#
$this->info('Running migrations');
\Artisan::call('migrate:fresh', [
$this->call('migrate:fresh', [
'--seed' => true,
]);
$this->info(\Artisan::output());
#
#
$this->info('Importing sample data');
\Artisan::call('phpvms:import', [
'files' => ['app/Database/seeds/sample.yml'],
]);
$this->info(\Artisan::output());
$this->info('Done!');
}
/**
* Rewrite the configuration files
*
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileException
*/
protected function rewriteConfigs()
@@ -67,28 +60,28 @@ class DevInstall extends BaseCommand
$this->info('Removing the old config files');
# Remove the old files
// Remove the old files
$config_file = base_path('config.php');
if(file_exists($config_file)) {
if (file_exists($config_file)) {
unlink($config_file);
}
$env_file = base_path('env.php');
if(file_exists($env_file)) {
if (file_exists($env_file)) {
unlink($env_file);
}
$this->info('Removing the sqlite db');
$db_file = storage_path('db.sqlite');
if(file_exists($db_file)) {
if (file_exists($db_file)) {
unlink($db_file);
}
$this->info('Regenerating the config files');
$cfgSvc->createConfigFiles([
'APP_ENV' => 'dev',
'APP_ENV' => 'dev',
'SITE_NAME' => 'phpvms test',
'DB_CONN' => 'sqlite',
'DB_CONN' => 'sqlite',
]);
$this->info('Config files generated!');

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Console\Commands;
use App\Contracts\Command;
use App\Services\ImportService;
class ImportCsv extends Command
{
protected $signature = 'phpvms:csv-import {type} {file}';
protected $description = 'Import from a CSV file';
private $importer;
/**
* Import constructor.
*
* @param ImportService $importer
*/
public function __construct(ImportService $importer)
{
parent::__construct();
$this->importer = $importer;
}
/**
* @throws \Illuminate\Validation\ValidationException
*
* @return mixed|void
*/
public function handle()
{
$type = $this->argument('type');
$file = $this->argument('file');
if (\in_array($type, ['flight', 'flights'], true)) {
$status = $this->importer->importFlights($file);
} elseif ($type === 'aircraft') {
$status = $this->importer->importAircraft($file);
} elseif (\in_array($type, ['airport', 'airports'], true)) {
$status = $this->importer->importAirports($file);
} elseif ($type === 'subfleet') {
$status = $this->importer->importSubfleets($file);
}
foreach ($status['success'] as $line) {
$this->info($line);
}
foreach ($status['errors'] as $line) {
$this->error($line);
}
}
}

View File

@@ -2,9 +2,9 @@
namespace App\Console\Commands;
use App\Console\BaseCommand;
use App\Contracts\Command;
class ImportFromClassic extends BaseCommand
class ImportFromClassic extends Command
{
protected $signature = 'phpvms:importer {db_host} {db_name} {db_user} {db_pass?} {table_prefix=phpvms_}';
protected $description = 'Import from an older version of phpVMS';
@@ -15,11 +15,11 @@ class ImportFromClassic extends BaseCommand
public function handle()
{
$db_creds = [
'host' => $this->argument('db_host'),
'name' => $this->argument('db_name'),
'user' => $this->argument('db_user'),
'pass' => $this->argument('db_pass'),
'table_prefix' => $this->argument('table_prefix')
'host' => $this->argument('db_host'),
'name' => $this->argument('db_name'),
'user' => $this->argument('db_user'),
'pass' => $this->argument('db_pass'),
'table_prefix' => $this->argument('table_prefix'),
];
$importerSvc = new \App\Console\Services\Importer($db_creds);

View File

@@ -1,77 +0,0 @@
<?php
namespace App\Console\Commands;
use App\Console\BaseCommand;
class Install extends BaseCommand
{
protected $signature = 'phpvms:install
{--update}
{--airline-name?}
{--airline-code?}';
protected $description = 'Install or update phpVMS';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$this->info('Installing phpVMS...');
$this->setupDatabase();
# Only run these if we're doing an initial install
if(!$this->option('update')) {
$this->writeLocalConfig();
$this->initialData();
}
}
/**
* Setup the database and run the migrations
* Only call the database creation if we're not
* explicitly trying to upgrade
*/
protected function setupDatabase()
{
if(!$this->option('update')) {
$this->call('database:create');
}
$this->info('Running database migrations...');
$this->call('migrate');
# TODO: Call initial seed data, for the groups and other supporting data
}
/**
* Write a local config file
*/
protected function writeLocalConfig()
{
}
/**
* Set an initial airline and admin user/password
*/
protected function initialData()
{
# TODO: Prompt for initial airline info
$airline_name = $this->option('airline-name');
if(!$airline_name) {
$airline_name = $this->ask('Enter your airline name');
}
$airline_code = $this->option('airline-code');
if(!$airline_code) {
$airline_code = $this->ask('Enter your airline code');
}
# TODO: Prompt for admin user/password
}
}

View File

@@ -2,20 +2,38 @@
namespace App\Console\Commands;
use App\Console\BaseCommand;
use App\Contracts\Command;
use App\Models\Enums\NavaidType;
use App\Models\Navdata;
class NavdataImport extends BaseCommand
class NavdataImport extends Command
{
protected $signature = 'phpvms:navdata';
protected $description = '';
/**
* Read and parse in the navaid file
* @throws \League\Geotools\Exception\InvalidArgumentException
*
* @return void
*/
public function read_wp_nav_aid()
public function handle()
{
$this->info('Emptying the current navdata...');
Navdata::query()->truncate();
$this->info('Looking for nav files...');
$this->read_wp_nav_aid();
$this->read_wp_nav_fix();
}
/**
* Read and parse in the navaid file
*
* @throws \League\Geotools\Exception\InvalidArgumentException
*
* @return void
*/
public function read_wp_nav_aid(): void
{
/*
* ....,....1....,....2....,....3....,....4....,....5....,....6..
@@ -49,7 +67,7 @@ class NavdataImport extends BaseCommand
$file_path = storage_path('/navdata/WPNAVAID.txt');
if (!file_exists($file_path)) {
$this->error('WPNAVAID.txt not found in storage/navdata');
return false;
return;
}
$this->info('Importing navaids (WPNAVAID.txt) ...');
@@ -57,10 +75,9 @@ class NavdataImport extends BaseCommand
$imported = 0;
foreach($generator as $line) {
foreach ($generator as $line) {
$navaid = [
'id' => trim(substr($line, 24, 4)), // ident column
'id' => trim(substr($line, 24, 4)), // ident column
'name' => trim(substr($line, 0, 24)),
'type' => trim(substr($line, 29, 4)),
'lat' => trim(substr($line, 33, 9)),
@@ -69,9 +86,8 @@ class NavdataImport extends BaseCommand
'class' => trim($line[60]),
];
# Map to the Navaid enum
switch($navaid['type'])
{
// Map to the Navaid enum
switch ($navaid['type']) {
case 'ILS':
$navaid['type'] = NavaidType::LOC;
break;
@@ -100,22 +116,22 @@ class NavdataImport extends BaseCommand
}*/
Navdata::updateOrCreate([
'id' => $navaid['id'], 'name' => $navaid['name']
'id' => $navaid['id'], 'name' => $navaid['name'],
], $navaid);
$imported++;
if($imported % 100 === 0) {
$this->info('Imported ' . $imported . ' entries...');
if ($imported % 100 === 0) {
$this->info('Imported '.$imported.' entries...');
}
}
$this->info('Imported a total of ' . $imported . ' nav aids');
$this->info('Imported a total of '.$imported.' nav aids');
}
/**
*
* @return void
*/
public function read_wp_nav_fix()
public function read_wp_nav_fix(): void
{
/*
* ....,....1....,....2....,...3....,....4....,....
@@ -137,9 +153,9 @@ class NavdataImport extends BaseCommand
*/
$file_path = storage_path('/navdata/WPNAVFIX.txt');
if(!file_exists($file_path)) {
if (!file_exists($file_path)) {
$this->error('WPNAVFIX.txt not found in storage/navdata');
return false;
return;
}
$this->info('Importing navaids (WPNAVFIX.txt) ...');
@@ -148,37 +164,23 @@ class NavdataImport extends BaseCommand
$imported = 0;
foreach ($generator as $line) {
$navfix = [
'id' => trim(substr($line, 0, 4)), // ident column
'id' => trim(substr($line, 0, 4)), // ident column
'name' => trim(substr($line, 24, 6)),
'type' => NavaidType::FIX,
'lat' => trim(substr($line, 30, 10)),
'lon' => trim(substr($line, 40, 11)),
'lat' => trim(substr($line, 30, 10)),
'lon' => trim(substr($line, 40, 11)),
];
switch ($navfix['type']) {
default:
$navfix['type'] = NavaidType::UNKNOWN;
break;
}
Navdata::updateOrCreate(['id' => $navfix['id']], $navfix);
Navdata::updateOrCreate([
'id' => $navfix['id'], 'name' => $navfix['name'],
], $navfix);
$imported++;
if ($imported % 100 === 0) {
$this->info('Imported ' . $imported . ' entries...');
$this->info('Imported '.$imported.' entries...');
}
}
$this->info('Imported a total of ' . $imported . ' nav fixes');
}
public function handle()
{
$this->info('Emptying the current navdata...');
Navdata::query()->truncate();
$this->info('Looking for nav files...');
$this->read_wp_nav_aid();
$this->read_wp_nav_fix();
$this->info('Imported a total of '.$imported.' nav fixes');
}
}

View File

@@ -2,13 +2,12 @@
namespace App\Console\Commands;
use App\Console\BaseCommand;
use App\Contracts\Command;
use GuzzleHttp\Client;
class TestApi extends BaseCommand
class TestApi extends Command
{
protected $signature = 'phpvms:test-api {apikey} {url}';
protected $httpClient;
/**
@@ -17,11 +16,11 @@ class TestApi extends BaseCommand
public function handle()
{
$this->httpClient = new Client([
'headers' => [
'Authorization' => $this->argument('apikey'),
'Content-type' => 'application/json',
'X-API-Key' => $this->argument('apikey'),
]
'headers' => [
'Authorization' => $this->argument('apikey'),
'Content-type' => 'application/json',
'X-API-Key' => $this->argument('apikey'),
],
]);
$result = $this->httpClient->get($this->argument('url'));

View File

@@ -2,56 +2,41 @@
namespace App\Console\Commands;
use App\Console\BaseCommand;
use App\Contracts\Command;
use App\Services\VersionService;
use Symfony\Component\Yaml\Yaml;
class Version extends BaseCommand
class Version extends Command
{
protected $signature = 'phpvms:version {--write} {--base-only}';
/**
* Create the version number that gets written out
*/
protected function createVersionNumber($cfg)
private $versionSvc;
public function __construct(VersionService $versionSvc)
{
exec($cfg['git']['git-local'], $version);
$version = substr($version[0], 0, $cfg['build']['length']);
parent::__construct();
# prefix with the date in YYMMDD format
$date = date('ymd');
$version = $date.'-'.$version;
return $version;
$this->versionSvc = $versionSvc;
}
/**
* Run dev related commands
*
* @throws \Symfony\Component\Yaml\Exception\ParseException
*/
public function handle()
{
$version_file = config_path('version.yml');
$cfg = Yaml::parse(file_get_contents($version_file));
// Write the updated build number out to the file
if ($this->option('write')) {
$version_file = config_path('version.yml');
$cfg = Yaml::parse(file_get_contents($version_file));
$build_number = $this->versionSvc->getBuildId($cfg);
$cfg['build']['number'] = $build_number;
if($this->option('write')) {
$version = $this->createVersionNumber($cfg);
$cfg['build']['number'] = $version;
file_put_contents($version_file, Yaml::dump($cfg, 4, 2));
}
# Only show the major.minor.patch version
if($this->option('base-only')) {
$version = 'v'.$cfg['current']['major'] . '.'
.$cfg['current']['minor'] . '.'
.$cfg['current']['patch'];
print $version;
} else {
$this->call('version:show', [
'--format' => 'compact',
'--suppress-app-name' => true
]);
}
$version = $this->versionSvc->getCurrentVersion(!$this->option('base-only'));
echo $version."\n";
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Console\Commands;
use App\Contracts\Command;
use DB;
use Symfony\Component\Yaml\Yaml;
/**
* Class YamlExport
*/
class YamlExport extends Command
{
protected $signature = 'phpvms:yaml-export {tables*}';
protected $description = 'YAML table export';
/**
* Run dev related commands
*/
public function handle()
{
$tables = $this->argument('tables');
if (empty($tables)) {
$this->error('No tables specified');
exit();
}
$export_tables = [];
foreach ($tables as $table) {
$export_tables[$table] = [];
$rows = DB::table($table)->get();
foreach ($rows as $row) {
$export_tables[$table][] = (array) $row;
}
}
$yaml = Yaml::dump($export_tables, 4, 2);
echo $yaml;
}
}

View File

@@ -2,49 +2,55 @@
namespace App\Console\Commands;
use App\Console\BaseCommand;
use App\Contracts\Command;
use App\Services\DatabaseService;
class YamlImport extends BaseCommand
/**
* Class YamlImport
*/
class YamlImport extends Command
{
protected $signature = 'phpvms:import {files*}';
protected $signature = 'phpvms:yaml-import {files*}';
protected $description = 'Developer commands';
protected $dbSvc;
/**
* YamlImport constructor.
*
* @param DatabaseService $dbSvc
*/
public function __construct(DatabaseService $dbSvc)
{
parent::__construct();
$this->dbSvc = $dbSvc;
}
/**
* Run dev related commands
*
* @throws \Exception
*/
public function handle()
{
$files = $this->argument('files');
if(empty($files)) {
if (empty($files)) {
$this->error('No files to import specified!');
exit();
}
$ignore_errors = true;
/*$ignore_errors = $this->option('ignore_errors');
if(!$ignore_errors) {
$ignore_errors = false;
}*/
foreach($files as $file) {
if(!file_exists($file)) {
$this->error('File ' . $file .' doesn\'t exist');
foreach ($files as $file) {
if (!file_exists($file)) {
$this->error('File '.$file.' doesn\'t exist');
exit;
}
$this->info('Importing ' . $file);
$this->info('Importing '.$file);
$imported = $this->dbSvc->seed_from_yaml_file($file, $ignore_errors);
foreach($imported as $table => $count) {
foreach ($imported as $table => $count) {
$this->info('Imported '.$count.' records from "'.$table.'"');
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Console\Cron;
use App\Contracts\Command;
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
{
protected $signature = 'cron:hourly';
protected $description = 'Run the hourly cron tasks';
protected $schedule;
public function handle(): void
{
$this->redirectLoggingToFile('cron');
event(new CronHourly());
}
}

View File

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

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Console\Cron;
use App\Contracts\Command;
use App\Events\CronNightly;
/**
* 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 Nightly extends Command
{
protected $signature = 'cron:nightly';
protected $description = 'Run the nightly cron tasks';
protected $schedule;
public function handle(): void
{
$this->redirectLoggingToFile('cron');
event(new CronNightly());
}
}

View File

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

View File

@@ -2,37 +2,37 @@
namespace App\Console;
use App\Console\Cron\Hourly;
use App\Console\Cron\Monthly;
use App\Console\Cron\Nightly;
use App\Console\Cron\Weekly;
use App\Services\CronService;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\AcarsReplay::class,
Commands\CreateDatabase::class,
Commands\DevCommands::class,
Commands\YamlImport::class,
Commands\ImportFromClassic::class,
Commands\Install::class,
Commands\NavdataImport::class,
Commands\TestApi::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*/
protected function schedule(Schedule $schedule)
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')
// ->hourly();
$schedule->command(Nightly::class)->dailyAt('01:00');
$schedule->command(Weekly::class)->weeklyOn(0);
$schedule->command(Monthly::class)->monthlyOn(1);
$schedule->command(Hourly::class)->hourly();
// When spatie-backups runs
$schedule->command('backup:clean')->daily()->at('01:00');
$schedule->command('backup:run')->daily()->at('02:00');
// Update the last time the cron was run
$cronSvc = app(CronService::class);
$cronSvc->updateLastRunTime();
}
/**
@@ -40,9 +40,10 @@ class Kernel extends ConsoleKernel
*
* @return void
*/
protected function commands()
protected function commands(): void
{
require app_path('Routes/console.php');
$this->load(__DIR__ . '/Commands');
require app_path('Http/Routes/console.php');
$this->load(__DIR__.'/Commands');
$this->load(__DIR__.'/Cron');
}
}

23
app/Console/Logger.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
namespace App\Console;
use Monolog\Handler\StreamHandler;
/**
* Just a simple custom logger that dumps to the console
*/
class Logger
{
public function __invoke(array $config)
{
$logger = new \Monolog\Logger('console');
try {
$logger->pushHandler(new StreamHandler('php://stdout'));
} catch (\Exception $e) {
}
return $logger;
}
}

View File

@@ -2,27 +2,27 @@
namespace App\Console\Services;
use Doctrine\DBAL\Driver\PDOException;
use PDO;
/**
* Class Database
* @package App\Console\Services
*/
class Database
{
/**
* Create the base connection DSN, optionally include the DB name
* @param $host
* @param $port
*
* @param $host
* @param $port
* @param null $name
*
* @return string
*/
public function createDsn($host, $port, $name=null)
public function createDsn($host, $port, $name = null)
{
$conn = config('database.default');
$dsn = "$conn:host=$host;port=$port";
if(filled($name)) {
if (filled($name)) {
$dsn .= ';dbname='.$name;
}
@@ -33,8 +33,10 @@ class Database
* @param $dsn
* @param $user
* @param $pass
* @return PDO
*
* @throws \PDOException
*
* @return PDO
*/
public function createPDO($dsn, $user, $pass)
{

View File

@@ -15,17 +15,16 @@ use App\Models\Rank;
use App\Models\Subfleet;
use App\Models\User;
use Carbon\Carbon;
use Doctrine\DBAL\Driver\PDOException;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use PDO;
use PDOException;
use Symfony\Component\Console\Output\ConsoleOutput;
/**
* Class Importer
* TODO: Batch import
* @package App\Console\Services
*/
class Importer
{
@@ -36,6 +35,7 @@ class Importer
/**
* Hold the PDO connection to the old database
*
* @var
*/
private $conn;
@@ -43,10 +43,11 @@ class Importer
/**
* @var array
*/
private $creds = [];
private $creds;
/**
* Hold the instance of the console logger
*
* @var
*/
private $log;
@@ -54,12 +55,12 @@ class Importer
/**
* CONSTANTS
*/
const BATCH_READ_ROWS = 300;
const SUBFLEET_NAME = 'Imported Aircraft';
public const BATCH_READ_ROWS = 300;
public const SUBFLEET_NAME = 'Imported Aircraft';
/**
* Importer constructor.
*
* @param $db_creds
*/
public function __construct($db_creds)
@@ -67,14 +68,14 @@ class Importer
// Setup the logger
$this->log = new ConsoleOutput();
# The db credentials
// The db credentials
$this->creds = array_merge([
'host' => '127.0.0.1',
'port' => 3306,
'name' => '',
'user' => '',
'pass' => '',
'table_prefix' => 'phpvms_'
'host' => '127.0.0.1',
'port' => 3306,
'name' => '',
'user' => '',
'pass' => '',
'table_prefix' => '',
], $db_creds);
}
@@ -85,7 +86,7 @@ class Importer
{
$this->reconnect();
# Import all the different parts
// Import all the different parts
$this->importRanks();
$this->importAirlines();
$this->importAircraft();
@@ -95,7 +96,7 @@ class Importer
$this->importFlights();
$this->importPireps();
# Finish up
// Finish up
$this->findLastPireps();
$this->recalculateRanks();
}
@@ -105,13 +106,13 @@ class Importer
*/
protected function reconnect()
{
$dsn = 'mysql:' . implode(';', [
'host=' . $this->creds['host'],
'port=' . $this->creds['port'],
'dbname=' . $this->creds['name']
$dsn = 'mysql:'.implode(';', [
'host='.$this->creds['host'],
'port='.$this->creds['port'],
'dbname='.$this->creds['name'],
]);
$this->info('Connection string: ' . $dsn);
$this->info('Connection string: '.$dsn);
try {
$this->conn = new PDO($dsn, $this->creds['user'], $this->creds['pass']);
@@ -127,37 +128,40 @@ class Importer
*/
protected function comment($message)
{
$this->log->writeln('<comment>' . $message . '</comment>');
$this->log->writeln('<comment>'.$message.'</comment>');
}
/**
* @param $message
*/
protected function error($message) {
$this->log->writeln('<error>' . $message . '</error>');
protected function error($message)
{
$this->log->writeln('<error>'.$message.'</error>');
}
/**
* @param string $message
* @param string|array $message
*/
protected function info($message)
{
if(\is_array($message)) {
if (\is_array($message)) {
/* @noinspection ForgottenDebugOutputInspection */
print_r($message);
}
else {
} else {
$this->log->writeln('<info>'.$message.'</info>');
}
}
/**
* Return the table name with the prefix
*
* @param $table
*
* @return string
*/
protected function tableName($table)
{
if($this->creds['table_prefix'] !== false) {
if ($this->creds['table_prefix'] !== false) {
return $this->creds['table_prefix'].$table;
}
@@ -165,17 +169,18 @@ class Importer
}
/**
*
* @param \Illuminate\Database\Eloquent\Model $model
*
* @return bool
*/
protected function saveModel($model)
{
try {
$model->save();
return true;
} catch (QueryException $e) {
if($e->getCode() !== '23000') {
if ($e->getCode() !== '23000') {
$this->error($e);
}
@@ -185,13 +190,14 @@ class Importer
/**
* Create a new mapping between an old ID and the new one
*
* @param $entity
* @param $old_id
* @param $new_id
*/
protected function addMapping($entity, $old_id, $new_id)
{
if(!array_key_exists($entity, $this->mappedEntities)) {
if (!array_key_exists($entity, $this->mappedEntities)) {
$this->mappedEntities[$entity] = [];
}
@@ -200,18 +206,20 @@ class Importer
/**
* Return the ID for a mapping
*
* @param $entity
* @param $old_id
*
* @return bool
*/
protected function getMapping($entity, $old_id)
{
if(!array_key_exists($entity, $this->mappedEntities)) {
if (!array_key_exists($entity, $this->mappedEntities)) {
return 0;
}
$entity = $this->mappedEntities[$entity];
if(array_key_exists($old_id, $entity)) {
if (array_key_exists($old_id, $entity)) {
return $entity[$old_id];
}
@@ -220,27 +228,31 @@ class Importer
/**
* @param $date
*
* @return Carbon
*/
protected function parseDate($date)
{
$carbon = Carbon::parse($date);
return $carbon;
}
/**
* Take a decimal duration and convert it to minutes
*
* @param $duration
*
* @return float|int
*/
protected function convertDuration($duration)
{
if(strpos($duration, '.') !== false) {
if (strpos($duration, '.') !== false) {
$delim = '.';
} elseif(strpos($duration, ':')) {
} elseif (strpos($duration, ':')) {
$delim = ':';
} else {
# no delimiter, assume it's just a straight hour
// no delimiter, assume it's just a straight hour
return (int) $duration * 60;
}
@@ -253,58 +265,61 @@ class Importer
/**
* @param $table
*
* @return mixed
*/
protected function getTotalRows($table)
{
$table = $this->tableName($table);
$sql = 'SELECT COUNT(*) FROM ' . $table;
$sql = 'SELECT COUNT(*) FROM '.$table;
$rows = $this->conn->query($sql)->fetchColumn();
$this->info('Found '.$rows.' rows in '.$table);
return (int) $rows;
}
/**
* Read all the rows in a table, but read them in a batched manner
* @param string $table The name of the table
* @param null $read_rows Number of rows to read
*
* @param string $table The name of the table
* @param null $read_rows Number of rows to read
*
* @return \Generator
*/
protected function readRows($table, $read_rows=null)
protected function readRows($table, $read_rows = null)
{
// Set the table prefix if it has been entered
$this->tableName($table);
$offset = 0;
if($read_rows === null) {
if ($read_rows === null) {
$read_rows = self::BATCH_READ_ROWS;
}
$total_rows = $this->getTotalRows($table);
while($offset < $total_rows)
{
while ($offset < $total_rows) {
$rows_to_read = $offset + $read_rows;
if($rows_to_read > $total_rows) {
if ($rows_to_read > $total_rows) {
$rows_to_read = $total_rows;
}
$this->info('Reading '.$offset.' to '.$rows_to_read.' of '.$total_rows);
$sql = 'SELECT * FROM ' . $this->tableName($table)
. ' LIMIT ' . self::BATCH_READ_ROWS . ' OFFSET ' . $offset;
$sql = 'SELECT * FROM '.$this->tableName($table)
.' LIMIT '.self::BATCH_READ_ROWS.' OFFSET '.$offset;
try {
foreach ($this->conn->query($sql) as $row) {
yield $row;
}
} catch(PDOException $e) {
} catch (PDOException $e) {
// Without incrementing the offset, it should re-run the same query
$this->error($e);
if(strpos($e->getMessage(), 'server has gone away') !== false) {
if (strpos($e->getMessage(), 'server has gone away') !== false) {
$this->reconnect();
continue;
}
@@ -316,6 +331,7 @@ class Importer
/**
* Return the subfleet
*
* @return mixed
*/
protected function getSubfleet()
@@ -330,10 +346,8 @@ class Importer
}
/**
*
* All the individual importers, done on a per-table basis
* Some tables get saved locally for tables that use FK refs
*
*/
/**
@@ -344,22 +358,21 @@ class Importer
$this->comment('--- RANK IMPORT ---');
$count = 0;
foreach ($this->readRows('ranks') as $row)
{
foreach ($this->readRows('ranks') as $row) {
$rank = Rank::firstOrCreate(
['name' => $row->rank],
['image_link' => $row->rankimage, 'hours'=>$row->minhours]
['image_url' => $row->rankimage, 'hours' => $row->minhours]
);
$this->addMapping('ranks', $row->rankid, $rank->id);
$this->addMapping('ranks', $row->rank, $rank->id);
if($rank->wasRecentlyCreated) {
++$count;
if ($rank->wasRecentlyCreated) {
$count++;
}
}
$this->info('Imported ' . $count . ' ranks');
$this->info('Imported '.$count.' ranks');
}
/**
@@ -371,8 +384,7 @@ class Importer
$this->comment('--- AIRLINE IMPORT ---');
$count = 0;
foreach ($this->readRows('airlines') as $row)
{
foreach ($this->readRows('airlines') as $row) {
$airline = Airline::firstOrCreate(
['icao' => $row->code],
['iata' => $row->code, 'name' => $row->name, 'active' => $row->enabled]
@@ -382,11 +394,11 @@ class Importer
$this->addMapping('airlines', $row->code, $airline->id);
if ($airline->wasRecentlyCreated) {
++$count;
$count++;
}
}
$this->info('Imported '. $count.' airlines');
$this->info('Imported '.$count.' airlines');
}
/**
@@ -401,23 +413,23 @@ class Importer
$this->info('Subfleet ID is '.$subfleet->id);
$count = 0;
foreach($this->readRows('aircraft') as $row)
{
foreach ($this->readRows('aircraft') as $row) {
$aircraft = Aircraft::firstOrCreate(
['name' => $row->fullname, 'registration' => $row->registration],
['icao' => $row->icao,
['icao' => $row->icao,
'subfleet_id' => $subfleet->id,
'active' => $row->enabled
]);
'active' => $row->enabled,
]
);
$this->addMapping('aircraft', $row->id, $aircraft->id);
if($aircraft->wasRecentlyCreated) {
++$count;
if ($aircraft->wasRecentlyCreated) {
$count++;
}
}
$this->info('Imported ' . $count . ' aircraft');
$this->info('Imported '.$count.' aircraft');
}
/**
@@ -428,16 +440,15 @@ class Importer
$this->comment('--- AIRPORT IMPORT ---');
$count = 0;
foreach ($this->readRows('airports') as $row)
{
foreach ($this->readRows('airports') as $row) {
$attrs = [
'id' => trim($row->icao),
'icao' => trim($row->icao),
'name' => $row->name,
'id' => trim($row->icao),
'icao' => trim($row->icao),
'name' => $row->name,
'country' => $row->country,
'lat' => $row->lat,
'lon' => $row->lng,
'hub' => $row->hub,
'lat' => $row->lat,
'lon' => $row->lng,
'hub' => $row->hub,
];
$airport = Airport::updateOrCreate(
@@ -445,12 +456,12 @@ class Importer
$attrs
);
if($airport->wasRecentlyCreated) {
++$count;
if ($airport->wasRecentlyCreated) {
$count++;
}
}
$this->info('Imported ' . $count . ' airports');
$this->info('Imported '.$count.' airports');
}
/**
@@ -461,8 +472,7 @@ class Importer
$this->comment('--- FLIGHT SCHEDULE IMPORT ---');
$count = 0;
foreach ($this->readRows('schedules') as $row)
{
foreach ($this->readRows('schedules') as $row) {
$airline_id = $this->getMapping('airlines', $row->code);
$flight_num = trim($row->flightnum);
@@ -470,14 +480,14 @@ class Importer
$attrs = [
'dpt_airport_id' => $row->depicao,
'arr_airport_id' => $row->arricao,
'route' => $row->route ?: '',
'distance' => round($row->distance ?: 0, 2),
'level' => $row->flightlevel ?: 0,
'dpt_time' => $row->deptime ?: '',
'arr_time' => $row->arrtime ?: '',
'flight_time' => $this->convertDuration($row->flighttime) ?: '',
'notes' => $row->notes ?: '',
'active' => $row->enabled ?: true,
'route' => $row->route ?: '',
'distance' => round($row->distance ?: 0, 2),
'level' => $row->flightlevel ?: 0,
'dpt_time' => $row->deptime ?: '',
'arr_time' => $row->arrtime ?: '',
'flight_time' => $this->convertDuration($row->flighttime) ?: '',
'notes' => $row->notes ?: '',
'active' => $row->enabled ?: true,
];
try {
@@ -486,19 +496,19 @@ class Importer
$attrs
);
} catch (\Exception $e) {
#$this->error($e);
//$this->error($e);
}
$this->addMapping('flights', $row->id, $flight->id);
// TODO: deserialize route_details into ACARS table
if($flight->wasRecentlyCreated) {
++$count;
if ($flight->wasRecentlyCreated) {
$count++;
}
}
$this->info('Imported ' . $count . ' flights');
$this->info('Imported '.$count.' flights');
}
/**
@@ -509,57 +519,56 @@ class Importer
$this->comment('--- PIREP IMPORT ---');
$count = 0;
foreach ($this->readRows('pireps') as $row)
{
foreach ($this->readRows('pireps') as $row) {
$pirep_id = $row->pirepid;
$user_id = $this->getMapping('users', $row->pilotid);
$airline_id = $this->getMapping('airlines', $row->code);
$aircraft_id = $this->getMapping('aircraft', $row->aircraft);
$attrs = [
#'id' => $pirep_id,
'user_id' => $user_id,
'airline_id' => $airline_id,
'aircraft_id' => $aircraft_id,
'flight_number' => $row->flightnum ?: '',
//'id' => $pirep_id,
'user_id' => $user_id,
'airline_id' => $airline_id,
'aircraft_id' => $aircraft_id,
'flight_number' => $row->flightnum ?: '',
'dpt_airport_id' => $row->depicao,
'arr_airport_id' => $row->arricao,
'block_fuel' => $row->fuelused,
'route' => $row->route ?: '',
'source_name' => $row->source,
'created_at' => $this->parseDate($row->submitdate),
'updated_at' => $this->parseDate($row->modifieddate),
'block_fuel' => $row->fuelused,
'route' => $row->route ?: '',
'source_name' => $row->source,
'created_at' => $this->parseDate($row->submitdate),
'updated_at' => $this->parseDate($row->modifieddate),
];
# Set the distance
// Set the distance
$distance = round($row->distance ?: 0, 2);
$attrs['distance'] = $distance;
$attrs['planned_distance'] = $distance;
# Set the flight time properly
// Set the flight time properly
$duration = $this->convertDuration($row->flighttime_stamp);
$attrs['flight_time'] = $duration;
$attrs['planned_flight_time'] = $duration;
# Set how it was filed
if(strtoupper($row->source) === 'MANUAL') {
// Set how it was filed
if (strtoupper($row->source) === 'MANUAL') {
$attrs['source'] = PirepSource::MANUAL;
} else {
$attrs['source'] = PirepSource::ACARS;
}
# Set the flight type
// Set the flight type
$row->flighttype = strtoupper($row->flighttype);
if($row->flighttype === 'P') {
$attrs['flight_type'] = FlightType::PASSENGER;
} elseif($row->flighttype === 'C') {
$attrs['flight_type'] = FlightType::CARGO;
if ($row->flighttype === 'P') {
$attrs['flight_type'] = FlightType::SCHED_PAX;
} elseif ($row->flighttype === 'C') {
$attrs['flight_type'] = FlightType::SCHED_CARGO;
} else {
$attrs['flight_type'] = FlightType::CHARTER;
$attrs['flight_type'] = FlightType::CHARTER_PAX_ONLY;
}
# Set the flight level of the PIREP is set
if(property_exists($row, 'flightlevel')) {
// Set the flight level of the PIREP is set
if (property_exists($row, 'flightlevel')) {
$attrs['level'] = $row->flightlevel;
} else {
$attrs['level'] = 0;
@@ -571,23 +580,23 @@ class Importer
);
$source = strtoupper($row->source);
if($source === 'SMARTCARS') {
# TODO: Parse smartcars log into the acars table
} elseif($source === 'KACARS') {
# TODO: Parse kACARS log into acars table
} elseif($source === 'XACARS') {
# TODO: Parse XACARS log into acars table
if ($source === 'SMARTCARS') {
// TODO: Parse smartcars log into the acars table
} elseif ($source === 'KACARS') {
// TODO: Parse kACARS log into acars table
} elseif ($source === 'XACARS') {
// TODO: Parse XACARS log into acars table
}
# TODO: Add extra fields in as PIREP fields
// TODO: Add extra fields in as PIREP fields
$this->addMapping('pireps', $row->pirepid, $pirep->id);
if ($pirep->wasRecentlyCreated) {
++$count;
$count++;
}
}
$this->info('Imported ' . $count . ' pireps');
$this->info('Imported '.$count.' pireps');
}
protected function importUsers()
@@ -596,10 +605,9 @@ class Importer
$count = 0;
foreach ($this->readRows('pilots', 50) as $row) {
// TODO: What to do about pilot ids
# TODO: What to do about pilot ids
$name = $row->firstname . ' ' . $row->lastname;
$name = $row->firstname.' '.$row->lastname;
$airline_id = $this->getMapping('airlines', $row->code);
$rank_id = $this->getMapping('ranks', $row->rank);
@@ -608,17 +616,17 @@ class Importer
$new_password = Str::random(60);
$attrs = [
'name' => $name,
'password' => Hash::make($new_password),
'api_key' => Utils::generateApiKey(),
'airline_id' => $airline_id,
'rank_id' => $rank_id,
'name' => $name,
'password' => Hash::make($new_password),
'api_key' => Utils::generateApiKey(),
'airline_id' => $airline_id,
'rank_id' => $rank_id,
'home_airport_id' => $row->hub,
'curr_airport_id' => $row->hub,
'flights' => (int)$row->totalflights,
'flight_time' => Utils::hoursToMinutes($row->totalhours),
'state' => $state,
'created_at' => $this->parseDate($row->joindate),
'flights' => (int) $row->totalflights,
'flight_time' => Utils::hoursToMinutes($row->totalhours),
'state' => $state,
'created_at' => $this->parseDate($row->joindate),
];
$user = User::updateOrCreate(
@@ -629,11 +637,11 @@ class Importer
$this->addMapping('users', $row->pilotid, $user->id);
if ($user->wasRecentlyCreated) {
++$count;
$count++;
}
}
$this->info('Imported ' . $count . ' users');
$this->info('Imported '.$count.' users');
}
/**
@@ -641,7 +649,6 @@ class Importer
*/
protected function findLastPireps()
{
}
/**
@@ -654,7 +661,9 @@ class Importer
/**
* Get the user's new state from their original state
*
* @param $state
*
* @return int
*/
protected function getUserState($state)
@@ -665,24 +674,31 @@ class Importer
// Declare array of classic states
$phpvms_classic_states = [
'ACTIVE' => 0,
'ACTIVE' => 0,
'INACTIVE' => 1,
'BANNED' => 2,
'ON_LEAVE' => 3
'BANNED' => 2,
'ON_LEAVE' => 3,
];
// Decide which state they will be in accordance with v7
if ($state === $phpvms_classic_states['ACTIVE']) {
return UserState::ACTIVE;
} elseif ($state === $phpvms_classic_states['INACTIVE']) {
# TODO: Make an inactive state?
return UserState::REJECTED;
} elseif ($state === $phpvms_classic_states['BANNED']) {
return UserState::SUSPENDED;
} elseif ($state === $phpvms_classic_states['ON_LEAVE']) {
return UserState::ON_LEAVE;
} else {
$this->error('Unknown status: '. $state);
}
if ($state === $phpvms_classic_states['INACTIVE']) {
// TODO: Make an inactive state?
return UserState::REJECTED;
}
if ($state === $phpvms_classic_states['BANNED']) {
return UserState::SUSPENDED;
}
if ($state === $phpvms_classic_states['ON_LEAVE']) {
return UserState::ON_LEAVE;
}
$this->error('Unknown status: '.$state);
return UserState::ACTIVE;
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Contracts;
use App\Models\Airport;
abstract class AirportLookup
{
/**
* Lookup the information for an airport. Needs to return an instance of the
* Airport model, or an array with the properties listed in the Airport model.
*
* The in-use implementation can be changed in the config/phpvms.php file, so
* different services can be used, in-case vaCentral one isn't working or there
* is a better one available. Don't handle any caching in this layer, that happens
* at the service layer
*
* Return null if there's an error or nothing was found
*
* @example App\Services\AirportLookup\VaCentralLookup
*
* @param string $icao
*
* @return Airport|null
*/
abstract public function getAirport($icao);
}

104
app/Contracts/Award.php Normal file
View File

@@ -0,0 +1,104 @@
<?php
namespace App\Contracts;
use App\Facades\Utils;
use App\Models\Award as AwardModel;
use App\Models\User;
use App\Models\UserAward;
use Log;
/**
* Base class for the Awards, you need to extend this, and implement:
* $name
* $param_description (optional)
* public function check($parameter=null)
*
* See: http://docs.phpvms.net/customizing/awards
*/
abstract class Award
{
public $name = '';
public $param_description = '';
/**
* Each award class just needs to return true or false if it should actually
* be awarded to a user. This is the only method that needs to be implemented
*
* @param null $parameter Optional parameters that are passed in from the UI
*
* @return bool
*/
abstract public function check($parameter = null): bool;
/*
* You don't really need to mess with anything below here
*/
protected $award;
protected $user;
/**
* AwardInterface constructor.
*
* @param AwardModel $award
* @param User $user
*/
public function __construct(AwardModel $award = null, User $user = null)
{
$this->award = $award;
$this->user = $user;
}
/**
* Run the main handler for this award class to determine if
* it should be awarded or not. Declared as final to prevent a child
* from accidentally overriding and breaking something
*/
final public function handle(): void
{
// Check if the params are a JSON object or array
$param = $this->award->ref_model_params;
if (Utils::isObject($this->award->ref_model_params)) {
$param = json_decode($this->award->ref_model_params);
}
if ($this->check($param)) {
$this->addAward();
}
}
/**
* Add the award to this user, if they don't already have it
*
* @return bool|UserAward
*/
final protected function addAward()
{
$w = [
'user_id' => $this->user->id,
'award_id' => $this->award->id,
];
$found = UserAward::where($w)->count('id');
if ($found > 0) {
return true;
}
// Associate this award to the user now
$award = new UserAward($w);
try {
$award->save();
} catch (\Exception $e) {
Log::error(
'Error saving award: '.$e->getMessage(),
$e->getTrace()
);
return false;
}
return $award;
}
}

116
app/Contracts/Command.php Normal file
View File

@@ -0,0 +1,116 @@
<?php
namespace App\Contracts;
use Illuminate\Support\Facades\Log;
use Symfony\Component\Process\Process;
/**
* Class BaseCommand
*/
abstract class Command extends \Illuminate\Console\Command
{
/**
* @return mixed
*/
abstract public function handle();
/**
* Adjust the logging depending on where we're running from
*/
public function __construct()
{
parent::__construct();
// Running in the console but not in the tests
if (app()->runningInConsole() && env('APP_ENV') !== 'testing') {
$this->redirectLoggingToFile('stdout');
}
}
/**
* Splice the logger and replace the active handlers with the handlers from the
* a stack in config/logging.php
*
* @param string $channel_name Channel name from config/logging.php
*/
public function redirectLoggingToFile($channel_name): void
{
$logger = app(\Illuminate\Log\Logger::class);
// Close the existing loggers
try {
$handlers = $logger->getHandlers();
foreach ($handlers as $handler) {
$handler->close();
}
} catch (\Exception $e) {
$this->error('Error closing handlers: '.$e->getMessage());
}
// Open the handlers for the channel name,
// and then set them to the main logger
try {
$logger->setHandlers(
Log::channel($channel_name)->getHandlers()
);
} catch (\Exception $e) {
$this->error('Couldn\'t splice the logger: '.$e->getMessage());
}
}
/**
* Streaming file reader
*
* @param $filename
*
* @return \Generator
*/
public function readFile($filename): ?\Generator
{
$fp = fopen($filename, 'rb');
while (($line = fgets($fp)) !== false) {
$line = rtrim($line, "\r\n");
if ($line[0] === ';') {
continue;
}
yield $line;
}
fclose($fp);
}
/**
* @param $cmd
* @param bool $return
* @param mixed $verbose
*
* @throws \Symfony\Component\Process\Exception\RuntimeException
* @throws \Symfony\Component\Process\Exception\LogicException
*
* @return string
*/
public function runCommand($cmd, $return = false, $verbose = true): string
{
if (\is_array($cmd)) {
$cmd = implode(' ', $cmd);
}
if ($verbose) {
$this->info('Running "'.$cmd.'"');
}
$val = '';
$process = new Process($cmd);
$process->run(function ($type, $buffer) use ($return, &$val) {
if ($return) {
$val .= $buffer;
} else {
echo $buffer;
}
});
return $val;
}
}

99
app/Contracts/Controller.php Executable file
View File

@@ -0,0 +1,99 @@
<?php
namespace App\Contracts;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Http\Request;
/**
* Class Controller
*/
abstract class Controller extends \Illuminate\Routing\Controller
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
/**
* Write a error to the flash and redirect the user to a route
*
* @param $message
* @param $route
*
* @return mixed
*/
public function flashError($message, $route)
{
flash()->error($message);
return redirect(route($route))->withInput();
}
/**
* Shortcut function to get the attributes from a request while running the validations
*
* @param Request $request
* @param array $attrs_or_validations
* @param array $addtl_fields
*
* @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
*
* @return array
*/
public function getFromReq($request, $attrs_or_validations, $addtl_fields = null)
{
// See if a list of values is passed in, or if a validation list is passed in
$is_validation = false;
if (\count(array_filter(array_keys($attrs_or_validations), '\is_string')) > 0) {
$is_validation = true;
}
if ($is_validation) {
$this->validate($request, $attrs_or_validations);
}
$fields = [];
foreach ($attrs_or_validations as $idx => $field) {
if ($is_validation) {
$field = $idx;
}
if ($request instanceof Request) {
if ($request->filled($field)) {
$fields[$field] = $request->input($field);
}
} else {
/* @noinspection NestedPositiveIfStatementsInspection */
if (array_key_exists($field, $request)) {
$fields[$field] = $request[$field];
}
}
}
if (!empty($addtl_fields) && \is_array($addtl_fields)) {
$fields = array_merge($fields, $addtl_fields);
}
return $fields;
}
/**
* Simple normalized method for forming the JSON responses
*
* @param $message
* @param null|mixed $count
*
* @return \Illuminate\Http\JsonResponse
*/
public function message($message, $count = null)
{
$attrs = [
'message' => $message,
];
if ($count !== null) {
$attrs['count'] = $count;
}
return response()->json($attrs);
}
}

167
app/Contracts/Enum.php Normal file
View File

@@ -0,0 +1,167 @@
<?php
namespace App\Contracts;
/**
* Borrowed some ideas from myclabs/php-enum after this was created
*/
abstract class Enum
{
protected static $cache = [];
protected static $codes = [];
protected static $labels = [];
/**
* @var int
*/
protected $value;
/**
* Create an instance of this Enum
*
* @param $val
*/
public function __construct($val)
{
$this->value = $val;
}
/**
* Return the value that's been set if this is an instance
*
* @return mixed
*/
final public function getValue()
{
return $this->value;
}
/**
* Return the label, try to return the translated version as well
*
* @param $value
*
* @return mixed
*/
final public static function label($value)
{
if (isset(static::$labels[$value])) {
return trans(static::$labels[$value]);
}
}
/**
* Return all of the (translated) labels
*/
final public static function labels(): array
{
$labels = [];
foreach (static::$labels as $key => $label) {
$labels[$key] = trans($label);
}
return $labels;
}
/**
* Get the numeric value from a string code
*
* @param $code
*
* @return mixed|null
*/
public static function getFromCode($code)
{
return array_search($code, static::$codes, true);
}
/**
* Convert the integer value into one of the codes
*
* @param $value
*
* @return false|int|string
*/
public static function convertToCode($value)
{
$value = (int) $value;
if (!array_key_exists($value, static::$codes)) {
return;
}
return static::$codes[$value];
}
/**
* Select box entry items
*
* @param bool $add_blank
*
* @return array
*/
public static function select($add_blank = false): array
{
$labels = [];
if ($add_blank) {
$labels[] = '';
}
foreach (static::$labels as $key => $label) {
$labels[$key] = trans($label);
}
return $labels;
}
/**
* Returns all possible values as an array
*
* @throws \ReflectionException
*
* @return array Constant name in key, constant value in value
*/
public static function toArray(): array
{
$class = static::class;
if (!array_key_exists($class, static::$cache)) {
$reflection = new \ReflectionClass($class);
static::$cache[$class] = $reflection->getConstants();
}
return static::$cache[$class];
}
/**
* @param Enum $enum
*
* @return bool
*/
final public function equals(self $enum): bool
{
return $this->getValue() === $enum->getValue() && static::class === \get_class($enum);
}
/**
* Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a
* class constant
*
* @param string $name
* @param array $arguments
*
* @throws \BadMethodCallException
* @throws \ReflectionException
*
* @return static
*/
public static function __callStatic($name, $arguments)
{
$array = static::toArray();
if (isset($array[$name])) {
return new static($array[$name]);
}
throw new \BadMethodCallException(
"No static method or enum constant '$name' in class ".static::class
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Contracts;
/**
* Class FormRequest
*/
class FormRequest extends \Illuminate\Foundation\Http\FormRequest
{
/**
* @return bool
*/
public function authorize()
{
return true;
}
/**
* @return array
*/
public function rules()
{
return [];
}
}

View File

@@ -0,0 +1,246 @@
<?php
namespace App\Contracts;
use App\Models\Airline;
use Illuminate\Validation\ValidationException;
use Log;
use Validator;
/**
* Common functionality used across all of the importers
*/
class ImportExport
{
public $assetType;
public $status = [
'success' => [],
'errors' => [],
];
/**
* Hold the columns for the particular table
*/
public static $columns = [];
/**
* @param mixed $row
*
* @return array
*/
public function export($row): array
{
throw new \RuntimeException('export not implemented');
}
/**
* @param array $row
* @param mixed $index
*
* @throws \RuntimeException
*
* @return bool
*/
public function import(array $row, $index): bool
{
throw new \RuntimeException('import not implemented');
}
/**
* Get the airline from the ICAO. Create it if it doesn't exist
*
* @param $code
*
* @return \Illuminate\Database\Eloquent\Model
*/
public function getAirline($code)
{
$airline = Airline::firstOrCreate([
'icao' => $code,
], ['name' => $code]);
return $airline;
}
/**
* @return array
*/
public function getColumns()
{
return static::$columns;
}
/**
* Do a basic check that the number of columns match
*
* @param $row
*
* @return bool
*/
public function checkColumns($row): bool
{
return \count($row) === \count($this->getColumns());
}
/**
* Bubble up an error to the interface that we need to stop
*
* @param $error
* @param $e
*
* @throws ValidationException
*/
protected function throwError($error, \Exception $e = null): void
{
Log::error($error);
if ($e) {
Log::error($e->getMessage());
}
$validator = Validator::make([], []);
$validator->errors()->add('csv_file', $error);
throw new ValidationException($validator);
}
/**
* Add to the log messages for this importer
*
* @param $msg
*/
public function log($msg): void
{
$this->status['success'][] = $msg;
Log::info($msg);
}
/**
* Add to the error log for this import
*
* @param $msg
*/
public function errorLog($msg): void
{
$this->status['errors'][] = $msg;
Log::error($msg);
}
/**
* Set a key-value pair to an array
*
* @param $kvp_str
* @param array $arr
*/
protected function kvpToArray($kvp_str, array &$arr)
{
$item = explode('=', $kvp_str);
if (\count($item) === 1) { // just a list?
$arr[] = trim($item[0]);
} else { // actually a key-value pair
$k = trim($item[0]);
$v = trim($item[1]);
$arr[$k] = $v;
}
}
/**
* Parse a multi column values field. E.g:
* Y?price=200&cost=100; F?price=1200
* or
* gate=B32;cost index=100
*
* Converted into a multi-dimensional array
*
* @param $field
*
* @return array|string
*/
public function parseMultiColumnValues($field)
{
$ret = [];
$split_values = explode(';', $field);
// No multiple values in here, just a straight value
if (\count($split_values) === 1) {
if (trim($split_values[0]) === '') {
return [];
}
return [$split_values[0]];
}
foreach ($split_values as $value) {
// This isn't in the query string format, so it's
// just a straight key-value pair set
if (strpos($value, '?') === false) {
$this->kvpToArray($value, $ret);
continue;
}
// This contains the query string, which turns it
// into the multi-level array
$query_str = explode('?', $value);
$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;
}
/**
* @param $obj
*
* @return mixed
*/
public function objectToMultiString($obj)
{
if (!\is_array($obj)) {
return $obj;
}
$ret_list = [];
foreach ($obj as $key => $val) {
if (is_numeric($key) && !\is_array($val)) {
$ret_list[] = $val;
continue;
}
$key = trim($key);
if (!\is_array($val)) {
$val = trim($val);
$ret_list[] = "{$key}={$val}";
} else {
$q = [];
foreach ($val as $subkey => $subval) {
if (is_numeric($subkey)) {
$q[] = $subval;
} else {
$q[] = "{$subkey}={$subval}";
}
}
$q = implode('&', $q);
if (!empty($q)) {
$ret_list[] = "{$key}?{$q}";
} else {
$ret_list[] = $key;
}
}
}
return implode(';', $ret_list);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Contracts;
/**
* Class Listener
*/
abstract class Listener
{
}

55
app/Contracts/Metar.php Normal file
View File

@@ -0,0 +1,55 @@
<?php
namespace App\Contracts;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
/**
* Base class for implementing retrieving METARs
*/
abstract class Metar
{
/**
* Implement retrieving the METAR - return the METAR string. Needs to be protected,
* since this shouldn't be directly called. Call `get_metar($icao)` instead
*
* @param $icao
*
* @return mixed
*/
abstract protected function metar($icao): string;
/**
* Download the METAR, wrap in caching
*
* @param $icao
*
* @return string
*/
public function get_metar($icao): string
{
$cache = config('cache.keys.WEATHER_LOOKUP');
$key = $cache['key'].$icao;
if (Cache::has($key)) {
$raw_metar = Cache::get($key);
if ($raw_metar !== '') {
return $raw_metar;
}
}
try {
$raw_metar = $this->metar($icao);
} catch (\Exception $e) {
Log::error('Error getting METAR: '.$e->getMessage(), $e->getTrace());
return '';
}
if ($raw_metar !== '') {
Cache::put($key, $raw_metar, $cache['time']);
}
return $raw_metar;
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Contracts;
use DB;
/**
* Class Migration
*/
abstract class Migration extends \Illuminate\Database\Migrations\Migration
{
/**
* At a minimum, this function needs to be implemented
*
* @return mixed
*/
abstract public function up();
/**
* A method to reverse a migration doesn't need to be made
*/
public function down()
{
}
/**
* Add rows to a table
*
* @param $table
* @param $rows
*/
public function addData($table, $rows)
{
foreach ($rows as $row) {
try {
DB::table($table)->insert($row);
} catch (\Exception $e) {
// setting already exists, just ignore it
if ($e->getCode() === 23000) {
continue;
}
}
}
}
}

23
app/Contracts/Model.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
namespace App\Contracts;
/**
* Class Model
*
* @property mixed $id
* @property bool $skip_mutator
*
* @method static where(array $array)
*/
abstract class Model extends \Illuminate\Database\Eloquent\Model
{
public const ID_MAX_LENGTH = 12;
/**
* For the factories, skip the mutators. Only apply to one instance
*
* @var bool
*/
public $skip_mutator = false;
}

View File

@@ -0,0 +1,137 @@
<?php
namespace App\Contracts;
use Illuminate\Validation\Validator;
use Prettus\Repository\Eloquent\BaseRepository;
abstract class Repository extends BaseRepository
{
/**
* @param $id
* @param array $columns
*
* @return mixed|null
*/
public function findWithoutFail($id, array $columns = ['*'])
{
try {
return $this->find($id, $columns);
} catch (\Exception $e) {
return;
}
}
/**
* @param $values
*
* @return bool
*/
public function validate($values)
{
$validator = Validator::make(
$values,
$this->model()->rules
);
if ($validator->fails()) {
return $validator->messages();
}
return true;
}
/**
* Return N most recent items, sorted by created_at
*
* @param int $count
* @param string $sort_by created_at (default) or updated_at
*
* @return mixed
*/
public function recent($count = null, $sort_by = 'created_at')
{
return $this->orderBy($sort_by, 'desc')->paginate($count);
}
/**
* Find records with a WHERE clause but also sort them
*
* @param $where
* @param $sort_by
* @param $order_by
*
* @return $this
*/
public function whereOrder($where, $sort_by, $order_by = 'asc')
{
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)) {
foreach ($sort_by as $key => $sort) {
$q = $q->orderBy($key, $sort);
}
} else {
$q = $q->orderBy($sort_by, $order_by);
}
return $q;
});
}
/**
* Find records where values don't match a list but sort the rest
*
* @param string $col
* @param array $values
* @param string $sort_by
* @param string $order_by
*
* @return $this
*/
public function whereNotInOrder($col, $values, $sort_by, $order_by = 'asc')
{
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)) {
foreach ($sort_by as $key => $sort) {
$q = $q->orderBy($key, $sort);
}
} else {
$q = $q->orderBy($sort_by, $order_by);
}
return $q;
});
}
/**
* Retrieve all data of repository, paginated. Added in extra parameter to read from the
* request which page it should be on
*
* @param null $limit
* @param array $columns
* @param string $method
*
* @throws \Prettus\Repository\Exceptions\RepositoryException
*
* @return mixed
*/
public function paginate($limit = null, $columns = ['*'], $method = 'paginate')
{
$this->applyCriteria();
$this->applyScope();
$max = config('repository.pagination.limit', 50);
$limit = (int) ($limit ?? request()->query('limit') ?? $max);
$page = (int) request()->query('page', 1);
$results = $this->model->{$method}($limit, $columns, 'page', $page);
$results->appends(app('request')->query());
$this->resetModel();
return $this->parserResult($results);
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Contracts;
/**
* Abstract class for finding a route from a departure airport to an arrival airport
* Can allow for multiple, configurable methods for finding a route, whether it reaches
* out to a REST API or implement some sort of internal logic to look through a file
* or whatever the logic might be.
*
* Just one public-facing method needs to be implemented
*/
abstract class RouteFinder
{
/**
* Find a route from the departure ICAO to the arrival ICAO
*
* @param $dptIcao
* @param $arrIcao
*
* @return string
*/
abstract public function findRoute($dptIcao, $arrIcao): string;
}

10
app/Contracts/Service.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
namespace App\Contracts;
/**
* Class Service
*/
abstract class Service
{
}

121
app/Contracts/Unit.php Normal file
View File

@@ -0,0 +1,121 @@
<?php
namespace App\Contracts;
use ArrayAccess;
/**
* Class Unit
*
* @property mixed $instance
* @property string $unit
* @property array $units
*/
class Unit implements ArrayAccess
{
/**
* The unit this is kept as
*/
public $unit;
/**
* All of the units of this class
*/
public $units;
/**
* Holds an instance of the PhpUnit type
*/
protected $instance;
/**
* Units that are included as part of the REST response
*/
public $responseUnits = [];
/**
* @return mixed
*/
public function value()
{
return $this->__toString();
}
/**
* Just call toUnit() on the PhpUnitOfMeasure instance
*
* @param string $unit
*
* @return mixed
*/
public function toUnit($unit)
{
return $this->instance->toUnit($unit);
}
/**
* Return all of the units that get sent back in a response
*/
public function getResponseUnits(): array
{
$response = [];
foreach ($this->responseUnits as $unit) {
$response[$unit] = $this[$unit];
}
return $response;
}
/**
* Implements ArrayAccess
*
* @param $offset
*
* @return bool
*/
public function offsetExists($offset)
{
return array_key_exists($offset, $this->units);
}
/**
* Implements ArrayAccess
*
* @param $offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return round($this->instance->toUnit($offset), 2);
}
/**
* Implements ArrayAccess
*
* @param $offset
* @param $value
*/
public function offsetSet($offset, $value)
{
// $this->units[$offset] = $value;
}
/**
* Implements ArrayAccess
*
* @param $offset
*/
public function offsetUnset($offset)
{
// $this->units[$offset] = null;
}
/**
* @return mixed
*/
public function __toString()
{
return (string) $this->units[$this->unit];
}
}

26
app/Contracts/Widget.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
namespace App\Contracts;
use Arrilot\Widgets\AbstractWidget;
/**
* Class Widget
*/
abstract class Widget extends AbstractWidget
{
public $cacheTime = 0;
/**
* Render the template
*
* @param string $template
* @param array $vars
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function view(string $template, array $vars = [])
{
return view($template, $vars);
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Cron\Hourly;
use App\Contracts\Listener;
use App\Events\CronHourly;
use App\Models\Bid;
use Carbon\Carbon;
/**
* Remove expired bids
*/
class RemoveExpiredBids extends Listener
{
/**
* Remove expired bids
*
* @param CronHourly $event
*
* @throws \Exception
*/
public function handle(CronHourly $event): void
{
if (setting('bids.expire_time') === 0) {
return;
}
$date = Carbon::now()->subHours(setting('bids.expire_time'));
Bid::whereDate('created_at', '<', $date)->delete();
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Cron\Hourly;
use App\Contracts\Listener;
use App\Events\CronHourly;
use App\Models\Pirep;
use Carbon\Carbon;
/**
* Remove expired live flights
*/
class RemoveExpiredLiveFlights extends Listener
{
/**
* Remove expired live flights
*
* @param CronHourly $event
*
* @throws \Exception
*/
public function handle(CronHourly $event): void
{
if (setting('acars.live_time') === 0) {
return;
}
$date = Carbon::now()->subHours(setting('acars.live_time'));
Pirep::whereDate('created_at', '<', $date)
->where('state', PirepState::IN_PROGRESS)
->delete();
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Cron\Monthly;
use App\Contracts\Listener;
use App\Events\CronMonthly;
use App\Models\Enums\ExpenseType;
use App\Services\Finance\RecurringFinanceService;
/**
* Go through and apply any finances that are daily
*/
class ApplyExpenses extends Listener
{
private $financeSvc;
/**
* ApplyExpenses constructor.
*
* @param RecurringFinanceService $financeSvc
*/
public function __construct(RecurringFinanceService $financeSvc)
{
$this->financeSvc = $financeSvc;
}
/**
* Apply all of the expenses for a month
*
* @param CronMonthly $event
*
* @throws \UnexpectedValueException
* @throws \InvalidArgumentException
* @throws \Prettus\Validator\Exceptions\ValidatorException
*/
public function handle(CronMonthly $event): void
{
$this->financeSvc->processExpenses(ExpenseType::MONTHLY);
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Models\Enums\ExpenseType;
use App\Services\Finance\RecurringFinanceService;
/**
* Go through and apply any finances that are daily
*/
class ApplyExpenses extends Listener
{
private $financeSvc;
/**
* ApplyExpenses constructor.
*
* @param RecurringFinanceService $financeSvc
*/
public function __construct(RecurringFinanceService $financeSvc)
{
$this->financeSvc = $financeSvc;
}
/**
* Apply all of the expenses for a day
*
* @param CronNightly $event
*
* @throws \UnexpectedValueException
* @throws \InvalidArgumentException
* @throws \Prettus\Validator\Exceptions\ValidatorException
*/
public function handle(CronNightly $event): void
{
$this->financeSvc->processExpenses(ExpenseType::DAILY);
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Services\VersionService;
/**
* Determine if any pilots should be set to ON LEAVE status
*/
class NewVersionCheck extends Listener
{
private $versionSvc;
/**
* @param VersionService $versionSvc
*/
public function __construct(VersionService $versionSvc)
{
$this->versionSvc = $versionSvc;
}
/**
* Set any users to being on leave after X days
*
* @param CronNightly $event
*/
public function handle(CronNightly $event): void
{
$this->versionSvc->isNewVersionAvailable();
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Models\Enums\UserState;
use App\Models\User;
use App\Services\UserService;
use Carbon\Carbon;
/**
* Determine if any pilots should be set to ON LEAVE status
*/
class PilotLeave extends Listener
{
private $userSvc;
/**
* PilotLeave constructor.
*/
public function __construct(UserService $userSvc)
{
$this->userSvc = $userSvc;
}
/**
* Set any users to being on leave after X days
*
* @param CronNightly $event
*
* @throws \UnexpectedValueException
* @throws \InvalidArgumentException
*/
public function handle(CronNightly $event): void
{
if (setting('pilots.auto_leave_days') === 0) {
return;
}
$date = Carbon::now()->subDay(setting('pilots.auto_leave_days'));
$users = User::where('status', UserState::ACTIVE)
->whereDate('updated_at', '<', $date);
foreach ($users as $user) {
Log::info('Setting user '.$user->ident.' to ON LEAVE status');
$this->userSvc->setStatusOnLeave($user);
}
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Models\Journal;
use App\Repositories\JournalRepository;
use Log;
/**
* This recalculates the balances on all of the journals
*/
class RecalculateBalances extends Listener
{
private $journalRepo;
/**
* Nightly constructor.
*
* @param JournalRepository $journalRepo
*/
public function __construct(JournalRepository $journalRepo)
{
$this->journalRepo = $journalRepo;
}
/**
* Recalculate all the balances for the different ledgers
*
* @param CronNightly $event
*
* @throws \UnexpectedValueException
* @throws \InvalidArgumentException
*/
public function handle(CronNightly $event): void
{
Log::info('Recalculating balances');
$journals = Journal::all();
foreach ($journals as $journal) {
$old_balance = $journal->balance;
$this->journalRepo->recalculateBalance($journal);
$journal->refresh();
Log::info('Adjusting balance on '.
$journal->morphed_type.':'.$journal->morphed_id
.' from '.$old_balance.' to '.$journal->balance);
}
Log::info('Done calculating balances');
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Services\UserService;
use Illuminate\Support\Facades\Log;
/**
* This recalculates the balances on all of the journals
*/
class RecalculateStats extends Listener
{
private $userSvc;
public function __construct(UserService $userService)
{
$this->userSvc = $userService;
}
/**
* Recalculate the stats for active users
*
* @param CronNightly $event
*
* @throws \UnexpectedValueException
* @throws \InvalidArgumentException
*/
public function handle(CronNightly $event): void
{
Log::info('Recalculating balances');
$this->userSvc->recalculateAllUserStats();
Log::info('Done recalculating stats');
}
}

View File

@@ -0,0 +1,97 @@
<?php
namespace App\Cron\Nightly;
use App\Contracts\Listener;
use App\Events\CronNightly;
use App\Models\Enums\Days;
use App\Models\Flight;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
/**
* Figure out what flights need to be active for today
*/
class SetActiveFlights extends Listener
{
/**
* @param CronNightly $event
*/
public function handle(CronNightly $event): void
{
$this->checkFlights();
}
/**
* Look through every single flight, check the start/end dates,
* as well of the days of week if this flight is active on this day
*
* TODO: Option to check the flight active/inactive against departure TZ
* TODO: Move to FlightService
*/
public function checkFlights(): void
{
$today = Carbon::now('UTC');
$flights = Flight::all();
/**
* @var Flight $flight
*/
foreach ($flights as $flight) {
if (!$flight->active) {
continue;
}
// dates aren't set, so just save if there were any changes above
// and move onto the next one
if ($flight->start_date === null || $flight->end_date === null) {
if ($flight->days !== null && $flight->days > 0) {
$visible = Days::isToday($flight->days);
if ($flight->visible !== $visible) {
Log::info('Flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden'));
$flight->visible = $visible;
if ($visible === false) {
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
}
}
} else {
Log::info('Toggling flight '.$flight->ident.' to visible');
$flight->visible = true;
}
$flight->save();
continue;
}
// Check the day of week now first
// Start/end date is set, so make sure today is valid for it to be alive
// and then make sure if days of the week are specified, check that too
if ($today->gte($flight->start_date) && $today->lte($flight->end_date)) {
if ($flight->days !== null && $flight->days > 0) {
$visible = Days::isToday($flight->days);
if ($flight->visible !== $visible) {
Log::info('Toggling flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden').'');
$flight->visible = $visible;
if ($visible === false) {
Log::info('Today='.date('N').', start='.$flight->start_date
.', end='.$flight->end_date.', mask='.$flight->days.', in='
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
}
}
} else {
Log::info('Toggling flight '.$flight->ident.' to visible');
$flight->visible = true;
}
} else {
$flight->visible = false;
Log::info('Toggling flight '.$flight->ident.' to hidden, outside of start/end boundary');
}
$flight->save();
}
}
}

View File

@@ -4,18 +4,20 @@ use Faker\Generator as Faker;
$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,
'heading' => $faker->numberBetween(0, 359),
'altitude' => $faker->numberBetween(20, 400),
'vs' => $faker->numberBetween(-5000, 5000),
'gs' => $faker->numberBetween(300, 500),
'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_flow' => $faker->randomFloat(2, 100, 1000),
'sim_time' => $faker->dateTime('now', 'UTC'),
'autopilot' => $faker->text(10),
'fuel' => $faker->randomFloat(2, 100, 1000),
'fuel_flow' => $faker->randomFloat(2, 100, 1000),
'sim_time' => $faker->dateTime('now', 'UTC'),
];
});

View File

@@ -4,20 +4,23 @@ use Faker\Generator as Faker;
$factory->define(App\Models\Aircraft::class, function (Faker $faker) {
return [
'id' => null,
'subfleet_id' => function() {
'id' => null,
'subfleet_id' => function () {
return factory(App\Models\Subfleet::class)->create()->id;
},
'airport_id' => function () {
return factory(App\Models\Airport::class)->create()->id;
},
'icao' => $faker->unique()->text(5),
'name' => $faker->unique()->text(50),
'iata' => $faker->unique()->text(5),
'icao' => $faker->unique()->text(5),
'name' => $faker->text(50),
'registration' => $faker->unique()->text(10),
'hex_code' => \App\Support\ICAO::createHexCode(),
'active' => true,
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
'updated_at' => function (array $pirep) {
'hex_code' => \App\Support\ICAO::createHexCode(),
'zfw' => $faker->randomFloat(2, 0, 50000),
'status' => \App\Models\Enums\AircraftStatus::ACTIVE,
'state' => \App\Models\Enums\AircraftState::PARKED,
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
'updated_at' => function (array $pirep) {
return $pirep['created_at'];
},
];

View File

@@ -3,20 +3,23 @@
use Faker\Generator as Faker;
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,
'id' => null,
'icao' => function (array $apt) use ($faker) {
$hashids = new Hashids(microtime(), 5);
$mt = str_replace('.', '', microtime(true));
return $hashids->encode($mt);
},
'iata' => function (array $apt) { return $apt['icao']; },
'name' => $faker->sentence(3),
'iata' => function (array $apt) {
return $apt['icao'];
},
'name' => $faker->sentence(3),
'country' => $faker->country,
'active' => 1
'active' => 1,
];
});

View File

@@ -2,31 +2,54 @@
use Faker\Generator as Faker;
/**
/*
* Create an ICAO for use in the factory.
*/
if (!function_exists('createFactoryICAO')) {
function createFactoryICAO(): string
{
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$max = strlen($characters) - 1;
$string = '';
for ($i = 0; $i < 4; $i++) {
try {
$string .= $characters[random_int(0, $max)];
} catch (Exception $e) {
}
}
return $string;
}
}
/*
* Add any number of airports. Don't really care if they're real or not
*/
$factory->define(App\Models\Airport::class, function (Faker $faker) {
$used = [];
return [
'id' => function() {
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$string = '';
$max = strlen($characters) - 1;
for ($i = 0; $i < 5; $i++) {
$string .= $characters[random_int(0, $max)];
}
'id' => function () use ($used) {
do {
$string = createFactoryICAO();
} while (in_array($string, $used, true));
return $string;
},
'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,
'fuel_100ll_cost' => $faker->randomFloat(2),
'fuel_jeta_cost' => $faker->randomFloat(2),
'fuel_mogas_cost' => $faker->randomFloat(2),
'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,13 @@
<?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

@@ -0,0 +1,18 @@
<?php
use App\Models\Enums\ExpenseType;
use Faker\Generator as Faker;
$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,
];
});

View File

@@ -4,10 +4,13 @@ use Faker\Generator as Faker;
$factory->define(App\Models\Fare::class, function (Faker $faker) {
return [
'id' => null,
'code' => $faker->text(5),
'name' => $faker->text(20),
'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),
];
});

View File

@@ -1,21 +1,19 @@
<?php
/**
* Create flights
*/
use Faker\Generator as Faker;
# Match the list available in tests/data/*.yml
$airlinesAvailable = [1];
$factory->define(App\Models\Flight::class, function (Faker $faker) use ($airlinesAvailable) {
$factory->define(App\Models\Flight::class, function (Faker $faker) {
return [
'id' => null,
'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->text(5)]),
'dpt_airport_id' => function() {
'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 () {
@@ -24,15 +22,20 @@ $factory->define(App\Models\Flight::class, function (Faker $faker) use ($airline
'alt_airport_id' => function () {
return factory(App\Models\Airport::class)->create()->id;
},
'distance' => $faker->numberBetween(0, 3000),
'route' => null,
'dpt_time' => $faker->time(),
'arr_time' => $faker->time(),
'distance' => $faker->numberBetween(1, 1000),
'route' => null,
'level' => 0,
'dpt_time' => $faker->time(),
'arr_time' => $faker->time(),
'flight_time' => $faker->numberBetween(60, 360),
'has_bid' => false,
'active' => true,
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
'updated_at' => function (array $flight) {
'has_bid' => false,
'active' => true,
'visible' => true,
'days' => 0,
'start_date' => null,
'end_date' => null,
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
'updated_at' => static function (array $flight) {
return $flight['created_at'];
},
];

View File

@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\Models\Journal::class, function (Faker $faker) {
return [
'currency' => 'USD',
];
});

View File

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

View File

@@ -1,15 +1,15 @@
<?php
use App\Models\Enums\NavaidType;
use Faker\Generator as Faker;
use \App\Models\Enums\NavaidType;
$factory->define(App\Models\Navdata::class, function (Faker $faker) {
return [
'id' => str_replace(' ', '', str_replace('.', '', $faker->unique()->text(5))),
'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,
'lat' => $faker->latitude,
'lon' => $faker->longitude,
'freq' => $faker->randomFloat(2, 100, 1000),
];
});

View File

@@ -0,0 +1,14 @@
<?php
use Faker\Generator as Faker;
$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,
];
});

View File

@@ -1,17 +1,24 @@
<?php
use App\Models\Enums\PirepSource;
use App\Models\Enums\PirepState;
use App\Models\Enums\PirepStatus;
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,
]);
return [
'id' => null,
'airline_id' => function () {
return factory(App\Models\Airline::class)->create()->id;
'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;
@@ -19,35 +26,43 @@ $factory->define(App\Models\Pirep::class, function (Faker $faker) {
'aircraft_id' => function () {
return factory(App\Models\Aircraft::class)->create()->id;
},
'flight_number' => function (array $pirep) {
return factory(App\Models\Flight::class)->create([
'airline_id' => $pirep['airline_id']
])->flight_number;
'flight_id' => function () use ($flight) {
return $flight->id;
},
'route_code' => null,
'route_leg' => null,
'dpt_airport_id' => function () {
return factory(App\Models\Airport::class)->create()->id;
'flight_number' => function () use ($flight) {
return $flight->flight_number;
},
'arr_airport_id' => function () {
return factory(App\Models\Airport::class)->create()->id;
'route_code' => null,
'route_leg' => null,
'dpt_airport_id' => function () use ($flight) {
return $flight->dpt_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),
'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, 30000),
'fuel_used' => $faker->randomFloat(2, 0, 30000),
'route' => $faker->text(200),
'notes' => $faker->text(200),
'source' => $faker->randomElement([PirepSource::MANUAL, PirepSource::ACARS]),
'source_name' => 'Test Factory',
'state' => PirepState::PENDING,
'status' => PirepStatus::SCHEDULED,
'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => function(array $pirep) {
'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'];
},
];

View File

@@ -11,11 +11,13 @@ use Faker\Generator as Faker;
*/
$factory->define(App\Models\Rank::class, function (Faker $faker) {
return [
'id' => null,
'name' => $faker->unique()->text(50),
'hours' => $faker->numberBetween(10, 50),
'auto_approve_acars' => 0,
'auto_approve_manual' => 0,
'auto_promote' => 0,
'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,
];
});

View File

@@ -4,11 +4,12 @@ use Faker\Generator as Faker;
$factory->define(App\Models\Subfleet::class, function (Faker $faker) {
return [
'id' => null,
'id' => null,
'airline_id' => function () {
return factory(App\Models\Airline::class)->create()->id;
},
'name' => $faker->unique()->text(50),
'type' => $faker->unique()->text(7),
'name' => $faker->unique()->text(50),
'type' => $faker->unique()->text(7),
'ground_handling_multiplier' => $faker->numberBetween(50, 200),
];
});

View File

@@ -1,26 +1,26 @@
<?php
use Faker\Generator as Faker;
use App\Models\Enums\UserState;
use Faker\Generator as Faker;
$factory->define(App\Models\User::class, function (Faker $faker)
{
$factory->define(App\Models\User::class, function (Faker $faker) {
static $password;
return [
'id' => null,
'name' => $faker->name,
'email' => $faker->safeEmail,
'password' => $password ?: $password = Hash::make('secret'),
'api_key' => $faker->sha1,
'id' => null,
'pilot_id' => 0,
'name' => $faker->name,
'email' => $faker->safeEmail,
'password' => $password ?: $password = Hash::make('secret'),
'api_key' => $faker->sha1,
'airline_id' => function () {
return factory(App\Models\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,
'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),
];
});

View File

@@ -1,10 +1,18 @@
<?php
use App\Models\Migrations\Migration;
use App\Contracts\Migration;
use App\Services\Installer\SeederService;
use Illuminate\Database\Schema\Blueprint;
class CreateSettingsTable extends Migration
{
private $seederSvc;
public function __construct()
{
$this->seederSvc = app(SeederService::class);
}
/**
* Run the migrations.
*
@@ -22,7 +30,7 @@ class CreateSettingsTable extends Migration
$table->string('default')->nullable();
$table->string('group')->nullable();
$table->string('type')->nullable();
$table->string('options')->nullable();
$table->text('options')->nullable();
$table->string('description')->nullable();
$table->primary('id');
@@ -30,181 +38,7 @@ class CreateSettingsTable extends Migration
$table->timestamps();
});
/**
* Initial default settings
*/
$this->addSetting('general.start_date', [
'name' => 'Start Date',
'group' => 'general',
'value' => '',
'type' => 'date',
'description' => 'The date your VA started',
]);
$this->addSetting('general.admin_email', [
'name' => 'Admin Email',
'group' => 'general',
'value' => '',
'type' => 'text',
'description' => 'Email where notices, etc are sent',
]);
$this->addSetting('general.currency', [
'name' => 'Currency to Use',
'group' => 'general',
'value' => 'dollar',
'type' => 'select',
'options' => 'dollar,euro,gbp,yen,jpy,rupee,ruble',
'description' => 'Currency to show in the interface',
]);
$this->addSetting('general.distance_unit', [
'name' => 'Distance Units',
'group' => 'general',
'value' => 'NM',
'type' => 'select',
'options' => 'km,mi,NM',
'description' => 'The distance unit to show',
]);
$this->addSetting('general.weight_unit', [
'name' => 'Weight Units',
'group' => 'general',
'value' => 'lbs',
'type' => 'select',
'options' => 'lbs,kg',
'description' => 'The weight unit',
]);
$this->addSetting('general.speed_unit', [
'name' => 'Speed Units',
'group' => 'general',
'value' => 'knot',
'type' => 'select',
'options' => 'km/h,knot',
'description' => 'The speed unit',
]);
$this->addSetting('general.altitude_unit', [
'name' => 'Altitude Units',
'group' => 'general',
'value' => 'ft',
'type' => 'select',
'options' => 'ft,m',
'description' => 'The altitude units',
]);
$this->addSetting('general.fuel_unit', [
'name' => 'Fuel Units',
'group' => 'general',
'value' => 'lbs',
'type' => 'select',
'options' => 'lbs,kg',
'description' => 'The units for fuel',
]);
/**
* BIDS
*/
$this->addSetting('bids.disable_flight_on_bid', [
'name' => 'Disable flight on bid',
'group' => 'bids',
'value' => true,
'type' => 'boolean',
'description' => 'When a flight is bid on, no one else can bid on it',
]);
$this->addSetting('bids.allow_multiple_bids', [
'name' => 'Allow multiple bids',
'group' => 'bids',
'value' => true,
'type' => 'boolean',
'description' => 'Whether or not someone can bid on multiple flights',
]);
/**
* PIREPS
*/
$this->addSetting('pireps.duplicate_check_time', [
'name' => 'PIREP duplicate time check',
'group' => 'pireps',
'value' => 10,
'type' => 'int',
'description' => 'The time in minutes to check for a duplicate PIREP',
]);
/*$this->addSetting('pireps.hide_cancelled_pireps', [
'name' => 'Hide Cancelled PIREPs',
'group' => 'pireps',
'value' => true,
'type' => 'boolean',
'description' => 'Hide any cancelled PIREPs in the front-end',
]);*/
$this->addSetting('pireps.restrict_aircraft_to_rank', [
'name' => 'Restrict Aircraft to Ranks',
'group' => 'pireps',
'value' => true,
'type' => 'boolean',
'description' => 'Aircraft that can be flown are restricted to a user\'s rank',
]);
$this->addSetting('pireps.only_aircraft_at_dep_airport', [
'name' => 'Restrict Aircraft At Departure',
'group' => 'pireps',
'value' => false,
'type' => 'boolean',
'description' => 'Only allow aircraft that are at the departure airport',
]);
/**
* PILOTS
*/
$this->addSetting('pilots.id_length', [
'name' => 'Pilot ID Length',
'group' => 'pilots',
'value' => 4,
'default' => 4,
'type' => 'int',
'description' => 'The length of a pilot\'s ID',
]);
$this->addSetting('pilot.auto_accept', [
'name' => 'Auto Accept New Pilot',
'group' => 'pilots',
'value' => true,
'type' => 'boolean',
'description' => 'Automatically accept a pilot when they register',
]);
$this->addSetting('pilots.only_flights_from_current', [
'name' => 'Flights from Current',
'group' => 'pilots',
'value' => false,
'type' => 'boolean',
'description' => 'Only show/allow flights from their current location',
]);
$this->addSetting('pilot.auto_leave_days', [
'name' => 'Pilot to ON LEAVE days',
'group' => 'pilots',
'value' => 30,
'default' => 30,
'type' => 'int',
'description' => 'Automatically set a pilot to ON LEAVE status after N days of no activity',
]);
$this->addSetting('pilots.hide_inactive', [
'name' => 'Hide Inactive Pilots',
'group' => 'pilots',
'value' => true,
'type' => 'boolean',
'description' => 'Don\'t show inactive pilots in the public view',
]);
$this->seederSvc->syncAllSettings();
}
/**

View File

@@ -1,6 +1,6 @@
<?php
use App\Models\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -28,10 +28,12 @@ class CreateUsersTable extends Migration
$table->unsignedBigInteger('flights')->default(0);
$table->unsignedBigInteger('flight_time')->nullable()->default(0);
$table->unsignedBigInteger('transfer_time')->nullable()->default(0);
$table->decimal('balance')->nullable();
$table->string('avatar')->nullable();
$table->string('timezone', 64)->nullable();
$table->unsignedTinyInteger('status')->nullable()->default(0);
$table->unsignedTinyInteger('state')->nullable()->default(0);
$table->boolean('toc_accepted')->nullable();
$table->boolean('opt_in')->nullable();
$table->boolean('active')->nullable();
$table->ipAddress('last_ip')->nullable();
$table->rememberToken();

View File

@@ -1,6 +1,6 @@
<?php
use App\Models\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
class RolesPermissionsTables extends Migration
@@ -8,7 +8,7 @@ class RolesPermissionsTables extends Migration
/**
* Run the migrations.
*
* @return void
* @return void
*/
public function up()
{
@@ -67,28 +67,22 @@ class RolesPermissionsTables extends Migration
$table->primary(['permission_id', 'role_id']);
});
# create a default user/role
// create a default user/role
$roles = [
[
'id' => 1,
'name' => 'admin',
'id' => 1,
'name' => 'admin',
'display_name' => 'Administrators',
],
[
'id' => 2,
'name' => 'user',
'display_name' => 'Pilot'
],
];
$this->addData('roles', $roles);
}
/**
* Reverse the migrations.
*
* @return void
* @return void
*/
public function down()
{

View File

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

View File

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

View File

@@ -1,11 +1,10 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAirlinesTable extends Migration
{
/**
* Run the migrations.
*

View File

@@ -1,7 +1,8 @@
<?php
use App\Contracts\Migration;
use App\Models\Enums\AircraftState;
use Illuminate\Database\Migrations\Migration;
use App\Models\Enums\AircraftStatus;
use Illuminate\Database\Schema\Blueprint;
class CreateAircraftsTable extends Migration
@@ -12,6 +13,7 @@ class CreateAircraftsTable extends Migration
$table->increments('id');
$table->unsignedInteger('subfleet_id');
$table->string('icao', 4)->nullable();
$table->string('iata', 4)->nullable();
$table->string('airport_id', 5)->nullable();
$table->timestamp('landing_time')->nullable();
$table->string('name', 50);
@@ -19,14 +21,13 @@ class CreateAircraftsTable extends Migration
$table->string('hex_code', 10)->nullable();
$table->unsignedDecimal('zfw')->nullable()->default(0);
$table->unsignedBigInteger('flight_time')->nullable()->default(0);
$table->boolean('active')->default(true);
$table->char('status', 1)->default(AircraftStatus::ACTIVE);
$table->unsignedTinyInteger('state')->default(AircraftState::PARKED);
$table->timestamps();
$table->unique('registration');
$table->index('airport_id');
});
}
public function down()

View File

@@ -1,11 +1,10 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateFaresTable extends Migration
{
/**
* Run the migrations.
*
@@ -15,7 +14,7 @@ class CreateFaresTable extends Migration
{
Schema::create('fares', function (Blueprint $table) {
$table->increments('id');
$table->string('code', 50);
$table->string('code', 50)->unique();
$table->string('name', 50);
$table->unsignedDecimal('price')->nullable()->default(0.00);
$table->unsignedDecimal('cost')->nullable()->default(0.00);

View File

@@ -1,6 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAirportsTable extends Migration
@@ -8,19 +8,24 @@ class CreateAirportsTable extends Migration
public function up()
{
Schema::create('airports', function (Blueprint $table) {
$table->string('id', 5)->primary();
$table->string('iata', 5)->nullable();
$table->string('icao', 5);
$table->string('id', 4)->primary();
$table->string('iata', 4)->nullable();
$table->string('icao', 4);
$table->string('name', 100);
$table->string('location', 100)->nullable();
$table->string('country', 64)->nullable();
$table->string('timezone', 64)->nullable();
$table->boolean('hub')->default(false);
$table->float('lat', 7, 4)->nullable()->default(0.0);
$table->float('lon', 7, 4)->nullable()->default(0.0);
$table->unsignedDecimal('ground_handling_cost')->nullable()->default(0);
$table->unsignedDecimal('fuel_100ll_cost')->nullable()->default(0);
$table->unsignedDecimal('fuel_jeta_cost')->nullable()->default(0);
$table->unsignedDecimal('fuel_mogas_cost')->nullable()->default(0);
$table->float('lat', 7, 4)->nullable()->default(0.0);
$table->float('lon', 7, 4)->nullable()->default(0.0);
$table->index('icao');
$table->index('iata');
$table->index('hub');
});
}

View File

@@ -1,12 +1,12 @@
<?php
use App\Contracts\Migration;
use App\Contracts\Model;
use App\Models\Enums\FlightType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateFlightTables extends Migration
{
/**
* Run the migrations.
*
@@ -15,24 +15,29 @@ class CreateFlightTables extends Migration
public function up()
{
Schema::create('flights', function (Blueprint $table) {
$table->string('id', \App\Models\Flight::ID_MAX_LENGTH);
$table->string('id', Model::ID_MAX_LENGTH);
$table->unsignedInteger('airline_id');
$table->string('flight_number', 10);
$table->unsignedInteger('flight_number');
$table->string('route_code', 5)->nullable();
$table->string('route_leg', 5)->nullable();
$table->string('dpt_airport_id', 5);
$table->string('arr_airport_id', 5);
$table->string('alt_airport_id', 5)->nullable();
$table->unsignedInteger('route_leg')->nullable();
$table->string('dpt_airport_id', 4);
$table->string('arr_airport_id', 4);
$table->string('alt_airport_id', 4)->nullable();
$table->string('dpt_time', 10)->nullable();
$table->string('arr_time', 10)->nullable();
$table->unsignedInteger('level')->nullable()->default(0);
$table->unsignedDecimal('distance')->nullable()->default(0.0);
$table->unsignedInteger('flight_time')->nullable();
$table->tinyInteger('flight_type')->default(FlightType::PASSENGER);
$table->char('flight_type', 1)->default(FlightType::SCHED_PAX);
$table->text('route')->nullable();
$table->text('notes')->nullable();
$table->boolean('scheduled')->default(false)->nullable();
$table->unsignedTinyInteger('days')->nullable();
$table->date('start_date')->nullable();
$table->date('end_date')->nullable();
$table->boolean('has_bid')->default(false);
$table->boolean('active')->default(true);
$table->boolean('visible')->default(true); // used by the cron
$table->timestamps();
$table->primary('id');
@@ -43,7 +48,7 @@ class CreateFlightTables extends Migration
});
Schema::create('flight_fare', function (Blueprint $table) {
$table->string('flight_id', \App\Models\Flight::ID_MAX_LENGTH);
$table->string('flight_id', Model::ID_MAX_LENGTH);
$table->unsignedInteger('fare_id');
$table->string('price', 10)->nullable();
$table->string('cost', 10)->nullable();
@@ -53,15 +58,37 @@ class CreateFlightTables extends Migration
$table->primary(['flight_id', 'fare_id']);
});
/*
* Hold a master list of fields
*/
Schema::create('flight_fields', function (Blueprint $table) {
$table->increments('id');
$table->string('flight_id', \App\Models\Flight::ID_MAX_LENGTH);
$table->string('name', 50);
$table->string('slug', 50)->nullable();
});
/*
* The values for the actual fields
*/
Schema::create('flight_field_values', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('flight_id', Model::ID_MAX_LENGTH);
$table->string('name', 50);
$table->string('slug', 50)->nullable();
$table->text('value');
$table->timestamps();
$table->index('flight_id');
});
Schema::create('flight_subfleet', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedInteger('subfleet_id');
$table->string('flight_id', Model::ID_MAX_LENGTH);
$table->index(['subfleet_id', 'flight_id']);
$table->index(['flight_id', 'subfleet_id']);
});
}
/**
@@ -73,6 +100,7 @@ class CreateFlightTables extends Migration
{
Schema::drop('flight_fields');
Schema::drop('flight_fare');
Schema::drop('flight_subfleet');
Schema::drop('flights');
}
}

View File

@@ -1,11 +1,10 @@
<?php
use App\Models\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateRanksTable extends Migration
{
/**
* Run the migrations.
*
@@ -16,28 +15,19 @@ class CreateRanksTable extends Migration
Schema::create('ranks', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 50);
$table->string('image_link')->nullable();
$table->string('image_url')->nullable();
$table->unsignedInteger('hours')->default(0);
$table->unsignedDecimal('acars_base_pay_rate')->nullable()->default(0);
$table->unsignedDecimal('manual_base_pay_rate')->nullable()->default(0);
$table->boolean('auto_approve_acars')->nullable()->default(false);
$table->boolean('auto_approve_manual')->nullable()->default(false);
$table->boolean('auto_promote')->nullable()->default(true);
$table->boolean('auto_approve_above_score')->nullable()->default(false);
$table->smallInteger('auto_approve_score')->nullable();
$table->timestamps();
$table->unique('name');
});
/**
* Initial required data...
*/
$ranks = [
[
'id' => 1,
'name' => 'New Pilot',
'hours' => 0,
]
];
$this->addData('ranks', $ranks);
}
/**

View File

@@ -1,63 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateSubfleetTables
*/
class CreateSubfleetTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('subfleets', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('airline_id')->nullable();
$table->string('type', 50)->unique();
$table->string('name', 50);
$table->string('type', 50);
$table->unsignedDecimal('cost_block_hour')->default(0)->nullable();
$table->unsignedDecimal('cost_delay_minute')->default(0)->nullable();
$table->unsignedTinyInteger('fuel_type')->nullable();
$table->unsignedDecimal('ground_handling_multiplier')->nullable()->default(100);
$table->unsignedDecimal('cargo_capacity')->nullable();
$table->unsignedDecimal('fuel_capacity')->nullable();
$table->unsignedDecimal('gross_weight')->nullable();
$table->timestamps();
});
Schema::create('subfleet_expenses', function(Blueprint $table) {
$table->unsignedBigInteger('subfleet_id');
$table->string('name', 50);
$table->unsignedDecimal('cost');
$table->primary(['subfleet_id', 'name']);
});
Schema::create('subfleet_fare', function (Blueprint $table) {
$table->unsignedInteger('subfleet_id');
$table->unsignedInteger('fare_id');
$table->unsignedDecimal('price')->nullable();
$table->unsignedDecimal('cost')->nullable();
$table->unsignedInteger('capacity')->nullable();
$table->string('price')->nullable();
$table->string('cost')->nullable();
$table->string('capacity')->nullable();
$table->timestamps();
$table->primary(['subfleet_id', 'fare_id']);
$table->index(['fare_id', 'subfleet_id']);
});
Schema::create('subfleet_flight', function(Blueprint $table) {
$table->unsignedInteger('subfleet_id');
$table->string('flight_id', 12);
$table->primary(['subfleet_id', 'flight_id']);
$table->index(['flight_id', 'subfleet_id']);
});
Schema::create('subfleet_rank', function(Blueprint $table) {
Schema::create('subfleet_rank', function (Blueprint $table) {
$table->unsignedInteger('rank_id');
$table->unsignedInteger('subfleet_id');
$table->unsignedDecimal('acars_pay')->nullable();
$table->unsignedDecimal('manual_pay')->nullable();
$table->string('acars_pay')->nullable();
$table->string('manual_pay')->nullable();
$table->primary(['rank_id', 'subfleet_id']);
$table->index(['subfleet_id', 'rank_id']);
@@ -72,9 +56,7 @@ class CreateSubfleetTables extends Migration
public function down()
{
Schema::dropIfExists('subfleets');
Schema::dropIfExists('subfleet_expenses');
Schema::dropIfExists('subfleet_fare');
Schema::dropIfExists('subfleet_flight');
Schema::dropIfExists('subfleet_rank');
}
}

View File

@@ -1,14 +1,14 @@
<?php
use App\Contracts\Migration;
use App\Contracts\Model;
use App\Models\Enums\FlightType;
use App\Models\Enums\PirepState;
use App\Models\Enums\PirepStatus;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePirepTables extends Migration
{
/**
* Run the migrations.
*
@@ -17,16 +17,17 @@ class CreatePirepTables extends Migration
public function up()
{
Schema::create('pireps', function (Blueprint $table) {
$table->string('id', \App\Models\Pirep::ID_MAX_LENGTH);
$table->string('id', Model::ID_MAX_LENGTH);
$table->unsignedInteger('user_id');
$table->unsignedInteger('airline_id');
$table->unsignedInteger('aircraft_id')->nullable();
$table->string('flight_id', \App\Models\Flight::ID_MAX_LENGTH)->nullable();
$table->string('flight_number', 10)->nullable();
$table->string('route_code', 5)->nullable();
$table->string('route_leg', 5)->nullable();
$table->string('dpt_airport_id', 5);
$table->string('arr_airport_id', 5);
$table->char('flight_type', 1)->default(FlightType::SCHED_PAX);
$table->string('dpt_airport_id', 4);
$table->string('arr_airport_id', 4);
$table->string('alt_airport_id', 4)->nullable();
$table->unsignedInteger('level')->nullable();
$table->unsignedDecimal('distance')->nullable();
$table->unsignedDecimal('planned_distance')->nullable();
@@ -36,56 +37,44 @@ class CreatePirepTables extends Migration
$table->unsignedDecimal('block_fuel')->nullable();
$table->unsignedDecimal('fuel_used')->nullable();
$table->decimal('landing_rate')->nullable();
$table->smallInteger('score')->nullable();
$table->text('route')->nullable();
$table->text('notes')->nullable();
$table->unsignedTinyInteger('source')->nullable()->default(0);
$table->string('source_name', 25)->nullable();
$table->tinyInteger('flight_type')->default(FlightType::PASSENGER);
$table->string('source_name', 50)->nullable();
$table->tinyInteger('state')->default(PirepState::PENDING);
$table->tinyInteger('status')->default(PirepStatus::SCHEDULED);
$table->char('status', 3)->default(PirepStatus::SCHEDULED);
$table->dateTime('submitted_at')->nullable();
$table->dateTime('block_off_time')->nullable();
$table->dateTime('block_on_time')->nullable();
$table->timestamps();
$table->primary('id');
$table->index('user_id');
$table->index('flight_id');
$table->index('flight_number');
$table->index('dpt_airport_id');
$table->index('arr_airport_id');
});
Schema::create('pirep_comments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
$table->string('pirep_id', Model::ID_MAX_LENGTH);
$table->unsignedInteger('user_id');
$table->text('comment');
$table->timestamps();
});
/*
* Financial tables/fields
*/
Schema::create('pirep_expenses', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
$table->string('name');
$table->double('value')->nullable();
$table->index('pirep_id');
});
Schema::create('pirep_fares', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
$table->unsignedBigInteger('fare_id');
$table->unsignedInteger('count')->nullable();
$table->string('pirep_id', Model::ID_MAX_LENGTH);
$table->unsignedInteger('fare_id');
$table->unsignedInteger('count')->nullable()->default(0);
$table->index('pirep_id');
});
/*
* Additional PIREP data
*/
Schema::create('pirep_fields', function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->string('name', 50);
$table->string('slug', 50)->nullable();
$table->boolean('required')->nullable()->default(false);
@@ -93,10 +82,11 @@ class CreatePirepTables extends Migration
Schema::create('pirep_field_values', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
$table->string('pirep_id', Model::ID_MAX_LENGTH);
$table->string('name', 50);
$table->string('slug', 50)->nullable();
$table->string('value')->nullable();
$table->string('source')->nullable();
$table->unsignedTinyInteger('source');
$table->timestamps();
$table->index('pirep_id');
@@ -112,7 +102,6 @@ class CreatePirepTables extends Migration
{
Schema::dropIfExists('pireps');
Schema::dropIfExists('pirep_comments');
Schema::dropIfExists('pirep_expenses');
Schema::dropIfExists('pirep_fares');
Schema::dropIfExists('pirep_fields');
Schema::dropIfExists('pirep_field_values');

View File

@@ -1,6 +1,7 @@
<?php
use Illuminate\Database\Migrations\Migration;
use App\Contracts\Migration;
use App\Contracts\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
@@ -13,10 +14,10 @@ class CreateBidsTable extends Migration
*/
public function up()
{
Schema::create('user_bids', function (Blueprint $table) {
Schema::create('bids', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->string('flight_id', \App\Models\Flight::ID_MAX_LENGTH);
$table->string('flight_id', Model::ID_MAX_LENGTH);
$table->timestamps();
$table->index('user_id');
@@ -31,6 +32,6 @@ class CreateBidsTable extends Migration
*/
public function down()
{
Schema::dropIfExists('user_bids');
Schema::dropIfExists('bids');
}
}

View File

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

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