Pull in mergeable upstream laravel updates

This commit is contained in:
Kevin MacMartin 2017-09-26 13:22:15 -04:00
parent b15d7cced9
commit 875ecb33aa
22 changed files with 110 additions and 92 deletions

View file

@ -29,12 +29,14 @@ class Kernel extends ConsoleKernel
} }
/** /**
* Register the Closure based commands for the application. * Register the commands for the application.
* *
* @return void * @return void
*/ */
protected function commands() protected function commands()
{ {
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php'); require base_path('routes/console.php');
} }
} }

View file

@ -3,23 +3,27 @@
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
{ {
/** /**
* A list of the exception types that should not be reported. * A list of the exception types that are not reported.
* *
* @var array * @var array
*/ */
protected $dontReport = [ protected $dontReport = [
\Illuminate\Auth\AuthenticationException::class, //
\Illuminate\Auth\Access\AuthorizationException::class, ];
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Database\Eloquent\ModelNotFoundException::class, /**
\Illuminate\Session\TokenMismatchException::class, * A list of the inputs that are never flashed for validation exceptions.
\Illuminate\Validation\ValidationException::class, *
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
]; ];
/** /**
@ -46,20 +50,4 @@ class Handler extends ExceptionHandler
{ {
return parent::render($request, $exception); return parent::render($request, $exception);
} }
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest('login');
}
} }

View file

@ -48,9 +48,9 @@ class RegisterController extends Controller
protected function validator(array $data) protected function validator(array $data)
{ {
return Validator::make($data, [ return Validator::make($data, [
'name' => 'required|max:255', 'name' => 'required|string|max:255',
'email' => 'required|email|max:255|unique:users', 'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|min:6|confirmed', 'password' => 'required|string|min:6|confirmed',
]); ]);
} }
@ -58,7 +58,7 @@ class RegisterController extends Controller
* Create a new user instance after a valid registration. * Create a new user instance after a valid registration.
* *
* @param array $data * @param array $data
* @return User * @return \App\User
*/ */
protected function create(array $data) protected function create(array $data)
{ {

View file

@ -18,6 +18,7 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class, \App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
]; ];
/** /**

View file

@ -2,9 +2,9 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter; use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends BaseEncrypter class EncryptCookies extends Middleware
{ {
/** /**
* The names of the cookies that should not be encrypted. * The names of the cookies that should not be encrypted.

View file

@ -2,9 +2,9 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as BaseTrimmer; use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends BaseTrimmer class TrimStrings extends Middleware
{ {
/** /**
* The names of the attributes that should not be trimmed. * The names of the attributes that should not be trimmed.

View file

@ -0,0 +1,29 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array
*/
protected $proxies;
/**
* The current proxy header mappings.
*
* @var array
*/
protected $headers = [
Request::HEADER_FORWARDED => 'FORWARDED',
Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',
];
}

View file

@ -2,9 +2,9 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends BaseVerifier class VerifyCsrfToken extends Middleware
{ {
/** /**
* The URIs that should be excluded from CSRF verification. * The URIs that should be excluded from CSRF verification.

View file

@ -13,7 +13,7 @@ class EventServiceProvider extends ServiceProvider
* @var array * @var array
*/ */
protected $listen = [ protected $listen = [
'App\Events\SomeEvent' => [ 'App\Events\Event' => [
'App\Listeners\EventListener', 'App\Listeners\EventListener',
], ],
]; ];

View file

@ -1,6 +1,8 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
define('LARAVEL_START', microtime(true));
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Register The Auto Loader | Register The Auto Loader
@ -13,7 +15,7 @@
| |
*/ */
require __DIR__.'/bootstrap/autoload.php'; require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php'; $app = require_once __DIR__.'/bootstrap/app.php';
@ -40,7 +42,7 @@ $status = $kernel->handle(
| Shutdown The Application | 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 | 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. | down the process. This is the last thing to happen to the request.
| |

View file

@ -1,34 +0,0 @@
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Include The Compiled Class File
|--------------------------------------------------------------------------
|
| To dramatically increase your application's performance, you may use a
| compiled class file which contains all of the classes commonly used
| by a request. The Artisan "optimize" is used to create this file.
|
*/
$compiledPath = __DIR__.'/cache/compiled.php';
if (file_exists($compiledPath)) {
require $compiledPath;
}

View file

@ -46,6 +46,7 @@ return [
'database' => env('DB_DATABASE', 'forge'), 'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'), 'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''), 'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4', 'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci', 'collation' => 'utf8mb4_unicode_ci',
'prefix' => '', 'prefix' => '',
@ -66,6 +67,17 @@ return [
'sslmode' => 'prefer', 'sslmode' => 'prefer',
], ],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
], ],
/* /*

View file

@ -13,7 +13,7 @@ return [
| |
*/ */
'default' => 'local', 'default' => env('FILESYSTEM_DRIVER', 'local'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -26,7 +26,7 @@ return [
| |
*/ */
'cloud' => 's3', 'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View file

@ -88,6 +88,19 @@ return [
'password' => env('MAIL_PASSWORD'), 'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Markdown Mail Settings | Markdown Mail Settings

View file

@ -1,18 +1,19 @@
<?php <?php
use Faker\Generator as Faker;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Model Factories | Model Factories
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may define all of your model factories. Model factories give | This directory should contain each of the model factory definitions for
| you a convenient way to create models for testing and seeding your | your application. Factories provide a convenient way to generate new
| database. Just tell the factory how a default model should look. | model instances for testing / seeding your application's database.
| |
*/ */
/** @var \Illuminate\Database\Eloquent\Factory $factory */ $factory->define(App\User::class, function (Faker $faker) {
$factory->define(App\User::class, function (Faker\Generator $faker) {
static $password; static $password;
return [ return [

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false" <phpunit backupGlobals="false"
backupStaticAttributes="false" backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php" bootstrap="vendor/autoload.php"
colors="true" colors="true"
convertErrorsToExceptions="true" convertErrorsToExceptions="true"
convertNoticesToExceptions="true" convertNoticesToExceptions="true"
@ -9,11 +9,11 @@
processIsolation="false" processIsolation="false"
stopOnFailure="false"> stopOnFailure="false">
<testsuites> <testsuites>
<testsuite name="Feature Tests"> <testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory> <directory suffix="Test.php">./tests/Feature</directory>
</testsuite> </testsuite>
<testsuite name="Unit Tests"> <testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory> <directory suffix="Test.php">./tests/Unit</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>

View file

@ -1,13 +1,14 @@
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
<IfModule mod_negotiation.c> <IfModule mod_negotiation.c>
Options -MultiViews Options -MultiViews -Indexes
</IfModule> </IfModule>
RewriteEngine On RewriteEngine On
# Redirect Trailing Slashes If Not A Folder... # Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301] RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller... # Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d

View file

@ -7,6 +7,8 @@
* @author Taylor Otwell <taylor@laravel.com> * @author Taylor Otwell <taylor@laravel.com>
*/ */
define('LARAVEL_START', microtime(true));
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Register The Auto Loader | Register The Auto Loader
@ -15,11 +17,11 @@
| Composer provides a convenient, automatically generated class loader for | Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it | our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual | into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels nice to relax. | loading any of our classes later on. It feels great to relax.
| |
*/ */
require __DIR__.'/../bootstrap/autoload.php'; require __DIR__.'/../vendor/autoload.php';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View file

@ -41,12 +41,14 @@ return [
'email' => 'The :attribute must be a valid email address.', 'email' => 'The :attribute must be a valid email address.',
'exists' => 'The selected :attribute is invalid.', 'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.', 'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field is required.', 'filled' => 'The :attribute field must have a value.',
'image' => 'The :attribute must be an image.', 'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.', 'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.', 'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.', 'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.', 'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.', 'json' => 'The :attribute must be a valid JSON string.',
'max' => [ 'max' => [
'numeric' => 'The :attribute may not be greater than :max.', 'numeric' => 'The :attribute may not be greater than :max.',

2
storage/framework/testing/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore

View file

@ -3,9 +3,7 @@
namespace Tests\Feature; namespace Tests\Feature;
use Tests\TestCase; use Tests\TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware; use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase class ExampleTest extends TestCase
{ {

View file

@ -3,8 +3,7 @@
namespace Tests\Unit; namespace Tests\Unit;
use Tests\TestCase; use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase class ExampleTest extends TestCase
{ {