Compare commits
140 Commits
UpdateMeta
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ced2012578 | ||
|
|
00918f54aa | ||
|
|
41bd325f9a | ||
|
|
b4311b861f | ||
|
|
2f9e8583f2 | ||
|
|
2155979eb9 | ||
|
|
f30a3bc1ef | ||
|
|
3461672f10 | ||
|
|
b4d5114ea2 | ||
|
|
231e54ea5e | ||
|
|
b1ae0240be | ||
|
|
64e470abec | ||
|
|
695ab3a90d | ||
|
|
0e1b55c6d7 | ||
|
|
ba5b4e23c7 | ||
|
|
ef38d39ec4 | ||
|
|
ccebc69be2 | ||
|
|
6becc6de63 | ||
|
|
ca1cd01f3d | ||
|
|
e2226b7400 | ||
|
|
991f661144 | ||
|
|
d1b7905e95 | ||
|
|
ca8d96d2b6 | ||
|
|
12848091a2 | ||
|
|
00bf18c225 | ||
|
|
b81dd97822 | ||
|
|
7a40a9d128 | ||
|
|
9d368e8efa | ||
|
|
219a7cf6f9 | ||
|
|
54bc5ccb30 | ||
|
|
648659aea5 | ||
|
|
08f82f8a2e | ||
|
|
60cec870f6 | ||
|
|
78fd8367a1 | ||
|
|
607ea6f5e5 | ||
|
|
9e080d544a | ||
|
|
cb38f2ad90 | ||
|
|
6cfbd91328 | ||
|
|
9253d39848 | ||
|
|
737b2f137f | ||
|
|
c518175244 | ||
|
|
08624042f2 | ||
|
|
94735103aa | ||
|
|
e4782c40f3 | ||
|
|
670cb5d811 | ||
|
|
88ffee16be | ||
|
|
cc5a6db427 | ||
|
|
74a1b4d753 | ||
|
|
8a94d8db7b | ||
|
|
c2cc067329 | ||
|
|
723f66a382 | ||
|
|
27be992395 | ||
|
|
6160d57790 | ||
|
|
7fabd57e13 | ||
|
|
09453becf8 | ||
|
|
023313c681 | ||
|
|
d3b7d25abd | ||
|
|
7799867302 | ||
|
|
fd7c1b8314 | ||
|
|
c12cf0964a | ||
|
|
2202d5bf99 | ||
|
|
064682b71f | ||
|
|
3c9d419ebb | ||
|
|
a3f110c0c0 | ||
|
|
c45d52dffa | ||
|
|
4d21ca0982 | ||
|
|
52e716d6ee | ||
|
|
66d83c0ce6 | ||
|
|
4ea8357952 | ||
|
|
b9c29fbe08 | ||
|
|
4e7149a51c | ||
|
|
4c60e5da69 | ||
|
|
2dbe19fdcc | ||
|
|
358f0b663e | ||
|
|
9146c4a68f | ||
|
|
addfa68016 | ||
|
|
571768b39d | ||
|
|
9956929df7 | ||
|
|
f498ad3bba | ||
|
|
471464272f | ||
|
|
85703e1aff | ||
|
|
930d4cfa08 | ||
|
|
91d68308aa | ||
|
|
4eca1f671f | ||
|
|
1e7e8cc5e5 | ||
|
|
c65b5c1b05 | ||
|
|
87886f2419 | ||
|
|
9a28cf22ff | ||
|
|
7a29630f57 | ||
|
|
0b27635fcb | ||
|
|
f3b032e56b | ||
|
|
f99af4cfc3 | ||
|
|
14e33574fc | ||
|
|
bd892f5407 | ||
|
|
96e63f1572 | ||
|
|
a0309b6303 | ||
|
|
e13a019a40 | ||
|
|
91f928ecf4 | ||
|
|
226ae6d109 | ||
|
|
90d1708aab | ||
|
|
6eef246b6a | ||
|
|
fc8ca69729 | ||
|
|
57277c558d | ||
|
|
b0f52ed1d0 | ||
|
|
d64e674c21 | ||
|
|
40c911ff17 | ||
|
|
b6abe8dd5b | ||
|
|
54c3c8f346 | ||
|
|
c250fce84b | ||
|
|
4125cdd373 | ||
|
|
6eb883de73 | ||
|
|
49528c9644 | ||
|
|
4475813a12 | ||
|
|
681e39650b | ||
|
|
bbbe8a8bd3 | ||
|
|
0acab21712 | ||
|
|
a17840d690 | ||
|
|
fe87f21599 | ||
|
|
2756c34702 | ||
|
|
564f9ec06e | ||
|
|
95e1df619e | ||
|
|
4a04d73d08 | ||
|
|
88a8ffe48a | ||
|
|
78d3c6b577 | ||
|
|
f42a41286d | ||
|
|
f8ded4e410 | ||
|
|
6304f3cab4 | ||
|
|
4eb73ab5f3 | ||
|
|
2af72d137d | ||
|
|
f68e068f87 | ||
|
|
89f9706520 | ||
|
|
cde6fb314b | ||
|
|
1a944f320c | ||
|
|
d7ad2bdd11 | ||
|
|
24fca650f8 | ||
|
|
35359b8646 | ||
|
|
b6a2fe405d | ||
|
|
bd9c429cfc | ||
|
|
b18f1bbe6c | ||
|
|
a5a21fb2fd |
19
.github/scripts/build.sh
vendored
19
.github/scripts/build.sh
vendored
@@ -15,7 +15,10 @@ declare -a remove_files=(
|
|||||||
.idea
|
.idea
|
||||||
.travis
|
.travis
|
||||||
docker
|
docker
|
||||||
|
node_modules
|
||||||
|
vendor/willdurand/geocoder/tests
|
||||||
_ide_helper.php
|
_ide_helper.php
|
||||||
|
.env
|
||||||
.dockerignore
|
.dockerignore
|
||||||
.dpl
|
.dpl
|
||||||
.editorconfig
|
.editorconfig
|
||||||
@@ -23,6 +26,7 @@ declare -a remove_files=(
|
|||||||
.eslintrc
|
.eslintrc
|
||||||
.php_cs
|
.php_cs
|
||||||
.php_cs.cache
|
.php_cs.cache
|
||||||
|
.php-cs-fixer.php
|
||||||
.phpstorm.meta.php
|
.phpstorm.meta.php
|
||||||
.styleci.yml
|
.styleci.yml
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
@@ -37,9 +41,8 @@ declare -a remove_files=(
|
|||||||
phpvms.iml
|
phpvms.iml
|
||||||
Procfile
|
Procfile
|
||||||
phpstan.neon
|
phpstan.neon
|
||||||
node_modules
|
symfony.lock
|
||||||
composer.phar
|
composer.phar
|
||||||
vendor/willdurand/geocoder/tests
|
|
||||||
)
|
)
|
||||||
|
|
||||||
for file in "${remove_files[@]}"; do
|
for file in "${remove_files[@]}"; do
|
||||||
@@ -70,14 +73,22 @@ mkdir -p storage/framework/views
|
|||||||
|
|
||||||
cd /tmp
|
cd /tmp
|
||||||
|
|
||||||
|
echo "Current directory contents"
|
||||||
|
ls -al $BASE_DIR
|
||||||
|
|
||||||
|
echo "Parent directory contents"
|
||||||
ls -al $BASE_DIR/../
|
ls -al $BASE_DIR/../
|
||||||
|
|
||||||
tar -czf $TAR_NAME -C $BASE_DIR .
|
echo "Calling find"
|
||||||
|
find $BASE_DIR/../ -type d -maxdepth 2
|
||||||
|
|
||||||
|
tar -czf $TAR_NAME -C $BASE_DIR --xform 's:^\./::' . [--show-transformed-names|--show-stored-names]
|
||||||
sha256sum $TAR_NAME >"$TAR_NAME.sha256"
|
sha256sum $TAR_NAME >"$TAR_NAME.sha256"
|
||||||
|
|
||||||
cd $BASE_DIR;
|
cd $BASE_DIR;
|
||||||
zip -r $ZIP_NAME *
|
zip -r $ZIP_NAME ./
|
||||||
sha256sum $ZIP_NAME >"$ZIP_NAME.sha256"
|
sha256sum $ZIP_NAME >"$ZIP_NAME.sha256"
|
||||||
|
|
||||||
mv $ZIP_NAME /tmp
|
mv $ZIP_NAME /tmp
|
||||||
mv "$ZIP_NAME.sha256" /tmp
|
mv "$ZIP_NAME.sha256" /tmp
|
||||||
|
|
||||||
|
|||||||
18
.github/workflows/build.yml
vendored
18
.github/workflows/build.yml
vendored
@@ -2,12 +2,12 @@ name: 'Build'
|
|||||||
on: ['push', 'pull_request', 'workflow_dispatch', 'release']
|
on: ['push', 'pull_request', 'workflow_dispatch', 'release']
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
if: github.repository == 'nabeelio/phpvms'
|
if: github.repository == 'nabeelio/phpvms'
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
php-versions: ['7.3', '7.4', '8.0']
|
php-versions: ['8.0', '8.1']
|
||||||
name: PHP ${{ matrix.php-versions }}
|
name: PHP ${{ matrix.php-versions }}
|
||||||
env:
|
env:
|
||||||
extensions: intl, pcov, mbstring
|
extensions: intl, pcov, mbstring
|
||||||
@@ -69,6 +69,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
php --version
|
php --version
|
||||||
mysql --version
|
mysql --version
|
||||||
|
sleep 15
|
||||||
# Downgrade composer version to 1.x
|
# Downgrade composer version to 1.x
|
||||||
composer install --dev --no-interaction --verbose
|
composer install --dev --no-interaction --verbose
|
||||||
cp .github/scripts/env.php env.php
|
cp .github/scripts/env.php env.php
|
||||||
@@ -78,7 +79,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: |
|
run: |
|
||||||
vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --diff --using-cache=no
|
export PHP_CS_FIXER_IGNORE_ENV=1
|
||||||
|
#vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --dry-run --diff --using-cache=no
|
||||||
vendor/bin/phpunit --debug --verbose
|
vendor/bin/phpunit --debug --verbose
|
||||||
|
|
||||||
# This runs after all of the tests, run have run. Creates a cleaned up version of the
|
# This runs after all of the tests, run have run. Creates a cleaned up version of the
|
||||||
@@ -86,7 +88,7 @@ jobs:
|
|||||||
artifacts:
|
artifacts:
|
||||||
name: 'Create dev build'
|
name: 'Create dev build'
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: 'ubuntu-18.04'
|
runs-on: ubuntu-20.04
|
||||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
|
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -95,7 +97,7 @@ jobs:
|
|||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '7.4'
|
php-version: '8.0'
|
||||||
|
|
||||||
- uses: olegtarasov/get-tag@v2.1
|
- uses: olegtarasov/get-tag@v2.1
|
||||||
id: tagName
|
id: tagName
|
||||||
@@ -116,7 +118,6 @@ jobs:
|
|||||||
- name: 'Install Release Dependencies'
|
- name: 'Install Release Dependencies'
|
||||||
run: |
|
run: |
|
||||||
rm -rf vendor
|
rm -rf vendor
|
||||||
sudo npm i tar-to-zip -g
|
|
||||||
composer install --no-dev --prefer-dist --no-interaction --verbose
|
composer install --no-dev --prefer-dist --no-interaction --verbose
|
||||||
sudo chmod +x ./.github/scripts/*
|
sudo chmod +x ./.github/scripts/*
|
||||||
|
|
||||||
@@ -149,7 +150,7 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
name: 'Create Release'
|
name: 'Create Release'
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: 'ubuntu-18.04'
|
runs-on: ubuntu-20.04
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -158,7 +159,7 @@ jobs:
|
|||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '7.4'
|
php-version: 8.0
|
||||||
|
|
||||||
- uses: olegtarasov/get-tag@v2.1
|
- uses: olegtarasov/get-tag@v2.1
|
||||||
id: tagName
|
id: tagName
|
||||||
@@ -179,7 +180,6 @@ jobs:
|
|||||||
- name: 'Install Release Dependencies'
|
- name: 'Install Release Dependencies'
|
||||||
run: |
|
run: |
|
||||||
rm -rf vendor
|
rm -rf vendor
|
||||||
sudo npm i tar-to-zip -g
|
|
||||||
composer install --no-dev --prefer-dist --no-interaction --verbose
|
composer install --no-dev --prefer-dist --no-interaction --verbose
|
||||||
sudo chmod +x ./.github/scripts/*
|
sudo chmod +x ./.github/scripts/*
|
||||||
|
|
||||||
|
|||||||
12
.gitignore
vendored
12
.gitignore
vendored
@@ -22,6 +22,7 @@ storage/*.sqlite
|
|||||||
.env.*.php
|
.env.*.php
|
||||||
.env.php
|
.env.php
|
||||||
.env
|
.env
|
||||||
|
.env.*
|
||||||
.env.bak
|
.env.bak
|
||||||
env.php
|
env.php
|
||||||
.env.generated
|
.env.generated
|
||||||
@@ -76,3 +77,14 @@ error_log
|
|||||||
/config.php
|
/config.php
|
||||||
/config.bak.php
|
/config.bak.php
|
||||||
/VERSION
|
/VERSION
|
||||||
|
sync.sh
|
||||||
|
|
||||||
|
###> friendsofphp/php-cs-fixer ###
|
||||||
|
/.php-cs-fixer.php
|
||||||
|
/.php-cs-fixer.cache
|
||||||
|
###< friendsofphp/php-cs-fixer ###
|
||||||
|
|
||||||
|
###> phpunit/phpunit ###
|
||||||
|
/phpunit.xml
|
||||||
|
.phpunit.result.cache
|
||||||
|
###< phpunit/phpunit ###
|
||||||
|
|||||||
69
.php-cs-fixer.php
Normal file
69
.php-cs-fixer.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of PHP CS Fixer.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
|
||||||
|
*
|
||||||
|
* This source file is subject to the MIT license that is bundled
|
||||||
|
* with this source code in the file LICENSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$header = <<<'EOF'
|
||||||
|
This file is part of PHP CS Fixer.
|
||||||
|
(c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
Dariusz Rumiński <dariusz.ruminski@gmail.com>
|
||||||
|
This source file is subject to the MIT license that is bundled
|
||||||
|
with this source code in the file LICENSE.
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$finder = PhpCsFixer\Finder::create()
|
||||||
|
->ignoreVCSIgnored(true)
|
||||||
|
->exclude('tests/data')
|
||||||
|
->exclude('storage')
|
||||||
|
->exclude('resources')
|
||||||
|
->in(__DIR__)
|
||||||
|
->append([
|
||||||
|
__DIR__.'/dev-tools/doc.php',
|
||||||
|
// __DIR__.'/php-cs-fixer', disabled, as we want to be able to run bootstrap file even on lower PHP version, to show nice message
|
||||||
|
__FILE__,
|
||||||
|
])
|
||||||
|
;
|
||||||
|
|
||||||
|
$config = new PhpCsFixer\Config();
|
||||||
|
$config
|
||||||
|
->setRiskyAllowed(true)
|
||||||
|
->setRules([
|
||||||
|
'@PSR2' => true,
|
||||||
|
'strict_param' => true,
|
||||||
|
'no_php4_constructor' => true,
|
||||||
|
'no_extra_blank_lines' => true,
|
||||||
|
'no_superfluous_elseif' => true,
|
||||||
|
'single_line_comment_style' => false,
|
||||||
|
'simple_to_complex_string_variable' => true,
|
||||||
|
'array_syntax' => [
|
||||||
|
'syntax' => 'short',
|
||||||
|
],
|
||||||
|
'binary_operator_spaces' => [
|
||||||
|
'operators' => [
|
||||||
|
'=>' => 'align_single_space_minimal'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
/*
|
||||||
|
'blank_line_before_statement' => [
|
||||||
|
'statements' => [
|
||||||
|
'declare',
|
||||||
|
'for',
|
||||||
|
'return',
|
||||||
|
'throw',
|
||||||
|
'try',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
*/
|
||||||
|
])
|
||||||
|
->setFinder($finder);
|
||||||
|
|
||||||
|
return $config;
|
||||||
37
.php_cs
37
.php_cs
@@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$finder = PhpCsFixer\Finder::create()
|
|
||||||
->in('app')
|
|
||||||
->in('config');
|
|
||||||
|
|
||||||
return PhpCsFixer\Config::create()
|
|
||||||
->setHideProgress(true)
|
|
||||||
->setUsingCache(false)
|
|
||||||
->setRiskyAllowed(true)
|
|
||||||
->setRules([
|
|
||||||
'@PSR2' => true,
|
|
||||||
'strict_param' => true,
|
|
||||||
'no_php4_constructor' => true,
|
|
||||||
'no_extra_blank_lines' => true,
|
|
||||||
'no_superfluous_elseif' => true,
|
|
||||||
'single_line_comment_style' => false,
|
|
||||||
'simple_to_complex_string_variable' => true,
|
|
||||||
'array_syntax' => [
|
|
||||||
'syntax' => 'short',
|
|
||||||
],
|
|
||||||
'binary_operator_spaces' => [
|
|
||||||
'align_double_arrow' => true,
|
|
||||||
],
|
|
||||||
/*
|
|
||||||
'blank_line_before_statement' => [
|
|
||||||
'statements' => [
|
|
||||||
'declare',
|
|
||||||
'for',
|
|
||||||
'return',
|
|
||||||
'throw',
|
|
||||||
'try',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
*/
|
|
||||||
])
|
|
||||||
->setFinder($finder);
|
|
||||||
19
Dockerfile
19
Dockerfile
@@ -1,14 +1,15 @@
|
|||||||
FROM php:7.4-fpm-alpine
|
FROM php:8.1-fpm-alpine3.15
|
||||||
|
|
||||||
WORKDIR /var/www/
|
WORKDIR /var/www/
|
||||||
|
|
||||||
RUN apk add gmp-dev icu-dev zlib-dev libpng-dev
|
# Setup composer
|
||||||
RUN curl --silent --show-error https://getcomposer.org/installer | php
|
COPY --from=composer:2.2.7 /usr/bin/composer /usr/local/bin/composer
|
||||||
|
|
||||||
|
RUN apk add gmp-dev icu-dev zlib-dev libpng-dev libzip-dev zip
|
||||||
|
|
||||||
# Copy any config files in
|
# Copy any config files in
|
||||||
COPY resources/docker/php/ext-opcache.ini $PHP_INI_DIR/conf.d/
|
COPY resources/docker/php/ext-opcache.ini $PHP_INI_DIR/conf.d/
|
||||||
COPY resources/docker/php/www.conf /usr/local/etc/php-fpm.d/www.conf
|
COPY resources/docker/php/www.conf /usr/local/etc/php-fpm.d/www.conf
|
||||||
RUN ln -sf /dev/stderr /var/log/fpm-error.log
|
|
||||||
|
|
||||||
RUN docker-php-ext-install \
|
RUN docker-php-ext-install \
|
||||||
calendar \
|
calendar \
|
||||||
@@ -16,17 +17,19 @@ RUN docker-php-ext-install \
|
|||||||
pdo_mysql \
|
pdo_mysql \
|
||||||
gd \
|
gd \
|
||||||
gmp \
|
gmp \
|
||||||
opcache && \
|
bcmath \
|
||||||
docker-php-ext-enable pdo_mysql opcache
|
opcache \
|
||||||
|
zip && \
|
||||||
|
docker-php-ext-enable pdo_mysql opcache bcmath zip intl
|
||||||
|
|
||||||
COPY . /var/www/
|
COPY . /var/www/
|
||||||
RUN php composer.phar install \
|
RUN composer install \
|
||||||
--ignore-platform-reqs \
|
--ignore-platform-reqs \
|
||||||
--no-interaction \
|
--no-interaction \
|
||||||
--no-plugins \
|
--no-plugins \
|
||||||
--no-scripts \
|
--no-scripts \
|
||||||
--prefer-dist
|
--prefer-dist
|
||||||
|
|
||||||
RUN chown -R www-data:www-data /var/www
|
#RUN chown -R www-data:www-data /var/www
|
||||||
|
|
||||||
EXPOSE 9000
|
EXPOSE 9000
|
||||||
|
|||||||
5
LICENSE
5
LICENSE
@@ -1,5 +1,3 @@
|
|||||||
BSD 3-Clause License
|
|
||||||
|
|
||||||
Copyright (c) 2017, phpvms - http://www.phpvms.net
|
Copyright (c) 2017, phpvms - http://www.phpvms.net
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
@@ -17,6 +15,9 @@ modification, are permitted provided that the following conditions are met:
|
|||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
* A "powered by phpvms" is required in page footers, unless the license has
|
||||||
|
purchased to omit it.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
|||||||
13
Makefile
13
Makefile
@@ -80,11 +80,7 @@ test:
|
|||||||
|
|
||||||
.PHONY: phpcs
|
.PHONY: phpcs
|
||||||
phpcs:
|
phpcs:
|
||||||
@vendor/bin/php-cs-fixer fix --config=.php_cs -v --diff --diff-format=udiff --dry-run
|
@PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --dry-run --diff --using-cache=no
|
||||||
|
|
||||||
#.PHONY: phpstan
|
|
||||||
#phpstan:
|
|
||||||
# vendor/bin/phpstan analyse -c phpstan.neon -v --level 2 app
|
|
||||||
|
|
||||||
.PHONY: replay-acars
|
.PHONY: replay-acars
|
||||||
replay-acars:
|
replay-acars:
|
||||||
@@ -95,11 +91,6 @@ replay-acars:
|
|||||||
sass-watch:
|
sass-watch:
|
||||||
sass --watch public/assets/admin/sass/paper-dashboard.scss:public/assets/admin/css/paper-dashboard.css
|
sass --watch public/assets/admin/sass/paper-dashboard.scss:public/assets/admin/css/paper-dashboard.css
|
||||||
|
|
||||||
.PHONY: schema
|
|
||||||
schema:
|
|
||||||
#php artisan infyom:scaffold Aircraft --fieldsFile=database/schema/aircraft.json
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
.PHONY: deploy-package
|
.PHONY: deploy-package
|
||||||
deploy-package:
|
deploy-package:
|
||||||
./.travis/deploy_script.sh
|
./.travis/deploy_script.sh
|
||||||
@@ -111,7 +102,7 @@ reset-installer:
|
|||||||
|
|
||||||
.PHONY: docker-test
|
.PHONY: docker-test
|
||||||
docker-test:
|
docker-test:
|
||||||
@docker-compose -f docker-compose.yml -f docker-compose.local.yml up
|
@docker compose -f docker-compose.dev.yml up
|
||||||
|
|
||||||
.PHONY: docker-clean
|
.PHONY: docker-clean
|
||||||
docker-clean:
|
docker-clean:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ A full distribution, with all of the composer dependencies, is available at this
|
|||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
- PHP 7.3+, extensions:
|
- PHP 8.0+, extensions:
|
||||||
- cURL
|
- cURL
|
||||||
- JSON
|
- JSON
|
||||||
- mbstring
|
- mbstring
|
||||||
@@ -39,7 +39,7 @@ make docker-test
|
|||||||
|
|
||||||
# **OR** with docker-compose directly
|
# **OR** with docker-compose directly
|
||||||
|
|
||||||
docker-compose -f docker-compose.yml -f docker-compose.local.yml up
|
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
|
||||||
```
|
```
|
||||||
|
|
||||||
Then go to `http://localhost`. If you're using dnsmasq, the `app` container is listening on `phpvms.test`, or you can add to your `/etc/hosts` file:
|
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:
|
||||||
|
|||||||
@@ -17,25 +17,25 @@ class AcarsReplay extends Command
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $apiKey = 'testadminapikey';
|
protected string $apiKey = 'testadminapikey';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For automatic updates, how many seconds to sleep between updates
|
* For automatic updates, how many seconds to sleep between updates
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $sleepTime = 10;
|
protected int $sleepTime = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array key == update[callsign]
|
* @var array key == update[callsign]
|
||||||
* value == PIREP ID
|
* value == PIREP ID
|
||||||
*/
|
*/
|
||||||
protected $pirepList = [];
|
protected array $pirepList = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Client
|
* @var Client
|
||||||
*/
|
*/
|
||||||
protected $httpClient;
|
protected Client $httpClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an instance of an HTTP client all ready to post
|
* Return an instance of an HTTP client all ready to post
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App;
|
|
||||||
use App\Contracts\Command;
|
use App\Contracts\Command;
|
||||||
use App\Services\Installer\ConfigService;
|
use App\Services\Installer\ConfigService;
|
||||||
use App\Services\Installer\SeederService;
|
use App\Services\Installer\SeederService;
|
||||||
use DatabaseSeeder;
|
use DatabaseSeeder;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the config files
|
* Create the config files
|
||||||
@@ -16,8 +16,8 @@ class CreateConfigs extends Command
|
|||||||
protected $signature = 'phpvms:config {db_host} {db_name} {db_user} {db_pass}';
|
protected $signature = 'phpvms:config {db_host} {db_name} {db_user} {db_pass}';
|
||||||
protected $description = 'Create the config files';
|
protected $description = 'Create the config files';
|
||||||
|
|
||||||
private $databaseSeeder;
|
private DatabaseSeeder $databaseSeeder;
|
||||||
private $seederSvc;
|
private SeederService $seederSvc;
|
||||||
|
|
||||||
public function __construct(DatabaseSeeder $databaseSeeder, SeederService $seederSvc)
|
public function __construct(DatabaseSeeder $databaseSeeder, SeederService $seederSvc)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,11 @@ class CreateDatabase extends Command
|
|||||||
{
|
{
|
||||||
protected $signature = 'database:create {--reset} {--migrate} {--conn=?}';
|
protected $signature = 'database:create {--reset} {--migrate} {--conn=?}';
|
||||||
protected $description = 'Create a database';
|
protected $description = 'Create a database';
|
||||||
protected $os;
|
|
||||||
|
/**
|
||||||
|
* @var Detector
|
||||||
|
*/
|
||||||
|
protected Detector $os;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CreateDatabase constructor.
|
* CreateDatabase constructor.
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ class DevCommands extends Command
|
|||||||
{
|
{
|
||||||
protected $signature = 'phpvms {cmd} {param?}';
|
protected $signature = 'phpvms {cmd} {param?}';
|
||||||
protected $description = 'Developer commands';
|
protected $description = 'Developer commands';
|
||||||
protected $dbSvc;
|
|
||||||
|
protected DatabaseService $dbSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DevCommands constructor.
|
* DevCommands constructor.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class DevInstall extends Command
|
|||||||
protected $signature = 'phpvms:dev-install {--reset-db} {--reset-configs}';
|
protected $signature = 'phpvms:dev-install {--reset-db} {--reset-configs}';
|
||||||
protected $description = 'Run a developer install and run the sample migration';
|
protected $description = 'Run a developer install and run the sample migration';
|
||||||
|
|
||||||
private $databaseSeeder;
|
private \DatabaseSeeder $databaseSeeder;
|
||||||
|
|
||||||
public function __construct(\DatabaseSeeder $databaseSeeder)
|
public function __construct(\DatabaseSeeder $databaseSeeder)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class ImportCsv extends Command
|
|||||||
protected $signature = 'phpvms:csv-import {type} {file}';
|
protected $signature = 'phpvms:csv-import {type} {file}';
|
||||||
protected $description = 'Import from a CSV file';
|
protected $description = 'Import from a CSV file';
|
||||||
|
|
||||||
private $importer;
|
private ImportService $importer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import constructor.
|
* Import constructor.
|
||||||
|
|||||||
@@ -18,11 +18,15 @@ class ProcessQueue extends Command
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
Artisan::call('queue:work', [
|
Artisan::call('queue:work', [
|
||||||
'--sansdaemon' => null,
|
//'--sansdaemon' => null,
|
||||||
'--stop-when-empty' => null,
|
'--stop-when-empty' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Log::info(Artisan::output());
|
$jobOutput = trim(Artisan::output());
|
||||||
|
if (!empty($jobOutput)) {
|
||||||
|
Log::info($jobOutput);
|
||||||
|
}
|
||||||
|
|
||||||
///** @var App\Support\WorkCommand $queueWorker */
|
///** @var App\Support\WorkCommand $queueWorker */
|
||||||
//$queueWorker = new App\Support\WorkCommand(app('queue.worker'), app('cache.store'));
|
//$queueWorker = new App\Support\WorkCommand(app('queue.worker'), app('cache.store'));
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,11 @@ use GuzzleHttp\Client;
|
|||||||
class TestApi extends Command
|
class TestApi extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'phpvms:test-api {apikey} {url}';
|
protected $signature = 'phpvms:test-api {apikey} {url}';
|
||||||
protected $httpClient;
|
|
||||||
|
/**
|
||||||
|
* @var Client
|
||||||
|
*/
|
||||||
|
protected Client $httpClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run dev related commands
|
* Run dev related commands
|
||||||
|
|||||||
@@ -10,8 +10,14 @@ class Version extends Command
|
|||||||
{
|
{
|
||||||
protected $signature = 'phpvms:version {--write} {--base-only} {--write-full-version} {version?}';
|
protected $signature = 'phpvms:version {--write} {--base-only} {--write-full-version} {version?}';
|
||||||
|
|
||||||
private $versionSvc;
|
/**
|
||||||
|
* @var VersionService
|
||||||
|
*/
|
||||||
|
private VersionService $versionSvc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param VersionService $versionSvc
|
||||||
|
*/
|
||||||
public function __construct(VersionService $versionSvc)
|
public function __construct(VersionService $versionSvc)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|||||||
@@ -12,7 +12,11 @@ class YamlImport extends Command
|
|||||||
{
|
{
|
||||||
protected $signature = 'phpvms:yaml-import {files*}';
|
protected $signature = 'phpvms:yaml-import {files*}';
|
||||||
protected $description = 'Developer commands';
|
protected $description = 'Developer commands';
|
||||||
protected $dbSvc;
|
|
||||||
|
/**
|
||||||
|
* @var DatabaseService
|
||||||
|
*/
|
||||||
|
protected DatabaseService $dbSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* YamlImport constructor.
|
* YamlImport constructor.
|
||||||
|
|||||||
90
app/Console/Cron.php
Normal file
90
app/Console/Cron.php
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This runs any of the cron tasks that are set to run according to the Laravel schedule
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Console;
|
||||||
|
|
||||||
|
use App\Console\Cron\FifteenMinute;
|
||||||
|
use App\Console\Cron\FiveMinute;
|
||||||
|
use App\Console\Cron\Hourly;
|
||||||
|
use App\Console\Cron\JobQueue;
|
||||||
|
use App\Console\Cron\Monthly;
|
||||||
|
use App\Console\Cron\Nightly;
|
||||||
|
use App\Console\Cron\ThirtyMinute;
|
||||||
|
use App\Console\Cron\Weekly;
|
||||||
|
use App\Contracts\Command;
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
|
||||||
|
class Cron
|
||||||
|
{
|
||||||
|
/** @var Schedule */
|
||||||
|
private $scheduler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string[] The cron tasks which get called/run
|
||||||
|
*/
|
||||||
|
private $cronTasks = [
|
||||||
|
JobQueue::class,
|
||||||
|
FiveMinute::class,
|
||||||
|
FifteenMinute::class,
|
||||||
|
ThirtyMinute::class,
|
||||||
|
Hourly::class,
|
||||||
|
Nightly::class,
|
||||||
|
Weekly::class,
|
||||||
|
Monthly::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Stores the instantiated cron tasks
|
||||||
|
*/
|
||||||
|
private $cronRunners = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Schedule $scheduler
|
||||||
|
*/
|
||||||
|
public function __construct(Schedule $scheduler)
|
||||||
|
{
|
||||||
|
$this->scheduler = $scheduler;
|
||||||
|
foreach ($this->cronTasks as $task) {
|
||||||
|
/** @var Command $cronTask */
|
||||||
|
$cronTask = app($task);
|
||||||
|
$signature = $cronTask->getSignature();
|
||||||
|
|
||||||
|
if (empty($signature)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->cronRunners[$signature] = $cronTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to figure out which commands are supposed to run right now
|
||||||
|
*
|
||||||
|
* @return array string of tasks that were run
|
||||||
|
*/
|
||||||
|
public function run(): array
|
||||||
|
{
|
||||||
|
$events = $this->scheduler->dueEvents(app());
|
||||||
|
if (empty($events)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$run = [];
|
||||||
|
|
||||||
|
/** @var \Illuminate\Console\Scheduling\Event $event */
|
||||||
|
foreach ($events as $event) {
|
||||||
|
foreach ($this->cronRunners as $signature => $task) {
|
||||||
|
if (!str_contains($event->command, $signature)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$task->callEvent();
|
||||||
|
$run[] = $signature;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $run;
|
||||||
|
}
|
||||||
|
}
|
||||||
26
app/Console/Cron/FifteenMinute.php
Normal file
26
app/Console/Cron/FifteenMinute.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Cron;
|
||||||
|
|
||||||
|
use App\Contracts\CronCommand;
|
||||||
|
use App\Events\CronFifteenMinute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The actual cron tasks are in app/Cron
|
||||||
|
*/
|
||||||
|
class FifteenMinute extends CronCommand
|
||||||
|
{
|
||||||
|
protected $signature = 'cron:fifteen';
|
||||||
|
protected $description = 'Run the 15 minute cron tasks';
|
||||||
|
protected $schedule;
|
||||||
|
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
$this->callEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function callEvent()
|
||||||
|
{
|
||||||
|
event(new CronFifteenMinute());
|
||||||
|
}
|
||||||
|
}
|
||||||
29
app/Console/Cron/FiveMinute.php
Normal file
29
app/Console/Cron/FiveMinute.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Cron;
|
||||||
|
|
||||||
|
use App\Contracts\CronCommand;
|
||||||
|
use App\Events\CronFiveMinute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This just calls the CronNightly event, so all of the
|
||||||
|
* listeners, etc can just be called to run those tasks
|
||||||
|
*
|
||||||
|
* The actual cron tasks are in app/Cron
|
||||||
|
*/
|
||||||
|
class FiveMinute extends CronCommand
|
||||||
|
{
|
||||||
|
protected $signature = 'cron:five';
|
||||||
|
protected $description = 'Run the 5 minute cron tasks';
|
||||||
|
protected $schedule;
|
||||||
|
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
$this->callEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function callEvent()
|
||||||
|
{
|
||||||
|
event(new CronFiveMinute());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Console\Cron;
|
namespace App\Console\Cron;
|
||||||
|
|
||||||
use App\Contracts\Command;
|
use App\Contracts\CronCommand;
|
||||||
use App\Events\CronHourly;
|
use App\Events\CronHourly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This just calls the CronHourly event, so all of the
|
* This just calls the CronHourly event, so all of the
|
||||||
* listeners, etc can just be called to run those tasks
|
* listeners, etc can just be called to run those tasks
|
||||||
*/
|
*/
|
||||||
class Hourly extends Command
|
class Hourly extends CronCommand
|
||||||
{
|
{
|
||||||
protected $signature = 'cron:hourly';
|
protected $signature = 'cron:hourly';
|
||||||
protected $description = 'Run the hourly cron tasks';
|
protected $description = 'Run the hourly cron tasks';
|
||||||
@@ -17,7 +17,11 @@ class Hourly extends Command
|
|||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->redirectLoggingToFile('cron');
|
$this->callEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function callEvent()
|
||||||
|
{
|
||||||
event(new CronHourly());
|
event(new CronHourly());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Console\Cron;
|
namespace App\Console\Cron;
|
||||||
|
|
||||||
use App\Contracts\Command;
|
use App\Contracts\CronCommand;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This just calls the CronHourly event, so all of the
|
* This just calls the CronHourly event, so all of the
|
||||||
* listeners, etc can just be called to run those tasks
|
* listeners, etc can just be called to run those tasks
|
||||||
*/
|
*/
|
||||||
class JobQueue extends Command
|
class JobQueue extends CronCommand
|
||||||
{
|
{
|
||||||
protected $signature = 'cron:queue';
|
protected $signature = 'cron:queue';
|
||||||
protected $description = 'Run the cron queue tasks';
|
protected $description = 'Run the cron queue tasks';
|
||||||
@@ -17,9 +17,16 @@ class JobQueue extends Command
|
|||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->redirectLoggingToFile('cron');
|
$this->callEvent();
|
||||||
Artisan::call('queue:cron');
|
|
||||||
|
|
||||||
$this->info(Artisan::output());
|
$queueOutput = trim(Artisan::output());
|
||||||
|
if (!empty($queueOutput)) {
|
||||||
|
$this->info($queueOutput);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function callEvent()
|
||||||
|
{
|
||||||
|
Artisan::call('queue:cron');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Console\Cron;
|
namespace App\Console\Cron;
|
||||||
|
|
||||||
use App\Contracts\Command;
|
use App\Contracts\CronCommand;
|
||||||
use App\Events\CronMonthly;
|
use App\Events\CronMonthly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,7 +11,7 @@ use App\Events\CronMonthly;
|
|||||||
*
|
*
|
||||||
* The actual cron tasks are in app/Cron
|
* The actual cron tasks are in app/Cron
|
||||||
*/
|
*/
|
||||||
class Monthly extends Command
|
class Monthly extends CronCommand
|
||||||
{
|
{
|
||||||
protected $signature = 'cron:monthly';
|
protected $signature = 'cron:monthly';
|
||||||
protected $description = 'Run the monthly cron tasks';
|
protected $description = 'Run the monthly cron tasks';
|
||||||
@@ -19,7 +19,11 @@ class Monthly extends Command
|
|||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->redirectLoggingToFile('cron');
|
$this->callEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function callEvent()
|
||||||
|
{
|
||||||
event(new CronMonthly());
|
event(new CronMonthly());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Console\Cron;
|
namespace App\Console\Cron;
|
||||||
|
|
||||||
use App\Contracts\Command;
|
use App\Contracts\CronCommand;
|
||||||
use App\Events\CronNightly;
|
use App\Events\CronNightly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,7 +11,7 @@ use App\Events\CronNightly;
|
|||||||
*
|
*
|
||||||
* The actual cron tasks are in app/Cron
|
* The actual cron tasks are in app/Cron
|
||||||
*/
|
*/
|
||||||
class Nightly extends Command
|
class Nightly extends CronCommand
|
||||||
{
|
{
|
||||||
protected $signature = 'cron:nightly';
|
protected $signature = 'cron:nightly';
|
||||||
protected $description = 'Run the nightly cron tasks';
|
protected $description = 'Run the nightly cron tasks';
|
||||||
@@ -19,7 +19,11 @@ class Nightly extends Command
|
|||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->redirectLoggingToFile('cron');
|
$this->callEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function callEvent()
|
||||||
|
{
|
||||||
event(new CronNightly());
|
event(new CronNightly());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
26
app/Console/Cron/ThirtyMinute.php
Normal file
26
app/Console/Cron/ThirtyMinute.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Cron;
|
||||||
|
|
||||||
|
use App\Contracts\CronCommand;
|
||||||
|
use App\Events\CronThirtyMinute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The actual cron tasks are in app/Cron
|
||||||
|
*/
|
||||||
|
class ThirtyMinute extends CronCommand
|
||||||
|
{
|
||||||
|
protected $signature = 'cron:thirty';
|
||||||
|
protected $description = 'Run the 30 minute cron tasks';
|
||||||
|
protected $schedule;
|
||||||
|
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
$this->callEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function callEvent()
|
||||||
|
{
|
||||||
|
event(new CronThirtyMinute());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Console\Cron;
|
namespace App\Console\Cron;
|
||||||
|
|
||||||
use App\Contracts\Command;
|
use App\Contracts\CronCommand;
|
||||||
use App\Events\CronWeekly;
|
use App\Events\CronWeekly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,7 +11,7 @@ use App\Events\CronWeekly;
|
|||||||
*
|
*
|
||||||
* The actual cron tasks are in app/Cron
|
* The actual cron tasks are in app/Cron
|
||||||
*/
|
*/
|
||||||
class Weekly extends Command
|
class Weekly extends CronCommand
|
||||||
{
|
{
|
||||||
protected $signature = 'cron:weekly';
|
protected $signature = 'cron:weekly';
|
||||||
protected $description = 'Run the weekly cron tasks';
|
protected $description = 'Run the weekly cron tasks';
|
||||||
@@ -19,7 +19,11 @@ class Weekly extends Command
|
|||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$this->redirectLoggingToFile('cron');
|
$this->callEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function callEvent()
|
||||||
|
{
|
||||||
event(new CronWeekly());
|
event(new CronWeekly());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Console;
|
namespace App\Console;
|
||||||
|
|
||||||
|
use App\Console\Cron\FifteenMinute;
|
||||||
|
use App\Console\Cron\FiveMinute;
|
||||||
use App\Console\Cron\Hourly;
|
use App\Console\Cron\Hourly;
|
||||||
use App\Console\Cron\JobQueue;
|
use App\Console\Cron\JobQueue;
|
||||||
use App\Console\Cron\Monthly;
|
use App\Console\Cron\Monthly;
|
||||||
use App\Console\Cron\Nightly;
|
use App\Console\Cron\Nightly;
|
||||||
|
use App\Console\Cron\ThirtyMinute;
|
||||||
use App\Console\Cron\Weekly;
|
use App\Console\Cron\Weekly;
|
||||||
use App\Services\CronService;
|
use App\Services\CronService;
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
@@ -33,10 +36,16 @@ class Kernel extends ConsoleKernel
|
|||||||
->withoutOverlapping();
|
->withoutOverlapping();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOTE: IF MORE TASKS ARE ADDED, THEY ALSO MUST BE ADDED TO THE CRON.PHP
|
||||||
|
*/
|
||||||
|
$schedule->command(FiveMinute::class)->everyFiveMinutes();
|
||||||
|
$schedule->command(FifteenMinute::class)->everyFifteenMinutes();
|
||||||
|
$schedule->command(ThirtyMinute::class)->everyThirtyMinutes();
|
||||||
$schedule->command(Nightly::class)->dailyAt('01:00');
|
$schedule->command(Nightly::class)->dailyAt('01:00');
|
||||||
|
$schedule->command(Hourly::class)->hourly();
|
||||||
$schedule->command(Weekly::class)->weeklyOn(0);
|
$schedule->command(Weekly::class)->weeklyOn(0);
|
||||||
$schedule->command(Monthly::class)->monthlyOn(1);
|
$schedule->command(Monthly::class)->monthlyOn(1);
|
||||||
$schedule->command(Hourly::class)->hourly();
|
|
||||||
|
|
||||||
// When spatie-backups runs
|
// When spatie-backups runs
|
||||||
/*if (config('backup.backup.enabled', false) === true) {
|
/*if (config('backup.backup.enabled', false) === true) {
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ abstract class Award
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** @var \App\Models\Award|null */
|
/** @var \App\Models\Award|null */
|
||||||
protected $award;
|
protected ?AwardModel $award;
|
||||||
|
|
||||||
/** @var \App\Models\User|null */
|
/** @var \App\Models\User|null */
|
||||||
protected $user;
|
protected ?User $user;
|
||||||
|
|
||||||
public function __construct(AwardModel $award = null, User $user = null)
|
public function __construct(AwardModel $award = null, User $user = null)
|
||||||
{
|
{
|
||||||
@@ -69,9 +69,9 @@ abstract class Award
|
|||||||
/**
|
/**
|
||||||
* Add the award to this user, if they don't already have it
|
* Add the award to this user, if they don't already have it
|
||||||
*
|
*
|
||||||
* @return bool|UserAward
|
* @return bool|UserAward|null
|
||||||
*/
|
*/
|
||||||
protected function addAward()
|
protected function addAward(): bool|UserAward|null
|
||||||
{
|
{
|
||||||
$w = [
|
$w = [
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
|
|||||||
@@ -29,6 +29,16 @@ abstract class Command extends \Illuminate\Console\Command
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the signature of the command
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSignature(): string
|
||||||
|
{
|
||||||
|
return $this->signature;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Splice the logger and replace the active handlers with the handlers from the
|
* Splice the logger and replace the active handlers with the handlers from the
|
||||||
* a stack in config/logging.php
|
* a stack in config/logging.php
|
||||||
|
|||||||
@@ -84,19 +84,21 @@ abstract class Controller extends \Illuminate\Routing\Controller
|
|||||||
*
|
*
|
||||||
* @param $message
|
* @param $message
|
||||||
* @param null|mixed $count
|
* @param null|mixed $count
|
||||||
|
* @param mixed $attrs
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
public function message($message, $count = null)
|
public function message($message, $count = null, $attrs = [])
|
||||||
{
|
{
|
||||||
$attrs = [
|
$ret = [
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
|
'attrs' => $attrs,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($count !== null) {
|
if ($count !== null) {
|
||||||
$attrs['count'] = $count;
|
$ret['count'] = $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($attrs);
|
return response()->json($ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
20
app/Contracts/CronCommand.php
Normal file
20
app/Contracts/CronCommand.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Contracts;
|
||||||
|
|
||||||
|
abstract class CronCommand extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
abstract public function callEvent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjust the logging depending on where we're running from
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->redirectLoggingToFile('cron');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,14 +7,14 @@ namespace App\Contracts;
|
|||||||
*/
|
*/
|
||||||
abstract class Enum
|
abstract class Enum
|
||||||
{
|
{
|
||||||
protected static $cache = [];
|
protected static array $cache = [];
|
||||||
protected static $codes = [];
|
protected static array $codes = [];
|
||||||
protected static $labels = [];
|
protected static array $labels = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $value;
|
protected int $value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an instance of this Enum
|
* Create an instance of this Enum
|
||||||
@@ -29,9 +29,9 @@ abstract class Enum
|
|||||||
/**
|
/**
|
||||||
* Return the value that's been set if this is an instance
|
* Return the value that's been set if this is an instance
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return int|null
|
||||||
*/
|
*/
|
||||||
final public function getValue()
|
final public function getValue(): ?int
|
||||||
{
|
{
|
||||||
return $this->value;
|
return $this->value;
|
||||||
}
|
}
|
||||||
@@ -41,9 +41,9 @@ abstract class Enum
|
|||||||
*
|
*
|
||||||
* @param $value
|
* @param $value
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return string
|
||||||
*/
|
*/
|
||||||
final public static function label($value)
|
final public static function label($value): string
|
||||||
{
|
{
|
||||||
if (isset(static::$labels[$value])) {
|
if (isset(static::$labels[$value])) {
|
||||||
$val = static::$labels[$value];
|
$val = static::$labels[$value];
|
||||||
@@ -53,6 +53,8 @@ abstract class Enum
|
|||||||
|
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,11 +89,11 @@ abstract class Enum
|
|||||||
*
|
*
|
||||||
* @return false|int|string
|
* @return false|int|string
|
||||||
*/
|
*/
|
||||||
public static function convertToCode($value)
|
public static function convertToCode($value): bool|int|string|null
|
||||||
{
|
{
|
||||||
$value = (int) $value;
|
$value = (int) $value;
|
||||||
if (!array_key_exists($value, static::$codes)) {
|
if (!array_key_exists($value, static::$codes)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return static::$codes[$value];
|
return static::$codes[$value];
|
||||||
|
|||||||
9
app/Contracts/Factory.php
Normal file
9
app/Contracts/Factory.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Contracts;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory as EloquentFactory;
|
||||||
|
|
||||||
|
abstract class Factory extends EloquentFactory
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -166,10 +166,36 @@ class ImportExport
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strpos($split_values[0], '?') !== false) {
|
||||||
|
// This contains the query string, which turns it into a multi-level array
|
||||||
|
$query_str = explode('?', $split_values[0]);
|
||||||
|
$parent = trim($query_str[0]);
|
||||||
|
|
||||||
|
$children = [];
|
||||||
|
$kvp = explode('&', trim($query_str[1]));
|
||||||
|
foreach ($kvp as $items) {
|
||||||
|
if (!$items) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->kvpToArray($items, $children);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret[$parent] = $children;
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is not a query string, return it back untouched
|
||||||
return [$split_values[0]];
|
return [$split_values[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($split_values as $value) {
|
foreach ($split_values as $value) {
|
||||||
|
$value = trim($value);
|
||||||
|
if ($value === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// This isn't in the query string format, so it's
|
// This isn't in the query string format, so it's
|
||||||
// just a straight key-value pair set
|
// just a straight key-value pair set
|
||||||
if (strpos($value, '?') === false) {
|
if (strpos($value, '?') === false) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use App\Notifications\Channels\Discord\DiscordMessage;
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
|
||||||
@@ -26,24 +25,4 @@ class Notification extends \Illuminate\Notifications\Notification implements Sho
|
|||||||
|
|
||||||
$this->channels = $notif_config[$klass];*/
|
$this->channels = $notif_config[$klass];*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
/*public function via($notifiable)
|
|
||||||
{
|
|
||||||
return $this->channels;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return DiscordMessage|null
|
|
||||||
*/
|
|
||||||
public function toDiscordChannel($notifiable): ?DiscordMessage
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,10 @@ abstract class Repository extends BaseRepository
|
|||||||
$page = (int) request()->query('page', 1);
|
$page = (int) request()->query('page', 1);
|
||||||
|
|
||||||
$results = $this->model->{$method}($limit, $columns, 'page', $page);
|
$results = $this->model->{$method}($limit, $columns, 'page', $page);
|
||||||
$results->appends(app('request')->query());
|
|
||||||
|
$qs = request()->except(['page', 'user']);
|
||||||
|
$results->appends($qs);
|
||||||
|
|
||||||
$this->resetModel();
|
$this->resetModel();
|
||||||
|
|
||||||
return $this->parserResult($results);
|
return $this->parserResult($results);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use ArrayAccess;
|
use ArrayAccess;
|
||||||
use PhpUnitsOfMeasure\Exception\UnknownUnitOfMeasure;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract unit wrapper
|
* Abstract unit wrapper
|
||||||
@@ -11,45 +10,89 @@ use PhpUnitsOfMeasure\Exception\UnknownUnitOfMeasure;
|
|||||||
class Unit implements ArrayAccess
|
class Unit implements ArrayAccess
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The unit this is kept as
|
* The localized unit the user wants it displayed in
|
||||||
*/
|
*/
|
||||||
public $unit;
|
public string $localUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All of the units of this class
|
* The unit that this value is stored in locally
|
||||||
*/
|
*/
|
||||||
public $units;
|
public string $internalUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All of the units of this class which are reported in an API response
|
||||||
|
*/
|
||||||
|
public array $units;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds an instance of the PhpUnit type
|
* Holds an instance of the PhpUnit type
|
||||||
*
|
|
||||||
* @var \PhpUnitsOfMeasure\AbstractPhysicalQuantity
|
|
||||||
*/
|
*/
|
||||||
protected $instance;
|
protected mixed $instance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Units that are included as part of the REST response
|
* Units that are included as part of the REST response
|
||||||
*/
|
*/
|
||||||
public $responseUnits = [];
|
public array $responseUnits = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* Factory method for creating a new unit type
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
* @param string $unit
|
||||||
|
*
|
||||||
|
* @throws \Exception
|
||||||
|
*
|
||||||
|
* @return Unit
|
||||||
*/
|
*/
|
||||||
public function value()
|
public static function make(mixed $value, string $unit): self
|
||||||
{
|
{
|
||||||
return $this->__toString();
|
if ($value instanceof self) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new static($value, $unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the value in an internal format
|
||||||
|
*
|
||||||
|
* @param int|null $round Optional value to round to
|
||||||
|
*
|
||||||
|
* @return float|null
|
||||||
|
*/
|
||||||
|
public function internal(?int $round = null): ?float
|
||||||
|
{
|
||||||
|
return $this->toUnit($this->internalUnit, $round);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the value in the localized format
|
||||||
|
*
|
||||||
|
* @param int|null $round Optional value to round to
|
||||||
|
*
|
||||||
|
* @return float|null
|
||||||
|
*/
|
||||||
|
public function local(?int $round = null): ?float
|
||||||
|
{
|
||||||
|
return $this->toUnit($this->localUnit, $round);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Just call toUnit() on the PhpUnitOfMeasure instance
|
* Just call toUnit() on the PhpUnitOfMeasure instance
|
||||||
*
|
*
|
||||||
* @param string $unit
|
* @param string $unit
|
||||||
|
* @param int|null $round Optional value to round to
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return float|null
|
||||||
*/
|
*/
|
||||||
public function toUnit($unit)
|
public function toUnit(string $unit, ?int $round = null): ?float
|
||||||
{
|
{
|
||||||
return $this->instance->toUnit($unit);
|
$val = $this->instance->toUnit($unit);
|
||||||
|
if ($round === null) {
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
return round($val, $round);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,7 +102,7 @@ class Unit implements ArrayAccess
|
|||||||
{
|
{
|
||||||
$response = [];
|
$response = [];
|
||||||
foreach ($this->responseUnits as $unit) {
|
foreach ($this->responseUnits as $unit) {
|
||||||
$response[$unit] = $this[$unit] ?? 0;
|
$response[$unit] = round($this->instance->toUnit($unit), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
@@ -72,7 +115,7 @@ class Unit implements ArrayAccess
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function offsetExists($offset)
|
public function offsetExists($offset): bool
|
||||||
{
|
{
|
||||||
return $this->offsetGet($offset) !== null;
|
return $this->offsetGet($offset) !== null;
|
||||||
}
|
}
|
||||||
@@ -80,19 +123,15 @@ class Unit implements ArrayAccess
|
|||||||
/**
|
/**
|
||||||
* Implements ArrayAccess
|
* Implements ArrayAccess
|
||||||
*
|
*
|
||||||
* @param $offset
|
* @param $unit
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return float|null
|
||||||
*/
|
*/
|
||||||
public function offsetGet($offset)
|
public function offsetGet($unit): ?float
|
||||||
{
|
{
|
||||||
try {
|
$value = $this->instance->toUnit($unit);
|
||||||
$value = $this->instance->toUnit($offset);
|
if (!$value) {
|
||||||
if (!$value) {
|
return null;
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (UnknownUnitOfMeasure $e) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return round($value, 2);
|
return round($value, 2);
|
||||||
@@ -124,6 +163,6 @@ class Unit implements ArrayAccess
|
|||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
return (string) $this->offsetGet($this->unit);
|
return (string) $this->offsetGet($this->localUnit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Log;
|
|||||||
*/
|
*/
|
||||||
class ClearExpiredSimbrief extends Listener
|
class ClearExpiredSimbrief extends Listener
|
||||||
{
|
{
|
||||||
private $simbriefSvc;
|
private SimBriefService $simbriefSvc;
|
||||||
|
|
||||||
public function __construct(SimBriefService $simbriefSvc)
|
public function __construct(SimBriefService $simbriefSvc)
|
||||||
{
|
{
|
||||||
@@ -20,7 +20,7 @@ class ClearExpiredSimbrief extends Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \App\Events\CronNightly $event
|
* @param CronHourly $event
|
||||||
*/
|
*/
|
||||||
public function handle(CronHourly $event): void
|
public function handle(CronHourly $event): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Cron\Hourly;
|
|||||||
use App\Contracts\Listener;
|
use App\Contracts\Listener;
|
||||||
use App\Events\CronHourly;
|
use App\Events\CronHourly;
|
||||||
use App\Models\Enums\PirepState;
|
use App\Models\Enums\PirepState;
|
||||||
|
use App\Models\Enums\PirepStatus;
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
use App\Services\PirepService;
|
use App\Services\PirepService;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
@@ -38,7 +39,10 @@ class DeletePireps extends Listener
|
|||||||
protected function deletePireps(int $expire_time_hours, int $state)
|
protected function deletePireps(int $expire_time_hours, int $state)
|
||||||
{
|
{
|
||||||
$dt = Carbon::now('UTC')->subHours($expire_time_hours);
|
$dt = Carbon::now('UTC')->subHours($expire_time_hours);
|
||||||
$pireps = Pirep::where('created_at', '<', $dt)->where(['state' => $state])->get();
|
$pireps = Pirep::where('created_at', '<', $dt)
|
||||||
|
->where(['state' => $state])
|
||||||
|
->where('status', '<>', PirepStatus::PAUSED)
|
||||||
|
->get();
|
||||||
|
|
||||||
/** @var PirepService $pirepSvc */
|
/** @var PirepService $pirepSvc */
|
||||||
$pirepSvc = app(PirepService::class);
|
$pirepSvc = app(PirepService::class);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Contracts\Listener;
|
|||||||
use App\Events\CronHourly;
|
use App\Events\CronHourly;
|
||||||
use App\Events\PirepCancelled;
|
use App\Events\PirepCancelled;
|
||||||
use App\Models\Enums\PirepState;
|
use App\Models\Enums\PirepState;
|
||||||
|
use App\Models\Enums\PirepStatus;
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
@@ -31,7 +32,9 @@ class RemoveExpiredLiveFlights extends Listener
|
|||||||
$date = Carbon::now('UTC')->subHours(setting('acars.live_time'));
|
$date = Carbon::now('UTC')->subHours(setting('acars.live_time'));
|
||||||
$pireps = Pirep::where('updated_at', '<', $date)
|
$pireps = Pirep::where('updated_at', '<', $date)
|
||||||
->where('state', PirepState::IN_PROGRESS)
|
->where('state', PirepState::IN_PROGRESS)
|
||||||
|
->where('status', '<>', PirepStatus::PAUSED)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
foreach ($pireps as $pirep) {
|
foreach ($pireps as $pirep) {
|
||||||
event(new PirepCancelled($pirep));
|
event(new PirepCancelled($pirep));
|
||||||
Log::info('Cron: Deleting Expired Live PIREP id='.$pirep->id.', state='.PirepState::label($pirep->state));
|
Log::info('Cron: Deleting Expired Live PIREP id='.$pirep->id.', state='.PirepState::label($pirep->state));
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Log;
|
|||||||
*/
|
*/
|
||||||
class ApplyExpenses extends Listener
|
class ApplyExpenses extends Listener
|
||||||
{
|
{
|
||||||
private $financeSvc;
|
private RecurringFinanceService $financeSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ApplyExpenses constructor.
|
* ApplyExpenses constructor.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Log;
|
|||||||
*/
|
*/
|
||||||
class ApplyExpenses extends Listener
|
class ApplyExpenses extends Listener
|
||||||
{
|
{
|
||||||
private $financeSvc;
|
private RecurringFinanceService $financeSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ApplyExpenses constructor.
|
* ApplyExpenses constructor.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Log;
|
|||||||
|
|
||||||
class NewVersionCheck extends Listener
|
class NewVersionCheck extends Listener
|
||||||
{
|
{
|
||||||
private $versionSvc;
|
private VersionService $versionSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param VersionService $versionSvc
|
* @param VersionService $versionSvc
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Log;
|
|||||||
*/
|
*/
|
||||||
class PilotLeave extends Listener
|
class PilotLeave extends Listener
|
||||||
{
|
{
|
||||||
private $userSvc;
|
private UserService $userSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PilotLeave constructor.
|
* PilotLeave constructor.
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ use App\Contracts\Listener;
|
|||||||
use App\Events\CronNightly;
|
use App\Events\CronNightly;
|
||||||
use App\Models\Journal;
|
use App\Models\Journal;
|
||||||
use App\Repositories\JournalRepository;
|
use App\Repositories\JournalRepository;
|
||||||
use Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This recalculates the balances on all of the journals
|
* This recalculates the balances on all of the journals
|
||||||
*/
|
*/
|
||||||
class RecalculateBalances extends Listener
|
class RecalculateBalances extends Listener
|
||||||
{
|
{
|
||||||
private $journalRepo;
|
private JournalRepository $journalRepo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nightly constructor.
|
* Nightly constructor.
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ use Illuminate\Support\Facades\Log;
|
|||||||
*/
|
*/
|
||||||
class RecalculateStats extends Listener
|
class RecalculateStats extends Listener
|
||||||
{
|
{
|
||||||
private $aircraftSvc;
|
private AircraftService $aircraftSvc;
|
||||||
private $userSvc;
|
private UserService $userSvc;
|
||||||
|
|
||||||
public function __construct(AircraftService $aircraftSvc, UserService $userSvc)
|
public function __construct(AircraftService $aircraftSvc, UserService $userSvc)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,23 +1,43 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Faker\Generator as Faker;
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
$factory->define(App\Models\Acars::class, function (Faker $faker) {
|
namespace App\Database\Factories;
|
||||||
return [
|
|
||||||
'id' => null,
|
use App\Contracts\Factory;
|
||||||
'pirep_id' => null,
|
use App\Models\Acars;
|
||||||
'log' => $faker->text(100),
|
use DateTime;
|
||||||
'lat' => $faker->latitude,
|
|
||||||
'lon' => $faker->longitude,
|
class AcarsFactory extends Factory
|
||||||
'distance' => $faker->randomFloat(2, 0, 6000),
|
{
|
||||||
'heading' => $faker->numberBetween(0, 359),
|
/**
|
||||||
'altitude' => $faker->numberBetween(20, 400),
|
* The name of the factory's corresponding model.
|
||||||
'vs' => $faker->numberBetween(-5000, 5000),
|
*
|
||||||
'gs' => $faker->numberBetween(300, 500),
|
* @var string
|
||||||
'transponder' => $faker->numberBetween(200, 9999),
|
*/
|
||||||
'autopilot' => $faker->text(10),
|
protected $model = Acars::class;
|
||||||
'fuel' => $faker->randomFloat(2, 100, 1000),
|
|
||||||
'fuel_flow' => $faker->randomFloat(2, 100, 1000),
|
/**
|
||||||
'sim_time' => $faker->dateTime('now', 'UTC'),
|
* @return array <string, mixed>
|
||||||
];
|
*/
|
||||||
});
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => null,
|
||||||
|
'pirep_id' => null,
|
||||||
|
'log' => $this->faker->text(100),
|
||||||
|
'lat' => $this->faker->latitude,
|
||||||
|
'lon' => $this->faker->longitude,
|
||||||
|
'distance' => $this->faker->randomFloat(2, 0, 6000),
|
||||||
|
'heading' => $this->faker->numberBetween(0, 359),
|
||||||
|
'altitude' => $this->faker->numberBetween(20, 400),
|
||||||
|
'vs' => $this->faker->numberBetween(-5000, 5000),
|
||||||
|
'gs' => $this->faker->numberBetween(300, 500),
|
||||||
|
'transponder' => $this->faker->numberBetween(200, 9999),
|
||||||
|
'autopilot' => $this->faker->text(10),
|
||||||
|
'fuel' => $this->faker->randomFloat(2, 100, 1000),
|
||||||
|
'fuel_flow' => $this->faker->randomFloat(2, 100, 1000),
|
||||||
|
'sim_time' => $this->faker->dateTime('now', 'UTC')->format(DateTime::ATOM),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,33 +1,51 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
|
namespace App\Database\Factories;
|
||||||
|
|
||||||
|
use App\Contracts\Factory;
|
||||||
|
use App\Models\Aircraft;
|
||||||
use App\Models\Airport;
|
use App\Models\Airport;
|
||||||
use App\Models\Enums\AircraftState;
|
use App\Models\Enums\AircraftState;
|
||||||
use App\Models\Enums\AircraftStatus;
|
use App\Models\Enums\AircraftStatus;
|
||||||
use App\Models\Subfleet;
|
use App\Models\Subfleet;
|
||||||
use App\Support\ICAO;
|
use App\Support\ICAO;
|
||||||
use Faker\Generator as Faker;
|
use DateTime;
|
||||||
|
|
||||||
$factory->define(App\Models\Aircraft::class, function (Faker $faker) {
|
class AircraftFactory extends Factory
|
||||||
return [
|
{
|
||||||
'id' => null,
|
/**
|
||||||
'subfleet_id' => function () {
|
* The name of the factory's corresponding model.
|
||||||
return factory(Subfleet::class)->create()->id;
|
*
|
||||||
},
|
* @var string
|
||||||
'airport_id' => function () {
|
*/
|
||||||
return factory(Airport::class)->create()->id;
|
protected $model = Aircraft::class;
|
||||||
},
|
|
||||||
'iata' => $faker->unique()->text(5),
|
/**
|
||||||
'icao' => $faker->unique()->text(5),
|
* Define the model's default state.
|
||||||
'name' => $faker->text(50),
|
*
|
||||||
'registration' => $faker->unique()->text(10),
|
* @throws \Exception
|
||||||
'hex_code' => ICAO::createHexCode(),
|
*
|
||||||
'mtow' => $faker->randomFloat(2, 0, 50000),
|
* @return array<string, mixed>
|
||||||
'zfw' => $faker->randomFloat(2, 0, 50000),
|
*/
|
||||||
'status' => AircraftStatus::ACTIVE,
|
public function definition(): array
|
||||||
'state' => AircraftState::PARKED,
|
{
|
||||||
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
|
return [
|
||||||
'updated_at' => function (array $pirep) {
|
'id' => null,
|
||||||
return $pirep['created_at'];
|
'subfleet_id' => fn () => Subfleet::factory()->create()->id,
|
||||||
},
|
'airport_id' => fn () => Airport::factory()->create()->id,
|
||||||
];
|
'iata' => $this->faker->unique()->text(5),
|
||||||
});
|
'icao' => $this->faker->unique()->text(5),
|
||||||
|
'name' => $this->faker->text(50),
|
||||||
|
'registration' => $this->faker->unique()->text(10),
|
||||||
|
'hex_code' => ICAO::createHexCode(),
|
||||||
|
'mtow' => $this->faker->randomFloat(2, 0, 50000),
|
||||||
|
'zfw' => $this->faker->randomFloat(2, 0, 50000),
|
||||||
|
'status' => AircraftStatus::ACTIVE,
|
||||||
|
'state' => AircraftState::PARKED,
|
||||||
|
'created_at' => $this->faker->dateTimeBetween('-1 week')->format(DateTime::ATOM),
|
||||||
|
'updated_at' => fn (array $pirep) => $pirep['created_at'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,25 +1,41 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Faker\Generator as Faker;
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
|
namespace App\Database\Factories;
|
||||||
|
|
||||||
|
use App\Contracts\Factory;
|
||||||
|
use App\Models\Airline;
|
||||||
use Hashids\Hashids;
|
use Hashids\Hashids;
|
||||||
|
|
||||||
/*
|
class AirlineFactory extends Factory
|
||||||
* Add any number of airports. Don't really care if they're real or not
|
{
|
||||||
*/
|
/**
|
||||||
$factory->define(App\Models\Airline::class, function (Faker $faker) {
|
* The name of the factory's corresponding model.
|
||||||
return [
|
*
|
||||||
'id' => null,
|
* @var string
|
||||||
'icao' => function (array $apt) {
|
*/
|
||||||
$hashids = new Hashids(microtime(), 5);
|
protected $model = Airline::class;
|
||||||
$mt = str_replace('.', '', microtime(true));
|
|
||||||
|
|
||||||
return $hashids->encode($mt);
|
/**
|
||||||
},
|
* Define the model's default state.
|
||||||
'iata' => function (array $apt) {
|
*
|
||||||
return $apt['icao'];
|
* @return array<string, mixed>
|
||||||
},
|
*/
|
||||||
'name' => $faker->sentence(3),
|
public function definition(): array
|
||||||
'country' => $faker->country,
|
{
|
||||||
'active' => 1,
|
return [
|
||||||
];
|
'id' => null,
|
||||||
});
|
'icao' => function (array $apt): string {
|
||||||
|
$hashids = new Hashids(microtime(), 5);
|
||||||
|
$mt = str_replace('.', '', microtime(true));
|
||||||
|
|
||||||
|
return $hashids->encode($mt);
|
||||||
|
},
|
||||||
|
'iata' => fn (array $apt) => $apt['icao'],
|
||||||
|
'name' => $this->faker->sentence(3),
|
||||||
|
'country' => $this->faker->country,
|
||||||
|
'active' => 1,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,12 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Faker\Generator as Faker;
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
/*
|
namespace App\Database\Factories;
|
||||||
* Create an ICAO for use in the factory.
|
|
||||||
*/
|
use App\Contracts\Factory;
|
||||||
if (!function_exists('createFactoryICAO')) {
|
use App\Models\Airport;
|
||||||
function createFactoryICAO(): string
|
|
||||||
|
class AirportFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = Airport::class;
|
||||||
|
|
||||||
|
protected array $usedIcaos = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a fake ICAO
|
||||||
|
*
|
||||||
|
* @throws \Exception
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function createFactoryICAO(): string
|
||||||
{
|
{
|
||||||
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||||
$max = strlen($characters) - 1;
|
$max = strlen($characters) - 1;
|
||||||
@@ -20,37 +39,35 @@ if (!function_exists('createFactoryICAO')) {
|
|||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => function () {
|
||||||
|
do {
|
||||||
|
$airport = $this->createFactoryICAO();
|
||||||
|
} while (in_array($airport, $this->usedIcaos, true));
|
||||||
|
|
||||||
|
return $airport;
|
||||||
|
},
|
||||||
|
'icao' => fn (array $apt) => $apt['id'],
|
||||||
|
'iata' => fn (array $apt) => $apt['id'],
|
||||||
|
'name' => $this->faker->sentence(3),
|
||||||
|
'country' => $this->faker->country,
|
||||||
|
'timezone' => $this->faker->timezone,
|
||||||
|
'lat' => $this->faker->latitude,
|
||||||
|
'lon' => $this->faker->longitude,
|
||||||
|
'hub' => false,
|
||||||
|
'notes' => null,
|
||||||
|
'ground_handling_cost' => $this->faker->randomFloat(2, 0, 500),
|
||||||
|
'fuel_100ll_cost' => $this->faker->randomFloat(2, 1, 10),
|
||||||
|
'fuel_jeta_cost' => $this->faker->randomFloat(2, 1, 10),
|
||||||
|
'fuel_mogas_cost' => $this->faker->randomFloat(2, 1, 10),
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Add any number of airports. Don't really care if they're real or not
|
|
||||||
*/
|
|
||||||
$factory->define(App\Models\Airport::class, function (Faker $faker) {
|
|
||||||
$usedIcaos = [];
|
|
||||||
|
|
||||||
return [
|
|
||||||
'id' => function () use ($usedIcaos) {
|
|
||||||
do {
|
|
||||||
$airport = createFactoryICAO();
|
|
||||||
} while (in_array($airport, $usedIcaos, true));
|
|
||||||
|
|
||||||
return $airport;
|
|
||||||
},
|
|
||||||
'icao' => function (array $apt) {
|
|
||||||
return $apt['id'];
|
|
||||||
},
|
|
||||||
'iata' => function (array $apt) {
|
|
||||||
return $apt['id'];
|
|
||||||
},
|
|
||||||
'name' => $faker->sentence(3),
|
|
||||||
'country' => $faker->country,
|
|
||||||
'timezone' => $faker->timezone,
|
|
||||||
'lat' => $faker->latitude,
|
|
||||||
'lon' => $faker->longitude,
|
|
||||||
'hub' => false,
|
|
||||||
'ground_handling_cost' => $faker->randomFloat(2, 0, 500),
|
|
||||||
'fuel_100ll_cost' => $faker->randomFloat(2, 1, 10),
|
|
||||||
'fuel_jeta_cost' => $faker->randomFloat(2, 1, 10),
|
|
||||||
'fuel_mogas_cost' => $faker->randomFloat(2, 1, 10),
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|||||||
34
app/Database/factories/AwardFactory.php
Normal file
34
app/Database/factories/AwardFactory.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
|
namespace App\Database\Factories;
|
||||||
|
|
||||||
|
use App\Contracts\Factory;
|
||||||
|
use App\Models\Award;
|
||||||
|
|
||||||
|
class AwardFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = Award::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => null,
|
||||||
|
'name' => $this->faker->name,
|
||||||
|
'description' => $this->faker->text(10),
|
||||||
|
'ref_model' => null,
|
||||||
|
'ref_model_params' => null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Faker\Generator as Faker;
|
|
||||||
|
|
||||||
$factory->define(App\Models\Award::class, function (Faker $faker) {
|
|
||||||
return [
|
|
||||||
'id' => null,
|
|
||||||
'name' => $faker->name,
|
|
||||||
'description' => $faker->text(10),
|
|
||||||
'ref_model' => null,
|
|
||||||
'ref_model_params' => null,
|
|
||||||
];
|
|
||||||
});
|
|
||||||
@@ -1,18 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Enums\ExpenseType;
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
use Faker\Generator as Faker;
|
|
||||||
|
|
||||||
$factory->define(App\Models\Expense::class, function (Faker $faker) {
|
namespace App\Database\Factories;
|
||||||
return [
|
|
||||||
'id' => null,
|
use App\Contracts\Factory;
|
||||||
'airline_id' => null,
|
use App\Models\Enums\ExpenseType;
|
||||||
'name' => $faker->text(20),
|
use App\Models\Expense;
|
||||||
'amount' => $faker->randomFloat(2, 100, 1000),
|
|
||||||
'type' => ExpenseType::FLIGHT,
|
class ExpenseFactory extends Factory
|
||||||
'multiplier' => false,
|
{
|
||||||
'ref_model' => \App\Models\Expense::class,
|
/**
|
||||||
'ref_model_id' => null,
|
* The name of the factory's corresponding model.
|
||||||
'active' => true,
|
*
|
||||||
];
|
* @var string
|
||||||
});
|
*/
|
||||||
|
protected $model = Expense::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => null,
|
||||||
|
'airline_id' => null,
|
||||||
|
'name' => $this->faker->text(20),
|
||||||
|
'amount' => $this->faker->randomFloat(2, 100, 1000),
|
||||||
|
'type' => ExpenseType::FLIGHT,
|
||||||
|
'multiplier' => false,
|
||||||
|
'ref_model' => \App\Models\Expense::class,
|
||||||
|
'ref_model_id' => null,
|
||||||
|
'active' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,16 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Faker\Generator as Faker;
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
$factory->define(App\Models\Fare::class, function (Faker $faker) {
|
namespace App\Database\Factories;
|
||||||
return [
|
|
||||||
'id' => null,
|
use App\Contracts\Factory;
|
||||||
'code' => $faker->unique()->text(50),
|
use App\Models\Fare;
|
||||||
'name' => $faker->text(50),
|
|
||||||
'price' => $faker->randomFloat(2, 100, 1000),
|
class FareFactory extends Factory
|
||||||
'cost' => function (array $fare) {
|
{
|
||||||
return round($fare['price'] / 2);
|
/**
|
||||||
},
|
* The name of the factory's corresponding model.
|
||||||
'capacity' => $faker->randomFloat(0, 20, 500),
|
*
|
||||||
];
|
* @var string
|
||||||
});
|
*/
|
||||||
|
protected $model = Fare::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => null,
|
||||||
|
'code' => $this->faker->unique()->text(50),
|
||||||
|
'name' => $this->faker->text(50),
|
||||||
|
'price' => $this->faker->randomFloat(2, 100, 1000),
|
||||||
|
'cost' => fn (array $fare) => round($fare['price'] / 2),
|
||||||
|
'capacity' => $this->faker->randomFloat(0, 20, 500),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,44 +1,58 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Create flights
|
|
||||||
*/
|
|
||||||
use Faker\Generator as Faker;
|
|
||||||
|
|
||||||
$factory->define(App\Models\Flight::class, function (Faker $faker) {
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
return [
|
|
||||||
'id' => $faker->unique()->numberBetween(10, 10000000),
|
namespace App\Database\Factories;
|
||||||
'airline_id' => function () {
|
|
||||||
return factory(\App\Models\Airline::class)->create()->id;
|
use App\Contracts\Factory;
|
||||||
},
|
use App\Models\Flight;
|
||||||
'flight_number' => $faker->unique()->numberBetween(10, 1000000),
|
use DateTime;
|
||||||
'route_code' => $faker->randomElement(['', $faker->text(5)]),
|
|
||||||
'route_leg' => $faker->randomElement(['', $faker->numberBetween(0, 1000)]),
|
class FlightFactory extends Factory
|
||||||
'dpt_airport_id' => function () {
|
{
|
||||||
return factory(\App\Models\Airport::class)->create()->id;
|
/**
|
||||||
},
|
* The name of the factory's corresponding model.
|
||||||
'arr_airport_id' => function () {
|
*
|
||||||
return factory(\App\Models\Airport::class)->create()->id;
|
* @var string
|
||||||
},
|
*/
|
||||||
'alt_airport_id' => function () {
|
protected $model = Flight::class;
|
||||||
return factory(\App\Models\Airport::class)->create()->id;
|
|
||||||
},
|
/**
|
||||||
'distance' => $faker->numberBetween(1, 1000),
|
* Define the model's default state.
|
||||||
'route' => null,
|
*
|
||||||
'level' => 0,
|
* @return array<string, mixed>
|
||||||
'dpt_time' => $faker->time(),
|
*/
|
||||||
'arr_time' => $faker->time(),
|
public function definition(): array
|
||||||
'flight_time' => $faker->numberBetween(60, 360),
|
{
|
||||||
'load_factor' => $faker->randomElement([15, 20, 50, 90, 100]),
|
return [
|
||||||
'load_factor_variance' => $faker->randomElement([15, 20, 50, 90, 100]),
|
'id' => $this->faker->unique()->numberBetween(10, 10000000),
|
||||||
'has_bid' => false,
|
'airline_id' => fn () => \App\Models\Airline::factory()->create()->id,
|
||||||
'active' => true,
|
'flight_number' => $this->faker->unique()->numberBetween(10, 1000000),
|
||||||
'visible' => true,
|
'route_code' => $this->faker->randomElement(['', $this->faker->text(5)]),
|
||||||
'days' => 0,
|
'route_leg' => $this->faker->randomElement(
|
||||||
'start_date' => null,
|
['', $this->faker->numberBetween(0, 1000)]
|
||||||
'end_date' => null,
|
),
|
||||||
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
|
'dpt_airport_id' => static fn () => \App\Models\Airport::factory()->create()->id,
|
||||||
'updated_at' => static function (array $flight) {
|
'arr_airport_id' => static fn () => \App\Models\Airport::factory()->create()->id,
|
||||||
return $flight['created_at'];
|
'alt_airport_id' => static fn () => \App\Models\Airport::factory()->create()->id,
|
||||||
},
|
'distance' => $this->faker->numberBetween(1, 1000),
|
||||||
];
|
'route' => null,
|
||||||
});
|
'level' => 0,
|
||||||
|
'dpt_time' => $this->faker->time(),
|
||||||
|
'arr_time' => $this->faker->time(),
|
||||||
|
'flight_time' => $this->faker->numberBetween(60, 360),
|
||||||
|
'load_factor' => $this->faker->randomElement([15, 20, 50, 90, 100]),
|
||||||
|
'load_factor_variance' => $this->faker->randomElement([15, 20, 50, 90, 100]),
|
||||||
|
'has_bid' => false,
|
||||||
|
'active' => true,
|
||||||
|
'visible' => true,
|
||||||
|
'days' => 0,
|
||||||
|
'start_date' => null,
|
||||||
|
'end_date' => null,
|
||||||
|
'created_at' => $this->faker->dateTimeBetween('-1 week')->format(
|
||||||
|
DateTime::ATOM
|
||||||
|
),
|
||||||
|
'updated_at' => static fn (array $flight) => $flight['created_at'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Faker\Generator as Faker;
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
$factory->define(App\Models\Journal::class, function (Faker $faker) {
|
namespace App\Database\Factories;
|
||||||
return [
|
|
||||||
'currency' => 'USD',
|
use App\Contracts\Factory;
|
||||||
];
|
use App\Models\Journal;
|
||||||
});
|
|
||||||
|
class JournalFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = Journal::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'currency' => 'USD',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,20 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
|
namespace App\Database\Factories;
|
||||||
|
|
||||||
|
use App\Contracts\Factory;
|
||||||
use App\Models\Journal;
|
use App\Models\Journal;
|
||||||
|
use App\Models\JournalTransaction;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Faker\Generator as Faker;
|
|
||||||
use Ramsey\Uuid\Uuid;
|
use Ramsey\Uuid\Uuid;
|
||||||
|
|
||||||
$factory->define(App\Models\JournalTransaction::class, function (Faker $faker) {
|
class JournalTransactionsFactory extends Factory
|
||||||
return [
|
{
|
||||||
'transaction_group' => Uuid::uuid4()->toString(),
|
/**
|
||||||
'journal_id' => function () {
|
* The name of the factory's corresponding model.
|
||||||
return factory(Journal::class)->create()->id;
|
*
|
||||||
},
|
* @var string
|
||||||
'credit' => $faker->numberBetween(100, 10000),
|
*/
|
||||||
'debit' => $faker->numberBetween(100, 10000),
|
protected $model = JournalTransaction::class;
|
||||||
'currency' => 'USD',
|
|
||||||
'memo' => $faker->sentence(6),
|
/**
|
||||||
'post_date' => Carbon::now('UTC'),
|
* Define the model's default state.
|
||||||
];
|
*
|
||||||
});
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'transaction_group' => Uuid::uuid4()->toString(),
|
||||||
|
'journal_id' => fn () => Journal::factory()->create()->id,
|
||||||
|
'credit' => $this->faker->numberBetween(100, 10000),
|
||||||
|
'debit' => $this->faker->numberBetween(100, 10000),
|
||||||
|
'currency' => 'USD',
|
||||||
|
'memo' => $this->faker->sentence(6),
|
||||||
|
'post_date' => Carbon::now('UTC')->toDateTimeString(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,15 +1,36 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Enums\NavaidType;
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
use Faker\Generator as Faker;
|
|
||||||
|
|
||||||
$factory->define(App\Models\Navdata::class, function (Faker $faker) {
|
namespace App\Database\Factories;
|
||||||
return [
|
|
||||||
'id' => str_replace(' ', '', str_replace('.', '', $faker->unique()->text(5))),
|
use App\Contracts\Factory;
|
||||||
'name' => str_replace('.', '', $faker->unique()->word),
|
use App\Models\Enums\NavaidType;
|
||||||
'type' => $faker->randomElement([NavaidType::VOR, NavaidType::NDB]),
|
use App\Models\Navdata;
|
||||||
'lat' => $faker->latitude,
|
|
||||||
'lon' => $faker->longitude,
|
class NavdataFactory extends Factory
|
||||||
'freq' => $faker->randomFloat(2, 100, 1000),
|
{
|
||||||
];
|
/**
|
||||||
});
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = Navdata::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => str_replace(' ', '', str_replace('.', '', $this->faker->unique()->text(5))),
|
||||||
|
'name' => str_replace('.', '', $this->faker->unique()->word),
|
||||||
|
'type' => $this->faker->randomElement([NavaidType::VOR, NavaidType::NDB]),
|
||||||
|
'lat' => $this->faker->latitude,
|
||||||
|
'lon' => $this->faker->longitude,
|
||||||
|
'freq' => $this->faker->randomFloat(2, 100, 1000),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,14 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Faker\Generator as Faker;
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
$factory->define(App\Models\News::class, function (Faker $faker) {
|
namespace App\Database\Factories;
|
||||||
return [
|
|
||||||
'id' => null,
|
use App\Contracts\Factory;
|
||||||
'user_id' => function () {
|
use App\Models\News;
|
||||||
return factory(\App\Models\User::class)->create()->id;
|
|
||||||
},
|
class NewsFactory extends Factory
|
||||||
'subject' => $faker->text(),
|
{
|
||||||
'body' => $faker->sentence,
|
/**
|
||||||
];
|
* The name of the factory's corresponding model.
|
||||||
});
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = News::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => null,
|
||||||
|
'user_id' => fn () => \App\Models\User::factory()->create()->id,
|
||||||
|
'subject' => $this->faker->text(),
|
||||||
|
'body' => $this->faker->sentence,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,69 +1,74 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
|
namespace App\Database\Factories;
|
||||||
|
|
||||||
|
use App\Contracts\Factory;
|
||||||
|
use App\Models\Airline;
|
||||||
use App\Models\Enums\PirepSource;
|
use App\Models\Enums\PirepSource;
|
||||||
use App\Models\Enums\PirepState;
|
use App\Models\Enums\PirepState;
|
||||||
use App\Models\Enums\PirepStatus;
|
use App\Models\Enums\PirepStatus;
|
||||||
|
use App\Models\Flight;
|
||||||
|
use App\Models\Pirep;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Faker\Generator as Faker;
|
|
||||||
|
|
||||||
/*
|
class PirepFactory extends Factory
|
||||||
* Create a new PIREP
|
{
|
||||||
*/
|
/**
|
||||||
$factory->define(App\Models\Pirep::class, function (Faker $faker) {
|
* The name of the factory's corresponding model.
|
||||||
$airline = factory(\App\Models\Airline::class)->create();
|
*
|
||||||
$flight = factory(\App\Models\Flight::class)->create([
|
* @var string
|
||||||
'airline_id' => $airline->id,
|
*/
|
||||||
]);
|
protected $model = Pirep::class;
|
||||||
|
|
||||||
return [
|
/**
|
||||||
'id' => $faker->unique()->numberBetween(10, 10000000),
|
* Define the model's default state.
|
||||||
'airline_id' => function () use ($airline) {
|
*
|
||||||
return $airline->id;
|
* @return array<string, mixed>
|
||||||
},
|
*/
|
||||||
'user_id' => function () {
|
public function definition(): array
|
||||||
return factory(\App\Models\User::class)->create()->id;
|
{
|
||||||
},
|
/** @var Airline $airline */
|
||||||
'aircraft_id' => function () {
|
$airline = Airline::factory()->create();
|
||||||
return factory(\App\Models\Aircraft::class)->create()->id;
|
|
||||||
},
|
/** @var Flight $flight */
|
||||||
'flight_id' => function () use ($flight) {
|
$flight = Flight::factory()->create(['airline_id' => $airline->id]);
|
||||||
return $flight->id;
|
|
||||||
},
|
return [
|
||||||
'flight_number' => function () use ($flight) {
|
'id' => $this->faker->unique()->numberBetween(10, 10000000),
|
||||||
return $flight->flight_number;
|
'airline_id' => fn () => $airline->id,
|
||||||
},
|
'user_id' => fn () => \App\Models\User::factory()->create()->id,
|
||||||
'route_code' => null,
|
'aircraft_id' => fn () => \App\Models\Aircraft::factory()->create()->id,
|
||||||
'route_leg' => null,
|
'flight_id' => fn () => $flight->id,
|
||||||
'dpt_airport_id' => function () use ($flight) {
|
'flight_number' => fn () => $flight->flight_number,
|
||||||
return $flight->dpt_airport_id;
|
'route_code' => null,
|
||||||
},
|
'route_leg' => null,
|
||||||
'arr_airport_id' => function () use ($flight) {
|
'dpt_airport_id' => fn () => $flight->dpt_airport_id,
|
||||||
return $flight->arr_airport_id;
|
'arr_airport_id' => fn () => $flight->arr_airport_id,
|
||||||
},
|
'level' => $this->faker->numberBetween(20, 400),
|
||||||
'level' => $faker->numberBetween(20, 400),
|
'distance' => $this->faker->randomFloat(2, 0, 6000),
|
||||||
'distance' => $faker->randomFloat(2, 0, 6000),
|
'planned_distance' => $this->faker->randomFloat(2, 0, 6000),
|
||||||
'planned_distance' => $faker->randomFloat(2, 0, 6000),
|
'flight_time' => $this->faker->numberBetween(60, 360),
|
||||||
'flight_time' => $faker->numberBetween(60, 360),
|
'planned_flight_time' => $this->faker->numberBetween(60, 360),
|
||||||
'planned_flight_time' => $faker->numberBetween(60, 360),
|
'zfw' => $this->faker->randomFloat(2),
|
||||||
'zfw' => $faker->randomFloat(2),
|
'block_fuel' => $this->faker->randomFloat(2, 0, 1000),
|
||||||
'block_fuel' => $faker->randomFloat(2, 0, 1000),
|
'fuel_used' => fn (array $pirep) => round($pirep['block_fuel'] * .9, 2),
|
||||||
'fuel_used' => function (array $pirep) {
|
'block_on_time' => Carbon::now('UTC'),
|
||||||
return round($pirep['block_fuel'] * .9, 2); // 90% of the fuel loaded was used
|
'block_off_time' => fn (array $pirep) => $pirep['block_on_time']->subMinutes(
|
||||||
},
|
$pirep['flight_time']
|
||||||
'block_on_time' => Carbon::now('UTC'),
|
),
|
||||||
'block_off_time' => function (array $pirep) {
|
'route' => $this->faker->text(200),
|
||||||
return $pirep['block_on_time']->subMinutes($pirep['flight_time']);
|
'notes' => $this->faker->text(200),
|
||||||
},
|
'source' => $this->faker->randomElement(
|
||||||
'route' => $faker->text(200),
|
[PirepSource::MANUAL, PirepSource::ACARS]
|
||||||
'notes' => $faker->text(200),
|
),
|
||||||
'source' => $faker->randomElement([PirepSource::MANUAL, PirepSource::ACARS]),
|
'source_name' => 'TestFactory',
|
||||||
'source_name' => 'TestFactory',
|
'state' => PirepState::PENDING,
|
||||||
'state' => PirepState::PENDING,
|
'status' => PirepStatus::SCHEDULED,
|
||||||
'status' => PirepStatus::SCHEDULED,
|
'submitted_at' => Carbon::now('UTC')->toDateTimeString(),
|
||||||
'submitted_at' => Carbon::now('UTC')->toDateTimeString(),
|
'created_at' => Carbon::now('UTC')->toDateTimeString(),
|
||||||
'created_at' => Carbon::now('UTC')->toDateTimeString(),
|
'updated_at' => fn (array $pirep) => $pirep['created_at'],
|
||||||
'updated_at' => function (array $pirep) {
|
];
|
||||||
return $pirep['created_at'];
|
}
|
||||||
},
|
}
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,23 +1,37 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Faker\Generator as Faker;
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
/*
|
namespace App\Database\Factories;
|
||||||
* id: 2
|
|
||||||
name: Junior First Officer
|
use App\Contracts\Factory;
|
||||||
hours: 10
|
use App\Models\Rank;
|
||||||
auto_approve_acars: 1
|
|
||||||
auto_approve_manual: 1
|
class RankFactory extends Factory
|
||||||
*/
|
{
|
||||||
$factory->define(App\Models\Rank::class, function (Faker $faker) {
|
/**
|
||||||
return [
|
* The name of the factory's corresponding model.
|
||||||
'id' => null,
|
*
|
||||||
'name' => $faker->unique()->text(50),
|
* @var string
|
||||||
'hours' => $faker->numberBetween(10, 50),
|
*/
|
||||||
'acars_base_pay_rate' => $faker->numberBetween(10, 100),
|
protected $model = Rank::class;
|
||||||
'manual_base_pay_rate' => $faker->numberBetween(10, 100),
|
|
||||||
'auto_approve_acars' => 0,
|
/**
|
||||||
'auto_approve_manual' => 0,
|
* Define the model's default state.
|
||||||
'auto_promote' => 0,
|
*
|
||||||
];
|
* @return array<string, mixed>
|
||||||
});
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => null,
|
||||||
|
'name' => $this->faker->unique()->text(50),
|
||||||
|
'hours' => $this->faker->numberBetween(10, 50),
|
||||||
|
'acars_base_pay_rate' => $this->faker->numberBetween(10, 100),
|
||||||
|
'manual_base_pay_rate' => $this->faker->numberBetween(10, 100),
|
||||||
|
'auto_approve_acars' => 0,
|
||||||
|
'auto_approve_manual' => 0,
|
||||||
|
'auto_promote' => 0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,13 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Faker\Generator as Faker;
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
$factory->define(App\Models\Role::class, function (Faker $faker) {
|
namespace App\Database\Factories;
|
||||||
return [
|
|
||||||
'id' => null,
|
use App\Contracts\Factory;
|
||||||
'name' => $faker->name,
|
use App\Models\Role;
|
||||||
'display_name' => $faker->name,
|
|
||||||
'read_only' => false,
|
class RoleFactory extends Factory
|
||||||
'disable_activity_checks' => $faker->boolean(),
|
{
|
||||||
];
|
/**
|
||||||
});
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = Role::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => null,
|
||||||
|
'name' => $this->faker->name,
|
||||||
|
'display_name' => $this->faker->name,
|
||||||
|
'read_only' => false,
|
||||||
|
'disable_activity_checks' => $this->faker->boolean(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
38
app/Database/factories/SimBriefFactory.php
Normal file
38
app/Database/factories/SimBriefFactory.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
|
namespace App\Database\Factories;
|
||||||
|
|
||||||
|
use App\Contracts\Factory;
|
||||||
|
use App\Models\SimBrief;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class SimBriefFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = SimBrief::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $this->faker->unique()->numberBetween(10, 10000000),
|
||||||
|
'user_id' => null,
|
||||||
|
'flight_id' => null,
|
||||||
|
'pirep_id' => null,
|
||||||
|
'acars_xml' => '',
|
||||||
|
'ofp_xml' => '',
|
||||||
|
'created_at' => Carbon::now('UTC')->toDateTimeString(),
|
||||||
|
'updated_at' => fn (array $sb) => $sb['created_at'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Faker\Generator as Faker;
|
|
||||||
|
|
||||||
$factory->define(App\Models\SimBrief::class, function (Faker $faker) {
|
|
||||||
return [
|
|
||||||
'id' => $faker->unique()->numberBetween(10, 10000000),
|
|
||||||
'user_id' => null,
|
|
||||||
'flight_id' => null,
|
|
||||||
'pirep_id' => null,
|
|
||||||
'acars_xml' => '',
|
|
||||||
'ofp_xml' => '',
|
|
||||||
'created_at' => Carbon::now('UTC')->toDateTimeString(),
|
|
||||||
'updated_at' => function (array $sb) {
|
|
||||||
return $sb['created_at'];
|
|
||||||
},
|
|
||||||
];
|
|
||||||
});
|
|
||||||
@@ -1,15 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Faker\Generator as Faker;
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
$factory->define(App\Models\Subfleet::class, function (Faker $faker) {
|
namespace App\Database\Factories;
|
||||||
return [
|
|
||||||
'id' => null,
|
use App\Contracts\Factory;
|
||||||
'airline_id' => function () {
|
use App\Models\Subfleet;
|
||||||
return factory(\App\Models\Airline::class)->create()->id;
|
|
||||||
},
|
class SubfleetFactory extends Factory
|
||||||
'name' => $faker->unique()->text(50),
|
{
|
||||||
'type' => $faker->unique()->text(7),
|
/**
|
||||||
'ground_handling_multiplier' => $faker->numberBetween(50, 200),
|
* The name of the factory's corresponding model.
|
||||||
];
|
*
|
||||||
});
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = Subfleet::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => null,
|
||||||
|
'airline_id' => fn () => \App\Models\Airline::factory()->create()->id,
|
||||||
|
'name' => $this->faker->unique()->text(50),
|
||||||
|
'type' => $this->faker->unique()->text(7),
|
||||||
|
'ground_handling_multiplier' => $this->faker->numberBetween(50, 200),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,28 +1,54 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** @noinspection PhpIllegalPsrClassPathInspection */
|
||||||
|
|
||||||
|
namespace App\Database\Factories;
|
||||||
|
|
||||||
|
use App\Contracts\Factory;
|
||||||
use App\Models\Airline;
|
use App\Models\Airline;
|
||||||
use App\Models\Enums\UserState;
|
use App\Models\Enums\UserState;
|
||||||
use Faker\Generator as Faker;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
$factory->define(App\Models\User::class, function (Faker $faker) {
|
class UserFactory extends Factory
|
||||||
static $password;
|
{
|
||||||
|
/**
|
||||||
|
* The name of the factory's corresponding model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $model = User::class;
|
||||||
|
|
||||||
return [
|
/**
|
||||||
'id' => null,
|
* @var string
|
||||||
'pilot_id' => null,
|
*/
|
||||||
'name' => $faker->name,
|
private static string $password;
|
||||||
'email' => $faker->safeEmail,
|
|
||||||
'password' => $password ?: $password = Hash::make('secret'),
|
/**
|
||||||
'api_key' => $faker->sha1,
|
* Define the model's default state.
|
||||||
'airline_id' => function () {
|
*
|
||||||
return factory(Airline::class)->create()->id;
|
* @return array<string, mixed>
|
||||||
},
|
*/
|
||||||
'rank_id' => 1,
|
public function definition(): array
|
||||||
'flights' => $faker->numberBetween(0, 1000),
|
{
|
||||||
'flight_time' => $faker->numberBetween(0, 10000),
|
if (empty(self::$password)) {
|
||||||
'transfer_time' => $faker->numberBetween(0, 10000),
|
self::$password = Hash::make('secret');
|
||||||
'state' => UserState::ACTIVE,
|
}
|
||||||
'remember_token' => $faker->unique()->text(5),
|
|
||||||
];
|
return [
|
||||||
});
|
'id' => null,
|
||||||
|
'pilot_id' => null,
|
||||||
|
'name' => $this->faker->name,
|
||||||
|
'email' => $this->faker->safeEmail,
|
||||||
|
'password' => self::$password,
|
||||||
|
'api_key' => $this->faker->sha1,
|
||||||
|
'airline_id' => fn () => Airline::factory()->create()->id,
|
||||||
|
'rank_id' => 1,
|
||||||
|
'flights' => $this->faker->numberBetween(0, 1000),
|
||||||
|
'flight_time' => $this->faker->numberBetween(0, 10000),
|
||||||
|
'transfer_time' => $this->faker->numberBetween(0, 10000),
|
||||||
|
'state' => UserState::ACTIVE,
|
||||||
|
'remember_token' => $this->faker->unique()->text(5),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use App\Services\Installer\SeederService;
|
use App\Services\Installer\SeederService;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
class CreateSettingsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
private $seederSvc;
|
private $seederSvc;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@@ -50,4 +49,4 @@ class CreateSettingsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('settings');
|
Schema::dropIfExists('settings');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ use App\Models\Pirep;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateUsersTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
@@ -55,4 +54,4 @@ class CreateUsersTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('users');
|
Schema::dropIfExists('users');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
use App\Contracts\Migration;
|
use App\Contracts\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class RolesPermissionsTables extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
// Create table for storing roles
|
// Create table for storing roles
|
||||||
@@ -82,4 +82,4 @@ class RolesPermissionsTables extends Migration
|
|||||||
Schema::dropIfExists('role_user');
|
Schema::dropIfExists('role_user');
|
||||||
Schema::dropIfExists('roles');
|
Schema::dropIfExists('roles');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreatePasswordResetsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('password_resets', function (Blueprint $table) {
|
Schema::create('password_resets', function (Blueprint $table) {
|
||||||
@@ -19,4 +18,4 @@ class CreatePasswordResetsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('password_resets');
|
Schema::dropIfExists('password_resets');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateSessionsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('sessions', function (Blueprint $table) {
|
Schema::create('sessions', function (Blueprint $table) {
|
||||||
@@ -22,4 +21,4 @@ class CreateSessionsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('sessions');
|
Schema::dropIfExists('sessions');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
use App\Contracts\Migration;
|
use App\Contracts\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
class CreateAirlinesTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('airlines', function (Blueprint $table) {
|
Schema::create('airlines', function (Blueprint $table) {
|
||||||
@@ -31,4 +30,4 @@ class CreateAirlinesTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('airlines');
|
Schema::dropIfExists('airlines');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ use App\Models\Enums\AircraftState;
|
|||||||
use App\Models\Enums\AircraftStatus;
|
use App\Models\Enums\AircraftStatus;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
class CreateAircraftsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('aircraft', function (Blueprint $table) {
|
Schema::create('aircraft', function (Blueprint $table) {
|
||||||
@@ -34,4 +33,4 @@ class CreateAircraftsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('aircraft');
|
Schema::dropIfExists('aircraft');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
use App\Contracts\Migration;
|
use App\Contracts\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
class CreateFaresTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('fares', function (Blueprint $table) {
|
Schema::create('fares', function (Blueprint $table) {
|
||||||
@@ -24,4 +23,4 @@ class CreateFaresTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('fares');
|
Schema::dropIfExists('fares');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
use App\Contracts\Migration;
|
use App\Contracts\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
class CreateAirportsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('airports', function (Blueprint $table) {
|
Schema::create('airports', function (Blueprint $table) {
|
||||||
@@ -33,4 +32,4 @@ class CreateAirportsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('airports');
|
Schema::dropIfExists('airports');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ use App\Contracts\Model;
|
|||||||
use App\Models\Enums\FlightType;
|
use App\Models\Enums\FlightType;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
class CreateFlightTables extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('flights', function (Blueprint $table) {
|
Schema::create('flights', function (Blueprint $table) {
|
||||||
@@ -98,4 +97,4 @@ class CreateFlightTables extends Migration
|
|||||||
Schema::drop('flight_subfleet');
|
Schema::drop('flight_subfleet');
|
||||||
Schema::drop('flights');
|
Schema::drop('flights');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
use App\Contracts\Migration;
|
use App\Contracts\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
class CreateRanksTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('ranks', function (Blueprint $table) {
|
Schema::create('ranks', function (Blueprint $table) {
|
||||||
@@ -29,4 +28,4 @@ class CreateRanksTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('ranks');
|
Schema::dropIfExists('ranks');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
use App\Contracts\Migration;
|
use App\Contracts\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
class CreateSubfleetTables extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('subfleets', function (Blueprint $table) {
|
Schema::create('subfleets', function (Blueprint $table) {
|
||||||
@@ -51,4 +50,4 @@ class CreateSubfleetTables extends Migration
|
|||||||
Schema::dropIfExists('subfleet_fare');
|
Schema::dropIfExists('subfleet_fare');
|
||||||
Schema::dropIfExists('subfleet_rank');
|
Schema::dropIfExists('subfleet_rank');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ use App\Models\Enums\PirepState;
|
|||||||
use App\Models\Enums\PirepStatus;
|
use App\Models\Enums\PirepStatus;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
class CreatePirepTables extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
@@ -106,4 +105,4 @@ class CreatePirepTables extends Migration
|
|||||||
Schema::dropIfExists('pirep_fields');
|
Schema::dropIfExists('pirep_fields');
|
||||||
Schema::dropIfExists('pirep_field_values');
|
Schema::dropIfExists('pirep_field_values');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ use App\Contracts\Model;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateBidsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('bids', function (Blueprint $table) {
|
Schema::create('bids', function (Blueprint $table) {
|
||||||
@@ -24,4 +23,4 @@ class CreateBidsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('bids');
|
Schema::dropIfExists('bids');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateJobsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('jobs', function (Blueprint $table) {
|
Schema::create('jobs', function (Blueprint $table) {
|
||||||
@@ -23,4 +22,4 @@ class CreateJobsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('jobs');
|
Schema::dropIfExists('jobs');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateFailedJobsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||||
@@ -22,4 +21,4 @@ class CreateFailedJobsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('failed_jobs');
|
Schema::dropIfExists('failed_jobs');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateNavdataTables extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -30,4 +29,4 @@ class CreateNavdataTables extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('navdata');
|
Schema::dropIfExists('navdata');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ use App\Contracts\Model;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateAcarsTables extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('acars', function (Blueprint $table) {
|
Schema::create('acars', function (Blueprint $table) {
|
||||||
@@ -43,4 +42,4 @@ class CreateAcarsTables extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('acars');
|
Schema::dropIfExists('acars');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateStatsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('stats', function (Blueprint $table) {
|
Schema::create('stats', function (Blueprint $table) {
|
||||||
@@ -24,4 +23,4 @@ class CreateStatsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('stats');
|
Schema::dropIfExists('stats');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateNewsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('news', function (Blueprint $table) {
|
Schema::create('news', function (Blueprint $table) {
|
||||||
@@ -21,4 +20,4 @@ class CreateNewsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::drop('news');
|
Schema::drop('news');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ use Illuminate\Database\Schema\Blueprint;
|
|||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Modules\Awards\Awards\PilotFlightAwards;
|
use Modules\Awards\Awards\PilotFlightAwards;
|
||||||
|
|
||||||
class CreateAwardsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('awards', function (Blueprint $table) {
|
Schema::create('awards', function (Blueprint $table) {
|
||||||
@@ -52,4 +51,4 @@ class CreateAwardsTable extends Migration
|
|||||||
Schema::dropIfExists('awards');
|
Schema::dropIfExists('awards');
|
||||||
Schema::dropIfExists('user_awards');
|
Schema::dropIfExists('user_awards');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateExpensesTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('expenses', function (Blueprint $table) {
|
Schema::create('expenses', function (Blueprint $table) {
|
||||||
@@ -34,4 +33,4 @@ class CreateExpensesTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('expenses');
|
Schema::dropIfExists('expenses');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateJournalTransactionsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('journal_transactions', function (Blueprint $table) {
|
Schema::create('journal_transactions', function (Blueprint $table) {
|
||||||
@@ -33,4 +32,4 @@ class CreateJournalTransactionsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('journal_transactions');
|
Schema::dropIfExists('journal_transactions');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateJournalsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('journals', function (Blueprint $table) {
|
Schema::create('journals', function (Blueprint $table) {
|
||||||
@@ -23,4 +22,4 @@ class CreateJournalsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('journals');
|
Schema::dropIfExists('journals');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateLedgersTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
@@ -30,4 +29,4 @@ class CreateLedgersTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('ledgers');
|
Schema::dropIfExists('ledgers');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ use App\Contracts\Model;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateFilesTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Create the files table. Acts as a morphable
|
* Create the files table. Acts as a morphable
|
||||||
*
|
*
|
||||||
@@ -40,4 +39,4 @@ class CreateFilesTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('files');
|
Schema::dropIfExists('files');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ use Illuminate\Database\Schema\Blueprint;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class AddReadonlyToRoles extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('roles', static function (Blueprint $table) {
|
Schema::table('roles', static function (Blueprint $table) {
|
||||||
@@ -25,4 +24,4 @@ class AddReadonlyToRoles extends Migration
|
|||||||
$table->dropColumn('read_only');
|
$table->dropColumn('read_only');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
* 3. Iterate through all of the users and set their `id` to the `pilot_id`
|
* 3. Iterate through all of the users and set their `id` to the `pilot_id`
|
||||||
* 4. Change the other tables column types that reference `user_id`
|
* 4. Change the other tables column types that reference `user_id`
|
||||||
*/
|
*/
|
||||||
class UsersAddPilotId extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('users', static function (Blueprint $table) {
|
Schema::table('users', static function (Blueprint $table) {
|
||||||
@@ -33,4 +32,4 @@ class UsersAddPilotId extends Migration
|
|||||||
$table->dropColumn('pilot_id');
|
$table->dropColumn('pilot_id');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use App\Contracts\Migration;
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateNotificationsTable extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('notifications', function (Blueprint $table) {
|
Schema::create('notifications', function (Blueprint $table) {
|
||||||
@@ -22,4 +21,4 @@ class CreateNotificationsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::dropIfExists('notifications');
|
Schema::dropIfExists('notifications');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
/**
|
/**
|
||||||
* Change the PIREP state column to be a TINYINT
|
* Change the PIREP state column to be a TINYINT
|
||||||
*/
|
*/
|
||||||
class PirepsChangeStateType extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
// Migrate the old rejected state
|
// Migrate the old rejected state
|
||||||
@@ -23,4 +22,4 @@ class PirepsChangeStateType extends Migration
|
|||||||
$table->unsignedSmallInteger('state')->change();
|
$table->unsignedSmallInteger('state')->change();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -8,12 +8,11 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
/**
|
/**
|
||||||
* Add a `flight_id` column to the PIREPs table
|
* Add a `flight_id` column to the PIREPs table
|
||||||
*/
|
*/
|
||||||
class PirepsAddFlightId extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('pireps', function (Blueprint $table) {
|
Schema::table('pireps', function (Blueprint $table) {
|
||||||
$table->string('flight_id', Model::ID_MAX_LENGTH)->nullable()->after('aircraft_id');
|
$table->string('flight_id', Model::ID_MAX_LENGTH)->nullable()->after('aircraft_id');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
/**
|
/**
|
||||||
* Add a `flight_type` column to the expenses table
|
* Add a `flight_type` column to the expenses table
|
||||||
*/
|
*/
|
||||||
class ExpensesAddFlightType extends Migration
|
return new class() extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('expenses', function (Blueprint $table) {
|
Schema::table('expenses', function (Blueprint $table) {
|
||||||
@@ -24,4 +23,4 @@ class ExpensesAddFlightType extends Migration
|
|||||||
$table->dropColumn('flight_type');
|
$table->dropColumn('flight_type');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user