Compare commits
361 Commits
7.0.0-beta
...
UpdateMeta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18206f4601 | ||
|
|
845514da2c | ||
|
|
531489bfde | ||
|
|
601a17e1e6 | ||
|
|
3be8b1c4b9 | ||
|
|
b4e33bb37e | ||
|
|
a8e6f1191b | ||
|
|
3a0140c2d0 | ||
|
|
547b159570 | ||
|
|
cab5c03c0b | ||
|
|
777a696b35 | ||
|
|
90344fb6e6 | ||
|
|
7481dab012 | ||
|
|
dead1cfd0f | ||
|
|
544462f420 | ||
|
|
a31201dfd3 | ||
|
|
9d336c1140 | ||
|
|
96d33c11c8 | ||
|
|
48cada2053 | ||
|
|
2a05013f66 | ||
|
|
4267648da5 | ||
|
|
5ada327236 | ||
|
|
82825ef77b | ||
|
|
db532e0f16 | ||
|
|
9b2e466b7e | ||
|
|
17447c6903 | ||
|
|
ad86e996d7 | ||
|
|
5a5fd02dac | ||
|
|
97f095e4e9 | ||
|
|
a2f91b6754 | ||
|
|
a9e5554dea | ||
|
|
5b10dca868 | ||
|
|
11cebb3e6e | ||
|
|
96c17d33bc | ||
|
|
9abc892698 | ||
|
|
67a51da220 | ||
|
|
7e586a273a | ||
|
|
8a591c11a5 | ||
|
|
728b033675 | ||
|
|
68a6ed24cb | ||
|
|
7d8a34645e | ||
|
|
4985da991b | ||
|
|
c94358350a | ||
|
|
d3ec0f4de3 | ||
|
|
ede5b74383 | ||
|
|
e7bbd6cccb | ||
|
|
edcea258ce | ||
|
|
5adc0b4072 | ||
|
|
fe7120e21a | ||
|
|
30be7c245c | ||
|
|
7cb9ae4ec3 | ||
|
|
6f1a5f1dc2 | ||
|
|
e3c3c81d19 | ||
|
|
352f1ee9f8 | ||
|
|
dff4273c72 | ||
|
|
77a4acb569 | ||
|
|
ff6827b368 | ||
|
|
594d0eb222 | ||
|
|
ee61de62fa | ||
|
|
f2be14402f | ||
|
|
a186bfae2a | ||
|
|
6e6ba85080 | ||
|
|
d2272e32a6 | ||
|
|
b6c0946795 | ||
|
|
fca04e6b0c | ||
|
|
5094fce4b0 | ||
|
|
fe0ef60b6c | ||
|
|
5094375e13 | ||
|
|
ec6cb42bfd | ||
|
|
14d0e99a37 | ||
|
|
f8c7bc31f5 | ||
|
|
2545328233 | ||
|
|
61739ce266 | ||
|
|
bffc4f911c | ||
|
|
d18925f473 | ||
|
|
f5e83461a3 | ||
|
|
bfddb2c84d | ||
|
|
7e9eb08135 | ||
|
|
3d55336823 | ||
|
|
68ed2355ad | ||
|
|
fdab4ee530 | ||
|
|
648e7a261d | ||
|
|
9cb0a0cf36 | ||
|
|
2c8372d484 | ||
|
|
498d5bfaf0 | ||
|
|
2202c5b479 | ||
|
|
ac64a5db75 | ||
|
|
6c3992e781 | ||
|
|
344edde0fb | ||
|
|
7502c053bf | ||
|
|
dbfaed0ecc | ||
|
|
ff255c999b | ||
|
|
8c065a44cf | ||
|
|
8e9ba3b922 | ||
|
|
677d30883f | ||
|
|
ede71e6927 | ||
|
|
3f84f84309 | ||
|
|
50e8f2e52b | ||
|
|
96fff0248d | ||
|
|
9c4aced837 | ||
|
|
ed146b2c70 | ||
|
|
1e320835c2 | ||
|
|
d4c301a36c | ||
|
|
c2b0b69eb2 | ||
|
|
43c33adcfe | ||
|
|
be6332936f | ||
|
|
8f38fc2dec | ||
|
|
65015cbce2 | ||
|
|
3cc5ca2c32 | ||
|
|
30e88ac6bc | ||
|
|
61ee4254fc | ||
|
|
f9f0ee826d | ||
|
|
4394487392 | ||
|
|
1287766a46 | ||
|
|
11824c9f8b | ||
|
|
bbd02bf5c7 | ||
|
|
9bb192b97f | ||
|
|
2cede04b1e | ||
|
|
7072428218 | ||
|
|
1d83b85d8b | ||
|
|
63eef59060 | ||
|
|
0152ff6045 | ||
|
|
e45bd66388 | ||
|
|
b9e7a2efc9 | ||
|
|
73f88fce0c | ||
|
|
e70ee5aa6f | ||
|
|
f1c54bcc7c | ||
|
|
d94d754961 | ||
|
|
9abfbd6c8c | ||
|
|
97fc1dd43d | ||
|
|
edc37f40fa | ||
|
|
950c7788be | ||
|
|
b3af50ac5a | ||
|
|
8a9b68d9ec | ||
|
|
70a4cf9f90 | ||
|
|
c3465851b2 | ||
|
|
b13c4df338 | ||
|
|
c736a9b639 | ||
|
|
d2e1004e08 | ||
|
|
3800c01d94 | ||
|
|
922e754c9e | ||
|
|
936cd2efd3 | ||
|
|
e22d6d5996 | ||
|
|
efcb7e8895 | ||
|
|
43fbe9e943 | ||
|
|
8fc0aec800 | ||
|
|
bb84fa82a4 | ||
|
|
4fe323a763 | ||
|
|
e3b4a0ed2e | ||
|
|
a4c431d39f | ||
|
|
a52e0410a7 | ||
|
|
baf63361a0 | ||
|
|
b4d5c0fbcd | ||
|
|
6b7eab05e2 | ||
|
|
4c8e31ac6f | ||
|
|
fe41e61c02 | ||
|
|
bd85a04530 | ||
|
|
cbb7d6e274 | ||
|
|
8907527872 | ||
|
|
942c060c99 | ||
|
|
68a9421445 | ||
|
|
4e652c91ae | ||
|
|
a6f62045c4 | ||
|
|
3f3b63da6f | ||
|
|
dd7812e5c5 | ||
|
|
447d02bd4f | ||
|
|
be9b698f14 | ||
|
|
d110c2d951 | ||
|
|
4d20998368 | ||
|
|
4a20b41b25 | ||
|
|
8c2513eb3d | ||
|
|
2dbd58e59e | ||
|
|
bf77f7dd96 | ||
|
|
5a570989de | ||
|
|
6b3207377a | ||
|
|
ac1d5e1555 | ||
|
|
0d45fc287b | ||
|
|
4911f6799d | ||
|
|
5821067231 | ||
|
|
fc7ad7eb6a | ||
|
|
101b3261f5 | ||
|
|
fb0027b140 | ||
|
|
066702e490 | ||
|
|
b4e0515405 | ||
|
|
f5ca8ce6e3 | ||
|
|
7e9196c7e6 | ||
|
|
a2916bf536 | ||
|
|
0578f98b58 | ||
|
|
2e0f0b00ef | ||
|
|
d5d9010134 | ||
|
|
bd8e13e78f | ||
|
|
c4dee07b7f | ||
|
|
f8a44d8c6d | ||
|
|
617cea5df7 | ||
|
|
3a99fe9e0e | ||
|
|
a952071cb4 | ||
|
|
157e0d830c | ||
|
|
a5b83185f5 | ||
|
|
29ff0758a7 | ||
|
|
be74d99ae8 | ||
|
|
53de2e3229 | ||
|
|
80a90c6e3c | ||
|
|
854ed9b92c | ||
|
|
46b17b5c04 | ||
|
|
0068b1215a | ||
|
|
984c1e0cec | ||
|
|
ad8b8e8945 | ||
|
|
2b0056b7c5 | ||
|
|
319a9fc8e1 | ||
|
|
a037597a21 | ||
|
|
4026fe9149 | ||
|
|
18e1d63760 | ||
|
|
4bda494c6b | ||
|
|
a5513b6fbb | ||
|
|
e4972eaae3 | ||
|
|
e95e61d4b4 | ||
|
|
f92912dff4 | ||
|
|
f62c607138 | ||
|
|
d1a3155653 | ||
|
|
883e8786e0 | ||
|
|
fb44b73f44 | ||
|
|
7379e93c46 | ||
|
|
d4bb5605de | ||
|
|
8ecc096bf7 | ||
|
|
6b5cf38224 | ||
|
|
2ecf366670 | ||
|
|
a7981c0a87 | ||
|
|
9cf07c47c7 | ||
|
|
8f4219bc95 | ||
|
|
eae345efa7 | ||
|
|
be15426b5b | ||
|
|
7e4c652330 | ||
|
|
ced2c150b7 | ||
|
|
a2de532f72 | ||
|
|
a52d844719 | ||
|
|
fd814bc79e | ||
|
|
0fa00206ce | ||
|
|
a58237b04b | ||
|
|
dc7efc981c | ||
|
|
060bebf8fe | ||
|
|
aaaf2e7c00 | ||
|
|
1be68d1e63 | ||
|
|
b83f7dcac8 | ||
|
|
c5de2fd8b1 | ||
|
|
b85d0e6a3e | ||
|
|
b37bd2cd7b | ||
|
|
584d37f230 | ||
|
|
1c9d1c1733 | ||
|
|
cd18442207 | ||
|
|
716ba38b6d | ||
|
|
c0514b381b | ||
|
|
5803487d51 | ||
|
|
ca220f1cdf | ||
|
|
75a0a4c87a | ||
|
|
3b6800077f | ||
|
|
bf878a98a4 | ||
|
|
d001704880 | ||
|
|
5371989921 | ||
|
|
6c553569bf | ||
|
|
9eb7dd6913 | ||
|
|
dc007f6d9e | ||
|
|
193fbd369d | ||
|
|
151f188886 | ||
|
|
69d89511be | ||
|
|
48087fb05f | ||
|
|
c702b01a87 | ||
|
|
0a5194b92e | ||
|
|
24aca506fc | ||
|
|
365e33f5f8 | ||
|
|
7a75e0f5ad | ||
|
|
93da2ca061 | ||
|
|
5363e4aa0f | ||
|
|
95a40d3565 | ||
|
|
98aa362935 | ||
|
|
b6603bd178 | ||
|
|
2c539d349d | ||
|
|
5df28eb027 | ||
|
|
0dbf8b8652 | ||
|
|
5856f88a0c | ||
|
|
5f9b9399e9 | ||
|
|
77fe6679ce | ||
|
|
435fa32663 | ||
|
|
78ca06e9dc | ||
|
|
2dd3dd5814 | ||
|
|
ac7a5a65e5 | ||
|
|
c5ab0978db | ||
|
|
8398d94c0a | ||
|
|
1db3295213 | ||
|
|
5dcbd01c00 | ||
|
|
c6d12802a4 | ||
|
|
07de33605b | ||
|
|
ec9ef9c1c2 | ||
|
|
23962a1abb | ||
|
|
9a735d2935 | ||
|
|
51004b143c | ||
|
|
50a0b89caa | ||
|
|
e99c22b007 | ||
|
|
55fa01478d | ||
|
|
552196ce57 | ||
|
|
7aa089bd88 | ||
|
|
1e4b0d629a | ||
|
|
febfff5f12 | ||
|
|
cdf7b13b5b | ||
|
|
51186bed7c | ||
|
|
ac1dc49377 | ||
|
|
be72571185 | ||
|
|
d3e6d2c49a | ||
|
|
4fa58cec5a | ||
|
|
27316f96e8 | ||
|
|
e5ed66b372 | ||
|
|
ee6982f558 | ||
|
|
4f46e75515 | ||
|
|
3ac03d9716 | ||
|
|
ace7c42557 | ||
|
|
3ebf4f2924 | ||
|
|
3739cc8e91 | ||
|
|
bbb5f1d13c | ||
|
|
64e4c91e7e | ||
|
|
3e2b1fe42b | ||
|
|
420bd7e4ae | ||
|
|
e4b1c238f3 | ||
|
|
57e91027c8 | ||
|
|
475ad3a66d | ||
|
|
340f52112d | ||
|
|
c6482bd160 | ||
|
|
df15053b75 | ||
|
|
04b8be1649 | ||
|
|
3d211535f7 | ||
|
|
c1408cb8fe | ||
|
|
519ae600d5 | ||
|
|
82bae9cc74 | ||
|
|
3a07e34259 | ||
|
|
89ca0b49a2 | ||
|
|
5b16c88bcb | ||
|
|
c67e45e98e | ||
|
|
688be6f75a | ||
|
|
8527b39fe2 | ||
|
|
a443908bed | ||
|
|
c46fc9171c | ||
|
|
71c09aaeb1 | ||
|
|
5046d26032 | ||
|
|
4cd7eef937 | ||
|
|
f17cd15b01 | ||
|
|
5f8053226e | ||
|
|
09cd7adb6b | ||
|
|
fb7d988032 | ||
|
|
eb90d08761 | ||
|
|
1ebb181c36 | ||
|
|
975ee9b88e | ||
|
|
52379c3789 | ||
|
|
bcf7acf957 | ||
|
|
3b1936e110 | ||
|
|
b9aeda1cba | ||
|
|
00505a1607 | ||
|
|
6ebbe0209e | ||
|
|
5754103a17 | ||
|
|
6078163d75 | ||
|
|
885e1d599e | ||
|
|
876457af71 | ||
|
|
8c75bd098e | ||
|
|
585c9578e8 |
@@ -1,6 +1,10 @@
|
||||
#
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.js]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
@@ -23,4 +27,4 @@ indent_style = tab
|
||||
# Matches the exact files either package.json or .travis.yml
|
||||
[{package.json, .travis.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
indent_size = 2
|
||||
85
.travis/deploy_script.sh → .github/scripts/build.sh
vendored
Executable file → Normal file
85
.travis/deploy_script.sh → .github/scripts/build.sh
vendored
Executable file → Normal file
@@ -1,52 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ "$TRAVIS" != "true" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
|
||||
if test "$TRAVIS_TAG"; then
|
||||
VERSION=$TRAVIS_TAG
|
||||
|
||||
# Pass in the tag as the version to write out
|
||||
php artisan phpvms:version --write --write-full-version "${VERSION}"
|
||||
FULL_VERSION=$(php artisan phpvms:version)
|
||||
else
|
||||
echo "On branch $TRAVIS_BRANCH"
|
||||
|
||||
if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_BRANCH" != "dev" ]; then
|
||||
echo "Not on valid branch, exiting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Write the version out but place the branch ID in there
|
||||
# This is only for the dev branch
|
||||
BASE_VERSION=$(php artisan phpvms:version --base-only)
|
||||
|
||||
# This now includes the pre-release version, so "-dev" by default
|
||||
VERSION=${BASE_VERSION}
|
||||
|
||||
# Don't pass in a version here, just write out the latest hash
|
||||
php artisan phpvms:version --write "${VERSION}"
|
||||
FULL_VERSION=$(php artisan phpvms:version)
|
||||
fi
|
||||
|
||||
FILE_NAME="phpvms-${VERSION}"
|
||||
TAR_NAME="$FILE_NAME.tar.gz"
|
||||
ZIP_NAME="$FILE_NAME.zip"
|
||||
|
||||
echo "Version: ${VERSION}"
|
||||
echo "Full Version: ${FULL_VERSION}"
|
||||
echo "Package name: ${TAR_NAME}"
|
||||
|
||||
echo "==========================="
|
||||
echo "Current directory: ${BASE_DIR}"
|
||||
|
||||
echo "Cleaning files"
|
||||
|
||||
rm -rf vendor
|
||||
composer install --no-dev --prefer-dist --no-interaction --verbose
|
||||
|
||||
# Leftover individual files to delete
|
||||
declare -a remove_files=(
|
||||
.git
|
||||
@@ -70,6 +30,7 @@ declare -a remove_files=(
|
||||
intellij_style.xml
|
||||
config.php
|
||||
docker-compose.yml
|
||||
docker-compose.local.yml
|
||||
Makefile
|
||||
phpcs.xml
|
||||
phpunit.xml
|
||||
@@ -107,44 +68,24 @@ mkdir -p storage/framework/cache
|
||||
mkdir -p storage/framework/sessions
|
||||
mkdir -p storage/framework/views
|
||||
|
||||
# Regenerate the autoloader and classes
|
||||
composer dump-autoload
|
||||
make clean
|
||||
|
||||
cd /tmp
|
||||
ls -al $TRAVIS_BUILD_DIR/../
|
||||
|
||||
tar -czf $TAR_NAME -C $TRAVIS_BUILD_DIR .
|
||||
ls -al $BASE_DIR/../
|
||||
|
||||
tar -czf $TAR_NAME -C $BASE_DIR .
|
||||
sha256sum $TAR_NAME >"$TAR_NAME.sha256"
|
||||
tar2zip $TAR_NAME
|
||||
|
||||
cd $BASE_DIR;
|
||||
zip -r $ZIP_NAME *
|
||||
sha256sum $ZIP_NAME >"$ZIP_NAME.sha256"
|
||||
mv $ZIP_NAME /tmp
|
||||
mv "$ZIP_NAME.sha256" /tmp
|
||||
|
||||
ls -al /tmp
|
||||
|
||||
echo "Uploading to S3"
|
||||
mkdir -p $TRAVIS_BUILD_DIR/build
|
||||
cd $TRAVIS_BUILD_DIR/build
|
||||
echo "Moving to dist"
|
||||
mkdir -p $BASE_DIR/dist
|
||||
cd $BASE_DIR/dist
|
||||
|
||||
mv "/tmp/$TAR_NAME" "/tmp/$ZIP_NAME" "/tmp/$TAR_NAME.sha256" "/tmp/$ZIP_NAME.sha256" .
|
||||
artifacts upload --target-paths "/" $ZIP_NAME $TAR_NAME $TRAVIS_BUILD_DIR/VERSION $TAR_NAME.sha256 $ZIP_NAME.sha256
|
||||
|
||||
# Upload the version for a tagged release. Move to a version file in different
|
||||
# tags. Within phpVMS, we have an option of which version to track in the admin
|
||||
if test "$TRAVIS_TAG"; then
|
||||
echo "Uploading release version file"
|
||||
cp "$TRAVIS_BUILD_DIR/VERSION" release_version
|
||||
artifacts upload --target-paths "/" release_version
|
||||
else
|
||||
echo "Uploading ${TRAVIS_BRANCH}_version file"
|
||||
cp $TRAVIS_BUILD_DIR/VERSION ${TRAVIS_BRANCH}_version
|
||||
artifacts upload --target-paths "/" ${TRAVIS_BRANCH}_version
|
||||
fi
|
||||
|
||||
#if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_BRANCH" != "dev" ]; then
|
||||
# echo "Skipping Discord branch update broadcast"
|
||||
#else
|
||||
curl -X POST \
|
||||
--data "{\"content\": \"A new build is available at http://downloads.phpvms.net/$TAR_NAME (${FULL_VERSION})\"}" \
|
||||
-H "Content-Type: application/json" \
|
||||
$DISCORD_WEBHOOK_URL
|
||||
#fi
|
||||
@@ -1,7 +1,3 @@
|
||||
<?php
|
||||
exit();
|
||||
?>
|
||||
|
||||
APP_ENV="dev"
|
||||
APP_KEY="base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY="
|
||||
APP_URL="http://localhost"
|
||||
@@ -12,7 +8,7 @@ APP_LOCALE="en"
|
||||
PHPVMS_INSTALLED="true"
|
||||
|
||||
APP_LOG="daily"
|
||||
APP_LOG_LEVEL="debug"
|
||||
LOG_LEVEL="debug"
|
||||
APP_LOG_MAX_FILES="3"
|
||||
|
||||
DB_CONNECTION="mysql"
|
||||
0
.travis/my.cnf → .github/scripts/my.cnf
vendored
0
.travis/my.cnf → .github/scripts/my.cnf
vendored
@@ -21,9 +21,9 @@
|
||||
<directory suffix=".php">./app</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<listeners>
|
||||
<!--<listeners>
|
||||
<listener class="NunoMaduro\Collision\Adapters\Phpunit\Listener"/>
|
||||
</listeners>
|
||||
</listeners>-->
|
||||
<php>
|
||||
<ini name="error_reporting" value="E_ALL"/>
|
||||
<ini name="display_errors" value="On"/>
|
||||
36
.github/scripts/version.sh
vendored
Normal file
36
.github/scripts/version.sh
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if test "$GIT_TAG_NAME"; then
|
||||
export VERSION=$GIT_TAG_NAME
|
||||
|
||||
# Pass in the tag as the version to write out
|
||||
php artisan phpvms:version --write --write-full-version "${VERSION}"
|
||||
export FULL_VERSION=$(php artisan phpvms:version)
|
||||
else
|
||||
export BRANCH=${GITHUB_REF##*/}
|
||||
echo "On branch $BRANCH"
|
||||
|
||||
# Write the version out but place the branch ID in there
|
||||
# This is only for the dev branch
|
||||
export BASE_VERSION=$(php artisan phpvms:version --base-only)
|
||||
|
||||
# This now includes the pre-release version, so "-dev" by default
|
||||
export VERSION=${BASE_VERSION}
|
||||
|
||||
# Don't pass in a version here, just write out the latest hash
|
||||
php artisan phpvms:version --write "${VERSION}"
|
||||
export FULL_VERSION=$(php artisan phpvms:version)
|
||||
fi
|
||||
|
||||
export FILE_NAME="phpvms-${VERSION}"
|
||||
export TAR_NAME="$FILE_NAME.tar.gz"
|
||||
export ZIP_NAME="$FILE_NAME.zip"
|
||||
export BASE_DIR=`pwd`
|
||||
|
||||
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#environment-files
|
||||
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
|
||||
echo "FILE_NAME=${FILE_NAME}" >> $GITHUB_ENV
|
||||
echo "TAR_NAME=${TAR_NAME}" >> $GITHUB_ENV
|
||||
echo "ZIP_NAME=${ZIP_NAME}" >> $GITHUB_ENV
|
||||
echo "BASE_DIR=${BASE_DIR}" >> $GITHUB_ENV
|
||||
echo "DISCORD_MSG=Version ${FULL_VERSION} is available, download: [zip](http://downloads.phpvms.net/$ZIP_NAME) | [tar](http://downloads.phpvms.net/$TAR_NAME)" >> $GITHUB_ENV
|
||||
248
.github/workflows/build.yml
vendored
Normal file
248
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
name: 'Build'
|
||||
on: ['push', 'pull_request', 'workflow_dispatch', 'release']
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-18.04
|
||||
if: github.repository == 'nabeelio/phpvms'
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
php-versions: ['7.3', '7.4', '8.0']
|
||||
name: PHP ${{ matrix.php-versions }}
|
||||
env:
|
||||
extensions: intl, pcov, mbstring
|
||||
key: cache-v1
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Configure Caching
|
||||
- name: Setup cache environment
|
||||
id: cache-env
|
||||
uses: shivammathur/cache-extensions@v1
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: ${{ env.extensions }}
|
||||
key: ${{ env.key }}
|
||||
|
||||
- name: Cache extensions
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ${{ steps.cache-env.outputs.dir }}
|
||||
key: ${{ steps.cache-env.outputs.key }}
|
||||
restore-keys: ${{ steps.cache-env.outputs.key }}
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
|
||||
# Configure PHP
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: ${{ env.extensions }}
|
||||
ini-values: post_max_size=256M, short_open_tag=On
|
||||
coverage: xdebug
|
||||
tools: php-cs-fixer, phpunit
|
||||
|
||||
- name: Shutdown Ubuntu MySQL
|
||||
run: sudo service mysql stop
|
||||
|
||||
- name: Install MariaDB
|
||||
uses: getong/mariadb-action@v1.1
|
||||
with:
|
||||
character set server: 'utf8'
|
||||
collation server: 'utf8_general_ci'
|
||||
mysql database: 'phpvms'
|
||||
mysql root password: ''
|
||||
mysql user: ''
|
||||
mysql password: ''
|
||||
|
||||
- name: Configure Environment
|
||||
run: |
|
||||
php --version
|
||||
mysql --version
|
||||
# Downgrade composer version to 1.x
|
||||
composer install --dev --no-interaction --verbose
|
||||
cp .github/scripts/env.php env.php
|
||||
cp .github/scripts/phpunit.xml phpunit.xml
|
||||
php artisan database:create --reset
|
||||
php artisan migrate:refresh --seed
|
||||
|
||||
- name: Run Tests
|
||||
run: |
|
||||
vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --diff --using-cache=no
|
||||
vendor/bin/phpunit --debug --verbose
|
||||
|
||||
# This runs after all of the tests, run have run. Creates a cleaned up version of the
|
||||
# distro, and then creates the artifact to push up to S3 or wherever
|
||||
artifacts:
|
||||
name: 'Create dev build'
|
||||
needs: build
|
||||
runs-on: 'ubuntu-18.04'
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- uses: olegtarasov/get-tag@v2.1
|
||||
id: tagName
|
||||
|
||||
# Configure Caching
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
# Dependencies
|
||||
- name: 'Install Release Dependencies'
|
||||
run: |
|
||||
rm -rf vendor
|
||||
sudo npm i tar-to-zip -g
|
||||
composer install --no-dev --prefer-dist --no-interaction --verbose
|
||||
sudo chmod +x ./.github/scripts/*
|
||||
|
||||
- name: Get version
|
||||
run: .github/scripts/version.sh
|
||||
|
||||
- name: Build Distro
|
||||
run: .github/scripts/build.sh
|
||||
|
||||
- name: Upload S3
|
||||
uses: shallwefootball/s3-upload-action@v1.1.3
|
||||
with:
|
||||
aws_key_id: ${{ secrets.S3_BUILD_ARTIFACTS_ACCESS_KEY_ID }}
|
||||
aws_secret_access_key: ${{ secrets.S3_BUILD_ARTIFACTS_SECRET_ACCESS_KEY}}
|
||||
aws_bucket: ${{ secrets.S3_BUCKET_NAME }}
|
||||
source_dir: 'dist'
|
||||
destination_dir: ''
|
||||
|
||||
- name: Discord notification
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
uses: Ilshidur/action-discord@0.3.0
|
||||
with:
|
||||
# DISCORD_MSG is defined in versions.sh
|
||||
args: '{{ DISCORD_MSG }}'
|
||||
|
||||
# This runs after all of the tests, run have run. Creates a cleaned up version of the
|
||||
# distro, and then creates the artifact to push up to S3 or wherever
|
||||
# https://github.com/actions/create-release
|
||||
release:
|
||||
name: 'Create Release'
|
||||
needs: build
|
||||
runs-on: 'ubuntu-18.04'
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- uses: olegtarasov/get-tag@v2.1
|
||||
id: tagName
|
||||
|
||||
# Configure Caching
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
# Dependencies
|
||||
- name: 'Install Release Dependencies'
|
||||
run: |
|
||||
rm -rf vendor
|
||||
sudo npm i tar-to-zip -g
|
||||
composer install --no-dev --prefer-dist --no-interaction --verbose
|
||||
sudo chmod +x ./.github/scripts/*
|
||||
|
||||
- name: Get version
|
||||
run: .github/scripts/version.sh
|
||||
|
||||
- name: Build Distro
|
||||
run: .github/scripts/build.sh
|
||||
|
||||
- name: Upload S3
|
||||
uses: shallwefootball/s3-upload-action@v1.1.3
|
||||
with:
|
||||
aws_key_id: ${{ secrets.S3_BUILD_ARTIFACTS_ACCESS_KEY_ID }}
|
||||
aws_secret_access_key: ${{ secrets.S3_BUILD_ARTIFACTS_SECRET_ACCESS_KEY}}
|
||||
aws_bucket: ${{ secrets.S3_BUCKET_NAME }}
|
||||
source_dir: 'dist'
|
||||
destination_dir: ''
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Get version
|
||||
run: .github/scripts/version.sh
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
draft: true
|
||||
prerelease: false
|
||||
|
||||
# Upload the tar file to the release
|
||||
- name: Upload Tar Asset
|
||||
id: upload-tar-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: dist/{{TAR_NAME}}
|
||||
asset_name: '{{ TAR_NAME }}'
|
||||
asset_content_type: application/gzip
|
||||
|
||||
# upload the zip file to the release
|
||||
- name: Upload Zip Asset
|
||||
id: upload-zip-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: dist/{{ZIP_NAME}}
|
||||
asset_name: '{{ ZIP_NAME }}'
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Discord notification
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
uses: Ilshidur/action-discord@0.3.0
|
||||
with:
|
||||
# DISCORD_MSG is defined in versions.sh
|
||||
args: '{{ DISCORD_MSG }}'
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -74,4 +74,5 @@ error_log
|
||||
.sass-cache
|
||||
.DS_Store
|
||||
/config.php
|
||||
/config.bak.php
|
||||
/VERSION
|
||||
|
||||
@@ -28,6 +28,8 @@ RedirectMatch 403 ^/composer.phar
|
||||
RedirectMatch 403 ^/env.php.*?$
|
||||
RedirectMatch 403 ^/env.php
|
||||
RedirectMatch 403 ^/env.php$
|
||||
RedirectMatch 403 ^/config.php$
|
||||
RedirectMatch 403 ^/config.bak.php$
|
||||
RedirectMatch 403 ^/Makefile
|
||||
RedirectMatch 403 ^/package.json
|
||||
RedirectMatch 403 ^/package-lock.json
|
||||
|
||||
161
.travis.yml
161
.travis.yml
@@ -1,161 +0,0 @@
|
||||
#
|
||||
# Travis CI config file
|
||||
#
|
||||
|
||||
language: php
|
||||
php:
|
||||
- '7.4'
|
||||
- '7.3'
|
||||
- '7.2'
|
||||
|
||||
#env:
|
||||
# - DB=mysql
|
||||
# - DB=mariadb
|
||||
|
||||
cache:
|
||||
# Cache lives for 10 min
|
||||
# Default of 3m might not be long enough for all the runs
|
||||
timeout: 600
|
||||
directories:
|
||||
- "$HOME/.composer/cache"
|
||||
- "$HOME/.npm"
|
||||
|
||||
services:
|
||||
- mysql
|
||||
|
||||
#addons:
|
||||
# mariadb: '10.2'
|
||||
|
||||
install:
|
||||
- php --version
|
||||
- mysql --version
|
||||
- composer install --dev --no-interaction --verbose
|
||||
- npm i tar-to-zip -g
|
||||
- cp .travis/env.travis.php env.php
|
||||
- cp .travis/phpunit.travis.xml phpunit.xml
|
||||
|
||||
before_script:
|
||||
- php artisan database:create --reset
|
||||
- php artisan migrate:refresh --seed
|
||||
|
||||
script:
|
||||
- vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --diff --using-cache=no
|
||||
- vendor/bin/phpunit --debug --verbose
|
||||
|
||||
after_failure:
|
||||
- cat storage/logs/*.log
|
||||
|
||||
# Refer to: https://github.com/doctrine/dbal/blob/master/.travis.yml#L39
|
||||
jobs:
|
||||
include:
|
||||
# Different test stages
|
||||
# - stage: Test
|
||||
# name: PHP 7.2 + MySQL 5.7
|
||||
# php: 7.2
|
||||
# env: DB=mysql
|
||||
# services:
|
||||
# - mysql
|
||||
# - stage: Test
|
||||
# name: PHP 7.3 + MySQL 5.7
|
||||
# php: 7.3
|
||||
# env: DB=mysql
|
||||
# services:
|
||||
# - mysql
|
||||
# - stage: Test
|
||||
# name: PHP 7.4 + MySQL 5.7
|
||||
# php: 7.4
|
||||
# env: DB=mysql
|
||||
# services:
|
||||
# - mysql
|
||||
# - stage: Test
|
||||
# name: PHP 7.2 + MariaDB 10.1
|
||||
# php: 7.2
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.1'
|
||||
# - stage: Test
|
||||
# name: PHP 7.3 + MariaDB 10.1
|
||||
# php: 7.3
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.1'
|
||||
# - stage: Test
|
||||
# name: PHP 7.4 + MariaDB 10.1
|
||||
# php: 7.4
|
||||
# env: DB=mariadb MARIADB_VERSION=10.1
|
||||
# addons:
|
||||
# mariadb: '10.1'
|
||||
# - stage: Test
|
||||
# name: PHP 7.2 + MariaDB 10.2
|
||||
# php: 7.2
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.2'
|
||||
# - stage: Test
|
||||
# name: PHP 7.3 + MariaDB 10.3
|
||||
# php: 7.3
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.2'
|
||||
# - stage: Test
|
||||
# name: PHP 7.4 + MariaDB 10.2
|
||||
# php: 7.4
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.2'
|
||||
# - stage: Test
|
||||
# name: PHP 7.2 + MariaDB 10.3
|
||||
# php: 7.2
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.3'
|
||||
# - stage: Test
|
||||
# name: PHP 7.3 + MariaDB 10.3
|
||||
# php: 7.3
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.3'
|
||||
# - stage: Test
|
||||
# name: PHP 7.4 + MariaDB 10.3
|
||||
# php: 7.4
|
||||
# env: DB=mariadb
|
||||
# addons:
|
||||
# mariadb: '10.3'
|
||||
|
||||
# Just packages up a release
|
||||
- stage: package
|
||||
script: skip
|
||||
before_deploy:
|
||||
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/6b10798/install | bash
|
||||
|
||||
# Configure the conditional deployment
|
||||
# https://docs.travis-ci.com/user/deployment/#examples-of-conditional-deployment
|
||||
deploy:
|
||||
- provider: script
|
||||
skip_cleanup: true
|
||||
script: ./.travis/deploy_script.sh
|
||||
on:
|
||||
all_branches: true
|
||||
repo: nabeelio/phpvms
|
||||
php: '7.4'
|
||||
tags: false
|
||||
|
||||
# RELEASE STAGE
|
||||
# Only runs when there's a tag applied to this release (tag should be the version)
|
||||
# This uses Github Releases and posts it there (provider: releases)
|
||||
# https://docs.travis-ci.com/user/deployment/releases
|
||||
- stage: release
|
||||
script: skip
|
||||
before_deploy:
|
||||
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/6b10798/install | bash
|
||||
- ./.travis/deploy_script.sh
|
||||
deploy:
|
||||
provider: releases
|
||||
skip_cleanup: true
|
||||
api_key: $GITHUB_TOKEN
|
||||
file_glob: true
|
||||
file: build/*
|
||||
on:
|
||||
tags: true
|
||||
repo: nabeelio/phpvms
|
||||
php: '7.4'
|
||||
@@ -2,7 +2,7 @@ FROM php:7.4-fpm-alpine
|
||||
|
||||
WORKDIR /var/www/
|
||||
|
||||
RUN apk add gmp-dev
|
||||
RUN apk add gmp-dev icu-dev zlib-dev libpng-dev
|
||||
RUN curl --silent --show-error https://getcomposer.org/installer | php
|
||||
|
||||
# Copy any config files in
|
||||
@@ -12,7 +12,9 @@ RUN ln -sf /dev/stderr /var/log/fpm-error.log
|
||||
|
||||
RUN docker-php-ext-install \
|
||||
calendar \
|
||||
intl \
|
||||
pdo_mysql \
|
||||
gd \
|
||||
gmp \
|
||||
opcache && \
|
||||
docker-php-ext-enable pdo_mysql opcache
|
||||
@@ -25,4 +27,6 @@ RUN php composer.phar install \
|
||||
--no-scripts \
|
||||
--prefer-dist
|
||||
|
||||
RUN chown -R www-data:www-data /var/www
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
22
Makefile
22
Makefile
@@ -43,7 +43,7 @@ build:
|
||||
# This is to build all the stylesheets, etc
|
||||
.PHONY: build-assets
|
||||
build-assets:
|
||||
yarn run production
|
||||
npm run production
|
||||
|
||||
.PHONY: install
|
||||
install: build
|
||||
@@ -74,9 +74,9 @@ reload-db:
|
||||
tests: test
|
||||
|
||||
.PHONY: test
|
||||
test: phpcs
|
||||
#php artisan database:create --reset
|
||||
vendor/bin/phpunit --debug --verbose
|
||||
test:
|
||||
@#php artisan database:create --reset
|
||||
@vendor/bin/phpunit --verbose
|
||||
|
||||
.PHONY: phpcs
|
||||
phpcs:
|
||||
@@ -109,17 +109,9 @@ reset-installer:
|
||||
@php artisan database:create --reset
|
||||
@php artisan migrate:refresh --seed
|
||||
|
||||
.PHONY: docker
|
||||
docker:
|
||||
@mkdir -p $(CURR_PATH)/tmp/mysql
|
||||
|
||||
-docker rm -f phpvms
|
||||
docker build -t phpvms .
|
||||
docker run --name=phpvms \
|
||||
-v $(CURR_PATH):/var/www/ \
|
||||
-v $(CURR_PATH)/tmp/mysql:/var/lib/mysql \
|
||||
-p 8080:80 \
|
||||
phpvms
|
||||
.PHONY: docker-test
|
||||
docker-test:
|
||||
@docker-compose -f docker-compose.yml -f docker-compose.local.yml up
|
||||
|
||||
.PHONY: docker-clean
|
||||
docker-clean:
|
||||
|
||||
38
README.md
38
README.md
@@ -1,20 +1,17 @@
|
||||
# phpvms <sup>7</sup>
|
||||
# phpVMS <sup>7</sup>
|
||||
|
||||
[](https://travis-ci.org/nabeelio/phpvms) [](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&utm_medium=referral&utm_content=nabeelio/phpvms&utm_campaign=Badge_Grade) [](https://packagist.org/packages/nabeel/phpvms)  [](https://packagist.org/packages/nabeel/phpvms)
|
||||
[](https://github.com/nabeelio/phpvms/actions) [](https://www.codacy.com/app/nabeelio/phpvms?utm_source=github.com&utm_medium=referral&utm_content=nabeelio/phpvms&utm_campaign=Badge_Grade) [](https://packagist.org/packages/nabeel/phpvms)  [](https://packagist.org/packages/nabeel/phpvms)
|
||||
|
||||
The next phpvms version built on the laravel framework. work in progress. The latest documentation, with installation instructions is available
|
||||
[on the phpVMS documentation](http://docs.phpvms.net/) page.
|
||||
The next phpvms version built on the laravel framework. work in progress. The latest documentation, with installation instructions is available [on the phpVMS documentation](https://docs.phpvms.net/) page.
|
||||
|
||||
# installation
|
||||
## Installation
|
||||
|
||||
A full distribution, with all of the composer dependencies, is available at this
|
||||
[GitHub Releases](https://github.com/nabeelio/phpvms/releases) link.
|
||||
|
||||
### Requirements
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
- PHP 7.1+, extensions:
|
||||
- PHP 7.3+, extensions:
|
||||
- cURL
|
||||
- JSON
|
||||
- mbstring
|
||||
@@ -24,24 +21,25 @@ A full distribution, with all of the composer dependencies, is available at this
|
||||
- Database:
|
||||
- MySQL 5.5+ (or MySQL variant, including MariaDB and Percona)
|
||||
|
||||
[View more details on requirements](http://docs.phpvms.net/setup/requirements)
|
||||
[View more details on requirements](https://docs.phpvms.net/requirements)
|
||||
|
||||
## Installer
|
||||
### Installer
|
||||
|
||||
1. Upload to your server
|
||||
1. Visit the site, and follow the link to the installer
|
||||
|
||||
[View installation details](http://docs.phpvms.net/setup/installation)
|
||||
[View installation details](https://docs.phpvms.net/installation/installation)
|
||||
|
||||
# development environment
|
||||
## Development Environment with Docker
|
||||
|
||||
A full development environment can be brought up using Docker:
|
||||
A full development environment can be brought up using Docker, without having to install composer/npm locally
|
||||
|
||||
```bash
|
||||
composer install
|
||||
yarn install
|
||||
docker-compose build
|
||||
docker-compose up
|
||||
make docker-test
|
||||
|
||||
# **OR** with docker-compose directly
|
||||
|
||||
docker-compose -f docker-compose.yml -f docker-compose.local.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:
|
||||
@@ -50,7 +48,9 @@ Then go to `http://localhost`. If you're using dnsmasq, the `app` container is l
|
||||
127.0.0.1 phpvms.test
|
||||
```
|
||||
|
||||
## Building JS/CSS assets
|
||||
The `docker-compose.local.yml` overrides the `app` section in `docker-compose.yml`. The standard `docker-compose.yml` can be used if you want to deploy from the image, or as a template for your own Dockerized deployments.
|
||||
|
||||
### Building JS/CSS assets
|
||||
|
||||
Yarn is required, run:
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace App\Console\Commands;
|
||||
|
||||
use App;
|
||||
use App\Contracts\Command;
|
||||
use App\Services\Installer\ConfigService;
|
||||
use App\Services\Installer\SeederService;
|
||||
use DatabaseSeeder;
|
||||
use Modules\Installer\Services\ConfigService;
|
||||
|
||||
/**
|
||||
* Create the config files
|
||||
@@ -81,13 +81,13 @@ class CreateConfigs extends Command
|
||||
|
||||
$this->info('Regenerating the config files');
|
||||
$cfgSvc->createConfigFiles([
|
||||
'APP_ENV' => 'dev',
|
||||
'SITE_NAME' => $this->argument('name'),
|
||||
'DB_CONN' => 'mysql',
|
||||
'DB_HOST' => $this->argument('db_host'),
|
||||
'DB_NAME' => $this->argument('db_name'),
|
||||
'DB_USER' => $this->argument('db_user'),
|
||||
'DB_PASS' => $this->argument('db_pass'),
|
||||
'APP_ENV' => 'dev',
|
||||
'SITE_NAME' => $this->argument('name'),
|
||||
'DB_CONNECTION' => 'mysql',
|
||||
'DB_HOST' => $this->argument('db_host'),
|
||||
'DB_DATABASE' => $this->argument('db_name'),
|
||||
'DB_USERNAME' => $this->argument('db_user'),
|
||||
'DB_PASSWORD' => $this->argument('db_pass'),
|
||||
]);
|
||||
|
||||
$this->info('Config files generated!');
|
||||
|
||||
@@ -79,21 +79,29 @@ class CreateDatabase extends Command
|
||||
*/
|
||||
protected function create_sqlite($dbkey)
|
||||
{
|
||||
$dbPath = config($dbkey.'database');
|
||||
|
||||
// Skip if running in memory
|
||||
if ($dbPath === ':memory:') {
|
||||
return;
|
||||
}
|
||||
|
||||
$exec = 'sqlite3';
|
||||
if ($this->os->isWindowsLike()) {
|
||||
$exec = 'sqlite3.exe';
|
||||
}
|
||||
|
||||
if ($this->option('reset') === true) {
|
||||
$cmd = ['rm', '-rf', config($dbkey.'database')];
|
||||
$this->runCommand($cmd);
|
||||
if (file_exists($dbPath)) {
|
||||
unlink(config($dbkey.'database'));
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_exists(config($dbkey.'database'))) {
|
||||
if (!file_exists($dbPath)) {
|
||||
$cmd = [
|
||||
$exec,
|
||||
config($dbkey.'database'),
|
||||
'""',
|
||||
$dbPath,
|
||||
'".exit"',
|
||||
];
|
||||
|
||||
$this->runCommand($cmd);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Contracts\Command;
|
||||
use Modules\Installer\Services\ConfigService;
|
||||
use App\Services\Installer\ConfigService;
|
||||
|
||||
/**
|
||||
* Create a fresh development install
|
||||
@@ -79,9 +79,9 @@ class DevInstall extends Command
|
||||
|
||||
$this->info('Regenerating the config files');
|
||||
$cfgSvc->createConfigFiles([
|
||||
'APP_ENV' => 'dev',
|
||||
'SITE_NAME' => 'phpvms test',
|
||||
'DB_CONN' => 'sqlite',
|
||||
'APP_ENV' => 'dev',
|
||||
'SITE_NAME' => 'phpvms test',
|
||||
'DB_CONNECTION' => 'sqlite',
|
||||
]);
|
||||
|
||||
$this->info('Config files generated!');
|
||||
|
||||
32
app/Console/Commands/EmailTest.php
Normal file
32
app/Console/Commands/EmailTest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App;
|
||||
use App\Contracts\Command;
|
||||
|
||||
class EmailTest extends Command
|
||||
{
|
||||
protected $signature = 'phpvms:email-test';
|
||||
protected $description = 'Send a test notification to admins';
|
||||
|
||||
/**
|
||||
* Run dev related commands
|
||||
*
|
||||
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileException
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
/** @var App\Notifications\NotificationEventsHandler $eventHandler */
|
||||
$eventHandler = app(App\Notifications\NotificationEventsHandler::class);
|
||||
|
||||
$news = new App\Models\News();
|
||||
$news->user_id = 1;
|
||||
$news->subject = 'Test News';
|
||||
$news->body = 'Test Body';
|
||||
$news->save();
|
||||
|
||||
$newsEvent = new App\Events\NewsAdded($news);
|
||||
$eventHandler->onNewsAdded($newsEvent);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Console\Commands;
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Contracts\Command;
|
||||
use App\Services\ImporterService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Importer\Services\ImporterService;
|
||||
|
||||
class ImportFromClassicCommand extends Command
|
||||
{
|
||||
38
app/Console/Commands/ProcessQueue.php
Normal file
38
app/Console/Commands/ProcessQueue.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App;
|
||||
use App\Contracts\Command;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ProcessQueue extends Command
|
||||
{
|
||||
protected $signature = 'queue:cron';
|
||||
protected $description = 'Process the queue from a cron job';
|
||||
|
||||
/**
|
||||
* Run the queue tasks
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Artisan::call('queue:work', [
|
||||
'--sansdaemon' => null,
|
||||
'--stop-when-empty' => null,
|
||||
]);
|
||||
|
||||
Log::info(Artisan::output());
|
||||
///** @var App\Support\WorkCommand $queueWorker */
|
||||
//$queueWorker = new App\Support\WorkCommand(app('queue.worker'), app('cache.store'));
|
||||
|
||||
//$queueWorker->setInput($queueWorker->createInputFromArguments([]));
|
||||
//$queueWorker->handle();
|
||||
|
||||
/*$output = $this->call('queue:work', [
|
||||
'--stop-when-empty' => null,
|
||||
]);
|
||||
|
||||
Log::info($output);*/
|
||||
}
|
||||
}
|
||||
25
app/Console/Commands/RewriteConfigs.php
Normal file
25
app/Console/Commands/RewriteConfigs.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Contracts\Command;
|
||||
use App\Services\Installer\ConfigService;
|
||||
|
||||
/**
|
||||
* Command to rewrite the config files
|
||||
*/
|
||||
class RewriteConfigs extends Command
|
||||
{
|
||||
protected $signature = 'phpvms:rewrite-configs';
|
||||
protected $description = 'Rewrite the config files';
|
||||
|
||||
/**
|
||||
* Run dev related commands
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
/** @var ConfigService $configSvc */
|
||||
$configSvc = app(ConfigService::class);
|
||||
$configSvc->rewriteConfigFiles();
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Contracts\Command;
|
||||
use DB;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
/**
|
||||
@@ -25,6 +25,20 @@ class YamlExport extends Command
|
||||
exit();
|
||||
}
|
||||
|
||||
// A "preset" for exporting the base set of data
|
||||
if ($tables[0] === 'base') {
|
||||
$tables = [
|
||||
'airlines',
|
||||
'aircraft',
|
||||
'subfleets',
|
||||
'subfleet_fare',
|
||||
'subfleet_rank',
|
||||
'bids',
|
||||
'fares',
|
||||
'flights',
|
||||
];
|
||||
}
|
||||
|
||||
$export_tables = [];
|
||||
foreach ($tables as $table) {
|
||||
$export_tables[$table] = [];
|
||||
|
||||
25
app/Console/Cron/JobQueue.php
Normal file
25
app/Console/Cron/JobQueue.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Cron;
|
||||
|
||||
use App\Contracts\Command;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
/**
|
||||
* This just calls the CronHourly event, so all of the
|
||||
* listeners, etc can just be called to run those tasks
|
||||
*/
|
||||
class JobQueue extends Command
|
||||
{
|
||||
protected $signature = 'cron:queue';
|
||||
protected $description = 'Run the cron queue tasks';
|
||||
protected $schedule;
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$this->redirectLoggingToFile('cron');
|
||||
Artisan::call('queue:cron');
|
||||
|
||||
$this->info(Artisan::output());
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Console;
|
||||
|
||||
use App\Console\Cron\Hourly;
|
||||
use App\Console\Cron\JobQueue;
|
||||
use App\Console\Cron\Monthly;
|
||||
use App\Console\Cron\Nightly;
|
||||
use App\Console\Cron\Weekly;
|
||||
@@ -13,7 +14,11 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
* Define the application's command schedule. How this works... according to the command
|
||||
* time, an event gets send out with the appropriate time (e.g, hourly sends an hourly event)
|
||||
*
|
||||
* Then the CronServiceProvider has the list of cronjobs which then run according to the events
|
||||
* and then calls those at the proper times.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
*
|
||||
@@ -21,16 +26,26 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
// If not using the queue worker then run those via cron
|
||||
if (!config('queue.worker', false)) {
|
||||
$schedule->command(JobQueue::class)
|
||||
->everyMinute()
|
||||
->withoutOverlapping();
|
||||
}
|
||||
|
||||
$schedule->command(Nightly::class)->dailyAt('01:00');
|
||||
$schedule->command(Weekly::class)->weeklyOn(0);
|
||||
$schedule->command(Monthly::class)->monthlyOn(1);
|
||||
$schedule->command(Hourly::class)->hourly();
|
||||
|
||||
// When spatie-backups runs
|
||||
$schedule->command('backup:clean')->daily()->at('01:00');
|
||||
$schedule->command('backup:run')->daily()->at('02:00');
|
||||
/*if (config('backup.backup.enabled', false) === true) {
|
||||
$schedule->command('backup:clean')->daily()->at('01:00');
|
||||
$schedule->command('backup:run')->daily()->at('02:00');
|
||||
}*/
|
||||
|
||||
// Update the last time the cron was run
|
||||
/** @var CronService $cronSvc */
|
||||
$cronSvc = app(CronService::class);
|
||||
$cronSvc->updateLastRunTime();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,10 @@ abstract class Award
|
||||
* You don't really need to mess with anything below here
|
||||
*/
|
||||
|
||||
/** @var \App\Models\Award|null */
|
||||
protected $award;
|
||||
|
||||
/** @var \App\Models\User|null */
|
||||
protected $user;
|
||||
|
||||
public function __construct(AwardModel $award = null, User $user = null)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Contracts;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use function is_array;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
/**
|
||||
@@ -23,9 +24,9 @@ abstract class Command extends \Illuminate\Console\Command
|
||||
parent::__construct();
|
||||
|
||||
// Running in the console but not in the tests
|
||||
if (app()->runningInConsole() && env('APP_ENV') !== 'testing') {
|
||||
/*if (app()->runningInConsole() && env('APP_ENV') !== 'testing') {
|
||||
$this->redirectLoggingToFile('stdout');
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,9 +83,9 @@ abstract class Command extends \Illuminate\Console\Command
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $cmd
|
||||
* @param bool $return
|
||||
* @param mixed $verbose
|
||||
* @param array|string $cmd
|
||||
* @param bool $return
|
||||
* @param mixed $verbose
|
||||
*
|
||||
* @throws \Symfony\Component\Process\Exception\RuntimeException
|
||||
* @throws \Symfony\Component\Process\Exception\LogicException
|
||||
@@ -93,16 +94,16 @@ abstract class Command extends \Illuminate\Console\Command
|
||||
*/
|
||||
public function runCommand($cmd, $return = false, $verbose = true): string
|
||||
{
|
||||
if (\is_array($cmd)) {
|
||||
if (is_array($cmd)) {
|
||||
$cmd = implode(' ', $cmd);
|
||||
}
|
||||
|
||||
if ($verbose) {
|
||||
$this->info('Running "'.$cmd.'"');
|
||||
$this->info('Running '.$cmd);
|
||||
}
|
||||
|
||||
$val = '';
|
||||
$process = new Process($cmd);
|
||||
$process = Process::fromShellCommandline($cmd);
|
||||
$process->run(function ($type, $buffer) use ($return, &$val) {
|
||||
if ($return) {
|
||||
$val .= $buffer;
|
||||
|
||||
12
app/Contracts/Event.php
Normal file
12
app/Contracts/Event.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Contracts;
|
||||
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class Event
|
||||
{
|
||||
use Dispatchable;
|
||||
use SerializesModels;
|
||||
}
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace App\Contracts;
|
||||
|
||||
use App\Models\Airline;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Log;
|
||||
use Validator;
|
||||
|
||||
/**
|
||||
* Common functionality used across all of the importers
|
||||
@@ -51,9 +51,9 @@ class ImportExport
|
||||
*
|
||||
* @param $code
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @return Airline
|
||||
*/
|
||||
public function getAirline($code)
|
||||
public function getAirline($code): Airline
|
||||
{
|
||||
$airline = Airline::firstOrCreate([
|
||||
'icao' => $code,
|
||||
|
||||
@@ -16,7 +16,7 @@ abstract class Listener
|
||||
public function subscribe(Dispatcher $events): void
|
||||
{
|
||||
foreach (static::$callbacks as $klass => $cb) {
|
||||
$events->listen($klass, get_class($this).'@'.$cb);
|
||||
$events->listen($klass, static::class.'@'.$cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,24 @@ abstract class Metar
|
||||
{
|
||||
/**
|
||||
* Implement retrieving the METAR - return the METAR string. Needs to be protected,
|
||||
* since this shouldn't be directly called. Call `get_metar($icao)` instead
|
||||
* since this shouldn't be directly called. Call `metar($icao)`. If not implemented,
|
||||
* return a blank string
|
||||
*
|
||||
* @param $icao
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract protected function metar($icao): string;
|
||||
abstract protected function get_metar($icao): string;
|
||||
|
||||
/**
|
||||
* Implement retrieving the TAF - return the string. Call `taf($icao)`. If not implemented,
|
||||
* return a blank string
|
||||
*
|
||||
* @param $icao
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract protected function get_taf($icao): string;
|
||||
|
||||
/**
|
||||
* Download the METAR, wrap in caching
|
||||
@@ -27,9 +38,9 @@ abstract class Metar
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_metar($icao): string
|
||||
public function metar($icao): string
|
||||
{
|
||||
$cache = config('cache.keys.WEATHER_LOOKUP');
|
||||
$cache = config('cache.keys.METAR_WEATHER_LOOKUP');
|
||||
$key = $cache['key'].$icao;
|
||||
|
||||
if (Cache::has($key)) {
|
||||
@@ -40,7 +51,7 @@ abstract class Metar
|
||||
}
|
||||
|
||||
try {
|
||||
$raw_metar = $this->metar($icao);
|
||||
$raw_metar = $this->get_metar($icao);
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Error getting METAR: '.$e->getMessage(), $e->getTrace());
|
||||
return '';
|
||||
@@ -52,4 +63,37 @@ abstract class Metar
|
||||
|
||||
return $raw_metar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the TAF, wrap in caching
|
||||
*
|
||||
* @param $icao
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function taf($icao): string
|
||||
{
|
||||
$cache = config('cache.keys.TAF_WEATHER_LOOKUP');
|
||||
$key = $cache['key'].$icao;
|
||||
|
||||
if (Cache::has($key)) {
|
||||
$taf = Cache::get($key);
|
||||
if ($taf !== '') {
|
||||
return $taf;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$taf = $this->get_taf($icao);
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Error getting TAF: '.$e->getMessage(), $e->getTrace());
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($taf !== '') {
|
||||
Cache::put($key, $taf, $cache['time']);
|
||||
}
|
||||
|
||||
return $taf;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
namespace App\Contracts;
|
||||
|
||||
use App\Support\Database;
|
||||
use DB;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
/**
|
||||
* Class Migration
|
||||
@@ -25,6 +28,29 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a module and enable it
|
||||
*
|
||||
* @param array $attrs
|
||||
*/
|
||||
public function addModule(array $attrs)
|
||||
{
|
||||
$module = array_merge([
|
||||
'enabled' => true,
|
||||
'created_at' => DB::raw('NOW()'),
|
||||
'updated_at' => DB::raw('NOW()'),
|
||||
], $attrs);
|
||||
|
||||
try {
|
||||
DB::table('modules')->insert($module);
|
||||
} catch (Exception $e) {
|
||||
// setting already exists, just ignore it
|
||||
if ($e->getCode() === 23000) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed a YAML file into the database
|
||||
*
|
||||
@@ -35,7 +61,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
try {
|
||||
$path = base_path($file);
|
||||
Database::seed_from_yaml_file($path, false);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
Log::error('Unable to load '.$file.' file');
|
||||
Log::error($e);
|
||||
}
|
||||
@@ -52,7 +78,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
foreach ($rows as $row) {
|
||||
try {
|
||||
DB::table($table)->insert($row);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
// setting already exists, just ignore it
|
||||
if ($e->getCode() === 23000) {
|
||||
continue;
|
||||
@@ -60,4 +86,22 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an award from the migrations (for example, if you're adding an award module)
|
||||
*
|
||||
* @param array $award See \App\Models\Awardv
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function addAward(array $award)
|
||||
{
|
||||
$validator = Validator::make($award, \App\Models\Award::$rules);
|
||||
if ($validator->fails()) {
|
||||
throw new ValidationException($validator);
|
||||
}
|
||||
|
||||
$awardModel = new \App\Models\Award($award);
|
||||
$awardModel->save();
|
||||
}
|
||||
}
|
||||
|
||||
49
app/Contracts/Modules/ServiceProvider.php
Normal file
49
app/Contracts/Modules/ServiceProvider.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Contracts\Modules;
|
||||
|
||||
/**
|
||||
* Base class for module service providers
|
||||
* Add-on module service providers must extend this class. Docs on Service Providers:
|
||||
* https://laravel.com/docs/7.x/providers
|
||||
*
|
||||
* For a sample service provider, view the sample module one:
|
||||
* https://github.com/nabeelio/phpvms-module/blob/master/Providers/SampleServiceProvider.php
|
||||
*/
|
||||
abstract class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
/**
|
||||
* A boot method is required, even if it doesn't do anything.
|
||||
* https://laravel.com/docs/7.x/providers#the-boot-method
|
||||
*
|
||||
* This is normally where you'd register the routes or other startup tasks for your module
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* This is required to register the links in either the public or admin toolbar
|
||||
* For example, adding a frontend link:
|
||||
*
|
||||
* $this->moduleSvc->addFrontendLink('Sample', '/sample', '', $logged_in=true);
|
||||
*
|
||||
* Or an admin link:
|
||||
*
|
||||
* $this->moduleSvc->addAdminLink('Sample', '/admin/sample');
|
||||
*/
|
||||
public function registerLinks(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Deferred providers:
|
||||
* https://laravel.com/docs/7.x/providers#deferred-providers
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
namespace App\Contracts;
|
||||
|
||||
use App\Notifications\Channels\Discord\DiscordMessage;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class BaseNotification extends Notification implements ShouldQueue
|
||||
class Notification extends \Illuminate\Notifications\Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public $channels = [];
|
||||
public $requires_opt_in = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Look in the notifications.channels config and see where this particular
|
||||
// notification can go. Map it to $channels
|
||||
$klass = get_class($this);
|
||||
/*$klass = static::class;
|
||||
$notif_config = config('notifications.channels', []);
|
||||
if (!array_key_exists($klass, $notif_config)) {
|
||||
Log::error('Notification type '.$klass.' missing from notifications config, defaulting to mail');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->channels = $notif_config[$klass];
|
||||
$this->channels = $notif_config[$klass];*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,8 +34,16 @@ class BaseNotification extends Notification implements ShouldQueue
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
/*public function via($notifiable)
|
||||
{
|
||||
return $this->channels;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* @return DiscordMessage|null
|
||||
*/
|
||||
public function toDiscordChannel($notifiable): ?DiscordMessage
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
namespace App\Contracts;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Validation\Validator;
|
||||
use function is_array;
|
||||
use Prettus\Repository\Eloquent\BaseRepository;
|
||||
use Prettus\Repository\Exceptions\RepositoryException;
|
||||
|
||||
/**
|
||||
* @mixin \Prettus\Repository\Eloquent\BaseRepository
|
||||
* @mixin BaseRepository
|
||||
*/
|
||||
abstract class Repository extends BaseRepository
|
||||
{
|
||||
@@ -20,8 +23,8 @@ abstract class Repository extends BaseRepository
|
||||
{
|
||||
try {
|
||||
return $this->find($id, $columns);
|
||||
} catch (\Exception $e) {
|
||||
return;
|
||||
} catch (Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,11 +35,7 @@ abstract class Repository extends BaseRepository
|
||||
*/
|
||||
public function validate($values)
|
||||
{
|
||||
$validator = Validator::make(
|
||||
$values,
|
||||
$this->model()->rules
|
||||
);
|
||||
|
||||
$validator = Validator::make($values, $this->model()->rules);
|
||||
if ($validator->fails()) {
|
||||
return $validator->messages();
|
||||
}
|
||||
@@ -50,6 +49,8 @@ abstract class Repository extends BaseRepository
|
||||
* @param int $count
|
||||
* @param string $sort_by created_at (default) or updated_at
|
||||
*
|
||||
* @throws RepositoryException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function recent($count = null, $sort_by = 'created_at')
|
||||
@@ -71,7 +72,7 @@ abstract class Repository extends BaseRepository
|
||||
return $this->scopeQuery(function ($query) use ($where, $sort_by, $order_by) {
|
||||
$q = $query->where($where);
|
||||
// See if there are multi-column sorts
|
||||
if (\is_array($sort_by)) {
|
||||
if (is_array($sort_by)) {
|
||||
foreach ($sort_by as $key => $sort) {
|
||||
$q = $q->orderBy($key, $sort);
|
||||
}
|
||||
@@ -98,7 +99,7 @@ abstract class Repository extends BaseRepository
|
||||
return $this->scopeQuery(function ($query) use ($col, $values, $sort_by, $order_by) {
|
||||
$q = $query->whereNotIn($col, $values);
|
||||
// See if there are multi-column sorts
|
||||
if (\is_array($sort_by)) {
|
||||
if (is_array($sort_by)) {
|
||||
foreach ($sort_by as $key => $sort) {
|
||||
$q = $q->orderBy($key, $sort);
|
||||
}
|
||||
@@ -118,7 +119,7 @@ abstract class Repository extends BaseRepository
|
||||
* @param array $columns
|
||||
* @param string $method
|
||||
*
|
||||
* @throws \Prettus\Repository\Exceptions\RepositoryException
|
||||
* @throws RepositoryException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
@@ -2,10 +2,15 @@
|
||||
|
||||
namespace App\Contracts;
|
||||
|
||||
use App\Support\Resources\CustomAnonymousResourceCollection;
|
||||
use App\Support\Resources\CustomPaginatedResourceResponse;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Pagination\AbstractPaginator;
|
||||
|
||||
/**
|
||||
* Base class for a resource/response
|
||||
*/
|
||||
class Resource extends \Illuminate\Http\Resources\Json\Resource
|
||||
class Resource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Iterate through the list of $fields and check if they're a "Unit"
|
||||
@@ -24,4 +29,28 @@ class Resource extends \Illuminate\Http\Resources\Json\Resource
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Customize the response to exclude all the extra data that isn't used. Based on:
|
||||
* https://gist.github.com/derekphilipau/4be52164a69ce487dcd0673656d280da
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function toResponse($request)
|
||||
{
|
||||
return $this->resource instanceof AbstractPaginator
|
||||
? (new CustomPaginatedResourceResponse($this))->toResponse($request)
|
||||
: parent::toResponse($request);
|
||||
}
|
||||
|
||||
public static function collection($resource)
|
||||
{
|
||||
return tap(new CustomAnonymousResourceCollection($resource, static::class), function ($collection) {
|
||||
if (property_exists(static::class, 'preserveKeys')) {
|
||||
$collection->preserveKeys = (new static([]))->preserveKeys === true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cron\Nightly;
|
||||
namespace App\Cron\Hourly;
|
||||
|
||||
use App\Contracts\Listener;
|
||||
use App\Events\CronNightly;
|
||||
use App\Events\CronHourly;
|
||||
use App\Services\SimBriefService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Clear any expired SimBrief flight briefs that aren't attached to a PIREP
|
||||
@@ -21,8 +22,9 @@ class ClearExpiredSimbrief extends Listener
|
||||
/**
|
||||
* @param \App\Events\CronNightly $event
|
||||
*/
|
||||
public function handle(CronNightly $event): void
|
||||
public function handle(CronHourly $event): void
|
||||
{
|
||||
Log::info('Hourly: Removing expired Simbrief entries');
|
||||
$this->simbriefSvc->removeExpiredEntries();
|
||||
}
|
||||
}
|
||||
52
app/Cron/Hourly/DeletePireps.php
Normal file
52
app/Cron/Hourly/DeletePireps.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cron\Hourly;
|
||||
|
||||
use App\Contracts\Listener;
|
||||
use App\Events\CronHourly;
|
||||
use App\Models\Enums\PirepState;
|
||||
use App\Models\Pirep;
|
||||
use App\Services\PirepService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Remove cancelled/deleted PIREPs. Look for PIREPs that were created before the setting time
|
||||
* (e.g, 12 hours ago) and are marked with the
|
||||
*/
|
||||
class DeletePireps extends Listener
|
||||
{
|
||||
/**
|
||||
* Delete old rejected PIREPs
|
||||
*
|
||||
* @param CronHourly $event
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function handle(CronHourly $event): void
|
||||
{
|
||||
$this->deletePireps(setting('pireps.delete_rejected_hours'), PirepState::REJECTED);
|
||||
$this->deletePireps(setting('pireps.delete_cancelled_hours'), PirepState::CANCELLED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Look for and delete PIREPs which match the criteria
|
||||
*
|
||||
* @param int $expire_time_hours The time in hours to look for PIREPs
|
||||
* @param int $state The PirepState enum value
|
||||
*/
|
||||
protected function deletePireps(int $expire_time_hours, int $state)
|
||||
{
|
||||
$dt = Carbon::now('UTC')->subHours($expire_time_hours);
|
||||
$pireps = Pirep::where('created_at', '<', $dt)->where(['state' => $state])->get();
|
||||
|
||||
/** @var PirepService $pirepSvc */
|
||||
$pirepSvc = app(PirepService::class);
|
||||
|
||||
/** @var Pirep $pirep */
|
||||
foreach ($pireps as $pirep) {
|
||||
Log::info('Cron: Deleting PIREP id='.$pirep->id.', state='.PirepState::label($state));
|
||||
$pirepSvc->delete($pirep);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ class RemoveExpiredBids extends Listener
|
||||
return;
|
||||
}
|
||||
|
||||
$date = Carbon::now()->subHours(setting('bids.expire_time'));
|
||||
Bid::whereDate('created_at', '<', $date)->delete();
|
||||
$date = Carbon::now('UTC')->subHours(setting('bids.expire_time'));
|
||||
Bid::where('created_at', '<', $date)->delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,11 @@ namespace App\Cron\Hourly;
|
||||
|
||||
use App\Contracts\Listener;
|
||||
use App\Events\CronHourly;
|
||||
use App\Events\PirepCancelled;
|
||||
use App\Models\Enums\PirepState;
|
||||
use App\Models\Pirep;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Remove expired live flights
|
||||
@@ -26,9 +28,14 @@ class RemoveExpiredLiveFlights extends Listener
|
||||
return;
|
||||
}
|
||||
|
||||
$date = Carbon::now()->subHours(setting('acars.live_time'));
|
||||
Pirep::whereDate('updated_at', '<', $date)
|
||||
$date = Carbon::now('UTC')->subHours(setting('acars.live_time'));
|
||||
$pireps = Pirep::where('updated_at', '<', $date)
|
||||
->where('state', PirepState::IN_PROGRESS)
|
||||
->delete();
|
||||
->get();
|
||||
foreach ($pireps as $pirep) {
|
||||
event(new PirepCancelled($pirep));
|
||||
Log::info('Cron: Deleting Expired Live PIREP id='.$pirep->id.', state='.PirepState::label($pirep->state));
|
||||
$pirep->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Contracts\Listener;
|
||||
use App\Events\CronMonthly;
|
||||
use App\Models\Enums\ExpenseType;
|
||||
use App\Services\Finance\RecurringFinanceService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Go through and apply any finances that are daily
|
||||
@@ -35,6 +36,7 @@ class ApplyExpenses extends Listener
|
||||
*/
|
||||
public function handle(CronMonthly $event): void
|
||||
{
|
||||
Log::info('Monthly: Applying monthly expenses');
|
||||
$this->financeSvc->processExpenses(ExpenseType::MONTHLY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Contracts\Listener;
|
||||
use App\Events\CronNightly;
|
||||
use App\Models\Enums\ExpenseType;
|
||||
use App\Services\Finance\RecurringFinanceService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Go through and apply any finances that are daily
|
||||
@@ -35,6 +36,7 @@ class ApplyExpenses extends Listener
|
||||
*/
|
||||
public function handle(CronNightly $event): void
|
||||
{
|
||||
Log::info('Nightly: Applying daily expenses');
|
||||
$this->financeSvc->processExpenses(ExpenseType::DAILY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,8 @@ namespace App\Cron\Nightly;
|
||||
use App\Contracts\Listener;
|
||||
use App\Events\CronNightly;
|
||||
use App\Services\VersionService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Determine if any pilots should be set to ON LEAVE status
|
||||
*/
|
||||
class NewVersionCheck extends Listener
|
||||
{
|
||||
private $versionSvc;
|
||||
@@ -28,6 +26,7 @@ class NewVersionCheck extends Listener
|
||||
*/
|
||||
public function handle(CronNightly $event): void
|
||||
{
|
||||
Log::info('Nightly: Checking for new version');
|
||||
$this->versionSvc->isNewVersionAvailable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,8 @@ namespace App\Cron\Nightly;
|
||||
|
||||
use App\Contracts\Listener;
|
||||
use App\Events\CronNightly;
|
||||
use App\Models\Enums\UserState;
|
||||
use App\Models\User;
|
||||
use App\Services\UserService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Determine if any pilots should be set to ON LEAVE status
|
||||
@@ -18,6 +16,8 @@ class PilotLeave extends Listener
|
||||
|
||||
/**
|
||||
* PilotLeave constructor.
|
||||
*
|
||||
* @param UserService $userSvc
|
||||
*/
|
||||
public function __construct(UserService $userSvc)
|
||||
{
|
||||
@@ -34,13 +34,9 @@ class PilotLeave extends Listener
|
||||
*/
|
||||
public function handle(CronNightly $event): void
|
||||
{
|
||||
if (setting('pilots.auto_leave_days') === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$date = Carbon::now()->subDay(setting('pilots.auto_leave_days'));
|
||||
$users = User::where('status', UserState::ACTIVE)
|
||||
->whereDate('updated_at', '<', $date);
|
||||
Log::info('Cron: Running pilot leave check');
|
||||
$users = $this->userSvc->findUsersOnLeave();
|
||||
Log::info('Found '.count($users).' users on leave');
|
||||
|
||||
foreach ($users as $user) {
|
||||
Log::info('Setting user '.$user->ident.' to ON LEAVE status');
|
||||
|
||||
@@ -35,7 +35,7 @@ class RecalculateBalances extends Listener
|
||||
*/
|
||||
public function handle(CronNightly $event): void
|
||||
{
|
||||
Log::info('Recalculating balances');
|
||||
Log::info('Nightly: Recalculating balances');
|
||||
|
||||
$journals = Journal::all();
|
||||
foreach ($journals as $journal) {
|
||||
|
||||
@@ -32,10 +32,10 @@ class RecalculateStats extends Listener
|
||||
*/
|
||||
public function handle(CronNightly $event): void
|
||||
{
|
||||
Log::info('Recalculating user stats');
|
||||
Log::info('Nightly: Recalculating user stats');
|
||||
$this->userSvc->recalculateAllUserStats();
|
||||
|
||||
Log::info('Recalcuating aircraft status');
|
||||
Log::info('Nightly: Recalcuating aircraft status');
|
||||
$this->aircraftSvc->recalculateStats();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ class SetActiveFlights extends Listener
|
||||
*/
|
||||
public function handle(CronNightly $event): void
|
||||
{
|
||||
Log::info('Nightly: Setting active flights');
|
||||
|
||||
$this->checkFlights();
|
||||
}
|
||||
|
||||
@@ -42,23 +44,18 @@ class SetActiveFlights extends Listener
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set to visible by default
|
||||
$flight->visible = true;
|
||||
|
||||
// dates aren't set, so just save if there were any changes above
|
||||
// and move onto the next one
|
||||
if ($flight->start_date === null || $flight->end_date === null) {
|
||||
if ($flight->days !== null && $flight->days > 0) {
|
||||
$visible = Days::isToday($flight->days);
|
||||
if ($flight->visible !== $visible) {
|
||||
Log::info('Flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden'));
|
||||
|
||||
$flight->visible = $visible;
|
||||
if ($visible === false) {
|
||||
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
|
||||
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
|
||||
}
|
||||
$flight->visible = Days::isToday($flight->days);
|
||||
if (!$flight->visible) {
|
||||
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
|
||||
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
|
||||
}
|
||||
} else {
|
||||
Log::info('Toggling flight '.$flight->ident.' to visible');
|
||||
$flight->visible = true;
|
||||
}
|
||||
|
||||
$flight->save();
|
||||
@@ -71,20 +68,11 @@ class SetActiveFlights extends Listener
|
||||
// and then make sure if days of the week are specified, check that too
|
||||
if ($today->gte($flight->start_date) && $today->lte($flight->end_date)) {
|
||||
if ($flight->days !== null && $flight->days > 0) {
|
||||
$visible = Days::isToday($flight->days);
|
||||
if ($flight->visible !== $visible) {
|
||||
Log::info('Toggling flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden').'');
|
||||
|
||||
$flight->visible = $visible;
|
||||
if ($visible === false) {
|
||||
Log::info('Today='.date('N').', start='.$flight->start_date
|
||||
.', end='.$flight->end_date.', mask='.$flight->days.', in='
|
||||
$flight->visible = Days::isToday($flight->days);
|
||||
if (!$flight->visible) {
|
||||
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
|
||||
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log::info('Toggling flight '.$flight->ident.' to visible');
|
||||
$flight->visible = true;
|
||||
}
|
||||
} else {
|
||||
$flight->visible = false;
|
||||
|
||||
@@ -1,24 +1,30 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Airport;
|
||||
use App\Models\Enums\AircraftState;
|
||||
use App\Models\Enums\AircraftStatus;
|
||||
use App\Models\Subfleet;
|
||||
use App\Support\ICAO;
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Models\Aircraft::class, function (Faker $faker) {
|
||||
return [
|
||||
'id' => null,
|
||||
'subfleet_id' => function () {
|
||||
return factory(App\Models\Subfleet::class)->create()->id;
|
||||
return factory(Subfleet::class)->create()->id;
|
||||
},
|
||||
'airport_id' => function () {
|
||||
return factory(App\Models\Airport::class)->create()->id;
|
||||
return factory(Airport::class)->create()->id;
|
||||
},
|
||||
'iata' => $faker->unique()->text(5),
|
||||
'icao' => $faker->unique()->text(5),
|
||||
'name' => $faker->text(50),
|
||||
'registration' => $faker->unique()->text(10),
|
||||
'hex_code' => \App\Support\ICAO::createHexCode(),
|
||||
'hex_code' => ICAO::createHexCode(),
|
||||
'mtow' => $faker->randomFloat(2, 0, 50000),
|
||||
'zfw' => $faker->randomFloat(2, 0, 50000),
|
||||
'status' => \App\Models\Enums\AircraftStatus::ACTIVE,
|
||||
'state' => \App\Models\Enums\AircraftState::PARKED,
|
||||
'status' => AircraftStatus::ACTIVE,
|
||||
'state' => AircraftState::PARKED,
|
||||
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
|
||||
'updated_at' => function (array $pirep) {
|
||||
return $pirep['created_at'];
|
||||
|
||||
@@ -9,7 +9,7 @@ use Hashids\Hashids;
|
||||
$factory->define(App\Models\Airline::class, function (Faker $faker) {
|
||||
return [
|
||||
'id' => null,
|
||||
'icao' => function (array $apt) use ($faker) {
|
||||
'icao' => function (array $apt) {
|
||||
$hashids = new Hashids(microtime(), 5);
|
||||
$mt = str_replace('.', '', microtime(true));
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ if (!function_exists('createFactoryICAO')) {
|
||||
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
$max = strlen($characters) - 1;
|
||||
$string = '';
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
try {
|
||||
$string .= $characters[random_int(0, $max)];
|
||||
} catch (Exception $e) {
|
||||
|
||||
@@ -8,19 +8,19 @@ $factory->define(App\Models\Flight::class, function (Faker $faker) {
|
||||
return [
|
||||
'id' => $faker->unique()->numberBetween(10, 10000000),
|
||||
'airline_id' => function () {
|
||||
return factory(App\Models\Airline::class)->create()->id;
|
||||
return factory(\App\Models\Airline::class)->create()->id;
|
||||
},
|
||||
'flight_number' => $faker->unique()->numberBetween(10, 1000000),
|
||||
'route_code' => $faker->randomElement(['', $faker->text(5)]),
|
||||
'route_leg' => $faker->randomElement(['', $faker->numberBetween(0, 1000)]),
|
||||
'dpt_airport_id' => function () {
|
||||
return factory(App\Models\Airport::class)->create()->id;
|
||||
return factory(\App\Models\Airport::class)->create()->id;
|
||||
},
|
||||
'arr_airport_id' => function () {
|
||||
return factory(App\Models\Airport::class)->create()->id;
|
||||
return factory(\App\Models\Airport::class)->create()->id;
|
||||
},
|
||||
'alt_airport_id' => function () {
|
||||
return factory(App\Models\Airport::class)->create()->id;
|
||||
return factory(\App\Models\Airport::class)->create()->id;
|
||||
},
|
||||
'distance' => $faker->numberBetween(1, 1000),
|
||||
'route' => null,
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Journal;
|
||||
use Carbon\Carbon;
|
||||
use Faker\Generator as Faker;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
$factory->define(App\Models\JournalTransactions::class, function (Faker $faker) {
|
||||
$factory->define(App\Models\JournalTransaction::class, function (Faker $faker) {
|
||||
return [
|
||||
'transaction_group' => \Ramsey\Uuid\Uuid::uuid4()->toString(),
|
||||
'transaction_group' => Uuid::uuid4()->toString(),
|
||||
'journal_id' => function () {
|
||||
return factory(App\Models\Journal::class)->create()->id;
|
||||
return factory(Journal::class)->create()->id;
|
||||
},
|
||||
'credit' => $faker->numberBetween(100, 10000),
|
||||
'debit' => $faker->numberBetween(100, 10000),
|
||||
'currency' => 'USD',
|
||||
'memo' => $faker->sentence(6),
|
||||
'post_date' => \Carbon\Carbon::now(),
|
||||
'post_date' => Carbon::now('UTC'),
|
||||
];
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ $factory->define(App\Models\News::class, function (Faker $faker) {
|
||||
return [
|
||||
'id' => null,
|
||||
'user_id' => function () {
|
||||
return factory(App\Models\User::class)->create()->id;
|
||||
return factory(\App\Models\User::class)->create()->id;
|
||||
},
|
||||
'subject' => $faker->text(),
|
||||
'body' => $faker->sentence,
|
||||
|
||||
@@ -10,8 +10,8 @@ use Faker\Generator as Faker;
|
||||
* Create a new PIREP
|
||||
*/
|
||||
$factory->define(App\Models\Pirep::class, function (Faker $faker) {
|
||||
$airline = factory(App\Models\Airline::class)->create();
|
||||
$flight = factory(App\Models\Flight::class)->create([
|
||||
$airline = factory(\App\Models\Airline::class)->create();
|
||||
$flight = factory(\App\Models\Flight::class)->create([
|
||||
'airline_id' => $airline->id,
|
||||
]);
|
||||
|
||||
@@ -21,10 +21,10 @@ $factory->define(App\Models\Pirep::class, function (Faker $faker) {
|
||||
return $airline->id;
|
||||
},
|
||||
'user_id' => function () {
|
||||
return factory(App\Models\User::class)->create()->id;
|
||||
return factory(\App\Models\User::class)->create()->id;
|
||||
},
|
||||
'aircraft_id' => function () {
|
||||
return factory(App\Models\Aircraft::class)->create()->id;
|
||||
return factory(\App\Models\Aircraft::class)->create()->id;
|
||||
},
|
||||
'flight_id' => function () use ($flight) {
|
||||
return $flight->id;
|
||||
|
||||
13
app/Database/factories/RoleFactory.php
Normal file
13
app/Database/factories/RoleFactory.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Models\Role::class, function (Faker $faker) {
|
||||
return [
|
||||
'id' => null,
|
||||
'name' => $faker->name,
|
||||
'display_name' => $faker->name,
|
||||
'read_only' => false,
|
||||
'disable_activity_checks' => $faker->boolean(),
|
||||
];
|
||||
});
|
||||
@@ -6,7 +6,7 @@ $factory->define(App\Models\Subfleet::class, function (Faker $faker) {
|
||||
return [
|
||||
'id' => null,
|
||||
'airline_id' => function () {
|
||||
return factory(App\Models\Airline::class)->create()->id;
|
||||
return factory(\App\Models\Airline::class)->create()->id;
|
||||
},
|
||||
'name' => $faker->unique()->text(50),
|
||||
'type' => $faker->unique()->text(7),
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Airline;
|
||||
use App\Models\Enums\UserState;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
$factory->define(App\Models\User::class, function (Faker $faker) {
|
||||
static $password;
|
||||
@@ -14,7 +16,7 @@ $factory->define(App\Models\User::class, function (Faker $faker) {
|
||||
'password' => $password ?: $password = Hash::make('secret'),
|
||||
'api_key' => $faker->sha1,
|
||||
'airline_id' => function () {
|
||||
return factory(App\Models\Airline::class)->create()->id;
|
||||
return factory(Airline::class)->create()->id;
|
||||
},
|
||||
'rank_id' => 1,
|
||||
'flights' => $faker->numberBetween(0, 1000),
|
||||
|
||||
@@ -5,11 +5,6 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class RolesPermissionsTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// Create table for storing roles
|
||||
@@ -79,11 +74,6 @@ class RolesPermissionsTables extends Migration
|
||||
$this->addData('roles', $roles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('permission_user');
|
||||
|
||||
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
@@ -20,11 +15,6 @@ class CreatePasswordResetsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
|
||||
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateSessionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
@@ -23,11 +18,6 @@ class CreateSessionsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('sessions');
|
||||
|
||||
@@ -5,11 +5,6 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateAirlinesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('airlines', function (Blueprint $table) {
|
||||
@@ -32,11 +27,6 @@ class CreateAirlinesTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('airlines');
|
||||
|
||||
@@ -5,11 +5,6 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateFaresTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('fares', function (Blueprint $table) {
|
||||
@@ -25,11 +20,6 @@ class CreateFaresTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('fares');
|
||||
|
||||
@@ -7,11 +7,6 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateFlightTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('flights', function (Blueprint $table) {
|
||||
|
||||
@@ -5,11 +5,6 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateRanksTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ranks', function (Blueprint $table) {
|
||||
@@ -30,11 +25,6 @@ class CreateRanksTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ranks');
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateSubfleetTables
|
||||
*/
|
||||
class CreateSubfleetTables extends Migration
|
||||
{
|
||||
public function up()
|
||||
@@ -48,11 +45,6 @@ class CreateSubfleetTables extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('subfleets');
|
||||
|
||||
@@ -7,11 +7,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateBidsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('bids', function (Blueprint $table) {
|
||||
@@ -25,11 +20,6 @@ class CreateBidsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('bids');
|
||||
|
||||
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
@@ -24,11 +19,6 @@ class CreateJobsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
|
||||
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateFailedJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
@@ -23,11 +18,6 @@ class CreateFailedJobsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
|
||||
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateNavdataTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
/*
|
||||
@@ -31,11 +26,6 @@ class CreateNavdataTables extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('navdata');
|
||||
|
||||
@@ -7,11 +7,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAcarsTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('acars', function (Blueprint $table) {
|
||||
@@ -44,11 +39,6 @@ class CreateAcarsTables extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('acars');
|
||||
|
||||
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateStatsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('stats', function (Blueprint $table) {
|
||||
@@ -25,11 +20,6 @@ class CreateStatsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('stats');
|
||||
|
||||
@@ -17,11 +17,6 @@ class CreateNewsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('news');
|
||||
|
||||
@@ -3,14 +3,10 @@
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Modules\Awards\Awards\PilotFlightAwards;
|
||||
|
||||
class CreateAwardsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('awards', function (Blueprint $table) {
|
||||
@@ -23,7 +19,6 @@ class CreateAwardsTable extends Migration
|
||||
// EG, the airports has an internal expense for gate costs
|
||||
$table->string('ref_model')->nullable();
|
||||
$table->text('ref_model_params')->nullable();
|
||||
//$table->string('ref_model_id', 36)->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
@@ -38,13 +33,20 @@ class CreateAwardsTable extends Migration
|
||||
|
||||
$table->index(['user_id', 'award_id']);
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a default, sample award
|
||||
*/
|
||||
$award = [
|
||||
'name' => 'Pilot 50 flights',
|
||||
'description' => 'When a pilot has 50 flights, give this award',
|
||||
'ref_model' => PilotFlightAwards::class,
|
||||
'ref_model_params' => 50,
|
||||
];
|
||||
|
||||
$this->addAward($award);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('awards');
|
||||
|
||||
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateJournalTransactionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('journal_transactions', function (Blueprint $table) {
|
||||
@@ -34,11 +29,6 @@ class CreateJournalTransactionsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('journal_transactions');
|
||||
|
||||
@@ -6,11 +6,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateJournalsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('journals', function (Blueprint $table) {
|
||||
@@ -24,11 +19,6 @@ class CreateJournalsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('journals');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Migration;
|
||||
use App\Contracts\Model;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -14,7 +15,7 @@ class CreateFilesTable extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::create('files', function (Blueprint $table) {
|
||||
$table->string('id', \App\Contracts\Model::ID_MAX_LENGTH);
|
||||
$table->string('id', Model::ID_MAX_LENGTH);
|
||||
$table->string('name');
|
||||
$table->string('description')->nullable();
|
||||
$table->string('disk')->nullable();
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddReadonlyToRoles extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('roles', static function (Blueprint $table) {
|
||||
@@ -24,11 +19,6 @@ class AddReadonlyToRoles extends Migration
|
||||
->update(['read_only' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('roles', static function (Blueprint $table) {
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Kinda of gross operations to change the pilot ID column
|
||||
* 1. Add an `pilot_id` column, which will get populated with the current ID
|
||||
* 2. Drop the `id` column, and then recreate it as a string field
|
||||
* 3. Iterate through all of the users and set their `id` to the `pilot_id`
|
||||
* 4. Change the other tables column types that reference `user_id`
|
||||
*/
|
||||
class UsersAddPilotId extends Migration
|
||||
{
|
||||
/**
|
||||
* Kinda of gross operations to change the pilot ID column
|
||||
* 1. Add an `pilot_id` column, which will get populated with the current ID
|
||||
* 2. Drop the `id` column, and then recreate it as a string field
|
||||
* 3. Iterate through all of the users and set their `id` to the `pilot_id`
|
||||
* 4. Change the other tables column types that reference `user_id`
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', static function (Blueprint $table) {
|
||||
@@ -29,11 +27,6 @@ class UsersAddPilotId extends Migration
|
||||
DB::table('users')->update(['pilot_id' => DB::raw('`id`')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateNotificationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
@@ -23,11 +18,6 @@ class CreateNotificationsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Migration;
|
||||
use App\Models\Enums\PirepState;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Change the PIREP state column to be a TINYINT
|
||||
*/
|
||||
class PirepsChangeStateType extends Migration
|
||||
{
|
||||
/**
|
||||
* Change the PIREP state column to be a TINYINT
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// Migrate the old rejected state
|
||||
@@ -25,13 +23,4 @@ class PirepsChangeStateType extends Migration
|
||||
$table->unsignedSmallInteger('state')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,27 +5,15 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Add a `flight_id` column to the PIREPs table
|
||||
*/
|
||||
class PirepsAddFlightId extends Migration
|
||||
{
|
||||
/**
|
||||
* Add a `flight_id` column to the PIREPs table
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('pireps', function (Blueprint $table) {
|
||||
$table->string('flight_id', Model::ID_MAX_LENGTH)->nullable()->after('aircraft_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('pireps', function (Blueprint $table) {
|
||||
$table->dropColumn('flight_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Add a `flight_type` column to the expenses table
|
||||
*/
|
||||
class ExpensesAddFlightType extends Migration
|
||||
{
|
||||
/**
|
||||
* Add a `flight_type` column to the expenses table
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
@@ -18,11 +18,6 @@ class ExpensesAddFlightType extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
@@ -25,13 +25,4 @@ class ModifyAirportsCoordinates extends Migration
|
||||
$table->decimal('lon', 11, 5)->change()->default(0.0)->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
@@ -8,24 +8,10 @@ use Illuminate\Support\Facades\Schema;
|
||||
*/
|
||||
class FlightFieldNullable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('flight_field_values', function ($table) {
|
||||
$table->text('value')->change()->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Add a `load_factor` and `load_factor_variance` columns to the expenses table
|
||||
*/
|
||||
class FlightsAddLoadFactor extends Migration
|
||||
{
|
||||
/**
|
||||
* Add a `load_factor` and `load_factor_variance` columns to the expenses table
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('flights', function (Blueprint $table) {
|
||||
@@ -22,11 +22,6 @@ class FlightsAddLoadFactor extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('flights', function (Blueprint $table) {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
|
||||
*/
|
||||
class FlightsAddPilotPay extends Migration
|
||||
{
|
||||
/**
|
||||
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('flights', function (Blueprint $table) {
|
||||
@@ -18,11 +18,6 @@ class FlightsAddPilotPay extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('flights', function (Blueprint $table) {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Migration;
|
||||
use App\Models\Enums\FareType;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
|
||||
*/
|
||||
class FaresAddType extends Migration
|
||||
{
|
||||
/**
|
||||
* Add a `pilot_pay` column for a fixed amount to pay to a pilot for a flight
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('fares', function (Blueprint $table) {
|
||||
@@ -19,16 +19,4 @@ class FaresAddType extends Migration
|
||||
->after('capacity');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('fares', function (Blueprint $table) {
|
||||
$table->dropColumn('type');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -33,13 +33,4 @@ class IncreaseIdLengths extends Migration
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -15,13 +15,4 @@ class RemoveSubfleetTypeIndex extends Migration
|
||||
$table->dropUnique(['type']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use App\Models\Enums\PageType;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -10,11 +11,6 @@ use Illuminate\Support\Facades\Schema;
|
||||
*/
|
||||
class CreatePages extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pages', function (Blueprint $table) {
|
||||
@@ -22,7 +18,7 @@ class CreatePages extends Migration
|
||||
$table->string('name');
|
||||
$table->string('slug');
|
||||
$table->string('icon');
|
||||
$table->unsignedSmallInteger('type');
|
||||
$table->unsignedSmallInteger('type')->default(PageType::PAGE);
|
||||
$table->boolean('public');
|
||||
$table->boolean('enabled');
|
||||
$table->mediumText('body');
|
||||
@@ -32,11 +28,6 @@ class CreatePages extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('pages');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -9,11 +9,7 @@ class AirlineRemoveNullable extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table('airlines', function (Blueprint $table) {
|
||||
$table->dropUnique('airlines_iata_unique');
|
||||
$table->dropUnique(['iata']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -12,8 +12,4 @@ class PageIconNullable extends Migration
|
||||
$table->string('icon')->change()->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
33
app/Database/migrations/2020_06_09_141153_pages_add_link.php
Normal file
33
app/Database/migrations/2020_06_09_141153_pages_add_link.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Add a `link` column and make the body optional. Also add a "new_window" bool
|
||||
* which determines if we open this link in a new window or not
|
||||
*/
|
||||
class PagesAddLink extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('pages', function (Blueprint $table) {
|
||||
$table->string('body')->change()->nullable();
|
||||
$table->string('link')
|
||||
->default('')
|
||||
->nullable()
|
||||
->after('body');
|
||||
|
||||
$table->boolean('new_window')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('fares', function (Blueprint $table) {
|
||||
$table->dropColumn('link');
|
||||
$table->dropColumn('new_window');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Model;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Add two tables for holding user fields and the values
|
||||
*/
|
||||
class CreateUserFields extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
/*
|
||||
* Hold a master list of fields
|
||||
*/
|
||||
Schema::create('user_fields', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name', 200);
|
||||
$table->text('description')->nullable();
|
||||
$table->boolean('show_on_registration')->default(false)->nullable();
|
||||
$table->boolean('required')->default(false)->nullable();
|
||||
$table->boolean('private')->default(false)->nullable();
|
||||
$table->boolean('active')->default(true)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
/*
|
||||
* The values for the actual fields
|
||||
*/
|
||||
Schema::create('user_field_values', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('user_field_id');
|
||||
$table->string('user_id', Model::ID_MAX_LENGTH);
|
||||
$table->text('value')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_field_id', 'user_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Add a `mtow` column for the max takeoff weight
|
||||
*/
|
||||
class AircraftAddMtow extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('aircraft', function (Blueprint $table) {
|
||||
$table->unsignedDecimal('mtow')
|
||||
->nullable()
|
||||
->default(0.0)
|
||||
->after('hex_code');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('aircraft', function (Blueprint $table) {
|
||||
$table->dropColumn('mtow');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateModulesTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('modules', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->boolean('enabled')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
$this->addModule(['name' => 'Awards']);
|
||||
$this->addModule(['name' => 'Sample']);
|
||||
$this->addModule(['name' => 'VMSAcars']);
|
||||
$this->addModule(['name' => 'Vacentral']);
|
||||
$this->addModule(['name' => 'TestModule']);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('modules');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Change the pages body column type to a Medium Text, max size of 16MB
|
||||
*/
|
||||
class ModifyPagesSize extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('pages', function (Blueprint $table) {
|
||||
$table->mediumText('body')->change()->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Change the downloads link size
|
||||
*/
|
||||
class ModifyDownloadLinkSize extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('files', function (Blueprint $table) {
|
||||
$table->mediumText('disk')->change()->nullable();
|
||||
$table->mediumText('path')->change()->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Add a hub to the subfleet is
|
||||
*/
|
||||
class AddHubToSubfleets extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('subfleets', function (Blueprint $table) {
|
||||
$table->string('hub_id', 4)
|
||||
->nullable()
|
||||
->after('airline_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Change the vertical speed for the acars table to a double
|
||||
*/
|
||||
class ChangeAcarsVsType extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('acars', function (Blueprint $table) {
|
||||
$table->float('vs')->change()->default(0.0)->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user