From b83783b10456f22399556ed268b9a396d8c35477 Mon Sep 17 00:00:00 2001 From: Laravel Shift Date: Tue, 6 Apr 2021 16:12:48 +0000 Subject: [PATCH 1/7] Shift bindings PHP 5.5.9+ adds the new static `class` property which provides the fully qualified class name. This is preferred over using class name strings as these references are checked by the parser. --- app/Providers/EventServiceProvider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index efab024..9b1b3df 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -13,8 +13,8 @@ class EventServiceProvider extends ServiceProvider * @var array */ protected $listen = [ - 'App\Events\FriendWasAdded' => [ - 'App\Listeners\FetchFriendInfo', + \App\Events\FriendWasAdded::class => [ + \App\Listeners\FetchFriendInfo::class, ], ]; From 0ce5fc05ea1eaf92c0ddeb2a0727c0275e4b850b Mon Sep 17 00:00:00 2001 From: Laravel Shift Date: Tue, 6 Apr 2021 16:12:48 +0000 Subject: [PATCH 2/7] Shift core files --- .../Controllers/Auth/RegisterController.php | 72 +++++++++++++++++++ bootstrap/app.php | 2 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 app/Http/Controllers/Auth/RegisterController.php diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php new file mode 100644 index 0000000..8d426ec --- /dev/null +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -0,0 +1,72 @@ +middleware('guest'); + } + + /** + * Get a validator for an incoming registration request. + * + * @param array $data + * @return \Illuminate\Contracts\Validation\Validator + */ + protected function validator(array $data) + { + return Validator::make($data, [ + 'name' => ['required', 'string', 'max:255'], + 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], + 'password' => ['required', 'string', 'min:6', 'confirmed'], + ]); + } + + /** + * Create a new user instance after a valid registration. + * + * @param array $data + * @return \App\User + */ + protected function create(array $data) + { + return User::create([ + 'name' => $data['name'], + 'email' => $data['email'], + 'password' => Hash::make($data['password']), + ]); + } +} diff --git a/bootstrap/app.php b/bootstrap/app.php index f2801ad..037e17d 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -12,7 +12,7 @@ */ $app = new Illuminate\Foundation\Application( - realpath(__DIR__.'/../') + $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__) ); /* From 75f8d9d9789c6dac93ae19c9644e1f316065df28 Mon Sep 17 00:00:00 2001 From: Laravel Shift Date: Tue, 6 Apr 2021 16:12:48 +0000 Subject: [PATCH 3/7] Shift config files --- .env.example | 2 +- config/broadcasting.php | 3 ++- config/cache.php | 8 +++++--- config/filesystems.php | 9 +++++---- config/hashing.php | 2 +- config/logging.php | 17 +++++++++++++++-- config/mail.php | 13 +++++++++++++ config/queue.php | 23 ++++++++++++----------- config/session.php | 28 ++++++++++++++++++++++++---- config/view.php | 5 ++++- phpunit.xml | 2 +- 11 files changed, 83 insertions(+), 29 deletions(-) diff --git a/.env.example b/.env.example index 0c02631..66b1c36 100644 --- a/.env.example +++ b/.env.example @@ -9,7 +9,7 @@ DB_PASSWORD= CACHE_DRIVER=file SESSION_DRIVER=file -QUEUE_DRIVER=sync +QUEUE_CONNECTION=sync MAIL_DRIVER=smtp MAIL_HOST=mailtrap.io diff --git a/config/broadcasting.php b/config/broadcasting.php index 5eecd2b..3ca45ea 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -36,7 +36,8 @@ 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ - // + 'cluster' => env('PUSHER_APP_CLUSTER'), + 'encrypted' => true, ], ], diff --git a/config/cache.php b/config/cache.php index e87f032..4f0b3c4 100644 --- a/config/cache.php +++ b/config/cache.php @@ -1,5 +1,7 @@ [ - // Memcached::OPT_CONNECT_TIMEOUT => 2000, + // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], 'servers' => [ [ @@ -70,7 +72,7 @@ 'redis' => [ 'driver' => 'redis', - 'connection' => 'default', + 'connection' => 'cache', ], ], @@ -86,6 +88,6 @@ | */ - 'prefix' => 'laravel', + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), ]; diff --git a/config/filesystems.php b/config/filesystems.php index 4544f60..77fa5de 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -37,7 +37,7 @@ | may even configure multiple disks of the same driver. Defaults have | been setup for each driver as an example of the required options. | - | Supported Drivers: "local", "ftp", "s3", "rackspace" + | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace" | */ @@ -57,10 +57,11 @@ 's3' => [ 'driver' => 's3', - 'key' => env('AWS_KEY'), - 'secret' => env('AWS_SECRET'), - 'region' => env('AWS_REGION'), + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), + 'url' => env('AWS_URL'), ], ], diff --git a/config/hashing.php b/config/hashing.php index d3c8e2f..8425770 100644 --- a/config/hashing.php +++ b/config/hashing.php @@ -11,7 +11,7 @@ | passwords for your application. By default, the bcrypt algorithm is | used; however, you remain free to modify this option if you wish. | - | Supported: "bcrypt", "argon" + | Supported: "bcrypt", "argon", "argon2id" | */ diff --git a/config/logging.php b/config/logging.php index 400bc7f..d09cd7d 100644 --- a/config/logging.php +++ b/config/logging.php @@ -1,6 +1,7 @@ [ 'stack' => [ 'driver' => 'stack', - 'channels' => ['single'], + 'channels' => ['daily'], + 'ignore_exceptions' => false, ], 'single' => [ @@ -48,7 +50,7 @@ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => 'debug', - 'days' => 7, + 'days' => 14, ], 'slack' => [ @@ -59,9 +61,20 @@ 'level' => 'critical', ], + 'papertrail' => [ + 'driver' => 'monolog', + 'level' => 'debug', + 'handler' => SyslogUdpHandler::class, + 'handler_with' => [ + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), + ], + ], + 'stderr' => [ 'driver' => 'monolog', 'handler' => StreamHandler::class, + 'formatter' => env('LOG_STDERR_FORMATTER'), 'with' => [ 'stream' => 'php://stderr', ], diff --git a/config/mail.php b/config/mail.php index bb92224..f400645 100644 --- a/config/mail.php +++ b/config/mail.php @@ -120,4 +120,17 @@ ], ], + /* + |-------------------------------------------------------------------------- + | Log Channel + |-------------------------------------------------------------------------- + | + | If you are using the "log" driver, you may specify the logging channel + | if you prefer to keep mail messages separate from other log entries + | for simpler reading. Otherwise, the default channel will be used. + | + */ + + 'log_channel' => env('MAIL_LOG_CHANNEL'), + ]; diff --git a/config/queue.php b/config/queue.php index 4d83ebd..c1430b4 100644 --- a/config/queue.php +++ b/config/queue.php @@ -4,18 +4,16 @@ /* |-------------------------------------------------------------------------- - | Default Queue Driver + | Default Queue Connection Name |-------------------------------------------------------------------------- | | Laravel's queue API supports an assortment of back-ends via a single | API, giving you convenient access to each back-end using the same - | syntax for each one. Here you may set the default queue driver. - | - | Supported: "sync", "database", "beanstalkd", "sqs", "redis", "null" + | syntax for every one. Here you may define a default connection. | */ - 'default' => env('QUEUE_DRIVER', 'sync'), + 'default' => env('QUEUE_CONNECTION', 'sync'), /* |-------------------------------------------------------------------------- @@ -26,6 +24,8 @@ | is used by your application. A default configuration has been added | for each back-end shipped with Laravel. You are free to add more. | + | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" + | */ 'connections' => [ @@ -50,18 +50,19 @@ 'sqs' => [ 'driver' => 'sqs', - 'key' => 'your-public-key', - 'secret' => 'your-secret-key', - 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', - 'queue' => 'your-queue-name', - 'region' => 'us-east-1', + 'key' => env('SQS_KEY', 'your-public-key'), + 'secret' => env('SQS_SECRET', 'your-secret-key'), + 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), + 'queue' => env('SQS_QUEUE', 'your-queue-name'), + 'region' => env('SQS_REGION', 'us-east-1'), ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', - 'queue' => 'default', + 'queue' => env('REDIS_QUEUE', 'default'), 'retry_after' => 90, + 'block_for' => null, ], ], diff --git a/config/session.php b/config/session.php index e2779ad..fae302a 100644 --- a/config/session.php +++ b/config/session.php @@ -1,5 +1,7 @@ 120, + 'lifetime' => env('SESSION_LIFETIME', 120), 'expire_on_close' => false, @@ -70,7 +72,7 @@ | */ - 'connection' => null, + 'connection' => env('SESSION_CONNECTION', null), /* |-------------------------------------------------------------------------- @@ -96,7 +98,7 @@ | */ - 'store' => null, + 'store' => env('SESSION_STORE', null), /* |-------------------------------------------------------------------------- @@ -122,7 +124,10 @@ | */ - 'cookie' => 'laravel_session', + 'cookie' => env( + 'SESSION_COOKIE', + Str::slug(env('APP_NAME', 'laravel'), '_').'_session' + ), /* |-------------------------------------------------------------------------- @@ -176,4 +181,19 @@ 'http_only' => true, + /* + |-------------------------------------------------------------------------- + | Same-Site Cookies + |-------------------------------------------------------------------------- + | + | This option determines how your cookies behave when cross-site requests + | take place, and can be used to mitigate CSRF attacks. By default, we + | do not enable this as other CSRF protection services are in place. + | + | Supported: "lax", "strict" + | + */ + + 'same_site' => null, + ]; diff --git a/config/view.php b/config/view.php index 2acfd9c..22b8a18 100644 --- a/config/view.php +++ b/config/view.php @@ -28,6 +28,9 @@ | */ - 'compiled' => realpath(storage_path('framework/views')), + 'compiled' => env( + 'VIEW_COMPILED_PATH', + realpath(storage_path('framework/views')) + ), ]; diff --git a/phpunit.xml b/phpunit.xml index a1d7dbb..91308dd 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -22,7 +22,7 @@ - + From 32d8d86f98fd3b847222bf4d9b86482b07cb407b Mon Sep 17 00:00:00 2001 From: Laravel Shift Date: Tue, 6 Apr 2021 16:12:48 +0000 Subject: [PATCH 4/7] Default config files In an effort to make upgrading the constantly changing config files easier, Shift defaulted them and merged your true customizations - where ENV variables may not be used. --- config/database.php | 17 ++++++++++++++--- config/services.php | 26 +++++++------------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/config/database.php b/config/database.php index e939b89..22347a4 100644 --- a/config/database.php +++ b/config/database.php @@ -37,6 +37,7 @@ 'driver' => 'sqlite', 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', + 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 'mysql' => [ @@ -50,7 +51,8 @@ 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', - 'strict' => false, + 'prefix_indexes' => true, + 'strict' => true, 'engine' => null, ], @@ -63,6 +65,7 @@ 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', + 'prefix_indexes' => true, 'schema' => 'public', 'sslmode' => 'prefer', ], @@ -76,6 +79,7 @@ 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', + 'prefix_indexes' => true, ], ], @@ -99,7 +103,7 @@ |-------------------------------------------------------------------------- | | Redis is an open source, fast, and advanced key-value store that also - | provides a richer set of commands than a typical key-value systems + | provides a richer body of commands than a typical key-value system | such as APC or Memcached. Laravel makes it easy to dig right in. | */ @@ -112,7 +116,14 @@ 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), - 'database' => 0, + 'database' => env('REDIS_DB', 0), + ], + + 'cache' => [ + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'password' => env('REDIS_PASSWORD', null), + 'port' => env('REDIS_PORT', 6379), + 'database' => env('REDIS_CACHE_DB', 1), ], ], diff --git a/config/services.php b/config/services.php index 6e7a61f..bb4d2ec 100644 --- a/config/services.php +++ b/config/services.php @@ -14,33 +14,16 @@ | */ - 'twitter' => [ - // @todo: merge these! - // Socialite - 'client_id' => env('TWITTER_CONSUMER_KEY'), - 'client_secret' => env('TWITTER_CONSUMER_SECRET'), - 'redirect' => env('TWITTER_URL'), - - // Other - 'consumer_key' => env('TWITTER_CONSUMER_KEY'), - 'consumer_secret' => env('TWITTER_CONSUMER_SECRET'), - 'access_token' => env('TWITTER_ACCESS_TOKEN'), - 'access_secret' => env('TWITTER_ACCESS_TOKEN_SECRET'), - ], - 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), - ], - - 'mandrill' => [ - 'secret' => env('MANDRILL_SECRET'), + 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), ], 'ses' => [ 'key' => env('SES_KEY'), 'secret' => env('SES_SECRET'), - 'region' => 'us-east-1', + 'region' => env('SES_REGION', 'us-east-1'), ], 'sparkpost' => [ @@ -51,5 +34,10 @@ 'model' => App\User::class, 'key' => env('STRIPE_KEY'), 'secret' => env('STRIPE_SECRET'), + 'webhook' => [ + 'secret' => env('STRIPE_WEBHOOK_SECRET'), + 'tolerance' => env('STRIPE_WEBHOOK_TOLERANCE', 300), + ], ], + ]; From cf542c3c28b7c339d2c359f0e8e97800920adf4a Mon Sep 17 00:00:00 2001 From: Laravel Shift Date: Tue, 6 Apr 2021 16:12:49 +0000 Subject: [PATCH 5/7] Shift middleware --- app/Http/Kernel.php | 19 +++++++++++++++-- app/Http/Middleware/Authenticate.php | 21 +++++++++++++++++++ .../Middleware/CheckForMaintenanceMode.php | 17 +++++++++++++++ app/Http/Middleware/VerifyCsrfToken.php | 11 ++++++++-- 4 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 app/Http/Middleware/Authenticate.php create mode 100644 app/Http/Middleware/CheckForMaintenanceMode.php diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 95ed257..e8c70c1 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -14,7 +14,7 @@ class Kernel extends HttpKernel * @var array */ protected $middleware = [ - \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, + \App\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, @@ -48,11 +48,26 @@ class Kernel extends HttpKernel * @var array */ protected $routeMiddleware = [ - 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, + 'auth' => \App\Http\Middleware\Authenticate::class, 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'owns-conference' => \App\Http\Middleware\UserOwnsConference::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, ]; + /** + * The priority-sorted list of middleware. + * + * This forces non-global middleware to always be in the given order. + * + * @var array + */ + protected $middlewarePriority = [ + \Illuminate\Session\Middleware\StartSession::class, + \Illuminate\View\Middleware\ShareErrorsFromSession::class, + \App\Http\Middleware\Authenticate::class, + \Illuminate\Session\Middleware\AuthenticateSession::class, + \Illuminate\Routing\Middleware\SubstituteBindings::class, + \Illuminate\Auth\Middleware\Authorize::class, + ]; } diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php new file mode 100644 index 0000000..a4be5c5 --- /dev/null +++ b/app/Http/Middleware/Authenticate.php @@ -0,0 +1,21 @@ +expectsJson()) { + return route('login'); + } + } +} diff --git a/app/Http/Middleware/CheckForMaintenanceMode.php b/app/Http/Middleware/CheckForMaintenanceMode.php new file mode 100644 index 0000000..35b9824 --- /dev/null +++ b/app/Http/Middleware/CheckForMaintenanceMode.php @@ -0,0 +1,17 @@ + Date: Tue, 6 Apr 2021 16:12:49 +0000 Subject: [PATCH 6/7] Shift Laravel dependencies --- composer.json | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 3ff9ac4..306c8c4 100644 --- a/composer.json +++ b/composer.json @@ -9,20 +9,23 @@ "type": "project", "require": { "php": ">=7.4", - "laravel/framework": "5.6.*", + "laravel/framework": "5.7.*", "laravel/socialite": "^3.0", "abraham/twitteroauth": "^1.0.0", "pda/pheanstalk": "~3.0", "bugsnag/bugsnag-laravel": "1.*", - "laravel/tinker": "~1.0" + "laravel/tinker": "^1.0", + "fideloper/proxy": "^4.0" }, "require-dev": { - "fzaninotto/faker": "~1.4", + "fzaninotto/faker": "^1.4", "mockery/mockery": "^1.0.0", "phpunit/phpunit": "^7.0", "doctrine/dbal": "^2.5", "laravel/browser-kit-testing": "4.*", - "filp/whoops": "~2.0" + "filp/whoops": "^2.0", + "beyondcode/laravel-dump-server": "^1.0", + "nunomaduro/collision": "^2.0" }, "autoload": { "classmap": [ @@ -56,7 +59,7 @@ ], "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", - "@php artisan package:discover" + "@php artisan package:discover --ansi" ] }, "config": { From 05fc08cbcbcb6c5e1664e6e9d394253046c2df5d Mon Sep 17 00:00:00 2001 From: Laravel Shift Date: Tue, 6 Apr 2021 16:12:49 +0000 Subject: [PATCH 7/7] Move assets --- resources/{assets => }/js/app.js | 0 resources/{assets => }/js/components/Conference.vue | 0 resources/{assets => }/js/components/ConferenceIntroduction.vue | 0 resources/{assets => }/js/components/Dashboard.vue | 0 resources/{assets => }/js/components/Datepicker.vue | 0 resources/{assets => }/js/components/FormErrors.vue | 0 resources/{assets => }/js/components/FriendDetails.vue | 0 resources/{assets => }/js/components/FriendsList.vue | 0 resources/{assets => }/js/core/dependencies.js | 0 resources/{assets => }/js/utils/EventListener.js | 0 resources/{assets => }/sass/app.scss | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename resources/{assets => }/js/app.js (100%) rename resources/{assets => }/js/components/Conference.vue (100%) rename resources/{assets => }/js/components/ConferenceIntroduction.vue (100%) rename resources/{assets => }/js/components/Dashboard.vue (100%) rename resources/{assets => }/js/components/Datepicker.vue (100%) rename resources/{assets => }/js/components/FormErrors.vue (100%) rename resources/{assets => }/js/components/FriendDetails.vue (100%) rename resources/{assets => }/js/components/FriendsList.vue (100%) rename resources/{assets => }/js/core/dependencies.js (100%) rename resources/{assets => }/js/utils/EventListener.js (100%) rename resources/{assets => }/sass/app.scss (100%) diff --git a/resources/assets/js/app.js b/resources/js/app.js similarity index 100% rename from resources/assets/js/app.js rename to resources/js/app.js diff --git a/resources/assets/js/components/Conference.vue b/resources/js/components/Conference.vue similarity index 100% rename from resources/assets/js/components/Conference.vue rename to resources/js/components/Conference.vue diff --git a/resources/assets/js/components/ConferenceIntroduction.vue b/resources/js/components/ConferenceIntroduction.vue similarity index 100% rename from resources/assets/js/components/ConferenceIntroduction.vue rename to resources/js/components/ConferenceIntroduction.vue diff --git a/resources/assets/js/components/Dashboard.vue b/resources/js/components/Dashboard.vue similarity index 100% rename from resources/assets/js/components/Dashboard.vue rename to resources/js/components/Dashboard.vue diff --git a/resources/assets/js/components/Datepicker.vue b/resources/js/components/Datepicker.vue similarity index 100% rename from resources/assets/js/components/Datepicker.vue rename to resources/js/components/Datepicker.vue diff --git a/resources/assets/js/components/FormErrors.vue b/resources/js/components/FormErrors.vue similarity index 100% rename from resources/assets/js/components/FormErrors.vue rename to resources/js/components/FormErrors.vue diff --git a/resources/assets/js/components/FriendDetails.vue b/resources/js/components/FriendDetails.vue similarity index 100% rename from resources/assets/js/components/FriendDetails.vue rename to resources/js/components/FriendDetails.vue diff --git a/resources/assets/js/components/FriendsList.vue b/resources/js/components/FriendsList.vue similarity index 100% rename from resources/assets/js/components/FriendsList.vue rename to resources/js/components/FriendsList.vue diff --git a/resources/assets/js/core/dependencies.js b/resources/js/core/dependencies.js similarity index 100% rename from resources/assets/js/core/dependencies.js rename to resources/js/core/dependencies.js diff --git a/resources/assets/js/utils/EventListener.js b/resources/js/utils/EventListener.js similarity index 100% rename from resources/assets/js/utils/EventListener.js rename to resources/js/utils/EventListener.js diff --git a/resources/assets/sass/app.scss b/resources/sass/app.scss similarity index 100% rename from resources/assets/sass/app.scss rename to resources/sass/app.scss