Skip to content

Commit 2fe5c5c

Browse files
Upgrade to Laravel 5.3
1 parent a4c0022 commit 2fe5c5c

19 files changed

+155
-99
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
namespace App\Http\Controllers\Auth;
3+
4+
use App\Http\Controllers\Controller;
5+
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
6+
7+
class ForgotPasswordController extends Controller
8+
{
9+
/*
10+
|--------------------------------------------------------------------------
11+
| Password Reset Controller
12+
|--------------------------------------------------------------------------
13+
|
14+
| This controller is responsible for handling password reset emails and
15+
| includes a trait which assists in sending these notifications from
16+
| your application to your users. Feel free to explore this trait.
17+
|
18+
*/
19+
use SendsPasswordResetEmails;
20+
21+
/**
22+
* Create a new controller instance.
23+
*
24+
* @return void
25+
*/
26+
public function __construct()
27+
{
28+
$this->middleware('guest');
29+
}
30+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
namespace App\Http\Controllers\Auth;
3+
4+
use App\Http\Controllers\Controller;
5+
use Illuminate\Foundation\Auth\AuthenticatesUsers;
6+
7+
class LoginController extends Controller
8+
{
9+
/*
10+
|--------------------------------------------------------------------------
11+
| Login Controller
12+
|--------------------------------------------------------------------------
13+
|
14+
| This controller handles authenticating users for the application and
15+
| redirecting them to your home screen. The controller uses a trait
16+
| to conveniently provide its functionality to your applications.
17+
|
18+
*/
19+
use AuthenticatesUsers;
20+
21+
/**
22+
* Where to redirect users after login / registration.
23+
*
24+
* @var string
25+
*/
26+
protected $redirectTo = '/';
27+
28+
/**
29+
* Create a new controller instance.
30+
*
31+
* @return void
32+
*/
33+
public function __construct()
34+
{
35+
$this->middleware('guest', ['except' => 'logout']);
36+
}
37+
}

app/Http/Controllers/Auth/AuthController.php renamed to app/Http/Controllers/Auth/RegisterController.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
11
<?php
2-
32
namespace App\Http\Controllers\Auth;
43

54
use App\Http\Controllers\Controller;
65
use App\User;
7-
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
8-
use Illuminate\Foundation\Auth\ThrottlesLogins;
6+
use Illuminate\Foundation\Auth\RegistersUsers;
97
use Validator;
108

11-
class AuthController extends Controller
9+
class RegisterController extends Controller
1210
{
1311
/*
1412
|--------------------------------------------------------------------------
15-
| Registration & Login Controller
13+
| Register Controller
1614
|--------------------------------------------------------------------------
1715
|
18-
| This controller handles the registration of new users, as well as the
19-
| authentication of existing users. By default, this controller uses
20-
| a simple trait to add these behaviors. Why don't you explore it?
16+
| This controller handles the registration of new users as well as their
17+
| validation and creation. By default this controller uses a trait to
18+
| provide this functionality without requiring any additional code.
2119
|
2220
*/
23-
24-
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
21+
use RegistersUsers;
2522

2623
/**
24+
* Where to redirect users after login / registration.
25+
*
2726
* @var string
2827
*/
29-
protected $redirectPath = '';
28+
protected $redirectTo = '/';
3029

3130
/**
32-
* Create a new authentication controller instance.
31+
* Create a new controller instance.
3332
*
3433
* @return void
3534
*/
3635
public function __construct()
3736
{
38-
$this->middleware('guest', ['except' => 'getLogout']);
37+
$this->middleware('guest');
3938
}
4039

4140
/**
@@ -49,7 +48,7 @@ protected function validator(array $data)
4948
return Validator::make($data, [
5049
'name' => 'required|max:255',
5150
'email' => 'required|email|max:255|unique:users',
52-
'password' => 'required|confirmed|min:6',
51+
'password' => 'required|min:6|confirmed',
5352
]);
5453
}
5554

@@ -67,4 +66,4 @@ protected function create(array $data)
6766
'password' => bcrypt($data['password']),
6867
]);
6968
}
70-
}
69+
}
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
2-
32
namespace App\Http\Controllers\Auth;
43

54
use App\Http\Controllers\Controller;
65
use Illuminate\Foundation\Auth\ResetsPasswords;
76

8-
class PasswordController extends Controller
7+
class ResetPasswordController extends Controller
98
{
109
/*
1110
|--------------------------------------------------------------------------
@@ -17,16 +16,15 @@ class PasswordController extends Controller
1716
| explore this trait and override any methods you wish to tweak.
1817
|
1918
*/
20-
2119
use ResetsPasswords;
2220

2321
/**
24-
* Create a new password controller instance.
22+
* Create a new controller instance.
2523
*
2624
* @return void
2725
*/
2826
public function __construct()
2927
{
3028
$this->middleware('guest');
3129
}
32-
}
30+
}

app/Http/Middleware/Authenticate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function handle($request, Closure $next)
4040
}
4141
else
4242
{
43-
return redirect()->guest('auth/login');
43+
return redirect()->guest('login');
4444
}
4545
}
4646

app/Http/routes.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
Route::match(['get', 'post'], 'form', 'HomeController@form');
3131

3232
Route::resource('posts', 'PostsController');
33-
Route::resource('api/posts', 'Api\PostsController');
33+
Route::resource('api/posts', 'Api\PostsController', ['as' => 'api']);
3434
Route::resource('users', 'UsersController');
35-
36-
Route::controllers([
37-
'auth' => 'Auth\AuthController',
38-
'password' => 'Auth\PasswordController',
39-
]);
40-
35+
Route::auth();

app/Providers/EventServiceProvider.php

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,32 @@
22

33
use App\Events\TestEvent;
44
use App\Listeners\TestEventListener;
5-
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
65
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
76

8-
class EventServiceProvider extends ServiceProvider {
7+
class EventServiceProvider extends ServiceProvider
8+
{
99

10-
/**
11-
* The event handler mappings for the application.
12-
*
13-
* @var array
14-
*/
15-
protected $listen = [
16-
TestEvent::class => [
17-
TestEventListener::class
18-
]
19-
];
10+
/**
11+
* The event handler mappings for the application.
12+
*
13+
* @var array
14+
*/
15+
protected $listen = [
16+
TestEvent::class => [
17+
TestEventListener::class
18+
]
19+
];
2020

21-
/**
22-
* Register any other events for your application.
23-
*
24-
* @param \Illuminate\Contracts\Events\Dispatcher $events
25-
* @return void
26-
*/
27-
public function boot(DispatcherContract $events)
28-
{
29-
parent::boot($events);
21+
/**
22+
* Register any other events for your application.
23+
*
24+
* @return void
25+
*/
26+
public function boot()
27+
{
28+
parent::boot();
3029

31-
//
32-
}
30+
//
31+
}
3332

3433
}
Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
11
<?php namespace App\Providers;
22

3-
use Illuminate\Routing\Router;
43
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
4+
use Illuminate\Routing\Router;
55

6-
class RouteServiceProvider extends ServiceProvider {
6+
class RouteServiceProvider extends ServiceProvider
7+
{
78

8-
/**
9-
* This namespace is applied to the controller routes in your routes file.
10-
*
11-
* In addition, it is set as the URL generator's root namespace.
12-
*
13-
* @var string
14-
*/
15-
protected $namespace = 'App\Http\Controllers';
9+
/**
10+
* This namespace is applied to the controller routes in your routes file.
11+
*
12+
* In addition, it is set as the URL generator's root namespace.
13+
*
14+
* @var string
15+
*/
16+
protected $namespace = 'App\Http\Controllers';
1617

17-
/**
18-
* Define your route model bindings, pattern filters, etc.
19-
*
20-
* @param \Illuminate\Routing\Router $router
21-
* @return void
22-
*/
23-
public function boot(Router $router)
24-
{
25-
parent::boot($router);
18+
/**
19+
* Define your route model bindings, pattern filters, etc.
20+
*
21+
* @return void
22+
*/
23+
public function boot()
24+
{
25+
parent::boot();
2626

27-
//
28-
}
27+
//
28+
}
2929

30-
/**
31-
* Define the routes for the application.
32-
*
33-
* @param \Illuminate\Routing\Router $router
34-
* @return void
35-
*/
36-
public function map(Router $router)
37-
{
38-
$router->group(['namespace' => $this->namespace], function($router)
39-
{
40-
require app_path('Http/routes.php');
41-
});
42-
}
30+
/**
31+
* Define the routes for the application.
32+
*
33+
* @param \Illuminate\Routing\Router $router
34+
* @return void
35+
*/
36+
public function map(Router $router)
37+
{
38+
$router->group(['namespace' => $this->namespace], function ($router) {
39+
require app_path('Http/routes.php');
40+
});
41+
}
4342

4443
}

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"license": "MIT",
66
"type": "project",
77
"require": {
8-
"laravel/framework": "5.2.*",
9-
"laravelcollective/html": "5.2.*",
8+
"laravel/framework": "5.3.x-dev",
9+
"laravelcollective/html": "dev-master",
1010
"flow/jsonpath": "^0.2.4",
1111
"fzaninotto/faker": "~1.4"
1212
},

config/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292

9393
'key' => env('APP_KEY', 'SomeRandomString'),
9494

95-
'cipher' => MCRYPT_RIJNDAEL_128,
95+
'cipher' => 'AES-256-CBC',
9696

9797
/*
9898
|--------------------------------------------------------------------------

0 commit comments

Comments
 (0)