Readouble

Laravel 5.7 アップグレードガイド

5.6から5.7.0へのアップグレードUpgrading To 5.7.0 From 5.6

アップグレード時間の見積もり:10分から15分Estimated Upgrade Time: 10 - 15 Minutes

Note: note 私達は、互換性を失う可能性がある変更を全部ドキュメントにしようとしています。しかし、変更点のいくつかは、フレームワークの明確ではない部分で行われているため、一部の変更が実際にアプリケーションに影響を与えてしまう可能性があります。{note} We attempt to document every possible breaking change. Since some of these breaking changes are in obscure parts of the framework only a portion of these changes may actually affect your application.

依存パッケージのアップデートUpdating Dependencies

composer.jsonファイル中の、laravel/framework依存指定を5.7.*へアップデートしてください。Update your laravel/framework dependency to 5.7.* in your composer.json file.

Laravel Passportを使用している場合は、composer.jsonファイルのlaravel/passport依存指定を^7.0へアップデートしてください。If you are using Laravel Passport, you should update your laravel/passport dependency to ^7.0 in your composer.json file.

次に、皆さんのアプリケーションで使用しているサードパーティのパッケージを確認し、Laravel5.7をサポートするバージョンを使用しているのをチェックしてください。Next, examine any 3rd party packages consumed by your application and verify you are using the proper version for Laravel 5.7 support.

アプリケーションApplication

registerメソッドThe register Method

影響の可能性: とても低いLikelihood Of Impact: Very Low

Illuminate\Foundation\Applicationクラスの未使用なoptions引数が削除されました。このメソッドをオーバーライドしている場合、メソッドの引数を更新してください。The unused options argument of the Illuminate\Foundation\Application class' register method has been removed. If you are overriding this method, you should update your method's signature:

/**
 * アプリケーションのサービスプロバイダの登録
 *
 * @param  \Illuminate\Support\ServiceProvider|string  $provider
 * @param  bool   $force
 * @return \Illuminate\Support\ServiceProvider
 */
public function register($provider, $force = false);

ArtisanArtisan

スケジュール済みのジョブの接続とキューScheduled Job Connection & Queues

影響の可能性: 低いLikelihood Of Impact: Low

$schedule->jobメソッドは、jobメソッドで接続/ジョブが明確に渡されていない場合、ジョブクラスのqueueconnectionプロパティの値が利用されるようになりました。The $schedule->job method now respects the queue and connection properties on the job class if a connection / job is not explicitly passed into the job method.

通常、これはバグフィックスと考えられています。しかしながら、不注意によるブレイキングチェンジとしてリストアップされています。この変更により、問題に遭遇した場合は、お知らせください。Generally, this should be considered a bug fix; however, it is listed as a breaking change out of caution. Please let us know if you encounter any issues surrounding this change[https://github.com/laravel/framework/pull/25216].

AssetsAssets

Assetディレクトリの非階層化Asset Directory Flattened

影響の可能性: なしLikelihood Of Impact: None

新しいLaravel5.7アプリケーションでは、スクリプトとスタイルを含んでいたassetsディレクトリは削除され、スクリプトとスタイルはresourcesディレクトリへ移動しました。これは既存のアプリケーションに影響しませんし、既存のアプリケーションを更新する必要はありません。For new Laravel 5.7 applications, the assets directory that contains the scripts and styles has been flattened into the resources directory. This will not affect existing applications and does not require changes to your existing applications.

しかし、この変更を適用したければ、resources/assets/*下の全てのファイル/ディレクトリを一つ上の階層へ移動してください。However, if you wish to make this change, you should move all files from the resources/assets/* directory up one level:

  • resources/assets/js/*resources/js/*へ移動From resources/assets/js/* to resources/js/*
  • resources/assets/sass/*resources/sass/*へ移動From resources/assets/sass/* to resources/sass/*

それから、webpack.mix.jsファイル中の、古いディレクトリの参照を更新します。Then, update any reference to the old directories in your webpack.mix.js file:

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css');

svgディレクトリの追加svg Directory Added

影響の可能性: とても高いLikelihood Of Impact: Very High

publicディレクトリへ、新しくsvgディレクトリが追加されました。その中に名前が示すエラーページを表示するための、403.svg404.svg500.svg503.svgのsvgファイルを含んでいます。A new directory, svg, was added to the public directory. It contains four svg files: 403.svg, 404.svg, 500.svg, and 503.svg, which are displayed on their respective error pages.

GitHubから、これらのファイルを取得できます。You may get the files from GitHub[https://github.com/laravel/laravel/tree/master/public/svg].

認証Authentication

AuthenticateミドルウェアThe Authenticate Middleware

影響の可能性: 低いLikelihood Of Impact: Low

Illuminate\Auth\Middleware\Authenticateミドルウェアのauthenticateメソッドは、最初の引数として送信されてきた$requestを受け取るようになりました。皆さんのAuthenticateミドルウェアの中で、このメソッドをオーバーライドしてる場合は、ミドルウェアの引数を更新してください。The authenticate method of the Illuminate\Auth\Middleware\Authenticate middleware has been updated to accept the incoming $request as its first argument. If you are overriding this method in your own Authenticate middleware, you should update your middleware's signature:

/**
 * Determine if the user is logged in to any of the given guards.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  array  $guards
 * @return void
 *
 * @throws \Illuminate\Auth\AuthenticationException
 */
protected function authenticate($request, array $guards)

ResetsPasswordsトレイトThe ResetsPasswords Trait

影響の可能性: 低いLikelihood Of Impact: Low

ResetsPasswordsトレイトのprotected sendResetResponseメソッドは、最初の引数として送信されてきたIlluminate\Http\Requestを受け取るようになりました。このメソッドをオーバーライドしている場合、皆さんのメソッドの引数を更新してください。The protected sendResetResponse method of the ResetsPasswords trait now accepts the incoming Illuminate\Http\Request as its first argument. If you are overriding this method, you should update your method's signature:

/**
 * Get the response for a successful password reset.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  string  $response
 * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
 */
protected function sendResetResponse(Request $request, $response)

SendsPasswordResetEmailsトレイトThe SendsPasswordResetEmails Trait

影響の可能性: 低いLikelihood Of Impact: Low

SendsPasswordResetEmailsトレイトのsendResetLinkResponse protectedメソッドは、最初の引数として送信されてきたIlluminate\Http\Requestを受け取るようになりました。このメソッドをオーバーライドしている場合、皆さんのメソッドの引数を更新してください。The protected sendResetLinkResponse method of the SendsPasswordResetEmails trait now accepts the incoming Illuminate\Http\Request as its first argument. If you are overriding this method, you should update your method's signature:

/**
 * Get the response for a successful password reset link.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  string  $response
 * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
 */
protected function sendResetLinkResponse(Request $request, $response)

認可Authorization

GateThe Gate Contract

影響の可能性: とても低いLikelihood Of Impact: Very Low

rawメソッドは可視性をprotectedからpublicに変更しました。それに付け加え、Illuminate\Contracts\Auth\Access\Gate契約に追加されましたThe raw method was changed from protected to public visibility. In addition, it was added to the Illuminate\Contracts\Auth\Access\Gate contract[https://github.com/laravel/framework/pull/25143]:

/**
 * Get the raw result from the authorization callback.
 *
 * @param  string  $ability
 * @param  array|mixed  $arguments
 * @return mixed
 */
public function raw($ability, $arguments = []);

このインターフェイスを実装してる場合は、メソッドを皆さんの実装へ追加してください。If you are implementing this interface, you should add this method to your implementation.

LoginイベントThe Login Event

影響の可能性: とても低いLikelihood Of Impact: Very Low

Illuminate\Auth\Events\Login__constructメソッドに、新しく$guard引数が追加されました。The __construct method of Illuminate\Auth\Events\Login event has a new $guard argument:

/**
 * 新しいイベントインスタンスの生成
 *
 * @param  string  $guard
 * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
 * @param  bool  $remember
 * @return void
 */
public function __construct($guard, $user, $remember)

アプリケーションの中で、このイベントを独自にディスパッチしている場合は、イベントのコンストラクタへこの新しい引数を渡す必要があります。以下の例では、フレームワークデフォルトのガードをログインイベントへ渡しています。If you are dispatching this event manually within your application, you'll need to pass this new argument into the event's constructor. The following example passes the default framework guard to the Login event:

use Illuminate\Auth\Events\Login;

event(new Login(config('auth.defaults.guard'), $user, $remember))

BladeBlade

or操作子The or Operator

影響の可能性: 高いLikelihood Of Impact: High

同じ目的・機能の?? PHP組み込み「null合体」演算子の優位性により、Bladeの"or"演算子を削除しました。The Blade "or" operator has been removed in favor of PHP's built-in ?? "null coalesce" operator, which has the same purpose and functionality:

// Laravel 5.6
{{ $foo or 'default' }}

// Laravel 5.7
{{ $foo ?? 'default' }}

CacheCache

影響の可能性: とても高いLikelihood Of Impact: Very High

新しくdataディレクトリがstorage/framework/cacheへ追加されました。このディレクトリをアプリケーションに作成してください。A new data directory has been added to storage/framework/cache. You should create this directory in your own application:

mkdir -p storage/framework/cache/data

次に、新しく作成したdataディレクトリへ、.gitignoreファイルを追加してください。Then, add a .gitignore[https://github.com/laravel/laravel/blob/76369205c8715a4a8d0d73061aa042a74fd402dc/storage/framework/cache/data/.gitignore] file to the newly created data directory:

cp storage/framework/cache/.gitignore storage/framework/cache/data/.gitignore

最後にstorage/framework/cache/.gitignoreファイルを以下のように確実に更新してください。Finally, ensure that the storage/framework/cache/.gitignore[https://github.com/laravel/laravel/blob/76369205c8715a4a8d0d73061aa042a74fd402dc/storage/framework/cache/.gitignore] file is updated as follows:

*
!data/
!.gitignore

CarbonCarbon

影響の可能性: とても低いLikelihood Of Impact: Very Low

Carbonの「マクロ」は、Laravelのライブラリの拡張に代わり、直接Carbonライブラリにより処理されるようになりました。この変更に関連する問題に気づいたら、お知らせください。Carbon "macros" are now handled by the Carbon library directly instead of Laravel's extension of the library. We do not expect this to break your code; however, please make us aware of any problems you encounter related to this change[https://github.com/laravel/framework/pull/23938].

コレクションCollections

splitメソッドThe split Method

影響の可能性: 低いLikelihood Of Impact: Low

splitメソッドは、オリジナルコレクション中の総アイテム数が、リクエストされたコレクション数より少なくない限り、「グループ」のリクエストした数を常に返すように更新されました一般的にはこれはバグフィックスとして考えられています。しかし、不注意によるブレイキングチェンジとしてリストアップされています。The split method has been updated to always return the requested number of "groups"[https://github.com/laravel/framework/pull/24088], unless the total number of items in the original collection is less than the requested collection count. Generally, this should be considered a bug fix; however, it is listed as a breaking change out of caution.

クッキーCookie

Factory契約のメソッド使用法Factory Contract Method Signature

影響の可能性: とても低いLikelihood Of Impact: Very Low

Illuminate\Contracts\Cookie\Factoryインターフェイスの makeforeverメソッドの使い方が、変更されました。このインターフェイスを実装している場合は、これらのメソッドを更新してください。The signatures of the make and forever methods of the Illuminate\Contracts\Cookie\Factory interface have been changed[https://github.com/laravel/framework/pull/23200]. If you are implementing this interface, you should update these methods in your implementation.

データベースDatabase

softDeletesTzマイグレーションメソッドThe softDeletesTz Migration Method

影響の可能性: 低いLikelihood Of Impact: Low

スキーマテーブルビルダのsoftDeletesTzメソッドは、第1引数にカラム名を受け取るようになりました。それにより、$precisionは第2引数となりました。The schema table builder's softDeletesTz method now accepts the column name as its first argument, while the $precision has been moved to the second argument position:

/**
 * Add a "deleted at" timestampTz for the table.
 *
 * @param  string  $column
 * @param  int  $precision
 * @return \Illuminate\Support\Fluent
 */
public function softDeletesTz($column = 'deleted_at', $precision = 0)

ConnectionInterface契約The ConnectionInterface Contract

影響の可能性: とても低いLikelihood Of Impact: Very Low

新しく$useReadPdo引数を追加したため、Illuminate\Contracts\Database\ConnectionInterface契約は、select and selectOneの引数が更新されました。The Illuminate\Contracts\Database\ConnectionInterface contract's select and selectOne method signatures have been updated to accommodate the new $useReadPdo argument:

/**
 * Run a select statement and return a single result.
 *
 * @param  string  $query
 * @param  array   $bindings
 * @param  bool  $useReadPdo
 * @return mixed
 */
public function selectOne($query, $bindings = [], $useReadPdo = true);

/**
 * Run a select statement against the database.
 *
 * @param  string  $query
 * @param  array   $bindings
 * @param  bool  $useReadPdo
 * @return array
 */
public function select($query, $bindings = [], $useReadPdo = true);

それに付け加え、この契約にcursorメソッドが追加されました。In addition, the cursor method was added to the contract:

/**
 * Run a select statement against the database and returns a generator.
 *
 * @param  string  $query
 * @param  array  $bindings
 * @param  bool  $useReadPdo
 * @return \Generator
 */
public function cursor($query, $bindings = [], $useReadPdo = true);

このインターフェイスを実装している場合、このメソッドを追加してください。If you are implementing this interface, you should add this method to your implementation.

マイグレーションコマンド出力Migration Command Output

影響の可能性: とても低いLikelihood Of Impact: Very Low

コアのマイグレーションコマンドは、マイグレータクラスの出力インスタンスをセットするように更新されました。既存のマイグレーションコマンドをオーバーライドしている場合は、$this->migrator->getNotes()の参照を削除し、代わりに$this->migrator->setOutput($this->output)を使用してください。The core migration commands have been updated to set the output instance on the migrator class[https://github.com/laravel/framework/pull/24811]. If you were overriding or extending the migration commands, you should remove references to $this->migrator->getNotes() and use $this->migrator->setOutput($this->output) instead.

SQL ServerドライバプライオリティSQL Server Driver Priority

影響の可能性: 低いLikelihood Of Impact: Low

Laravel5.7より前は、デフォルトSQL Server PDOドライバとして、PDO_DBLIBドライバが使用されていました。このドライバは、Microsoftにより非推奨とされています。Laravel5.7では、利用可能であればPDO_SQLSRVをデフォルトドライバとして利用します。別の選択として、PDO_ODBCドライバの使用も選べます。Prior to Laravel 5.7, the PDO_DBLIB driver was used as the default SQL Server PDO driver. This driver is considered deprecated by Microsoft. As of Laravel 5.7, PDO_SQLSRV will be used as the default driver if it is available. Alternatively, you may choose to use the PDO_ODBC driver:

'sqlsrv' => [
    // ...
    'odbc' => true,
    'odbc_datasource_name' => 'your-odbc-dsn',
],

どちらのドライバも利用可能でない場合、LaravelはPDO_DBLIBドライバを使用します。If neither of these drivers are available, Laravel will use the PDO_DBLIB driver.

SQLite外部キーSQLite Foreign Keys

影響の可能性: 中程度Likelihood Of Impact: Medium

SQLiteは外部キーのドロップをサポートしていません。そのため、テーブルに対するdropForeignメソッドを使用すると例外が投げられるようになりました。一般的にはこれはバグフィックスとして考えられています。しかし、不注意によるブレイキングチェンジとしてリストアップされています。SQLite does not support dropping foreign keys. For that reason, using the dropForeign method on a table now throws an exception. Generally, this should be considered a bug fix; however, it is listed as a breaking change out of caution.

複数のタイプのデータベースでマイグレーションを実行する場合、SQLiteの外部キー非サポートを避けるために、マイグレーションでのDB::getDriverName()使用を考慮してください。If you run your migrations on multiple types of databases, consider using DB::getDriverName() in your migrations to skip unsupported foreign key methods for SQLite.

デバッグDebug

ダンパクラスDumper Classes

影響の可能性: とても低いLikelihood Of Impact: Very Low

Symfonyのネイティブな変数ダンパである、Symfony\Component\VarDumper\VarDumperSymfony\Component\VarDumper\Dumper\HtmlDumperを使用する利点により、Illuminate\Support\Debug\DumperIlluminate\Support\Debug\HtmlDumperクラスは削除されました。The Illuminate\Support\Debug\Dumper and Illuminate\Support\Debug\HtmlDumper classes have been removed in favor of using Symfony's native variable dumpers: Symfony\Component\VarDumper\VarDumper and Symfony\Component\VarDumper\Dumper\HtmlDumper.

EloquentEloquent

latestoldestメソッドThe latest / oldest Methods

影響の可能性: 低いLikelihood Of Impact: Low

Eloquentクエリビルダのlatestoldestメソッドは、Eloquentモデルに指定されたカスタム"created at"タイムスタンプカラムを尊重するようにアップデートされました。一般的にはこれはバグフィックスとして考えられています。しかし、不注意によるブレイキングチェンジとしてリストアップされています。The Eloquent query builder's latest and oldest methods have been updated to respect custom "created at" timestamp columns that may be specified on your Eloquent models. Generally, this should be considered a bug fix; however, it is listed as a breaking change out of caution.

wasChangedメソッドThe wasChanged Method

影響の可能性: とても低いLikelihood Of Impact: Very Low

Eloquentモデルの変更は、updatedモデルイベントが発行される前にwasChangedメソッドが利用可能になったことです。一般的にはこれはバグフィックスとして考えられています。しかし、不注意によるブレイキングチェンジとしてリストアップされています。この変更による問題に遭遇した場合は、お知らせくださいAn Eloquent model's changes are now available to the wasChanged method before firing the updated model event. Generally, this should be considered a bug fix; however, it is listed as a breaking change out of caution. Please let us know if you encounter any issues surrounding this change[https://github.com/laravel/framework/pull/25026].

PostgreSQL特殊実数値PostgreSQL Special Float Values

影響の可能性: 低いLikelihood Of Impact: Low

PostgreSQLでは、実数値としてInfinity-InfinityNaNをサポートしています。Laravel5.7より前のバージョンでは、Eloquentのキャストタイプがfloatdoublerealの場合、0へキャストされていました。PostgreSQL supports the float values Infinity, -Infinity and NaN. Prior to Laravel 5.7, these were cast to 0 when the Eloquent casting type for the column was float, double, or real.

Laravel5.7では、これらの値は対応するPHP定数、INF-INFNANへキャストされます。As of Laravel 5.7, these values will be cast to the corresponding PHP constants INF, -INF, and NAN.

メール確認Email Verification

影響の可能性: 状況によるLikelihood Of Impact: Optional

Laravelの新しいメール確認サービスを使用する選択をした場合、アプリケーションへスカフォールドを追加する必要があります。最初に、アプリケーションへVerificationControllerを追加します。App\Http\Controllers\Auth\VerificationControllerIf you choose to use Laravel's new email verification services[/docs/{{version}}/verification], you will need to add additional scaffolding to your application. First, add the VerificationController to your application: App\Http\Controllers\Auth\VerificationController[https://github.com/laravel/laravel/blob/master/app/Http/Controllers/Auth/VerificationController.php].

さらに、App\UserモデルにMustVerifyEmail契約を実装する必要があります。You will also need to modify your App\User model to implement the MustVerifyEmail contract:

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements MustVerifyEmail
{
    use Notifiable;

    // ...
}

検査済みのユーザーだけに特定のルートへのアクセスを許すためにverifiedミドルウェアを使うためには、app/Http/Kernel.phpファイルの$routeMiddlewareプロパティへ、新しいミドルウェアを含めるために更新する必要があります。In order to use the verified middleware so that only verified users may access a given route, you will need to update the $routeMiddleware property of your app/Http/Kernel.php file to include the new middleware:

// App\Http\Kernelクラスの中

protected $routeMiddleware = [
    'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
    'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
    'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
    'can' => \Illuminate\Auth\Middleware\Authorize::class,
    'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
    'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
    'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];

さらに、確認ビュースタブが必要です。このビューは、resources/views/auth/verify.blade.phpとして設置します。ビューの中身は、GitHubで取得できます。You will also need the verification view stub. This view should be placed at resources/views/auth/verify.blade.php. You may obtain the view's contents on GitHub[https://github.com/laravel/framework/blob/5.7/src/Illuminate/Auth/Console/stubs/make/views/auth/verify.stub].

次に、メールアドレスが確認された日時を保存するための、email_verified_atカラムをユーザーテーブルへ追加します。Next, your user table must contain an email_verified_at column to store the date and time that the email address was verified:

$table->timestamp('email_verified_at')->nullable();

ユーザー登録時にメールを送信するには、App\Providers\EventServiceProviderクラスへ、以下のイベントとリスナを登録する必要があります。In order to send the email when a user is registered, you should register following events and listeners in your App\Providers\EventServiceProvider[https://github.com/laravel/laravel/blob/master/app/Providers/EventServiceProvider.php] class:

use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;

/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
    Registered::class => [
        SendEmailVerificationNotification::class,
    ],
];

最後に、Auth::routesメソッドを呼び出す時に、verifyオプションを渡してください。Finally, when calling the Auth::routes method, you should pass the verify option to the method:

Auth::routes(['verify' => true]);

ファイルシステムFilesystem

Filesystem契約メソッドFilesystem Contract Methods

影響の可能性: 低いLikelihood Of Impact: Low

readStreamwriteStreamメソッドが、Illuminate\Contracts\Filesystem\Filesystem契約へ追加されました。このインターフェイスを実装している場合、皆さんの実装へこれらのメソッドを追加してください。The readStream and writeStream methods have been added to the Illuminate\Contracts\Filesystem\Filesystem contract[https://github.com/laravel/framework/pull/23755]. If you are implementing this interface, you should add these methods to your implementation.

ハッシュHashing

Hash::checkメソッドHash::check Method

影響の可能性: なしLikelihood Of Impact: None

checkメソッドは、設定されたアルゴリズムとハッシュのアルゴリズムがマッチするかをオプションとしてチェックするようになりました。The check method now optionally checks if the algorithm of the hash matches the configured algorithm.

メールMail

Mailable動的変数のケースMailable Dynamic Variable Casing

影響の可能性: 低いLikelihood Of Impact: Low

動的なビュー変数とMailable動的変数の振る舞いを統一するため、Mailableビューへ動的に渡される変数は、自動的に「キャメルケース」になるようになりました。動的Mailable変数はLaravelの機能としてドキュメントに乗せていないため、アプリケーションに影響する可能性は低いでしょう。Variables that are dynamically passed to mailable views are now automatically "camel cased"[https://github.com/laravel/framework/pull/24232], which makes mailable dynamic variable behavior consistent with dynamic view variables. Dynamic mailable variables are not a documented Laravel feature, so likelihood of impact to your application is low.

テンプレートテーマTemplate Theme

影響の可能性: 中程度Likelihood Of Impact: Medium

Markdownのmailableテンプレートのためのデフォルトテーマスタイルをカスタマイズしている場合、再公開(publish)し、カスタマイズし直す必要があります。'blue'、'green'、'red'のボタン色クラスが、'primary'、'success'、'error'へリネームされました。If you have customized the default theme styles used for Markdown mailable templates, you will need to re-publish and make your customizations again. The button color classes have been renamed from 'blue', 'green', and 'red' to 'primary', 'success', and 'error'.

キューQueue

QUEUE_DRIVER環境変数QUEUE_DRIVER Environment Variable

影響の可能性: とても低いLikelihood Of Impact: Very Low

QUEUE_DRIVER環境変数は、QUEUE_CONNECTIONへリネームされました。意図的に皆さんのconfig/queue.php設定ファイルをLaravel5.7の内容へ合わせようとしない限り、アップグレードしている既存のアプリケーションには影響ありません。The QUEUE_DRIVER environment variable has been renamed to QUEUE_CONNECTION. This should not affect existing applications that you are upgrading unless you intentionally modify your config/queue.php configuration file to match Laravel 5.7's.

WorkCommandオプションWorkCommand Options

影響の可能性: とても低いLikelihood Of Impact: Very Low

WorkCommandstop-when-emptyオプションが追加されました。このコマンドを拡張している場合は、クラスの$signatureプロパティへstop-when-emptyを追加する必要があります。The stop-when-empty option was added to the WorkCommand. If you extend this command, you need to add stop-when-empty to $signature property of your class.

ルートRouting

Route::redirectメソッドThe Route::redirect Method

影響の可能性: 高いLikelihood Of Impact: High

Route::redirectメソッドは、302HTTPステータスコードを返すようになりました。301リダイレクションを行う、permanentRedirectメソッドが追加されました。The Route::redirect method now returns a 302 HTTP status code redirect. The permanentRedirect method has been added to allow 301 redirects.

// Return a 302 redirect...
Route::redirect('/foo', '/bar');

// Return a 301 redirect...
Route::redirect('/foo', '/bar', 301);

// Return a 301 redirect...
Route::permanentRedirect('/foo', '/bar');

addRouteメソッドThe addRoute Method

影響の可能性: 低いLikelihood Of Impact: Low

Illuminate\Routing\RouterクラスのaddRouteメソッドが、protectedからpublicへ変更になりました。The addRoute method of the Illuminate\Routing\Router class has been changed from protected to public.

バリデーションValidation

ネストしたバリデーションデータNested Validation Data

影響の可能性: 中程度Likelihood Of Impact: Medium

以前のバージョンのLaravelでは、validateはネストしたバリデーションルールに対して、正しいデータを返しませんでした。Laravel5.7では、修正されています。In previous versions of Laravel, the validate method did not return the correct data for nested validation rules. This has been corrected in Laravel 5.7:

$data = Validator::make([
    'person' => [
        'name' => 'Taylor',
        'job' => 'Developer'
    ]
], ['person.name' => 'required'])->validate();

dump($data);

// 以前の振る舞い
['person' => ['name' => 'Taylor', 'job' => 'Developer']]

// 新しい振る舞い
['person' => ['name' => 'Taylor']]

Validator契約The Validator Contract

影響の可能性: とても低いLikelihood Of Impact: Very Low

validateメソッドが、Illuminate\Contracts\Validation\Validator契約に追加されましたThe validate method was added to the Illuminate\Contracts\Validation\Validator contract[https://github.com/laravel/framework/pull/25128]:

/**
 * Run the validator's rules against its data.
 *
 * @return array
 */
public function validate();

このインターフェイスを実装している場合は、皆さんの実装にこのメソッドを追加してください。If you are implementing this interface, you should add this method to your implementation.

テストTesting

影響の可能性: 中程度Likelihood of Impact: Medium

Laravel5.7ではArtisanコマンドに対するテストツールが向上しました。Artisanコマンドの出力は、デフォルトでモックされるようになりました。テストの一部としてartisanメソッドでコマンドを実行する必要がある場合は、Artisan::callを使用するか、テストクラス中でpublic $mockConsoleOutput = falseをプロパティとして定義してください。Laravel 5.7 introduces improved testing tools for Artisan commands. By default, Artisan command output is now mocked. If you are relying on the artisan method to run commands as part of your test, you should use Artisan::call or define public $mockConsoleOutput = false as a property in your test class.

その他Miscellaneous

私達はまた、laravel/laravel GitHubリポジトリの変更を確認することを推奨しています。そうした変更の多くは必要ありませんが、皆さんのアプリケーションでは最新状態へ同期しておきたいでしょう。変更のいくつかは、このアップグレードガイドで取り扱っていますが、設定ファイルやコメントの変更のような部分は扱っていません。GitHub比較ツールで変更を確認し、皆さんにとって重要な変更を選び出すことが簡単にできます。We also encourage you to view the changes in the laravel/laravel GitHub repository[https://github.com/laravel/laravel]. While many of these changes are not required, you may wish to keep these files in sync with your application. Some of these changes will be covered in this upgrade guide, but others, such as changes to configuration files or comments, will not be. You can easily view the changes with the GitHub comparison tool[https://github.com/laravel/laravel/compare/5.6...master] and choose which updates are important to you.

章選択

設定

明暗テーマ
light_mode
dark_mode
brightness_auto システム設定に合わせる
テーマ選択
photo_size_select_actual デフォルト
photo_size_select_actual モノクローム(白黒)
photo_size_select_actual Solarized風
photo_size_select_actual GitHub風(青ベース)
photo_size_select_actual Viva(黄緑ベース)
photo_size_select_actual Happy(紫ベース)
photo_size_select_actual Mint(緑ベース)
コードハイライトテーマ選択

明暗テーマごとに、コードハイライトのテーマを指定できます。

テーマ配色確認
スクリーン表示幅
640px
80%
90%
100%

768px以上の幅があるときのドキュメント部分表示幅です。

インデント
無し
1rem
2rem
3rem
原文確認
原文を全行表示
原文を一行ずつ表示
使用しない

※ 段落末のEボタンへカーソルオンで原文をPopupします。

Diff表示形式
色分けのみで区別
行頭の±で区別
削除線と追記で区別

※ [tl!…]形式の挿入削除行の表示形式です。

テストコード表示
両コード表示
Pestのみ表示
PHPUnitのみ表示
和文変換

対象文字列と置換文字列を半角スペースで区切ってください。(最大5組各10文字まで)

本文フォント

総称名以外はCSSと同様に、"〜"でエスケープしてください。

コードフォント

総称名以外はCSSと同様に、"〜"でエスケープしてください。

保存内容リセット

localStrageに保存してある設定項目をすべて削除し、デフォルト状態へ戻します。

ヘッダー項目移動

キーボード操作