Skip to content
This repository has been archived by the owner on Jan 29, 2021. It is now read-only.

Upgrade to Laravel 5.6 #1063

Closed
wants to merge 13 commits into from
16 changes: 5 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,15 @@ root = true


[*]
indent_style = space
indent_size = 2

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true

[*.php]
indent_style = space
indent_size = 4

[*.json]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.php]
indent_size = 4
7 changes: 4 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG=daily
APP_LOG_LEVEL=debug
APP_URL=http://rogue.test

LOG_CHANNEL=daily
LOG_SLACK_WEBHOOK_URL=

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
Expand All @@ -13,8 +14,8 @@ DB_USERNAME=homestead
DB_PASSWORD=secret

CACHE_DRIVER=redis
FILESYSTEM_DRIVER=public
SESSION_DRIVER=redis
STORAGE_DRIVER=public
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
Expand Down
18 changes: 8 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
/vendor
/node_modules
/public/storage
/storage/debugbar
Homestead.yaml
Homestead.json
.DS_Store
.env
.env.dusk.local
.phpunit.result.cache

.DS_Store
vendor
node_modules
storage/debugbar
Homestead.yaml
Homestead.json

public/assets/**
public/dist
public/storage

npm-debug.log

/_book
10 changes: 5 additions & 5 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,13 @@
"ASHES_USERNAME": {
"required": true
},
"ROGUE_API_KEY": {
"AWS_S3_BUCKET": {
"required": true
},
"AWS_S3_URL": {
"required": true
},
"S3_BUCKET": {
"ROGUE_API_KEY": {
"required": true
},
"S3_KEY": {
Expand All @@ -91,9 +94,6 @@
},
"S3_SECRET": {
"required": true
},
"S3_URL": {
"required": true
}
}
}
26 changes: 12 additions & 14 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,37 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @param \Exception $exceptionxception
* @return void
*/
public function report(Exception $e)
public function report(Exception $exception)
{
parent::report($e);
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response
* @param \Exception $exception
* @return \Illuminate\Http\Response | \Symfony\Component\HttpFoundation\Response
*/
public function render($request, Exception $e)
public function render($request, Exception $exception)
{
// If Intervention can't parse a file (corrupted or wrong type), return 422.
// @TODO: Handle this with a validation rule on our v3 routes.
if ($e instanceof \Intervention\Image\Exception\NotReadableException) {
if ($exception instanceof \Intervention\Image\Exception\NotReadableException) {
abort(422, 'Invalid image provided.');
}

// Re-cast specific exceptions or uniquely render them:
if ($e instanceof GlideNotFoundException) {
$e = new NotFoundHttpException('That image could not be found.');
} elseif ($e instanceof ModelNotFoundException) {
$e = new NotFoundHttpException('That resource could not be found.');
if ($exception instanceof GlideNotFoundException) {
$exception = new NotFoundHttpException('That image could not be found.');
} elseif ($exception instanceof ModelNotFoundException) {
$exception = new NotFoundHttpException('That resource could not be found.');
}

return parent::render($request, $e);
return parent::render($request, $exception);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Kernel extends HttpKernel
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Rogue\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\Rogue\Http\Middleware\TrustProxies::class,
Expand Down Expand Up @@ -58,8 +58,10 @@ class Kernel extends HttpKernel
'guard' => \DoSomething\Gateway\Server\Middleware\SetGuard::class,
'scopes' => \DoSomething\Gateway\Server\Middleware\RequireScope::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \Rogue\Http\Middleware\RedirectIfAuthenticated::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'role' => \Rogue\Http\Middleware\CheckRole::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
];
Expand Down
17 changes: 17 additions & 0 deletions app/Http/Middleware/CheckForMaintenanceMode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Rogue\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;

class CheckForMaintenanceMode extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}
15 changes: 4 additions & 11 deletions app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,16 @@
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application,
* sourced from 'config/trustedproxy.php'.
* The trusted proxies for this application.
*
* @var array
*/
protected $proxies;

/**
* The current proxy header mappings.
* The headers that should be used to detect proxies.
*
* @var array
* @var int
*/
protected $headers = [
Request::HEADER_FORWARDED => null, // Not set on AWS or Heroku.
Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
Request::HEADER_X_FORWARDED_HOST => null, // Not set on AWS or Heroku.
Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',
];
protected $headers = Request::HEADER_X_FORWARDED_ALL;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm less familiar with Trusted Proxy and want to make sure the new bit property is fine that should encompass the prior series of headers.

}
2 changes: 1 addition & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function boot()
}, 'The :attribute must be a valid ISO-3166-2 region code.');

// Attach the user & request ID to context for all log messages.
Log::getMonolog()->pushProcessor(function ($record) {
Log::getLogger()->pushProcessor(function ($record) {
$record['extra']['user_id'] = auth()->id();
$record['extra']['client_id'] = token()->client();
$record['extra']['request_id'] = request()->header('X-Request-Id');
Expand Down
6 changes: 4 additions & 2 deletions artisan
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env php
<?php

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
Expand All @@ -13,7 +15,7 @@
|
*/

require __DIR__.'/bootstrap/autoload.php';
require __DIR__.'/vendor/autoload.php';

$app = require_once __DIR__.'/bootstrap/app.php';

Expand All @@ -40,7 +42,7 @@ $status = $kernel->handle(
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running. We will fire off the shutdown events
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
Expand Down
34 changes: 0 additions & 34 deletions bootstrap/autoload.php

This file was deleted.

18 changes: 11 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"type": "project",
"require": {
"php": "~7.3.0",
"laravel/framework": "5.5.*",
"laravel/framework": "5.6.*",
"aws/aws-sdk-php-laravel": "^3.1",
"doctrine/dbal": "~2.5.13",
"dosomething/gateway": "^2.2",
"fideloper/proxy": "^3.3",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.2",
"intervention/image": "^2.3",
"league/flysystem-aws-s3-v3": "~1.0",
Expand All @@ -22,7 +22,6 @@
"ext-gd": "*",
"ext-exif": "*",
"ext-bcmath": "*",
"fzaninotto/faker": "^1.6",
"ext-newrelic": "*",
"sokil/php-isocodes": "^3.0",
"myclabs/php-enum": "^1.7",
Expand All @@ -32,10 +31,12 @@
"algolia/algoliasearch-client-php": "^2.6"
},
"require-dev": {
"filp/whoops": "~2.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.6",
"laravel/tinker": "^1.0",
"mockery/mockery": "^0.9.5",
"phpunit/phpunit": "~6.0",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*",
"itsgoingd/clockwork": "^3.0"
Expand Down Expand Up @@ -69,6 +70,9 @@
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
Loading