Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.

Commit 4f3d85b

Browse files
committed
upgrade to Laravel v5.7
1 parent aa00134 commit 4f3d85b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+441
-174
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.yml]
15+
indent_size = 2

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ DB_PASSWORD=secret
1616
BROADCAST_DRIVER=log
1717
CACHE_DRIVER=file
1818
SESSION_DRIVER=file
19-
QUEUE_DRIVER=sync
19+
QUEUE_CONNECTION=sync
2020

2121
REDIS_HOST=127.0.0.1
2222
REDIS_PASSWORD=null

app/Http/Controllers/Auth/RegisterController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public function __construct()
4949
protected function validator(array $data)
5050
{
5151
return Validator::make($data, [
52-
'name' => 'required|max:255',
53-
'email' => 'required|email|max:255|unique:users',
54-
'password' => 'required|min:6|confirmed',
52+
'name' => ['required', 'string', 'max:255'],
53+
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
54+
'password' => ['required', 'string', 'min:6', 'confirmed'],
5555
]);
5656
}
5757

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace Framework\Http\Controllers\Auth;
4+
5+
use Framework\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\VerifiesEmails;
7+
8+
class VerificationController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Email Verification Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling email verification for any
16+
| user that recently registered with the application. Emails may also
17+
| be re-sent if the user didn't receive the original email message.
18+
|
19+
*/
20+
21+
use VerifiesEmails;
22+
23+
/**
24+
* Where to redirect users after verification.
25+
*
26+
* @var string
27+
*/
28+
protected $redirectTo = '/home';
29+
30+
/**
31+
* Create a new controller instance.
32+
*
33+
* @return void
34+
*/
35+
public function __construct()
36+
{
37+
$this->middleware('auth');
38+
$this->middleware('signed')->only('verify');
39+
$this->middleware('throttle:6,1')->only('verify', 'resend');
40+
}
41+
}

app/Http/Kernel.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,30 @@ class Kernel extends HttpKernel
5050
* @var array
5151
*/
5252
protected $routeMiddleware = [
53-
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
53+
'auth' => \Framework\Http\Middleware\Authenticate::class,
5454
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
5555
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
5656
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
5757
'can' => \Illuminate\Auth\Middleware\Authorize::class,
5858
'guest' => \Framework\Http\Middleware\RedirectIfAuthenticated::class,
5959
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
6060
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
61+
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
62+
];
63+
64+
/**
65+
* The priority-sorted list of middleware.
66+
*
67+
* This forces the listed middleware to always be in the given order.
68+
*
69+
* @var array
70+
*/
71+
protected $middlewarePriority = [
72+
\Illuminate\Session\Middleware\StartSession::class,
73+
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
74+
\Framework\Http\Middleware\Authenticate::class,
75+
\Illuminate\Session\Middleware\AuthenticateSession::class,
76+
\Illuminate\Routing\Middleware\SubstituteBindings::class,
77+
\Illuminate\Auth\Middleware\Authorize::class,
6178
];
6279
}

app/Http/Middleware/Authenticate.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Framework\Http\Middleware;
4+
5+
use Illuminate\Auth\Middleware\Authenticate as Middleware;
6+
7+
class Authenticate extends Middleware
8+
{
9+
/**
10+
* Get the path the user should be redirected to when they are not authenticated.
11+
*
12+
* @param \Illuminate\Http\Request $request
13+
* @return string
14+
*/
15+
protected function redirectTo($request)
16+
{
17+
if (!$request->expectsJson()) {
18+
return route('login');
19+
}
20+
}
21+
}

app/Http/Middleware/VerifyCsrfToken.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66

77
class VerifyCsrfToken extends BaseVerifier
88
{
9+
/**
10+
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
11+
*
12+
* @var bool
13+
*/
14+
protected $addHttpCookie = true;
15+
916
/**
1017
* The URIs that should be excluded from CSRF verification.
1118
*

app/Providers/EventServiceProvider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace Framework\Providers;
44

55
use Illuminate\Support\Facades\Event;
6+
use Illuminate\Auth\Events\Registered;
7+
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
68
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
79

810
class EventServiceProvider extends ServiceProvider
@@ -13,8 +15,8 @@ class EventServiceProvider extends ServiceProvider
1315
* @var array
1416
*/
1517
protected $listen = [
16-
'Framework\Events\SomeEvent' => [
17-
'Framework\Listeners\EventListener',
18+
Registered::class => [
19+
SendEmailVerificationNotification::class,
1820
],
1921
];
2022

app/User.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
namespace Framework;
44

55
use Illuminate\Notifications\Notifiable;
6+
use Illuminate\Contracts\Auth\MustVerifyEmail;
67
use Illuminate\Foundation\Auth\User as Authenticatable;
78

8-
class User extends Authenticatable
9+
class User extends Authenticatable implements MustVerifyEmail
910
{
1011
use Notifiable;
1112

bootstrap/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313

1414
$app = new Illuminate\Foundation\Application(
15-
realpath(__DIR__.'/../')
15+
dirname(__DIR__)
1616
);
1717

1818
/*

0 commit comments

Comments
 (0)