From 2b5e17ab4e5d1632c581cfa013acbfd857509771 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Fri, 11 Aug 2017 21:02:03 +0100 Subject: [PATCH] Squashed commit of the following: commit 7daedd241246bd11f371a8c93394796f8f5ec4cb Author: Jonny Barnes Date: Fri Aug 11 21:01:17 2017 +0100 Bring in the latest changes from upstream repo laravel/laravel --- .env.example | 16 ++-- .gitattributes | 1 + .gitignore | 5 +- app/Http/Controllers/Auth/LoginController.php | 4 +- .../Controllers/Auth/RegisterController.php | 8 +- app/Http/Kernel.php | 3 +- .../Middleware/RedirectIfAuthenticated.php | 2 +- app/Providers/AuthServiceProvider.php | 1 + app/Providers/EventServiceProvider.php | 2 +- app/Providers/RouteServiceProvider.php | 1 - artisan | 2 +- bootstrap/autoload.php | 4 +- config/auth.php | 1 + config/database.php | 13 ++- config/filesystems.php | 4 +- config/mail.php | 1 + config/services.php | 2 +- config/session.php | 2 +- database/factories/ModelFactory.php | 4 +- phpunit.xml | 4 +- public/index.php | 2 +- resources/lang/en/pagination.php | 2 +- resources/lang/en/validation.php | 10 ++- resources/views/welcome.blade.php | 88 ++++++++++++++----- server.php | 2 +- tests/CreatesApplication.php | 2 + tests/Feature/ExampleTest.php | 1 + 27 files changed, 132 insertions(+), 55 deletions(-) diff --git a/.env.example b/.env.example index 138332c6..21e860aa 100644 --- a/.env.example +++ b/.env.example @@ -1,10 +1,8 @@ +APP_NAME=Laravel APP_ENV=production APP_KEY=SomeRandomString # Leave this APP_DEBUG=false APP_LOG_LEVEL=warning -APP_TIMEZONE=UTC -APP_LANG=en -APP_LOG=daily DB_CONNECTION=pgsql DB_HOST=127.0.0.1 @@ -13,6 +11,7 @@ DB_DATABASE= DB_USERNAME= DB_PASSWORD= +BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync @@ -27,8 +26,10 @@ MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null -MAILGUN_DOMAIN=null -MAILGUN_SECRET=null + +PUSHER_APP_ID= +PUSHER_APP_KEY= +PUSHER_APP_SECRET= AWS_S3_KEY=your-key AWS_S3_SECRET=your-secret @@ -54,3 +55,8 @@ SCOUT_DRIVER=pgsql PIWIK=false PIWIK_ID=1 PIWIK_URL=https://analytics.jmb.lv/piwik.php + +APP_TIMEZONE=UTC +APP_LANG=en +APP_LOG=daily +SECURE_SESSION_COOKIE=true diff --git a/.gitattributes b/.gitattributes index 2195b20d..967315dd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,4 @@ *.css linguist-vendored *.scss linguist-vendored *.js linguist-vendored +CHANGELOG.md export-ignore diff --git a/.gitignore b/.gitignore index c8cae252..b4bc6662 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,14 @@ /node_modules -/public/storage /public/hot +/public/storage /storage/*.key /vendor /.idea +/.vagrant Homestead.yaml Homestead.json +.npm-debug.log +yarn-error.log .env /public/files /public/keybase.txt diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 2abd9e04..b2ea669a 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -21,7 +21,7 @@ class LoginController extends Controller use AuthenticatesUsers; /** - * Where to redirect users after login / registration. + * Where to redirect users after login. * * @var string */ @@ -34,6 +34,6 @@ class LoginController extends Controller */ public function __construct() { - $this->middleware('guest', ['except' => 'logout']); + $this->middleware('guest')->except('logout'); } } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index e48e2e3b..ed8d1b77 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -23,7 +23,7 @@ class RegisterController extends Controller use RegistersUsers; /** - * Where to redirect users after login / registration. + * Where to redirect users after registration. * * @var string */ @@ -48,9 +48,9 @@ class RegisterController extends Controller protected function validator(array $data) { return Validator::make($data, [ - 'name' => 'required|max:255', - 'email' => 'required|email|max:255|unique:users', - 'password' => 'required|min:6|confirmed', + 'name' => 'required|string|max:255', + 'email' => 'required|string|email|max:255|unique:users', + 'password' => 'required|string|min:6|confirmed', ]); } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 1fad4108..c8b1e55b 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -30,6 +30,7 @@ class Kernel extends HttpKernel \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, + // \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, @@ -57,8 +58,8 @@ class Kernel extends HttpKernel 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, - 'myauth' => \App\Http\Middleware\MyAuthMiddleware::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'micropub.token' => \App\Http\Middleware\VerifyMicropubToken::class, + 'myauth' => \App\Http\Middleware\MyAuthMiddleware::class, ]; } diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index e27860e2..e4cec9c8 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -18,7 +18,7 @@ class RedirectIfAuthenticated public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { - return redirect('/'); + return redirect('/home'); } return $next($request); diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index f3e3c3fc..db3c26f9 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; +use Illuminate\Support\Facades\Gate; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; class AuthServiceProvider extends ServiceProvider diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 9b28f3e3..fca6152c 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -19,7 +19,7 @@ class EventServiceProvider extends ServiceProvider ]; /** - * Register any other events for your application. + * Register any events for your application. * * @return void */ diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 1b9577e3..5ea48d39 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -19,7 +19,6 @@ class RouteServiceProvider extends ServiceProvider /** * Define your route model bindings, pattern filters, etc. * - * @param \Illuminate\Routing\Router $router * @return void */ public function boot() diff --git a/artisan b/artisan index df630d0d..44dc07b0 100755 --- a/artisan +++ b/artisan @@ -40,7 +40,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. | diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php index 94adc997..c64e19fa 100644 --- a/bootstrap/autoload.php +++ b/bootstrap/autoload.php @@ -9,8 +9,8 @@ define('LARAVEL_START', microtime(true)); | | 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. +| into the script here so we do not have to manually load any of +| our application's PHP classes. It just feels great to relax. | */ diff --git a/config/auth.php b/config/auth.php index 97b29789..78175010 100644 --- a/config/auth.php +++ b/config/auth.php @@ -90,6 +90,7 @@ return [ | they have less time to be guessed. You may change this as needed. | */ + 'passwords' => [ 'users' => [ 'provider' => 'users', diff --git a/config/database.php b/config/database.php index cd74d4d7..9b9632e8 100644 --- a/config/database.php +++ b/config/database.php @@ -67,6 +67,17 @@ return [ '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' => '', + ], + 'travis' => [ 'driver' => 'pgsql', 'host' => 'localhost', @@ -106,7 +117,7 @@ return [ 'redis' => [ - 'cluster' => false, + 'client' => 'predis', 'default' => [ 'host' => env('REDIS_HOST', 'localhost'), diff --git a/config/filesystems.php b/config/filesystems.php index 38b34b97..6721ad67 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -13,7 +13,7 @@ return [ | */ - 'default' => 'local', + 'default' => env('FILESYSTEM_DRIVER', 'local'), /* |-------------------------------------------------------------------------- @@ -26,7 +26,7 @@ return [ | */ - 'cloud' => 's3', + 'cloud' => env('FILESYSTEM_CLOUD', 's3'), /* |-------------------------------------------------------------------------- diff --git a/config/mail.php b/config/mail.php index 2884c67a..95ebf4ee 100644 --- a/config/mail.php +++ b/config/mail.php @@ -113,6 +113,7 @@ return [ 'markdown' => [ 'theme' => 'default', + 'paths' => [ resource_path('views/vendor/mail'), ], diff --git a/config/services.php b/config/services.php index 287b1186..4460f0ec 100644 --- a/config/services.php +++ b/config/services.php @@ -8,7 +8,7 @@ return [ |-------------------------------------------------------------------------- | | This file is for storing the credentials for third party services such - | as Stripe, Mailgun, Mandrill, and others. This file provides a sane + | as Stripe, Mailgun, SparkPost and others. This file provides a sane | default location for this type of information, allowing packages | to have a conventional place to find your various credentials. | diff --git a/config/session.php b/config/session.php index 2ea2eed5..659fb767 100644 --- a/config/session.php +++ b/config/session.php @@ -161,7 +161,7 @@ return [ | */ - 'secure' => (config('app.env') != 'testing'), + 'secure' => env('SESSION_SECURE_COOKIE', false), /* |-------------------------------------------------------------------------- diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index b4663e4d..8ad6c471 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -13,10 +13,12 @@ /** @var \Illuminate\Database\Eloquent\Factory $factory */ $factory->define(App\User::class, function (Faker\Generator $faker) { + static $password; + return [ 'name' => $faker->name, 'email' => $faker->safeEmail, - 'password' => bcrypt(str_random(10)), + 'password' => $password ?: $password = bcrypt('secret'), 'remember_token' => str_random(10), ]; }); diff --git a/phpunit.xml b/phpunit.xml index 88860829..da3bb8c8 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -9,10 +9,10 @@ processIsolation="false" stopOnFailure="false"> - + ./tests/Feature - + ./tests/Unit diff --git a/public/index.php b/public/index.php index 716731f8..1e1d775f 100644 --- a/public/index.php +++ b/public/index.php @@ -15,7 +15,7 @@ | Composer provides a convenient, automatically generated class loader for | 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 -| loading any of our classes later on. It feels nice to relax. +| loading any of our classes later on. It feels great to relax. | */ diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php index fcab34b2..d4814118 100644 --- a/resources/lang/en/pagination.php +++ b/resources/lang/en/pagination.php @@ -14,6 +14,6 @@ return [ */ 'previous' => '« Previous', - 'next' => 'Next »', + 'next' => 'Next »', ]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index de05cd2e..edc036dd 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -16,11 +16,13 @@ return [ 'accepted' => 'The :attribute must be accepted.', 'active_url' => 'The :attribute is not a valid URL.', 'after' => 'The :attribute must be a date after :date.', + 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', 'alpha' => 'The :attribute may only contain letters.', 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', 'alpha_num' => 'The :attribute may only contain letters and numbers.', 'array' => 'The :attribute must be an array.', 'before' => 'The :attribute must be a date before :date.', + 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', 'between' => [ 'numeric' => 'The :attribute must be between :min and :max.', 'file' => 'The :attribute must be between :min and :max kilobytes.', @@ -38,13 +40,15 @@ return [ 'distinct' => 'The :attribute field has a duplicate value.', 'email' => 'The :attribute must be a valid email address.', 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.' - 'filled' => 'The :attribute field is required.', + 'file' => 'The :attribute must be a file.', + 'filled' => 'The :attribute field must have a value.', 'image' => 'The :attribute must be an image.', 'in' => 'The selected :attribute is invalid.', 'in_array' => 'The :attribute field does not exist in :other.', 'integer' => 'The :attribute must be an integer.', '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.', 'max' => [ 'numeric' => 'The :attribute may not be greater than :max.', @@ -53,6 +57,7 @@ return [ 'array' => 'The :attribute may not have more than :max items.', ], 'mimes' => 'The :attribute must be a file of type: :values.', + 'mimetypes' => 'The :attribute must be a file of type: :values.', 'min' => [ 'numeric' => 'The :attribute must be at least :min.', 'file' => 'The :attribute must be at least :min kilobytes.', @@ -80,6 +85,7 @@ return [ 'string' => 'The :attribute must be a string.', 'timezone' => 'The :attribute must be a valid zone.', 'unique' => 'The :attribute has already been taken.', + 'uploaded' => 'The :attribute failed to upload.', 'url' => 'The :attribute format is invalid.', /* diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 87710ace..396f7006 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -1,44 +1,86 @@ - - + + + + + + Laravel - + + + -
+
+ @if (Route::has('login')) + + @endif +
-
Laravel 5
+
+ Laravel +
+ +
diff --git a/server.php b/server.php index f65c7c44..5fb6379e 100644 --- a/server.php +++ b/server.php @@ -4,7 +4,7 @@ * Laravel - A PHP Framework For Web Artisans * * @package Laravel - * @author Taylor Otwell + * @author Taylor Otwell */ $uri = urldecode( diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index a2e89522..547152f6 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -14,7 +14,9 @@ trait CreatesApplication public function createApplication() { $app = require __DIR__.'/../bootstrap/app.php'; + $app->make(Kernel::class)->bootstrap(); + return $app; } } diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php index ed0d1cef..486dc271 100644 --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -17,6 +17,7 @@ class ExampleTest extends TestCase public function testBasicTest() { $response = $this->get('/'); + $response->assertStatus(200); } }