Skip to content

Commit

Permalink
Merge pull request #86 from april-knights/feature-laravel.update
Browse files Browse the repository at this point in the history
Update Laravel to 10
  • Loading branch information
NorbiPeti authored Feb 21, 2024
2 parents 98221e7 + 16efccc commit 246c0a8
Show file tree
Hide file tree
Showing 12 changed files with 2,874 additions and 2,767 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.0-fpm AS development
FROM php:8.1-fpm AS development

RUN apt-get update && apt-get install -y wait-for-it libzip-dev zip gosu

Expand Down
6 changes: 3 additions & 3 deletions .docker/app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ chown :www-data bootstrap/cache \
storage/framework/cache/data \
storage/logs

# Wait for the database to start before running migrations or running artisan commands at all
wait-for-it database:3306 -t 0 || exit 1

# Copy the default environment for first run and make it writable by anyone so that it can be edited
[ ! -f .env ] && cp .env.default .env && chmod ugo+rw .env && php artisan key:generate
# Or just set the key if not set yet
Expand All @@ -16,9 +19,6 @@ grep APP_KEY=CHANGEME .env > /dev/null && php artisan key:generate

gosu www-data php artisan package:discover --ansi

# Wait for the database to start before running migrations
wait-for-it squire-database:3306 -t 0 || exit 1

gosu www-data php artisan migrate

exec docker-php-entrypoint "$@"
7 changes: 3 additions & 4 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ services:
build:
dockerfile: Dockerfile
target: development
image: squire-web
image: local/squire/app
volumes:
- ..:/var/www/html
container_name: squire-app
# Linux only
# extra_hosts:
# - host.docker.internal:host-gateway
Expand All @@ -24,7 +23,6 @@ services:
environment:
- APP_HOST=app:8000
- WEB_PORT=80
container_name: squire-web
database:
image: mysql:5.7
ports:
Expand All @@ -34,11 +32,12 @@ services:
- MYSQL_DATABASE=squire
- MYSQL_USER=squire
- MYSQL_PASSWORD=DevelopmentPassword
container_name: squire-database
volumes:
- ./DBInitialize.sql:/docker-entrypoint-initdb.d/init.sql

networks:
default:
name: squire
driver: bridge

name: squire
2 changes: 1 addition & 1 deletion .env.default
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ APP_URL=http://0.0.0.0
LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=squire-database
DB_HOST=database
DB_PORT=3306
DB_DATABASE=squire
DB_USERNAME=squire
Expand Down
20 changes: 10 additions & 10 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Exceptions;

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

class Handler extends ExceptionHandler
{
Expand All @@ -29,27 +29,27 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* @param \Exception $exception
* @param Throwable $e
* @return void
*
* @throws \Exception
* @throws Throwable
*/
public function report(Exception $exception)
public function report(Throwable $e)
{
parent::report($exception);
parent::report($e);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Illuminate\Http\Request $request
* @param Throwable $e
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Exception
* @throws Throwable
*/
public function render($request, Exception $exception)
public function render($request, Throwable $e)
{
return parent::render($request, $exception);
return parent::render($request, $e);
}
}
9 changes: 7 additions & 2 deletions app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Http\Middleware;

use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;

class TrustProxies extends Middleware
Expand All @@ -19,5 +19,10 @@ class TrustProxies extends Middleware
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}
3 changes: 3 additions & 0 deletions app/Model/Battalion.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
class Battalion extends SquireModel {
use HasActiveTrait;

/**
* Unaffiliated
*/
const DEFAULT_BATTALION = 99;

protected static string|null $permName = 'batt';
Expand Down
2 changes: 0 additions & 2 deletions app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class AuthServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->registerPolicies();

Auth::provider('knight', function($app, array $config) {
return new KnightUserProvider($app['hash'], $config['model']);
});
Expand Down
24 changes: 10 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@
"framework",
"laravel"
],
"license": "MIT",
"license": "GPL-3.0-or-later",
"require": {
"php": "^8.0",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.20",
"laravel/framework": "^10.0",
"laravel/socialite": "^5.1",
"laravel/tinker": "^2.0",
"mews/purifier": "^3.2",
"socialiteproviders/reddit": "^4.1"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.6",
"facade/ignition": "^1.4",
"fzaninotto/faker": "^1.9.1",
"spatie/laravel-ignition": "^2.0",
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^9.3"
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0"
},
"config": {
"optimize-autoloader": true,
Expand All @@ -36,19 +35,16 @@
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
Expand Down
Loading

0 comments on commit 246c0a8

Please sign in to comment.