Skip to content

Commit

Permalink
2023/11/13までの原文変更点反映。
Browse files Browse the repository at this point in the history
  • Loading branch information
HiroKws committed Nov 12, 2023
1 parent d99b603 commit 402cf10
Show file tree
Hide file tree
Showing 12 changed files with 249 additions and 43 deletions.
2 changes: 1 addition & 1 deletion original-en/artisan.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ If you would like complete control over the prompt, you may provide a closure th
label: 'Search for a user:',
placeholder: 'E.g. Taylor Otwell',
options: fn ($value) => strlen($value) > 0
? User::where('name', 'like', "%{$value}%")->pluck('name', 'id')
? User::where('name', 'like', "%{$value}%")->pluck('name', 'id')->all()
: []
),
];
Expand Down
2 changes: 1 addition & 1 deletion original-en/eloquent.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ If you would like a model to use a UUID key instead of an auto-incrementing inte

$article->id; // "8f8e8478-9035-4d23-b9a7-62f4d2612ce5"

By default, The `HasUuids` trait will generate ["ordered" UUIDs](/docs/{{version}}/helpers#method-str-ordered-uuid) for your models. These UUIDs are more efficient for indexed database storage because they can be sorted lexicographically.
By default, The `HasUuids` trait will generate ["ordered" UUIDs](/docs/{{version}}/strings#method-str-ordered-uuid) for your models. These UUIDs are more efficient for indexed database storage because they can be sorted lexicographically.

You can override the UUID generation process for a given model by defining a `newUniqueId` method on the model. In addition, you may specify which columns should receive UUIDs by defining a `uniqueIds` method on the model:

Expand Down
2 changes: 1 addition & 1 deletion original-en/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Typically, events should be registered via the `EventServiceProvider` `$listen`
{
Event::listen(
PodcastProcessed::class,
[SendPodcastNotification::class, 'handle']
SendPodcastNotification::class,
);

Event::listen(function (PodcastProcessed $event) {
Expand Down
10 changes: 3 additions & 7 deletions original-en/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,7 @@ Your `.env` file should not be committed to your application's source control, s

Now that you have created your Laravel application, you probably want to store some data in a database. By default, your application's `.env` configuration file specifies that Laravel will be interacting with a MySQL database and will access the database at `127.0.0.1`. If you are developing on macOS and need to install MySQL, Postgres, or Redis locally, you may find it convenient to utilize [DBngin](https://dbngin.com/).

If you do not want to install MySQL or Postgres on your local machine, you can always use a [SQLite](https://www.sqlite.org/index.html) database. SQLite is a small, fast, self-contained database engine. To get started, create a SQLite database by creating an empty SQLite file. Typically, this file will exist within the `database` directory of your Laravel application:

```shell
touch database/database.sqlite
```

Next, update your `.env` configuration file to use Laravel's `sqlite` database driver. You may remove the other database configuration options:
If you do not want to install MySQL or Postgres on your local machine, you can always use a [SQLite](https://www.sqlite.org/index.html) database. SQLite is a small, fast, self-contained database engine. To get started, update your `.env` configuration file to use Laravel's `sqlite` database driver. You may remove the other database configuration options:

```ini
DB_CONNECTION=sqlite # [tl! add]
Expand All @@ -254,6 +248,8 @@ Once you have configured your SQLite database, you may run your application's [d
php artisan migrate
```

If an SQLite database does not exist for your application, Laravel will ask you if you would like the database to be created. Typically, the SQLite database file will be created at `database/database.sqlite`.

<a name="directory-configuration"></a>
### Directory Configuration

Expand Down
87 changes: 87 additions & 0 deletions original-en/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
- [Customizing Monolog For Channels](#customizing-monolog-for-channels)
- [Creating Monolog Handler Channels](#creating-monolog-handler-channels)
- [Creating Custom Channels Via Factories](#creating-custom-channels-via-factories)
- [Tailing Log Messages Using Pail](#tailing-log-messages-using-pail)
- [Installation](#pail-installation)
- [Usage](#pail-usage)
- [Filtering Logs](#pail-filtering-logs)

<a name="introduction"></a>
## Introduction
Expand Down Expand Up @@ -444,3 +448,86 @@ Once you have configured the `custom` driver channel, you're ready to define the
return new Logger(/* ... */);
}
}

<a name="tailing-log-messages-using-pail"></a>
## Tailing Log Messages Using Pail

Often you may need to tail your application's logs in real time. For example, when debugging an issue or when monitoring your application's logs for specific types of errors.

Laravel Pail is a package that allows you to easily dive into your Laravel application's log files directly from the command line. Unlike the standard `tail` command, Pail is designed to work with any log driver, including Sentry or Flare. In addition, Pail provides a set of useful filters to help you quickly find what you're looking for.

<img src="https://laravel.com/img/docs/pail-example.png">

<a name="pail-installation"></a>
### Installation

> **Warning**
> Laravel Pail requires [PHP 8.2+](https://php.net/releases/) and the [PCNTL](https://www.php.net/manual/en/book.pcntl.php) extension.
To get started, install Pail into your project using the Composer package manager:

```bash
composer require laravel/pail
```

<a name="pail-usage"></a>
### Usage

To start tailing logs, run the `pail` command:

```bash
php artisan pail
```

To increase the verbosity of the output and avoid truncation (…), use the `-v` option:

```bash
php artisan pail -v
```

For maximum verbosity and to display exception stack traces, use the `-vv` option:

```bash
php artisan pail -vv
```

To stop tailing logs, press `Ctrl+C` at any time.

<a name="pail-filtering-logs"></a>
### Filtering Logs

<a name="pail-filtering-logs-filter-option"></a>
#### `--filter`

You may use the `--filter` option to filter logs by their type, file, message, and stack trace content:

```bash
php artisan pail --filter="QueryException"
```

<a name="pail-filtering-logs-message-option"></a>
#### `--message`

To filter logs by only their message, you may use the `--message` option:

```bash
php artisan pail --message="User created"
```

<a name="pail-filtering-logs-level-option"></a>
#### `--level`

The `--level` option may be used to filter logs by their [log level](#log-levels):

```bash
php artisan pail --level=error
```

<a name="pail-filtering-logs-user-option"></a>
#### `--user`

To only display logs that were written while a given user was authenticated, you may provide the user's ID to the `--user` option:

```bash
php artisan pail --user=1
```
24 changes: 22 additions & 2 deletions original-en/queues.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [Job Batching](#job-batching)
- [Defining Batchable Jobs](#defining-batchable-jobs)
- [Dispatching Batches](#dispatching-batches)
- [Chains & Batches](#chains-and-batches)
- [Adding Jobs To Batches](#adding-jobs-to-batches)
- [Inspecting Batches](#inspecting-batches)
- [Cancelling Batches](#cancelling-batches)
Expand Down Expand Up @@ -1288,8 +1289,8 @@ If you would like to specify the connection and queue that should be used for th
// All jobs completed successfully...
})->onConnection('redis')->onQueue('imports')->dispatch();

<a name="chains-within-batches"></a>
#### Chains Within Batches
<a name="chains-and-batches"></a>
### Chains & Batches

You may define a set of [chained jobs](#job-chaining) within a batch by placing the chained jobs within an array. For example, we may execute two job chains in parallel and execute a callback when both job chains have finished processing:

Expand All @@ -1311,6 +1312,25 @@ You may define a set of [chained jobs](#job-chaining) within a batch by placing
// ...
})->dispatch();

Conversely, you may run batches of jobs within a [chain](#job-chaining) by defining batches within the chain. For example, you could first run a batch of jobs to release multiple podcasts then a batch of jobs to send the release notifications:

use App\Jobs\FlushPodcastCache;
use App\Jobs\ReleasePodcast;
use App\Jobs\SendPodcastReleaseNotification;
use Illuminate\Support\Facades\Bus;

Bus::chain([
new FlushPodcastCache,
Bus::batch([
new ReleasePodcast(1),
new ReleasePodcast(2),
]),
Bus::batch([
new SendPodcastReleaseNotification(1),
new SendPodcastReleaseNotification(2),
]),
])->dispatch();

<a name="adding-jobs-to-batches"></a>
### Adding Jobs To Batches

Expand Down
2 changes: 1 addition & 1 deletion translation-ja/artisan.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ Laravelが必要な引数をユーザーから収集する必要がある場合
label: 'Search for a user:',
placeholder: 'E.g. Taylor Otwell',
options: fn ($value) => strlen($value) > 0
? User::where('name', 'like', "%{$value}%")->pluck('name', 'id')
? User::where('name', 'like', "%{$value}%")->pluck('name', 'id')->all()
: []
),
];
Expand Down
2 changes: 1 addition & 1 deletion translation-ja/eloquent.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ Eloquentモデルの主キーへ、自動増分整数を使用する代わりに

$article->id; // "8f8e8478-9035-4d23-b9a7-62f4d2612ce5"

`HasUuids`トレイトはデフォルトで、モデルに対し[順序付き(ordered)UUID](/docs/{{version}}/helpers#method-str-ordered-uuid)を生成します。これらのUUIDは辞書式にソートすることができるため、インデックス付きデータベースの保存が効率的です。
`HasUuids`トレイトはデフォルトで、モデルに対し[順序付き(ordered)UUID](/docs/{{version}}/strings#method-str-ordered-uuid)を生成します。これらのUUIDは辞書式にソートすることができるため、インデックス付きデータベースの保存が効率的です。

モデルへ`newUniqueId`メソッドを定義すれば、指定モデルのUUID生成処理をオーバーライドできます。さらに、モデルに`uniqueIds`メソッドを定義すれば、UUIDをどのカラムで受け取るのかを指定できます。

Expand Down
2 changes: 1 addition & 1 deletion translation-ja/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ php artisan make:listener SendPodcastNotification --event=PodcastProcessed
{
Event::listen(
PodcastProcessed::class,
[SendPodcastNotification::class, 'handle']
SendPodcastNotification::class,
);

Event::listen(function (PodcastProcessed $event) {
Expand Down
10 changes: 3 additions & 7 deletions translation-ja/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,7 @@ Laravelの設定オプションの値の多くは、アプリケーションが

Laravelアプリケーションを作成したら、データをデータベースへ保存したいと思うことでしょう。アプリケーションの`.env`設定ファイルはデフォルトで、MySQLデータベースを操作するように指定し、`127.0.0.1`のデータベースへアクセスするようになっています。macOSで開発しており、MySQL、Postgres、Redisをローカルにインストールする必要がある場合、[DBngin](https://dbngin.com/)を利用すると便利です。

ローカルマシンにMySQLやPostgresをインストールしたくない場合は、いつでも[SQLite](https://www.sqlite.org/index.html)データベースを使用できます。SQLiteは小さく、高速で、自己完結型のデータベースエンジンです。使用し始めるには、空のSQLiteファイルを作成することにより、SQLiteデータベースを作成します。通常、このファイルはLaravelアプリケーションの`database`ディレクトリの中に設置します。

```shell
touch database/database.sqlite
```

次に、Laravelが`sqlite`データベースドライバを使用するよう、`.env`設定ファイルを変更します。他のデータベース設定オプションは削除してかまいません。
ローカルマシンにMySQLやPostgresをインストールしたくない場合は、いつでも[SQLite](https://www.sqlite.org/index.html)データベースを使うことができます。SQLiteは小さく、高速で、自己完結型のデータベースエンジンです。使い始めるには、Laravelの`sqlite`データベースドライバを使用するように、`.env`設定ファイルを更新してください。他のデータベース設定オプションは削除してもかまいません:

```ini
DB_CONNECTION=sqlite # [tl! add]
Expand All @@ -254,6 +248,8 @@ SQLiteデータベースの設定が終わったら、[データベースマイ
php artisan migrate
```

アプリケーションにSQLiteデータベースが存在しない場合、Laravelはデータベースを作成するかを尋ねます。通常、SQLiteデータベースファイルは、`database/database.sqlite`へ作成します。

<a name="directory-configuration"></a>
### ディレクトリ設定

Expand Down
Loading

0 comments on commit 402cf10

Please sign in to comment.