Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
daveroverts committed Jun 14, 2020
2 parents db82a69 + ccdd113 commit 06477e8
Show file tree
Hide file tree
Showing 77 changed files with 5,407 additions and 4,269 deletions.
23 changes: 20 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,26 @@ PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

SSO_KEY=
SSO_SECRET=
SSO_CERT=
# Connect
VATSIM_OAUTH_BASE=https://auth.vatsim.net
VATSIM_OAUTH_CLIENT=
VATSIM_OAUTH_SECRET=

#Branding
SITE_TITLE="Booking"
SITE_DIVISION="Divsion Name"
SITE_DIVISION_URL="https://division.org"
SITE_CONTACT_MAIL="[email protected]"
SITE_PILOTBRIEF_URL="https://www.division.org/visiting-pilots/"
SITE_CHARTS_URL="https://www.division.org/charts/"

#Bootstrap colors
BOOTSTRAP_COLOR_PRIMARY="#2C3E50"
BOOTSTRAP_COLOR_SECONDARY="#95a5a6"
BOOTSTRAP_COLOR_TERTIARY="#18BC9C"
BOOTSTRAP_COLOR_SUCCESS="#18BC9C"
BOOTSTRAP_COLOR_DANGER="#E74C3C"
BOOTSTRAP_COLOR_WARNING="#F39C12"

LARAVEL_PAGE_SPEED_ENABLE=true
ACTIVITY_LOGGER_ENABLED=true
Expand Down
13 changes: 13 additions & 0 deletions .env.gitlab.testing
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
APP_NAME="Book me a cookie (testing)"
APP_ENV=testing
APP_DEBUG=true

DB_CONNECTION=mysql
DB_HOST=mysql
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

LARAVEL_PAGE_SPEED_ENABLE=false
ACTIVITY_LOGGER_ENABLED=false
TELESCOPE_ENABLED=false
10 changes: 3 additions & 7 deletions .env.testing
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ APP_ENV=testing
APP_DEBUG=true

DB_CONNECTION=mysql
DB_HOST=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=root
DB_PASSWORD=secret

# Vatsim SSO demo
SSO_KEY=SSO_DEMO_VACC
SSO_SECRET=04i_~ruVUE.1-do1--sc
SSO_CERT="\\n-----BEGIN RSA PRIVATE KEY-----\\nMIIEpgIBAAKCAQEA2S5RckDw7SnEoZDmjaQHAQGajVlb7iwKIAX6nXbZBO7Uo3pN\\nItjmAbfkMqKBgWDVowM3UjbKivZNWGzkmxirArpbw9q7JhcX2LW6RfXx+5zn2+zW\\nm58nQtnEgZtj8U9z3yjJEwfGbiJHEt56pNY0VFV5sDbEiQ52d/bPHlH17j/SUfm6\\neWCbUWW5S8kI8LDuN40qtxCZ0InTfRvcI3bx0+UBf9T6SYQWK2DsS+bz2YtKxVom\\nOs9NdLbcPDK1rKPCJ+gvvmhCCt7jDbf1oFUzhPb6hjsIl1uRyjdtjhDb5FIokH+O\\n3LuZdvSGF/SkoBnkfnqg5yTjC0GrnPg+Dr++1QIDAQABAoIBAQDIAisJwJrgnx2x\\n+WMKQGwe1h5CXHAYOMCeW0NBLsmQDG8RmrldBUlVfcgPha8kukwlEvooocMIFOqI\\nK8iguSgMnBmUlmTSIGRatIm2kljm8spotIWzze93VlvtTHDPM++vLb135CovFSxF\\nSVTDZ23L2Of3i4iV/BbIRijacHq/jJ605OBcHhgW0ONCPUxL+uUd7siD68Y/BcYu\\nkm1OfQaxxryKdnE4UWzVKm0fwIzGvS/Baraek3kQCqOs7+OixV2YWFw6Xafq3WAp\\nPe5I/pJSevu90dGN01k84fVS6q3q419Z+VxarPYYznLrGGgUxM5zKlU4VHGwvA2p\\n857ydg3hAoGBAPFuOulYQW8DIas4rlPPGofQI+dT0w8xf/YB1WmCtlt0GkSmEzd+\\nJJZtcJiQSlTC4BuACvTBoIgo3vUC2wM5gZLz9NCeUHrwW0558q1YnGx1GNKcWgKK\\nLrYvWPCrOKVnDvfhSQ4P3CPeUyks4OUTiPHY+5QlBpY7c1hSBnJWSNKZAoGBAOZJ\\ndtle62ZK6S3TlIgbElaa1h8J5QyEFmcCPl47B4+SUNIljccO55OQhe89paMD2EH6\\nTbz9eP/s4U7X1tTb2onYtd7g3ldod/RBhrRHg7oXTmQj9wXopJsHwgNnYG59BPt2\\nxpnB7aTmMZCXTO2YRxR4CCTtnOO/TZeNZV/xIK+dAoGBAJQ2sJHZ7WmiSYQcquCm\\njsn7nF8CFdsI715uJ767UQn5z7p/HeL+XKXAj9QJGKjKbdxUEeXKDKwqMx3E4AEt\\nx38Ypx1/Yzbl4Zfew31pnbXzeQaql5Nhk2Wi0X4GDyNzjjvcoQWx9NpMPU9Uzsey\\n42pdY6zBwjZuTtRUnsKId/JZAoGBALzXVXyfF85Ec76+mDicaodWZWwCgy+mSXCj\\nKF3BbkvPojMR1Jd9o20gwJQVK3ToPDiud30ZJlZH++LZoDPhLe6IJWvlXq6y3lsQ\\nONQxKNY7Mm9wBqtzwTfYPsLnzO4N2z4Sgn2nx6bHlbGKQO09SFyCqbsOlu8z+v7i\\nVlU8uJ8JAoGBAOmzlKBcEjJdlD0ZxkgMxp+YqpKkC+ojzf4tORn6jo2d/aKUOIAR\\nbfRCMTmDmqyVoUH/SYgQWzD36zAy8HyHEz0U1k6+QMzWPbsEGQSQrk0DgnlOBPWo\\nO0gQ0RDS3gD8C5XHvy5vryYjUOB10rUn9A2xLQw4sqKv2suHvIhc0Eit\\n-----END RSA PRIVATE KEY-----\\n"
DB_PASSWORD=root

LARAVEL_PAGE_SPEED_ENABLE=false
ACTIVITY_LOGGER_ENABLED=false
Expand Down
92 changes: 92 additions & 0 deletions .github/workflows/laravel-mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# GitHub Action for Laravel with MySQL and Redis
name: Testing Laravel with MySQL
on: [push, pull_request]
jobs:
laravel:
name: Laravel (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: homestead
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis
ports:
- 6379/tcp
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
php-versions: ['7.4']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug #optional
tools: phpcs, phpcpd
- name: Start mysql service
run: sudo /etc/init.d/mysql start
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: Prepare the application
run: |
php -r "file_exists('.env') || copy('.env.testing', '.env');"
php artisan key:generate
- name: Clear Config
run: php artisan config:clear
- name: Run Migration
run: php artisan migrate -v
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
- name: Test with phpunit
run: vendor/bin/phpunit --coverage-text
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
- name: PHP_CodeSniffer
run: phpcs --extensions=php app
- name: Copy/Paste Detector
run: phpcpd app/ --min-lines=50
- name: Sensiolabs
run: php vendor/sensiolabs/security-checker security:check composer.lock
- name: Get node.js cache directory
id: node-cache-dir
run: echo "::set-output name=dir::$(npm config get cache)" # Use $(yarn cache dir) for yarn

- name: Cache NPM dependencies
uses: actions/cache@v1
with:
path: ${{ steps.node-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} # Use '**/yarn.lock' for yarn
restore-keys: ${{ runner.os }}-node-
- name: NPM Build
run: |
npm ci
npm run production --no-progress
cat public/mix-manifest.json # See asset versions in log
- name: Upload build files
uses: actions/upload-artifact@v1
with:
name: assets
path: public
8 changes: 6 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ image: edbizarro/gitlab-ci-pipeline-php:7.4-alpine

# Variables
variables:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_DATABASE: homestead
MYSQL_ROOT_PASSWORD: secret
DB_HOST: mysql

cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
Expand All @@ -31,7 +34,7 @@ composer:
script:
- php -v
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
- cp .env.testing .env
- cp .env.gitlab.testing .env
- php artisan key:generate
artifacts:
paths:
Expand Down Expand Up @@ -98,6 +101,7 @@ phpunit:
- composer
script:
- php -v
- cp .env.gitlab.testing .env
- vendor/bin/phpunit --coverage-text --colors=never --coverage-clover code-coverage --log-junit test-executions
artifacts:
paths:
Expand Down
31 changes: 27 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

### Changed

### Removed

## [v2.0.0](https://gitlab.com/daveroverts/Book-me-a-cookie/compare/v2.0.0...v1.5.3) - 2020-06-14

### Added
- Vatsim SSO replaced with Vatsim Connect
- ``BookingAdminController@import()`` now supports Route
- [davejamesmiller/laravel-breadcrumbs](https://github.com/davejamesmiller/laravel-breadcrumbs) replaced with [tabuna/breadcrumbs](https://github.com/tabuna/breadcrumbs)
- Possiblity to change the default Bootswatch Flatly colors #23 + various site variables #16, thanks to @blt950

### Changed
- Removed unique index for ``icao`` in ``2018_06_06_172719_create_airports_table.php`` to fix a problem in the first migrations, Thanks to @blt950
- Upgraded to Laravel 7
- ``BookingAdminController@import()`` now supports even more empty fields
- Homepage / Upcoming Events page layout #23, thanks to @blt950

### Removed
- Laravel Passport, as it was not really used

## [v1.5.3](https://gitlab.com/daveroverts/Book-me-a-cookie/compare/v1.5.3...v1.5.2) - 2020-03-04

### Changed
Expand Down Expand Up @@ -266,7 +289,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- ``full_name`` and ``event_name`` have been added
- Route binding for ``event`` now accepts ``id`` and ``slug``
- ``holdOnWeGotABadAss()`` that replaces all RickRolls

### Changed
- ``AirportTest`` and ``EventTest``
- ``.env.testing`` + ``MYSQL_DATABASE``
Expand Down Expand Up @@ -316,7 +339,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- UsersCollection / ``/users``
- PHP CodeSniffer xml file, source: [https://medium.com/@nandosalles/the-ruleset-phpcs-for-my-laravel-projects-a54cb3c95b31](https://medium.com/@nandosalles/the-ruleset-phpcs-for-my-laravel-projects-a54cb3c95b31)
- ``EventController@destroy()``
- Relation ``Airport``->``Event`` ``eventDep`` + ``eventArr``
- Relation ``Airport``->``Event`` ``eventDep`` + ``eventArr``
- ``EventController@update()``
- ``UpdateEvent`` Request
- ``events.show`` now actually does something
Expand Down Expand Up @@ -452,7 +475,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- Deployment procedure, due to [lorisleiva/laravel-deployer](https://github.com/lorisleiva/laravel-deployer) being added

### Removed
- ``AirportLinkController@show()``
- [svenluijten/artisan-view](https://github.com/svenluijten/artisan-view) as dev dependency
Expand Down Expand Up @@ -547,7 +570,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Replaces ``reservedBy_id`` and ``bookedBy_id`` with ``user_id`` and ``status``
- Start of using GitLab CI
- At the moment, only to run PHPUnit, later also to run Laravel Mix.

### Changed
- Some optimalisation on Eloquent models
- Updates FontAwesome to 5.2.0
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ Be sure to update your remotes ASAP. I've enabled mirroring, but chances are tha
Book me a Cookie is a booking system created in Laravel. It's initial purpose was to be used for one event (The Holland - America Line), howerver, this system is already ready to be used for more events.

# Features
- Uses [Vatsim SSO](https://forums.vatsim.net/viewforum.php?f=134)
- At the moment, only VACC tokens are supported non-VACC tokens will be supported in a new version
- Uses [Vatsim Connect](https://vatsimnetwork.github.io/documentation/connect)

# Installing
Before you begin, make sure you have a server to run everything on. For local development, I use [Laravel Homestead](https://laravel.com/docs/master/homestead).
Expand All @@ -17,13 +16,17 @@ Before you begin, make sure you have a server to run everything on. For local de
- ``production`` Vatsim SSO will be normally used, don't do this when testing.
- Anything else will use the demo server
- APP_URL: Be sure to set this, if you don't, SSO will redirect you incorrectly.
- BUGSNAG_API_KEY: If you don't use Bugsnag, fill in a random string here, or else you might get errors when running ``npm run prod``
- DB_*: As required
- If your database does not support long indexes, add ``DB_LOWER_STRING_LENGTH=true``
- QUEUE_DRIVER: I recommend either to use ``database`` or ``redis``, but this depends on your setup.
- MAIL_DRIVER: For testing, use something like [Mailtrap](https://mailtrap.io/) or [Mailhog](https://github.com/mailhog/MailHog) (included with [Laravel Homestead](https://laravel.com/docs/master/homestead))
- MAIL_FROM_ADDRESS: For testing, this can be anything.
- MAIL_FROM_NAME: This will be used as the ``From`` name.
- SSO_*: On production, fill you SSO credentials in. For the demo server, use [these](https://pastebin.com/AYYDVdqc)
- VATSIM_OAUTH_*: Fill in the required fields.
- SITE_*: Feel free to edit these. They are used all over the place.
- When adding a new redirect url, point to /login.
- BOOTSTRAP_COLOR*: By default, BMAC uses [Bootswatch Flatly](https://bootswatch.com/flatly/). If you wish to edit some colors, you can do so here.
3. Run the following commands:
- Production:
- ``composer install --optimize-autoloader --no-dev``
Expand All @@ -41,4 +44,8 @@ Before you begin, make sure you have a server to run everything on. For local de
- ``npm run dev``
4. Open the website, and login.
5. Open the database, and make yourself admin by setting ``isAdmin`` to ``1``.
6. To import airports, open route ``admin/airports/import``
6. To import airports, open route ``admin/airports/import``. Depending on your setup, this might take a little while, and you won't get a confirmation that import has been done. The script uses [this](https://github.com/jpatokal/openflights/blob/master/data/airports.dat) file as source.

# Import bookings template file
https://uploads.daveroverts.nl/import_template
Note that the **bold** fields are always required
10 changes: 5 additions & 5 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace App\Exceptions;

use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
Expand All @@ -30,10 +30,10 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* @param \Exception $exception
* @param \Throwable $exception
* @return void
*/
public function report(Exception $exception)
public function report(Throwable $exception)
{
parent::report($exception);
}
Expand All @@ -42,10 +42,10 @@ public function report(Exception $exception)
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Throwable $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
Expand Down
Loading

0 comments on commit 06477e8

Please sign in to comment.