laravel5.3にアップグレード

5.2から5.3に上げたときの備忘録です。
https://laravel.com/docs/5.3/upgrade
を見つつ
http://takayukii.me/post/20160914887
http://qiita.com/kawax/items/b846aba6f9acee9d6c61
を参考にさせていただきました

##composer
composer.jsonのlaravelとlaravelcollectiveを更新して`composer update`

```json:composer.json
     "require": {

-        "laravel/framework": "5.2.*",
+        "laravel/framework": "5.3.*",

-        "laravelcollective/html": "5.2.*",
+        "laravelcollective/html": "~5.0",
```

##providers
Providersのboot()から引数を削除

```php:app/Providers/AuthServiceProvider.php
-    public function boot(GateContract $gate)
+    public function boot()
     {
-        $this->registerPolicies($gate);
+        $this->registerPolicies();
```

```php:app/Providers/EventServiceProvider.php
-    public function boot(DispatcherContract $events)
+    public function boot()
     {
-        parent::boot($events);
+        parent::boot();
```

RouteServiceProvider.phpはboot()以外のところも一緒に修正しました
map()とmapWebRoutes()の引数がいらない
あとapp_path()をbase_path()に変更

```php:app/Providers/RouteServiceProvider.php
-use Illuminate\Routing\Router;
+use Illuminate\Support\Facades\Route;


-    public function boot(Router $router)
+    public function boot()
     {
         //

-        parent::boot($router);
+        parent::boot();


-    public function map(Router $router)
+    public function map()
     {
-        $this->mapWebRoutes($router);
+        $this->mapWebRoutes();



-    protected function mapWebRoutes(Router $router)
+    protected function mapWebRoutes()
     {
-        $router->group([
-            'namespace' => $this->namespace, 'middleware' => 'web',
+        Route::group([
+            'namespace' => $this->namespace,
+            'middleware' => 'web',
         ], function ($router) {
-            require app_path('Http/routes.php');
+            require base_path('routes/web.php');
         });
     }
```
##route
routeファイルの位置が変わったので以下の通り変更

```
mkdir routes
mv app/Http/route.php routes/web.php
```

あと、Route::controllerが使えなくなって悲しみながらget/postに修正しました。

##controller
ControllerはAuthorizesResourcesの記述を削除

```php:app/Http/Controllers/Controller.php
-use Illuminate\Foundation\Auth\Access\AuthorizesResources;

 class Controller extends BaseController
 {
-    use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests;
+    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
 }
```
##auth
AuthControllerがLoginControllerに。
[github: LoginController.php](https://github.com/laravel/laravel/blob/master/app/Http/Controllers/Auth/LoginController.php)
をこぴぺしまして、AuthControllerのメソッドを持ってきました
そして```rm app/Http/Controllers/AuthController.php```

RegisterControllerは使ってないのでノータッチ

##password
PasswordControllerがForgotPasswordControllerとResetPasswordControllerに分裂してたのでぶったぎって
```rm app/Http/Controllers/PasswordController.php```
[github: ForgotPasswordController.php]
(https://github.com/laravel/laravel/blob/master/app/Http/Controllers/Auth/ForgotPasswordController.php)
[github: ResetPasswordController.php]
(https://github.com/laravel/laravel/blob/master/app/Http/Controllers/Auth/ResetPasswordController.php)

##request
App\Http\Requests\Requestは使わずIlluminate\Foundation\Http\FormRequestに置き換えて```rm App\Http\Requests\Request```

```
-use App\Http\Requests\Request;
+use Illuminate\Foundation\Http\FormRequest;

-class TestRequest extends Request {
+class TestRequest extends FormRequest {
```

##config
2行追加

```php:config/app.php
+        Illuminate\Notifications\NotificationServiceProvider::class,

+        'Notification' => Illuminate\Support\Facades\Notification::class,
```

##kernel
'can'と'auth'の修正(2016/11/9 authについて追加)

```php:app/Http/Kernel.php
-        'auth'        => \App\Http\Middleware\Authenticate::class,
+        'auth'        => \Illuminate\Auth\Middleware\Authenticate::class,

-        'can'        => \Illuminate\Foundation\Http\Middleware\Authorize::class,
+        'can'        => \Illuminate\Auth\Middleware\Authorize::class,
```

```rm app\Http\Middleware\Authenticate.php```(2016/11/9 追加)

##models
通知機能使うなら追加

```php:app/Models/User.php
+use Illuminate\Notifications\Notifiable;


 class User extends Authenticatable
 {
     use \App\Models\BootTrait;
     // 論理削除有効化
     use SoftDeletes;
+    //通知
+    use Notifiable;
```

とりあえず動きました
修正できていないところがまだありそう･･･