Skip to content

Commit 9bdaf58

Browse files
committed
2024-03-04までの原文変更点反映。
1 parent 0858c49 commit 9bdaf58

16 files changed

+187
-59
lines changed

original-en/configuration.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,31 @@ php artisan env:decrypt --force
185185
<a name="accessing-configuration-values"></a>
186186
## Accessing Configuration Values
187187

188-
You may easily access your configuration values using the global `config` function from anywhere in your application. The configuration values may be accessed using "dot" syntax, which includes the name of the file and option you wish to access. A default value may also be specified and will be returned if the configuration option does not exist:
188+
You may easily access your configuration values using the `Config` facade or global `config` function from anywhere in your application. The configuration values may be accessed using "dot" syntax, which includes the name of the file and option you wish to access. A default value may also be specified and will be returned if the configuration option does not exist:
189+
190+
use Illuminate\Support\Facades\Config;
191+
192+
$value = Config::get('app.timezone');
189193

190194
$value = config('app.timezone');
191195

192196
// Retrieve a default value if the configuration value does not exist...
193197
$value = config('app.timezone', 'Asia/Seoul');
194198

195-
To set configuration values at runtime, pass an array to the `config` function:
199+
To set configuration values at runtime, you may invoke the `Config` facade's `set` method or pass an array to the `config` function:
200+
201+
Config::set('app.timezone', 'America/Chicago');
196202

197203
config(['app.timezone' => 'America/Chicago']);
198204

205+
To assist with static analysis, the `Config` facade also provides typed configuration retrieval methods. If the retrieved configuration value does not match the expected type, an exception will be thrown:
206+
207+
Config::string('config-key');
208+
Config::integer('config-key');
209+
Config::float('config-key');
210+
Config::boolean('config-key');
211+
Config::array('config-key');
212+
199213
<a name="configuration-caching"></a>
200214
## Configuration Caching
201215

original-en/eloquent-resources.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -334,24 +334,6 @@ By default, your outermost resource is wrapped in a `data` key when the resource
334334
}
335335
```
336336

337-
If you would like to use a custom key instead of `data`, you may define a `$wrap` attribute on the resource class:
338-
339-
<?php
340-
341-
namespace App\Http\Resources;
342-
343-
use Illuminate\Http\Resources\Json\JsonResource;
344-
345-
class UserResource extends JsonResource
346-
{
347-
/**
348-
* The "data" wrapper that should be applied.
349-
*
350-
* @var string|null
351-
*/
352-
public static $wrap = 'user';
353-
}
354-
355337
If you would like to disable the wrapping of the outermost resource, you should invoke the `withoutWrapping` method on the base `Illuminate\Http\Resources\Json\JsonResource` class. Typically, you should call this method from your `AppServiceProvider` or another [service provider](/docs/{{version}}/providers) that is loaded on every request to your application:
356338

357339
<?php

original-en/prompts.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [Suggest](#suggest)
1212
- [Search](#search)
1313
- [Multi-search](#multisearch)
14+
- [Pause](#pause)
1415
- [Informational Messages](#informational-messages)
1516
- [Tables](#tables)
1617
- [Spin](#spin)
@@ -610,8 +611,19 @@ $ids = multisearch(
610611

611612
If the `options` closure returns an associative array, then the closure will receive the selected keys; otherwise, it will receive the selected values. The closure may return an error message, or `null` if the validation passes.
612613

614+
<a name="pause"></a>
615+
### Pause
616+
617+
The `pause` function may be used to display informational text to the user and wait for them to confirm their desire to proceed by pressing the Enter / Return key:
618+
619+
```php
620+
use function Laravel\Prompts\pause;
621+
622+
pause('Press ENTER to continue.');
623+
```
624+
613625
<a name="informational-messages"></a>
614-
### Informational Messages
626+
## Informational Messages
615627

616628
The `note`, `info`, `warning`, `error`, and `alert` functions may be used to display informational messages:
617629

@@ -622,7 +634,7 @@ info('Package installed successfully.');
622634
```
623635

624636
<a name="tables"></a>
625-
### Tables
637+
## Tables
626638

627639
The `table` function makes it easy to display multiple rows and columns of data. All you need to do is provide the column names and the data for the table:
628640

@@ -636,7 +648,7 @@ table(
636648
```
637649

638650
<a name="spin"></a>
639-
### Spin
651+
## Spin
640652

641653
The `spin` function displays a spinner along with an optional message while executing a specified callback. It serves to indicate ongoing processes and returns the callback's results upon completion:
642654

@@ -705,7 +717,7 @@ $progress->finish();
705717
```
706718

707719
<a name="terminal-considerations"></a>
708-
### Terminal Considerations
720+
## Terminal Considerations
709721

710722
<a name="terminal-width"></a>
711723
#### Terminal Width
@@ -718,7 +730,7 @@ If the length of any label, option, or validation message exceeds the number of
718730
For any prompts that accept the `scroll` argument, the configured value will automatically be reduced to fit the height of the user's terminal, including space for a validation message.
719731

720732
<a name="fallbacks"></a>
721-
### Unsupported Environments and Fallbacks
733+
## Unsupported Environments and Fallbacks
722734

723735
Laravel Prompts supports macOS, Linux, and Windows with WSL. Due to limitations in the Windows version of PHP, it is not currently possible to use Laravel Prompts on Windows outside of WSL.
724736

original-en/queries.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,26 @@ You may use the `joinSub`, `leftJoinSub`, and `rightJoinSub` methods to join a q
380380
$join->on('users.id', '=', 'latest_posts.user_id');
381381
})->get();
382382

383+
<a name="lateral-joins"></a>
384+
#### Lateral Joins
385+
386+
> [!WARNING]
387+
> Lateral joins are currently supported by PostgreSQL, MySQL >= 8.0.14, and SQL Server.
388+
389+
You may use the `joinLateral` and `leftJoinLateral` methods to perform a "lateral join" with a subquery. Each of these methods receives two arguments: the subquery and its table alias. The join condition(s) should be specified within the `where` clause of the given subquery. Lateral joins are evaluated for each row and can reference columns outside the subquery.
390+
391+
In this example, we will retrieve a collection of users as well as the user's three most recent blog posts. Each user can produce up to three rows in the result set: one for each of their most recent blog posts. The join condition is specified with a `whereColumn` clause within the subquery, referencing the current user row:
392+
393+
$latestPosts = DB::table('posts')
394+
->select('id as post_id', 'title as post_title', 'created_at as post_created_at')
395+
->whereColumn('user_id', 'users.id')
396+
->orderBy('created_at', 'desc')
397+
->limit(3);
398+
399+
$users = DB::table('users')
400+
->joinLateral($latestPosts, 'latest_posts')
401+
->get();
402+
383403
<a name="unions"></a>
384404
## Unions
385405

original-en/rate-limiting.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,24 @@ If you would like to manually interact with the rate limiter, a variety of other
6666
return 'Too many attempts!';
6767
}
6868

69-
RateLimiter::hit('send-message:'.$user->id);
69+
RateLimiter::increment('send-message:'.$user->id);
7070

7171
// Send message...
7272

73-
Alternatively, you may use the `remaining` method to retrieve the number of attempts remaining for a given key. If a given key has retries remaining, you may invoke the `hit` method to increment the number of total attempts:
73+
Alternatively, you may use the `remaining` method to retrieve the number of attempts remaining for a given key. If a given key has retries remaining, you may invoke the `increment` method to increment the number of total attempts:
7474

7575
use Illuminate\Support\Facades\RateLimiter;
7676

7777
if (RateLimiter::remaining('send-message:'.$user->id, $perMinute = 5)) {
78-
RateLimiter::hit('send-message:'.$user->id);
78+
RateLimiter::increment('send-message:'.$user->id);
7979

8080
// Send message...
8181
}
8282

83+
If you would like to increment the value for a given rate limiter key by more than one, you may provide the desired amount to the `increment` method:
84+
85+
RateLimiter::increment('send-message:'.$user->id, amount: 5);
86+
8387
<a name="determining-limiter-availability"></a>
8488
#### Determining Limiter Availability
8589

@@ -93,7 +97,7 @@ When a key has no more attempts left, the `availableIn` method returns the numbe
9397
return 'You may try again in '.$seconds.' seconds.';
9498
}
9599

96-
RateLimiter::hit('send-message:'.$user->id);
100+
RateLimiter::increment('send-message:'.$user->id);
97101

98102
// Send message...
99103

original-en/strings.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,10 @@ The `Str::isUrl` method determines if the given string is a valid URL:
559559

560560
// false
561561

562+
The `isUrl` method considers a wide range of protocols as valid. However, you may specify the protocols that should be considered valid by providing them to the `isUrl` method:
563+
564+
$isUrl = Str::isUrl('http://example.com', ['http', 'https']);
565+
562566
<a name="method-str-is-ulid"></a>
563567
#### `Str::isUlid()` {.collection-method}
564568

@@ -1758,6 +1762,10 @@ The `isUrl` method determines if a given string is a URL:
17581762

17591763
// false
17601764

1765+
The `isUrl` method considers a wide range of protocols as valid. However, you may specify the protocols that should be considered valid by providing them to the `isUrl` method:
1766+
1767+
$result = Str::of('http://example.com')->isUrl(['http', 'https']);
1768+
17611769
<a name="method-fluent-str-is-uuid"></a>
17621770
#### `isUuid` {.collection-method}
17631771

original-en/telescope.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ php artisan telescope:install
5656
php artisan migrate
5757
```
5858

59+
Finally, you may access the Telescope dashboard via the `/telescope` route.
60+
5961
<a name="migration-customization"></a>
6062
#### Migration Customization
6163

original-en/validation.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,28 @@ The `Enum` rule is a class based rule that validates whether the field under val
12451245
'status' => [Rule::enum(ServerStatus::class)],
12461246
]);
12471247

1248+
The `Enum` rule's `only` and `except` methods may be used to limit which enum cases should be considered valid:
1249+
1250+
Rule::enum(ServerStatus::class)
1251+
->only([ServerStatus::Pending, ServerStatus::Active]);
1252+
1253+
Rule::enum(ServerStatus::class)
1254+
->except([ServerStatus::Pending, ServerStatus::Active]);
1255+
1256+
The `when` method may be used to conditionally modify the `Enum` rule:
1257+
1258+
```php
1259+
use Illuminate\Support\Facades\Auth;
1260+
use Illuminate\Validation\Rule;
1261+
1262+
Rule::enum(ServerStatus::class)
1263+
->when(
1264+
Auth::user()->isAdmin(),
1265+
fn ($rule) => $rule->only(...),
1266+
fn ($rule) => $rule->only(...),
1267+
);
1268+
```
1269+
12481270
<a name="rule-exclude"></a>
12491271
#### exclude
12501272

translation-ja/configuration.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,31 @@ php artisan env:decrypt --force
185185
<a name="accessing-configuration-values"></a>
186186
## 設定値へのアクセス
187187

188-
アプリケーションのどこからでもグローバルの`config`関数を使用し、設定値へ簡単にアクセスできます。設定値はファイルとオプションの名前を含む「ドット」記法を使いアクセスします。デフォルト値も指定でき、設定オプションが存在しない場合に、返されます。
188+
アプリケーションのどこからでも、`Config`ファサードと`config`グローバル関数を使い、簡単に設定値にアクセスできます。設定値には「ドット」構文を使いアクセスでき、アクセスしたいファイル名とオプション名を指定します。デフォルト値を指定することもでき、その設定オプションが存在しない場合に返します。
189+
190+
use Illuminate\Support\Facades\Config;
191+
192+
$value = Config::get('app.timezone');
189193

190194
$value = config('app.timezone');
191195

192196
// 設定値が存在しない場合、デフォルト値を取得する
193197
$value = config('app.timezone', 'Asia/Seoul');
194198

195-
実行時に設定値をセットするには、`config`関数へ配列で渡してください。
199+
実行時に設定値をセットするには、`Config`ファサードの`set`メソッドを呼び出すか、`config` 関数に配列を渡します。
200+
201+
Config::set('app.timezone', 'America/Chicago');
196202

197203
config(['app.timezone' => 'America/Chicago']);
198204

205+
静的解析を支援するため、`Config`ファサードは型付き設定値取得メソッドも提供しています。取得した設定値が期待している型と一致しない場合は、例外を投げます。
206+
207+
Config::string('config-key');
208+
Config::integer('config-key');
209+
Config::float('config-key');
210+
Config::boolean('config-key');
211+
Config::array('config-key');
212+
199213
<a name="configuration-caching"></a>
200214
## 設定キャッシュ
201215

translation-ja/eloquent-resources.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -334,24 +334,6 @@ php artisan make:resource UserCollection
334334
}
335335
```
336336

337-
`data`の代わりにカスタムキーを使用したい場合は、リソースクラスに`$wrap`属性を定義します。
338-
339-
<?php
340-
341-
namespace App\Http\Resources;
342-
343-
use Illuminate\Http\Resources\Json\JsonResource;
344-
345-
class UserResource extends JsonResource
346-
{
347-
/**
348-
* 適用する「データ」ラッパー
349-
*
350-
* @var string|null
351-
*/
352-
public static $wrap = 'user';
353-
}
354-
355337
最も外側のリソースのラッピングを無効にする場合は、ベースの`Illuminate\Http\Resources\Json\JsonResource`クラスで`withoutWrapping`メソッドを呼び出す必要があります。通常、このメソッドは、アプリケーションへのすべてのリクエストで読み込まれる`AppServiceProvider`か、別の[サービスプロバイダ](/docs/{{version}}/provider)から呼び出す必要があります。
356338

357339
<?php

0 commit comments

Comments
 (0)