Skip to content

Commit

Permalink
Merge pull request #5 from Situ314/shift-67661
Browse files Browse the repository at this point in the history
Laravel 6.x Shift
  • Loading branch information
Situ314 authored Jul 28, 2022
2 parents eba776f + 34fa1ab commit f70bc9e
Show file tree
Hide file tree
Showing 20 changed files with 160 additions and 76 deletions.
40 changes: 40 additions & 0 deletions app/Http/Controllers/Auth/ConfirmPasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords;

class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/

use ConfirmsPasswords;

/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}
10 changes: 0 additions & 10 deletions app/Http/Controllers/Auth/ForgotPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,4 @@ class ForgotPasswordController extends Controller
*/

use SendsPasswordResetEmails;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}
9 changes: 5 additions & 4 deletions app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use App\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
Expand All @@ -28,7 +29,7 @@ class RegisterController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = RouteServiceProvider::HOME;

/**
* Create a new controller instance.
Expand All @@ -49,9 +50,9 @@ public function __construct()
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',
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}

Expand Down
13 changes: 2 additions & 11 deletions app/Http/Controllers/Auth/ResetPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ResetsPasswords;

class ResetPasswordController extends Controller
Expand All @@ -25,15 +26,5 @@ class ResetPasswordController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
protected $redirectTo = RouteServiceProvider::HOME;
}
40 changes: 26 additions & 14 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class Kernel extends HttpKernel
* @var array
*/
protected $middleware = [
\App\Http\Middleware\TrustProxies::class,
\App\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
//\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];

/**
Expand All @@ -38,12 +38,8 @@ class Kernel extends HttpKernel
],

'api' => [
'throttle:240,1',
'bindings',
],

'basic' => [
\App\Http\Middleware\AuthBasic::class,
'throttle:60,1',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];

Expand All @@ -55,16 +51,32 @@ class Kernel extends HttpKernel
* @var array
*/
protected $routeMiddleware = [
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'blockip' => \App\Http\Middleware\BlockIp::class,
'oracle' => \App\Http\Middleware\Oracle::class,
'InforAuth' => \App\Http\Middleware\InforAuth::class,
'miller' => \App\Http\Middleware\Miller::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::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\Routing\Middleware\ThrottleRequests::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Illuminate\Auth\Middleware\Authorize::class,
];
}
}
21 changes: 21 additions & 0 deletions app/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Http\Middleware;

use Illuminate\Auth\Middleware\Authenticate as Middleware;

class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
7 changes: 7 additions & 0 deletions app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ class RouteServiceProvider extends ServiceProvider
*/
protected $namespace = 'App\Http\Controllers';

/**
* The path to the "home" route for your application.
*
* @var string
*/
public const HOME = '/home';

/**
* Define your route model bindings, pattern filters, etc.
*
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);

/*
Expand Down
28 changes: 13 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,26 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^7.1.3",
"aws/aws-sdk-php-laravel": "^3.6",
"folklore/graphql": "~1.0.0",
"php": "^7.4|^8.0",
"aws/aws-sdk-php-laravel": "^3.7",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "5.8.*",
"laravel/passport": "~5.0",
"laravel/tinker": "~1.0",
"lcobucci/jwt": "3.3.3",
"orchestra/parser": "~3.0",
"laravel/framework": "^6.20",
"laravel/passport": "^9.4",
"laravel/tinker": "^2.5",
"lcobucci/jwt": "^4.1",
"orchestra/parser": "^4.0",
"sentry/sentry-laravel": "2.13.0",
"shiftonelabs/laravel-sqs-fifo-queue": "^2.0",
"spatie/array-to-xml": "2.3.0",
"symfony/psr-http-message-bridge": "^1.1",
"fideloper/proxy": "^4.0"
"spatie/array-to-xml": "^3.1",
"symfony/psr-http-message-bridge": "^2.1",
"fideloper/proxy": "^4.4"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "^7.5",
"filp/whoops": "~2.0",
"phpunit/phpunit": "^8.5.8|^9.3.3",
"nunomaduro/collision": "^3.0",
"beyondcode/laravel-dump-server": "^1.0"
"fakerphp/faker": "^1.9.1",
"facade/ignition": "^1.16.4"
},
"autoload": {
"classmap": [
Expand Down
4 changes: 2 additions & 2 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
/**
* GraphQL
*/
Folklore\GraphQL\ServiceProvider::class,
//Folklore\GraphQL\ServiceProvider::class,

/*
* Application Service Providers...
Expand All @@ -189,7 +189,7 @@
App\Providers\RouteServiceProvider::class,
//Sentry\Laravel\ServiceProvider::class,
Sentry\Laravel\ServiceProvider::class,
// Sentry\SentryLaravel\SentryLaravelServiceProvider::class,
// Sentry\SentryLaravel\SentryLaravelServiceProvider::class,
// Amazon SQS
Aws\Laravel\AwsServiceProvider::class,
// Amazon SQS FIFO
Expand Down
15 changes: 15 additions & 0 deletions config/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'api' => [
'driver' => 'token',
'provider' => 'users',
'hash' => false,
],
],

Expand Down Expand Up @@ -96,7 +97,21 @@
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],

/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/

'password_timeout' => 10800,

];
2 changes: 1 addition & 1 deletion config/broadcasting.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'encrypted' => true,
'useTLS' => true,
],
],

Expand Down
12 changes: 6 additions & 6 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,27 +119,27 @@

'redis' => [

'client' => env('REDIS_CLIENT', 'predis'),
'client' => env('REDIS_CLIENT', 'phpredis'),

'options' => [
'cluster' => env('REDIS_CLUSTER', 'predis'),
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],

'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DB', 0),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],

'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_CACHE_DB', 1),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],

],
Expand Down
3 changes: 2 additions & 1 deletion config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -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", "sftp", "s3", "rackspace"
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/

Expand All @@ -62,6 +62,7 @@
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
],

],
Expand Down
Loading

0 comments on commit f70bc9e

Please sign in to comment.