Skip to content
This repository was archived by the owner on Feb 18, 2023. It is now read-only.

Commit 12a62ee

Browse files
committed
Upgrade to laravel 5.8 and upgrade packages
1 parent 22d75e3 commit 12a62ee

Some content is hidden

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

45 files changed

+1877
-1423
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ Homestead.json
99
/public/fonts/
1010
/packages
1111
/storage/oauth-private.key
12-
/storage/oauth-public.key
12+
/storage/oauth-public.key
13+
.idea/
14+
.DS_Store

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ language: php
33
php:
44
- 7.1
55
- 7.2
6+
- 7.3
67
before_script:
78
- composer self-update
89
- composer install

app/Http/Controllers/Api/Users/UsersController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(User $model)
4545
*/
4646
public function index(Request $request)
4747
{
48-
$paginator = $this->model->with('roles.permissions')->paginate($request->get('limit', config('app.pagination_limit')));
48+
$paginator = $this->model->with('roles.permissions')->paginate($request->get('limit', config('app.pagination_limit', 20)));
4949
if ($request->has('limit')) {
5050
$paginator->appends('limit', $request->get('limit'));
5151
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
7+
8+
class ForgotPasswordController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Password Reset Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling password reset emails and
16+
| includes a trait which assists in sending these notifications from
17+
| your application to your users. Feel free to explore this trait.
18+
|
19+
*/
20+
21+
use SendsPasswordResetEmails;
22+
23+
/**
24+
* Create a new controller instance.
25+
*
26+
* @return void
27+
*/
28+
public function __construct()
29+
{
30+
$this->middleware('guest');
31+
}
32+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\AuthenticatesUsers;
7+
8+
class LoginController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Login Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller handles authenticating users for the application and
16+
| redirecting them to your home screen. The controller uses a trait
17+
| to conveniently provide its functionality to your applications.
18+
|
19+
*/
20+
21+
use AuthenticatesUsers;
22+
23+
/**
24+
* Where to redirect users after login.
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('guest')->except('logout');
38+
}
39+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\User;
6+
use App\Http\Controllers\Controller;
7+
use Illuminate\Support\Facades\Hash;
8+
use Illuminate\Support\Facades\Validator;
9+
use Illuminate\Foundation\Auth\RegistersUsers;
10+
11+
class RegisterController extends Controller
12+
{
13+
/*
14+
|--------------------------------------------------------------------------
15+
| Register Controller
16+
|--------------------------------------------------------------------------
17+
|
18+
| This controller handles the registration of new users as well as their
19+
| validation and creation. By default this controller uses a trait to
20+
| provide this functionality without requiring any additional code.
21+
|
22+
*/
23+
24+
use RegistersUsers;
25+
26+
/**
27+
* Where to redirect users after registration.
28+
*
29+
* @var string
30+
*/
31+
protected $redirectTo = '/home';
32+
33+
/**
34+
* Create a new controller instance.
35+
*
36+
* @return void
37+
*/
38+
public function __construct()
39+
{
40+
$this->middleware('guest');
41+
}
42+
43+
/**
44+
* Get a validator for an incoming registration request.
45+
*
46+
* @param array $data
47+
* @return \Illuminate\Contracts\Validation\Validator
48+
*/
49+
protected function validator(array $data)
50+
{
51+
return Validator::make($data, [
52+
'name' => ['required', 'string', 'max:255'],
53+
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
54+
'password' => ['required', 'string', 'min:8', 'confirmed'],
55+
]);
56+
}
57+
58+
/**
59+
* Create a new user instance after a valid registration.
60+
*
61+
* @param array $data
62+
* @return \App\User
63+
*/
64+
protected function create(array $data)
65+
{
66+
return User::create([
67+
'name' => $data['name'],
68+
'email' => $data['email'],
69+
'password' => Hash::make($data['password']),
70+
]);
71+
}
72+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\ResetsPasswords;
7+
8+
class ResetPasswordController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Password Reset Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling password reset requests
16+
| and uses a simple trait to include this behavior. You're free to
17+
| explore this trait and override any methods you wish to tweak.
18+
|
19+
*/
20+
21+
use ResetsPasswords;
22+
23+
/**
24+
* Where to redirect users after resetting their password.
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('guest');
38+
}
39+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\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: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ class Kernel extends HttpKernel
1414
* @var array
1515
*/
1616
protected $middleware = [
17-
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
17+
\App\Http\Middleware\CheckForMaintenanceMode::class,
1818
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
1919
\App\Http\Middleware\TrimStrings::class,
2020
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
21+
\App\Http\Middleware\TrustProxies::class,
2122
];
2223

2324
/**
@@ -54,5 +55,23 @@ class Kernel extends HttpKernel
5455
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
5556
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
5657
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
58+
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
59+
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
60+
];
61+
62+
/**
63+
* The priority-sorted list of middleware.
64+
*
65+
* This forces non-global middleware to always be in the given order.
66+
*
67+
* @var array
68+
*/
69+
protected $middlewarePriority = [
70+
\Illuminate\Session\Middleware\StartSession::class,
71+
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
72+
\App\Http\Middleware\Authenticate::class,
73+
\Illuminate\Session\Middleware\AuthenticateSession::class,
74+
\Illuminate\Routing\Middleware\SubstituteBindings::class,
75+
\Illuminate\Auth\Middleware\Authorize::class,
5776
];
5877
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace App\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+
}

0 commit comments

Comments
 (0)