Skip to content

Commit f69d25a

Browse files
committed
2025-01-20までの原文変更点反映。
1 parent 2adb1b8 commit f69d25a

16 files changed

+132
-48
lines changed

Diff for: original-en/cashier-paddle.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ Sometimes, you may need to create a checkout session for users that do not need
558558
use Laravel\Paddle\Checkout;
559559

560560
Route::get('/buy', function (Request $request) {
561-
$checkout = Checkout::guest('pri_34567')
561+
$checkout = Checkout::guest(['pri_34567'])
562562
->returnTo(route('home'));
563563

564564
return view('billing', ['checkout' => $checkout]);

Diff for: original-en/controllers.md

+3
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ You may also define controller middleware as closures, which provides a convenie
152152
];
153153
}
154154

155+
> [!WARNING]
156+
> Controllers implementing `Illuminate\Routing\Controllers\HasMiddleware` should not extend `Illuminate\Routing\Controller`.
157+
155158
<a name="resource-controllers"></a>
156159
## Resource Controllers
157160

Diff for: original-en/eloquent.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -923,10 +923,6 @@ To delete a model, you may call the `delete` method on the model instance:
923923

924924
$flight->delete();
925925

926-
You may call the `truncate` method to delete all of the model's associated database records. The `truncate` operation will also reset any auto-incrementing IDs on the model's associated table:
927-
928-
Flight::truncate();
929-
930926
<a name="deleting-an-existing-model-by-its-primary-key"></a>
931927
#### Deleting an Existing Model by its Primary Key
932928

@@ -954,6 +950,10 @@ Of course, you may build an Eloquent query to delete all models matching your qu
954950

955951
$deleted = Flight::where('active', 0)->delete();
956952

953+
To delete all models in a table, you should execute a query without adding any conditions:
954+
955+
$deleted = Flight::query()->delete();
956+
957957
> [!WARNING]
958958
> When executing a mass delete statement via Eloquent, the `deleting` and `deleted` model events will not be dispatched for the deleted models. This is because the models are never actually retrieved when executing the delete statement.
959959

Diff for: original-en/filesystem.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ Next, you may include the `read-only` configuration option in one or more of you
203203
<a name="amazon-s3-compatible-filesystems"></a>
204204
### Amazon S3 Compatible Filesystems
205205

206-
By default, your application's `filesystems` configuration file contains a disk configuration for the `s3` disk. In addition to using this disk to interact with Amazon S3, you may use it to interact with any S3 compatible file storage service such as [MinIO](https://github.com/minio/minio) or [DigitalOcean Spaces](https://www.digitalocean.com/products/spaces/).
206+
By default, your application's `filesystems` configuration file contains a disk configuration for the `s3` disk. In addition to using this disk to interact with [Amazon S3](https://aws.amazon.com/s3/), you may use it to interact with any S3-compatible file storage service such as [MinIO](https://github.com/minio/minio), [DigitalOcean Spaces](https://www.digitalocean.com/products/spaces/), [Akamai / Linode Object Storage](https://www.linode.com/products/object-storage/), [Vultr Object Storage](https://www.vultr.com/products/object-storage/), or [Hetzner Cloud Storage](https://www.hetzner.com/storage/object-storage/).
207207

208208
Typically, after updating the disk's credentials to match the credentials of the service you are planning to use, you only need to update the value of the `endpoint` configuration option. This option's value is typically defined via the `AWS_ENDPOINT` environment variable:
209209

Diff for: original-en/pint.md

+6
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ If you would like Pint to simply inspect your code for style errors without actu
5555
./vendor/bin/pint --test
5656
```
5757

58+
If you would like Pint to only modify the files that differ from the provided branch according to Git, you may use the `--diff=[branch]` option. This can be effectively used in your CI environment (like GitHub actions) to save time by only inspecting new or modified files:
59+
60+
```shell
61+
./vendor/bin/pint --diff=main
62+
```
63+
5864
If you would like Pint to only modify the files that have uncommitted changes according to Git, you may use the `--dirty` option:
5965

6066
```shell

Diff for: original-en/queries.md

+28-9
Original file line numberDiff line numberDiff line change
@@ -1165,15 +1165,6 @@ The query builder's `delete` method may be used to delete records from the table
11651165

11661166
$deleted = DB::table('users')->where('votes', '>', 100)->delete();
11671167

1168-
If you wish to truncate an entire table, which will remove all records from the table and reset the auto-incrementing ID to zero, you may use the `truncate` method:
1169-
1170-
DB::table('users')->truncate();
1171-
1172-
<a name="table-truncation-and-postgresql"></a>
1173-
#### Table Truncation and PostgreSQL
1174-
1175-
When truncating a PostgreSQL database, the `CASCADE` behavior will be applied. This means that all foreign key related records in other tables will be deleted as well.
1176-
11771168
<a name="pessimistic-locking"></a>
11781169
## Pessimistic Locking
11791170

@@ -1191,6 +1182,34 @@ Alternatively, you may use the `lockForUpdate` method. A "for update" lock preve
11911182
->lockForUpdate()
11921183
->get();
11931184

1185+
While not obligatory, it is recommended to wrap pessimistic locks within a [transaction](/docs/{{version}}/database#database-transactions). This ensures that the data retrieved remains unaltered in the database until the entire operation completes. In case of a failure, the transaction will roll back any changes and release the locks automatically:
1186+
1187+
DB::transaction(function () {
1188+
$sender = DB::table('users')
1189+
->lockForUpdate()
1190+
->find(1);
1191+
1192+
$receiver = DB::table('users')
1193+
->lockForUpdate();
1194+
->find(2);
1195+
1196+
if ($sender->balance < 100) {
1197+
throw new RuntimeException('Balance too low.');
1198+
}
1199+
1200+
DB::table('users')
1201+
->where('id', $sender->id)
1202+
->update([
1203+
'balance' => $sender->balance - 100
1204+
]);
1205+
1206+
DB::table('users')
1207+
->where('id', $receiver->id)
1208+
->update([
1209+
'balance' => $receiver->balance + 100
1210+
]);
1211+
});
1212+
11941213
<a name="debugging"></a>
11951214
## Debugging
11961215

Diff for: original-en/redis.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ If your application is utilizing a cluster of Redis servers, you should define t
125125

126126
By default, Laravel will use native Redis clustering since the `options.cluster` configuration value is set to `redis`. Redis clustering is a great default option, as it gracefully handles failover.
127127

128-
Laravel also supports client-side sharding. However, client-side sharding does not handle failover; therefore, it is primarily suited for transient cached data that is available from another primary data store.
128+
Laravel also supports client-side sharding when using Predis. However, client-side sharding does not handle failover; therefore, it is primarily suited for transient cached data that is available from another primary data store.
129129

130130
If you would like to use client-side sharding instead of native Redis clustering, you may remove the `options.cluster` configuration value within your application's `config/database.php` configuration file:
131131

@@ -176,7 +176,7 @@ By default, Laravel will use the PhpRedis extension to communicate with Redis. T
176176
// ...
177177
],
178178

179-
In addition to the default configuration options, PhpRedis supports the following additional connection parameters: `name`, `persistent`, `persistent_id`, `prefix`, `read_timeout`, `retry_interval`, `timeout`, and `context`. You may add any of these options to your Redis server configuration in the `config/database.php` configuration file:
179+
In addition to the default configuration options, PhpRedis supports the following additional connection parameters: `name`, `persistent`, `persistent_id`, `prefix`, `read_timeout`, `retry_interval`, `max_retries`, `backoff_algorithm`, `backoff_base`, `backoff_cap`, `timeout`, and `context`. You may add any of these options to your Redis server configuration in the `config/database.php` configuration file:
180180

181181
'default' => [
182182
'url' => env('REDIS_URL'),

Diff for: original-en/validation.md

+21-7
Original file line numberDiff line numberDiff line change
@@ -1226,16 +1226,30 @@ The example above will apply the `RFCValidation` and `DNSCheckValidation` valida
12261226

12271227
<div class="content-list" markdown="1">
12281228

1229-
- `rfc`: `RFCValidation`
1230-
- `strict`: `NoRFCWarningsValidation`
1231-
- `dns`: `DNSCheckValidation`
1232-
- `spoof`: `SpoofCheckValidation`
1233-
- `filter`: `FilterEmailValidation`
1234-
- `filter_unicode`: `FilterEmailValidation::unicode()`
1229+
- `rfc`: `RFCValidation` - Validate the email address according to RFC 5322.
1230+
- `strict`: `NoRFCWarningsValidation` - Validate the email according to RFC 5322, rejecting trailing periods or multiple consecutive periods.
1231+
- `dns`: `DNSCheckValidation` - Ensure the email address's domain has a valid MX record.
1232+
- `spoof`: `SpoofCheckValidation` - Ensure the email address does not contain homograph or deceptive Unicode characters.
1233+
- `filter`: `FilterEmailValidation` - Ensure the email address is valid according to PHP's `filter_var` function.
1234+
- `filter_unicode`: `FilterEmailValidation::unicode()` - Ensure the email address is valid according to PHP's `filter_var` function, allowing some Unicode characters.
12351235

12361236
</div>
12371237

1238-
The `filter` validator, which uses PHP's `filter_var` function, ships with Laravel and was Laravel's default email validation behavior prior to Laravel version 5.8.
1238+
For convenience, email validation rules may be built using the fluent rule builder:
1239+
1240+
```php
1241+
use Illuminate\Validation\Rule;
1242+
1243+
$request->validate([
1244+
'email' => [
1245+
'required',
1246+
Rule::email()
1247+
->rfcCompliant(strict: false)
1248+
->validateMxRecord()
1249+
->preventSpoofing()
1250+
],
1251+
]);
1252+
```
12391253

12401254
> [!WARNING]
12411255
> The `dns` and `spoof` validators require the PHP `intl` extension.

Diff for: translation-ja/cashier-paddle.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ Sometimes, you may need to create a checkout session for users that do not need
558558
use Laravel\Paddle\Checkout;
559559

560560
Route::get('/buy', function (Request $request) {
561-
$checkout = Checkout::guest('pri_34567')
561+
$checkout = Checkout::guest(['pri_34567'])
562562
->returnTo(route('home'));
563563

564564
return view('billing', ['checkout' => $checkout]);

Diff for: translation-ja/controllers.md

+3
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ php artisan make:controller ProvisionServer --invokable
152152
];
153153
}
154154

155+
> [!WARNING]
156+
> `Illuminate\Routing\Controllers\HasMiddleware'を実装するコントローラは、`Illuminate\Routing\Controller`を継承してはいけません。
157+
155158
<a name="resource-controllers"></a>
156159
## リソースコントローラ
157160

Diff for: translation-ja/eloquent.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -923,10 +923,6 @@ Eloquentの`upsert`メソッドを使用すると、単一で極小の操作で
923923

924924
$flight->delete();
925925

926-
モデルに関連しているすべてのデータベースレコードを削除するには、`truncate`メソッドを呼びだせます。`truncate`操作は、モデルの関連テーブルの自動増分IDをリセットします。
927-
928-
Flight::truncate();
929-
930926
<a name="deleting-an-existing-model-by-its-primary-key"></a>
931927
#### 主キーによる既存のモデルの削除
932928

@@ -954,6 +950,10 @@ Eloquentの`upsert`メソッドを使用すると、単一で極小の操作で
954950

955951
$deleted = Flight::where('active', 0)->delete();
956952

953+
テーブル内のすべてのモデルを削除するには、条件を追加せずにクエリを実行する必要があります。
954+
955+
$deleted = Flight::query()->delete();
956+
957957
> [!WARNING]
958958
> Eloquentを介して一括削除ステートメントを実行すると、削除されたモデルに対して`deleting`および`deleted`モデルイベントがディスパッチされません。これは、deleteステートメントの実行時にモデルが実際には取得されないためです。
959959

Diff for: translation-ja/filesystem.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ composer require league/flysystem-read-only "^3.0"
203203
<a name="amazon-s3-compatible-filesystems"></a>
204204
### Amazon S3互換ファイルシステム
205205

206-
アプリケーションの`filesystems`設定ファイルはデフォルトで、`s3`ディスクのディスク設定を含んでいます。このディスクはAmazon S3の操作に加え[MinIO](https://github.com/minio/minio)[DigitalOcean Spaces](https://www.digitalocean.com/products/spaces/)など、S3と互換性のあるファイルストレージサービスの操作にも使用できます
206+
アプリケーションの`filesystems`設定ファイルには、デフォルトで`s3`のディスク設定がしてあります。このディスクを使用して[Amazon S3](https://aws.amazon.com/s3/)を操作するだけでなく[MinIO](https://github.com/minio/minio)[DigitalOcean Spaces](https://www.digitalocean.com/products/spaces/)[Akamai/Linode Object Storage](https://www.linode.com/products/object-storage/)[Vultr Object Storage](https://www.vultr.com/products/object-storage/)[Hetzner Cloud Storage](https://www.hetzner.com/storage/object-storage/)など、S3互換のファイルストレージサービスを操作することもできます
207207

208208
通常、ディスクの認証情報を使用予定のサービス認証情報へ合わせて更新した後に、`endpoint`設定オプションの値を更新するだけで済みます。このオプションの値は通常、`AWS_ENDPOINT`環境変数で定義されています。
209209

Diff for: translation-ja/pint.md

+6
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ Pintは更新した全ファイルの完全なリストを表示します。Pint
5555
./vendor/bin/pint --test
5656
```
5757

58+
Gitで指定したブランチと比較して、異なるファイルのみをPintで修正したい場合は、`--diff=[branch]`オプションを使用します。これはCI環境(GitHub actionsなど)で効果的に使用でき、新規または変更されたファイルのみを調べることで時間を節約できます。
59+
60+
```shell
61+
./vendor/bin/pint --diff=main
62+
```
63+
5864
もし、Gitへコミットされていない変更のあるファイルだけをPintに修正させたい場合は、`--dirty` オプションを使用します。
5965

6066
```shell

Diff for: translation-ja/queries.md

+28-9
Original file line numberDiff line numberDiff line change
@@ -1165,15 +1165,6 @@ JSONカラムを更新する場合は、JSONオブジェクトの適切なキー
11651165

11661166
$deleted = DB::table('users')->where('votes', '>', 100)->delete();
11671167

1168-
テーブル全体を切り捨てて、テーブルからすべてのレコードを削除し、自動増分IDをゼロにリセットする場合は、`truncate`メソッドを使用します。
1169-
1170-
DB::table('users')->truncate();
1171-
1172-
<a name="table-truncation-and-postgresql"></a>
1173-
#### テーブルのトランケーションとPostgreSQL
1174-
1175-
PostgreSQLデータベースを切り捨てる場合、`CASCADE`動作が適用されます。これは、他のテーブルのすべての外部キー関連レコードも削除されることを意味します。
1176-
11771168
<a name="pessimistic-locking"></a>
11781169
## 悲観的ロック
11791170

@@ -1191,6 +1182,34 @@ PostgreSQLデータベースを切り捨てる場合、`CASCADE`動作が適用
11911182
->lockForUpdate()
11921183
->get();
11931184

1185+
義務ではありませんが、悲観的ロックは[トランザクション](/docs/{{version}}/database#database-transactions)の中へラップすることを推奨します。これにより、操作全体が完了するまで、取得したデータがデータベース内で変更されないことが保証されます。失敗した場合、トランザクションは変更をロールバックし、ロックを自動的に解放します。
1186+
1187+
DB::transaction(function () {
1188+
$sender = DB::table('users')
1189+
->lockForUpdate()
1190+
->find(1);
1191+
1192+
$receiver = DB::table('users')
1193+
->lockForUpdate();
1194+
->find(2);
1195+
1196+
if ($sender->balance < 100) {
1197+
throw new RuntimeException('Balance too low.');
1198+
}
1199+
1200+
DB::table('users')
1201+
->where('id', $sender->id)
1202+
->update([
1203+
'balance' => $sender->balance - 100
1204+
]);
1205+
1206+
DB::table('users')
1207+
->where('id', $receiver->id)
1208+
->update([
1209+
'balance' => $receiver->balance + 100
1210+
]);
1211+
});
1212+
11941213
<a name="debugging"></a>
11951214
## デバッグ
11961215

Diff for: translation-ja/redis.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ RedisクライアントはRedisサーバへ接続するとき、デフォルト
125125

126126
`options.cluster`の設定値が`redis`に設定されているため、Laravelはデフォルトで、ネイティブのRedisクラスタリングを使用します。Redisクラスタリングは丁寧にフェイルオーバーを処理するので、素晴らしいデフォルトオプションです。
127127

128-
Laravelはクライアントサイドシャーディングもサポートしています。しかし、クライアントサイドシャーディングはフェイルオーバーを処理しません。そのため、主に別のプライマリデータストアから利用可能な一時的なキャッシュデータに適しています。
128+
Predisを使用する場合、Laravelはクライアントサイドシャーディングもサポートしています。しかし、クライアントサイドシャーディングはフェイルオーバーを処理しません。そのため、主に別のプライマリデータストアから利用可能な一時的なキャッシュデータに適しています。
129129

130130
ネイティブのRedisクラスタリングではなく、クライアントサイドのシャーディングを使用したい場合は、アプリケーションの`config/database.php`設定ファイル内の`options.cluster`設定値を削除してください。
131131

@@ -176,7 +176,7 @@ Laravelはクライアントサイドシャーディングもサポートして
176176
// ...
177177
],
178178

179-
デフォルトの設定オプションに加えて、PhpRedisは`name``persistent``persistent_id``prefix``read_timeout``retry_interval``timeout``context`の追加接続パラメータをサポートしています。これらのオプションは、`config/database.php`設定ファイルのRedisサーバ設定へ追加してください。
179+
デフォルトの設定オプションに加えて、PhpRedisは`name``persistent``persistent_id``prefix``read_timeout``retry_interval``max_retries``backoff_algorithm``backoff_base``backoff_cap`,`timeout``context`の追加接続パラメータをサポートしています。これらのオプションは、`config/database.php`設定ファイルのRedisサーバ設定へ追加してください。
180180

181181
'default' => [
182182
'url' => env('REDIS_URL'),

Diff for: translation-ja/validation.md

+21-7
Original file line numberDiff line numberDiff line change
@@ -1226,16 +1226,30 @@ distinctはデフォルトで緩い比較を使用します。厳密な比較を
12261226

12271227
<div class="content-list" markdown="1">
12281228

1229-
- `rfc`: `RFCValidation`
1230-
- `strict`: `NoRFCWarningsValidation`
1231-
- `dns`: `DNSCheckValidation`
1232-
- `spoof`: `SpoofCheckValidation`
1233-
- `filter`: `FilterEmailValidation`
1234-
- `filter_unicode`: `FilterEmailValidation::unicode()`
1229+
- `rfc`: `RFCValidation` - RFC 5322に従い、メールアドレスをバリデーションする。
1230+
- `strict`: `NoRFCWarningsValidation` - RFC 5322に従い、メールアドレスをバリデーションするが、末尾のピリオドや連続するピリオドは拒絶する。
1231+
- `dns`: `DNSCheckValidation` - メールアドレスのドメインに、有効なMXレコードがあることを確認する。
1232+
- `spoof`: `SpoofCheckValidation` - メールアドレスにホモグラフや偽のUnicode文字が含まれていないことを確認する。
1233+
- `filter`: `FilterEmailValidation` - PHPの`filter_var`関数に従い、メールアドレスが有効であることを確認する。
1234+
- `filter_unicode`: `FilterEmailValidation::unicode()` - メールアドレスがPHPのfilter_var関数に従い、メールアドレスが有効であることを確認し、一部のUnicode文字を許可します。
12351235

12361236
</div>
12371237

1238-
PHPの`filter_var`関数を使用する`filter`バリデータは、Laravelに付属しており、Laravelバージョン5.8より前のLaravelのデフォルトの電子メールバリデーション動作でした。
1238+
使い勝手が良いように、メールバリデーションルールは、fluentルールビルダを使って作成できます。
1239+
1240+
```php
1241+
use Illuminate\Validation\Rule;
1242+
1243+
$request->validate([
1244+
'email' => [
1245+
'required',
1246+
Rule::email()
1247+
->rfcCompliant(strict: false)
1248+
->validateMxRecord()
1249+
->preventSpoofing()
1250+
],
1251+
]);
1252+
```
12391253

12401254
> [!WARNING]
12411255
> `dns`および`spoof`バリデータには、PHPの`intl`拡張が必要です。

0 commit comments

Comments
 (0)