diff --git a/po/zh_TW/artisan.po b/po/zh_TW/artisan.po index 02f43d972..7290970ba 100644 --- a/po/zh_TW/artisan.po +++ b/po/zh_TW/artisan.po @@ -10,249 +10,645 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" - -#: docs/10.x/artisan.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H1 +#: ./docs/8.x/artisan.md:1 +#: ./docs/9.x/artisan.md:1 +#: ./docs/10.x/artisan.md:1 +#: ./docs/11.x/artisan.md:1 +#: ./docs/master/artisan.md:1 msgid "Artisan Console" -msgstr "Artisan 主控台" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:3 +#: ./docs/9.x/artisan.md:3 +#: ./docs/10.x/artisan.md:3 +#: ./docs/11.x/artisan.md:3 +#: ./docs/master/artisan.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:4 +#: ./docs/9.x/artisan.md:4 +#: ./docs/10.x/artisan.md:4 +#: ./docs/11.x/artisan.md:4 +#: ./docs/master/artisan.md:4 msgid "[Tinker (REPL)](#tinker)" -msgstr "[Tinker (REPL)](#tinker)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:5 +#: ./docs/9.x/artisan.md:5 +#: ./docs/10.x/artisan.md:5 +#: ./docs/11.x/artisan.md:5 +#: ./docs/master/artisan.md:5 msgid "[Writing Commands](#writing-commands)" -msgstr "[撰寫指令](#writing-commands)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:6 +#: ./docs/9.x/artisan.md:6 +#: ./docs/10.x/artisan.md:6 +#: ./docs/11.x/artisan.md:6 +#: ./docs/master/artisan.md:6 msgid "[Generating Commands](#generating-commands)" -msgstr "[產生指令](#generating-commands)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:7 +#: ./docs/9.x/artisan.md:7 +#: ./docs/10.x/artisan.md:7 +#: ./docs/11.x/artisan.md:7 +#: ./docs/master/artisan.md:7 msgid "[Command Structure](#command-structure)" -msgstr "[指令結構](#command-structure)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:8 +#: ./docs/9.x/artisan.md:8 +#: ./docs/10.x/artisan.md:8 +#: ./docs/11.x/artisan.md:8 +#: ./docs/master/artisan.md:8 msgid "[Closure Commands](#closure-commands)" -msgstr "[閉包指令](#closure-commands)" - -#: docs/10.x/artisan.md:block 2 (unordered list) -msgid "[Isolatable Commands](#isolatable-commands)" -msgstr "[可隔離的指令](#isolatable-commands)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:9 +#: ./docs/9.x/artisan.md:10 +#: ./docs/10.x/artisan.md:10 +#: ./docs/11.x/artisan.md:10 +#: ./docs/master/artisan.md:10 msgid "[Defining Input Expectations](#defining-input-expectations)" -msgstr "[定義預期的輸入](#defining-input-expectations)" +msgstr "" + +# P +#: ./docs/9.x/artisan.md:9 +#: ./docs/10.x/artisan.md:9 +#: ./docs/11.x/artisan.md:9 +#: ./docs/master/artisan.md:9 +msgid "[Isolatable Commands](#isolatable-commands)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:10 +#: ./docs/9.x/artisan.md:11 +#: ./docs/10.x/artisan.md:11 +#: ./docs/11.x/artisan.md:11 +#: ./docs/master/artisan.md:11 msgid "[Arguments](#arguments)" -msgstr "[引數](#arguments)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:11 +#: ./docs/9.x/artisan.md:12 +#: ./docs/10.x/artisan.md:12 +#: ./docs/11.x/artisan.md:12 +#: ./docs/master/artisan.md:12 msgid "[Options](#options)" -msgstr "[選項](#options)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:12 +#: ./docs/9.x/artisan.md:13 +#: ./docs/10.x/artisan.md:13 +#: ./docs/11.x/artisan.md:13 +#: ./docs/master/artisan.md:13 msgid "[Input Arrays](#input-arrays)" -msgstr "[輸入陣列](#input-arrays)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:13 +#: ./docs/9.x/artisan.md:14 +#: ./docs/10.x/artisan.md:14 +#: ./docs/11.x/artisan.md:14 +#: ./docs/master/artisan.md:14 msgid "[Input Descriptions](#input-descriptions)" -msgstr "[輸入說明](#input-descriptions)" - -#: docs/10.x/artisan.md:block 2 (unordered list) -msgid "[Prompting For Missing Input](#prompting-for-missing-input)" -msgstr "[為未提供的輸入進行提示](#prompting-for-missing-input)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:14 +#: ./docs/9.x/artisan.md:15 +#: ./docs/10.x/artisan.md:16 +#: ./docs/11.x/artisan.md:16 +#: ./docs/master/artisan.md:16 msgid "[Command I/O](#command-io)" -msgstr "[指令 I/O](#command-io)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/10.x/artisan.md:15 +#: ./docs/11.x/artisan.md:15 +#: ./docs/master/artisan.md:15 +msgid "[Prompting for Missing Input](#prompting-for-missing-input)" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:15 +#: ./docs/9.x/artisan.md:16 +#: ./docs/10.x/artisan.md:17 +#: ./docs/11.x/artisan.md:17 +#: ./docs/master/artisan.md:17 msgid "[Retrieving Input](#retrieving-input)" -msgstr "[取得輸入](#retrieving-input)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:16 +#: ./docs/9.x/artisan.md:17 msgid "[Prompting For Input](#prompting-for-input)" -msgstr "[為輸入進行提示](#prompting-for-input)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:17 +#: ./docs/9.x/artisan.md:18 +#: ./docs/10.x/artisan.md:19 +#: ./docs/11.x/artisan.md:19 +#: ./docs/master/artisan.md:19 msgid "[Writing Output](#writing-output)" -msgstr "[撰寫輸出](#writing-output)" +msgstr "" + +# P +#: ./docs/10.x/artisan.md:18 +#: ./docs/11.x/artisan.md:18 +#: ./docs/master/artisan.md:18 +msgid "[Prompting for Input](#prompting-for-input)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:18 +#: ./docs/9.x/artisan.md:19 +#: ./docs/10.x/artisan.md:20 +#: ./docs/11.x/artisan.md:20 +#: ./docs/master/artisan.md:20 msgid "[Registering Commands](#registering-commands)" -msgstr "[註冊指令](#registering-commands)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:19 +#: ./docs/9.x/artisan.md:20 +#: ./docs/10.x/artisan.md:21 +#: ./docs/11.x/artisan.md:21 +#: ./docs/master/artisan.md:21 msgid "[Programmatically Executing Commands](#programmatically-executing-commands)" -msgstr "[使用程式碼呼叫指令](#programmatically-executing-commands)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:20 +#: ./docs/9.x/artisan.md:21 +#: ./docs/10.x/artisan.md:22 +#: ./docs/11.x/artisan.md:22 +#: ./docs/master/artisan.md:22 msgid "[Calling Commands From Other Commands](#calling-commands-from-other-commands)" -msgstr "[自其他指令內呼叫指令](#calling-commands-from-other-commands)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:21 +#: ./docs/9.x/artisan.md:22 +#: ./docs/10.x/artisan.md:23 +#: ./docs/11.x/artisan.md:23 +#: ./docs/master/artisan.md:23 msgid "[Signal Handling](#signal-handling)" -msgstr "[處理訊號 (Signal)](#signal-handling)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:22 +#: ./docs/9.x/artisan.md:23 +#: ./docs/10.x/artisan.md:24 +#: ./docs/11.x/artisan.md:24 +#: ./docs/master/artisan.md:24 msgid "[Stub Customization](#stub-customization)" -msgstr "[自訂 Stub](#stub-customization)" +msgstr "" -#: docs/10.x/artisan.md:block 2 (unordered list) +# P +#: ./docs/8.x/artisan.md:23 +#: ./docs/9.x/artisan.md:24 +#: ./docs/10.x/artisan.md:25 +#: ./docs/11.x/artisan.md:25 +#: ./docs/master/artisan.md:25 msgid "[Events](#events)" -msgstr "[事件](#events)" +msgstr "" -#: docs/10.x/artisan.md:block 4 (header) +# P +#: ./docs/8.x/artisan.md:25 +#: ./docs/9.x/artisan.md:26 +#: ./docs/10.x/artisan.md:27 +#: ./docs/11.x/artisan.md:27 +#: ./docs/master/artisan.md:27 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/artisan.md:26 +#: ./docs/9.x/artisan.md:27 +#: ./docs/10.x/artisan.md:28 +#: ./docs/11.x/artisan.md:28 +#: ./docs/master/artisan.md:28 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/artisan.md:block 5 (paragraph) +# P +#: ./docs/8.x/artisan.md:28 +#: ./docs/9.x/artisan.md:29 +#: ./docs/10.x/artisan.md:30 +#: ./docs/11.x/artisan.md:30 +#: ./docs/master/artisan.md:30 msgid "Artisan is the command line interface included with Laravel. Artisan exists at the root of your application as the `artisan` script and provides a number of helpful commands that can assist you while you build your application. To view a list of all available Artisan commands, you may use the `list` command:" -msgstr "Artisan 是 Laravel 內所包含的指令列界面。Artisan 是放在專案根目錄的 `artisan` 工序指令,提供多種實用指令來幫你撰寫你的專案。若要檢視所有可用的 Artisan 指令,可以使用 `list` 指令:" +msgstr "" -#: docs/10.x/artisan.md:block 6 (code) -msgid "php artisan list\n" -msgstr "php artisan list\n" +# CODE +# CODE: shell +#: ./docs/8.x/artisan.md:30 +#: ./docs/9.x/artisan.md:31 +#: ./docs/10.x/artisan.md:32 +#: ./docs/11.x/artisan.md:32 +#: ./docs/master/artisan.md:32 +msgid "php artisan list" +msgstr "" -#: docs/10.x/artisan.md:block 7 (paragraph) +# P +#: ./docs/8.x/artisan.md:32 +#: ./docs/9.x/artisan.md:35 +#: ./docs/10.x/artisan.md:36 +#: ./docs/11.x/artisan.md:36 +#: ./docs/master/artisan.md:36 msgid "Every command also includes a \"help\" screen which displays and describes the command's available arguments and options. To view a help screen, precede the name of the command with `help`:" -msgstr "每個指令也包含了一個「help」畫面,用於顯示指令的說明以及可用的引數與選項。若要檢視輔助說明畫面,請在指令名稱的前面加上 `help`:" +msgstr "" -#: docs/10.x/artisan.md:block 8 (code) -msgid "php artisan help migrate\n" -msgstr "php artisan help migrate\n" +# CODE +# CODE: shell +#: ./docs/8.x/artisan.md:34 +#: ./docs/9.x/artisan.md:37 +#: ./docs/10.x/artisan.md:38 +#: ./docs/11.x/artisan.md:38 +#: ./docs/master/artisan.md:38 +msgid "php artisan help migrate" +msgstr "" -#: docs/10.x/artisan.md:block 10 (header) +# P +#: ./docs/8.x/artisan.md:36 +#: ./docs/9.x/artisan.md:41 +#: ./docs/10.x/artisan.md:42 +#: ./docs/11.x/artisan.md:42 +#: ./docs/master/artisan.md:42 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:37 +#: ./docs/9.x/artisan.md:42 +#: ./docs/10.x/artisan.md:43 +#: ./docs/11.x/artisan.md:43 +#: ./docs/master/artisan.md:43 msgid "Laravel Sail" -msgstr "Laravel Sail" +msgstr "" -#: docs/10.x/artisan.md:block 11 (paragraph) +# P +#: ./docs/8.x/artisan.md:39 +#: ./docs/9.x/artisan.md:44 +#: ./docs/10.x/artisan.md:45 +#: ./docs/11.x/artisan.md:45 +#: ./docs/master/artisan.md:45 msgid "If you are using [Laravel Sail](/docs/{{version}}/sail) as your local development environment, remember to use the `sail` command line to invoke Artisan commands. Sail will execute your Artisan commands within your application's Docker containers:" -msgstr "若使用 [Laravel Sail](/docs/{{version}}/sail) 作為本機開發環境,請記得使用 `sail` 指令列來叫用 Artisan 指令。Sail 會在專案的 Docker 容器內執行 Artisan 指令。" +msgstr "" -#: docs/10.x/artisan.md:block 12 (code) -msgid "./vendor/bin/sail artisan list\n" -msgstr "./vendor/bin/sail artisan list\n" +# CODE +#: ./docs/8.x/artisan.md:41 +msgid "./sail artisan list" +msgstr "" -#: docs/10.x/artisan.md:block 14 (header) +# P +#: ./docs/8.x/artisan.md:43 +#: ./docs/9.x/artisan.md:50 +#: ./docs/10.x/artisan.md:51 +#: ./docs/11.x/artisan.md:51 +#: ./docs/master/artisan.md:51 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/artisan.md:44 +#: ./docs/9.x/artisan.md:51 +#: ./docs/10.x/artisan.md:52 +#: ./docs/11.x/artisan.md:52 +#: ./docs/master/artisan.md:52 msgid "Tinker (REPL)" -msgstr "Tinker (REPL)" +msgstr "" -#: docs/10.x/artisan.md:block 15 (paragraph) +# P +#: ./docs/8.x/artisan.md:46 +#: ./docs/9.x/artisan.md:53 +#: ./docs/10.x/artisan.md:54 +#: ./docs/11.x/artisan.md:54 +#: ./docs/master/artisan.md:54 msgid "Laravel Tinker is a powerful REPL for the Laravel framework, powered by the [PsySH](https://github.com/bobthecow/psysh) package." -msgstr "Laravel Tinker 是用於 Laravel 框架的強大 REPL,由 [PsySH](https://github.com/bobthecow/psysh) 套件提供。" +msgstr "" + +# CODE: shell +#: ./docs/9.x/artisan.md:46 +#: ./docs/10.x/artisan.md:47 +#: ./docs/11.x/artisan.md:47 +#: ./docs/master/artisan.md:47 +msgid "./vendor/bin/sail artisan list" +msgstr "" -#: docs/10.x/artisan.md:block 17 (header) +# P +#: ./docs/8.x/artisan.md:48 +#: ./docs/9.x/artisan.md:55 +#: ./docs/10.x/artisan.md:56 +#: ./docs/11.x/artisan.md:56 +#: ./docs/master/artisan.md:56 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:49 +#: ./docs/9.x/artisan.md:56 +#: ./docs/10.x/artisan.md:57 +#: ./docs/11.x/artisan.md:57 +#: ./docs/master/artisan.md:57 msgid "Installation" -msgstr "安裝" +msgstr "" -#: docs/10.x/artisan.md:block 18 (paragraph) +# P +#: ./docs/8.x/artisan.md:51 +#: ./docs/9.x/artisan.md:58 +#: ./docs/10.x/artisan.md:59 +#: ./docs/11.x/artisan.md:59 +#: ./docs/master/artisan.md:59 msgid "All Laravel applications include Tinker by default. However, you may install Tinker using Composer if you have previously removed it from your application:" -msgstr "所有的 Laravel 專案預設都包含了 Tinker。但若先前曾自專案內移除 Tinker,則可使用 Composer 來安裝:" +msgstr "" -#: docs/10.x/artisan.md:block 19 (code) -msgid "composer require laravel/tinker\n" -msgstr "composer require laravel/tinker\n" +# CODE +# CODE: shell +#: ./docs/8.x/artisan.md:53 +#: ./docs/9.x/artisan.md:60 +#: ./docs/10.x/artisan.md:61 +#: ./docs/11.x/artisan.md:61 +#: ./docs/master/artisan.md:61 +msgid "composer require laravel/tinker" +msgstr "" -#: docs/10.x/artisan.md:block 20 (quote) -msgid "**Note** Looking for a graphical UI for interacting with your Laravel application? Check out [Tinkerwell](https://tinkerwell.app)!" -msgstr "**Note** 想找個能與你的 Laravel 應用程式互動的圖形化 UI 嗎?試試 [Tinkerwell](https://tinkerwell.app) 吧!" +# P +#: ./docs/8.x/artisan.md:55 +#: ./docs/9.x/artisan.md:65 +msgid "Looking for a graphical UI for interacting with your Laravel application? Check out [Tinkerwell](https://tinkerwell.app)!" +msgstr "" -#: docs/10.x/artisan.md:block 22 (header) +# P +#: ./docs/8.x/artisan.md:57 +#: ./docs/9.x/artisan.md:67 +#: ./docs/10.x/artisan.md:68 +#: ./docs/11.x/artisan.md:68 +#: ./docs/master/artisan.md:68 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:58 +#: ./docs/9.x/artisan.md:68 +#: ./docs/10.x/artisan.md:69 +#: ./docs/11.x/artisan.md:69 +#: ./docs/master/artisan.md:69 msgid "Usage" -msgstr "使用" +msgstr "" -#: docs/10.x/artisan.md:block 23 (paragraph) +# P +#: ./docs/8.x/artisan.md:60 +#: ./docs/9.x/artisan.md:70 +#: ./docs/10.x/artisan.md:71 +#: ./docs/11.x/artisan.md:71 +#: ./docs/master/artisan.md:71 msgid "Tinker allows you to interact with your entire Laravel application on the command line, including your Eloquent models, jobs, events, and more. To enter the Tinker environment, run the `tinker` Artisan command:" -msgstr "Tinker 可讓你在指令列內與完整的 Laravel 專案進行互動,包含 Eloquent Model、任務、事件…等。要進入 Tinker 環境,請執行 `tinker` Artisan 指令:" +msgstr "" -#: docs/10.x/artisan.md:block 24 (code) -msgid "php artisan tinker\n" -msgstr "php artisan tinker\n" +# CODE +# CODE: shell +#: ./docs/8.x/artisan.md:62 +#: ./docs/9.x/artisan.md:72 +#: ./docs/10.x/artisan.md:73 +#: ./docs/11.x/artisan.md:73 +#: ./docs/master/artisan.md:73 +msgid "php artisan tinker" +msgstr "" -#: docs/10.x/artisan.md:block 25 (paragraph) +# P +#: ./docs/8.x/artisan.md:64 +#: ./docs/9.x/artisan.md:76 +#: ./docs/10.x/artisan.md:77 +#: ./docs/11.x/artisan.md:77 +#: ./docs/master/artisan.md:77 msgid "You can publish Tinker's configuration file using the `vendor:publish` command:" -msgstr "可以通過 `vendor:publish` 指令來安裝 Tinker 的設定檔:" +msgstr "" + +# P +#: ./docs/10.x/artisan.md:66 +#: ./docs/11.x/artisan.md:66 +#: ./docs/master/artisan.md:66 +msgid "Looking for hot reloading, multiline code editing, and autocompletion when interacting with your Laravel application? Check out [Tinkerwell](https://tinkerwell.app)!" +msgstr "" -#: docs/10.x/artisan.md:block 26 (code) -msgid "php artisan vendor:publish --provider=\"Laravel\\Tinker\\TinkerServiceProvider\"\n" -msgstr "php artisan vendor:publish --provider=\"Laravel\\Tinker\\TinkerServiceProvider\"\n" +# CODE +# CODE: shell +#: ./docs/8.x/artisan.md:66 +#: ./docs/9.x/artisan.md:78 +#: ./docs/10.x/artisan.md:79 +#: ./docs/11.x/artisan.md:79 +#: ./docs/master/artisan.md:79 +msgid "php artisan vendor:publish --provider=\"Laravel\\Tinker\\TinkerServiceProvider\"" +msgstr "" -#: docs/10.x/artisan.md:block 27 (quote) -msgid "**Warning** The `dispatch` helper function and `dispatch` method on the `Dispatchable` class depends on garbage collection to place the job on the queue. Therefore, when using tinker, you should use `Bus::dispatch` or `Queue::push` to dispatch jobs." -msgstr "**Warning** `dispatch` 輔助函式與 `Dispatchable` 類別上的 `dispatch` 方法需要仰賴垃圾回收機制來將任務放進佇列中。因此,在使用 Tinker 時,應使用 `Bus::dispatch` 或 `Queue::push` 來分派任務。" +# P +#: ./docs/8.x/artisan.md:68 +#: ./docs/9.x/artisan.md:83 +#: ./docs/10.x/artisan.md:84 +#: ./docs/11.x/artisan.md:84 +#: ./docs/master/artisan.md:84 +msgid "The `dispatch` helper function and `dispatch` method on the `Dispatchable` class depends on garbage collection to place the job on the queue. Therefore, when using tinker, you should use `Bus::dispatch` or `Queue::push` to dispatch jobs." +msgstr "" -#: docs/10.x/artisan.md:block 29 (header) +# P +#: ./docs/8.x/artisan.md:70 +#: ./docs/9.x/artisan.md:85 +#: ./docs/10.x/artisan.md:86 +#: ./docs/11.x/artisan.md:86 +#: ./docs/master/artisan.md:86 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:71 +#: ./docs/9.x/artisan.md:86 +#: ./docs/10.x/artisan.md:87 +#: ./docs/11.x/artisan.md:87 +#: ./docs/master/artisan.md:87 msgid "Command Allow List" -msgstr "指令允許列表" +msgstr "" -#: docs/10.x/artisan.md:block 30 (paragraph) +# P +#: ./docs/8.x/artisan.md:73 +#: ./docs/9.x/artisan.md:88 +#: ./docs/10.x/artisan.md:89 +#: ./docs/master/artisan.md:89 msgid "Tinker utilizes an \"allow\" list to determine which Artisan commands are allowed to be run within its shell. By default, you may run the `clear-compiled`, `down`, `env`, `inspire`, `migrate`, `optimize`, and `up` commands. If you would like to allow more commands you may add them to the `commands` array in your `tinker.php` configuration file:" -msgstr "Tinker 使用一個「allow」清單來判斷哪些 Artisan 指令可在其 Shell 內執行。預設情況下,可以執行 `clear-compiled`, `down`, `env`, `inspire`, `migrate`, `optimize` 以及 `up` 指令。若想允許更多指令,可以將要允許的指令加在 `tinker.php` 設定檔中的 `commands` 陣列內:" +msgstr "" -#: docs/10.x/artisan.md:block 31 (code) +# CODE +#: ./docs/8.x/artisan.md:75 +#: ./docs/9.x/artisan.md:90 +#: ./docs/10.x/artisan.md:91 +#: ./docs/11.x/artisan.md:91 +#: ./docs/master/artisan.md:91 msgid "'commands' => [\n" " // App\\Console\\Commands\\ExampleCommand::class,\n" -"],\n" -msgstr "'commands' => [\n" -" // App\\Console\\Commands\\ExampleCommand::class,\n" -"],\n" +"]," +msgstr "" -#: docs/10.x/artisan.md:block 33 (header) +# P +#: ./docs/8.x/artisan.md:79 +#: ./docs/9.x/artisan.md:94 +#: ./docs/10.x/artisan.md:95 +#: ./docs/11.x/artisan.md:95 +#: ./docs/master/artisan.md:95 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:80 +#: ./docs/9.x/artisan.md:95 +#: ./docs/10.x/artisan.md:96 +#: ./docs/11.x/artisan.md:96 +#: ./docs/master/artisan.md:96 msgid "Classes That Should Not Be Aliased" -msgstr "不應以別名使用的類別" +msgstr "" -#: docs/10.x/artisan.md:block 34 (paragraph) +# P +#: ./docs/8.x/artisan.md:82 +#: ./docs/9.x/artisan.md:97 +#: ./docs/10.x/artisan.md:98 +#: ./docs/11.x/artisan.md:98 +#: ./docs/master/artisan.md:98 msgid "Typically, Tinker automatically aliases classes as you interact with them in Tinker. However, you may wish to never alias some classes. You may accomplish this by listing the classes in the `dont_alias` array of your `tinker.php` configuration file:" -msgstr "一般來說,Tinker 會在使用過程中自動為類別加上別名。但有些類別可能不希望被設定別名。可以通過在 `tinker.php` 設定檔中的 `dont_alias` 陣列中列出這些不想被自動別名的類別來達成:" +msgstr "" -#: docs/10.x/artisan.md:block 35 (code) +# CODE +#: ./docs/8.x/artisan.md:84 +#: ./docs/9.x/artisan.md:99 +#: ./docs/10.x/artisan.md:100 +#: ./docs/11.x/artisan.md:100 +#: ./docs/master/artisan.md:100 msgid "'dont_alias' => [\n" " App\\Models\\User::class,\n" -"],\n" -msgstr "'dont_alias' => [\n" -" App\\Models\\User::class,\n" -"],\n" +"]," +msgstr "" + +# P +#: ./docs/8.x/artisan.md:88 +#: ./docs/9.x/artisan.md:103 +#: ./docs/10.x/artisan.md:104 +#: ./docs/11.x/artisan.md:104 +#: ./docs/master/artisan.md:104 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/11.x/artisan.md:89 +msgid "Tinker utilizes an \"allow\" list to determine which Artisan commands are allowed to be run within its shell. By default, you may run the `clear-compiled`, `down`, `env`, `inspire`, `migrate`, `migrate:install`, `up`, and `optimize` commands. If you would like to allow more commands you may add them to the `commands` array in your `tinker.php` configuration file:" +msgstr "" -#: docs/10.x/artisan.md:block 37 (header) +# H2 +#: ./docs/8.x/artisan.md:89 +#: ./docs/9.x/artisan.md:104 +#: ./docs/10.x/artisan.md:105 +#: ./docs/11.x/artisan.md:105 +#: ./docs/master/artisan.md:105 msgid "Writing Commands" -msgstr "撰寫指令" +msgstr "" -#: docs/10.x/artisan.md:block 38 (paragraph) +# P +#: ./docs/8.x/artisan.md:91 +#: ./docs/9.x/artisan.md:106 +#: ./docs/10.x/artisan.md:107 +#: ./docs/11.x/artisan.md:107 +#: ./docs/master/artisan.md:107 msgid "In addition to the commands provided with Artisan, you may build your own custom commands. Commands are typically stored in the `app/Console/Commands` directory; however, you are free to choose your own storage location as long as your commands can be loaded by Composer." -msgstr "除了 Artisan 提供的指令外,也可以建制自己的自訂指令。指令通常儲存於 `app/Console/Commands` 目錄內。但是,只要你的自訂指令可以被 Composer 載入,也可以自行選擇儲存位置。" +msgstr "" -#: docs/10.x/artisan.md:block 40 (header) +# P +#: ./docs/8.x/artisan.md:93 +#: ./docs/9.x/artisan.md:108 +#: ./docs/10.x/artisan.md:109 +#: ./docs/11.x/artisan.md:109 +#: ./docs/master/artisan.md:109 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/artisan.md:94 +#: ./docs/9.x/artisan.md:109 +#: ./docs/10.x/artisan.md:110 +#: ./docs/11.x/artisan.md:110 +#: ./docs/master/artisan.md:110 msgid "Generating Commands" -msgstr "產生指令" +msgstr "" -#: docs/10.x/artisan.md:block 41 (paragraph) +# P +#: ./docs/8.x/artisan.md:96 +#: ./docs/9.x/artisan.md:111 +#: ./docs/10.x/artisan.md:112 +#: ./docs/11.x/artisan.md:112 +#: ./docs/master/artisan.md:112 msgid "To create a new command, you may use the `make:command` Artisan command. This command will create a new command class in the `app/Console/Commands` directory. Don't worry if this directory does not exist in your application - it will be created the first time you run the `make:command` Artisan command:" -msgstr "若要建立新指令,可以使用 `make:command` Artisan 指令。該指令會在 `app/Console/Commands` 目錄下建立一個新的指令類別。若你的專案中沒有這個資料夾,請別擔心——第一次執行 `make:command` Artisan 指令的時候會自動建立該資料夾:" +msgstr "" -#: docs/10.x/artisan.md:block 42 (code) -msgid "php artisan make:command SendEmails\n" -msgstr "php artisan make:command SendEmails\n" +# CODE +# CODE: shell +#: ./docs/8.x/artisan.md:98 +#: ./docs/9.x/artisan.md:113 +#: ./docs/10.x/artisan.md:114 +#: ./docs/11.x/artisan.md:114 +#: ./docs/master/artisan.md:114 +msgid "php artisan make:command SendEmails" +msgstr "" -#: docs/10.x/artisan.md:block 44 (header) +# P +#: ./docs/8.x/artisan.md:100 +#: ./docs/9.x/artisan.md:117 +#: ./docs/10.x/artisan.md:118 +#: ./docs/11.x/artisan.md:118 +#: ./docs/master/artisan.md:118 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/artisan.md:101 +#: ./docs/9.x/artisan.md:118 +#: ./docs/10.x/artisan.md:119 +#: ./docs/11.x/artisan.md:119 +#: ./docs/master/artisan.md:119 msgid "Command Structure" -msgstr "指令結構" +msgstr "" -#: docs/10.x/artisan.md:block 45 (paragraph) +# P +#: ./docs/8.x/artisan.md:103 +#: ./docs/9.x/artisan.md:120 +#: ./docs/10.x/artisan.md:121 +#: ./docs/11.x/artisan.md:121 +#: ./docs/master/artisan.md:121 msgid "After generating your command, you should define appropriate values for the `signature` and `description` properties of the class. These properties will be used when displaying your command on the `list` screen. The `signature` property also allows you to define [your command's input expectations](#defining-input-expectations). The `handle` method will be called when your command is executed. You may place your command logic in this method." -msgstr "產生指令後,應為類別的 `signature` 與 `description` 屬性定義適當的值。當在 `list` 畫面內顯示該指令時,就會用到這些屬性。`signature` 屬性可以用來定義 [指令預期的輸入](#defining-input-expectations)。`handle` 方法會在執行該指令時呼叫。可以將指令的邏輯放在該方法內。" +msgstr "" -#: docs/10.x/artisan.md:block 46 (paragraph) +# P +#: ./docs/8.x/artisan.md:105 +#: ./docs/9.x/artisan.md:122 +#: ./docs/10.x/artisan.md:123 +#: ./docs/11.x/artisan.md:123 +#: ./docs/master/artisan.md:123 msgid "Let's take a look at an example command. Note that we are able to request any dependencies we need via the command's `handle` method. The Laravel [service container](/docs/{{version}}/container) will automatically inject all dependencies that are type-hinted in this method's signature:" -msgstr "來看看一個範例指令。請注意,我們可以通過指令的 `handle` 方法來要求任意的相依性。Laravel 的 [Service Container](/docs/{{version}}/container) 會自動插入所有在方法簽章內有型別提示的相依性。" +msgstr "" -#: docs/10.x/artisan.md:block 47 (code) +# CODE +#: ./docs/8.x/artisan.md:107 msgid "send(User::find($this->argument('user')));\n" +" }\n" +"}" +msgstr "" + +# CODE +#: ./docs/9.x/artisan.md:124 +msgid "send(User::find($this->argument('user')));\n" " }\n" -"}\n" -msgstr "send(User::find($this->argument('user')));\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/artisan.md:block 48 (quote) -msgid "**Note** For greater code reuse, it is good practice to keep your console commands light and let them defer to application services to accomplish their tasks. In the example above, note that we inject a service class to do the \"heavy lifting\" of sending the e-mails." -msgstr "**Note** 為了提升程式碼重複使用率,最好保持主控台指令精簡,並將指令的任務委託給應用程式服務來完成。在上方的例子中,可以注意到我們插入了一個服務類別來處理寄送 E-Mail 的這個「重責大任」。" +# P +#: ./docs/8.x/artisan.md:153 +#: ./docs/9.x/artisan.md:161 +#: ./docs/10.x/artisan.md:159 +#: ./docs/11.x/artisan.md:159 +#: ./docs/master/artisan.md:159 +msgid "For greater code reuse, it is good practice to keep your console commands light and let them defer to application services to accomplish their tasks. In the example above, note that we inject a service class to do the \"heavy lifting\" of sending the e-mails." +msgstr "" -#: docs/10.x/artisan.md:block 50 (header) +# P +#: ./docs/8.x/artisan.md:155 +#: ./docs/9.x/artisan.md:163 +#: ./docs/10.x/artisan.md:161 +#: ./docs/11.x/artisan.md:174 +#: ./docs/master/artisan.md:161 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/artisan.md:156 +#: ./docs/9.x/artisan.md:164 +#: ./docs/10.x/artisan.md:162 +#: ./docs/11.x/artisan.md:175 +#: ./docs/master/artisan.md:162 msgid "Closure Commands" -msgstr "閉包指令" +msgstr "" -#: docs/10.x/artisan.md:block 51 (paragraph) +# P +#: ./docs/8.x/artisan.md:158 +#: ./docs/9.x/artisan.md:166 +#: ./docs/10.x/artisan.md:164 msgid "Closure based commands provide an alternative to defining console commands as classes. In the same way that route closures are an alternative to controllers, think of command closures as an alternative to command classes. Within the `commands` method of your `app/Console/Kernel.php` file, Laravel loads the `routes/console.php` file:" -msgstr "基於閉包的指令提供了以類別定義主控台指令外的另一個選擇。就如同使用閉包來定義路由可用來代替控制器一樣,可以將指令閉包想象成是指令類別的代替。在 `app/Console/Kernel.php` 檔中的 `commands` 方法內,Laravel 載入了 `routes/console.php` 檔:" +msgstr "" -#: docs/10.x/artisan.md:block 52 (code) +# CODE +#: ./docs/8.x/artisan.md:160 +#: ./docs/9.x/artisan.md:168 msgid "/**\n" " * Register the closure based commands for the application.\n" +" *\n" +" * @return void\n" " */\n" -"protected function commands(): void\n" +"protected function commands()\n" "{\n" " require base_path('routes/console.php');\n" -"}\n" -msgstr "/**\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/artisan.md:161 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/11.x/artisan.md:162 +msgid "Exit Codes" +msgstr "" + +# P +#: ./docs/11.x/artisan.md:164 +msgid "If nothing is returned from the `handle` method and the command executes successfully, the command will exit with a `0` exit code, indicating success. However, the `handle` method may optionally return an integer to manually specify command's exit code:" +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:166 +msgid "/**\n" " * Register the closure based commands for the application.\n" " */\n" "protected function commands(): void\n" "{\n" " require base_path('routes/console.php');\n" -"}\n" +"}" +msgstr "" + +# CODE +#: ./docs/11.x/artisan.md:166 +msgid "$this->error('Something went wrong.');\n\n" +"return 1;" +msgstr "" + +# P +#: ./docs/master/artisan.md:166 +msgid "Even though the `routes/console.php` file file does not define HTTP routes, it defines console based entry points (routes) into your application. Within this file, you may define all of your closure based console commands using the `Artisan::command` method. The `command` method accepts two arguments: the [command signature](#defining-input-expectations) and a closure which receives the command's arguments and options:" +msgstr "" -#: docs/10.x/artisan.md:block 53 (paragraph) +# P +#: ./docs/11.x/artisan.md:170 +msgid "If you would like to \"fail\" the command from any method within the command, you may utilize the `fail` method. The `fail` method will immediately terminate execution of the command and return an exit code of `1`:" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:170 +#: ./docs/9.x/artisan.md:178 +#: ./docs/10.x/artisan.md:174 msgid "Even though this file does not define HTTP routes, it defines console based entry points (routes) into your application. Within this file, you may define all of your closure based console commands using the `Artisan::command` method. The `command` method accepts two arguments: the [command signature](#defining-input-expectations) and a closure which receives the command's arguments and options:" -msgstr "這個檔案並沒有定義 HTTP 路由,而是定義從主控台「路由」進入專案的進入點。在該檔案內,可以通過 `Artisan::command` 方法來定義基於閉包的主控台指令。`command` 方法接受 2 個引數:[指令簽章](#defining-input-expectations),以及一個用來接收指令引數與選項的閉包:" +msgstr "" -#: docs/10.x/artisan.md:block 54 (code) -msgid "Artisan::command('mail:send {user}', function (string $user) {\n" +# CODE +#: ./docs/11.x/artisan.md:172 +msgid "$this->fail('Something went wrong.');" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:172 +#: ./docs/9.x/artisan.md:180 +msgid "Artisan::command('mail:send {user}', function ($user) {\n" " $this->info(\"Sending email to: {$user}!\");\n" -"});\n" -msgstr "Artisan::command('mail:send {user}', function (string $user) {\n" +"});" +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:176 +#: ./docs/11.x/artisan.md:181 +#: ./docs/master/artisan.md:168 +msgid "Artisan::command('mail:send {user}', function (string $user) {\n" " $this->info(\"Sending email to: {$user}!\");\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/artisan.md:block 55 (paragraph) +# P +#: ./docs/8.x/artisan.md:176 +#: ./docs/9.x/artisan.md:184 +#: ./docs/10.x/artisan.md:180 +#: ./docs/11.x/artisan.md:185 +#: ./docs/master/artisan.md:172 msgid "The closure is bound to the underlying command instance, so you have full access to all of the helper methods you would typically be able to access on a full command class." -msgstr "這裡的閉包有綁定到該指令的基礎類別執行個體,因此可以像在完整的指令類別內一樣存取所有的輔助函式。" +msgstr "" + +# P +#: ./docs/11.x/artisan.md:177 +#: ./docs/master/artisan.md:164 +msgid "Closure based commands provide an alternative to defining console commands as classes. In the same way that route closures are an alternative to controllers, think of command closures as an alternative to command classes." +msgstr "" + +# P +#: ./docs/8.x/artisan.md:178 +#: ./docs/9.x/artisan.md:186 +#: ./docs/10.x/artisan.md:182 +#: ./docs/11.x/artisan.md:187 +#: ./docs/master/artisan.md:174 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/11.x/artisan.md:179 +msgid "Even though the `routes/console.php` file does not define HTTP routes, it defines console based entry points (routes) into your application. Within this file, you may define all of your closure based console commands using the `Artisan::command` method. The `command` method accepts two arguments: the [command signature](#defining-input-expectations) and a closure which receives the command's arguments and options:" +msgstr "" -#: docs/10.x/artisan.md:block 57 (header) +# H4 +#: ./docs/8.x/artisan.md:179 +#: ./docs/9.x/artisan.md:187 +#: ./docs/10.x/artisan.md:183 +#: ./docs/11.x/artisan.md:188 +#: ./docs/master/artisan.md:175 msgid "Type-Hinting Dependencies" -msgstr "對相依關係進行型別提示" +msgstr "" -#: docs/10.x/artisan.md:block 58 (paragraph) +# P +#: ./docs/8.x/artisan.md:181 +#: ./docs/9.x/artisan.md:189 +#: ./docs/10.x/artisan.md:185 +#: ./docs/11.x/artisan.md:190 +#: ./docs/master/artisan.md:177 msgid "In addition to receiving your command's arguments and options, command closures may also type-hint additional dependencies that you would like resolved out of the [service container](/docs/{{version}}/container):" -msgstr "除了接收指令的引數與選項外,指令閉包也可以通過型別提示來向 [Service Container](/docs/{{version}}/container) 解析額外的相依關係。" +msgstr "" -#: docs/10.x/artisan.md:block 59 (code) +# CODE +#: ./docs/8.x/artisan.md:183 +#: ./docs/9.x/artisan.md:191 msgid "use App\\Models\\User;\n" "use App\\Support\\DripEmailer;\n\n" -"Artisan::command('mail:send {user}', function (DripEmailer $drip, string $user) {\n" +"Artisan::command('mail:send {user}', function (DripEmailer $drip, $user) {\n" " $drip->send(User::find($user));\n" -"});\n" -msgstr "use App\\Models\\User;\n" +"});" +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:187 +#: ./docs/11.x/artisan.md:192 +#: ./docs/master/artisan.md:179 +msgid "use App\\Models\\User;\n" "use App\\Support\\DripEmailer;\n\n" "Artisan::command('mail:send {user}', function (DripEmailer $drip, string $user) {\n" " $drip->send(User::find($user));\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/artisan.md:block 61 (header) +# P +#: ./docs/8.x/artisan.md:190 +#: ./docs/9.x/artisan.md:198 +#: ./docs/10.x/artisan.md:194 +#: ./docs/11.x/artisan.md:199 +#: ./docs/master/artisan.md:186 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:191 +#: ./docs/9.x/artisan.md:199 +#: ./docs/10.x/artisan.md:195 +#: ./docs/11.x/artisan.md:200 +#: ./docs/master/artisan.md:187 msgid "Closure Command Descriptions" -msgstr "閉包指令描述" +msgstr "" -#: docs/10.x/artisan.md:block 62 (paragraph) +# P +#: ./docs/8.x/artisan.md:193 +#: ./docs/9.x/artisan.md:201 +#: ./docs/10.x/artisan.md:197 +#: ./docs/11.x/artisan.md:202 +#: ./docs/master/artisan.md:189 msgid "When defining a closure based command, you may use the `purpose` method to add a description to the command. This description will be displayed when you run the `php artisan list` or `php artisan help` commands:" -msgstr "在定義基於閉包的指令時,可以使用 `purpose` 方法來為該指令加上描述。這段描述會在執行 `php artisan list` 或 `php artisan help` 指令時顯示:" +msgstr "" -#: docs/10.x/artisan.md:block 63 (code) -msgid "Artisan::command('mail:send {user}', function (string $user) {\n" +# CODE +#: ./docs/8.x/artisan.md:195 +#: ./docs/9.x/artisan.md:203 +msgid "Artisan::command('mail:send {user}', function ($user) {\n" " // ...\n" -"})->purpose('Send a marketing email to a user');\n" -msgstr "Artisan::command('mail:send {user}', function (string $user) {\n" +"})->purpose('Send a marketing email to a user');" +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:199 +#: ./docs/11.x/artisan.md:204 +#: ./docs/master/artisan.md:191 +msgid "Artisan::command('mail:send {user}', function (string $user) {\n" " // ...\n" -"})->purpose('Send a marketing email to a user');\n" +"})->purpose('Send a marketing email to a user');" +msgstr "" -#: docs/10.x/artisan.md:block 65 (header) +# P +#: ./docs/8.x/artisan.md:199 +#: ./docs/9.x/artisan.md:256 +#: ./docs/10.x/artisan.md:268 +#: ./docs/11.x/artisan.md:273 +#: ./docs/master/artisan.md:260 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/artisan.md:200 +#: ./docs/9.x/artisan.md:257 +#: ./docs/10.x/artisan.md:269 +#: ./docs/11.x/artisan.md:274 +#: ./docs/master/artisan.md:261 +msgid "Defining Input Expectations" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:202 +#: ./docs/9.x/artisan.md:259 +#: ./docs/10.x/artisan.md:271 +#: ./docs/11.x/artisan.md:276 +#: ./docs/master/artisan.md:263 +msgid "When writing console commands, it is common to gather input from the user through arguments or options. Laravel makes it very convenient to define the input you expect from the user using the `signature` property on your commands. The `signature` property allows you to define the name, arguments, and options for the command in a single, expressive, route-like syntax." +msgstr "" + +# P +#: ./docs/8.x/artisan.md:204 +#: ./docs/9.x/artisan.md:261 +#: ./docs/10.x/artisan.md:273 +#: ./docs/11.x/artisan.md:278 +#: ./docs/master/artisan.md:265 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/artisan.md:205 +#: ./docs/9.x/artisan.md:262 +#: ./docs/10.x/artisan.md:274 +#: ./docs/11.x/artisan.md:279 +#: ./docs/master/artisan.md:266 +msgid "Arguments" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:207 +#: ./docs/9.x/artisan.md:264 +#: ./docs/10.x/artisan.md:276 +#: ./docs/11.x/artisan.md:281 +#: ./docs/master/artisan.md:268 +msgid "All user supplied arguments and options are wrapped in curly braces. In the following example, the command defines one required argument: `user`:" +msgstr "" + +# P +#: ./docs/9.x/artisan.md:207 +#: ./docs/10.x/artisan.md:203 +#: ./docs/11.x/artisan.md:208 +#: ./docs/master/artisan.md:195 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/artisan.md:208 +#: ./docs/10.x/artisan.md:204 +#: ./docs/11.x/artisan.md:209 +#: ./docs/master/artisan.md:196 msgid "Isolatable Commands" -msgstr "可隔離的指令" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:209 +#: ./docs/9.x/artisan.md:266 +#: ./docs/10.x/artisan.md:278 +#: ./docs/11.x/artisan.md:283 +#: ./docs/master/artisan.md:270 +msgid "/**\n" +" * The name and signature of the console command.\n" +" *\n" +" * @var string\n" +" */\n" +"protected $signature = 'mail:send {user}';" +msgstr "" -#: docs/10.x/artisan.md:block 66 (quote) -msgid "**Warning** To utilize this feature, your application must be using the `memcached`, `redis`, `dynamodb`, `database`, `file`, or `array` cache driver as your application's default cache driver. In addition, all servers must be communicating with the same central cache server." -msgstr "**Warning** 若要使用此功能,則應用程式必須要使用 `memcached`, `redis`, `dynamodb`, `database`, `file` 或 `array` 作為應用程式的預設快取 Driver。另外,所有的伺服器也都必須要連線至相同的中央快取伺服器。" +# P +#: ./docs/9.x/artisan.md:211 +#: ./docs/10.x/artisan.md:207 +#: ./docs/11.x/artisan.md:212 +#: ./docs/master/artisan.md:199 +msgid "To utilize this feature, your application must be using the `memcached`, `redis`, `dynamodb`, `database`, `file`, or `array` cache driver as your application's default cache driver. In addition, all servers must be communicating with the same central cache server." +msgstr "" -#: docs/10.x/artisan.md:block 67 (paragraph) +# P +#: ./docs/9.x/artisan.md:213 +#: ./docs/10.x/artisan.md:209 +#: ./docs/11.x/artisan.md:214 +#: ./docs/master/artisan.md:201 msgid "Sometimes you may wish to ensure that only one instance of a command can run at a time. To accomplish this, you may implement the `Illuminate\\Contracts\\Console\\Isolatable` interface on your command class:" -msgstr "有時候,我們可能需要確保某個指令在同一時間只有一個實體在執行。為此,可以在指令類別上實作 `Illuminate\\Contracts\\Console\\Isolatable` Interface:" +msgstr "" -#: docs/10.x/artisan.md:block 68 (code) +# CODE +#: ./docs/9.x/artisan.md:215 +#: ./docs/10.x/artisan.md:211 +#: ./docs/11.x/artisan.md:216 +#: ./docs/master/artisan.md:203 msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/artisan.md:225 +#: ./docs/9.x/artisan.md:282 +#: ./docs/10.x/artisan.md:294 +#: ./docs/11.x/artisan.md:299 +#: ./docs/master/artisan.md:286 +msgid "Options" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:227 +#: ./docs/9.x/artisan.md:284 +#: ./docs/10.x/artisan.md:296 +#: ./docs/11.x/artisan.md:301 +#: ./docs/master/artisan.md:288 +msgid "Options, like arguments, are another form of user input. Options are prefixed by two hyphens (`--`) when they are provided via the command line. There are two types of options: those that receive a value and those that don't. Options that don't receive a value serve as a boolean \"switch\". Let's take a look at an example of this type of option:" +msgstr "" + +# P +#: ./docs/9.x/artisan.md:227 +#: ./docs/10.x/artisan.md:223 +#: ./docs/11.x/artisan.md:228 +#: ./docs/master/artisan.md:215 msgid "When a command is marked as `Isolatable`, Laravel will automatically add an `--isolated` option to the command. When the command is invoked with that option, Laravel will ensure that no other instances of that command are already running. Laravel accomplishes this by attempting to acquire an atomic lock using your application's default cache driver. If other instances of the command are running, the command will not execute; however, the command will still exit with a successful exit status code:" -msgstr "將指令標記為 ^[`Isolatable`](可隔離的) 後,Laravel 會自動為該指令加上一個 `--isolated` 選項。使用 `--isolated` 選項呼叫該指令時,Laravel 會確保沒有其他該指令的實體正在執行。Laravel 通過在預設快取 Driver 上取得 ^[Atomic Lock](不可部分完成鎖定) 來確保只有一個實體在執行。若該指令有其他實體在執行,就不會執行該指令。不過,該指令依然會以成功的終止狀態碼結束:" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:229 +#: ./docs/9.x/artisan.md:286 +#: ./docs/10.x/artisan.md:298 +#: ./docs/11.x/artisan.md:303 +#: ./docs/master/artisan.md:290 +msgid "/**\n" +" * The name and signature of the console command.\n" +" *\n" +" * @var string\n" +" */\n" +"protected $signature = 'mail:send {user} {--queue}';" +msgstr "" -#: docs/10.x/artisan.md:block 70 (code) -msgid "php artisan mail:send 1 --isolated\n" -msgstr "php artisan mail:send 1 --isolated\n" +# CODE: shell +#: ./docs/9.x/artisan.md:229 +#: ./docs/10.x/artisan.md:225 +#: ./docs/11.x/artisan.md:230 +#: ./docs/master/artisan.md:217 +msgid "php artisan mail:send 1 --isolated" +msgstr "" -#: docs/10.x/artisan.md:block 71 (paragraph) +# P +#: ./docs/9.x/artisan.md:233 +#: ./docs/10.x/artisan.md:229 +#: ./docs/11.x/artisan.md:234 +#: ./docs/master/artisan.md:221 msgid "If you would like to specify the exit status code that the command should return if it is not able to execute, you may provide the desired status code via the `isolated` option:" -msgstr "若想指定該指令無法執行時回傳的終止狀態碼,可使用 `isolated` 選項來設定:" +msgstr "" -#: docs/10.x/artisan.md:block 72 (code) -msgid "php artisan mail:send 1 --isolated=12\n" -msgstr "php artisan mail:send 1 --isolated=12\n" +# P +#: ./docs/10.x/artisan.md:235 +#: ./docs/11.x/artisan.md:240 +#: ./docs/master/artisan.md:227 +#~ msgid "" +#~ msgstr "" + +# CODE: shell +#: ./docs/9.x/artisan.md:235 +#: ./docs/10.x/artisan.md:231 +#: ./docs/11.x/artisan.md:236 +#: ./docs/master/artisan.md:223 +msgid "php artisan mail:send 1 --isolated=12" +msgstr "" -#: docs/10.x/artisan.md:block 74 (header) +# H4 +#: ./docs/10.x/artisan.md:236 +#: ./docs/11.x/artisan.md:241 +#: ./docs/master/artisan.md:228 msgid "Lock ID" -msgstr "Lock ID" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:236 +#: ./docs/9.x/artisan.md:293 +#: ./docs/10.x/artisan.md:305 +#: ./docs/11.x/artisan.md:310 +#: ./docs/master/artisan.md:297 +msgid "In this example, the `--queue` switch may be specified when calling the Artisan command. If the `--queue` switch is passed, the value of the option will be `true`. Otherwise, the value will be `false`:" +msgstr "" -#: docs/10.x/artisan.md:block 75 (paragraph) +# P +#: ./docs/10.x/artisan.md:238 +#: ./docs/11.x/artisan.md:243 +#: ./docs/master/artisan.md:230 msgid "By default, Laravel will use the command's name to generate the string key that is used to acquire the atomic lock in your application's cache. However, you may customize this key by defining an `isolatableId` method on your Artisan command class, allowing you to integrate the command's arguments or options into the key:" -msgstr "預設情況下,Laravel 會使用該指令的名稱來產生一組字串索引鍵,以用在專案快取中取得 Atomic Lock。不過,只要在 Artisan Command 類別上定義 `isolatebleId` 方法,就可以自定這個索引鍵,讓你能將該指令的引數或選項整合進索引鍵中:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/artisan.md:238 +#: ./docs/9.x/artisan.md:295 +#: ./docs/10.x/artisan.md:307 +#: ./docs/11.x/artisan.md:312 +#: ./docs/master/artisan.md:299 +msgid "php artisan mail:send 1 --queue" +msgstr "" -#: docs/10.x/artisan.md:block 76 (code) +# P +#: ./docs/9.x/artisan.md:239 +#: ./docs/10.x/artisan.md:250 +#: ./docs/11.x/artisan.md:255 +#: ./docs/master/artisan.md:242 +#~ msgid "" +#~ msgstr "" + +# CODE: php +#: ./docs/10.x/artisan.md:240 +#: ./docs/11.x/artisan.md:245 +#: ./docs/master/artisan.md:232 msgid "/**\n" " * Get the isolatable ID for the command.\n" " */\n" "public function isolatableId(): string\n" "{\n" " return $this->argument('user');\n" -"}\n" -msgstr "/**\n" -" * Get the isolatable ID for the command.\n" -" */\n" -"public function isolatableId(): string\n" -"{\n" -" return $this->argument('user');\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/artisan.md:block 78 (header) +# P +#: ./docs/8.x/artisan.md:240 +#: ./docs/9.x/artisan.md:299 +#: ./docs/10.x/artisan.md:311 +#: ./docs/11.x/artisan.md:316 +#: ./docs/master/artisan.md:303 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/artisan.md:240 +#: ./docs/10.x/artisan.md:251 +#: ./docs/11.x/artisan.md:256 +#: ./docs/master/artisan.md:243 msgid "Lock Expiration Time" -msgstr "Lock 的逾期時間" +msgstr "" -#: docs/10.x/artisan.md:block 79 (paragraph) +# H4 +#: ./docs/8.x/artisan.md:241 +#: ./docs/9.x/artisan.md:300 +#: ./docs/10.x/artisan.md:312 +#: ./docs/11.x/artisan.md:317 +#: ./docs/master/artisan.md:304 +msgid "Options With Values" +msgstr "" + +# P +#: ./docs/9.x/artisan.md:242 +#: ./docs/10.x/artisan.md:253 +#: ./docs/11.x/artisan.md:258 +#: ./docs/master/artisan.md:245 msgid "By default, isolation locks expire after the command is finished. Or, if the command is interrupted and unable to finish, the lock will expire after one hour. However, you may adjust the lock expiration time by defining a `isolationLockExpiresAt` method on your command:" -msgstr "預設情況下,指令完成執行後,獨立指令的 Lock 就會逾時。而如果指令在執行時遭到中斷而無法完成,該 Lock 會在一小時後逾時。不過,你可以在指令中定義一個 `isolationLockExpiresAt` 方法來調整逾時時間:" +msgstr "" -#: docs/10.x/artisan.md:block 80 (code) -msgid "use DateTimeInterface;\n" -"use DateInterval;\n\n" -"/**\n" +# P +#: ./docs/8.x/artisan.md:243 +#: ./docs/9.x/artisan.md:302 +#: ./docs/10.x/artisan.md:314 +#: ./docs/11.x/artisan.md:319 +#: ./docs/master/artisan.md:306 +msgid "Next, let's take a look at an option that expects a value. If the user must specify a value for an option, you should suffix the option name with a `=` sign:" +msgstr "" + +# CODE: php +#: ./docs/9.x/artisan.md:244 +msgid "/**\n" " * Determine when an isolation lock expires for the command.\n" -" */\n" -"public function isolationLockExpiresAt(): DateTimeInterface|DateInterval\n" +" *\n" +" * @return \\DateTimeInterface|\\DateInterval\n" +" */\n" +"public function isolationLockExpiresAt()\n" "{\n" " return now()->addMinutes(5);\n" -"}\n" -msgstr "use DateTimeInterface;\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:245 +#: ./docs/9.x/artisan.md:304 +#: ./docs/10.x/artisan.md:316 +#: ./docs/11.x/artisan.md:321 +#: ./docs/master/artisan.md:308 +msgid "/**\n" +" * The name and signature of the console command.\n" +" *\n" +" * @var string\n" +" */\n" +"protected $signature = 'mail:send {user} {--queue=}';" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:252 +#: ./docs/9.x/artisan.md:311 +#: ./docs/10.x/artisan.md:323 +#: ./docs/11.x/artisan.md:328 +#: ./docs/master/artisan.md:315 +msgid "In this example, the user may pass a value for the option like so. If the option is not specified when invoking the command, its value will be `null`:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/artisan.md:254 +#: ./docs/9.x/artisan.md:313 +#: ./docs/10.x/artisan.md:325 +#: ./docs/11.x/artisan.md:330 +#: ./docs/master/artisan.md:317 +msgid "php artisan mail:send 1 --queue=default" +msgstr "" + +# CODE: php +#: ./docs/10.x/artisan.md:255 +#: ./docs/11.x/artisan.md:260 +#: ./docs/master/artisan.md:247 +msgid "use DateTimeInterface;\n" "use DateInterval;\n\n" "/**\n" " * Determine when an isolation lock expires for the command.\n" @@ -484,223 +1355,619 @@ msgstr "use DateTimeInterface;\n" "public function isolationLockExpiresAt(): DateTimeInterface|DateInterval\n" "{\n" " return now()->addMinutes(5);\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/artisan.md:block 82 (header) -msgid "Defining Input Expectations" -msgstr "定義預期的輸入" +# P +#: ./docs/8.x/artisan.md:256 +#: ./docs/9.x/artisan.md:317 +#: ./docs/10.x/artisan.md:329 +#: ./docs/11.x/artisan.md:334 +#: ./docs/master/artisan.md:321 +msgid "You may assign default values to options by specifying the default value after the option name. If no option value is passed by the user, the default value will be used:" +msgstr "" -#: docs/10.x/artisan.md:block 83 (paragraph) -msgid "When writing console commands, it is common to gather input from the user through arguments or options. Laravel makes it very convenient to define the input you expect from the user using the `signature` property on your commands. The `signature` property allows you to define the name, arguments, and options for the command in a single, expressive, route-like syntax." -msgstr "在撰寫主控台指令時,常常會通過引數或選項來向使用者取得輸入。Laravel 通過指令的 `signature` 屬性來定義預期從使用者那取得的輸入,讓這個過程變得非常簡單。通過 `signature` 屬性,就能通過類似路由的格式來一次定義名稱、引數,以及選項。非常簡潔有力。" +# CODE +#: ./docs/8.x/artisan.md:258 +msgid "mail:send {user} {--queue=default}" +msgstr "" -#: docs/10.x/artisan.md:block 85 (header) -msgid "Arguments" -msgstr "引數" +# P +#: ./docs/8.x/artisan.md:260 +#: ./docs/9.x/artisan.md:321 +#: ./docs/10.x/artisan.md:333 +#: ./docs/11.x/artisan.md:338 +#: ./docs/master/artisan.md:325 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:261 +#: ./docs/9.x/artisan.md:322 +#: ./docs/10.x/artisan.md:334 +#: ./docs/11.x/artisan.md:339 +#: ./docs/master/artisan.md:326 +msgid "Option Shortcuts" +msgstr "" -#: docs/10.x/artisan.md:block 86 (paragraph) -msgid "All user supplied arguments and options are wrapped in curly braces. In the following example, the command defines one required argument: `user`:" -msgstr "所有由使用者提供的引數與選項都以大括號來包裝。在下列範例中的指令定義了一個必要的引數:`user`:" +# P +#: ./docs/8.x/artisan.md:263 +#: ./docs/9.x/artisan.md:324 +#: ./docs/10.x/artisan.md:336 +#: ./docs/11.x/artisan.md:341 +#: ./docs/master/artisan.md:328 +msgid "To assign a shortcut when defining an option, you may specify it before the option name and use the `|` character as a delimiter to separate the shortcut from the full option name:" +msgstr "" -#: docs/10.x/artisan.md:block 87 (code) -msgid "/**\n" -" * The name and signature of the console command.\n" -" *\n" -" * @var string\n" -" */\n" -"protected $signature = 'mail:send {user}';\n" -msgstr "/**\n" -" * The name and signature of the console command.\n" -" *\n" -" * @var string\n" -" */\n" -"protected $signature = 'mail:send {user}';\n" +# CODE +#: ./docs/8.x/artisan.md:265 +msgid "mail:send {user} {--Q|queue}" +msgstr "" -#: docs/10.x/artisan.md:block 88 (paragraph) -msgid "You may also make arguments optional or define default values for arguments:" -msgstr "也可以將引數設為可選,或是定義引數的預設值:" +# P +#: ./docs/8.x/artisan.md:267 +#: ./docs/9.x/artisan.md:328 +msgid "When invoking the command on your terminal, option shortcuts should be prefixed with a single hyphen:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/artisan.md:269 +#: ./docs/9.x/artisan.md:330 +msgid "php artisan mail:send 1 -Q" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:271 +#: ./docs/9.x/artisan.md:334 +#: ./docs/10.x/artisan.md:346 +#: ./docs/11.x/artisan.md:351 +#: ./docs/master/artisan.md:338 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/artisan.md:272 +#: ./docs/9.x/artisan.md:335 +#: ./docs/10.x/artisan.md:347 +#: ./docs/11.x/artisan.md:352 +#: ./docs/master/artisan.md:339 +msgid "Input Arrays" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:274 +#: ./docs/9.x/artisan.md:337 +#: ./docs/10.x/artisan.md:349 +#: ./docs/11.x/artisan.md:354 +#: ./docs/master/artisan.md:341 +msgid "If you would like to define arguments or options to expect multiple input values, you may use the `*` character. First, let's take a look at an example that specifies such an argument:" +msgstr "" -#: docs/10.x/artisan.md:block 89 (code) +# CODE +#: ./docs/9.x/artisan.md:275 +#: ./docs/10.x/artisan.md:287 +#: ./docs/11.x/artisan.md:292 +#: ./docs/master/artisan.md:279 msgid "// Optional argument...\n" "'mail:send {user?}'\n\n" "// Optional argument with default value...\n" -"'mail:send {user=foo}'\n" -msgstr "// 可選引數...\n" -"'mail:send {user?}'\n\n" -"// 有預設值的可選引數...\n" -"'mail:send {user=foo}'\n" +"'mail:send {user=foo}'" +msgstr "" -#: docs/10.x/artisan.md:block 91 (header) -msgid "Options" -msgstr "選項" +# CODE +#: ./docs/8.x/artisan.md:276 +msgid "mail:send {user*}" +msgstr "" -#: docs/10.x/artisan.md:block 92 (paragraph) -msgid "Options, like arguments, are another form of user input. Options are prefixed by two hyphens (`--`) when they are provided via the command line. There are two types of options: those that receive a value and those that don't. Options that don't receive a value serve as a boolean \"switch\". Let's take a look at an example of this type of option:" -msgstr "選項就像引數一樣,是另一種形式的使用者輸入。選項在從指令列提供時,會加上兩個減號 (`--`) 作為前綴。有兩種類型的選項:一種可接收值,一種沒有接收值。沒有接收值的選項是一種布林「開關」功能。來看看一個使用這種類型選項的例子:" +# P +#: ./docs/8.x/artisan.md:278 +msgid "When calling this method, the `user` arguments may be passed in order to the command line. For example, the following command will set the value of `user` to an array with `foo` and `bar` as its values:" +msgstr "" -#: docs/10.x/artisan.md:block 93 (code) -msgid "/**\n" -" * The name and signature of the console command.\n" -" *\n" -" * @var string\n" -" */\n" -"protected $signature = 'mail:send {user} {--queue}';\n" -msgstr "/**\n" -" * The name and signature of the console command.\n" -" *\n" -" * @var string\n" -" */\n" -"protected $signature = 'mail:send {user} {--queue}';\n" +# CODE +#: ./docs/8.x/artisan.md:280 +msgid "php artisan mail:send foo bar" +msgstr "" -#: docs/10.x/artisan.md:block 94 (paragraph) -msgid "In this example, the `--queue` switch may be specified when calling the Artisan command. If the `--queue` switch is passed, the value of the option will be `true`. Otherwise, the value will be `false`:" -msgstr "在這個例子中,呼叫該 Artisan 指令時可以指定 `--queue` 開關。若有傳入 `--queue` 開關,則該選項的值會是 `true`。否則,該值為 `false`:" +# P +#: ./docs/8.x/artisan.md:282 +#: ./docs/9.x/artisan.md:347 +#: ./docs/10.x/artisan.md:359 +#: ./docs/11.x/artisan.md:364 +#: ./docs/master/artisan.md:351 +msgid "This `*` character can be combined with an optional argument definition to allow zero or more instances of an argument:" +msgstr "" -#: docs/10.x/artisan.md:block 95 (code) -msgid "php artisan mail:send 1 --queue\n" -msgstr "php artisan mail:send 1 --queue\n" +# CODE +#: ./docs/8.x/artisan.md:284 +msgid "mail:send {user?*}" +msgstr "" -#: docs/10.x/artisan.md:block 97 (header) -msgid "Options With Values" -msgstr "帶值的選項" +# P +#: ./docs/8.x/artisan.md:286 +#: ./docs/9.x/artisan.md:351 +#: ./docs/10.x/artisan.md:363 +#: ./docs/11.x/artisan.md:368 +#: ./docs/master/artisan.md:355 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:287 +#: ./docs/9.x/artisan.md:352 +#: ./docs/10.x/artisan.md:364 +#: ./docs/11.x/artisan.md:369 +#: ./docs/master/artisan.md:356 +msgid "Option Arrays" +msgstr "" -#: docs/10.x/artisan.md:block 98 (paragraph) -msgid "Next, let's take a look at an option that expects a value. If the user must specify a value for an option, you should suffix the option name with a `=` sign:" -msgstr "接下來,來看看有值的選項。若使用者必須為選項指定一個值,則應在選項名稱後方加上 `=` 符號:" +# P +#: ./docs/8.x/artisan.md:289 +#: ./docs/9.x/artisan.md:354 +#: ./docs/10.x/artisan.md:366 +#: ./docs/11.x/artisan.md:371 +#: ./docs/master/artisan.md:358 +msgid "When defining an option that expects multiple input values, each option value passed to the command should be prefixed with the option name:" +msgstr "" -#: docs/10.x/artisan.md:block 99 (code) +# CODE +#: ./docs/8.x/artisan.md:291 +msgid "mail:send {user} {--id=*}\n\n" +"php artisan mail:send --id=1 --id=2" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:295 +#: ./docs/9.x/artisan.md:364 +#: ./docs/10.x/artisan.md:376 +#: ./docs/11.x/artisan.md:381 +#: ./docs/master/artisan.md:368 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/artisan.md:296 +#: ./docs/9.x/artisan.md:365 +#: ./docs/10.x/artisan.md:377 +#: ./docs/11.x/artisan.md:382 +#: ./docs/master/artisan.md:369 +msgid "Input Descriptions" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:298 +#: ./docs/9.x/artisan.md:367 +#: ./docs/10.x/artisan.md:379 +#: ./docs/11.x/artisan.md:384 +#: ./docs/master/artisan.md:371 +msgid "You may assign descriptions to input arguments and options by separating the argument name from the description using a colon. If you need a little extra room to define your command, feel free to spread the definition across multiple lines:" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:300 +#: ./docs/9.x/artisan.md:369 +#: ./docs/10.x/artisan.md:381 +#: ./docs/11.x/artisan.md:386 +#: ./docs/master/artisan.md:373 msgid "/**\n" " * The name and signature of the console command.\n" " *\n" " * @var string\n" " */\n" -"protected $signature = 'mail:send {user} {--queue=}';\n" -msgstr "/**\n" -" * The name and signature of the console command.\n" +"protected $signature = 'mail:send\n" +" {user : The ID of the user}\n" +" {--queue : Whether the job should be queued}';" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:309 +#: ./docs/9.x/artisan.md:378 +#: ./docs/10.x/artisan.md:477 +#: ./docs/11.x/artisan.md:478 +#: ./docs/master/artisan.md:465 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/artisan.md:310 +#: ./docs/9.x/artisan.md:379 +#: ./docs/10.x/artisan.md:478 +#: ./docs/11.x/artisan.md:479 +#: ./docs/master/artisan.md:466 +msgid "Command I/O" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:312 +#: ./docs/9.x/artisan.md:381 +#: ./docs/10.x/artisan.md:480 +#: ./docs/11.x/artisan.md:481 +#: ./docs/master/artisan.md:468 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/artisan.md:313 +#: ./docs/9.x/artisan.md:382 +#: ./docs/10.x/artisan.md:481 +#: ./docs/11.x/artisan.md:482 +#: ./docs/master/artisan.md:469 +msgid "Retrieving Input" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:315 +#: ./docs/9.x/artisan.md:384 +#: ./docs/10.x/artisan.md:483 +#: ./docs/11.x/artisan.md:484 +#: ./docs/master/artisan.md:471 +msgid "While your command is executing, you will likely need to access the values for the arguments and options accepted by your command. To do so, you may use the `argument` and `option` methods. If an argument or option does not exist, `null` will be returned:" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:317 +#: ./docs/9.x/artisan.md:386 +msgid "/**\n" +" * Execute the console command.\n" " *\n" -" * @var string\n" +" * @return int\n" " */\n" -"protected $signature = 'mail:send {user} {--queue=}';\n" +"public function handle()\n" +"{\n" +" $userId = $this->argument('user');\n\n" +" //\n" +"}" +msgstr "" -#: docs/10.x/artisan.md:block 100 (paragraph) -msgid "In this example, the user may pass a value for the option like so. If the option is not specified when invoking the command, its value will be `null`:" -msgstr "在這個例子中,使用者可以傳入像這樣給選項帶入一個值。若在叫用該指令時未指定該選項,則其值為 `null`:" +# CODE +#: ./docs/9.x/artisan.md:319 +#: ./docs/10.x/artisan.md:331 +#: ./docs/11.x/artisan.md:336 +#: ./docs/master/artisan.md:323 +msgid "'mail:send {user} {--queue=default}'" +msgstr "" -#: docs/10.x/artisan.md:block 101 (code) -msgid "php artisan mail:send 1 --queue=default\n" -msgstr "php artisan mail:send 1 --queue=default\n" +# CODE +#: ./docs/9.x/artisan.md:326 +#: ./docs/10.x/artisan.md:338 +#: ./docs/11.x/artisan.md:343 +#: ./docs/master/artisan.md:330 +msgid "'mail:send {user} {--Q|queue}'" +msgstr "" -#: docs/10.x/artisan.md:block 102 (paragraph) -msgid "You may assign default values to options by specifying the default value after the option name. If no option value is passed by the user, the default value will be used:" -msgstr "可以通過在選項名稱後方加上預設值來為選項指派一個預設值。若使用者未傳入選項值,將會使用預設值:" +# P +#: ./docs/8.x/artisan.md:329 +#: ./docs/9.x/artisan.md:398 +#: ./docs/10.x/artisan.md:493 +#: ./docs/11.x/artisan.md:494 +#: ./docs/master/artisan.md:481 +msgid "If you need to retrieve all of the arguments as an `array`, call the `arguments` method:" +msgstr "" -#: docs/10.x/artisan.md:block 103 (code) -msgid "'mail:send {user} {--queue=default}'\n" -msgstr "'mail:send {user} {--queue=default}'\n" +# CODE +#: ./docs/8.x/artisan.md:331 +#: ./docs/9.x/artisan.md:400 +#: ./docs/10.x/artisan.md:495 +#: ./docs/11.x/artisan.md:496 +#: ./docs/master/artisan.md:483 +msgid "$arguments = $this->arguments();" +msgstr "" -#: docs/10.x/artisan.md:block 105 (header) -msgid "Option Shortcuts" -msgstr "選項捷徑" +# P +#: ./docs/8.x/artisan.md:333 +#: ./docs/9.x/artisan.md:402 +#: ./docs/10.x/artisan.md:497 +#: ./docs/11.x/artisan.md:498 +#: ./docs/master/artisan.md:485 +msgid "Options may be retrieved just as easily as arguments using the `option` method. To retrieve all of the options as an array, call the `options` method:" +msgstr "" -#: docs/10.x/artisan.md:block 106 (paragraph) -msgid "To assign a shortcut when defining an option, you may specify it before the option name and use the `|` character as a delimiter to separate the shortcut from the full option name:" -msgstr "若要在定義選項時指定捷徑,可以在選項名稱前加上其捷徑名稱,並使用 `|` 字元來區分捷徑名稱與完整的選項名稱:" +# CODE +#: ./docs/8.x/artisan.md:335 +#: ./docs/9.x/artisan.md:404 +#: ./docs/10.x/artisan.md:499 +#: ./docs/11.x/artisan.md:500 +#: ./docs/master/artisan.md:487 +msgid "// Retrieve a specific option...\n" +"$queueName = $this->option('queue');\n\n" +"// Retrieve all options as an array...\n" +"$options = $this->options();" +msgstr "" -#: docs/10.x/artisan.md:block 107 (code) -msgid "'mail:send {user} {--Q|queue}'\n" -msgstr "'mail:send {user} {--Q|queue}'\n" +# CODE +#: ./docs/9.x/artisan.md:339 +#: ./docs/10.x/artisan.md:351 +#: ./docs/11.x/artisan.md:356 +#: ./docs/master/artisan.md:343 +msgid "'mail:send {user*}'" +msgstr "" -#: docs/10.x/artisan.md:block 108 (paragraph) +# P +#: ./docs/10.x/artisan.md:340 +#: ./docs/11.x/artisan.md:345 +#: ./docs/master/artisan.md:332 msgid "When invoking the command on your terminal, option shortcuts should be prefixed with a single hyphen and no `=` character should be included when specifying a value for the option:" -msgstr "在終端機中呼叫指令時,選項捷徑前面應該只有一個減號,且在指定選項值時不應加上 `=` 字元:" - -#: docs/10.x/artisan.md:block 109 (code) -msgid "php artisan mail:send 1 -Qdefault\n" -msgstr "php artisan mail:send 1 -Qdefault\n" +msgstr "" -#: docs/10.x/artisan.md:block 111 (header) -msgid "Input Arrays" -msgstr "輸入陣列" +# P +#: ./docs/8.x/artisan.md:341 +#: ./docs/9.x/artisan.md:410 +#: ./docs/10.x/artisan.md:505 +#: ./docs/11.x/artisan.md:506 +#: ./docs/master/artisan.md:493 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/artisan.md:341 +#: ./docs/10.x/artisan.md:353 +#: ./docs/11.x/artisan.md:358 +#: ./docs/master/artisan.md:345 +msgid "When calling this method, the `user` arguments may be passed in order to the command line. For example, the following command will set the value of `user` to an array with `1` and `2` as its values:" +msgstr "" -#: docs/10.x/artisan.md:block 112 (paragraph) -msgid "If you would like to define arguments or options to expect multiple input values, you may use the `*` character. First, let's take a look at an example that specifies such an argument:" -msgstr "若想要定義預期有多個輸入值的引數或選項,則可以使用 `*` 字元。首先,來看看這樣設定引數的例子:" +# CODE: shell +#: ./docs/10.x/artisan.md:342 +#: ./docs/11.x/artisan.md:347 +#: ./docs/master/artisan.md:334 +msgid "php artisan mail:send 1 -Qdefault" +msgstr "" -#: docs/10.x/artisan.md:block 113 (code) -msgid "'mail:send {user*}'\n" -msgstr "'mail:send {user*}'\n" +# H3 +#: ./docs/8.x/artisan.md:342 +#: ./docs/9.x/artisan.md:411 +msgid "Prompting For Input" +msgstr "" -#: docs/10.x/artisan.md:block 114 (paragraph) -msgid "When calling this method, the `user` arguments may be passed in order to the command line. For example, the following command will set the value of `user` to an array with `1` and `2` as its values:" -msgstr "呼叫這個方法的時候,`user` 引數在指令列中可以按照順序傳入。舉例來說,下列指令會將 `user` 的值設為一個內容為 `1` 與 `2` 的陣列:" +# CODE: shell +#: ./docs/9.x/artisan.md:343 +#: ./docs/10.x/artisan.md:355 +#: ./docs/11.x/artisan.md:360 +#: ./docs/master/artisan.md:347 +msgid "php artisan mail:send 1 2" +msgstr "" -#: docs/10.x/artisan.md:block 115 (code) -msgid "php artisan mail:send 1 2\n" -msgstr "php artisan mail:send 1 2\n" +# P +#: ./docs/8.x/artisan.md:344 +#: ./docs/9.x/artisan.md:413 +#: ./docs/10.x/artisan.md:511 +#: ./docs/11.x/artisan.md:512 +#: ./docs/master/artisan.md:499 +msgid "In addition to displaying output, you may also ask the user to provide input during the execution of your command. The `ask` method will prompt the user with the given question, accept their input, and then return the user's input back to your command:" +msgstr "" -#: docs/10.x/artisan.md:block 116 (paragraph) -msgid "This `*` character can be combined with an optional argument definition to allow zero or more instances of an argument:" -msgstr "`*` 字元可以與可選引數組合使用來定義,這樣一來可允許有 0 個或多個引數的實體:" +# CODE +#: ./docs/8.x/artisan.md:346 +#: ./docs/9.x/artisan.md:415 +msgid "/**\n" +" * Execute the console command.\n" +" *\n" +" * @return mixed\n" +" */\n" +"public function handle()\n" +"{\n" +" $name = $this->ask('What is your name?');\n" +"}" +msgstr "" -#: docs/10.x/artisan.md:block 117 (code) -msgid "'mail:send {user?*}'\n" -msgstr "'mail:send {user?*}'\n" +# CODE +#: ./docs/9.x/artisan.md:349 +#: ./docs/10.x/artisan.md:361 +#: ./docs/11.x/artisan.md:366 +#: ./docs/master/artisan.md:353 +msgid "'mail:send {user?*}'" +msgstr "" -#: docs/10.x/artisan.md:block 119 (header) -msgid "Option Arrays" -msgstr "選項陣列" +# P +#: ./docs/8.x/artisan.md:356 +#: ./docs/9.x/artisan.md:425 +#: ./docs/10.x/artisan.md:527 +#: ./docs/11.x/artisan.md:528 +#: ./docs/master/artisan.md:515 +msgid "The `secret` method is similar to `ask`, but the user's input will not be visible to them as they type in the console. This method is useful when asking for sensitive information such as passwords:" +msgstr "" -#: docs/10.x/artisan.md:block 120 (paragraph) -msgid "When defining an option that expects multiple input values, each option value passed to the command should be prefixed with the option name:" -msgstr "定義預期有多個輸入值的選項時,每個傳入指令的選項值都應以選項名稱作為前綴:" +# CODE +#: ./docs/9.x/artisan.md:356 +#: ./docs/10.x/artisan.md:368 +#: ./docs/11.x/artisan.md:373 +#: ./docs/master/artisan.md:360 +msgid "'mail:send {--id=*}'" +msgstr "" -#: docs/10.x/artisan.md:block 121 (code) -msgid "'mail:send {--id=*}'\n" -msgstr "'mail:send {--id=*}'\n" +# CODE +#: ./docs/8.x/artisan.md:358 +#: ./docs/9.x/artisan.md:427 +#: ./docs/10.x/artisan.md:529 +#: ./docs/11.x/artisan.md:530 +#: ./docs/master/artisan.md:517 +msgid "$password = $this->secret('What is the password?');" +msgstr "" -#: docs/10.x/artisan.md:block 122 (paragraph) +# P +#: ./docs/9.x/artisan.md:358 +#: ./docs/10.x/artisan.md:370 +#: ./docs/11.x/artisan.md:375 +#: ./docs/master/artisan.md:362 msgid "Such a command may be invoked by passing multiple `--id` arguments:" -msgstr "可以通過傳入多個 `-id` 引數來叫用這樣的指令:" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:360 +#: ./docs/9.x/artisan.md:429 +#: ./docs/10.x/artisan.md:531 +#: ./docs/11.x/artisan.md:532 +#: ./docs/master/artisan.md:519 +#~ msgid "" +#~ msgstr "" + +# CODE: shell +#: ./docs/9.x/artisan.md:360 +#: ./docs/10.x/artisan.md:372 +#: ./docs/11.x/artisan.md:377 +#: ./docs/master/artisan.md:364 +msgid "php artisan mail:send --id=1 --id=2" +msgstr "" -#: docs/10.x/artisan.md:block 123 (code) -msgid "php artisan mail:send --id=1 --id=2\n" -msgstr "php artisan mail:send --id=1 --id=2\n" +# H4 +#: ./docs/8.x/artisan.md:361 +#: ./docs/9.x/artisan.md:430 +msgid "Asking For Confirmation" +msgstr "" -#: docs/10.x/artisan.md:block 125 (header) -msgid "Input Descriptions" -msgstr "輸入描述" +# P +#: ./docs/8.x/artisan.md:363 +#: ./docs/9.x/artisan.md:432 +#: ./docs/10.x/artisan.md:534 +#: ./docs/11.x/artisan.md:535 +#: ./docs/master/artisan.md:522 +msgid "If you need to ask the user for a simple \"yes or no\" confirmation, you may use the `confirm` method. By default, this method will return `false`. However, if the user enters `y` or `yes` in response to the prompt, the method will return `true`." +msgstr "" -#: docs/10.x/artisan.md:block 126 (paragraph) -msgid "You may assign descriptions to input arguments and options by separating the argument name from the description using a colon. If you need a little extra room to define your command, feel free to spread the definition across multiple lines:" -msgstr "可以通過以冒號 (`:`) 區分引數名與描述來為輸入引數或選項指定描述。若需要更多空間來定義指令的話,可以將定義拆分為多行:" +# CODE +#: ./docs/8.x/artisan.md:365 +#: ./docs/9.x/artisan.md:434 +msgid "if ($this->confirm('Do you wish to continue?')) {\n" +" //\n" +"}" +msgstr "" -#: docs/10.x/artisan.md:block 127 (code) -msgid "/**\n" -" * The name and signature of the console command.\n" -" *\n" -" * @var string\n" -" */\n" -"protected $signature = 'mail:send\n" -" {user : The ID of the user}\n" -" {--queue : Whether the job should be queued}';\n" -msgstr "/**\n" -" * The name and signature of the console command.\n" -" *\n" -" * @var string\n" -" */\n" -"protected $signature = 'mail:send\n" -" {user : The ID of the user}\n" -" {--queue : Whether the job should be queued}';\n" +# P +#: ./docs/8.x/artisan.md:369 +#: ./docs/9.x/artisan.md:438 +#: ./docs/10.x/artisan.md:540 +#: ./docs/11.x/artisan.md:541 +#: ./docs/master/artisan.md:528 +msgid "If necessary, you may specify that the confirmation prompt should return `true` by default by passing `true` as the second argument to the `confirm` method:" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:371 +#: ./docs/9.x/artisan.md:440 +msgid "if ($this->confirm('Do you wish to continue?', true)) {\n" +" //\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:375 +#: ./docs/9.x/artisan.md:444 +#: ./docs/10.x/artisan.md:546 +#: ./docs/11.x/artisan.md:547 +#: ./docs/master/artisan.md:534 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:376 +#: ./docs/9.x/artisan.md:445 +#: ./docs/10.x/artisan.md:547 +#: ./docs/11.x/artisan.md:548 +#: ./docs/master/artisan.md:535 +msgid "Auto-Completion" +msgstr "" -#: docs/10.x/artisan.md:block 129 (header) -msgid "Prompting For Missing Input" -msgstr "為未提供的輸入進行提示" +# P +#: ./docs/8.x/artisan.md:378 +#: ./docs/9.x/artisan.md:447 +#: ./docs/10.x/artisan.md:549 +#: ./docs/11.x/artisan.md:550 +#: ./docs/master/artisan.md:537 +msgid "The `anticipate` method can be used to provide auto-completion for possible choices. The user can still provide any answer, regardless of the auto-completion hints:" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:380 +#: ./docs/9.x/artisan.md:449 +#: ./docs/10.x/artisan.md:551 +#: ./docs/11.x/artisan.md:552 +#: ./docs/master/artisan.md:539 +msgid "$name = $this->anticipate('What is your name?', ['Taylor', 'Dayle']);" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:382 +#: ./docs/9.x/artisan.md:451 +#: ./docs/10.x/artisan.md:553 +#: ./docs/11.x/artisan.md:554 +#: ./docs/master/artisan.md:541 +msgid "Alternatively, you may pass a closure as the second argument to the `anticipate` method. The closure will be called each time the user types an input character. The closure should accept a string parameter containing the user's input so far, and return an array of options for auto-completion:" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:384 +#: ./docs/9.x/artisan.md:453 +msgid "$name = $this->anticipate('What is your address?', function ($input) {\n" +" // Return auto-completion options...\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:388 +#: ./docs/9.x/artisan.md:457 +#: ./docs/10.x/artisan.md:559 +#: ./docs/11.x/artisan.md:560 +#: ./docs/master/artisan.md:547 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:389 +#: ./docs/9.x/artisan.md:458 +#: ./docs/10.x/artisan.md:560 +#: ./docs/11.x/artisan.md:561 +#: ./docs/master/artisan.md:548 +msgid "Multiple Choice Questions" +msgstr "" + +# P +#: ./docs/10.x/artisan.md:390 +#: ./docs/11.x/artisan.md:395 +#: ./docs/master/artisan.md:382 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/artisan.md:391 +#: ./docs/11.x/artisan.md:396 +#: ./docs/master/artisan.md:383 +msgid "Prompting for Missing Input" +msgstr "" -#: docs/10.x/artisan.md:block 130 (paragraph) +# P +#: ./docs/8.x/artisan.md:391 +#: ./docs/9.x/artisan.md:460 +#: ./docs/10.x/artisan.md:562 +#: ./docs/11.x/artisan.md:563 +#: ./docs/master/artisan.md:550 +msgid "If you need to give the user a predefined set of choices when asking a question, you may use the `choice` method. You may set the array index of the default value to be returned if no option is chosen by passing the index as the third argument to the method:" +msgstr "" + +# P +#: ./docs/10.x/artisan.md:393 +#: ./docs/11.x/artisan.md:398 +#: ./docs/master/artisan.md:385 msgid "If your command contains required arguments, the user will receive an error message when they are not provided. Alternatively, you may configure your command to automatically prompt the user when required arguments are missing by implementing the `PromptsForMissingInput` interface:" -msgstr "當指令有包含必填的引數時,若使用者未提供這些引數,則會產生錯誤訊息。除了產生錯誤訊息外,只要實作 `PromptsForMissingInput` ^[Interface](介面),就可以讓 Command 在使用者未提供必填引數時自動提示使用者輸入。" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:393 +#: ./docs/9.x/artisan.md:462 +#: ./docs/10.x/artisan.md:564 +#: ./docs/11.x/artisan.md:565 +#: ./docs/master/artisan.md:552 +msgid "$name = $this->choice(\n" +" 'What is your name?',\n" +" ['Taylor', 'Dayle'],\n" +" $defaultIndex\n" +");" +msgstr "" -#: docs/10.x/artisan.md:block 131 (code) +# CODE +#: ./docs/10.x/artisan.md:395 +#: ./docs/11.x/artisan.md:400 +#: ./docs/master/artisan.md:387 msgid "choice(\n" +" 'What is your name?',\n" +" ['Taylor', 'Dayle'],\n" +" $defaultIndex,\n" +" $maxAttempts = null,\n" +" $allowMultipleSelections = false\n" +");" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:409 +#: ./docs/9.x/artisan.md:478 +#: ./docs/10.x/artisan.md:580 +#: ./docs/11.x/artisan.md:581 +#: ./docs/master/artisan.md:568 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/artisan.md:410 +#: ./docs/9.x/artisan.md:479 +#: ./docs/10.x/artisan.md:581 +#: ./docs/11.x/artisan.md:582 +#: ./docs/master/artisan.md:569 +msgid "Writing Output" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:412 +#: ./docs/9.x/artisan.md:481 +#: ./docs/10.x/artisan.md:583 +#: ./docs/11.x/artisan.md:584 +#: ./docs/master/artisan.md:571 +msgid "To send output to the console, you may use the `line`, `info`, `comment`, `question`, `warn`, and `error` methods. Each of these methods will use appropriate ANSI colors for their purpose. For example, let's display some general information to the user. Typically, the `info` method will display in the console as green colored text:" +msgstr "" -#: docs/10.x/artisan.md:block 132 (paragraph) +# P +#: ./docs/10.x/artisan.md:414 +#: ./docs/11.x/artisan.md:419 +#: ./docs/master/artisan.md:406 msgid "If Laravel needs to gather a required argument from the user, it will automatically ask the user for the argument by intelligently phrasing the question using either the argument name or description. If you wish to customize the question used to gather the required argument, you may implement the `promptForMissingArgumentsUsing` method, returning an array of questions keyed by the argument names:" -msgstr "當 Laravel 需要從使用者取得必填引數時,Laravel 會自動智慧地使用引數名稱與說明來產生提問,並向使用者要求輸入。若想自定必填引數的提問,可實作 `promptForMissingArgumentsUsing` 方法,並回傳一組以引數名稱為索引鍵的問題陣列:" +msgstr "" -#: docs/10.x/artisan.md:block 133 (code) +# CODE +#: ./docs/8.x/artisan.md:414 +#: ./docs/9.x/artisan.md:483 msgid "/**\n" -" * Prompt for missing input arguments using the returned questions.\n" +" * Execute the console command.\n" " *\n" -" * @return array\n" +" * @return mixed\n" " */\n" -"protected function promptForMissingArgumentsUsing()\n" +"public function handle()\n" "{\n" -" return [\n" -" 'user' => 'Which user ID should receive the mail?',\n" -" ];\n" -"}\n" -msgstr "/**\n" +" // ...\n\n" +" $this->info('The command was successful!');\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:416 +msgid "/**\n" " * Prompt for missing input arguments using the returned questions.\n" " *\n" " * @return array\n" @@ -756,25 +2069,97 @@ msgstr "/**\n" " return [\n" " 'user' => 'Which user ID should receive the mail?',\n" " ];\n" -"}\n" +"}" +msgstr "" + +# CODE +#: ./docs/11.x/artisan.md:421 +#: ./docs/master/artisan.md:408 +msgid "/**\n" +" * Prompt for missing input arguments using the returned questions.\n" +" *\n" +" * @return array\n" +" */\n" +"protected function promptForMissingArgumentsUsing(): array\n" +"{\n" +" return [\n" +" 'user' => 'Which user ID should receive the mail?',\n" +" ];\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:426 +#: ./docs/9.x/artisan.md:495 +#: ./docs/10.x/artisan.md:595 +#: ./docs/11.x/artisan.md:596 +#: ./docs/master/artisan.md:583 +msgid "To display an error message, use the `error` method. Error message text is typically displayed in red:" +msgstr "" -#: docs/10.x/artisan.md:block 134 (paragraph) +# P +#: ./docs/10.x/artisan.md:428 +#: ./docs/11.x/artisan.md:433 +#: ./docs/master/artisan.md:420 msgid "You may also provide placeholder text by using a tuple containing the question and placeholder:" -msgstr "也可以使用包含提問與預留位置 (Placeholder) 的 ^[Tuple](有序元素) 來提供預留位置文字:" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:428 +#: ./docs/9.x/artisan.md:497 +#: ./docs/10.x/artisan.md:597 +#: ./docs/11.x/artisan.md:598 +#: ./docs/master/artisan.md:585 +msgid "$this->error('Something went wrong!');" +msgstr "" -#: docs/10.x/artisan.md:block 135 (code) +# CODE +#: ./docs/10.x/artisan.md:430 +#: ./docs/11.x/artisan.md:435 +#: ./docs/master/artisan.md:422 msgid "return [\n" " 'user' => ['Which user ID should receive the mail?', 'E.g. 123'],\n" -"];\n" -msgstr "return [\n" -" 'user' => ['Which user ID should receive the mail?', 'E.g. 123'],\n" -"];\n" +"];" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:430 +#: ./docs/9.x/artisan.md:499 +#: ./docs/10.x/artisan.md:599 +#: ./docs/11.x/artisan.md:600 +#: ./docs/master/artisan.md:587 +msgid "You may use the `line` method to display plain, uncolored text:" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:432 +#: ./docs/9.x/artisan.md:501 +#: ./docs/10.x/artisan.md:601 +#: ./docs/11.x/artisan.md:602 +#: ./docs/master/artisan.md:589 +msgid "$this->line('Display this on the screen');" +msgstr "" -#: docs/10.x/artisan.md:block 136 (paragraph) +# P +#: ./docs/10.x/artisan.md:434 +#: ./docs/11.x/artisan.md:439 +#: ./docs/master/artisan.md:426 msgid "If you would like complete control over the prompt, you may provide a closure that should prompt the user and return their answer:" -msgstr "若想完全控制提示,可以提供一個 Closure 以用於向使用者提問並回傳使用者提供的答案:" +msgstr "" -#: docs/10.x/artisan.md:block 137 (code) +# P +#: ./docs/8.x/artisan.md:434 +#: ./docs/9.x/artisan.md:503 +#: ./docs/10.x/artisan.md:603 +#: ./docs/11.x/artisan.md:604 +#: ./docs/master/artisan.md:591 +msgid "You may use the `newLine` method to display a blank line:" +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:436 +#: ./docs/11.x/artisan.md:441 +#: ./docs/master/artisan.md:428 msgid "use App\\Models\\User;\n" "use function Laravel\\Prompts\\search;\n\n" "// ...\n\n" @@ -783,32 +2168,90 @@ msgid "use App\\Models\\User;\n" " label: 'Search for a user:',\n" " placeholder: 'E.g. Taylor Otwell',\n" " options: fn ($value) => strlen($value) > 0\n" -" ? User::where('name', 'like', \"%{$value}%\")->pluck('name', 'id')\n" -" : []\n" -" ),\n" -"];\n" -msgstr "use App\\Models\\User;\n" -"use function Laravel\\Prompts\\search;\n\n" -"// ...\n\n" -"return [\n" -" 'user' => fn () => search(\n" -" label: 'Search for a user:',\n" -" placeholder: 'E.g. Taylor Otwell',\n" -" options: fn ($value) => strlen($value) > 0\n" -" ? User::where('name', 'like', \"%{$value}%\")->pluck('name', 'id')\n" +" ? User::where('name', 'like', \"%{$value}%\")->pluck('name', 'id')->all()\n" " : []\n" " ),\n" -"];\n" +"];" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:436 +#: ./docs/9.x/artisan.md:505 +#: ./docs/10.x/artisan.md:605 +#: ./docs/11.x/artisan.md:606 +#: ./docs/master/artisan.md:593 +msgid "// Write a single blank line...\n" +"$this->newLine();\n\n" +"// Write three blank lines...\n" +"$this->newLine(3);" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:442 +#: ./docs/9.x/artisan.md:511 +#: ./docs/10.x/artisan.md:611 +#: ./docs/11.x/artisan.md:612 +#: ./docs/master/artisan.md:599 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:443 +#: ./docs/9.x/artisan.md:512 +#: ./docs/10.x/artisan.md:612 +#: ./docs/11.x/artisan.md:613 +#: ./docs/master/artisan.md:600 +msgid "Tables" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:445 +#: ./docs/9.x/artisan.md:514 +#: ./docs/10.x/artisan.md:614 +#: ./docs/11.x/artisan.md:615 +#: ./docs/master/artisan.md:602 +msgid "The `table` method makes it easy to correctly format multiple rows / columns of data. All you need to do is provide the column names and the data for the table and Laravel will\n" +"automatically calculate the appropriate width and height of the table for you:" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:448 +#: ./docs/9.x/artisan.md:517 +#: ./docs/10.x/artisan.md:617 +#: ./docs/11.x/artisan.md:618 +#: ./docs/master/artisan.md:605 +msgid "use App\\Models\\User;\n\n" +"$this->table(\n" +" ['Name', 'Email'],\n" +" User::all(['name', 'email'])->toArray()\n" +");" +msgstr "" -#: docs/10.x/artisan.md:block 138 (quote) -msgid "**Note** The comprehensive [Laravel Prompts](/docs/{{version}}/prompts) documentation includes additional information on the available prompts and their usage." -msgstr "**Note** 完整的 [Laravel Prompts](/docs/{{version}}/prompts) 說明文件中包含了有關可用的提示及其使用方法的更多資訊。" +# P +#: ./docs/10.x/artisan.md:452 +#: ./docs/11.x/artisan.md:457 +#: ./docs/master/artisan.md:444 +msgid "The comprehensive [Laravel Prompts](/docs/{{version}}/prompts) documentation includes additional information on the available prompts and their usage." +msgstr "" -#: docs/10.x/artisan.md:block 139 (paragraph) +# P +#: ./docs/10.x/artisan.md:454 +#: ./docs/11.x/artisan.md:459 +#: ./docs/master/artisan.md:446 msgid "If you wish to prompt the user to select or enter [options](#options), you may include prompts in your command's `handle` method. However, if you only wish to prompt the user when they have also been automatically prompted for missing arguments, then you may implement the `afterPromptingForMissingArguments` method:" -msgstr "若想提示使用者選擇或輸入[選項](#options),則可在 Command 的 `handle` 方法中包含提示。不過,若只想在使用者同時被提示未提供的引數時提示使用者,則可實作 `afterPromptingForMissingArguments` 方法:" +msgstr "" -#: docs/10.x/artisan.md:block 140 (code) +# P +#: ./docs/8.x/artisan.md:455 +#: ./docs/9.x/artisan.md:524 +#: ./docs/10.x/artisan.md:624 +#: ./docs/11.x/artisan.md:625 +#: ./docs/master/artisan.md:612 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:456 msgid "use Symfony\\Component\\Console\\Input\\InputInterface;\n" "use Symfony\\Component\\Console\\Output\\OutputInterface;\n" "use function Laravel\\Prompts\\confirm;\n\n" @@ -826,933 +2269,458 @@ msgid "use Symfony\\Component\\Console\\Input\\InputInterface;\n" " label: 'Would you like to queue the mail?',\n" " default: $this->option('queue')\n" " ));\n" -"}\n" -msgstr "use Symfony\\Component\\Console\\Input\\InputInterface;\n" +"}" +msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:456 +#: ./docs/9.x/artisan.md:525 +#: ./docs/10.x/artisan.md:625 +#: ./docs/11.x/artisan.md:626 +#: ./docs/master/artisan.md:613 +msgid "Progress Bars" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:458 +#: ./docs/9.x/artisan.md:527 +#: ./docs/10.x/artisan.md:627 +#: ./docs/11.x/artisan.md:628 +#: ./docs/master/artisan.md:615 +msgid "For long running tasks, it can be helpful to show a progress bar that informs users how complete the task is. Using the `withProgressBar` method, Laravel will display a progress bar and advance its progress for each iteration over a given iterable value:" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:460 +#: ./docs/9.x/artisan.md:529 +msgid "use App\\Models\\User;\n\n" +"$users = $this->withProgressBar(User::all(), function ($user) {\n" +" $this->performTask($user);\n" +"});" +msgstr "" + +# CODE +#: ./docs/11.x/artisan.md:461 +#: ./docs/master/artisan.md:448 +msgid "use Symfony\\Component\\Console\\Input\\InputInterface;\n" "use Symfony\\Component\\Console\\Output\\OutputInterface;\n" "use function Laravel\\Prompts\\confirm;\n\n" "// ...\n\n" "/**\n" " * Perform actions after the user was prompted for missing arguments.\n" -" *\n" -" * @param \\Symfony\\Component\\Console\\Input\\InputInterface $input\n" -" * @param \\Symfony\\Component\\Console\\Output\\OutputInterface $output\n" -" * @return void\n" " */\n" -"protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)\n" +"protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output): void\n" "{\n" " $input->setOption('queue', confirm(\n" " label: 'Would you like to queue the mail?',\n" " default: $this->option('queue')\n" " ));\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/artisan.md:block 142 (header) -msgid "Command I/O" -msgstr "指令 I/O" +# P +#: ./docs/8.x/artisan.md:466 +#: ./docs/9.x/artisan.md:535 +#: ./docs/10.x/artisan.md:635 +#: ./docs/11.x/artisan.md:636 +#: ./docs/master/artisan.md:623 +msgid "Sometimes, you may need more manual control over how a progress bar is advanced. First, define the total number of steps the process will iterate through. Then, advance the progress bar after processing each item:" +msgstr "" -#: docs/10.x/artisan.md:block 144 (header) -msgid "Retrieving Input" -msgstr "截取輸入" +# CODE +#: ./docs/8.x/artisan.md:468 +#: ./docs/9.x/artisan.md:537 +#: ./docs/10.x/artisan.md:637 +#: ./docs/11.x/artisan.md:638 +#: ./docs/master/artisan.md:625 +msgid "$users = App\\Models\\User::all();\n\n" +"$bar = $this->output->createProgressBar(count($users));\n\n" +"$bar->start();\n\n" +"foreach ($users as $user) {\n" +" $this->performTask($user);\n\n" +" $bar->advance();\n" +"}\n\n" +"$bar->finish();" +msgstr "" -#: docs/10.x/artisan.md:block 145 (paragraph) -msgid "While your command is executing, you will likely need to access the values for the arguments and options accepted by your command. To do so, you may use the `argument` and `option` methods. If an argument or option does not exist, `null` will be returned:" -msgstr "指令執行時,我們通常需要存取這些指令所接收的引數與選項值。要截取這些值,可以使用 `argument` 與 `option` 方法。若引數或選項不存在,則會回傳 `null`:" +# P +#: ./docs/8.x/artisan.md:482 +#: ./docs/9.x/artisan.md:552 +#: ./docs/10.x/artisan.md:652 +msgid "For more advanced options, check out the [Symfony Progress Bar component documentation](https://symfony.com/doc/current/components/console/helpers/progressbar.html)." +msgstr "" -#: docs/10.x/artisan.md:block 146 (code) +# P +#: ./docs/8.x/artisan.md:484 +#: ./docs/9.x/artisan.md:554 +#: ./docs/10.x/artisan.md:654 +#: ./docs/11.x/artisan.md:655 +#: ./docs/master/artisan.md:642 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:485 +#: ./docs/11.x/artisan.md:486 +#: ./docs/master/artisan.md:473 msgid "/**\n" " * Execute the console command.\n" " */\n" "public function handle(): void\n" "{\n" " $userId = $this->argument('user');\n" -"}\n" -msgstr "/**\n" -" * Execute the console command.\n" -" */\n" -"public function handle(): void\n" -"{\n" -" $userId = $this->argument('user');\n" -"}\n" - -#: docs/10.x/artisan.md:block 147 (paragraph) -msgid "If you need to retrieve all of the arguments as an `array`, call the `arguments` method:" -msgstr "若要將所有引數截取為陣列,則可呼叫 `arguments` 方法:" - -#: docs/10.x/artisan.md:block 148 (code) -msgid "$arguments = $this->arguments();\n" -msgstr "$arguments = $this->arguments();\n" - -#: docs/10.x/artisan.md:block 149 (paragraph) -msgid "Options may be retrieved just as easily as arguments using the `option` method. To retrieve all of the options as an array, call the `options` method:" -msgstr "我們也可像截取引數一樣使用 `option` 方法來輕鬆地截取選項。若要將所有選項截取為陣列,請呼叫 `options` 方法:" - -#: docs/10.x/artisan.md:block 150 (code) -msgid "// Retrieve a specific option...\n" -"$queueName = $this->option('queue');\n\n" -"// Retrieve all options as an array...\n" -"$options = $this->options();\n" -msgstr "// 取得特定選項...\n" -"$queueName = $this->option('queue');\n\n" -"// 將所有選項作為陣列取得...\n" -"$options = $this->options();\n" - -#: docs/10.x/artisan.md:block 152 (header) -msgid "Prompting For Input" -msgstr "為輸入進行提示" +"}" +msgstr "" -#: docs/10.x/artisan.md:block 153 (quote) -msgid "**Note** [Laravel Prompts](/docs/{{version}}/prompts) is a PHP package for adding beautiful and user-friendly forms to your command-line applications, with browser-like features including placeholder text and validation." -msgstr "**Note** [Laravel Prompts](/docs/{{version}}/prompts) 是一個 PHP 套件,可用來在 CLI 應用程式中新增好看且對使用者友善的表單,並具有類似瀏覽器中的功能,如預留位置文字與表單驗證。" +# H2 +#: ./docs/8.x/artisan.md:485 +#: ./docs/9.x/artisan.md:555 +#: ./docs/10.x/artisan.md:655 +#: ./docs/11.x/artisan.md:656 +#: ./docs/master/artisan.md:643 +msgid "Registering Commands" +msgstr "" -#: docs/10.x/artisan.md:block 154 (paragraph) -msgid "In addition to displaying output, you may also ask the user to provide input during the execution of your command. The `ask` method will prompt the user with the given question, accept their input, and then return the user's input back to your command:" -msgstr "除了顯示輸出外,也可以在執行指令的過程中詢問使用者來提供輸入。`ask` 方法會提示使用者給定的問題,並接受使用者輸入,然後將使用者的輸入回傳至指令:" +# P +#: ./docs/8.x/artisan.md:487 +#: ./docs/9.x/artisan.md:557 +#: ./docs/10.x/artisan.md:657 +msgid "All of your console commands are registered within your application's `App\\Console\\Kernel` class, which is your application's \"console kernel\". Within the `commands` method of this class, you will see a call to the kernel's `load` method. The `load` method will scan the `app/Console/Commands` directory and automatically register each command it contains with Artisan. You are even free to make additional calls to the `load` method to scan other directories for Artisan commands:" +msgstr "" -#: docs/10.x/artisan.md:block 155 (code) +# CODE +#: ./docs/8.x/artisan.md:489 +#: ./docs/9.x/artisan.md:559 msgid "/**\n" -" * Execute the console command.\n" -" */\n" -"public function handle(): void\n" -"{\n" -" $name = $this->ask('What is your name?');\n\n" -" // ...\n" -"}\n" -msgstr "/**\n" -" * Execute the console command.\n" +" * Register the commands for the application.\n" +" *\n" +" * @return void\n" " */\n" -"public function handle(): void\n" +"protected function commands()\n" "{\n" -" $name = $this->ask('What is your name?');\n\n" -" // ...\n" -"}\n" - -#: docs/10.x/artisan.md:block 156 (paragraph) -msgid "The `secret` method is similar to `ask`, but the user's input will not be visible to them as they type in the console. This method is useful when asking for sensitive information such as passwords:" -msgstr "`secret` 方法與 `ask` 類似,但使用者在指令列輸入的過程中將看不到他們自己的輸入值。這個方法適用於像使用者詢問如密碼等機密資訊的時候:" - -#: docs/10.x/artisan.md:block 157 (code) -msgid "$password = $this->secret('What is the password?');\n" -msgstr "$password = $this->secret('What is the password?');\n" - -#: docs/10.x/artisan.md:block 159 (header) -msgid "Asking For Confirmation" -msgstr "要求確認" - -#: docs/10.x/artisan.md:block 160 (paragraph) -msgid "If you need to ask the user for a simple \"yes or no\" confirmation, you may use the `confirm` method. By default, this method will return `false`. However, if the user enters `y` or `yes` in response to the prompt, the method will return `true`." -msgstr "若需要使用者回答簡單的「yes / no」的確認問題,可以使用 `confirm` 方法。預設情況下,這個方法會回傳 `false`,但若使用者在提示時輸入 `y` 或 `yes`,則該方法會回傳 `true`。" - -#: docs/10.x/artisan.md:block 161 (code) -msgid "if ($this->confirm('Do you wish to continue?')) {\n" -" // ...\n" -"}\n" -msgstr "if ($this->confirm('Do you wish to continue?')) {\n" -" // ...\n" -"}\n" - -#: docs/10.x/artisan.md:block 162 (paragraph) -msgid "If necessary, you may specify that the confirmation prompt should return `true` by default by passing `true` as the second argument to the `confirm` method:" -msgstr "若有必要,也可以通過將 `true` 傳入為 `confirm` 方法的第二個引數來指定讓確認提示預設回傳 `true`:" - -#: docs/10.x/artisan.md:block 163 (code) -msgid "if ($this->confirm('Do you wish to continue?', true)) {\n" -" // ...\n" -"}\n" -msgstr "if ($this->confirm('Do you wish to continue?', true)) {\n" +" $this->load(__DIR__.'/Commands');\n" +" $this->load(__DIR__.'/../Domain/Orders/Commands');\n\n" " // ...\n" -"}\n" - -#: docs/10.x/artisan.md:block 165 (header) -msgid "Auto-Completion" -msgstr "自動補全" - -#: docs/10.x/artisan.md:block 166 (paragraph) -msgid "The `anticipate` method can be used to provide auto-completion for possible choices. The user can still provide any answer, regardless of the auto-completion hints:" -msgstr "`anticipate` 方法可以用來為可能的選項提供自動補全。不論自動補全提示了什麼,使用者一樣可以提供任意回答:" - -#: docs/10.x/artisan.md:block 167 (code) -msgid "$name = $this->anticipate('What is your name?', ['Taylor', 'Dayle']);\n" -msgstr "$name = $this->anticipate('What is your name?', ['Taylor', 'Dayle']);\n" - -#: docs/10.x/artisan.md:block 168 (paragraph) -msgid "Alternatively, you may pass a closure as the second argument to the `anticipate` method. The closure will be called each time the user types an input character. The closure should accept a string parameter containing the user's input so far, and return an array of options for auto-completion:" -msgstr "另外,也可以將一個閉包傳給 `anticipate` 方法的第二個引數。這個閉包會在每次使用者輸入字元的時候被呼叫。該閉包應接受一個字串參數,其中包含了目前使用者的輸入值,並回傳用於自動補全的選項陣列:" - -#: docs/10.x/artisan.md:block 169 (code) -msgid "$name = $this->anticipate('What is your address?', function (string $input) {\n" -" // Return auto-completion options...\n" -"});\n" -msgstr "$name = $this->anticipate('What is your address?', function (string $input) {\n" -" // 回傳自動補全的選項...\n" -"});\n" - -#: docs/10.x/artisan.md:block 171 (header) -msgid "Multiple Choice Questions" -msgstr "多重選擇問題" +"}" +msgstr "" -#: docs/10.x/artisan.md:block 172 (paragraph) -msgid "If you need to give the user a predefined set of choices when asking a question, you may use the `choice` method. You may set the array index of the default value to be returned if no option is chosen by passing the index as the third argument to the method:" -msgstr "若需要在詢問問題時為提供使用者一組預先定義的選項,可以使用 `choice` 方法。也可以通過將預設選項的陣列索引傳給該方法的第三個參數,來指定沒有選擇任何選項時要回傳的預設值:" +# P +#: ./docs/8.x/artisan.md:502 +#: ./docs/9.x/artisan.md:572 +#: ./docs/10.x/artisan.md:670 +msgid "If necessary, you may manually register commands by adding the command's class name to a `$commands` property within your `App\\Console\\Kernel` class. If this property is not already defined on your kernel, you should define it manually. When Artisan boots, all the commands listed in this property will be resolved by the [service container](/docs/{{version}}/container) and registered with Artisan:" +msgstr "" -#: docs/10.x/artisan.md:block 173 (code) -msgid "$name = $this->choice(\n" -" 'What is your name?',\n" -" ['Taylor', 'Dayle'],\n" -" $defaultIndex\n" -");\n" -msgstr "$name = $this->choice(\n" -" 'What is your name?',\n" -" ['Taylor', 'Dayle'],\n" -" $defaultIndex\n" -");\n" +# CODE +#: ./docs/8.x/artisan.md:504 +#: ./docs/9.x/artisan.md:574 +#: ./docs/10.x/artisan.md:672 +msgid "protected $commands = [\n" +" Commands\\SendEmails::class\n" +"];" +msgstr "" -#: docs/10.x/artisan.md:block 174 (paragraph) -msgid "In addition, the `choice` method accepts optional fourth and fifth arguments for determining the maximum number of attempts to select a valid response and whether multiple selections are permitted:" -msgstr "另外,`choice` 方法也接受第 4 個與第 5 個引數,這兩個引數分別是用來判斷選擇有效回答的最大嘗試次數,以及是否允許多重選擇:" +# H3 +#: ./docs/10.x/artisan.md:506 +#: ./docs/11.x/artisan.md:507 +#: ./docs/master/artisan.md:494 +msgid "Prompting for Input" +msgstr "" -#: docs/10.x/artisan.md:block 175 (code) -msgid "$name = $this->choice(\n" -" 'What is your name?',\n" -" ['Taylor', 'Dayle'],\n" -" $defaultIndex,\n" -" $maxAttempts = null,\n" -" $allowMultipleSelections = false\n" -");\n" -msgstr "$name = $this->choice(\n" -" 'What is your name?',\n" -" ['Taylor', 'Dayle'],\n" -" $defaultIndex,\n" -" $maxAttempts = null,\n" -" $allowMultipleSelections = false\n" -");\n" +# P +#: ./docs/8.x/artisan.md:508 +#: ./docs/9.x/artisan.md:578 +#: ./docs/10.x/artisan.md:676 +#: ./docs/11.x/artisan.md:674 +#: ./docs/master/artisan.md:661 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/artisan.md:509 +#: ./docs/11.x/artisan.md:510 +#: ./docs/master/artisan.md:497 +msgid "[Laravel Prompts](/docs/{{version}}/prompts) is a PHP package for adding beautiful and user-friendly forms to your command-line applications, with browser-like features including placeholder text and validation." +msgstr "" -#: docs/10.x/artisan.md:block 177 (header) -msgid "Writing Output" -msgstr "撰寫輸出" +# H2 +#: ./docs/8.x/artisan.md:509 +#: ./docs/9.x/artisan.md:579 +#: ./docs/10.x/artisan.md:677 +#: ./docs/11.x/artisan.md:675 +#: ./docs/master/artisan.md:662 +msgid "Programmatically Executing Commands" +msgstr "" -#: docs/10.x/artisan.md:block 178 (paragraph) -msgid "To send output to the console, you may use the `line`, `info`, `comment`, `question`, `warn`, and `error` methods. Each of these methods will use appropriate ANSI colors for their purpose. For example, let's display some general information to the user. Typically, the `info` method will display in the console as green colored text:" -msgstr "若要將輸出傳送至主控台,可以使用 `line`, `info`, `comment`, `question`, `warn` 與 `error` 方法。這幾個方法會依不同目的來使用適當的 ANSI 色彩。舉例來說,我們來顯示一些一般的資訊給使用者看。通常來說,`info` 方法會在主控台上顯示出綠色的文字:" +# P +#: ./docs/8.x/artisan.md:511 +#: ./docs/9.x/artisan.md:581 +#: ./docs/10.x/artisan.md:679 +#: ./docs/11.x/artisan.md:677 +#: ./docs/master/artisan.md:664 +msgid "Sometimes you may wish to execute an Artisan command outside of the CLI. For example, you may wish to execute an Artisan command from a route or controller. You may use the `call` method on the `Artisan` facade to accomplish this. The `call` method accepts either the command's signature name or class name as its first argument, and an array of command parameters as the second argument. The exit code will be returned:" +msgstr "" -#: docs/10.x/artisan.md:block 179 (code) +# CODE +#: ./docs/10.x/artisan.md:513 +#: ./docs/11.x/artisan.md:514 +#: ./docs/master/artisan.md:501 msgid "/**\n" " * Execute the console command.\n" " */\n" "public function handle(): void\n" "{\n" -" // ...\n\n" -" $this->info('The command was successful!');\n" -"}\n" -msgstr "/**\n" -" * Execute the console command.\n" -" */\n" -"public function handle(): void\n" -"{\n" -" // ...\n\n" -" $this->info('The command was successful!');\n" -"}\n" +" $name = $this->ask('What is your name?');\n\n" +" // ...\n" +"}" +msgstr "" -#: docs/10.x/artisan.md:block 180 (paragraph) -msgid "To display an error message, use the `error` method. Error message text is typically displayed in red:" -msgstr "若要顯示錯誤訊息,可以使用 `error` 方法。錯誤訊息文字通常會以紅色顯示:" +# CODE +#: ./docs/8.x/artisan.md:513 +#: ./docs/9.x/artisan.md:583 +msgid "use Illuminate\\Support\\Facades\\Artisan;\n\n" +"Route::post('/user/{user}/mail', function ($user) {\n" +" $exitCode = Artisan::call('mail:send', [\n" +" 'user' => $user, '--queue' => 'default'\n" +" ]);\n\n" +" //\n" +"});" +msgstr "" -#: docs/10.x/artisan.md:block 181 (code) -msgid "$this->error('Something went wrong!');\n" -msgstr "$this->error('Something went wrong!');\n" +# P +#: ./docs/10.x/artisan.md:523 +#: ./docs/11.x/artisan.md:524 +#: ./docs/master/artisan.md:511 +msgid "The `ask` method also accepts an optional second argument which specifies the default value that should be returned if no user input is provided:" +msgstr "" -#: docs/10.x/artisan.md:block 182 (paragraph) -msgid "You may use the `line` method to display plain, uncolored text:" -msgstr "也可以使用 `line` 方法來顯示未標示色彩的純文字:" +# P +#: ./docs/8.x/artisan.md:523 +#: ./docs/9.x/artisan.md:593 +#: ./docs/10.x/artisan.md:691 +#: ./docs/11.x/artisan.md:689 +#: ./docs/master/artisan.md:676 +msgid "Alternatively, you may pass the entire Artisan command to the `call` method as a string:" +msgstr "" -#: docs/10.x/artisan.md:block 183 (code) -msgid "$this->line('Display this on the screen');\n" -msgstr "$this->line('Display this on the screen');\n" +# CODE +#: ./docs/10.x/artisan.md:525 +#: ./docs/11.x/artisan.md:526 +#: ./docs/master/artisan.md:513 +msgid "$name = $this->ask('What is your name?', 'Taylor');" +msgstr "" -#: docs/10.x/artisan.md:block 184 (paragraph) -msgid "You may use the `newLine` method to display a blank line:" -msgstr "可以使用 `newLine` 方法來顯示空行:" +# CODE +#: ./docs/8.x/artisan.md:525 +#: ./docs/9.x/artisan.md:595 +#: ./docs/10.x/artisan.md:693 +#: ./docs/11.x/artisan.md:691 +#: ./docs/master/artisan.md:678 +msgid "Artisan::call('mail:send 1 --queue=default');" +msgstr "" -#: docs/10.x/artisan.md:block 185 (code) -msgid "// Write a single blank line...\n" -"$this->newLine();\n\n" -"// Write three blank lines...\n" -"$this->newLine(3);\n" -msgstr "// 寫入一行空行...\n" -"$this->newLine();\n\n" -"// 寫入三行空行...\n" -"$this->newLine(3);\n" +# P +#: ./docs/8.x/artisan.md:527 +#: ./docs/9.x/artisan.md:597 +#: ./docs/10.x/artisan.md:695 +#: ./docs/11.x/artisan.md:693 +#: ./docs/master/artisan.md:680 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:528 +#: ./docs/9.x/artisan.md:598 +#: ./docs/10.x/artisan.md:696 +#: ./docs/11.x/artisan.md:694 +#: ./docs/master/artisan.md:681 +msgid "Passing Array Values" +msgstr "" -#: docs/10.x/artisan.md:block 187 (header) -msgid "Tables" -msgstr "表格" +# P +#: ./docs/8.x/artisan.md:530 +#: ./docs/9.x/artisan.md:600 +#: ./docs/10.x/artisan.md:698 +#: ./docs/11.x/artisan.md:696 +#: ./docs/master/artisan.md:683 +msgid "If your command defines an option that accepts an array, you may pass an array of values to that option:" +msgstr "" -#: docs/10.x/artisan.md:block 188 (paragraph) -msgid "The `table` method makes it easy to correctly format multiple rows / columns of data. All you need to do is provide the column names and the data for the table and Laravel will automatically calculate the appropriate width and height of the table for you:" -msgstr "通過 `table` 方法可以很輕鬆地正確為多行列資料進行格式化。只需要提供表格的欄位名稱與表格的資料,Laravel 就會自動計算適當的表格寬高:" +# H4 +#: ./docs/10.x/artisan.md:532 +#: ./docs/11.x/artisan.md:533 +#: ./docs/master/artisan.md:520 +msgid "Asking for Confirmation" +msgstr "" -#: docs/10.x/artisan.md:block 189 (code) -msgid "use App\\Models\\User;\n\n" -"$this->table(\n" -" ['Name', 'Email'],\n" -" User::all(['name', 'email'])->toArray()\n" -");\n" -msgstr "use App\\Models\\User;\n\n" -"$this->table(\n" -" ['Name', 'Email'],\n" -" User::all(['name', 'email'])->toArray()\n" -");\n" +# CODE +#: ./docs/8.x/artisan.md:532 +#: ./docs/9.x/artisan.md:602 +#: ./docs/10.x/artisan.md:700 +#: ./docs/11.x/artisan.md:698 +#: ./docs/master/artisan.md:685 +msgid "use Illuminate\\Support\\Facades\\Artisan;\n\n" +"Route::post('/mail', function () {\n" +" $exitCode = Artisan::call('mail:send', [\n" +" '--id' => [5, 13]\n" +" ]);\n" +"});" +msgstr "" -#: docs/10.x/artisan.md:block 191 (header) -msgid "Progress Bars" -msgstr "進度列" +# CODE +#: ./docs/10.x/artisan.md:536 +#: ./docs/11.x/artisan.md:537 +#: ./docs/master/artisan.md:524 +msgid "if ($this->confirm('Do you wish to continue?')) {\n" +" // ...\n" +"}" +msgstr "" -#: docs/10.x/artisan.md:block 192 (paragraph) -msgid "For long running tasks, it can be helpful to show a progress bar that informs users how complete the task is. Using the `withProgressBar` method, Laravel will display a progress bar and advance its progress for each iteration over a given iterable value:" -msgstr "當有需要長時間執行的任務時,最好顯示一個能告訴使用者目前任務完成度的進度列。使用 `withProgressBar` 方法,Laravel 就會顯示出一個進度列,並在每次迭代過指定的迭代值時增加進度列的進度:" +# P +#: ./docs/8.x/artisan.md:540 +#: ./docs/9.x/artisan.md:610 +#: ./docs/10.x/artisan.md:708 +#: ./docs/11.x/artisan.md:706 +#: ./docs/master/artisan.md:693 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:541 +#: ./docs/9.x/artisan.md:611 +#: ./docs/10.x/artisan.md:709 +#: ./docs/11.x/artisan.md:707 +#: ./docs/master/artisan.md:694 +msgid "Passing Boolean Values" +msgstr "" -#: docs/10.x/artisan.md:block 193 (code) -msgid "use App\\Models\\User;\n\n" -"$users = $this->withProgressBar(User::all(), function (User $user) {\n" -" $this->performTask($user);\n" -"});\n" -msgstr "use App\\Models\\User;\n\n" -"$users = $this->withProgressBar(User::all(), function (User $user) {\n" -" $this->performTask($user);\n" -"});\n" - -#: docs/10.x/artisan.md:block 194 (paragraph) -msgid "Sometimes, you may need more manual control over how a progress bar is advanced. First, define the total number of steps the process will iterate through. Then, advance the progress bar after processing each item:" -msgstr "有時候,我們可能需要手動控制進度列何時需要增加。首先,我們先定義整個過程所需要迭代的次數。接著,在每個項目處理完後增加進度:" - -#: docs/10.x/artisan.md:block 195 (code) -msgid "$users = App\\Models\\User::all();\n\n" -"$bar = $this->output->createProgressBar(count($users));\n\n" -"$bar->start();\n\n" -"foreach ($users as $user) {\n" -" $this->performTask($user);\n\n" -" $bar->advance();\n" -"}\n\n" -"$bar->finish();\n" -msgstr "$users = App\\Models\\User::all();\n\n" -"$bar = $this->output->createProgressBar(count($users));\n\n" -"$bar->start();\n\n" -"foreach ($users as $user) {\n" -" $this->performTask($user);\n\n" -" $bar->advance();\n" -"}\n\n" -"$bar->finish();\n" - -#: docs/10.x/artisan.md:block 196 (quote) -msgid "**Note** For more advanced options, check out the [Symfony Progress Bar component documentation](https://symfony.com/doc/current/components/console/helpers/progressbar.html)." -msgstr "**Note** 有關更進階的選項,請參考 [Symfony Progress Bar 元件說明文件](https://symfony.com/doc/current/components/console/helpers/progressbar.html)。" - -#: docs/10.x/artisan.md:block 198 (header) -msgid "Registering Commands" -msgstr "註冊指令" - -#: docs/10.x/artisan.md:block 199 (paragraph) -msgid "All of your console commands are registered within your application's `App\\Console\\Kernel` class, which is your application's \"console kernel\". Within the `commands` method of this class, you will see a call to the kernel's `load` method. The `load` method will scan the `app/Console/Commands` directory and automatically register each command it contains with Artisan. You are even free to make additional calls to the `load` method to scan other directories for Artisan commands:" -msgstr "所有主控台指令都在 `App\\Console\\Kernel` 類別內自動註冊。該類別為專案的「主控台核心」。在該類別的 `commands` 方法內,可以看到一個核心 `load` 方法的呼叫。`load` 方法會掃描 `app/Console/Commands` 目錄並自動向 Artisan 註冊其中的各個指令。你也可以在 `load` 方法中加上額外的呼叫來掃描其他目錄中的 Artisan 指令:" - -#: docs/10.x/artisan.md:block 200 (code) -msgid "/**\n" -" * Register the commands for the application.\n" -" */\n" -"protected function commands(): void\n" -"{\n" -" $this->load(__DIR__.'/Commands');\n" -" $this->load(__DIR__.'/../Domain/Orders/Commands');\n\n" -" // ...\n" -"}\n" -msgstr "/**\n" -" * Register the commands for the application.\n" -" */\n" -"protected function commands(): void\n" -"{\n" -" $this->load(__DIR__.'/Commands');\n" -" $this->load(__DIR__.'/../Domain/Orders/Commands');\n\n" -" // ...\n" -"}\n" - -#: docs/10.x/artisan.md:block 201 (paragraph) -msgid "If necessary, you may manually register commands by adding the command's class name to a `$commands` property within your `App\\Console\\Kernel` class. If this property is not already defined on your kernel, you should define it manually. When Artisan boots, all the commands listed in this property will be resolved by the [service container](/docs/{{version}}/container) and registered with Artisan:" -msgstr "若有需要的話,也可以通過將指令的類別名稱加至 `App\\Console\\Kernel` 類別的 `$commands` 屬性來手動註冊指令。若該屬性不存在,你可以手動建立。當 Artisan 啟動時,列在該屬性上的所有指令都會由 [Service Container](/docs/{{version}}/container) 進行解析,並向 Artisan 註冊:" - -#: docs/10.x/artisan.md:block 202 (code) -msgid "protected $commands = [\n" -" Commands\\SendEmails::class\n" -"];\n" -msgstr "protected $commands = [\n" -" Commands\\SendEmails::class\n" -"];\n" - -#: docs/10.x/artisan.md:block 204 (header) -msgid "Programmatically Executing Commands" -msgstr "通過程式碼執行指令" - -#: docs/10.x/artisan.md:block 205 (paragraph) -msgid "Sometimes you may wish to execute an Artisan command outside of the CLI. For example, you may wish to execute an Artisan command from a route or controller. You may use the `call` method on the `Artisan` facade to accomplish this. The `call` method accepts either the command's signature name or class name as its first argument, and an array of command parameters as the second argument. The exit code will be returned:" -msgstr "有時候可能需要在 CLI 以外的地方執行 Artisan 指令。舉例來說,你可能會想在路由或控制器內執行 Artisan 指令。可以使用 `Artisan` Facade 的 `call` 方法來完成這一目標。可以傳入指令的簽章名稱或類別名稱給 `call` 方法的第一個引數,而指令的參數則可以陣列傳為第二個引數。指令的結束代碼(Exit Code)會被回傳:" - -#: docs/10.x/artisan.md:block 206 (code) -msgid "use Illuminate\\Support\\Facades\\Artisan;\n\n" -"Route::post('/user/{user}/mail', function (string $user) {\n" -" $exitCode = Artisan::call('mail:send', [\n" -" 'user' => $user, '--queue' => 'default'\n" -" ]);\n\n" -" // ...\n" -"});\n" -msgstr "use Illuminate\\Support\\Facades\\Artisan;\n\n" -"Route::post('/user/{user}/mail', function (string $user) {\n" -" $exitCode = Artisan::call('mail:send', [\n" -" 'user' => $user, '--queue' => 'default'\n" -" ]);\n\n" +# CODE +#: ./docs/10.x/artisan.md:542 +#: ./docs/11.x/artisan.md:543 +#: ./docs/master/artisan.md:530 +msgid "if ($this->confirm('Do you wish to continue?', true)) {\n" " // ...\n" -"});\n" - -#: docs/10.x/artisan.md:block 207 (paragraph) -msgid "Alternatively, you may pass the entire Artisan command to the `call` method as a string:" -msgstr "或者,也可以將整個 Artisan 指令作為字串傳給 `call` 方法:" - -#: docs/10.x/artisan.md:block 208 (code) -msgid "Artisan::call('mail:send 1 --queue=default');\n" -msgstr "Artisan::call('mail:send 1 --queue=default');\n" - -#: docs/10.x/artisan.md:block 210 (header) -msgid "Passing Array Values" -msgstr "傳入陣列值" - -#: docs/10.x/artisan.md:block 211 (paragraph) -msgid "If your command defines an option that accepts an array, you may pass an array of values to that option:" -msgstr "若指令有定義接受陣列的選項,則可將陣列傳給該選項:" - -#: docs/10.x/artisan.md:block 212 (code) -msgid "use Illuminate\\Support\\Facades\\Artisan;\n\n" -"Route::post('/mail', function () {\n" -" $exitCode = Artisan::call('mail:send', [\n" -" '--id' => [5, 13]\n" -" ]);\n" -"});\n" -msgstr "use Illuminate\\Support\\Facades\\Artisan;\n\n" -"Route::post('/mail', function () {\n" -" $exitCode = Artisan::call('mail:send', [\n" -" '--id' => [5, 13]\n" -" ]);\n" -"});\n" - -#: docs/10.x/artisan.md:block 214 (header) -msgid "Passing Boolean Values" -msgstr "傳入布林值" +"}" +msgstr "" -#: docs/10.x/artisan.md:block 215 (paragraph) +# P +#: ./docs/8.x/artisan.md:543 +#: ./docs/9.x/artisan.md:613 +#: ./docs/10.x/artisan.md:711 +#: ./docs/11.x/artisan.md:709 +#: ./docs/master/artisan.md:696 msgid "If you need to specify the value of an option that does not accept string values, such as the `--force` flag on the `migrate:refresh` command, you should pass `true` or `false` as the value of the option:" -msgstr "若有需要為不接受字串值的選項指定值,如 `migrate:refresh` 指令的 `--force` 旗標,則可以為該選項傳入 `true` 或 `false`:" +msgstr "" -#: docs/10.x/artisan.md:block 216 (code) +# CODE +#: ./docs/8.x/artisan.md:545 +#: ./docs/9.x/artisan.md:615 +#: ./docs/10.x/artisan.md:713 +#: ./docs/11.x/artisan.md:711 +#: ./docs/master/artisan.md:698 msgid "$exitCode = Artisan::call('migrate:refresh', [\n" -" '--force' => true,\n" -"]);\n" -msgstr "$exitCode = Artisan::call('migrate:refresh', [\n" -" '--force' => true,\n" -"]);\n" - -#: docs/10.x/artisan.md:block 218 (header) -msgid "Queueing Artisan Commands" -msgstr "將 Artisan 指令放入佇列" - -#: docs/10.x/artisan.md:block 219 (paragraph) -msgid "Using the `queue` method on the `Artisan` facade, you may even queue Artisan commands so they are processed in the background by your [queue workers](/docs/{{version}}/queues). Before using this method, make sure you have configured your queue and are running a queue listener:" -msgstr "只需要使用 `Artisan` Facade 的 `queue` 方法,就可以將 Artisan 指令放入佇列執行,這樣這個指令就會在 [佇列背景工作角色](/docs/{{version}}/queues) 內背景執行。在使用該方法前,請先確認是否已設定好佇列,且有執行佇列監聽程式:" - -#: docs/10.x/artisan.md:block 220 (code) -msgid "use Illuminate\\Support\\Facades\\Artisan;\n\n" -"Route::post('/user/{user}/mail', function (string $user) {\n" -" Artisan::queue('mail:send', [\n" -" 'user' => $user, '--queue' => 'default'\n" -" ]);\n\n" -" // ...\n" -"});\n" -msgstr "use Illuminate\\Support\\Facades\\Artisan;\n\n" -"Route::post('/user/{user}/mail', function (string $user) {\n" -" Artisan::queue('mail:send', [\n" -" 'user' => $user, '--queue' => 'default'\n" -" ]);\n\n" -" // ...\n" -"});\n" - -#: docs/10.x/artisan.md:block 221 (paragraph) -msgid "Using the `onConnection` and `onQueue` methods, you may specify the connection or queue the Artisan command should be dispatched to:" -msgstr "可以使用 `onConnection` 與 `onQueue` 方法來指定 Artisan 指令應分派到哪個連線或佇列上:" - -#: docs/10.x/artisan.md:block 222 (code) -msgid "Artisan::queue('mail:send', [\n" -" 'user' => 1, '--queue' => 'default'\n" -"])->onConnection('redis')->onQueue('commands');\n" -msgstr "Artisan::queue('mail:send', [\n" -" 'user' => 1, '--queue' => 'default'\n" -"])->onConnection('redis')->onQueue('commands');\n" - -#: docs/10.x/artisan.md:block 224 (header) -msgid "Calling Commands From Other Commands" -msgstr "在其他指令內執行指令" - -#: docs/10.x/artisan.md:block 225 (paragraph) -msgid "Sometimes you may wish to call other commands from an existing Artisan command. You may do so using the `call` method. This `call` method accepts the command name and an array of command arguments / options:" -msgstr "有時候可能需要在現有 Artisan 指令內執行另一個指令。可以通過呼叫 `call` 方法來完成。`call` 方法接受指令名稱與指令的引數與選項:" - -#: docs/10.x/artisan.md:block 226 (code) -msgid "/**\n" -" * Execute the console command.\n" -" */\n" -"public function handle(): void\n" -"{\n" -" $this->call('mail:send', [\n" -" 'user' => 1, '--queue' => 'default'\n" -" ]);\n\n" -" // ...\n" -"}\n" -msgstr "/**\n" -" * Execute the console command.\n" -" */\n" -"public function handle(): void\n" -"{\n" -" $this->call('mail:send', [\n" -" 'user' => 1, '--queue' => 'default'\n" -" ]);\n\n" -" // ...\n" -"}\n" - -#: docs/10.x/artisan.md:block 227 (paragraph) -msgid "If you would like to call another console command and suppress all of its output, you may use the `callSilently` method. The `callSilently` method has the same signature as the `call` method:" -msgstr "若有需要呼叫另一個主控台指令並忽略其所有輸出,則可使用 `callSilently` 方法。`callSilently` 方法的簽章與 `call` 方法相同:" - -#: docs/10.x/artisan.md:block 228 (code) -msgid "$this->callSilently('mail:send', [\n" -" 'user' => 1, '--queue' => 'default'\n" -"]);\n" -msgstr "$this->callSilently('mail:send', [\n" -" 'user' => 1, '--queue' => 'default'\n" -"]);\n" - -#: docs/10.x/artisan.md:block 230 (header) -msgid "Signal Handling" -msgstr "處理訊號" - -#: docs/10.x/artisan.md:block 231 (paragraph) -msgid "As you may know, operating systems allow signals to be sent to running processes. For example, the `SIGTERM` signal is how operating systems ask a program to terminate. If you wish to listen for signals in your Artisan console commands and execute code when they occur, you may use the `trap` method:" -msgstr "讀者可能已經知道,在作業系統中,我們可以傳送訊號 (Signal) 給正在執行的處理程序。舉例來說,作業系統會使用 `SIGTERM` 訊號來要求某個程式停止執行。若想在 Artisan 主控台指令上監聽這些訊號,可使用 `trap` 方法:" - -#: docs/10.x/artisan.md:block 232 (code) -msgid "/**\n" -" * Execute the console command.\n" -" */\n" -"public function handle(): void\n" -"{\n" -" $this->trap(SIGTERM, fn () => $this->shouldKeepRunning = false);\n\n" -" while ($this->shouldKeepRunning) {\n" -" // ...\n" -" }\n" -"}\n" -msgstr "/**\n" -" * Execute the console command.\n" -" */\n" -"public function handle(): void\n" -"{\n" -" $this->trap(SIGTERM, fn () => $this->shouldKeepRunning = false);\n\n" -" while ($this->shouldKeepRunning) {\n" -" // ...\n" -" }\n" -"}\n" - -#: docs/10.x/artisan.md:block 233 (paragraph) -msgid "To listen for multiple signals at once, you may provide an array of signals to the `trap` method:" -msgstr "若要同時監聽多個訊號,可提供一組訊號的陣列給 `trap` 方法:" - -#: docs/10.x/artisan.md:block 234 (code) -msgid "$this->trap([SIGTERM, SIGQUIT], function (int $signal) {\n" -" $this->shouldKeepRunning = false;\n\n" -" dump($signal); // SIGTERM / SIGQUIT\n" -"});\n" -msgstr "$this->trap([SIGTERM, SIGQUIT], function (int $signal) {\n" -" $this->shouldKeepRunning = false;\n\n" -" dump($signal); // SIGTERM / SIGQUIT\n" -"});\n" - -#: docs/10.x/artisan.md:block 236 (header) -msgid "Stub Customization" -msgstr "自訂 Stub" - -#: docs/10.x/artisan.md:block 237 (paragraph) -msgid "The Artisan console's `make` commands are used to create a variety of classes, such as controllers, jobs, migrations, and tests. These classes are generated using \"stub\" files that are populated with values based on your input. However, you may want to make small changes to files generated by Artisan. To accomplish this, you may use the `stub:publish` command to publish the most common stubs to your application so that you can customize them:" -msgstr "Artisan 主控台的 `make` 指令可以用來建立各種類別,如控制器、任務、資料庫遷移,以及測試。這些類別都是使用「Stub (虛設常式)」來產生的,Stub 會依據給定的輸入來填入不同的值。不過,你可能會想對這些 Artisan 產生的檔案做一些微調。要修改這些 Stub,可以通過 `stub:publish` 指令來將這些最常見的 Stub 安裝到專案中,如此一來就能自訂這些 Stub:" - -#: docs/10.x/artisan.md:block 238 (code) -msgid "php artisan stub:publish\n" -msgstr "php artisan stub:publish\n" - -#: docs/10.x/artisan.md:block 239 (paragraph) -msgid "The published stubs will be located within a `stubs` directory in the root of your application. Any changes you make to these stubs will be reflected when you generate their corresponding classes using Artisan's `make` commands." -msgstr "安裝的 Stub 會被放在專案根目錄的 `stubs` 目錄中。對這些 Stub 做出的任何改動都會反應到使用 Artisan 的 `make` 指令所產生的對應類別上。" - -#: docs/10.x/artisan.md:block 241 (header) -msgid "Events" -msgstr "事件" - -#: docs/10.x/artisan.md:block 242 (paragraph) -msgid "Artisan dispatches three events when running commands: `Illuminate\\Console\\Events\\ArtisanStarting`, `Illuminate\\Console\\Events\\CommandStarting`, and `Illuminate\\Console\\Events\\CommandFinished`. The `ArtisanStarting` event is dispatched immediately when Artisan starts running. Next, the `CommandStarting` event is dispatched immediately before a command runs. Finally, the `CommandFinished` event is dispatched once a command finishes executing." -msgstr "Artisan 會在執行指令的時候分派三個事件: `Illuminate\\Console\\Events\\ArtisanStarting`, `Illuminate\\Console\\Events\\CommandStarting` 與 `Illuminate\\Console\\Events\\CommandFinished`。`ArtisanStarting` 事件會在 Artisan 開始執行後馬上被分派。接著,`CommandStarting` 事件會在指令開始執行前的瞬間被分派。最後,`CommandFinished` 事件會在指令完成執行後被分派。" - -#: docs/8.x/artisan.md:block 12 (code) -msgid "./sail artisan list\n" -msgstr "./sail artisan list\n" - -#: docs/8.x/artisan.md:block 20 (quote) -msgid "{tip} Looking for a graphical UI for interacting with your Laravel application? Check out [Tinkerwell](https://tinkerwell.app)!" -msgstr "{tip} 想找個能與你的 Laravel 應用程式互動的圖形化 UI 嗎?試試 [Tinkerwell](https://tinkerwell.app) 吧!" - -#: docs/8.x/artisan.md:block 27 (quote) -msgid "{note} The `dispatch` helper function and `dispatch` method on the `Dispatchable` class depends on garbage collection to place the job on the queue. Therefore, when using tinker, you should use `Bus::dispatch` or `Queue::push` to dispatch jobs." -msgstr "{note} `dispatch` 輔助函式與 `Dispatchable` 類別上的 `dispatch` 方法需要仰賴垃圾回收機制來將任務放進佇列中。因此,在使用 Tinker 時,應使用 `Bus::dispatch` 或 `Queue::push` 來分派任務。" - -#: docs/8.x/artisan.md:block 47 (code) -msgid "send(User::find($this->argument('user')));\n" -" }\n" -"}\n" -msgstr "send(User::find($this->argument('user')));\n" -" }\n" -"}\n" - -#: docs/8.x/artisan.md:block 48 (quote) -msgid "{tip} For greater code reuse, it is good practice to keep your console commands light and let them defer to application services to accomplish their tasks. In the example above, note that we inject a service class to do the \"heavy lifting\" of sending the e-mails." -msgstr "{tip} 為了提升程式碼重複使用率,最好保持主控台指令精簡,並將指令的任務委託給應用程式服務來完成。在上方的例子中,可以注意到我們插入了一個服務類別來處理寄送 E-Mail 的這個「重責大任」。" - -#: docs/8.x/artisan.md:block 52 (code) -msgid "/**\n" -" * Register the closure based commands for the application.\n" -" *\n" -" * @return void\n" -" */\n" -"protected function commands()\n" -"{\n" -" require base_path('routes/console.php');\n" -"}\n" -msgstr "/**\n" -" * Register the closure based commands for the application.\n" -" *\n" -" * @return void\n" -" */\n" -"protected function commands()\n" -"{\n" -" require base_path('routes/console.php');\n" -"}\n" - -#: docs/8.x/artisan.md:block 54 (code) -msgid "Artisan::command('mail:send {user}', function ($user) {\n" -" $this->info(\"Sending email to: {$user}!\");\n" -"});\n" -msgstr "Artisan::command('mail:send {user}', function ($user) {\n" -" $this->info(\"Sending email to: {$user}!\");\n" -"});\n" - -#: docs/8.x/artisan.md:block 59 (code) -msgid "use App\\Models\\User;\n" -"use App\\Support\\DripEmailer;\n\n" -"Artisan::command('mail:send {user}', function (DripEmailer $drip, $user) {\n" -" $drip->send(User::find($user));\n" -"});\n" -msgstr "use App\\Models\\User;\n" -"use App\\Support\\DripEmailer;\n\n" -"Artisan::command('mail:send {user}', function (DripEmailer $drip, $user) {\n" -" $drip->send(User::find($user));\n" -"});\n" - -#: docs/8.x/artisan.md:block 63 (code) -msgid "Artisan::command('mail:send {user}', function ($user) {\n" -" // ...\n" -"})->purpose('Send a marketing email to a user');\n" -msgstr "Artisan::command('mail:send {user}', function ($user) {\n" -" // ...\n" -"})->purpose('Send a marketing email to a user');\n" - -#: docs/8.x/artisan.md:block 72 (code) -msgid "// Optional argument...\n" -"mail:send {user?}\n\n" -"// Optional argument with default value...\n" -"mail:send {user=foo}\n" -msgstr "// 可選的引數...\n" -"mail:send {user?}\n\n" -"// 有預設值的可選引數...\n" -"mail:send {user=foo}\n" - -#: docs/8.x/artisan.md:block 86 (code) -msgid "mail:send {user} {--queue=default}\n" -msgstr "mail:send {user} {--queue=default}\n" - -#: docs/8.x/artisan.md:block 90 (code) -msgid "mail:send {user} {--Q|queue}\n" -msgstr "mail:send {user} {--Q|queue}\n" - -#: docs/8.x/artisan.md:block 91 (paragraph) -msgid "When invoking the command on your terminal, option shortcuts should be prefixed with a single hyphen:" -msgstr "在終端機內叫用指令時,應在選項捷徑前加上一個減號:" - -#: docs/8.x/artisan.md:block 92 (code) -msgid "php artisan mail:send 1 -Q\n" -msgstr "php artisan mail:send 1 -Q\n" - -#: docs/8.x/artisan.md:block 96 (code) -msgid "mail:send {user*}\n" -msgstr "mail:send {user*}\n" - -#: docs/8.x/artisan.md:block 97 (paragraph) -msgid "When calling this method, the `user` arguments may be passed in order to the command line. For example, the following command will set the value of `user` to an array with `foo` and `bar` as its values:" -msgstr "呼叫這個方法的時候,`user` 引數在指令列中可以按照順序傳入。舉例來說,下列指令會將 `user` 的值設為一個內容為 `foo` 與 `bar` 的陣列:" - -#: docs/8.x/artisan.md:block 98 (code) -msgid "php artisan mail:send foo bar\n" -msgstr "php artisan mail:send foo bar\n" - -#: docs/8.x/artisan.md:block 100 (code) -msgid "mail:send {user?*}\n" -msgstr "mail:send {user?*}\n" - -#: docs/8.x/artisan.md:block 104 (code) -msgid "mail:send {user} {--id=*}\n\n" -"php artisan mail:send --id=1 --id=2\n" -msgstr "mail:send {user} {--id=*}\n\n" -"php artisan mail:send --id=1 --id=2\n" - -#: docs/8.x/artisan.md:block 114 (code) -msgid "/**\n" -" * Execute the console command.\n" -" *\n" -" * @return int\n" -" */\n" -"public function handle()\n" -"{\n" -" $userId = $this->argument('user');\n\n" -" //\n" -"}\n" -msgstr "/**\n" -" * Execute the console command.\n" -" *\n" -" * @return int\n" -" */\n" -"public function handle()\n" -"{\n" -" $userId = $this->argument('user');\n\n" -" //\n" -"}\n" - -#: docs/8.x/artisan.md:block 122 (code) -msgid "/**\n" -" * Execute the console command.\n" -" *\n" -" * @return mixed\n" -" */\n" -"public function handle()\n" -"{\n" -" $name = $this->ask('What is your name?');\n" -"}\n" -msgstr "/**\n" -" * Execute the console command.\n" -" *\n" -" * @return mixed\n" -" */\n" -"public function handle()\n" -"{\n" -" $name = $this->ask('What is your name?');\n" -"}\n" - -#: docs/8.x/artisan.md:block 128 (code) -msgid "if ($this->confirm('Do you wish to continue?')) {\n" -" //\n" -"}\n" -msgstr "if ($this->confirm('Do you wish to continue?')) {\n" -" //\n" -"}\n" - -#: docs/8.x/artisan.md:block 130 (code) -msgid "if ($this->confirm('Do you wish to continue?', true)) {\n" -" //\n" -"}\n" -msgstr "if ($this->confirm('Do you wish to continue?', true)) {\n" -" //\n" -"}\n" - -#: docs/8.x/artisan.md:block 136 (code) -msgid "$name = $this->anticipate('What is your address?', function ($input) {\n" -" // Return auto-completion options...\n" -"});\n" -msgstr "$name = $this->anticipate('What is your address?', function ($input) {\n" -" // 回傳自動補全的選項...\n" -"});\n" - -#: docs/8.x/artisan.md:block 146 (code) -msgid "/**\n" -" * Execute the console command.\n" -" *\n" -" * @return mixed\n" -" */\n" -"public function handle()\n" -"{\n" -" // ...\n\n" -" $this->info('The command was successful!');\n" -"}\n" -msgstr "/**\n" -" * Execute the console command.\n" -" *\n" -" * @return mixed\n" -" */\n" -"public function handle()\n" -"{\n" -" // ...\n\n" -" $this->info('The command was successful!');\n" -"}\n" - -#: docs/8.x/artisan.md:block 160 (code) -msgid "use App\\Models\\User;\n\n" -"$users = $this->withProgressBar(User::all(), function ($user) {\n" -" $this->performTask($user);\n" -"});\n" -msgstr "use App\\Models\\User;\n\n" -"$users = $this->withProgressBar(User::all(), function ($user) {\n" -" $this->performTask($user);\n" -"});\n" - -#: docs/8.x/artisan.md:block 163 (quote) -msgid "{tip} For more advanced options, check out the [Symfony Progress Bar component documentation](https://symfony.com/doc/current/components/console/helpers/progressbar.html)." -msgstr "{tip} 有關更進階的選項,請參考 [Symfony Progress Bar 元件說明文件](https://symfony.com/doc/current/components/console/helpers/progressbar.html)。" - -#: docs/8.x/artisan.md:block 167 (code) -msgid "/**\n" -" * Register the commands for the application.\n" -" *\n" -" * @return void\n" -" */\n" -"protected function commands()\n" -"{\n" -" $this->load(__DIR__.'/Commands');\n" -" $this->load(__DIR__.'/../Domain/Orders/Commands');\n\n" -" // ...\n" -"}\n" -msgstr "/**\n" -" * Register the commands for the application.\n" -" *\n" -" * @return void\n" -" */\n" -"protected function commands()\n" -"{\n" -" $this->load(__DIR__.'/Commands');\n" -" $this->load(__DIR__.'/../Domain/Orders/Commands');\n\n" -" // ...\n" -"}\n" +" '--force' => true,\n" +"]);" +msgstr "" -#: docs/8.x/artisan.md:block 173 (code) -msgid "use Illuminate\\Support\\Facades\\Artisan;\n\n" -"Route::post('/user/{user}/mail', function ($user) {\n" -" $exitCode = Artisan::call('mail:send', [\n" -" 'user' => $user, '--queue' => 'default'\n" -" ]);\n\n" -" //\n" -"});\n" -msgstr "use Illuminate\\Support\\Facades\\Artisan;\n\n" -"Route::post('/user/{user}/mail', function ($user) {\n" -" $exitCode = Artisan::call('mail:send', [\n" -" 'user' => $user, '--queue' => 'default'\n" -" ]);\n\n" -" //\n" -"});\n" +# P +#: ./docs/8.x/artisan.md:549 +#: ./docs/9.x/artisan.md:619 +#: ./docs/10.x/artisan.md:717 +#: ./docs/11.x/artisan.md:715 +#: ./docs/master/artisan.md:702 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/artisan.md:550 +#: ./docs/9.x/artisan.md:620 +#: ./docs/10.x/artisan.md:718 +#: ./docs/11.x/artisan.md:716 +#: ./docs/master/artisan.md:703 +msgid "Queueing Artisan Commands" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:552 +#: ./docs/9.x/artisan.md:622 +#: ./docs/10.x/artisan.md:720 +#: ./docs/11.x/artisan.md:718 +#: ./docs/master/artisan.md:705 +msgid "Using the `queue` method on the `Artisan` facade, you may even queue Artisan commands so they are processed in the background by your [queue workers](/docs/{{version}}/queues). Before using this method, make sure you have configured your queue and are running a queue listener:" +msgstr "" -#: docs/8.x/artisan.md:block 187 (code) +# CODE +#: ./docs/8.x/artisan.md:554 +#: ./docs/9.x/artisan.md:624 msgid "use Illuminate\\Support\\Facades\\Artisan;\n\n" "Route::post('/user/{user}/mail', function ($user) {\n" " Artisan::queue('mail:send', [\n" " 'user' => $user, '--queue' => 'default'\n" " ]);\n\n" " //\n" -"});\n" -msgstr "use Illuminate\\Support\\Facades\\Artisan;\n\n" -"Route::post('/user/{user}/mail', function ($user) {\n" -" Artisan::queue('mail:send', [\n" -" 'user' => $user, '--queue' => 'default'\n" -" ]);\n\n" -" //\n" -"});\n" +"});" +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:555 +#: ./docs/11.x/artisan.md:556 +#: ./docs/master/artisan.md:543 +msgid "$name = $this->anticipate('What is your address?', function (string $input) {\n" +" // Return auto-completion options...\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:564 +#: ./docs/9.x/artisan.md:634 +#: ./docs/10.x/artisan.md:732 +#: ./docs/11.x/artisan.md:730 +#: ./docs/master/artisan.md:717 +msgid "Using the `onConnection` and `onQueue` methods, you may specify the connection or queue the Artisan command should be dispatched to:" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:566 +#: ./docs/9.x/artisan.md:636 +#: ./docs/10.x/artisan.md:734 +#: ./docs/11.x/artisan.md:732 +#: ./docs/master/artisan.md:719 +msgid "Artisan::queue('mail:send', [\n" +" 'user' => 1, '--queue' => 'default'\n" +"])->onConnection('redis')->onQueue('commands');" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:570 +#: ./docs/9.x/artisan.md:640 +#: ./docs/10.x/artisan.md:738 +#: ./docs/11.x/artisan.md:736 +#: ./docs/master/artisan.md:723 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/artisan.md:571 +#: ./docs/9.x/artisan.md:641 +#: ./docs/10.x/artisan.md:739 +#: ./docs/11.x/artisan.md:737 +#: ./docs/master/artisan.md:724 +msgid "Calling Commands From Other Commands" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:573 +#: ./docs/9.x/artisan.md:643 +#: ./docs/10.x/artisan.md:741 +#: ./docs/11.x/artisan.md:739 +#: ./docs/master/artisan.md:726 +msgid "Sometimes you may wish to call other commands from an existing Artisan command. You may do so using the `call` method. This `call` method accepts the command name and an array of command arguments / options:" +msgstr "" -#: docs/8.x/artisan.md:block 193 (code) +# CODE +#: ./docs/8.x/artisan.md:575 +#: ./docs/9.x/artisan.md:645 msgid "/**\n" " * Execute the console command.\n" " *\n" @@ -1764,29 +2732,73 @@ msgid "/**\n" " 'user' => 1, '--queue' => 'default'\n" " ]);\n\n" " //\n" -"}\n" -msgstr "/**\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:585 +#: ./docs/11.x/artisan.md:586 +#: ./docs/master/artisan.md:573 +msgid "/**\n" " * Execute the console command.\n" -" *\n" -" * @return mixed\n" " */\n" -"public function handle()\n" +"public function handle(): void\n" "{\n" -" $this->call('mail:send', [\n" -" 'user' => 1, '--queue' => 'default'\n" -" ]);\n\n" -" //\n" -"}\n" +" // ...\n\n" +" $this->info('The command was successful!');\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:589 +#: ./docs/9.x/artisan.md:659 +#: ./docs/10.x/artisan.md:755 +#: ./docs/11.x/artisan.md:753 +#: ./docs/master/artisan.md:740 +msgid "If you would like to call another console command and suppress all of its output, you may use the `callSilently` method. The `callSilently` method has the same signature as the `call` method:" +msgstr "" + +# CODE +#: ./docs/8.x/artisan.md:591 +#: ./docs/9.x/artisan.md:661 +#: ./docs/10.x/artisan.md:757 +#: ./docs/11.x/artisan.md:755 +#: ./docs/master/artisan.md:742 +msgid "$this->callSilently('mail:send', [\n" +" 'user' => 1, '--queue' => 'default'\n" +"]);" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:595 +#: ./docs/9.x/artisan.md:665 +#: ./docs/10.x/artisan.md:761 +#: ./docs/11.x/artisan.md:759 +#: ./docs/master/artisan.md:746 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/artisan.md:596 +#: ./docs/9.x/artisan.md:666 +#: ./docs/10.x/artisan.md:762 +#: ./docs/11.x/artisan.md:760 +#: ./docs/master/artisan.md:747 +msgid "Signal Handling" +msgstr "" -#: docs/8.x/artisan.md:block 198 (paragraph) +# P +#: ./docs/8.x/artisan.md:598 msgid "The Symfony Console component, which powers the Artisan console, allows you to indicate which process signals (if any) your command handles. For example, you may indicate that your command handles the `SIGINT` and `SIGTERM` signals." -msgstr "驅動 Artisan 主控台的 Symfony Console 能夠設定指令能處理那些處理程序訊號(若有的話)。舉例來說,你可能會想要讓指令能處理 `SIGINT` 與 `SIGTERM` 訊號。" +msgstr "" -#: docs/8.x/artisan.md:block 199 (paragraph) +# P +#: ./docs/8.x/artisan.md:600 msgid "To get started, you should implement the `Symfony\\Component\\Console\\Command\\SignalableCommandInterface` interface on your Artisan command class. This interface requires you to define two methods: `getSubscribedSignals` and `handleSignal`:" -msgstr "要開始處理訊號,請先在 Artisan 指令類別上實作 `Symfony\\Component\\Console\\Command\\SignalableCommandInterface` 介面。這個介面要求要定義兩個方法:`getSubscribedSignals` 與 `handleSignal` :" +msgstr "" -#: docs/8.x/artisan.md:block 200 (code) +# CODE: php +#: ./docs/8.x/artisan.md:602 msgid "stopServer();\n\n" -" return;\n" -" }\n" -" }\n" -"}\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:629 +#: ./docs/11.x/artisan.md:630 +#: ./docs/master/artisan.md:617 +msgid "use App\\Models\\User;\n\n" +"$users = $this->withProgressBar(User::all(), function (User $user) {\n" +" $this->performTask($user);\n" +"});" +msgstr "" -#: docs/8.x/artisan.md:block 201 (paragraph) +# P +#: ./docs/8.x/artisan.md:638 msgid "As you might expect, the `getSubscribedSignals` method should return an array of the signals that your command can handle, while the `handleSignal` method receives the signal and can respond accordingly." -msgstr "你可能已經看得出來,`getSubscribedSignals` 應回傳一個包含所有指令能處理訊號的陣列,而 `handleSignal` 則接收訊號並根據訊號進行回應。" +msgstr "" -#: docs/9.x/artisan.md:block 47 (code) -msgid "send(User::find($this->argument('user')));\n" -" }\n" -"}\n" -msgstr "send(User::find($this->argument('user')));\n" -" }\n" -"}\n" +# P +#: ./docs/8.x/artisan.md:640 +#: ./docs/9.x/artisan.md:692 +#: ./docs/10.x/artisan.md:786 +#: ./docs/11.x/artisan.md:784 +#: ./docs/master/artisan.md:771 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/artisan.md:641 +#: ./docs/9.x/artisan.md:693 +#: ./docs/10.x/artisan.md:787 +#: ./docs/11.x/artisan.md:785 +#: ./docs/master/artisan.md:772 +msgid "Stub Customization" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:643 +#: ./docs/9.x/artisan.md:695 +#: ./docs/10.x/artisan.md:789 +#: ./docs/11.x/artisan.md:787 +#: ./docs/master/artisan.md:774 +msgid "The Artisan console's `make` commands are used to create a variety of classes, such as controllers, jobs, migrations, and tests. These classes are generated using \"stub\" files that are populated with values based on your input. However, you may want to make small changes to files generated by Artisan. To accomplish this, you may use the `stub:publish` command to publish the most common stubs to your application so that you can customize them:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/artisan.md:645 +#: ./docs/9.x/artisan.md:697 +#: ./docs/10.x/artisan.md:791 +#: ./docs/11.x/artisan.md:789 +#: ./docs/master/artisan.md:776 +msgid "php artisan stub:publish" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:647 +#: ./docs/9.x/artisan.md:701 +#: ./docs/10.x/artisan.md:795 +#: ./docs/11.x/artisan.md:793 +#: ./docs/master/artisan.md:780 +msgid "The published stubs will be located within a `stubs` directory in the root of your application. Any changes you make to these stubs will be reflected when you generate their corresponding classes using Artisan's `make` commands." +msgstr "" + +# CODE +#: ./docs/master/artisan.md:647 +msgid "->withCommands([\n" +" __DIR__.'../app/Domain/Orders/Commands',\n" +"])" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:649 +#: ./docs/9.x/artisan.md:703 +#: ./docs/10.x/artisan.md:797 +#: ./docs/11.x/artisan.md:795 +#: ./docs/master/artisan.md:782 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/artisan.md:650 +#: ./docs/9.x/artisan.md:704 +#: ./docs/10.x/artisan.md:798 +#: ./docs/11.x/artisan.md:796 +#: ./docs/master/artisan.md:783 +msgid "Events" +msgstr "" + +# P +#: ./docs/8.x/artisan.md:652 +#: ./docs/9.x/artisan.md:706 +#: ./docs/10.x/artisan.md:800 +#: ./docs/11.x/artisan.md:798 +#: ./docs/master/artisan.md:785 +msgid "Artisan dispatches three events when running commands: `Illuminate\\Console\\Events\\ArtisanStarting`, `Illuminate\\Console\\Events\\CommandStarting`, and `Illuminate\\Console\\Events\\CommandFinished`. The `ArtisanStarting` event is dispatched immediately when Artisan starts running. Next, the `CommandStarting` event is dispatched immediately before a command runs. Finally, the `CommandFinished` event is dispatched once a command finishes executing." +msgstr "" + +# P +#: ./docs/11.x/artisan.md:653 +#: ./docs/master/artisan.md:640 +msgid "For more advanced options, check out the [Symfony Progress Bar component documentation](https://symfony.com/doc/7.0/components/console/helpers/progressbar.html)." +msgstr "" + +# P +#: ./docs/11.x/artisan.md:658 +#: ./docs/master/artisan.md:645 +msgid "By default, Laravel automatically registers all commands within the `app/Console/Commands` directory. However, you can instruct Laravel to scan other directories for Artisan commands using the `withCommands` method in your application's `bootstrap/app.php` file:" +msgstr "" -#: docs/9.x/artisan.md:block 76 (code) +# CODE +#: ./docs/10.x/artisan.md:659 msgid "/**\n" -" * Determine when an isolation lock expires for the command.\n" -" *\n" -" * @return \\DateTimeInterface|\\DateInterval\n" -" */\n" -"public function isolationLockExpiresAt()\n" -"{\n" -" return now()->addMinutes(5);\n" -"}\n" -msgstr "/**\n" -" * Determine when an isolation lock expires for the command.\n" -" *\n" -" * @return \\DateTimeInterface|\\DateInterval\n" +" * Register the commands for the application.\n" " */\n" -"public function isolationLockExpiresAt()\n" +"protected function commands(): void\n" "{\n" -" return now()->addMinutes(5);\n" -"}\n" +" $this->load(__DIR__.'/Commands');\n" +" $this->load(__DIR__.'/../Domain/Orders/Commands');\n\n" +" // ...\n" +"}" +msgstr "" + +# CODE +#: ./docs/11.x/artisan.md:660 +msgid "->withCommands([\n" +" __DIR__.'/../app/Domain/Orders/Commands',\n" +"])" +msgstr "" + +# P +#: ./docs/11.x/artisan.md:664 +#: ./docs/master/artisan.md:651 +msgid "If necessary, you may also manually register commands by providing the command's class name to the `withCommands` method:" +msgstr "" + +# CODE +#: ./docs/11.x/artisan.md:666 +#: ./docs/master/artisan.md:653 +msgid "use App\\Domain\\Orders\\Commands\\SendEmails;\n\n" +"->withCommands([\n" +" SendEmails::class,\n" +"])" +msgstr "" + +# P +#: ./docs/9.x/artisan.md:668 +#: ./docs/10.x/artisan.md:764 +#: ./docs/11.x/artisan.md:762 +#: ./docs/master/artisan.md:749 +msgid "As you may know, operating systems allow signals to be sent to running processes. For example, the `SIGTERM` signal is how operating systems ask a program to terminate. If you wish to listen for signals in your Artisan console commands and execute code when they occur, you may use the `trap` method:" +msgstr "" -#: docs/9.x/artisan.md:block 214 (code) +# CODE +#: ./docs/9.x/artisan.md:670 msgid "/**\n" " * Execute the console command.\n" " *\n" @@ -1942,27 +2992,96 @@ msgid "/**\n" " while ($this->shouldKeepRunning) {\n" " // ...\n" " }\n" -"}\n" -msgstr "/**\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/artisan.md:672 +#: ./docs/master/artisan.md:659 +msgid "When Artisan boots, all the commands in your application will be resolved by the [service container](/docs/{{version}}/container) and registered with Artisan." +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:681 +#: ./docs/11.x/artisan.md:679 +#: ./docs/master/artisan.md:666 +msgid "use Illuminate\\Support\\Facades\\Artisan;\n\n" +"Route::post('/user/{user}/mail', function (string $user) {\n" +" $exitCode = Artisan::call('mail:send', [\n" +" 'user' => $user, '--queue' => 'default'\n" +" ]);\n\n" +" // ...\n" +"});" +msgstr "" + +# P +#: ./docs/9.x/artisan.md:684 +#: ./docs/10.x/artisan.md:778 +#: ./docs/11.x/artisan.md:776 +#: ./docs/master/artisan.md:763 +msgid "To listen for multiple signals at once, you may provide an array of signals to the `trap` method:" +msgstr "" + +# CODE +#: ./docs/9.x/artisan.md:686 +msgid "$this->trap([SIGTERM, SIGQUIT], function ($signal) {\n" +" $this->shouldKeepRunning = false;\n\n" +" dump($signal); // SIGTERM / SIGQUIT\n" +"});" +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:722 +#: ./docs/11.x/artisan.md:720 +#: ./docs/master/artisan.md:707 +msgid "use Illuminate\\Support\\Facades\\Artisan;\n\n" +"Route::post('/user/{user}/mail', function (string $user) {\n" +" Artisan::queue('mail:send', [\n" +" 'user' => $user, '--queue' => 'default'\n" +" ]);\n\n" +" // ...\n" +"});" +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:743 +#: ./docs/11.x/artisan.md:741 +#: ./docs/master/artisan.md:728 +msgid "/**\n" " * Execute the console command.\n" -" *\n" -" * @return mixed\n" " */\n" -"public function handle()\n" +"public function handle(): void\n" +"{\n" +" $this->call('mail:send', [\n" +" 'user' => 1, '--queue' => 'default'\n" +" ]);\n\n" +" // ...\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/artisan.md:766 +#: ./docs/11.x/artisan.md:764 +#: ./docs/master/artisan.md:751 +msgid "/**\n" +" * Execute the console command.\n" +" */\n" +"public function handle(): void\n" "{\n" " $this->trap(SIGTERM, fn () => $this->shouldKeepRunning = false);\n\n" " while ($this->shouldKeepRunning) {\n" " // ...\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/9.x/artisan.md:block 216 (code) -msgid "$this->trap([SIGTERM, SIGQUIT], function ($signal) {\n" -" $this->shouldKeepRunning = false;\n\n" -" dump($signal); // SIGTERM / SIGQUIT\n" -"});\n" -msgstr "$this->trap([SIGTERM, SIGQUIT], function ($signal) {\n" +# CODE +#: ./docs/10.x/artisan.md:780 +#: ./docs/11.x/artisan.md:778 +#: ./docs/master/artisan.md:765 +msgid "$this->trap([SIGTERM, SIGQUIT], function (int $signal) {\n" " $this->shouldKeepRunning = false;\n\n" " dump($signal); // SIGTERM / SIGQUIT\n" -"});\n" +"});" +msgstr "" diff --git a/po/zh_TW/authentication.po b/po/zh_TW/authentication.po index b92c1e67b..8b5ffed84 100644 --- a/po/zh_TW/authentication.po +++ b/po/zh_TW/authentication.po @@ -10,338 +10,952 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" +"PO-Revision-Date: 2024-11-30 08:38\n" -#: docs/10.x/authentication.md:block 1 (header) +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "Event Name" +msgstr "" + +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "`Illuminate\\Auth\\Events\\Registered`" +msgstr "" + +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "`Illuminate\\Auth\\Events\\Attempting`" +msgstr "" + +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "`Illuminate\\Auth\\Events\\Authenticated`" +msgstr "" + +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "`Illuminate\\Auth\\Events\\Login`" +msgstr "" + +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "`Illuminate\\Auth\\Events\\Failed`" +msgstr "" + +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "`Illuminate\\Auth\\Events\\Validated`" +msgstr "" + +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "`Illuminate\\Auth\\Events\\Verified`" +msgstr "" + +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "`Illuminate\\Auth\\Events\\Logout`" +msgstr "" + +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "`Illuminate\\Auth\\Events\\CurrentDeviceLogout`" +msgstr "" + +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "`Illuminate\\Auth\\Events\\OtherDeviceLogout`" +msgstr "" + +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "`Illuminate\\Auth\\Events\\Lockout`" +msgstr "" + +# TD +#: ./docs/11.x/authentication.md +#: ./docs/master/authentication.md +msgid "`Illuminate\\Auth\\Events\\PasswordReset`" +msgstr "" + +# H1 +#: ./docs/8.x/authentication.md:1 +#: ./docs/9.x/authentication.md:1 +#: ./docs/10.x/authentication.md:1 +#: ./docs/11.x/authentication.md:1 +#: ./docs/master/authentication.md:1 msgid "Authentication" -msgstr "認證" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:3 +#: ./docs/9.x/authentication.md:3 +#: ./docs/10.x/authentication.md:3 +#: ./docs/11.x/authentication.md:3 +#: ./docs/master/authentication.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:4 +#: ./docs/9.x/authentication.md:4 +#: ./docs/10.x/authentication.md:4 +#: ./docs/11.x/authentication.md:4 +#: ./docs/master/authentication.md:4 msgid "[Starter Kits](#starter-kits)" -msgstr "[入門套件](#starter-kits)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:5 +#: ./docs/9.x/authentication.md:5 +#: ./docs/10.x/authentication.md:5 +#: ./docs/11.x/authentication.md:5 +#: ./docs/master/authentication.md:5 msgid "[Database Considerations](#introduction-database-considerations)" -msgstr "[資料庫選擇](#introduction-database-considerations)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:6 +#: ./docs/9.x/authentication.md:6 +#: ./docs/10.x/authentication.md:6 +#: ./docs/11.x/authentication.md:6 +#: ./docs/master/authentication.md:6 msgid "[Ecosystem Overview](#ecosystem-overview)" -msgstr "[生態鏈概覽](#ecosystem-overview)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:7 +#: ./docs/9.x/authentication.md:7 +#: ./docs/10.x/authentication.md:7 +#: ./docs/11.x/authentication.md:7 +#: ./docs/master/authentication.md:7 msgid "[Authentication Quickstart](#authentication-quickstart)" -msgstr "[「驗證」快速入門](#authentication-quickstart)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/10.x/authentication.md:8 +#: ./docs/11.x/authentication.md:8 +#: ./docs/master/authentication.md:8 +msgid "[Install a Starter Kit](#install-a-starter-kit)" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:8 +#: ./docs/9.x/authentication.md:8 msgid "[Install A Starter Kit](#install-a-starter-kit)" -msgstr "[安裝入門套件](#install-a-starter-kit)" +msgstr "" + +# P +#: ./docs/10.x/authentication.md:9 +#: ./docs/11.x/authentication.md:9 +#: ./docs/master/authentication.md:9 +msgid "[Retrieving the Authenticated User](#retrieving-the-authenticated-user)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:9 +#: ./docs/9.x/authentication.md:9 msgid "[Retrieving The Authenticated User](#retrieving-the-authenticated-user)" -msgstr "[取得已登入的使用者](#retrieving-the-authenticated-user)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:10 +#: ./docs/9.x/authentication.md:10 +#: ./docs/10.x/authentication.md:10 +#: ./docs/11.x/authentication.md:10 +#: ./docs/master/authentication.md:10 msgid "[Protecting Routes](#protecting-routes)" -msgstr "[受保護的 Route](#protecting-routes)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:11 +#: ./docs/9.x/authentication.md:11 +#: ./docs/10.x/authentication.md:11 +#: ./docs/11.x/authentication.md:11 +#: ./docs/master/authentication.md:11 msgid "[Login Throttling](#login-throttling)" -msgstr "[登入頻率限制](#login-throttling)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:12 +#: ./docs/9.x/authentication.md:12 +#: ./docs/10.x/authentication.md:12 +#: ./docs/11.x/authentication.md:12 +#: ./docs/master/authentication.md:12 msgid "[Manually Authenticating Users](#authenticating-users)" -msgstr "[手動登入使用者](#authenticating-users)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:13 +#: ./docs/9.x/authentication.md:13 +#: ./docs/10.x/authentication.md:13 +#: ./docs/11.x/authentication.md:13 +#: ./docs/master/authentication.md:13 msgid "[Remembering Users](#remembering-users)" -msgstr "[記住使用者](#remembering-users)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:14 +#: ./docs/9.x/authentication.md:14 +#: ./docs/10.x/authentication.md:14 +#: ./docs/11.x/authentication.md:14 +#: ./docs/master/authentication.md:14 msgid "[Other Authentication Methods](#other-authentication-methods)" -msgstr "[其他認證方法](#other-authentication-methods)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:15 +#: ./docs/9.x/authentication.md:15 +#: ./docs/10.x/authentication.md:15 +#: ./docs/11.x/authentication.md:15 +#: ./docs/master/authentication.md:15 msgid "[HTTP Basic Authentication](#http-basic-authentication)" -msgstr "[HTTP Basic 認證](#http-basic-authentication)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:16 +#: ./docs/9.x/authentication.md:16 +#: ./docs/10.x/authentication.md:16 +#: ./docs/11.x/authentication.md:16 +#: ./docs/master/authentication.md:16 msgid "[Stateless HTTP Basic Authentication](#stateless-http-basic-authentication)" -msgstr "[Stateless HTTP Basic 認證](#stateless-http-basic-authentication)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:17 +#: ./docs/9.x/authentication.md:17 +#: ./docs/10.x/authentication.md:17 +#: ./docs/11.x/authentication.md:17 +#: ./docs/master/authentication.md:17 msgid "[Logging Out](#logging-out)" -msgstr "[登出](#logging-out)" +msgstr "" + +# P +#: ./docs/10.x/authentication.md:18 +#: ./docs/11.x/authentication.md:18 +#: ./docs/master/authentication.md:18 +msgid "[Invalidating Sessions on Other Devices](#invalidating-sessions-on-other-devices)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:18 +#: ./docs/9.x/authentication.md:18 msgid "[Invalidating Sessions On Other Devices](#invalidating-sessions-on-other-devices)" -msgstr "[登出其他裝置上的工作階段](#invalidating-sessions-on-other-devices)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:19 +#: ./docs/9.x/authentication.md:19 +#: ./docs/10.x/authentication.md:19 +#: ./docs/11.x/authentication.md:19 +#: ./docs/master/authentication.md:19 msgid "[Password Confirmation](#password-confirmation)" -msgstr "[確認密碼](#password-confirmation)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:20 +#: ./docs/9.x/authentication.md:20 +#: ./docs/10.x/authentication.md:20 +#: ./docs/11.x/authentication.md:20 +#: ./docs/master/authentication.md:20 msgid "[Configuration](#password-confirmation-configuration)" -msgstr "[設定](#password-confirmation-configuration)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:21 +#: ./docs/9.x/authentication.md:21 +#: ./docs/10.x/authentication.md:21 +#: ./docs/11.x/authentication.md:21 +#: ./docs/master/authentication.md:21 msgid "[Routing](#password-confirmation-routing)" -msgstr "[路由](#password-confirmation-routing)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:22 +#: ./docs/9.x/authentication.md:22 +#: ./docs/10.x/authentication.md:22 +#: ./docs/11.x/authentication.md:22 +#: ./docs/master/authentication.md:22 msgid "[Protecting Routes](#password-confirmation-protecting-routes)" -msgstr "[保護 Route](#password-confirmation-protecting-routes)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:23 +#: ./docs/9.x/authentication.md:23 +#: ./docs/10.x/authentication.md:23 +#: ./docs/11.x/authentication.md:23 +#: ./docs/master/authentication.md:23 msgid "[Adding Custom Guards](#adding-custom-guards)" -msgstr "[新增自訂 Guard](#adding-custom-guards)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:24 +#: ./docs/9.x/authentication.md:24 +#: ./docs/10.x/authentication.md:24 +#: ./docs/11.x/authentication.md:24 +#: ./docs/master/authentication.md:24 msgid "[Closure Request Guards](#closure-request-guards)" -msgstr "[閉包的 Request Guard](#closure-request-guards)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:25 +#: ./docs/9.x/authentication.md:25 +#: ./docs/10.x/authentication.md:25 +#: ./docs/11.x/authentication.md:25 +#: ./docs/master/authentication.md:25 msgid "[Adding Custom User Providers](#adding-custom-user-providers)" -msgstr "[新增自訂的 User Provider](#adding-custom-user-providers)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:26 +#: ./docs/9.x/authentication.md:26 +#: ./docs/10.x/authentication.md:26 +#: ./docs/11.x/authentication.md:26 +#: ./docs/master/authentication.md:26 msgid "[The User Provider Contract](#the-user-provider-contract)" -msgstr "[UserProvider Contract](#the-user-provider-contract)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:27 +#: ./docs/9.x/authentication.md:27 +#: ./docs/10.x/authentication.md:27 +#: ./docs/11.x/authentication.md:27 +#: ./docs/master/authentication.md:27 msgid "[The Authenticatable Contract](#the-authenticatable-contract)" -msgstr "[Authenticatable Contract](#the-authenticatable-contract)" +msgstr "" + +# P +#: ./docs/11.x/authentication.md:28 +msgid "[Automatic Password Rehashing](#automatic-password-rehashing)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:28 +#: ./docs/9.x/authentication.md:28 +#: ./docs/10.x/authentication.md:28 +#: ./docs/11.x/authentication.md:29 +#: ./docs/master/authentication.md:28 msgid "[Social Authentication](/docs/{{version}}/socialite)" -msgstr "[社群登入](/docs/{{version}}/socialite)" +msgstr "" -#: docs/10.x/authentication.md:block 2 (unordered list) +# P +#: ./docs/8.x/authentication.md:29 +#: ./docs/9.x/authentication.md:29 +#: ./docs/10.x/authentication.md:29 +#: ./docs/11.x/authentication.md:30 +#: ./docs/master/authentication.md:29 msgid "[Events](#events)" -msgstr "[事件](#events)" +msgstr "" -#: docs/10.x/authentication.md:block 4 (header) +# P +#: ./docs/8.x/authentication.md:31 +#: ./docs/9.x/authentication.md:31 +#: ./docs/10.x/authentication.md:31 +#: ./docs/11.x/authentication.md:32 +#: ./docs/master/authentication.md:31 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authentication.md:32 +#: ./docs/9.x/authentication.md:32 +#: ./docs/10.x/authentication.md:32 +#: ./docs/11.x/authentication.md:33 +#: ./docs/master/authentication.md:32 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/authentication.md:block 5 (paragraph) +# P +#: ./docs/8.x/authentication.md:34 +#: ./docs/9.x/authentication.md:34 +#: ./docs/10.x/authentication.md:34 +#: ./docs/11.x/authentication.md:35 +#: ./docs/master/authentication.md:34 msgid "Many web applications provide a way for their users to authenticate with the application and \"login\". Implementing this feature in web applications can be a complex and potentially risky endeavor. For this reason, Laravel strives to give you the tools you need to implement authentication quickly, securely, and easily." -msgstr "許多網頁 App 都提供了讓使用者向 App 認證以及「登入」的功能。在網頁 App 上實作這些功能可能會很複雜,而且可能會有些風險。為此,Laravel 竭力為你提供了用於快速、安全、且簡單地實作認證功能的工具。" +msgstr "" -#: docs/10.x/authentication.md:block 6 (paragraph) +# P +#: ./docs/8.x/authentication.md:36 +#: ./docs/9.x/authentication.md:36 +#: ./docs/10.x/authentication.md:36 +#: ./docs/11.x/authentication.md:37 +#: ./docs/master/authentication.md:36 msgid "At its core, Laravel's authentication facilities are made up of \"guards\" and \"providers\". Guards define how users are authenticated for each request. For example, Laravel ships with a `session` guard which maintains state using session storage and cookies." -msgstr "在 Laravel 的核心中,認證功能是通過「Guard」與「Provider」來提供的。Guard 用來定義使用者在每個請求上是如何被認證的。舉例來說,Laravel 附帶了一個 `session` Guard,會通過 Session 儲存空間與 Cookie 來維護認證狀態。" +msgstr "" -#: docs/10.x/authentication.md:block 7 (paragraph) +# P +#: ./docs/8.x/authentication.md:38 +#: ./docs/9.x/authentication.md:38 +#: ./docs/10.x/authentication.md:38 +#: ./docs/11.x/authentication.md:39 +#: ./docs/master/authentication.md:38 msgid "Providers define how users are retrieved from your persistent storage. Laravel ships with support for retrieving users using [Eloquent](/docs/{{version}}/eloquent) and the database query builder. However, you are free to define additional providers as needed for your application." -msgstr "Provider 則定義了要如何從長期儲存空間內取得使用者。Laravel 內建支援使用 [Eloquent](/docs/{{version}}/eloquent) 或資料庫 Query Builder 來取得使用者。不過,你也可以自行依據需求額外定義其他 Provider。" +msgstr "" -#: docs/10.x/authentication.md:block 8 (paragraph) +# P +#: ./docs/8.x/authentication.md:40 +#: ./docs/9.x/authentication.md:40 +#: ./docs/10.x/authentication.md:40 +#: ./docs/11.x/authentication.md:41 +#: ./docs/master/authentication.md:40 msgid "Your application's authentication configuration file is located at `config/auth.php`. This file contains several well-documented options for tweaking the behavior of Laravel's authentication services." -msgstr "你的專案的認證設定檔位於 `config/auth.php` 內。該檔案包含了多個有文件說明的選項,可以調整 Laravel 認證服務的行為。" +msgstr "" -#: docs/10.x/authentication.md:block 9 (quote) -msgid "**Note** Guards and providers should not be confused with \"roles\" and \"permissions\". To learn more about authorizing user actions via permissions, please refer to the [authorization](/docs/{{version}}/authorization) documentation." -msgstr "**Note** Guard 與 Provider 與「角色」以及「權限」不同,不應溷肴。要瞭解如何依照權限來授權使用者的方法,請參考 [授權](/docs/{{version}}/authorization) 說明文件。" +# P +#: ./docs/8.x/authentication.md:42 +#: ./docs/9.x/authentication.md:43 +#: ./docs/10.x/authentication.md:43 +#: ./docs/11.x/authentication.md:44 +#: ./docs/master/authentication.md:43 +msgid "Guards and providers should not be confused with \"roles\" and \"permissions\". To learn more about authorizing user actions via permissions, please refer to the [authorization](/docs/{{version}}/authorization) documentation." +msgstr "" -#: docs/10.x/authentication.md:block 11 (header) +# P +#: ./docs/8.x/authentication.md:44 +#: ./docs/9.x/authentication.md:45 +#: ./docs/10.x/authentication.md:45 +#: ./docs/11.x/authentication.md:46 +#: ./docs/master/authentication.md:45 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:45 +#: ./docs/9.x/authentication.md:46 +#: ./docs/10.x/authentication.md:46 +#: ./docs/11.x/authentication.md:47 +#: ./docs/master/authentication.md:46 msgid "Starter Kits" -msgstr "入門套件" +msgstr "" -#: docs/10.x/authentication.md:block 12 (paragraph) +# P +#: ./docs/8.x/authentication.md:47 +#: ./docs/9.x/authentication.md:48 +#: ./docs/10.x/authentication.md:48 +#: ./docs/11.x/authentication.md:49 +#: ./docs/master/authentication.md:48 msgid "Want to get started fast? Install a [Laravel application starter kit](/docs/{{version}}/starter-kits) in a fresh Laravel application. After migrating your database, navigate your browser to `/register` or any other URL that is assigned to your application. The starter kits will take care of scaffolding your entire authentication system!" -msgstr "想要快速入門嗎?請在全新的 Laravel 專案內安裝一個 [Laravel 專案入門套件](docs/{{version}}/starter-kits)。完成資料庫遷移後,在瀏覽器上開啟 `/register` 或其他任何設定給應用程式的 URL。這些入門套件會幫你搞定整個認證系統的 Scaffolding。" +msgstr "" -#: docs/10.x/authentication.md:block 13 (paragraph) +# P +#: ./docs/8.x/authentication.md:49 +#: ./docs/9.x/authentication.md:50 +#: ./docs/10.x/authentication.md:50 +#: ./docs/11.x/authentication.md:51 +#: ./docs/master/authentication.md:50 msgid "**Even if you choose not to use a starter kit in your final Laravel application, installing the [Laravel Breeze](/docs/{{version}}/starter-kits#laravel-breeze) starter kit can be a wonderful opportunity to learn how to implement all of Laravel's authentication functionality in an actual Laravel project.** Since Laravel Breeze creates authentication controllers, routes, and views for you, you can examine the code within these files to learn how Laravel's authentication features may be implemented." -msgstr "**就算最後不會在 Laravel 專案上使用任何一種入門套件,安裝 [Laravel Breeze](/docs/{{version}}/starter-kits#laravel-breeze) 入門套件也是個學習如何在實際 Laravel 專案上實作所有 Laravel 認證功能的好機會。** 由於 Laravel Breeze 會為你建立好認證 Controller、路由、以及 View,因此可以通過閱讀這些檔案的程式碼來學習可如何實作 Laravel 的認證功能。" +msgstr "" -#: docs/10.x/authentication.md:block 15 (header) +# P +#: ./docs/8.x/authentication.md:51 +#: ./docs/9.x/authentication.md:52 +#: ./docs/10.x/authentication.md:52 +#: ./docs/11.x/authentication.md:53 +#: ./docs/master/authentication.md:52 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:52 +#: ./docs/9.x/authentication.md:53 +#: ./docs/10.x/authentication.md:53 +#: ./docs/11.x/authentication.md:54 +#: ./docs/master/authentication.md:53 msgid "Database Considerations" -msgstr "資料庫選擇" +msgstr "" -#: docs/10.x/authentication.md:block 16 (paragraph) +# P +#: ./docs/8.x/authentication.md:54 +#: ./docs/9.x/authentication.md:55 +#: ./docs/10.x/authentication.md:55 +#: ./docs/master/authentication.md:55 msgid "By default, Laravel includes an `App\\Models\\User` [Eloquent model](/docs/{{version}}/eloquent) in your `app/Models` directory. This model may be used with the default Eloquent authentication driver. If your application is not using Eloquent, you may use the `database` authentication provider which uses the Laravel query builder." -msgstr "預設情況下,Laravel 在 `app/Models` 資料夾中包含了一個 `App\\Models\\User` [Eloquent Model](/docs/{{version}}/eloquent)。這個 Model 可以用在預設的 Eloquent 登入 Driver 上。若你的專案不使用 Eloquent,則可以使用 `database` 認證 Provider,該 Provider 使用 Laravel 的 Query Builder。" +msgstr "" + +# P +#: ./docs/11.x/authentication.md:56 +msgid "By default, Laravel includes an `App\\Models\\User` [Eloquent model](/docs/{{version}}/eloquent) in your `app/Models` directory. This model may be used with the default Eloquent authentication driver." +msgstr "" -#: docs/10.x/authentication.md:block 17 (paragraph) +# P +#: ./docs/8.x/authentication.md:56 +#: ./docs/9.x/authentication.md:57 +#: ./docs/10.x/authentication.md:57 +#: ./docs/11.x/authentication.md:60 +#: ./docs/master/authentication.md:57 msgid "When building the database schema for the `App\\Models\\User` model, make sure the password column is at least 60 characters in length. Of course, the `users` table migration that is included in new Laravel applications already creates a column that exceeds this length." -msgstr "為 `App\\Models\\User` 模型建立資料庫結構時,請確保密碼欄位的長度至少有 60 個字元。當然,在新建立的 Laravel 專案中, `users` 資料表遷移檔已經建立了超過這個長度的欄位。" +msgstr "" -#: docs/10.x/authentication.md:block 18 (paragraph) +# P +#: ./docs/11.x/authentication.md:58 +msgid "If your application is not using Eloquent, you may use the `database` authentication provider which uses the Laravel query builder. If your application is using MongoDB, check out MongoDB's official [Laravel user authentication documentation](https://www.mongodb.com/docs/drivers/php/laravel-mongodb/current/user-authentication/) ." +msgstr "" + +# P +#: ./docs/8.x/authentication.md:58 +#: ./docs/9.x/authentication.md:59 +#: ./docs/10.x/authentication.md:59 +#: ./docs/11.x/authentication.md:62 +#: ./docs/master/authentication.md:59 msgid "Also, you should verify that your `users` (or equivalent) table contains a nullable, string `remember_token` column of 100 characters. This column will be used to store a token for users that select the \"remember me\" option when logging into your application. Again, the default `users` table migration that is included in new Laravel applications already contains this column." -msgstr "另外,也請求確保 `users`(或其相應的)資料表有包含一個 Nullable、100 字元的 `remember_token` 字串欄位。該欄位會用來在使用者登入時勾選「記住我」選項時使用。同樣地,在新建立的 Laravel 專案中,`users` 資料表遷移檔已經有包含了這個欄位。" +msgstr "" -#: docs/10.x/authentication.md:block 20 (header) +# P +#: ./docs/8.x/authentication.md:60 +#: ./docs/9.x/authentication.md:61 +#: ./docs/10.x/authentication.md:61 +#: ./docs/11.x/authentication.md:64 +#: ./docs/master/authentication.md:61 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:61 +#: ./docs/9.x/authentication.md:62 +#: ./docs/10.x/authentication.md:62 +#: ./docs/11.x/authentication.md:65 +#: ./docs/master/authentication.md:62 msgid "Ecosystem Overview" -msgstr "生態鏈概覽" +msgstr "" -#: docs/10.x/authentication.md:block 21 (paragraph) +# P +#: ./docs/8.x/authentication.md:63 +#: ./docs/9.x/authentication.md:64 +#: ./docs/10.x/authentication.md:64 +#: ./docs/11.x/authentication.md:67 +#: ./docs/master/authentication.md:64 msgid "Laravel offers several packages related to authentication. Before continuing, we'll review the general authentication ecosystem in Laravel and discuss each package's intended purpose." -msgstr "Laravel 提供了多個有關認證的套件。在繼續之前,我們先來看看這些 Laravel 中的一般認證生態鏈,並討論各個套件預設的目的。" +msgstr "" -#: docs/10.x/authentication.md:block 22 (paragraph) +# P +#: ./docs/8.x/authentication.md:65 +#: ./docs/9.x/authentication.md:66 +#: ./docs/10.x/authentication.md:66 +#: ./docs/11.x/authentication.md:69 +#: ./docs/master/authentication.md:66 msgid "First, consider how authentication works. When using a web browser, a user will provide their username and password via a login form. If these credentials are correct, the application will store information about the authenticated user in the user's [session](/docs/{{version}}/session). A cookie issued to the browser contains the session ID so that subsequent requests to the application can associate the user with the correct session. After the session cookie is received, the application will retrieve the session data based on the session ID, note that the authentication information has been stored in the session, and will consider the user as \"authenticated\"." -msgstr "首先,我們先來看看認證是怎麼運作的。在使用網頁瀏覽器時,使用者會通過登入表格來提供他們的使用者名稱以及密碼。若帳號密碼正確,則網站會將已認證使用者的資訊儲存在使用者的 [Session](/docs/{{version}}/session) 中。Cookie 會傳給瀏覽器,其中包含了 Session ID。這樣一來,我們就可以通過正確的 Session 來將接下來向網站發起的請求與使用者連結起來。收到 Session Cookie 後,網站會依據 Session ID 來取得 Session 資料。請注意,由於認證資訊已經被保存在 Session 中了,所以該使用者將被視為「已認證」。" +msgstr "" -#: docs/10.x/authentication.md:block 23 (paragraph) +# P +#: ./docs/8.x/authentication.md:67 +#: ./docs/9.x/authentication.md:68 +#: ./docs/10.x/authentication.md:68 +#: ./docs/11.x/authentication.md:71 +#: ./docs/master/authentication.md:68 msgid "When a remote service needs to authenticate to access an API, cookies are not typically used for authentication because there is no web browser. Instead, the remote service sends an API token to the API on each request. The application may validate the incoming token against a table of valid API tokens and \"authenticate\" the request as being performed by the user associated with that API token." -msgstr "當遠端服務需要認證來存取 API 時,通常不會在認證上使用 Cookie,因為這種情況下並沒有網頁瀏覽器。取而代之地,遠端服務會在每個請求時帶上 API 權杖。網站可以通過將傳入的權杖與包含了有效 API 憑證的資料表進行比對來「認證」該請求,並將其視為是有與 API 權杖管理的使用者所進行的操作。" +msgstr "" -#: docs/10.x/authentication.md:block 25 (header) +# P +#: ./docs/8.x/authentication.md:69 +#: ./docs/9.x/authentication.md:70 +#: ./docs/10.x/authentication.md:70 +#: ./docs/11.x/authentication.md:73 +#: ./docs/master/authentication.md:70 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:70 +#: ./docs/9.x/authentication.md:71 +#: ./docs/10.x/authentication.md:71 +#: ./docs/11.x/authentication.md:74 +#: ./docs/master/authentication.md:71 msgid "Laravel's Built-in Browser Authentication Services" -msgstr "Laravel 的內建瀏覽器認證服務" +msgstr "" -#: docs/10.x/authentication.md:block 26 (paragraph) +# P +#: ./docs/8.x/authentication.md:72 +#: ./docs/9.x/authentication.md:73 +#: ./docs/10.x/authentication.md:73 +#: ./docs/11.x/authentication.md:76 +#: ./docs/master/authentication.md:73 msgid "Laravel includes built-in authentication and session services which are typically accessed via the `Auth` and `Session` facades. These features provide cookie-based authentication for requests that are initiated from web browsers. They provide methods that allow you to verify a user's credentials and authenticate the user. In addition, these services will automatically store the proper authentication data in the user's session and issue the user's session cookie. A discussion of how to use these services is contained within this documentation." -msgstr "Laravel 的內建認證與 Session 服務通常會通過 `Auth` 與 `Session` Facade 來存取。這些功能為從瀏覽器發起的請求提供了基於 Cookie 的認證功能。這些功能也提供了能認證使用者憑證與認證使用者的方法。此外,這些服務也會自動將正確的資料儲存在使用者的 Session 內,並為使用者核發 Session Cookie。本文件中包含了如何使用這些服務的討論。" +msgstr "" -#: docs/10.x/authentication.md:block 27 (paragraph) +# P +#: ./docs/8.x/authentication.md:74 +#: ./docs/9.x/authentication.md:75 +#: ./docs/10.x/authentication.md:75 +#: ./docs/11.x/authentication.md:78 +#: ./docs/master/authentication.md:75 msgid "**Application Starter Kits**" -msgstr "**應用程式入門套件**" +msgstr "" -#: docs/10.x/authentication.md:block 28 (paragraph) +# P +#: ./docs/8.x/authentication.md:76 +#: ./docs/9.x/authentication.md:77 +#: ./docs/10.x/authentication.md:77 +#: ./docs/11.x/authentication.md:80 +#: ./docs/master/authentication.md:77 msgid "As discussed in this documentation, you can interact with these authentication services manually to build your application's own authentication layer. However, to help you get started more quickly, we have released [free packages](/docs/{{version}}/starter-kits) that provide robust, modern scaffolding of the entire authentication layer. These packages are [Laravel Breeze](/docs/{{version}}/starter-kits#laravel-breeze), [Laravel Jetstream](/docs/{{version}}/starter-kits#laravel-jetstream), and [Laravel Fortify](/docs/{{version}}/fortify)." -msgstr "我們剛才也在本文中討論過,你可以通過手動操作這些認證服務來為專案建立一套「認證層」。但,為了讓你可以更快入門,我們也釋出了[一些免費套件](/docs/{{version}}/starter-kits)來提供更快速且現代化的完整認證層 Scaffolding:[Laravel Breeze](/docs/{{version}}/starter-kits#laravel-breeze), [Laravel Jetstream](/docs/{{version}}/starter-kits#laravel-jetstream),與 [Laravel Fortify](/docs/{{version}}/fortify)。" +msgstr "" -#: docs/10.x/authentication.md:block 29 (paragraph) +# P +#: ./docs/8.x/authentication.md:78 +#: ./docs/9.x/authentication.md:79 +#: ./docs/10.x/authentication.md:79 +#: ./docs/11.x/authentication.md:82 +#: ./docs/master/authentication.md:79 msgid "*Laravel Breeze* is a simple, minimal implementation of all of Laravel's authentication features, including login, registration, password reset, email verification, and password confirmation. Laravel Breeze's view layer is comprised of simple [Blade templates](/docs/{{version}}/blade) styled with [Tailwind CSS](https://tailwindcss.com). To get started, check out the documentation on Laravel's [application starter kits](/docs/{{version}}/starter-kits)." -msgstr "**Laravel Breeze** 是一個簡單且最小化實作出所有 Laravel 驗證功能的套件,包含登入、註冊、密碼重設、電子郵件驗證、以及密碼確認。Laravel Breeze 的檢視器層是通過簡單的 [Blade 樣板](/docs/{{version}}/blade) 搭配 [Tailwind CSS](https://tailwindcss.com) 提供樣式組合而成的。若要瞭解有關 Laravel Breeze,請參考 Laravel 的 [應用程式入門套件](/docs/{{version}}/starter-kits) 說明文件。" +msgstr "" -#: docs/10.x/authentication.md:block 30 (paragraph) +# P +#: ./docs/8.x/authentication.md:80 +#: ./docs/9.x/authentication.md:81 +#: ./docs/10.x/authentication.md:81 +#: ./docs/11.x/authentication.md:84 +#: ./docs/master/authentication.md:81 msgid "*Laravel Fortify* is a headless authentication backend for Laravel that implements many of the features found in this documentation, including cookie-based authentication as well as other features such as two-factor authentication and email verification. Fortify provides the authentication backend for Laravel Jetstream or may be used independently in combination with [Laravel Sanctum](/docs/{{version}}/sanctum) to provide authentication for an SPA that needs to authenticate with Laravel." -msgstr "**Laravel Fortify** 是一種用於 Laravel 的無周邊(Headless)驗證後端。Laravel Fortify 實作了許多可在此說明文件中找到的功能,包含基於 Cookie 的驗證以及其他如二步驟驗證與電子郵件驗證等功能。Fortify 也為 Laravel Jetstream 提供了驗證後端。或者,也可以通過與 [Laravel Sanctum](/docs/{{version}}/sanctum) 組合使用來為需要在 Laravel 中進行驗證的 SPA(Single Page Application,單一頁面應用程式)提供驗證功能。" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:82 +msgid "*[Laravel Jetstream](https://jetstream.laravel.com)* is a robust application starter kit that consumes and exposes Laravel Fortify's authentication services with a beautiful, modern UI powered by [Tailwind CSS](https://tailwindcss.com), [Livewire](https://laravel-livewire.com), and / or [Inertia.js](https://inertiajs.com). Laravel Jetstream includes optional support for two-factor authentication, team support, browser session management, profile management, and built-in integration with [Laravel Sanctum](/docs/{{version}}/sanctum) to offer API token authentication. Laravel's API authentication offerings are discussed below." +msgstr "" -#: docs/10.x/authentication.md:block 31 (paragraph) +# P +#: ./docs/10.x/authentication.md:83 +#: ./docs/11.x/authentication.md:86 +#: ./docs/master/authentication.md:83 msgid "*[Laravel Jetstream](https://jetstream.laravel.com)* is a robust application starter kit that consumes and exposes Laravel Fortify's authentication services with a beautiful, modern UI powered by [Tailwind CSS](https://tailwindcss.com), [Livewire](https://livewire.laravel.com), and / or [Inertia](https://inertiajs.com). Laravel Jetstream includes optional support for two-factor authentication, team support, browser session management, profile management, and built-in integration with [Laravel Sanctum](/docs/{{version}}/sanctum) to offer API token authentication. Laravel's API authentication offerings are discussed below." -msgstr "**[Laravel Jetstream](https://jetstream.laravel.com)** 是一個強大的入門套件,該套件使用者 Laravel Fortify 的驗證服務,並將其通過 [Tailwind CSS](https://tailwindcss.com), [Livewire](https://livewire.laravel.com),與/或 [Inertia](https://inertiajs.com) 來提供美麗且現代的 UI。Laravel Jetstream 也提供了對二步驟驗證、團隊支援、瀏覽器啟程管理、個人檔案管理、以及內建與 [Laravel Sanctum](/docs/{{version}}/sunctum) 整合來提供 API 權杖驗證的可選支援。Laravel 提供的 API 驗證功能將在下方討論。" +msgstr "" + +# P +#: ./docs/9.x/authentication.md:83 +msgid "*[Laravel Jetstream](https://jetstream.laravel.com)* is a robust application starter kit that consumes and exposes Laravel Fortify's authentication services with a beautiful, modern UI powered by [Tailwind CSS](https://tailwindcss.com), [Livewire](https://laravel-livewire.com), and / or [Inertia](https://inertiajs.com). Laravel Jetstream includes optional support for two-factor authentication, team support, browser session management, profile management, and built-in integration with [Laravel Sanctum](/docs/{{version}}/sanctum) to offer API token authentication. Laravel's API authentication offerings are discussed below." +msgstr "" -#: docs/10.x/authentication.md:block 33 (header) +# P +#: ./docs/8.x/authentication.md:84 +#: ./docs/9.x/authentication.md:85 +#: ./docs/10.x/authentication.md:85 +#: ./docs/11.x/authentication.md:88 +#: ./docs/master/authentication.md:85 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:85 +#: ./docs/9.x/authentication.md:86 +#: ./docs/10.x/authentication.md:86 +#: ./docs/11.x/authentication.md:89 +#: ./docs/master/authentication.md:86 msgid "Laravel's API Authentication Services" -msgstr "Laravel 的 API 認證服務" +msgstr "" -#: docs/10.x/authentication.md:block 34 (paragraph) +# P +#: ./docs/8.x/authentication.md:87 +#: ./docs/9.x/authentication.md:88 +#: ./docs/10.x/authentication.md:88 +#: ./docs/11.x/authentication.md:91 +#: ./docs/master/authentication.md:88 msgid "Laravel provides two optional packages to assist you in managing API tokens and authenticating requests made with API tokens: [Passport](/docs/{{version}}/passport) and [Sanctum](/docs/{{version}}/sanctum). Please note that these libraries and Laravel's built-in cookie based authentication libraries are not mutually exclusive. These libraries primarily focus on API token authentication while the built-in authentication services focus on cookie based browser authentication. Many applications will use both Laravel's built-in cookie based authentication services and one of Laravel's API authentication packages." -msgstr "Laravel 提供了兩個可選的套件來協助你管理 API 權杖以及認證以 API 權杖建立的請求:[Passport](/docs/{{version}}/passport) 與 [Sanctum](/docs/{{version}}/sanctum)。請注意,這些函式庫與 Laravel 內建的基於 Cookie 的認證函式庫並不互相衝突。這些函式庫的重點都是在提供 API 進行權杖認證,而內建的認證服務則著重於基於 Cookie 的瀏覽器認證。許多網站都會同時使用 Laravel 內建的基於 Cookie 的認證服務,以及其中一種 Laravel 的 API 認證套件。" +msgstr "" -#: docs/10.x/authentication.md:block 35 (paragraph) +# P +#: ./docs/8.x/authentication.md:89 +#: ./docs/9.x/authentication.md:90 +#: ./docs/10.x/authentication.md:90 +#: ./docs/11.x/authentication.md:93 +#: ./docs/master/authentication.md:90 msgid "**Passport**" -msgstr "**Passport**" +msgstr "" -#: docs/10.x/authentication.md:block 36 (paragraph) +# P +#: ./docs/8.x/authentication.md:91 +#: ./docs/9.x/authentication.md:92 +#: ./docs/10.x/authentication.md:92 +#: ./docs/11.x/authentication.md:95 +#: ./docs/master/authentication.md:92 msgid "Passport is an OAuth2 authentication provider, offering a variety of OAuth2 \"grant types\" which allow you to issue various types of tokens. In general, this is a robust and complex package for API authentication. However, most applications do not require the complex features offered by the OAuth2 spec, which can be confusing for both users and developers. In addition, developers have been historically confused about how to authenticate SPA applications or mobile applications using OAuth2 authentication providers like Passport." -msgstr "Passport 是一個 OAuth2 認證 Provider,提供了多種 OAuth2 的「Grant Type」來讓你簽發各種不同的權杖。通常來說,對於 API 認證來說 Passport 是一個很強大很複雜的套件。但,大多數的網站並不需要 OAuth2 規格所提供的那些複雜的功能。這些功能只會讓使用者與開發人員都搞不清楚要怎麼用。而且,很多開發人員都搞不懂要怎麽樣使用 Passport 這樣的 OAuth2 認證 Provider 來認證 SPA App 或手機 App。" +msgstr "" -#: docs/10.x/authentication.md:block 37 (paragraph) +# P +#: ./docs/8.x/authentication.md:93 +#: ./docs/9.x/authentication.md:94 +#: ./docs/10.x/authentication.md:94 +#: ./docs/11.x/authentication.md:97 +#: ./docs/master/authentication.md:94 msgid "**Sanctum**" -msgstr "**Sanctum**" +msgstr "" -#: docs/10.x/authentication.md:block 38 (paragraph) +# P +#: ./docs/8.x/authentication.md:95 +#: ./docs/9.x/authentication.md:96 +#: ./docs/10.x/authentication.md:96 +#: ./docs/11.x/authentication.md:99 +#: ./docs/master/authentication.md:96 msgid "In response to the complexity of OAuth2 and developer confusion, we set out to build a simpler, more streamlined authentication package that could handle both first-party web requests from a web browser and API requests via tokens. This goal was realized with the release of [Laravel Sanctum](/docs/{{version}}/sanctum), which should be considered the preferred and recommended authentication package for applications that will be offering a first-party web UI in addition to an API, or will be powered by a single-page application (SPA) that exists separately from the backend Laravel application, or applications that offer a mobile client." -msgstr "為了處理 OAuth2 很複雜的問題以及解決開發者的困惑,我們希望建立一種更簡單、更精簡的認證套件。這個套件不但要可以處理來自網頁瀏覽器的第一方網頁請求,也要可以處理通過權杖發起的 API 請求。我們在 [Laravel Sanctum](/docs/{{version}}/sanctum) 中解決了這些問題。對於「有提供第一方 Web UI 的 API」、「有獨立 Laravel 後端的 SPA」、或是「有提供手機 App 的網站」,Laravel Sanctum 目前是我們推薦與建議的認證套件。" +msgstr "" -#: docs/10.x/authentication.md:block 39 (paragraph) +# P +#: ./docs/8.x/authentication.md:97 +#: ./docs/9.x/authentication.md:98 +#: ./docs/10.x/authentication.md:98 +#: ./docs/11.x/authentication.md:101 +#: ./docs/master/authentication.md:98 msgid "Laravel Sanctum is a hybrid web / API authentication package that can manage your application's entire authentication process. This is possible because when Sanctum based applications receive a request, Sanctum will first determine if the request includes a session cookie that references an authenticated session. Sanctum accomplishes this by calling Laravel's built-in authentication services which we discussed earlier. If the request is not being authenticated via a session cookie, Sanctum will inspect the request for an API token. If an API token is present, Sanctum will authenticate the request using that token. To learn more about this process, please consult Sanctum's [\"how it works\"](/docs/{{version}}/sanctum#how-it-works) documentation." -msgstr "Laravel Sanctum 混合了網頁認證與 API 認證,可以用來處理整個網站的認證流程。怎麼做到的呢?當使用 Sanctum 的網站收到請求後,Sanctum 會先判斷該請求是否有包含了認證 Session 的 Session Cookie。Sanctum 是通過呼叫我們稍早討論過的 Laravel 內建認證服務來達成此一功能的。若該請求的 Session Cookie 未被認證過,則 Sanctum 接著會檢查請求的 API 權杖。若有找到 API 權杖,則 Sanctum 會使用該權杖來認證請求。要瞭解更多有關此一流程的資訊,請參考 Sanctum 的[「運作方式」](/docs/{{version}}/sanctum#how-it-works)說明文件。" +msgstr "" -#: docs/10.x/authentication.md:block 40 (paragraph) +# P +#: ./docs/8.x/authentication.md:99 +#: ./docs/9.x/authentication.md:100 +#: ./docs/10.x/authentication.md:100 +#: ./docs/11.x/authentication.md:103 +#: ./docs/master/authentication.md:100 msgid "Laravel Sanctum is the API package we have chosen to include with the [Laravel Jetstream](https://jetstream.laravel.com) application starter kit because we believe it is the best fit for the majority of web application's authentication needs." -msgstr "Laravel Sanctum 是我們在 [Laravel Jetstream](https://jetstream.laravel.com) 專案入門套件中選擇的 API 套件,因為我們認為該套件最符合大多數網頁 App 的認證需求。" +msgstr "" -#: docs/10.x/authentication.md:block 42 (header) +# P +#: ./docs/8.x/authentication.md:101 +#: ./docs/9.x/authentication.md:102 +#: ./docs/10.x/authentication.md:102 +#: ./docs/11.x/authentication.md:105 +#: ./docs/master/authentication.md:102 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:102 +#: ./docs/9.x/authentication.md:103 msgid "Summary & Choosing Your Stack" -msgstr "總結與選擇你的 Stack" +msgstr "" + +# H4 +#: ./docs/10.x/authentication.md:103 +#: ./docs/11.x/authentication.md:106 +#: ./docs/master/authentication.md:103 +msgid "Summary and Choosing Your Stack" +msgstr "" -#: docs/10.x/authentication.md:block 43 (paragraph) +# P +#: ./docs/8.x/authentication.md:104 +#: ./docs/9.x/authentication.md:105 +#: ./docs/10.x/authentication.md:105 +#: ./docs/11.x/authentication.md:108 +#: ./docs/master/authentication.md:105 msgid "In summary, if your application will be accessed using a browser and you are building a monolithic Laravel application, your application will use Laravel's built-in authentication services." -msgstr "總結一下,若你的專案會通過瀏覽器來存取,而且你只會製作單一一個 Laravel 專案,則應使用 Laravel 的內建認證服務。" +msgstr "" -#: docs/10.x/authentication.md:block 44 (paragraph) +# P +#: ./docs/8.x/authentication.md:106 +#: ./docs/9.x/authentication.md:107 +#: ./docs/10.x/authentication.md:107 +#: ./docs/11.x/authentication.md:110 +#: ./docs/master/authentication.md:107 msgid "Next, if your application offers an API that will be consumed by third parties, you will choose between [Passport](/docs/{{version}}/passport) or [Sanctum](/docs/{{version}}/sanctum) to provide API token authentication for your application. In general, Sanctum should be preferred when possible since it is a simple, complete solution for API authentication, SPA authentication, and mobile authentication, including support for \"scopes\" or \"abilities\"." -msgstr "若你的專案中包含了會被第三方使用的 API,則應選擇 [Passport](/docs/{{version}}/passport) 或 [Sanctum](/docs/{{version}}/sanctum) 來為專案提供 API 權杖認證。一般來說,應該儘量先選擇 Sanctum,因為 Sanctum 對 API 認證、SPA 認證、以及行動裝置認證來說是最簡單且完整的解決方案,而且也支援「範圍 (Scope)」與「權限 (Ability)」。" +msgstr "" -#: docs/10.x/authentication.md:block 45 (paragraph) +# P +#: ./docs/8.x/authentication.md:108 +#: ./docs/9.x/authentication.md:109 +#: ./docs/10.x/authentication.md:109 +#: ./docs/11.x/authentication.md:112 +#: ./docs/master/authentication.md:109 msgid "If you are building a single-page application (SPA) that will be powered by a Laravel backend, you should use [Laravel Sanctum](/docs/{{version}}/sanctum). When using Sanctum, you will either need to [manually implement your own backend authentication routes](#authenticating-users) or utilize [Laravel Fortify](/docs/{{version}}/fortify) as a headless authentication backend service that provides routes and controllers for features such as registration, password reset, email verification, and more." -msgstr "如果你正在製作由 Laravel 提供後端的 SPA,則應該使用 [Laravel Sanctum](/docs/{{version}}/sanctum)。在使用 Sanctum 時,會需要[手動實作你自己的認證路由後端](#authenticating-users),或是使用 [Laravel Fortify](/docs/{{version}}/fortify) 來作為 Headless 的認證後端服務,來為註冊、密碼重設、電子郵件認證等功能提供路由與 Controller。" +msgstr "" -#: docs/10.x/authentication.md:block 46 (paragraph) +# P +#: ./docs/8.x/authentication.md:110 +#: ./docs/9.x/authentication.md:111 +#: ./docs/10.x/authentication.md:111 +#: ./docs/11.x/authentication.md:114 +#: ./docs/master/authentication.md:111 msgid "Passport may be chosen when your application absolutely needs all of the features provided by the OAuth2 specification." -msgstr "當你的專案真的需要所有 OAuth2 規格所提供的功能時,就可以選擇使用 Passport。" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:112 +msgid "And, if you would like to get started quickly, we are pleased to recommend [Laravel Jetstream](https://jetstream.laravel.com) as a quick way to start a new Laravel application that already uses our preferred authentication stack of Laravel's built-in authentication services and Laravel Sanctum." +msgstr "" -#: docs/10.x/authentication.md:block 47 (paragraph) +# P +#: ./docs/9.x/authentication.md:113 +#: ./docs/10.x/authentication.md:113 +#: ./docs/11.x/authentication.md:116 +#: ./docs/master/authentication.md:113 msgid "And, if you would like to get started quickly, we are pleased to recommend [Laravel Breeze](/docs/{{version}}/starter-kits#laravel-breeze) as a quick way to start a new Laravel application that already uses our preferred authentication stack of Laravel's built-in authentication services and Laravel Sanctum." -msgstr "此外,若想要快速入門,我們誠摯推薦你使用 [Laravel Breeze](/docs/{{version}}/starter-kits#laravel-breeze) 來作為快速建立新 Laravel 專案的方法。Laravel Breeze 已經使用了我們偏好的認證 Stack —— 使用 Laravel 的內建認證服務與 Laravel Sanctum。" +msgstr "" -#: docs/10.x/authentication.md:block 49 (header) +# P +#: ./docs/8.x/authentication.md:114 +#: ./docs/9.x/authentication.md:115 +#: ./docs/10.x/authentication.md:115 +#: ./docs/11.x/authentication.md:118 +#: ./docs/master/authentication.md:115 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authentication.md:115 +#: ./docs/9.x/authentication.md:116 +#: ./docs/10.x/authentication.md:116 +#: ./docs/11.x/authentication.md:119 +#: ./docs/master/authentication.md:116 msgid "Authentication Quickstart" -msgstr "「認證」快速入門" +msgstr "" -#: docs/10.x/authentication.md:block 50 (quote) -msgid "**Warning** This portion of the documentation discusses authenticating users via the [Laravel application starter kits](/docs/{{version}}/starter-kits), which includes UI scaffolding to help you get started quickly. If you would like to integrate with Laravel's authentication systems directly, check out the documentation on [manually authenticating users](#authenticating-users)." -msgstr "**Warning** 這部分的文件會討論通過 [Laravel 應用程式入門套件](/docs/{{version}}/starter-kits) 來驗證使用者,這些入門套件包含了能協助你快速開始的 UI Scaffolding。若你想要直接與 Laravel 的驗證系統整合,請參考 [手動驗證使用者](#authenticating-users) 內的說明文件。" +# P +#: ./docs/8.x/authentication.md:117 +#: ./docs/9.x/authentication.md:119 +#: ./docs/10.x/authentication.md:119 +#: ./docs/11.x/authentication.md:122 +#: ./docs/master/authentication.md:119 +msgid "This portion of the documentation discusses authenticating users via the [Laravel application starter kits](/docs/{{version}}/starter-kits), which includes UI scaffolding to help you get started quickly. If you would like to integrate with Laravel's authentication systems directly, check out the documentation on [manually authenticating users](#authenticating-users)." +msgstr "" -#: docs/10.x/authentication.md:block 52 (header) +# P +#: ./docs/8.x/authentication.md:119 +#: ./docs/9.x/authentication.md:121 +#: ./docs/10.x/authentication.md:121 +#: ./docs/11.x/authentication.md:124 +#: ./docs/master/authentication.md:121 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:120 +#: ./docs/9.x/authentication.md:122 msgid "Install A Starter Kit" -msgstr "安裝一種入門套件" +msgstr "" + +# H3 +#: ./docs/10.x/authentication.md:122 +#: ./docs/11.x/authentication.md:125 +#: ./docs/master/authentication.md:122 +msgid "Install a Starter Kit" +msgstr "" -#: docs/10.x/authentication.md:block 53 (paragraph) +# P +#: ./docs/8.x/authentication.md:122 +#: ./docs/9.x/authentication.md:124 +#: ./docs/10.x/authentication.md:124 +#: ./docs/11.x/authentication.md:127 +#: ./docs/master/authentication.md:124 msgid "First, you should [install a Laravel application starter kit](/docs/{{version}}/starter-kits). Our current starter kits, Laravel Breeze and Laravel Jetstream, offer beautifully designed starting points for incorporating authentication into your fresh Laravel application." -msgstr "首先,需要[安裝一個 Laravel 專案入門套件](/docs/{{version}}/starter-kits)。我們目前的入門套件 —— Laravel Breeze 與 Laravel Jetstream —— 都是讓你的 Laravel 新專案有個美觀設計的起始點。" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:124 +#: ./docs/9.x/authentication.md:126 +msgid "Laravel Breeze is a minimal, simple implementation of all of Laravel's authentication features, including login, registration, password reset, email verification, and password confirmation. Laravel Breeze's view layer is made up of simple [Blade templates](/docs/{{version}}/blade) styled with [Tailwind CSS](https://tailwindcss.com). Breeze also offers an [Inertia](https://inertiajs.com) based scaffolding option using Vue or React." +msgstr "" -#: docs/10.x/authentication.md:block 54 (paragraph) +# P +#: ./docs/10.x/authentication.md:126 +#: ./docs/11.x/authentication.md:129 +#: ./docs/master/authentication.md:126 msgid "Laravel Breeze is a minimal, simple implementation of all of Laravel's authentication features, including login, registration, password reset, email verification, and password confirmation. Laravel Breeze's view layer is made up of simple [Blade templates](/docs/{{version}}/blade) styled with [Tailwind CSS](https://tailwindcss.com). Additionally, Breeze provides scaffolding options based on [Livewire](https://livewire.laravel.com) or [Inertia](https://inertiajs.com), with the choice of using Vue or React for the Inertia-based scaffolding." -msgstr "Laravel Breeze 是一個簡單且最小化實作出所有 Laravel 認證功能的套件,包含登入、註冊、密碼重設、電子郵件認證、以及密碼確認。Laravel Breeze 的檢視器層是通過簡單的 [Blade 樣板](/docs/{{version}}/blade) 搭配 [Tailwind CSS](https://tailwindcss.com) 提供樣式組合而成的。此外,Breeze 也提供了基於 [Livewire](https://livewire.laravel.com) 或 [Inertia](https://inertiajs.com) 的 Scaffolding 選項,並且在選擇基於 Inertia 的 Scaffolding 時可選擇使用 Vue 或 React。" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:126 +msgid "[Laravel Jetstream](https://jetstream.laravel.com) is a more robust application starter kit that includes support for scaffolding your application with [Livewire](https://laravel-livewire.com) or [Inertia.js and Vue](https://inertiajs.com). In addition, Jetstream features optional support for two-factor authentication, teams, profile management, browser session management, API support via [Laravel Sanctum](/docs/{{version}}/sanctum), account deletion, and more." +msgstr "" -#: docs/10.x/authentication.md:block 55 (paragraph) +# P +#: ./docs/10.x/authentication.md:128 +#: ./docs/11.x/authentication.md:131 +#: ./docs/master/authentication.md:128 msgid "[Laravel Jetstream](https://jetstream.laravel.com) is a more robust application starter kit that includes support for scaffolding your application with [Livewire](https://livewire.laravel.com) or [Inertia and Vue](https://inertiajs.com). In addition, Jetstream features optional support for two-factor authentication, teams, profile management, browser session management, API support via [Laravel Sanctum](/docs/{{version}}/sanctum), account deletion, and more." -msgstr "[Laravel Jetstream](https://jetstream.laravel.com) 是一個更複雜的專案入門套件,其中包含了使用 [Livewire](https://livewire.laravel.com) 或 [Inertia 與 Vue](https://inertiajs.com) 來對應用程式 Scaffolding 的支援。此外,Jetstream 也提供了對二步驟認證、團隊、個人檔案管理、瀏覽器啟程管理、通過 [Laravel Sanctum](/docs/{{version}}/sanctum) 提供的 API 支援、帳號刪除…等功能的可選支援。" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:128 +#: ./docs/9.x/authentication.md:130 +#: ./docs/10.x/authentication.md:130 +#: ./docs/11.x/authentication.md:133 +#: ./docs/master/authentication.md:130 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/authentication.md:128 +msgid "[Laravel Jetstream](https://jetstream.laravel.com) is a more robust application starter kit that includes support for scaffolding your application with [Livewire](https://laravel-livewire.com) or [Inertia and Vue](https://inertiajs.com). In addition, Jetstream features optional support for two-factor authentication, teams, profile management, browser session management, API support via [Laravel Sanctum](/docs/{{version}}/sanctum), account deletion, and more." +msgstr "" -#: docs/10.x/authentication.md:block 57 (header) +# H3 +#: ./docs/8.x/authentication.md:129 +#: ./docs/9.x/authentication.md:131 msgid "Retrieving The Authenticated User" -msgstr "取得已登入的使用者" +msgstr "" + +# H3 +#: ./docs/10.x/authentication.md:131 +#: ./docs/11.x/authentication.md:134 +#: ./docs/master/authentication.md:131 +msgid "Retrieving the Authenticated User" +msgstr "" -#: docs/10.x/authentication.md:block 58 (paragraph) +# P +#: ./docs/8.x/authentication.md:131 +#: ./docs/9.x/authentication.md:133 +#: ./docs/10.x/authentication.md:133 +#: ./docs/11.x/authentication.md:136 +#: ./docs/master/authentication.md:133 msgid "After installing an authentication starter kit and allowing users to register and authenticate with your application, you will often need to interact with the currently authenticated user. While handling an incoming request, you may access the authenticated user via the `Auth` facade's `user` method:" -msgstr "安裝完認證入門套件並讓使用者在網站內註冊與認證後,我們通常需要與目前已登入的使用者進行互動。在處理連入請求時,我們可以通過 `Auth` Facade 的 `user` 方法來存取已登入的使用者:" +msgstr "" -#: docs/10.x/authentication.md:block 59 (code) +# CODE +#: ./docs/8.x/authentication.md:133 +#: ./docs/9.x/authentication.md:135 +#: ./docs/10.x/authentication.md:135 +#: ./docs/11.x/authentication.md:138 +#: ./docs/master/authentication.md:135 msgid "use Illuminate\\Support\\Facades\\Auth;\n\n" "// Retrieve the currently authenticated user...\n" "$user = Auth::user();\n\n" "// Retrieve the currently authenticated user's ID...\n" -"$id = Auth::id();\n" -msgstr "use Illuminate\\Support\\Facades\\Auth;\n\n" -"// 取得目前登入的使用者...\n" -"$user = Auth::user();\n\n" -"// 取得目前登入使用者的 ID...\n" -"$id = Auth::id();\n" +"$id = Auth::id();" +msgstr "" -#: docs/10.x/authentication.md:block 60 (paragraph) +# P +#: ./docs/8.x/authentication.md:141 +#: ./docs/9.x/authentication.md:143 +#: ./docs/10.x/authentication.md:143 +#: ./docs/11.x/authentication.md:146 +#: ./docs/master/authentication.md:143 msgid "Alternatively, once a user is authenticated, you may access the authenticated user via an `Illuminate\\Http\\Request` instance. Remember, type-hinted classes will automatically be injected into your controller methods. By type-hinting the `Illuminate\\Http\\Request` object, you may gain convenient access to the authenticated user from any controller method in your application via the request's `user` method:" -msgstr "另外,使用者認證後,也可以通過 `Illuminate\\Http\\Request` 實體來存取已登入的使用者。請記得,有型別提示的類別會自動被插入到 Controller 方法內。只要型別提示 `Illuminate\\Http\\Request` 物件,就可以方便地通過 Request 的 `user` 方法來在任何 Controller 方法內存取已登入的使用者:" +msgstr "" -#: docs/10.x/authentication.md:block 61 (code) +# CODE +#: ./docs/8.x/authentication.md:143 +#: ./docs/9.x/authentication.md:145 msgid "user();\n\n" -" // ...\n\n" -" return redirect('/flights');\n" +" // $request->user()\n" " }\n" -"}\n" -msgstr "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:164 +#: ./docs/9.x/authentication.md:166 msgid "Determining If The Current User Is Authenticated" -msgstr "判斷目前使用者是否已認證" +msgstr "" -#: docs/10.x/authentication.md:block 64 (paragraph) +# P +#: ./docs/8.x/authentication.md:166 +#: ./docs/9.x/authentication.md:168 +#: ./docs/10.x/authentication.md:170 +#: ./docs/11.x/authentication.md:173 +#: ./docs/master/authentication.md:170 msgid "To determine if the user making the incoming HTTP request is authenticated, you may use the `check` method on the `Auth` facade. This method will return `true` if the user is authenticated:" -msgstr "若要判斷建立連入 HTTP 請求的使用者是否已登入,可以使用 `Auth` Facade 的 `check` 方法。該方法會在使用者已登入的時候回傳 `true`:" +msgstr "" + +# H4 +#: ./docs/10.x/authentication.md:168 +#: ./docs/11.x/authentication.md:171 +#: ./docs/master/authentication.md:168 +msgid "Determining if the Current User is Authenticated" +msgstr "" -#: docs/10.x/authentication.md:block 65 (code) +# CODE +#: ./docs/8.x/authentication.md:168 +#: ./docs/9.x/authentication.md:170 +#: ./docs/10.x/authentication.md:172 +#: ./docs/11.x/authentication.md:175 +#: ./docs/master/authentication.md:172 msgid "use Illuminate\\Support\\Facades\\Auth;\n\n" "if (Auth::check()) {\n" " // The user is logged in...\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Auth;\n\n" -"if (Auth::check()) {\n" -" // The user is logged in...\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authentication.md:block 66 (quote) -msgid "**Note** Even though it is possible to determine if a user is authenticated using the `check` method, you will typically use a middleware to verify that the user is authenticated before allowing the user access to certain routes / controllers. To learn more about this, check out the documentation on [protecting routes](/docs/{{version}}/authentication#protecting-routes)." -msgstr "**Note** 雖然可以使用 `check` 方法來判斷使用者是否已登入,但通常可以使用 Middleware 來在使用者存取特定 Route 或 Controller 前就先驗證該使用者是否已登入。關更多詳情,參考[保護 Route](/docs/{{version}}/authentication#protecting-routes) 內的說明文件。" +# P +#: ./docs/8.x/authentication.md:174 +#: ./docs/9.x/authentication.md:177 +#: ./docs/10.x/authentication.md:179 +#: ./docs/11.x/authentication.md:182 +#: ./docs/master/authentication.md:179 +msgid "Even though it is possible to determine if a user is authenticated using the `check` method, you will typically use a middleware to verify that the user is authenticated before allowing the user access to certain routes / controllers. To learn more about this, check out the documentation on [protecting routes](/docs/{{version}}/authentication#protecting-routes)." +msgstr "" -#: docs/10.x/authentication.md:block 68 (header) +# P +#: ./docs/8.x/authentication.md:176 +#: ./docs/9.x/authentication.md:179 +#: ./docs/10.x/authentication.md:181 +#: ./docs/11.x/authentication.md:184 +#: ./docs/master/authentication.md:181 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:177 +#: ./docs/8.x/authentication.md:491 +#: ./docs/9.x/authentication.md:180 +#: ./docs/9.x/authentication.md:528 +#: ./docs/10.x/authentication.md:182 +#: ./docs/10.x/authentication.md:528 +#: ./docs/11.x/authentication.md:185 +#: ./docs/11.x/authentication.md:530 +#: ./docs/master/authentication.md:182 +#: ./docs/master/authentication.md:527 msgid "Protecting Routes" -msgstr "保護路由" +msgstr "" -#: docs/10.x/authentication.md:block 69 (paragraph) +# P +#: ./docs/8.x/authentication.md:179 +#: ./docs/9.x/authentication.md:182 +#: ./docs/10.x/authentication.md:184 msgid "[Route middleware](/docs/{{version}}/middleware) can be used to only allow authenticated users to access a given route. Laravel ships with an `auth` middleware, which references the `Illuminate\\Auth\\Middleware\\Authenticate` class. Since this middleware is already registered in your application's HTTP kernel, all you need to do is attach the middleware to a route definition:" -msgstr "[路由 Middleware](/docs/{{version}}/middleware) 可以用來只允許已認證的使用者存取指定的路由。Laravel 內建了一個 `auth` Middleware,這個 Middleware為 `Illuminate\\Auth\\Middleware\\Authenticate` 類別。由於該 Middleware已預先在專案中的 HTTP Kernel 內註冊好了,所以只需要在路由定義內加上這個 Middleware 即可:" +msgstr "" -#: docs/10.x/authentication.md:block 70 (code) +# CODE +#: ./docs/8.x/authentication.md:181 +#: ./docs/9.x/authentication.md:184 +#: ./docs/10.x/authentication.md:186 +#: ./docs/11.x/authentication.md:189 +#: ./docs/master/authentication.md:186 msgid "Route::get('/flights', function () {\n" " // Only authenticated users may access this route...\n" -"})->middleware('auth');\n" -msgstr "Route::get('/flights', function () {\n" -" // 只有已登入的使用者才能存取此路由…\n" -"})->middleware('auth');\n" +"})->middleware('auth');" +msgstr "" -#: docs/10.x/authentication.md:block 72 (header) +# P +#: ./docs/master/authentication.md:184 +msgid "[Route middleware](/docs/{{version}}/middleware) can be used to only allow authenticated users to access a given route. Laravel ships with an `auth` middleware, which is a [middleware alias](/docs/{{version}}/middleware#middleware-alias) for the `Illuminate\\Auth\\Middleware\\Authenticate` class. Since this middleware is already aliased internally by Laravel, all you need to do is attach the middleware to a route definition:" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:185 +#: ./docs/9.x/authentication.md:188 +#: ./docs/10.x/authentication.md:190 +#: ./docs/11.x/authentication.md:193 +#: ./docs/master/authentication.md:190 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:186 +#: ./docs/9.x/authentication.md:189 +#: ./docs/10.x/authentication.md:191 +#: ./docs/11.x/authentication.md:194 +#: ./docs/master/authentication.md:191 msgid "Redirecting Unauthenticated Users" -msgstr "重新導向未登入的使用者" +msgstr "" + +# P +#: ./docs/11.x/authentication.md:187 +msgid "[Route middleware](/docs/{{version}}/middleware) can be used to only allow authenticated users to access a given route. Laravel ships with an `auth` middleware, which is a [middleware alias](/docs/{{version}}/middleware#middleware-aliases) for the `Illuminate\\Auth\\Middleware\\Authenticate` class. Since this middleware is already aliased internally by Laravel, all you need to do is attach the middleware to a route definition:" +msgstr "" -#: docs/10.x/authentication.md:block 73 (paragraph) +# P +#: ./docs/8.x/authentication.md:188 +#: ./docs/9.x/authentication.md:191 +#: ./docs/10.x/authentication.md:193 msgid "When the `auth` middleware detects an unauthenticated user, it will redirect the user to the `login` [named route](/docs/{{version}}/routing#named-routes). You may modify this behavior by updating the `redirectTo` function in your application's `app/Http/Middleware/Authenticate.php` file:" -msgstr "當 `auth` Middleware 偵測到未登入的使用者,`auth` Middleware 會將使用者重新導向到 `login` 這個[帶名稱的路由](/docs/{{version}}/routing#named-routes)上。可以通過更新專案中 `app/Http/Middleware/Authenticate.php` 檔案內的 `redirectTo` 方法來更改此一行為。" +msgstr "" -#: docs/10.x/authentication.md:block 74 (code) -msgid "use Illuminate\\Http\\Request;\n\n" -"/**\n" +# CODE +#: ./docs/8.x/authentication.md:190 +#: ./docs/9.x/authentication.md:193 +msgid "/**\n" " * Get the path the user should be redirected to.\n" +" *\n" +" * @param \\Illuminate\\Http\\Request $request\n" +" * @return string\n" " */\n" -"protected function redirectTo(Request $request): string\n" +"protected function redirectTo($request)\n" "{\n" " return route('login');\n" -"}\n" -msgstr "use Illuminate\\Http\\Request;\n\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/authentication.md:195 +msgid "use Illuminate\\Http\\Request;\n\n" "/**\n" " * Get the path the user should be redirected to.\n" " */\n" "protected function redirectTo(Request $request): string\n" "{\n" " return route('login');\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/authentication.md:196 +#: ./docs/master/authentication.md:193 +msgid "When the `auth` middleware detects an unauthenticated user, it will redirect the user to the `login` [named route](/docs/{{version}}/routing#named-routes). You may modify this behavior using the method `redirectGuestsTo` of your application's `bootstrap/app.php` file:" +msgstr "" -#: docs/10.x/authentication.md:block 76 (header) +# CODE +#: ./docs/11.x/authentication.md:198 +#: ./docs/master/authentication.md:195 +msgid "use Illuminate\\Http\\Request;\n\n" +"->withMiddleware(function (Middleware $middleware) {\n" +" $middleware->redirectGuestsTo('/login');\n\n" +" // Using a closure...\n" +" $middleware->redirectGuestsTo(fn (Request $request) => route('login'));\n" +"})" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:201 +#: ./docs/9.x/authentication.md:204 +#: ./docs/10.x/authentication.md:205 +#: ./docs/11.x/authentication.md:207 +#: ./docs/master/authentication.md:204 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:202 +#: ./docs/9.x/authentication.md:205 msgid "Specifying A Guard" -msgstr "指定 Guard" +msgstr "" -#: docs/10.x/authentication.md:block 77 (paragraph) +# P +#: ./docs/8.x/authentication.md:204 +#: ./docs/9.x/authentication.md:207 +#: ./docs/10.x/authentication.md:208 +#: ./docs/11.x/authentication.md:210 +#: ./docs/master/authentication.md:207 msgid "When attaching the `auth` middleware to a route, you may also specify which \"guard\" should be used to authenticate the user. The guard specified should correspond to one of the keys in the `guards` array of your `auth.php` configuration file:" -msgstr "在將 `auth` 中間層加到路由時,可以指定要使用哪個「Guard」來認證使用者。可以通過指定 `auth.php` 設定檔中 `guards` 陣列內對應的鍵值來指定 Guard:" +msgstr "" + +# H4 +#: ./docs/10.x/authentication.md:206 +#: ./docs/11.x/authentication.md:208 +#: ./docs/master/authentication.md:205 +msgid "Specifying a Guard" +msgstr "" -#: docs/10.x/authentication.md:block 78 (code) +# CODE +#: ./docs/8.x/authentication.md:206 +#: ./docs/9.x/authentication.md:209 +#: ./docs/10.x/authentication.md:210 +#: ./docs/11.x/authentication.md:212 +#: ./docs/master/authentication.md:209 msgid "Route::get('/flights', function () {\n" " // Only authenticated users may access this route...\n" -"})->middleware('auth:admin');\n" -msgstr "Route::get('/flights', function () {\n" -" // 只有已登入的使用者才能存取該 Route...\n" -"})->middleware('auth:admin');\n" +"})->middleware('auth:admin');" +msgstr "" -#: docs/10.x/authentication.md:block 80 (header) +# P +#: ./docs/8.x/authentication.md:210 +#: ./docs/9.x/authentication.md:213 +#: ./docs/10.x/authentication.md:214 +#: ./docs/11.x/authentication.md:216 +#: ./docs/master/authentication.md:213 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:211 +#: ./docs/9.x/authentication.md:214 +#: ./docs/10.x/authentication.md:215 +#: ./docs/11.x/authentication.md:217 +#: ./docs/master/authentication.md:214 msgid "Login Throttling" -msgstr "登入頻率限制" +msgstr "" -#: docs/10.x/authentication.md:block 81 (paragraph) +# P +#: ./docs/8.x/authentication.md:213 +#: ./docs/9.x/authentication.md:216 +#: ./docs/10.x/authentication.md:217 +#: ./docs/11.x/authentication.md:219 +#: ./docs/master/authentication.md:216 msgid "If you are using the Laravel Breeze or Laravel Jetstream [starter kits](/docs/{{version}}/starter-kits), rate limiting will automatically be applied to login attempts. By default, the user will not be able to login for one minute if they fail to provide the correct credentials after several attempts. The throttling is unique to the user's username / email address and their IP address." -msgstr "若使用 Laravel Breeze 或 Laravel Jetstream [入門套件](/docs/{{version}}/starter-kits),會自動將頻率限制套用到登入限制上。預設情況下,若使用者嘗試了數次仍未提供正確的帳號密碼,則將在一分鐘之內都無法登入。登入限制是基於每個使用者的使用者名稱或電子郵件,以及其 IP 位址來區分的。" +msgstr "" -#: docs/10.x/authentication.md:block 82 (quote) -msgid "**Note** If you would like to rate limit other routes in your application, check out the [rate limiting documentation](/docs/{{version}}/routing#rate-limiting)." -msgstr "**Note** 若想在專案中的其他 Route 上提供頻率限制,請參考[頻率限制的說明文件](/docs/{{version}}/routing#rate-limiting)。" +# P +#: ./docs/8.x/authentication.md:215 +#: ./docs/9.x/authentication.md:219 +#: ./docs/10.x/authentication.md:220 +#: ./docs/11.x/authentication.md:222 +#: ./docs/master/authentication.md:219 +msgid "If you would like to rate limit other routes in your application, check out the [rate limiting documentation](/docs/{{version}}/routing#rate-limiting)." +msgstr "" -#: docs/10.x/authentication.md:block 84 (header) +# P +#: ./docs/8.x/authentication.md:217 +#: ./docs/9.x/authentication.md:221 +#: ./docs/10.x/authentication.md:222 +#: ./docs/11.x/authentication.md:224 +#: ./docs/master/authentication.md:221 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authentication.md:218 +#: ./docs/9.x/authentication.md:222 +#: ./docs/10.x/authentication.md:223 +#: ./docs/11.x/authentication.md:225 +#: ./docs/master/authentication.md:222 msgid "Manually Authenticating Users" -msgstr "手動認證使用者" +msgstr "" -#: docs/10.x/authentication.md:block 85 (paragraph) +# P +#: ./docs/8.x/authentication.md:220 +#: ./docs/9.x/authentication.md:224 +#: ./docs/10.x/authentication.md:225 +#: ./docs/11.x/authentication.md:227 +#: ./docs/master/authentication.md:224 msgid "You are not required to use the authentication scaffolding included with Laravel's [application starter kits](/docs/{{version}}/starter-kits). If you choose not to use this scaffolding, you will need to manage user authentication using the Laravel authentication classes directly. Don't worry, it's a cinch!" -msgstr "不一定要使用 Laravel [專案入門套件](/docs/{{version}}/starter-kits) 內包含的認證 Scaffolding。若決定不使用這些 Scaffolding 的話,就需要直接使用 Laravel 的認證類別來處理使用者認證。別擔心,這只是小菜一碟!" +msgstr "" -#: docs/10.x/authentication.md:block 86 (paragraph) +# P +#: ./docs/8.x/authentication.md:222 +#: ./docs/9.x/authentication.md:226 +#: ./docs/10.x/authentication.md:227 +#: ./docs/11.x/authentication.md:229 +#: ./docs/master/authentication.md:226 msgid "We will access Laravel's authentication services via the `Auth` [facade](/docs/{{version}}/facades), so we'll need to make sure to import the `Auth` facade at the top of the class. Next, let's check out the `attempt` method. The `attempt` method is normally used to handle authentication attempts from your application's \"login\" form. If authentication is successful, you should regenerate the user's [session](/docs/{{version}}/session) to prevent [session fixation](https://en.wikipedia.org/wiki/Session_fixation):" -msgstr "我們會通過 `Auth` [Facade](/docs/{{version}}/facades) 來存取 Laravel 的認證服務。因此,我們需要確保有在該類別的最上方引入 `Auth` Facade。接著,還要確認一下我們的 `attempt` 方法。這個 `attempt` 方法通常會用來處理來自網站「登入」表單的認證嘗試。若成功認證,則應該重新產生使用者的 [session](/docs/{{version}}/session) 來防止 [Session Fixation (英語)](https://en.wikipedia.org/wiki/Session_fixation):" +msgstr "" -#: docs/10.x/authentication.md:block 87 (code) +# CODE +#: ./docs/8.x/authentication.md:224 msgid "validate([\n" +" 'email' => ['required', 'email'],\n" +" 'password' => ['required'],\n" +" ]);\n\n" +" if (Auth::attempt($credentials)) {\n" +" $request->session()->regenerate();\n\n" +" return redirect()->intended('dashboard');\n" +" }\n\n" +" return back()->withErrors([\n" +" 'email' => 'The provided credentials do not match our records.',\n" +" ]);\n" +" }\n" +"}" +msgstr "" + +# CODE +#: ./docs/9.x/authentication.md:228 +msgid "validate([\n" " 'email' => ['required', 'email'],\n" @@ -487,8 +1318,14 @@ msgid " 'The provided credentials do not match our records.',\n" " ])->onlyInput('email');\n" " }\n" -"}\n" -msgstr " 'The provided credentials do not match our records.',\n" " ])->onlyInput('email');\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authentication.md:block 88 (paragraph) +# P +#: ./docs/8.x/authentication.md:258 +#: ./docs/9.x/authentication.md:262 +#: ./docs/10.x/authentication.md:261 +#: ./docs/11.x/authentication.md:263 +#: ./docs/master/authentication.md:260 msgid "The `attempt` method accepts an array of key / value pairs as its first argument. The values in the array will be used to find the user in your database table. So, in the example above, the user will be retrieved by the value of the `email` column. If the user is found, the hashed password stored in the database will be compared with the `password` value passed to the method via the array. You should not hash the incoming request's `password` value, since the framework will automatically hash the value before comparing it to the hashed password in the database. An authenticated session will be started for the user if the two hashed passwords match." -msgstr "`attempt` 方法接收包含了索引鍵/值配對的陣列作為其第一個引數。陣列中的值會被用來在資料庫資料表中尋找使用者。因此,在上方的範例中,使用者會依照 `email` 欄位中的值來取得。若找到該使用者,則會將資料庫中儲存的密碼雜湊跟陣列中的 `password` 值進行比對。請不要將連入請求的 `password` 進行雜湊,因為框架會自動在與資料庫中雜湊密碼比對時自動對齊進行雜湊。當兩個雜湊密碼相符合時,將開始該使用者的認證 Session。" +msgstr "" -#: docs/10.x/authentication.md:block 89 (paragraph) +# P +#: ./docs/8.x/authentication.md:260 +#: ./docs/9.x/authentication.md:264 +#: ./docs/10.x/authentication.md:263 +#: ./docs/11.x/authentication.md:265 +#: ./docs/master/authentication.md:262 msgid "Remember, Laravel's authentication services will retrieve users from your database based on your authentication guard's \"provider\" configuration. In the default `config/auth.php` configuration file, the Eloquent user provider is specified and it is instructed to use the `App\\Models\\User` model when retrieving users. You may change these values within your configuration file based on the needs of your application." -msgstr "請記得,Laravel 的認證服務會依據認證 Guard 的「provider」設定來從資料庫中取得使用者。預設的 `config/auth.php` 設定檔中使用了 Eloquent User Provider,並使用 `App\\Models\\User` Model 來取得使用者。可以依照專案需求來在設定檔中更改這些值。" +msgstr "" -#: docs/10.x/authentication.md:block 90 (paragraph) +# P +#: ./docs/8.x/authentication.md:262 +#: ./docs/9.x/authentication.md:266 +#: ./docs/10.x/authentication.md:265 +#: ./docs/11.x/authentication.md:267 +#: ./docs/master/authentication.md:264 msgid "The `attempt` method will return `true` if authentication was successful. Otherwise, `false` will be returned." -msgstr "當認證成功後,`attempt` 方法會回傳 `true`。否則,會回傳 `false`。" +msgstr "" -#: docs/10.x/authentication.md:block 91 (paragraph) +# P +#: ./docs/8.x/authentication.md:264 +#: ./docs/9.x/authentication.md:268 +#: ./docs/10.x/authentication.md:267 +#: ./docs/11.x/authentication.md:269 +#: ./docs/master/authentication.md:266 msgid "The `intended` method provided by Laravel's redirector will redirect the user to the URL they were attempting to access before being intercepted by the authentication middleware. A fallback URI may be given to this method in case the intended destination is not available." -msgstr "Laravel 的重新導向程式中提供的 `intended` 方法可以用來將使用者導向到他們被認證中間層攔截存取前正在嘗試存取的 URL。可以提供一個遞補的 URI 給該方法,以免沒有預期的目的地。" +msgstr "" -#: docs/10.x/authentication.md:block 93 (header) +# P +#: ./docs/8.x/authentication.md:266 +#: ./docs/9.x/authentication.md:270 +#: ./docs/10.x/authentication.md:269 +#: ./docs/11.x/authentication.md:271 +#: ./docs/master/authentication.md:268 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:267 +#: ./docs/9.x/authentication.md:271 +#: ./docs/10.x/authentication.md:270 +#: ./docs/11.x/authentication.md:272 +#: ./docs/master/authentication.md:269 msgid "Specifying Additional Conditions" -msgstr "指定額外條件" +msgstr "" -#: docs/10.x/authentication.md:block 94 (paragraph) +# P +#: ./docs/8.x/authentication.md:269 +#: ./docs/9.x/authentication.md:273 +#: ./docs/10.x/authentication.md:272 +#: ./docs/11.x/authentication.md:274 +#: ./docs/master/authentication.md:271 msgid "If you wish, you may also add extra query conditions to the authentication query in addition to the user's email and password. To accomplish this, we may simply add the query conditions to the array passed to the `attempt` method. For example, we may verify that the user is marked as \"active\":" -msgstr "若有需要的話,也可以在認證查詢上指定除了使用者的電子郵件與密碼外的額外查詢條件。為此,只需要將查詢條件加到傳給 `attempt` 方法的陣列中即可。如,我們可以認證使用者有被標示為「啟用」:" +msgstr "" -#: docs/10.x/authentication.md:block 95 (code) +# CODE +#: ./docs/8.x/authentication.md:271 +#: ./docs/9.x/authentication.md:275 +#: ./docs/10.x/authentication.md:274 +#: ./docs/11.x/authentication.md:276 +#: ./docs/master/authentication.md:273 msgid "if (Auth::attempt(['email' => $email, 'password' => $password, 'active' => 1])) {\n" " // Authentication was successful...\n" -"}\n" -msgstr "if (Auth::attempt(['email' => $email, 'password' => $password, 'active' => 1])) {\n" -" // 認證成功...\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:275 +#: ./docs/9.x/authentication.md:290 +#: ./docs/10.x/authentication.md:291 +#: ./docs/11.x/authentication.md:293 +#: ./docs/master/authentication.md:290 +msgid "In these examples, `email` is not a required option, it is merely used as an example. You should use whatever column name corresponds to a \"username\" in your database table." +msgstr "" + +# P +#: ./docs/8.x/authentication.md:277 +#: ./docs/9.x/authentication.md:303 +#: ./docs/10.x/authentication.md:304 +#: ./docs/11.x/authentication.md:306 +#: ./docs/master/authentication.md:303 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:278 +#: ./docs/9.x/authentication.md:304 +#: ./docs/10.x/authentication.md:305 +#: ./docs/11.x/authentication.md:307 +#: ./docs/master/authentication.md:304 +msgid "Accessing Specific Guard Instances" +msgstr "" -#: docs/10.x/authentication.md:block 96 (paragraph) +# P +#: ./docs/9.x/authentication.md:279 +#: ./docs/10.x/authentication.md:278 +#: ./docs/11.x/authentication.md:280 +#: ./docs/master/authentication.md:277 msgid "For complex query conditions, you may provide a closure in your array of credentials. This closure will be invoked with the query instance, allowing you to customize the query based on your application's needs:" -msgstr "對於複雜的查詢條件,可以提供在帳號密碼陣列中提供一個閉包。Laravel 會以查詢實體來呼叫此閉包,讓你可以依據專案需求自定查詢:" +msgstr "" -#: docs/10.x/authentication.md:block 97 (code) +# CODE +#: ./docs/10.x/authentication.md:280 +#: ./docs/master/authentication.md:279 msgid "use Illuminate\\Database\\Eloquent\\Builder;\n\n" "if (Auth::attempt([\n" " 'email' => $email, \n" @@ -558,230 +1471,584 @@ msgid "use Illuminate\\Database\\Eloquent\\Builder;\n\n" " fn (Builder $query) => $query->has('activeSubscription'),\n" "])) {\n" " // Authentication was successful...\n" -"}\n" -msgstr "use Illuminate\\Database\\Eloquent\\Builder;\n\n" -"if (Auth::attempt([\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:280 +#: ./docs/9.x/authentication.md:306 +#: ./docs/10.x/authentication.md:307 +#: ./docs/11.x/authentication.md:309 +#: ./docs/master/authentication.md:306 +msgid "Via the `Auth` facade's `guard` method, you may specify which guard instance you would like to utilize when authenticating the user. This allows you to manage authentication for separate parts of your application using entirely separate authenticatable models or user tables." +msgstr "" + +# CODE +#: ./docs/9.x/authentication.md:281 +msgid "if (Auth::attempt([\n" " 'email' => $email, \n" " 'password' => $password, \n" +" fn ($query) => $query->has('activeSubscription'),\n" +"])) {\n" +" // Authentication was successful...\n" +"}" +msgstr "" + +# CODE +#: ./docs/11.x/authentication.md:282 +msgid "use Illuminate\\Database\\Eloquent\\Builder;\n\n" +"if (Auth::attempt([\n" +" 'email' => $email,\n" +" 'password' => $password,\n" " fn (Builder $query) => $query->has('activeSubscription'),\n" "])) {\n" -" // 登入成功...\n" -"}\n" +" // Authentication was successful...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:282 +#: ./docs/9.x/authentication.md:308 +#: ./docs/10.x/authentication.md:309 +#: ./docs/11.x/authentication.md:311 +#: ./docs/master/authentication.md:308 +msgid "The guard name passed to the `guard` method should correspond to one of the guards configured in your `auth.php` configuration file:" +msgstr "" + +# CODE +#: ./docs/8.x/authentication.md:284 +#: ./docs/9.x/authentication.md:310 +#: ./docs/10.x/authentication.md:311 +#: ./docs/11.x/authentication.md:313 +#: ./docs/master/authentication.md:310 +msgid "if (Auth::guard('admin')->attempt($credentials)) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:288 +#: ./docs/9.x/authentication.md:314 +#: ./docs/10.x/authentication.md:315 +#: ./docs/11.x/authentication.md:317 +#: ./docs/master/authentication.md:314 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:289 +#: ./docs/9.x/authentication.md:315 +#: ./docs/10.x/authentication.md:316 +#: ./docs/11.x/authentication.md:318 +#: ./docs/master/authentication.md:315 +msgid "Remembering Users" +msgstr "" -#: docs/10.x/authentication.md:block 98 (quote) -msgid "**Warning** In these examples, `email` is not a required option, it is merely used as an example. You should use whatever column name corresponds to a \"username\" in your database table." -msgstr "**Warning** 不一定要像這個例子一樣使用 `email` 欄位,此處只是以 E-Mail 當作範例。可以使用任何在資料庫中相當於「使用者名稱」的欄位來認證。" +# P +#: ./docs/8.x/authentication.md:291 +#: ./docs/9.x/authentication.md:317 +#: ./docs/10.x/authentication.md:318 +#: ./docs/11.x/authentication.md:320 +#: ./docs/master/authentication.md:317 +msgid "Many web applications provide a \"remember me\" checkbox on their login form. If you would like to provide \"remember me\" functionality in your application, you may pass a boolean value as the second argument to the `attempt` method." +msgstr "" -#: docs/10.x/authentication.md:block 99 (paragraph) +# P +#: ./docs/9.x/authentication.md:292 +#: ./docs/10.x/authentication.md:293 +#: ./docs/11.x/authentication.md:295 +#: ./docs/master/authentication.md:292 msgid "The `attemptWhen` method, which receives a closure as its second argument, may be used to perform more extensive inspection of the potential user before actually authenticating the user. The closure receives the potential user and should return `true` or `false` to indicate if the user may be authenticated:" -msgstr "`attemptWhen` 方法所接收的第二個引數為閉包,該閉包可用來在使用者實際登入前,對正在嘗試登入的使用者執行更進一步的檢驗。這個閉包會收到正在嘗試登入的使用者,並應回傳 `true` 或 `false` 來表示使用者是否可登入:" +msgstr "" -#: docs/10.x/authentication.md:block 100 (code) +# P +#: ./docs/8.x/authentication.md:293 +#: ./docs/9.x/authentication.md:319 +#: ./docs/10.x/authentication.md:320 +#: ./docs/11.x/authentication.md:322 +#: ./docs/master/authentication.md:319 +msgid "When this value is `true`, Laravel will keep the user authenticated indefinitely or until they manually logout. Your `users` table must include the string `remember_token` column, which will be used to store the \"remember me\" token. The `users` table migration included with new Laravel applications already includes this column:" +msgstr "" + +# CODE +#: ./docs/9.x/authentication.md:294 msgid "if (Auth::attemptWhen([\n" " 'email' => $email,\n" " 'password' => $password,\n" -"], function (User $user) {\n" +"], function ($user) {\n" " return $user->isNotBanned();\n" "})) {\n" " // Authentication was successful...\n" -"}\n" -msgstr "if (Auth::attemptWhen([\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/authentication.md:295 +#: ./docs/11.x/authentication.md:297 +#: ./docs/master/authentication.md:294 +msgid "if (Auth::attemptWhen([\n" " 'email' => $email,\n" " 'password' => $password,\n" "], function (User $user) {\n" " return $user->isNotBanned();\n" "})) {\n" -" // 登入成功...\n" -"}\n" - -#: docs/10.x/authentication.md:block 102 (header) -msgid "Accessing Specific Guard Instances" -msgstr "存取特定 Guard 實體" - -#: docs/10.x/authentication.md:block 103 (paragraph) -msgid "Via the `Auth` facade's `guard` method, you may specify which guard instance you would like to utilize when authenticating the user. This allows you to manage authentication for separate parts of your application using entirely separate authenticatable models or user tables." -msgstr "通過 `Auth` Facade 的 `guard` 方法,可以指定使用者登入時要使用哪個 Guard 實體。如此一來便能為專案中不同部分的登入功能使用不同的 Authenticatable Model 或使用者資料表。" - -#: docs/10.x/authentication.md:block 104 (paragraph) -msgid "The guard name passed to the `guard` method should correspond to one of the guards configured in your `auth.php` configuration file:" -msgstr "傳如 `guard` 方法的 Guard 名稱應為 `auth.php` 設定檔中設定的其中一個 Guard 名稱:" - -#: docs/10.x/authentication.md:block 105 (code) -msgid "if (Auth::guard('admin')->attempt($credentials)) {\n" -" // ...\n" -"}\n" -msgstr "if (Auth::guard('admin')->attempt($credentials)) {\n" -" // ...\n" -"}\n" - -#: docs/10.x/authentication.md:block 107 (header) -msgid "Remembering Users" -msgstr "記住使用者" - -#: docs/10.x/authentication.md:block 108 (paragraph) -msgid "Many web applications provide a \"remember me\" checkbox on their login form. If you would like to provide \"remember me\" functionality in your application, you may pass a boolean value as the second argument to the `attempt` method." -msgstr "許多網站的登入表單內都有一個「記住我」勾選框。若想為你的網站提供「記住我」功能,可以傳入布林值給 `attempt` 方法的第二個引數。" - -#: docs/10.x/authentication.md:block 109 (paragraph) -msgid "When this value is `true`, Laravel will keep the user authenticated indefinitely or until they manually logout. Your `users` table must include the string `remember_token` column, which will be used to store the \"remember me\" token. The `users` table migration included with new Laravel applications already includes this column:" -msgstr "當該值為 `true` 時,Laravel 會永久儲存使用者的登入狀態,直到使用者手動登出。你的 `users` 資料表必須包含 `remember_token` 字串欄位,該欄位用來儲存「記住我」權杖。在新的 Laravel 專案中,`users` 資料表的 Migration 已包含了此欄位:" +" // Authentication was successful...\n" +"}" +msgstr "" -#: docs/10.x/authentication.md:block 110 (code) +# CODE +#: ./docs/8.x/authentication.md:295 +#: ./docs/9.x/authentication.md:321 +#: ./docs/10.x/authentication.md:322 +#: ./docs/11.x/authentication.md:324 +#: ./docs/master/authentication.md:321 msgid "use Illuminate\\Support\\Facades\\Auth;\n\n" "if (Auth::attempt(['email' => $email, 'password' => $password], $remember)) {\n" " // The user is being remembered...\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Auth;\n\n" -"if (Auth::attempt(['email' => $email, 'password' => $password], $remember)) {\n" -" // 已記住使用者...\n" -"}\n" - -#: docs/10.x/authentication.md:block 111 (paragraph) -msgid "If your application offers \"remember me\" functionality, you may use the `viaRemember` method to determine if the currently authenticated user was authenticated using the \"remember me\" cookie:" -msgstr "若專案有提供「記住我」的功能,則可使用 `viaRemember` 方法來判斷目前登入的使用者是否是使用「記住我」Cookie 登入的:" - -#: docs/10.x/authentication.md:block 112 (code) -msgid "use Illuminate\\Support\\Facades\\Auth;\n\n" -"if (Auth::viaRemember()) {\n" -" // ...\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Auth;\n\n" -"if (Auth::viaRemember()) {\n" -" // ...\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authentication.md:block 114 (header) +# P +#: ./docs/8.x/authentication.md:301 +#: ./docs/9.x/authentication.md:335 +#: ./docs/10.x/authentication.md:336 +#: ./docs/11.x/authentication.md:338 +#: ./docs/master/authentication.md:335 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:302 +#: ./docs/9.x/authentication.md:336 +#: ./docs/10.x/authentication.md:337 +#: ./docs/11.x/authentication.md:339 +#: ./docs/master/authentication.md:336 msgid "Other Authentication Methods" -msgstr "其他認證方法" +msgstr "" -#: docs/10.x/authentication.md:block 116 (header) +# P +#: ./docs/8.x/authentication.md:304 +#: ./docs/9.x/authentication.md:338 +#: ./docs/10.x/authentication.md:339 +#: ./docs/11.x/authentication.md:341 +#: ./docs/master/authentication.md:338 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:305 +#: ./docs/9.x/authentication.md:339 msgid "Authenticate A User Instance" -msgstr "認證使用者實體" +msgstr "" -#: docs/10.x/authentication.md:block 117 (paragraph) +# P +#: ./docs/8.x/authentication.md:307 +#: ./docs/9.x/authentication.md:341 +#: ./docs/10.x/authentication.md:342 +#: ./docs/11.x/authentication.md:344 +#: ./docs/master/authentication.md:341 msgid "If you need to set an existing user instance as the currently authenticated user, you may pass the user instance to the `Auth` facade's `login` method. The given user instance must be an implementation of the `Illuminate\\Contracts\\Auth\\Authenticatable` [contract](/docs/{{version}}/contracts). The `App\\Models\\User` model included with Laravel already implements this interface. This method of authentication is useful when you already have a valid user instance, such as directly after a user registers with your application:" -msgstr "若需要將目前已認證使用者設為一個現有的使用者實體,可以將該實體傳入 `Auth` Facade 的 `login` 方法內。給定的使用者實體必須要實作 `Illuminate\\Contracts\\Auth\\Authenticatable` [Contract](/docs/{{version}}/contracts)。Laravel 中的 `App\\Models\\User` Model 已經實作了這個介面。這種認證的方法適用與已有有效使用者實體的情況,如使用者在網站上註冊之後:" +msgstr "" -#: docs/10.x/authentication.md:block 118 (code) +# CODE +#: ./docs/8.x/authentication.md:309 +#: ./docs/9.x/authentication.md:343 +#: ./docs/10.x/authentication.md:344 +#: ./docs/11.x/authentication.md:346 +#: ./docs/master/authentication.md:343 msgid "use Illuminate\\Support\\Facades\\Auth;\n\n" -"Auth::login($user);\n" -msgstr "use Illuminate\\Support\\Facades\\Auth;\n\n" -"Auth::login($user);\n" +"Auth::login($user);" +msgstr "" -#: docs/10.x/authentication.md:block 119 (paragraph) +# P +#: ./docs/8.x/authentication.md:313 +#: ./docs/9.x/authentication.md:347 +#: ./docs/10.x/authentication.md:348 +#: ./docs/11.x/authentication.md:350 +#: ./docs/master/authentication.md:347 msgid "You may pass a boolean value as the second argument to the `login` method. This value indicates if \"remember me\" functionality is desired for the authenticated session. Remember, this means that the session will be authenticated indefinitely or until the user manually logs out of the application:" -msgstr "可以將布林值傳入 `login` 方法的第二個引數。這個布林值會用來判斷該登入 Session 是否可套用「記住我」功能。請記得,啟用該功能就表示這個 Session 將永久可用,直到使用者手動登出:" +msgstr "" -#: docs/10.x/authentication.md:block 120 (code) -msgid "Auth::login($user, $remember = true);\n" -msgstr "Auth::login($user, $remember = true);\n" +# CODE +#: ./docs/8.x/authentication.md:315 +#: ./docs/9.x/authentication.md:349 +#: ./docs/10.x/authentication.md:350 +#: ./docs/11.x/authentication.md:352 +#: ./docs/master/authentication.md:349 +msgid "Auth::login($user, $remember = true);" +msgstr "" -#: docs/10.x/authentication.md:block 121 (paragraph) +# P +#: ./docs/8.x/authentication.md:317 +#: ./docs/9.x/authentication.md:351 +#: ./docs/10.x/authentication.md:352 +#: ./docs/11.x/authentication.md:354 +#: ./docs/master/authentication.md:351 msgid "If needed, you may specify an authentication guard before calling the `login` method:" -msgstr "若有需要,可以在呼叫 `login` 方法前指定一個認證 Guard:" +msgstr "" -#: docs/10.x/authentication.md:block 122 (code) -msgid "Auth::guard('admin')->login($user);\n" -msgstr "Auth::guard('admin')->login($user);\n" +# CODE +#: ./docs/8.x/authentication.md:319 +#: ./docs/9.x/authentication.md:353 +#: ./docs/10.x/authentication.md:354 +#: ./docs/11.x/authentication.md:356 +#: ./docs/master/authentication.md:353 +msgid "Auth::guard('admin')->login($user);" +msgstr "" -#: docs/10.x/authentication.md:block 124 (header) +# P +#: ./docs/8.x/authentication.md:321 +#: ./docs/9.x/authentication.md:355 +#: ./docs/10.x/authentication.md:356 +#: ./docs/11.x/authentication.md:358 +#: ./docs/master/authentication.md:355 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:322 +#: ./docs/9.x/authentication.md:356 msgid "Authenticate A User By ID" -msgstr "通過 ID 認證使用者" +msgstr "" -#: docs/10.x/authentication.md:block 125 (paragraph) +# P +#: ./docs/8.x/authentication.md:324 +#: ./docs/9.x/authentication.md:358 +#: ./docs/10.x/authentication.md:359 +#: ./docs/11.x/authentication.md:361 +#: ./docs/master/authentication.md:358 msgid "To authenticate a user using their database record's primary key, you may use the `loginUsingId` method. This method accepts the primary key of the user you wish to authenticate:" -msgstr "若要使用資料庫中的主索引鍵 (Primary Key) 來認證使用者,可以使用 `loginUsingId` 方法。該方法接受要用來認證使用者的主索引鍵值:" +msgstr "" + +# CODE +#: ./docs/8.x/authentication.md:326 +#: ./docs/9.x/authentication.md:360 +#: ./docs/10.x/authentication.md:361 +#: ./docs/11.x/authentication.md:363 +#: ./docs/master/authentication.md:360 +msgid "Auth::loginUsingId(1);" +msgstr "" -#: docs/10.x/authentication.md:block 126 (code) -msgid "Auth::loginUsingId(1);\n" -msgstr "Auth::loginUsingId(1);\n" +# P +#: ./docs/9.x/authentication.md:327 +#: ./docs/10.x/authentication.md:328 +#: ./docs/11.x/authentication.md:330 +#: ./docs/master/authentication.md:327 +msgid "If your application offers \"remember me\" functionality, you may use the `viaRemember` method to determine if the currently authenticated user was authenticated using the \"remember me\" cookie:" +msgstr "" -#: docs/10.x/authentication.md:block 127 (paragraph) +# P +#: ./docs/8.x/authentication.md:328 +#: ./docs/9.x/authentication.md:362 +#: ./docs/10.x/authentication.md:363 +#: ./docs/master/authentication.md:362 msgid "You may pass a boolean value as the second argument to the `loginUsingId` method. This value indicates if \"remember me\" functionality is desired for the authenticated session. Remember, this means that the session will be authenticated indefinitely or until the user manually logs out of the application:" -msgstr "可以將布林值傳入 `loginUsingId` 方法的第二個引數。這個布林值會用來判斷該登入 Session 是否可套用「記住我」功能。請記得,啟用該功能就標示該 Session 將永久可用,直到使用者手動登出:" +msgstr "" + +# CODE +#: ./docs/9.x/authentication.md:329 +#: ./docs/10.x/authentication.md:330 +#: ./docs/11.x/authentication.md:332 +#: ./docs/master/authentication.md:329 +msgid "use Illuminate\\Support\\Facades\\Auth;\n\n" +"if (Auth::viaRemember()) {\n" +" // ...\n" +"}" +msgstr "" -#: docs/10.x/authentication.md:block 128 (code) -msgid "Auth::loginUsingId(1, $remember = true);\n" -msgstr "Auth::loginUsingId(1, $remember = true);\n" +# CODE +#: ./docs/8.x/authentication.md:330 +#: ./docs/9.x/authentication.md:364 +#: ./docs/10.x/authentication.md:365 +#: ./docs/master/authentication.md:364 +msgid "Auth::loginUsingId(1, $remember = true);" +msgstr "" -#: docs/10.x/authentication.md:block 130 (header) +# P +#: ./docs/8.x/authentication.md:332 +#: ./docs/9.x/authentication.md:366 +#: ./docs/10.x/authentication.md:367 +#: ./docs/11.x/authentication.md:369 +#: ./docs/master/authentication.md:366 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:333 +#: ./docs/9.x/authentication.md:367 msgid "Authenticate A User Once" -msgstr "僅認證使用者一次" +msgstr "" -#: docs/10.x/authentication.md:block 131 (paragraph) +# P +#: ./docs/8.x/authentication.md:335 +#: ./docs/9.x/authentication.md:369 +#: ./docs/10.x/authentication.md:370 +#: ./docs/11.x/authentication.md:372 +#: ./docs/master/authentication.md:369 msgid "You may use the `once` method to authenticate a user with the application for a single request. No sessions or cookies will be utilized when calling this method:" -msgstr "可以使用 `once` 方法來只在單一請求內認證使用者。呼叫此方法時不會使用到 Session 或 Cookie:" +msgstr "" -#: docs/10.x/authentication.md:block 132 (code) +# CODE +#: ./docs/8.x/authentication.md:337 +#: ./docs/9.x/authentication.md:371 msgid "if (Auth::once($credentials)) {\n" -" // ...\n" -"}\n" -msgstr "if (Auth::once($credentials)) {\n" -" // ...\n" -"}\n" +" //\n" +"}" +msgstr "" + +# H4 +#: ./docs/10.x/authentication.md:340 +#: ./docs/11.x/authentication.md:342 +#: ./docs/master/authentication.md:339 +msgid "Authenticate a User Instance" +msgstr "" -#: docs/10.x/authentication.md:block 134 (header) +# P +#: ./docs/8.x/authentication.md:341 +#: ./docs/9.x/authentication.md:375 +#: ./docs/10.x/authentication.md:376 +#: ./docs/11.x/authentication.md:378 +#: ./docs/master/authentication.md:375 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authentication.md:342 +#: ./docs/9.x/authentication.md:376 +#: ./docs/10.x/authentication.md:377 +#: ./docs/11.x/authentication.md:379 +#: ./docs/master/authentication.md:376 msgid "HTTP Basic Authentication" -msgstr "HTTP 基本認證" +msgstr "" -#: docs/10.x/authentication.md:block 135 (paragraph) +# P +#: ./docs/8.x/authentication.md:344 +#: ./docs/9.x/authentication.md:378 +#: ./docs/10.x/authentication.md:379 +#: ./docs/11.x/authentication.md:381 +#: ./docs/master/authentication.md:378 msgid "[HTTP Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) provides a quick way to authenticate users of your application without setting up a dedicated \"login\" page. To get started, attach the `auth.basic` [middleware](/docs/{{version}}/middleware) to a route. The `auth.basic` middleware is included with the Laravel framework, so you do not need to define it:" -msgstr "[HTTP 基本認證](https://zh.wikipedia.org/zh-tw/HTTP%E5%9F%BA%E6%9C%AC%E8%AE%A4%E8%AF%81)提供了一種不需要設定專屬「登入」頁面而快速認證專案中使用者的方法。要進行 HTTP 基本認證,請將 `auth.basic` [Middleware](/docs/{{version}}/middleware) 加到路由上。`auth.basic` Middleware 已包含在 Laravel 框架內,不需要自行定義:" +msgstr "" -#: docs/10.x/authentication.md:block 136 (code) +# CODE +#: ./docs/8.x/authentication.md:346 +#: ./docs/9.x/authentication.md:380 +#: ./docs/10.x/authentication.md:381 +#: ./docs/11.x/authentication.md:383 +#: ./docs/master/authentication.md:380 msgid "Route::get('/profile', function () {\n" " // Only authenticated users may access this route...\n" -"})->middleware('auth.basic');\n" -msgstr "Route::get('/profile', function () {\n" -" // 只有已登入使用者可以存取這個 Route...\n" -"})->middleware('auth.basic');\n" +"})->middleware('auth.basic');" +msgstr "" -#: docs/10.x/authentication.md:block 137 (paragraph) +# P +#: ./docs/8.x/authentication.md:350 +#: ./docs/9.x/authentication.md:384 +#: ./docs/10.x/authentication.md:385 +#: ./docs/11.x/authentication.md:387 +#: ./docs/master/authentication.md:384 msgid "Once the middleware has been attached to the route, you will automatically be prompted for credentials when accessing the route in your browser. By default, the `auth.basic` middleware will assume the `email` column on your `users` database table is the user's \"username\"." -msgstr "將該 Middleware 加到路由上後,在瀏覽器上存取該路由時會自動被提示帳號密碼。預設情況下,`auth.basic` 中間層會假設 `email` 欄位是 `users` 資料表中的使用者「帳號」欄位。" +msgstr "" -#: docs/10.x/authentication.md:block 139 (header) +# P +#: ./docs/8.x/authentication.md:352 +#: ./docs/9.x/authentication.md:386 +#: ./docs/10.x/authentication.md:387 +#: ./docs/11.x/authentication.md:389 +#: ./docs/master/authentication.md:386 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:353 +#: ./docs/9.x/authentication.md:387 msgid "A Note On FastCGI" -msgstr "FastCGI 備註" +msgstr "" -#: docs/10.x/authentication.md:block 140 (paragraph) +# P +#: ./docs/8.x/authentication.md:355 +#: ./docs/9.x/authentication.md:389 +#: ./docs/10.x/authentication.md:390 +#: ./docs/11.x/authentication.md:392 +#: ./docs/master/authentication.md:389 msgid "If you are using PHP FastCGI and Apache to serve your Laravel application, HTTP Basic authentication may not work correctly. To correct these problems, the following lines may be added to your application's `.htaccess` file:" -msgstr "若使用 PHP FastCGI 與 Apache 來執行 Laravel 專案,則 HTTP 基本認證可能不會正確運作。要修正這個問題,請將下列幾行加到專案的 `.htaccess` 檔中:" +msgstr "" + +# H4 +#: ./docs/10.x/authentication.md:357 +#: ./docs/11.x/authentication.md:359 +#: ./docs/master/authentication.md:356 +msgid "Authenticate a User by ID" +msgstr "" -#: docs/10.x/authentication.md:block 141 (code) +# CODE +# CODE: apache +#: ./docs/8.x/authentication.md:357 +#: ./docs/9.x/authentication.md:391 +#: ./docs/10.x/authentication.md:392 +#: ./docs/11.x/authentication.md:394 +#: ./docs/master/authentication.md:391 msgid "RewriteCond %{HTTP:Authorization} ^(.+)$\n" -"RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]\n" -msgstr "RewriteCond %{HTTP:Authorization} ^(.+)$\n" -"RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]\n" +"RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]" +msgstr "" -#: docs/10.x/authentication.md:block 143 (header) +# P +#: ./docs/8.x/authentication.md:360 +#: ./docs/9.x/authentication.md:396 +#: ./docs/10.x/authentication.md:397 +#: ./docs/11.x/authentication.md:399 +#: ./docs/master/authentication.md:396 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:361 +#: ./docs/9.x/authentication.md:397 +#: ./docs/10.x/authentication.md:398 +#: ./docs/11.x/authentication.md:400 +#: ./docs/master/authentication.md:397 msgid "Stateless HTTP Basic Authentication" -msgstr "無周邊 HTTP 基本認證" +msgstr "" -#: docs/10.x/authentication.md:block 144 (paragraph) +# P +#: ./docs/8.x/authentication.md:363 +#: ./docs/9.x/authentication.md:399 +#: ./docs/10.x/authentication.md:400 +#: ./docs/11.x/authentication.md:402 +#: ./docs/master/authentication.md:399 msgid "You may also use HTTP Basic Authentication without setting a user identifier cookie in the session. This is primarily helpful if you choose to use HTTP Authentication to authenticate requests to your application's API. To accomplish this, [define a middleware](/docs/{{version}}/middleware) that calls the `onceBasic` method. If no response is returned by the `onceBasic` method, the request may be passed further into the application:" -msgstr "也可以於不在 Session 內寫入可識別使用者 Cookie 的情況下使用 HTTP 基本認證。這個作法通常適用於想通過 HTTP 認證來認證網站 API 請求時。為此,請先[定義一個 Middleware](/docs/{{version}}/middleware),並在該 Middleware 中呼叫 `onceBasic` 方法。若 `onceBasic` 方法無回傳值,則該請求才會接著被傳遞到專案中:" +msgstr "" + +# P +#: ./docs/11.x/authentication.md:365 +msgid "You may pass a boolean value to the `remember` argument of the `loginUsingId` method. This value indicates if \"remember me\" functionality is desired for the authenticated session. Remember, this means that the session will be authenticated indefinitely or until the user manually logs out of the application:" +msgstr "" -#: docs/10.x/authentication.md:block 145 (code) +# CODE +#: ./docs/8.x/authentication.md:365 +#: ./docs/9.x/authentication.md:401 msgid "middleware('auth.basic.once');" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:393 +#: ./docs/9.x/authentication.md:429 +#: ./docs/10.x/authentication.md:431 +#: ./docs/11.x/authentication.md:433 +#: ./docs/master/authentication.md:430 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authentication.md:394 +#: ./docs/9.x/authentication.md:430 +#: ./docs/10.x/authentication.md:432 +#: ./docs/11.x/authentication.md:434 +#: ./docs/master/authentication.md:431 +msgid "Logging Out" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:396 +#: ./docs/9.x/authentication.md:432 +#: ./docs/10.x/authentication.md:434 +#: ./docs/11.x/authentication.md:436 +#: ./docs/master/authentication.md:433 +msgid "To manually log users out of your application, you may use the `logout` method provided by the `Auth` facade. This will remove the authentication information from the user's session so that subsequent requests are not authenticated." +msgstr "" + +# P +#: ./docs/8.x/authentication.md:398 +#: ./docs/9.x/authentication.md:434 +#: ./docs/10.x/authentication.md:436 +#: ./docs/11.x/authentication.md:438 +#: ./docs/master/authentication.md:435 +msgid "In addition to calling the `logout` method, it is recommended that you invalidate the user's session and regenerate their [CSRF token](/docs/{{version}}/csrf). After logging the user out, you would typically redirect the user to the root of your application:" +msgstr "" + +# CODE +#: ./docs/8.x/authentication.md:400 +#: ./docs/9.x/authentication.md:436 +msgid "use Illuminate\\Http\\Request;\n" +"use Illuminate\\Support\\Facades\\Auth;\n\n" +"/**\n" +" * Log the user out of the application.\n" +" *\n" +" * @param \\Illuminate\\Http\\Request $request\n" +" * @return \\Illuminate\\Http\\Response\n" +" */\n" +"public function logout(Request $request)\n" +"{\n" +" Auth::logout();\n\n" +" $request->session()->invalidate();\n\n" +" $request->session()->regenerateToken();\n\n" +" return redirect('/');\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/authentication.md:402 +#: ./docs/11.x/authentication.md:404 +#: ./docs/master/authentication.md:401 +msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:421 +#: ./docs/9.x/authentication.md:457 +msgid "Invalidating Sessions On Other Devices" +msgstr "" -#: docs/10.x/authentication.md:block 146 (paragraph) +# P +#: ./docs/8.x/authentication.md:423 +#: ./docs/9.x/authentication.md:459 +#: ./docs/10.x/authentication.md:459 +#: ./docs/11.x/authentication.md:461 +#: ./docs/master/authentication.md:458 +msgid "Laravel also provides a mechanism for invalidating and \"logging out\" a user's sessions that are active on other devices without invalidating the session on their current device. This feature is typically utilized when a user is changing or updating their password and you would like to invalidate sessions on other devices while keeping the current device authenticated." +msgstr "" + +# P +#: ./docs/10.x/authentication.md:425 +#: ./docs/11.x/authentication.md:427 +#: ./docs/master/authentication.md:424 msgid "Next, attach the middleware to a route:" -msgstr "接著,將這個 Middleware 附加到 Route 上:" +msgstr "" -#: docs/10.x/authentication.md:block 147 (code) +# P +#: ./docs/8.x/authentication.md:425 +msgid "Before getting started, you should make sure that the `Illuminate\\Session\\Middleware\\AuthenticateSession` middleware is present and un-commented in your `App\\Http\\Kernel` class' `web` middleware group:" +msgstr "" + +# CODE +#: ./docs/10.x/authentication.md:427 +#: ./docs/11.x/authentication.md:429 +#: ./docs/master/authentication.md:426 msgid "Route::get('/api/user', function () {\n" " // Only authenticated users may access this route...\n" -"})->middleware(AuthenticateOnceWithBasicAuth::class);\n" -msgstr "Route::get('/api/user', function () {\n" -" // 只有已登入使用者可以存取這個 Route...\n" -"})->middleware(AuthenticateOnceWithBasicAuth::class);\n" +"})->middleware(AuthenticateOnceWithBasicAuth::class);" +msgstr "" -#: docs/10.x/authentication.md:block 149 (header) -msgid "Logging Out" -msgstr "登出" +# CODE +#: ./docs/8.x/authentication.md:427 +msgid "'web' => [\n" +" // ...\n" +" \\Illuminate\\Session\\Middleware\\AuthenticateSession::class,\n" +" // ...\n" +"]," +msgstr "" -#: docs/10.x/authentication.md:block 150 (paragraph) -msgid "To manually log users out of your application, you may use the `logout` method provided by the `Auth` facade. This will remove the authentication information from the user's session so that subsequent requests are not authenticated." -msgstr "若要手動將使用者登出網站,可以使用 `Auth` Facade 提供的 `logout` 方法。該方法會從使用者的 Session 中將認證資訊移除,如此一來,接下來的請求都會是已登出的狀態。" +# P +#: ./docs/8.x/authentication.md:433 +#: ./docs/9.x/authentication.md:469 +#: ./docs/10.x/authentication.md:469 +#: ./docs/11.x/authentication.md:471 +#: ./docs/master/authentication.md:468 +msgid "Then, you may use the `logoutOtherDevices` method provided by the `Auth` facade. This method requires the user to confirm their current password, which your application should accept through an input form:" +msgstr "" -#: docs/10.x/authentication.md:block 151 (paragraph) -msgid "In addition to calling the `logout` method, it is recommended that you invalidate the user's session and regenerate their [CSRF token](/docs/{{version}}/csrf). After logging the user out, you would typically redirect the user to the root of your application:" -msgstr "除了呼叫 `logout` 方法外,也建議將使用者的 Session 無效化,並為使用者重新產生 [CSRF 權杖](/docs/{{version}}/csrf)。登出使用者後,我們通常會將使用者重新導向回網站根目錄:" +# CODE +#: ./docs/8.x/authentication.md:435 +#: ./docs/9.x/authentication.md:471 +#: ./docs/10.x/authentication.md:471 +#: ./docs/11.x/authentication.md:473 +#: ./docs/master/authentication.md:470 +msgid "use Illuminate\\Support\\Facades\\Auth;\n\n" +"Auth::logoutOtherDevices($currentPassword);" +msgstr "" -#: docs/10.x/authentication.md:block 152 (code) +# CODE +#: ./docs/10.x/authentication.md:438 +#: ./docs/11.x/authentication.md:440 +#: ./docs/master/authentication.md:437 msgid "use Illuminate\\Http\\Request;\n" "use Illuminate\\Http\\RedirectResponse;\n" "use Illuminate\\Support\\Facades\\Auth;\n\n" @@ -837,112 +2157,215 @@ msgid "use Illuminate\\Http\\Request;\n" " $request->session()->invalidate();\n\n" " $request->session()->regenerateToken();\n\n" " return redirect('/');\n" -"}\n" -msgstr "use Illuminate\\Http\\Request;\n" -"use Illuminate\\Http\\RedirectResponse;\n" -"use Illuminate\\Support\\Facades\\Auth;\n\n" -"/**\n" -" * Log the user out of the application.\n" -" */\n" -"public function logout(Request $request): RedirectResponse\n" -"{\n" -" Auth::logout();\n\n" -" $request->session()->invalidate();\n\n" -" $request->session()->regenerateToken();\n\n" -" return redirect('/');\n" -"}\n" - -#: docs/10.x/authentication.md:block 154 (header) -msgid "Invalidating Sessions On Other Devices" -msgstr "將其他裝置上的 Session 無效化" - -#: docs/10.x/authentication.md:block 155 (paragraph) -msgid "Laravel also provides a mechanism for invalidating and \"logging out\" a user's sessions that are active on other devices without invalidating the session on their current device. This feature is typically utilized when a user is changing or updating their password and you would like to invalidate sessions on other devices while keeping the current device authenticated." -msgstr "Laravel 也提供了另一個機制,可以用來在不影響目前裝置上 Session 的情況下將使用者在其他裝置的 Session 無效化並登出使用者。該功能通常適用於使用者更改密碼、或是想將其他 Session 無效化但想讓目前裝置保持認證的情況。" - -#: docs/10.x/authentication.md:block 156 (paragraph) -msgid "Before getting started, you should make sure that the `Illuminate\\Session\\Middleware\\AuthenticateSession` middleware is included on the routes that should receive session authentication. Typically, you should place this middleware on a route group definition so that it can be applied to the majority of your application's routes. By default, the `AuthenticateSession` middleware may be attached to a route using the `auth.session` route middleware alias as defined in your application's HTTP kernel:" -msgstr "在開始之前,請先確保要收到 Session 身份驗證的 Route 都有包含 `Illuminate\\Session\\Middleware\\AuthenticateSession` Middleware。一般來說,應在 Route 群組定義內放入這個 Middleware,好讓該 Middleware 被套用到專案中大多數的 Route。預設情況下,`AuthenticateSession` Middleware 可使用專案 HTTP Kernel 中所定義的 `auth.session` 這個 Route Middleware 來附加到 Route 上:" - -#: docs/10.x/authentication.md:block 157 (code) -msgid "Route::middleware(['auth', 'auth.session'])->group(function () {\n" -" Route::get('/', function () {\n" -" // ...\n" -" });\n" -"});\n" -msgstr "Route::middleware(['auth', 'auth.session'])->group(function () {\n" -" Route::get('/', function () {\n" -" // ...\n" -" });\n" -"});\n" - -#: docs/10.x/authentication.md:block 158 (paragraph) -msgid "Then, you may use the `logoutOtherDevices` method provided by the `Auth` facade. This method requires the user to confirm their current password, which your application should accept through an input form:" -msgstr "接著,可以使用 `Auth` Facade 提供的 `logoutOtherDevices` 方法。該方法會需要使用者確認目前密碼,而你的網站應通過一個輸入表單來接收密碼:" - -#: docs/10.x/authentication.md:block 159 (code) -msgid "use Illuminate\\Support\\Facades\\Auth;\n\n" -"Auth::logoutOtherDevices($currentPassword);\n" -msgstr "use Illuminate\\Support\\Facades\\Auth;\n\n" -"Auth::logoutOtherDevices($currentPassword);\n" +"}" +msgstr "" -#: docs/10.x/authentication.md:block 160 (paragraph) +# P +#: ./docs/8.x/authentication.md:439 +#: ./docs/9.x/authentication.md:475 +#: ./docs/10.x/authentication.md:475 +#: ./docs/11.x/authentication.md:477 +#: ./docs/master/authentication.md:474 msgid "When the `logoutOtherDevices` method is invoked, the user's other sessions will be invalidated entirely, meaning they will be \"logged out\" of all guards they were previously authenticated by." -msgstr "當 `logoutOtherDevices` 方法被叫用後,使用者的其他 Session 將被立即無效化。這代表,使用者會被從其他所有已認證過的 Guard 中被「登出」。" +msgstr "" -#: docs/10.x/authentication.md:block 162 (header) +# P +#: ./docs/8.x/authentication.md:441 +#: ./docs/9.x/authentication.md:477 +#: ./docs/10.x/authentication.md:477 +#: ./docs/11.x/authentication.md:479 +#: ./docs/master/authentication.md:476 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authentication.md:442 +#: ./docs/9.x/authentication.md:478 +#: ./docs/10.x/authentication.md:478 +#: ./docs/11.x/authentication.md:480 +#: ./docs/master/authentication.md:477 msgid "Password Confirmation" -msgstr "密碼確認" +msgstr "" -#: docs/10.x/authentication.md:block 163 (paragraph) +# P +#: ./docs/8.x/authentication.md:444 +#: ./docs/9.x/authentication.md:480 +#: ./docs/10.x/authentication.md:480 +#: ./docs/11.x/authentication.md:482 +#: ./docs/master/authentication.md:479 msgid "While building your application, you may occasionally have actions that should require the user to confirm their password before the action is performed or before the user is redirected to a sensitive area of the application. Laravel includes built-in middleware to make this process a breeze. Implementing this feature will require you to define two routes: one route to display a view asking the user to confirm their password and another route to confirm that the password is valid and redirect the user to their intended destination." -msgstr "在製作網站時,有時可能會需要使用者在執行某個操作前、或是在使用者被重新導向到網站機敏區域前要求使用者確認密碼。Laravel 提供了一個內建的 Middleware 來讓這個過程變得很輕鬆。要實作這項功能會需要定義兩個路由:一個用於顯示並要求使用者確認密碼的路由,另一個則用於確認密碼有效並將使用者重新導向至預期目的地的路由。" +msgstr "" -#: docs/10.x/authentication.md:block 164 (quote) -msgid "**Note** The following documentation discusses how to integrate with Laravel's password confirmation features directly; however, if you would like to get started more quickly, the [Laravel application starter kits](/docs/{{version}}/starter-kits) include support for this feature!" -msgstr "**Note** 下列說明文件討論了如何直接整合 Laravel 的密碼確認功能。但若想更快速地入門, [Laravel 專案入門套件](/docs/{{version}}/starter-kits) 有內建支援這個功能!" +# P +#: ./docs/8.x/authentication.md:446 +#: ./docs/9.x/authentication.md:483 +#: ./docs/10.x/authentication.md:483 +#: ./docs/11.x/authentication.md:485 +#: ./docs/master/authentication.md:482 +msgid "The following documentation discusses how to integrate with Laravel's password confirmation features directly; however, if you would like to get started more quickly, the [Laravel application starter kits](/docs/{{version}}/starter-kits) include support for this feature!" +msgstr "" -#: docs/10.x/authentication.md:block 166 (header) +# P +#: ./docs/8.x/authentication.md:448 +#: ./docs/9.x/authentication.md:485 +#: ./docs/10.x/authentication.md:485 +#: ./docs/11.x/authentication.md:487 +#: ./docs/master/authentication.md:484 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:449 +#: ./docs/9.x/authentication.md:486 +#: ./docs/10.x/authentication.md:486 +#: ./docs/11.x/authentication.md:488 +#: ./docs/master/authentication.md:485 msgid "Configuration" -msgstr "設定" +msgstr "" -#: docs/10.x/authentication.md:block 167 (paragraph) +# P +#: ./docs/8.x/authentication.md:451 +#: ./docs/9.x/authentication.md:488 +#: ./docs/10.x/authentication.md:488 +#: ./docs/11.x/authentication.md:490 +#: ./docs/master/authentication.md:487 msgid "After confirming their password, a user will not be asked to confirm their password again for three hours. However, you may configure the length of time before the user is re-prompted for their password by changing the value of the `password_timeout` configuration value within your application's `config/auth.php` configuration file." -msgstr "確認使用者密碼後,接下來的三小時內就不會再次向使用者詢問密碼了。但是,只需要更改專案中 `config/auth.php` 設定檔的 `password_timeout` 設定,就可以調整要重新詢問使用者密碼的時間長度。" +msgstr "" -#: docs/10.x/authentication.md:block 169 (header) +# P +#: ./docs/8.x/authentication.md:453 +#: ./docs/9.x/authentication.md:490 +#: ./docs/10.x/authentication.md:490 +#: ./docs/11.x/authentication.md:492 +#: ./docs/master/authentication.md:489 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:454 +#: ./docs/9.x/authentication.md:491 +#: ./docs/10.x/authentication.md:491 +#: ./docs/11.x/authentication.md:493 +#: ./docs/master/authentication.md:490 msgid "Routing" -msgstr "路由" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:456 +#: ./docs/9.x/authentication.md:493 +#: ./docs/10.x/authentication.md:493 +#: ./docs/11.x/authentication.md:495 +#: ./docs/master/authentication.md:492 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/authentication.md:457 +#: ./docs/11.x/authentication.md:459 +#: ./docs/master/authentication.md:456 +msgid "Invalidating Sessions on Other Devices" +msgstr "" -#: docs/10.x/authentication.md:block 171 (header) +# H4 +#: ./docs/8.x/authentication.md:457 +#: ./docs/9.x/authentication.md:494 +#: ./docs/10.x/authentication.md:494 +#: ./docs/11.x/authentication.md:496 +#: ./docs/master/authentication.md:493 msgid "The Password Confirmation Form" -msgstr "密碼確認表單" +msgstr "" -#: docs/10.x/authentication.md:block 172 (paragraph) +# P +#: ./docs/8.x/authentication.md:459 +#: ./docs/9.x/authentication.md:496 +#: ./docs/10.x/authentication.md:496 +#: ./docs/11.x/authentication.md:498 +#: ./docs/master/authentication.md:495 msgid "First, we will define a route to display a view that requests the user to confirm their password:" -msgstr "首先,我們先定義用來顯示要求使用者確認密碼的路由:" +msgstr "" + +# P +#: ./docs/master/authentication.md:460 +msgid "Before getting started, you should make sure that the `Illuminate\\Session\\Middleware\\AuthenticateSession` middleware is included on the routes that should receive session authentication. Typically, you should place this middleware on a route group definition so that it can be applied to the majority of your application's routes. By default, the `AuthenticateSession` middleware may be attached to a route using the `auth.session` [middleware alias](/docs/{{version}}/middleware#middleware-alias):" +msgstr "" + +# P +#: ./docs/10.x/authentication.md:461 +msgid "Before getting started, you should make sure that the `Illuminate\\Session\\Middleware\\AuthenticateSession` middleware is included on the routes that should receive session authentication. Typically, you should place this middleware on a route group definition so that it can be applied to the majority of your application's routes. By default, the `AuthenticateSession` middleware may be attached to a route using the `auth.session` route middleware alias as defined in your application's HTTP kernel:" +msgstr "" -#: docs/10.x/authentication.md:block 173 (code) +# CODE +#: ./docs/8.x/authentication.md:461 +#: ./docs/9.x/authentication.md:498 +#: ./docs/10.x/authentication.md:498 +#: ./docs/11.x/authentication.md:500 +#: ./docs/master/authentication.md:497 msgid "Route::get('/confirm-password', function () {\n" " return view('auth.confirm-password');\n" -"})->middleware('auth')->name('password.confirm');\n" -msgstr "Route::get('/confirm-password', function () {\n" -" return view('auth.confirm-password');\n" -"})->middleware('auth')->name('password.confirm');\n" +"})->middleware('auth')->name('password.confirm');" +msgstr "" + +# P +#: ./docs/9.x/authentication.md:461 +msgid "Before getting started, you should make sure that the `Illuminate\\Session\\Middleware\\AuthenticateSession` middleware is included on the routes that should receive session authentication. Typically, you should place this middleware on a route group definition so that it can be applied to the majority of your application's routes. By default, the `AuthenticateSession` middleware may be attached to a route using the `auth.session` route middleware key as defined in your application's HTTP kernel:" +msgstr "" + +# P +#: ./docs/11.x/authentication.md:463 +msgid "Before getting started, you should make sure that the `Illuminate\\Session\\Middleware\\AuthenticateSession` middleware is included on the routes that should receive session authentication. Typically, you should place this middleware on a route group definition so that it can be applied to the majority of your application's routes. By default, the `AuthenticateSession` middleware may be attached to a route using the `auth.session` [middleware alias](/docs/{{version}}/middleware#middleware-aliases):" +msgstr "" + +# CODE +#: ./docs/9.x/authentication.md:463 +#: ./docs/10.x/authentication.md:463 +#: ./docs/11.x/authentication.md:465 +#: ./docs/master/authentication.md:462 +msgid "Route::middleware(['auth', 'auth.session'])->group(function () {\n" +" Route::get('/', function () {\n" +" // ...\n" +" });\n" +"});" +msgstr "" -#: docs/10.x/authentication.md:block 174 (paragraph) +# P +#: ./docs/8.x/authentication.md:465 +#: ./docs/9.x/authentication.md:502 +#: ./docs/10.x/authentication.md:502 +#: ./docs/11.x/authentication.md:504 +#: ./docs/master/authentication.md:501 msgid "As you might expect, the view that is returned by this route should have a form containing a `password` field. In addition, feel free to include text within the view that explains that the user is entering a protected area of the application and must confirm their password." -msgstr "跟我們預期的一樣,這個路由所回傳的 View 內應有一個含有 `password` 欄位的表單。此外,我們也可以隨意在該 View 中加上文字說明,來告訴使用者他們正在進入網站中受保護的區域,必須要輸入密碼來進行確認。" +msgstr "" -#: docs/10.x/authentication.md:block 176 (header) +# P +#: ./docs/8.x/authentication.md:467 +#: ./docs/9.x/authentication.md:504 +#: ./docs/10.x/authentication.md:504 +#: ./docs/11.x/authentication.md:506 +#: ./docs/master/authentication.md:503 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authentication.md:468 +#: ./docs/9.x/authentication.md:505 msgid "Confirming The Password" -msgstr "確認密碼" +msgstr "" -#: docs/10.x/authentication.md:block 177 (paragraph) +# P +#: ./docs/8.x/authentication.md:470 +#: ./docs/9.x/authentication.md:507 +#: ./docs/10.x/authentication.md:507 +#: ./docs/11.x/authentication.md:509 +#: ./docs/master/authentication.md:506 msgid "Next, we will define a route that will handle the form request from the \"confirm password\" view. This route will be responsible for validating the password and redirecting the user to their intended destination:" -msgstr "接著,我們來定義要處理來自「確認密碼」View 傳來的表單請求的路由。該路由會負責認證使用者的密碼,並將使用者重新導向至原本預定的目的地。" +msgstr "" -#: docs/10.x/authentication.md:block 178 (code) +# CODE +#: ./docs/8.x/authentication.md:472 +#: ./docs/9.x/authentication.md:509 +#: ./docs/10.x/authentication.md:509 +#: ./docs/11.x/authentication.md:511 +#: ./docs/master/authentication.md:508 msgid "use Illuminate\\Http\\Request;\n" "use Illuminate\\Support\\Facades\\Hash;\n" "use Illuminate\\Support\\Facades\\Redirect;\n\n" @@ -954,71 +2377,143 @@ msgid "use Illuminate\\Http\\Request;\n" " }\n\n" " $request->session()->passwordConfirmed();\n\n" " return redirect()->intended();\n" -"})->middleware(['auth', 'throttle:6,1']);\n" -msgstr "use Illuminate\\Http\\Request;\n" -"use Illuminate\\Support\\Facades\\Hash;\n" -"use Illuminate\\Support\\Facades\\Redirect;\n\n" -"Route::post('/confirm-password', function (Request $request) {\n" -" if (! Hash::check($request->password, $request->user()->password)) {\n" -" return back()->withErrors([\n" -" 'password' => ['The provided password does not match our records.']\n" -" ]);\n" -" }\n\n" -" $request->session()->passwordConfirmed();\n\n" -" return redirect()->intended();\n" -"})->middleware(['auth', 'throttle:6,1']);\n" +"})->middleware(['auth', 'throttle:6,1']);" +msgstr "" -#: docs/10.x/authentication.md:block 179 (paragraph) +# P +#: ./docs/8.x/authentication.md:488 +#: ./docs/9.x/authentication.md:525 +#: ./docs/10.x/authentication.md:525 +#: ./docs/11.x/authentication.md:527 +#: ./docs/master/authentication.md:524 msgid "Before moving on, let's examine this route in more detail. First, the request's `password` field is determined to actually match the authenticated user's password. If the password is valid, we need to inform Laravel's session that the user has confirmed their password. The `passwordConfirmed` method will set a timestamp in the user's session that Laravel can use to determine when the user last confirmed their password. Finally, we can redirect the user to their intended destination." -msgstr "在繼續之前,來更仔細地看看這個路由。首先,會判斷請求的 `password` 是否真的符合已認證使用者的密碼。若密碼有效,則我們會通知 Laravel 的 Session 該使用者已確認密碼了。`passwordConfirmed` 方法會在使用者的 Session 上設定一個時間戳記,這樣 Laravel 便能判斷使用者上次確認密碼是什麼時候。最後,我們將使用者重新導向至原本預定的目的地。" +msgstr "" -#: docs/10.x/authentication.md:block 182 (paragraph) +# P +#: ./docs/8.x/authentication.md:490 +#: ./docs/9.x/authentication.md:527 +#: ./docs/10.x/authentication.md:527 +#: ./docs/11.x/authentication.md:529 +#: ./docs/master/authentication.md:526 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/authentication.md:493 +#: ./docs/9.x/authentication.md:530 +#: ./docs/10.x/authentication.md:530 +#: ./docs/11.x/authentication.md:532 +#: ./docs/master/authentication.md:529 msgid "You should ensure that any route that performs an action which requires recent password confirmation is assigned the `password.confirm` middleware. This middleware is included with the default installation of Laravel and will automatically store the user's intended destination in the session so that the user may be redirected to that location after confirming their password. After storing the user's intended destination in the session, the middleware will redirect the user to the `password.confirm` [named route](/docs/{{version}}/routing#named-routes):" -msgstr "任何有需要確保最近認證過密碼操作的路由都應設定 `password.confirm` 中間層。該中間層已包含在預設 Laravel 安裝內,且會自動將使用者預定的目的地保存在 Session 內。因此,使用者在確認密碼後會被重新導向之該頁面。將使用者預定的目的地保存在 Session 後,該中間層會將使用者重新導向之 `password.confirm` 這個[命名路由](/docs/{{version}}/routing#named-routes):" +msgstr "" -#: docs/10.x/authentication.md:block 183 (code) +# CODE +#: ./docs/8.x/authentication.md:495 +#: ./docs/9.x/authentication.md:532 +#: ./docs/10.x/authentication.md:532 +#: ./docs/11.x/authentication.md:534 +#: ./docs/master/authentication.md:531 msgid "Route::get('/settings', function () {\n" " // ...\n" "})->middleware(['password.confirm']);\n\n" "Route::post('/settings', function () {\n" " // ...\n" -"})->middleware(['password.confirm']);\n" -msgstr "Route::get('/settings', function () {\n" -" // ...\n" -"})->middleware(['password.confirm']);\n\n" -"Route::post('/settings', function () {\n" -" // ...\n" -"})->middleware(['password.confirm']);\n" +"})->middleware(['password.confirm']);" +msgstr "" -#: docs/10.x/authentication.md:block 185 (header) +# P +#: ./docs/8.x/authentication.md:503 +#: ./docs/9.x/authentication.md:540 +#: ./docs/10.x/authentication.md:540 +#: ./docs/11.x/authentication.md:542 +#: ./docs/master/authentication.md:539 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authentication.md:504 +#: ./docs/9.x/authentication.md:541 +#: ./docs/10.x/authentication.md:541 +#: ./docs/11.x/authentication.md:543 +#: ./docs/master/authentication.md:540 msgid "Adding Custom Guards" -msgstr "新增自訂 Guard" +msgstr "" + +# H4 +#: ./docs/10.x/authentication.md:505 +#: ./docs/11.x/authentication.md:507 +#: ./docs/master/authentication.md:504 +msgid "Confirming the Password" +msgstr "" -#: docs/10.x/authentication.md:block 186 (paragraph) +# P +#: ./docs/8.x/authentication.md:506 +#: ./docs/9.x/authentication.md:543 +#: ./docs/10.x/authentication.md:543 msgid "You may define your own authentication guards using the `extend` method on the `Auth` facade. You should place your call to the `extend` method within a [service provider](/docs/{{version}}/providers). Since Laravel already ships with an `AuthServiceProvider`, we can place the code in that provider:" -msgstr "可以通過 `Auth` Facade 中的 `extend` 方法來定義你自己的認證 Guard。`extend` 方法的呼叫應放置於一個 [Service Provider](/docs/{{version}}/providers) 內。由於 Laravel 預設已附帶了 `AuthServiceProvider`,因此我們可以將程式碼放在這個 Provider 中:" +msgstr "" -#: docs/10.x/authentication.md:block 187 (code) +# CODE +#: ./docs/8.x/authentication.md:508 +#: ./docs/9.x/authentication.md:545 msgid "registerPolicies();\n\n" +" Auth::extend('jwt', function ($app, $name, array $config) {\n" " // Return an instance of Illuminate\\Contracts\\Auth\\Guard...\n\n" " return new JwtGuard(Auth::createUserProvider($config['provider']));\n" " });\n" " }\n" -"}\n" -msgstr " [\n" +" 'api' => [\n" +" 'driver' => 'jwt',\n" +" 'provider' => 'users',\n" +" ],\n" +"]," +msgstr "" + +# P +#: ./docs/8.x/authentication.md:544 +#: ./docs/9.x/authentication.md:581 +#: ./docs/10.x/authentication.md:578 +#: ./docs/11.x/authentication.md:582 +#: ./docs/master/authentication.md:579 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/authentication.md:545 +msgid "registerPolicies();\n\n" +" Auth::viaRequest('custom-token', function (Request $request) {\n" +" return User::where('token', $request->token)->first();\n" +" });\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/authentication.md:569 +#: ./docs/9.x/authentication.md:606 +#: ./docs/10.x/authentication.md:599 +#: ./docs/11.x/authentication.md:603 +#: ./docs/master/authentication.md:600 +msgid "Once your custom authentication driver has been defined, you may configure it as a driver within the `guards` configuration of your `auth.php` configuration file:" +msgstr "" -#: docs/10.x/authentication.md:block 189 (code) +# CODE +#: ./docs/8.x/authentication.md:571 +#: ./docs/9.x/authentication.md:608 +#: ./docs/10.x/authentication.md:601 +#: ./docs/11.x/authentication.md:605 +#: ./docs/master/authentication.md:602 msgid "'guards' => [\n" " 'api' => [\n" -" 'driver' => 'jwt',\n" -" 'provider' => 'users',\n" -" ],\n" -"],\n" -msgstr "'guards' => [\n" -" 'api' => [\n" -" 'driver' => 'jwt',\n" -" 'provider' => 'users',\n" +" 'driver' => 'custom-token',\n" " ],\n" -"],\n" +"]," +msgstr "" -#: docs/10.x/authentication.md:block 191 (header) -msgid "Closure Request Guards" -msgstr "閉包請求 Guard" +# P +#: ./docs/8.x/authentication.md:577 +#: ./docs/9.x/authentication.md:620 +#: ./docs/10.x/authentication.md:613 +#: ./docs/11.x/authentication.md:617 +#: ./docs/master/authentication.md:614 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authentication.md:578 +#: ./docs/9.x/authentication.md:621 +#: ./docs/10.x/authentication.md:614 +#: ./docs/11.x/authentication.md:618 +#: ./docs/master/authentication.md:615 +msgid "Adding Custom User Providers" +msgstr "" -#: docs/10.x/authentication.md:block 192 (paragraph) -msgid "The simplest way to implement a custom, HTTP request based authentication system is by using the `Auth::viaRequest` method. This method allows you to quickly define your authentication process using a single closure." -msgstr "要實作一個基於 HTTP 請求的自訂認證系統最簡單的方法,就是通過 `Auth::viaRequest`。通過此方法就可以用單一閉包來快速定義認證流程。" +# P +#: ./docs/8.x/authentication.md:580 +#: ./docs/9.x/authentication.md:623 +#: ./docs/10.x/authentication.md:616 +#: ./docs/11.x/authentication.md:620 +#: ./docs/master/authentication.md:617 +msgid "If you are not using a traditional relational database to store your users, you will need to extend Laravel with your own authentication user provider. We will use the `provider` method on the `Auth` facade to define a custom user provider. The user provider resolver should return an implementation of `Illuminate\\Contracts\\Auth\\UserProvider`:" +msgstr "" -#: docs/10.x/authentication.md:block 193 (paragraph) -msgid "To get started, call the `Auth::viaRequest` method within the `boot` method of your `AuthServiceProvider`. The `viaRequest` method accepts an authentication driver name as its first argument. This name can be any string that describes your custom guard. The second argument passed to the method should be a closure that receives the incoming HTTP request and returns a user instance or, if authentication fails, `null`:" -msgstr "要開始定義自訂 Guard,先在 `AuthServiceProvider` 中的 `boot` 方法內呼叫 `Auth::viaRequest` 方法。`viaRequest` 方法的第一個引數為認證 Driver 的名稱。這個 Driver 名稱可以是用來描述該自訂 Guard 的一個任意字串。傳入該方法的第二個引數則應為接收連入 HTTP 請求的閉包,該閉包應在認證成功時回傳使用者實體、認證失敗時回傳 `null`。" +# CODE +#: ./docs/8.x/authentication.md:582 +#: ./docs/9.x/authentication.md:625 +msgid "registerPolicies();\n\n" +" Auth::provider('mongo', function ($app, array $config) {\n" +" // Return an instance of Illuminate\\Contracts\\Auth\\UserProvider...\n\n" +" return new MongoUserProvider($app->make('mongo.connection'));\n" +" });\n" +" }\n" +"}" +msgstr "" -#: docs/10.x/authentication.md:block 194 (code) +# CODE +#: ./docs/10.x/authentication.md:585 msgid "use App\\Models\\User;\n" "use Illuminate\\Http\\Request;\n" "use Illuminate\\Support\\Facades\\Auth;\n\n" @@ -1081,57 +2697,108 @@ msgid "use App\\Models\\User;\n" " Auth::viaRequest('custom-token', function (Request $request) {\n" " return User::where('token', (string) $request->token)->first();\n" " });\n" -"}\n" -msgstr "use App\\Models\\User;\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/authentication.md:587 +#: ./docs/master/authentication.md:584 +msgid "To get started, call the `Auth::viaRequest` method within the `boot` method of your application's `AppServiceProvider`. The `viaRequest` method accepts an authentication driver name as its first argument. This name can be any string that describes your custom guard. The second argument passed to the method should be a closure that receives the incoming HTTP request and returns a user instance or, if authentication fails, `null`:" +msgstr "" + +# CODE +#: ./docs/9.x/authentication.md:588 +msgid "use App\\Models\\User;\n" "use Illuminate\\Http\\Request;\n" "use Illuminate\\Support\\Facades\\Auth;\n\n" "/**\n" " * Register any application authentication / authorization services.\n" +" *\n" +" * @return void\n" +" */\n" +"public function boot()\n" +"{\n" +" $this->registerPolicies();\n\n" +" Auth::viaRequest('custom-token', function (Request $request) {\n" +" return User::where('token', (string) $request->token)->first();\n" +" });\n" +"}" +msgstr "" + +# CODE +#: ./docs/11.x/authentication.md:589 +#: ./docs/master/authentication.md:586 +msgid "use App\\Models\\User;\n" +"use Illuminate\\Http\\Request;\n" +"use Illuminate\\Support\\Facades\\Auth;\n\n" +"/**\n" +" * Bootstrap any application services.\n" " */\n" "public function boot(): void\n" "{\n" " Auth::viaRequest('custom-token', function (Request $request) {\n" " return User::where('token', (string) $request->token)->first();\n" " });\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authentication.md:block 195 (paragraph) -msgid "Once your custom authentication driver has been defined, you may configure it as a driver within the `guards` configuration of your `auth.php` configuration file:" -msgstr "定義好自訂認證 Driver 後,可以將其設定在 `auth.php` 設定檔中的 `guards` 設定。" +# CODE +#: ./docs/10.x/authentication.md:609 +#: ./docs/11.x/authentication.md:613 +#: ./docs/master/authentication.md:610 +msgid "Route::middleware('auth:api')->group(function () {\n" +" // ...\n" +"});" +msgstr "" -#: docs/10.x/authentication.md:block 196 (code) -msgid "'guards' => [\n" -" 'api' => [\n" -" 'driver' => 'custom-token',\n" -" ],\n" -"],\n" -msgstr "'guards' => [\n" -" 'api' => [\n" -" 'driver' => 'custom-token',\n" +# P +#: ./docs/8.x/authentication.md:609 +#: ./docs/9.x/authentication.md:652 +#: ./docs/10.x/authentication.md:642 +#: ./docs/11.x/authentication.md:648 +#: ./docs/master/authentication.md:645 +msgid "After you have registered the provider using the `provider` method, you may switch to the new user provider in your `auth.php` configuration file. First, define a `provider` that uses your new driver:" +msgstr "" + +# CODE +#: ./docs/8.x/authentication.md:611 +#: ./docs/9.x/authentication.md:654 +#: ./docs/10.x/authentication.md:644 +#: ./docs/11.x/authentication.md:650 +#: ./docs/master/authentication.md:647 +msgid "'providers' => [\n" +" 'users' => [\n" +" 'driver' => 'mongo',\n" " ],\n" -"],\n" +"]," +msgstr "" -#: docs/10.x/authentication.md:block 197 (paragraph) +# P +#: ./docs/9.x/authentication.md:614 +#: ./docs/10.x/authentication.md:607 +#: ./docs/11.x/authentication.md:611 +#: ./docs/master/authentication.md:608 msgid "Finally, you may reference the guard when assigning the authentication middleware to a route:" -msgstr "最後,在 Route 中指定驗證 Middleware 時可參照這個 Guard:" +msgstr "" -#: docs/10.x/authentication.md:block 198 (code) +# CODE +#: ./docs/9.x/authentication.md:616 msgid "Route::middleware('auth:api')->group(function () {\n" " // ...\n" -"});\n" -msgstr "Route::middleware('auth:api')->group(function () {\n" -" // ...\n" -"});\n" - -#: docs/10.x/authentication.md:block 200 (header) -msgid "Adding Custom User Providers" -msgstr "新增自訂 User Provider" +"}" +msgstr "" -#: docs/10.x/authentication.md:block 201 (paragraph) -msgid "If you are not using a traditional relational database to store your users, you will need to extend Laravel with your own authentication user provider. We will use the `provider` method on the `Auth` facade to define a custom user provider. The user provider resolver should return an implementation of `Illuminate\\Contracts\\Auth\\UserProvider`:" -msgstr "若你不是使用傳統關聯式資料庫來儲存使用者,就需要擴充 Laravel 來新增自訂的認證 User Provider。接下來我們會用 `Auth` Facade 的 `provider` 方法來定義自訂 User Provider。這個 User Provider 的解析程式應回傳一個 `Illuminate\\Contracts\\Auth\\UserProvider` 的實作:" +# P +#: ./docs/8.x/authentication.md:617 +#: ./docs/9.x/authentication.md:660 +#: ./docs/10.x/authentication.md:650 +#: ./docs/11.x/authentication.md:656 +#: ./docs/master/authentication.md:653 +msgid "Finally, you may reference this provider in your `guards` configuration:" +msgstr "" -#: docs/10.x/authentication.md:block 202 (code) +# CODE +#: ./docs/10.x/authentication.md:618 msgid "make('mongo.connection'));\n" " });\n" " }\n" -"}\n" -msgstr " [\n" +" 'web' => [\n" +" 'driver' => 'session',\n" +" 'provider' => 'users',\n" +" ],\n" +"]," +msgstr "" + +# CODE +#: ./docs/11.x/authentication.md:622 +#: ./docs/master/authentication.md:619 +msgid "make('mongo.connection'));\n" " });\n" " }\n" -"}\n" - -#: docs/10.x/authentication.md:block 203 (paragraph) -msgid "After you have registered the provider using the `provider` method, you may switch to the new user provider in your `auth.php` configuration file. First, define a `provider` that uses your new driver:" -msgstr "通過 `provider` 方法註冊好 Provider 後,即可在 `auth.php` 設定檔內更改為新的 User Provider。首先,先定義使用這個新 Driver 的 `provider`:" - -#: docs/10.x/authentication.md:block 204 (code) -msgid "'providers' => [\n" -" 'users' => [\n" -" 'driver' => 'mongo',\n" -" ],\n" -"],\n" -msgstr "'providers' => [\n" -" 'users' => [\n" -" 'driver' => 'mongo',\n" -" ],\n" -"],\n" - -#: docs/10.x/authentication.md:block 205 (paragraph) -msgid "Finally, you may reference this provider in your `guards` configuration:" -msgstr "最後,就能在 `guards` 設定中參照這個 Provider:" - -#: docs/10.x/authentication.md:block 206 (code) -msgid "'guards' => [\n" -" 'web' => [\n" -" 'driver' => 'session',\n" -" 'provider' => 'users',\n" -" ],\n" -"],\n" -msgstr "'guards' => [\n" -" 'web' => [\n" -" 'driver' => 'session',\n" -" 'provider' => 'users',\n" -" ],\n" -"],\n" +"}" +msgstr "" -#: docs/10.x/authentication.md:block 208 (header) +# P +#: ./docs/8.x/authentication.md:626 +#: ./docs/9.x/authentication.md:669 +#: ./docs/10.x/authentication.md:659 +#: ./docs/11.x/authentication.md:665 +#: ./docs/master/authentication.md:662 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:627 +#: ./docs/9.x/authentication.md:670 +#: ./docs/10.x/authentication.md:660 +#: ./docs/11.x/authentication.md:666 +#: ./docs/master/authentication.md:663 msgid "The User Provider Contract" -msgstr "User Provider Contract" +msgstr "" -#: docs/10.x/authentication.md:block 209 (paragraph) +# P +#: ./docs/8.x/authentication.md:629 +#: ./docs/9.x/authentication.md:672 +#: ./docs/10.x/authentication.md:662 +#: ./docs/11.x/authentication.md:668 +#: ./docs/master/authentication.md:665 msgid "`Illuminate\\Contracts\\Auth\\UserProvider` implementations are responsible for fetching an `Illuminate\\Contracts\\Auth\\Authenticatable` implementation out of a persistent storage system, such as MySQL, MongoDB, etc. These two interfaces allow the Laravel authentication mechanisms to continue functioning regardless of how the user data is stored or what type of class is used to represent the authenticated user:" -msgstr "`Illuminate\\Contracts\\Auth\\UserProvider` 的實作應負責從持續性儲存系統 (如 MySQL、MongoDB…等) 中取出 `Illuminate\\Contracts\\Auth\\Authenticatable` 的實作。有了這兩個介面,不論我們如何儲存使用者資料、不論我們使用什麼類型的 Class 來代表已登入使用者,Laravel 的認證機制都能繼續運作:" +msgstr "" -#: docs/10.x/authentication.md:block 210 (paragraph) +# P +#: ./docs/8.x/authentication.md:631 +#: ./docs/9.x/authentication.md:674 +#: ./docs/10.x/authentication.md:664 +#: ./docs/11.x/authentication.md:670 +#: ./docs/master/authentication.md:667 msgid "Let's take a look at the `Illuminate\\Contracts\\Auth\\UserProvider` contract:" -msgstr "我們來看看 `Illuminate\\Contracts\\Auth\\UserProvider` Contract:" +msgstr "" -#: docs/10.x/authentication.md:block 211 (code) +# CODE +#: ./docs/8.x/authentication.md:633 +#: ./docs/9.x/authentication.md:676 +#: ./docs/10.x/authentication.md:666 msgid "getAuthPassword()` to the value of `$credentials['password']`. This method should return `true` or `false` indicating whether the password is valid." -msgstr "`validateCredentials` 方法應負責使用 `$credentials` 來比對給定的 `$user` 以驗證使用者。舉例來說,該方法通常會使用 `Hash::check` 方法來比對 `$user->getAuthPassword()` 與 `$credentials['password']` 的值。該方法應回傳 `true` 或 `false` 來標示密碼是否有效。" +msgstr "" -#: docs/10.x/authentication.md:block 218 (header) +# P +#: ./docs/8.x/authentication.md:656 +#: ./docs/9.x/authentication.md:699 +#: ./docs/10.x/authentication.md:689 +#: ./docs/11.x/authentication.md:698 +#: ./docs/master/authentication.md:695 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authentication.md:657 +#: ./docs/9.x/authentication.md:700 +#: ./docs/10.x/authentication.md:690 +#: ./docs/11.x/authentication.md:699 +#: ./docs/master/authentication.md:696 msgid "The Authenticatable Contract" -msgstr "Authenticatable Contract" +msgstr "" -#: docs/10.x/authentication.md:block 219 (paragraph) +# P +#: ./docs/8.x/authentication.md:659 +#: ./docs/9.x/authentication.md:702 +#: ./docs/10.x/authentication.md:692 +#: ./docs/11.x/authentication.md:701 +#: ./docs/master/authentication.md:698 msgid "Now that we have explored each of the methods on the `UserProvider`, let's take a look at the `Authenticatable` contract. Remember, user providers should return implementations of this interface from the `retrieveById`, `retrieveByToken`, and `retrieveByCredentials` methods:" -msgstr "現在我們已經看過 `UserProvider` 內的各個方法了。接著來看看 `Authenticatable` Contract。請記住,User Provider 應在 `retrieveById`, `retrieveByToken` 以及 `retrieveByCredentials` 方法內回傳該介面的實作:" +msgstr "" -#: docs/10.x/authentication.md:block 220 (code) +# CODE +#: ./docs/8.x/authentication.md:661 +#: ./docs/9.x/authentication.md:704 +#: ./docs/10.x/authentication.md:694 msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authentication.md:680 +#: ./docs/9.x/authentication.md:723 +#: ./docs/10.x/authentication.md:713 +#: ./docs/11.x/authentication.md:742 +#: ./docs/master/authentication.md:720 msgid "Events" -msgstr "事件" +msgstr "" -#: docs/10.x/authentication.md:block 225 (paragraph) +# P +#: ./docs/8.x/authentication.md:682 +#: ./docs/9.x/authentication.md:725 +#: ./docs/10.x/authentication.md:715 msgid "Laravel dispatches a variety of [events](/docs/{{version}}/events) during the authentication process. You may attach listeners to these events in your `EventServiceProvider`:" -msgstr "Laravel 會在認證的過程中分派數個 [事件](/docs/{{version}}/events)。可以在 `EventServiceProvider` 內為這些事件附加監聽程式。" +msgstr "" -#: docs/10.x/authentication.md:block 226 (code) +# CODE +#: ./docs/8.x/authentication.md:684 +#: ./docs/9.x/authentication.md:727 +#: ./docs/10.x/authentication.md:717 msgid "/**\n" " * The event listener mappings for the application.\n" " *\n" @@ -1350,714 +3100,88 @@ msgid "/**\n" " 'Illuminate\\Auth\\Events\\PasswordReset' => [\n" " 'App\\Listeners\\LogPasswordReset',\n" " ],\n" -"];\n" -msgstr "/**\n" -" * The event listener mappings for the application.\n" -" *\n" -" * @var array\n" -" */\n" -"protected $listen = [\n" -" 'Illuminate\\Auth\\Events\\Registered' => [\n" -" 'App\\Listeners\\LogRegisteredUser',\n" -" ],\n\n" -" 'Illuminate\\Auth\\Events\\Attempting' => [\n" -" 'App\\Listeners\\LogAuthenticationAttempt',\n" -" ],\n\n" -" 'Illuminate\\Auth\\Events\\Authenticated' => [\n" -" 'App\\Listeners\\LogAuthenticated',\n" -" ],\n\n" -" 'Illuminate\\Auth\\Events\\Login' => [\n" -" 'App\\Listeners\\LogSuccessfulLogin',\n" -" ],\n\n" -" 'Illuminate\\Auth\\Events\\Failed' => [\n" -" 'App\\Listeners\\LogFailedLogin',\n" -" ],\n\n" -" 'Illuminate\\Auth\\Events\\Validated' => [\n" -" 'App\\Listeners\\LogValidated',\n" -" ],\n\n" -" 'Illuminate\\Auth\\Events\\Verified' => [\n" -" 'App\\Listeners\\LogVerified',\n" -" ],\n\n" -" 'Illuminate\\Auth\\Events\\Logout' => [\n" -" 'App\\Listeners\\LogSuccessfulLogout',\n" -" ],\n\n" -" 'Illuminate\\Auth\\Events\\CurrentDeviceLogout' => [\n" -" 'App\\Listeners\\LogCurrentDeviceLogout',\n" -" ],\n\n" -" 'Illuminate\\Auth\\Events\\OtherDeviceLogout' => [\n" -" 'App\\Listeners\\LogOtherDeviceLogout',\n" -" ],\n\n" -" 'Illuminate\\Auth\\Events\\Lockout' => [\n" -" 'App\\Listeners\\LogLockout',\n" -" ],\n\n" -" 'Illuminate\\Auth\\Events\\PasswordReset' => [\n" -" 'App\\Listeners\\LogPasswordReset',\n" -" ],\n" -"];\n" - -#: docs/8.x/authentication.md:block 9 (quote) -msgid "{tip} Guards and providers should not be confused with \"roles\" and \"permissions\". To learn more about authorizing user actions via permissions, please refer to the [authorization](/docs/{{version}}/authorization) documentation." -msgstr "{tip} Guard 與 Provider 跟「角色」以及「權限」不同,不應混謠。若要瞭解如何依照權限來授權使用者的方法,請參考[授權](/docs/{{version}}/authorization) 說明文件。" - -#: docs/8.x/authentication.md:block 31 (paragraph) -msgid "*[Laravel Jetstream](https://jetstream.laravel.com)* is a robust application starter kit that consumes and exposes Laravel Fortify's authentication services with a beautiful, modern UI powered by [Tailwind CSS](https://tailwindcss.com), [Livewire](https://laravel-livewire.com), and / or [Inertia.js](https://inertiajs.com). Laravel Jetstream includes optional support for two-factor authentication, team support, browser session management, profile management, and built-in integration with [Laravel Sanctum](/docs/{{version}}/sanctum) to offer API token authentication. Laravel's API authentication offerings are discussed below." -msgstr "**[Laravel Jetstream](https://jetstream.laravel.com)** 是一個強大的入門套件,該套件使用者 Laravel Fortify 的驗證服務,並將其通過 [Tailwind CSS](https://tailwindcss.com), [Livewire](https://laravel-livewire.com),與/或 [Inertia.js](https://inertiajs.com) 來提供美麗且現代的 UI。Laravel Jetstream 也提供了對二步驟驗證、團隊支援、瀏覽器啟程管理、個人檔案管理、以及內建與 [Laravel Sanctum](/docs/{{version}}/sunctum) 整合來提供 API 權杖驗證的可選支援。Laravel 提供的 API 驗證功能將在下方討論。" - -#: docs/8.x/authentication.md:block 47 (paragraph) -msgid "And, if you would like to get started quickly, we are pleased to recommend [Laravel Jetstream](https://jetstream.laravel.com) as a quick way to start a new Laravel application that already uses our preferred authentication stack of Laravel's built-in authentication services and Laravel Sanctum." -msgstr "此外,若想要快速入門,我們誠摯推薦你使用 [Laravel Jetstream](https://jetstream.laravel.com) 來作為快速建立新 Laravel 專案的方法。Laravel Jetstream 已經使用了我們偏好的認證 Stack —— 使用 Laravel 的內建認證服務與 Laravel Sanctum。" - -#: docs/8.x/authentication.md:block 50 (quote) -msgid "{note} This portion of the documentation discusses authenticating users via the [Laravel application starter kits](/docs/{{version}}/starter-kits), which includes UI scaffolding to help you get started quickly. If you would like to integrate with Laravel's authentication systems directly, check out the documentation on [manually authenticating users](#authenticating-users)." -msgstr "{note} 這部分的文件會討論通過 [Laravel 應用程式入門套件](/docs/{{version}}/starter-kits) 來驗證使用者,這些入門套件包含了能協助你快速開始的 UI Scaffolding。若你想要直接與 Laravel 的驗證系統整合,請參考 [手動驗證使用者](#authenticating-users) 內的說明文件。" - -#: docs/8.x/authentication.md:block 54 (paragraph) -msgid "Laravel Breeze is a minimal, simple implementation of all of Laravel's authentication features, including login, registration, password reset, email verification, and password confirmation. Laravel Breeze's view layer is made up of simple [Blade templates](/docs/{{version}}/blade) styled with [Tailwind CSS](https://tailwindcss.com). Breeze also offers an [Inertia](https://inertiajs.com) based scaffolding option using Vue or React." -msgstr "Laravel Breeze 是一個簡單且最小化實作出所有 Laravel 認證功能的套件,包含登入、註冊、密碼重設、電子郵件認證、以及密碼確認。Laravel Breeze 的檢視器層是通過簡單的 [Blade 樣板](/docs/{{version}}/blade) 搭配 [Tailwind CSS](https://tailwindcss.com) 提供樣式組合而成的。Breeze 也提供了一個使用 Vue 或 React 的基於 [Inertia](https://inertiajs.com) 的 Scaffolding 選項。" +"];" +msgstr "" -#: docs/8.x/authentication.md:block 55 (paragraph) -msgid "[Laravel Jetstream](https://jetstream.laravel.com) is a more robust application starter kit that includes support for scaffolding your application with [Livewire](https://laravel-livewire.com) or [Inertia.js and Vue](https://inertiajs.com). In addition, Jetstream features optional support for two-factor authentication, teams, profile management, browser session management, API support via [Laravel Sanctum](/docs/{{version}}/sanctum), account deletion, and more." -msgstr "[Laravel Jetstream](https://jetstream.laravel.com) 是一個更複雜的專案入門套件,其中包含了使用 [Livewire](https://laravel-livewire.com) 或 [Inertia.js 與 Vue](https://inertiajs.com) 來對應用程式 Scaffolding 的支援。此外,Jetstream 也提供了對二步驟認證、團隊、個人檔案管理、瀏覽器啟程管理、通過 [Laravel Sanctum](/docs/{{version}}/sanctum) 提供的 API 支援、帳號刪除…等功能的可選支援。" +# P +#: ./docs/11.x/authentication.md:696 +#: ./docs/master/authentication.md:693 +msgid "The `rehashPasswordIfRequired` method should rehash the given `$user`'s password if required and supported. For example, this method will typically use the `Hash::needsRehash` method to determine if the `$credentials['password']` value needs to be rehashed. If the password needs to be rehashed, the method should use the `Hash::make` method to rehash the password and update the user's record in the underlying persistent storage." +msgstr "" -#: docs/8.x/authentication.md:block 61 (code) +# CODE +#: ./docs/11.x/authentication.md:703 +#: ./docs/master/authentication.md:700 msgid "user()\n" -" }\n" -"}\n" -msgstr "user()\n" -" }\n" -"}\n" - -#: docs/8.x/authentication.md:block 66 (quote) -msgid "{tip} Even though it is possible to determine if a user is authenticated using the `check` method, you will typically use a middleware to verify that the user is authenticated before allowing the user access to certain routes / controllers. To learn more about this, check out the documentation on [protecting routes](/docs/{{version}}/authentication#protecting-routes)." -msgstr "{tip} 雖然可以使用 `check` 方法來判斷使用者是否已登入,但通常可以使用 Middleware 來在使用者存取特定 Route 或 Controller 前就先驗證該使用者是否已登入。關更多詳情,參考[保護 Route](/docs/{{version}}/authentication#protecting-routes) 內的說明文件。" - -#: docs/8.x/authentication.md:block 74 (code) -msgid "/**\n" -" * Get the path the user should be redirected to.\n" -" *\n" -" * @param \\Illuminate\\Http\\Request $request\n" -" * @return string\n" -" */\n" -"protected function redirectTo($request)\n" -"{\n" -" return route('login');\n" -"}\n" -msgstr "/**\n" -" * Get the path the user should be redirected to.\n" -" *\n" -" * @param \\Illuminate\\Http\\Request $request\n" -" * @return string\n" -" */\n" -"protected function redirectTo($request)\n" +"namespace Illuminate\\Contracts\\Auth;\n\n" +"interface Authenticatable\n" "{\n" -" return route('login');\n" -"}\n" - -#: docs/8.x/authentication.md:block 82 (quote) -msgid "{tip} If you would like to rate limit other routes in your application, check out the [rate limiting documentation](/docs/{{version}}/routing#rate-limiting)." -msgstr "{tip} 若想在專案中的其他 Route 上提供頻率限制,請參考[頻率限制的說明文件](/docs/{{version}}/routing#rate-limiting)。" +" public function getAuthIdentifierName();\n" +" public function getAuthIdentifier();\n" +" public function getAuthPasswordName();\n" +" public function getAuthPassword();\n" +" public function getRememberToken();\n" +" public function setRememberToken($value);\n" +" public function getRememberTokenName();\n" +"}" +msgstr "" -#: docs/8.x/authentication.md:block 87 (code) -msgid "validate([\n" -" 'email' => ['required', 'email'],\n" -" 'password' => ['required'],\n" -" ]);\n\n" -" if (Auth::attempt($credentials)) {\n" -" $request->session()->regenerate();\n\n" -" return redirect()->intended('dashboard');\n" -" }\n\n" -" return back()->withErrors([\n" -" 'email' => 'The provided credentials do not match our records.',\n" -" ]);\n" -" }\n" -"}\n" -msgstr "validate([\n" -" 'email' => ['required', 'email'],\n" -" 'password' => ['required'],\n" -" ]);\n\n" -" if (Auth::attempt($credentials)) {\n" -" $request->session()->regenerate();\n\n" -" return redirect()->intended('dashboard');\n" -" }\n\n" -" return back()->withErrors([\n" -" 'email' => 'The provided credentials do not match our records.',\n" -" ]);\n" -" }\n" -"}\n" +# P +#: ./docs/10.x/authentication.md:710 +#: ./docs/11.x/authentication.md:720 +#: ./docs/master/authentication.md:717 +msgid "This interface allows the authentication system to work with any \"user\" class, regardless of what ORM or storage abstraction layer you are using. By default, Laravel includes an `App\\Models\\User` class in the `app/Models` directory which implements this interface." +msgstr "" -#: docs/8.x/authentication.md:block 96 (quote) -msgid "{note} In these examples, `email` is not a required option, it is merely used as an example. You should use whatever column name corresponds to a \"username\" in your database table." -msgstr "{note} 不一定要像這個例子一樣使用 `email` 欄位,此處只是以 E-Mail 當作範例。可以使用任何在資料庫中相當於「使用者名稱」的欄位來認證。" +# P +#: ./docs/11.x/authentication.md:718 +#: ./docs/master/authentication.md:715 +msgid "This interface is simple. The `getAuthIdentifierName` method should return the name of the \"primary key\" column for the user and the `getAuthIdentifier` method should return the \"primary key\" of the user. When using a MySQL back-end, this would likely be the auto-incrementing primary key assigned to the user record. The `getAuthPasswordName` method should return the name of the user's password column. The `getAuthPassword` method should return the user's hashed password." +msgstr "" -#: docs/8.x/authentication.md:block 126 (code) -msgid "if (Auth::once($credentials)) {\n" -" //\n" -"}\n" -msgstr "if (Auth::once($credentials)) {\n" -" //\n" -"}\n" +# P +#: ./docs/11.x/authentication.md:722 +#~ msgid "" +#~ msgstr "" -#: docs/8.x/authentication.md:block 139 (code) -msgid "middleware('auth.basic.once');\n" -msgstr "Route::get('/api/user', function () {\n" -" // 只有已登入使用者可以存取這個 Route...\n" -"})->middleware('auth.basic.once');\n" +# P +#: ./docs/11.x/authentication.md:727 +msgid "Typically, the bcrypt work factor should be increased over time as CPU / GPU processing power increases. If you increase the bcrypt work factor for your application, Laravel will gracefully and automatically rehash user passwords as users authenticate with your application via Laravel's starter kits or when you [manually authenticate users](#authenticating-users) via the `attempt` method." +msgstr "" -#: docs/8.x/authentication.md:block 146 (code) -msgid "use Illuminate\\Http\\Request;\n" -"use Illuminate\\Support\\Facades\\Auth;\n\n" -"/**\n" -" * Log the user out of the application.\n" -" *\n" -" * @param \\Illuminate\\Http\\Request $request\n" -" * @return \\Illuminate\\Http\\Response\n" -" */\n" -"public function logout(Request $request)\n" -"{\n" -" Auth::logout();\n\n" -" $request->session()->invalidate();\n\n" -" $request->session()->regenerateToken();\n\n" -" return redirect('/');\n" -"}\n" -msgstr "use Illuminate\\Http\\Request;\n" -"use Illuminate\\Support\\Facades\\Auth;\n\n" -"/**\n" -" * Log the user out of the application.\n" -" *\n" -" * @param \\Illuminate\\Http\\Request $request\n" -" * @return \\Illuminate\\Http\\Response\n" -" */\n" -"public function logout(Request $request)\n" -"{\n" -" Auth::logout();\n\n" -" $request->session()->invalidate();\n\n" -" $request->session()->regenerateToken();\n\n" -" return redirect('/');\n" -"}\n" +# P +#: ./docs/11.x/authentication.md:729 +msgid "Typically, automatic password rehashing should not disrupt your application; however, you may disable this behavior by publishing the `hashing` configuration file:" +msgstr "" -#: docs/8.x/authentication.md:block 150 (paragraph) -msgid "Before getting started, you should make sure that the `Illuminate\\Session\\Middleware\\AuthenticateSession` middleware is present and un-commented in your `App\\Http\\Kernel` class' `web` middleware group:" -msgstr "在開始前,請先確保 `Illuminate\\Session\\Middleware\\AuthenticateSession` Middleware 有出現在 `App\\Http\\Kernel` 類別的 `web` Middleware 群組中,並且未被註解掉:" +# CODE: shell +#: ./docs/11.x/authentication.md:731 +msgid "php artisan config:publish hashing" +msgstr "" -#: docs/8.x/authentication.md:block 151 (code) -msgid "'web' => [\n" -" // ...\n" -" \\Illuminate\\Session\\Middleware\\AuthenticateSession::class,\n" -" // ...\n" -"],\n" -msgstr "'web' => [\n" -" // ...\n" -" \\Illuminate\\Session\\Middleware\\AuthenticateSession::class,\n" -" // ...\n" -"],\n" +# P +#: ./docs/11.x/authentication.md:735 +msgid "Once the configuration file has been published, you may set the `rehash_on_login` configuration value to `false`:" +msgstr "" -#: docs/8.x/authentication.md:block 158 (quote) -msgid "{tip} The following documentation discusses how to integrate with Laravel's password confirmation features directly; however, if you would like to get started more quickly, the [Laravel application starter kits](/docs/{{version}}/starter-kits) include support for this feature!" -msgstr "{tip} 下列說明文件討論了如何直接整合 Laravel 的密碼確認功能。但若想更快速地入門, [Laravel 專案入門套件](/docs/{{version}}/starter-kits) 有內建支援這個功能!" +# CODE: php +#: ./docs/11.x/authentication.md:737 +msgid "'rehash_on_login' => false," +msgstr "" -#: docs/8.x/authentication.md:block 181 (code) -msgid "registerPolicies();\n\n" -" Auth::extend('jwt', function ($app, $name, array $config) {\n" -" // Return an instance of Illuminate\\Contracts\\Auth\\Guard...\n\n" -" return new JwtGuard(Auth::createUserProvider($config['provider']));\n" -" });\n" -" }\n" -"}\n" -msgstr "registerPolicies();\n\n" -" Auth::extend('jwt', function ($app, $name, array $config) {\n" -" // Return an instance of Illuminate\\Contracts\\Auth\\Guard...\n\n" -" return new JwtGuard(Auth::createUserProvider($config['provider']));\n" -" });\n" -" }\n" -"}\n" - -#: docs/8.x/authentication.md:block 188 (code) -msgid "use App\\Models\\User;\n" -"use Illuminate\\Http\\Request;\n" -"use Illuminate\\Support\\Facades\\Auth;\n\n" -"/**\n" -" * Register any application authentication / authorization services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" $this->registerPolicies();\n\n" -" Auth::viaRequest('custom-token', function (Request $request) {\n" -" return User::where('token', $request->token)->first();\n" -" });\n" -"}\n" -msgstr "use App\\Models\\User;\n" -"use Illuminate\\Http\\Request;\n" -"use Illuminate\\Support\\Facades\\Auth;\n\n" -"/**\n" -" * Register any application authentication / authorization services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" $this->registerPolicies();\n\n" -" Auth::viaRequest('custom-token', function (Request $request) {\n" -" return User::where('token', $request->token)->first();\n" -" });\n" -"}\n" - -#: docs/8.x/authentication.md:block 194 (code) -msgid "registerPolicies();\n\n" -" Auth::provider('mongo', function ($app, array $config) {\n" -" // Return an instance of Illuminate\\Contracts\\Auth\\UserProvider...\n\n" -" return new MongoUserProvider($app->make('mongo.connection'));\n" -" });\n" -" }\n" -"}\n" -msgstr "registerPolicies();\n\n" -" Auth::provider('mongo', function ($app, array $config) {\n" -" // Return an instance of Illuminate\\Contracts\\Auth\\UserProvider...\n\n" -" return new MongoUserProvider($app->make('mongo.connection'));\n" -" });\n" -" }\n" -"}\n" - -#: docs/8.x/authentication.md:block 214 (paragraph) -msgid "This interface allows the authentication system to work with any \"user\" class, regardless of what ORM or storage abstraction layer you are using. By default, Laravel includes a `App\\Models\\User` class in the `app/Models` directory which implements this interface." -msgstr "有了這個介面,不論使用什麼 ORM 或儲存抽象層,認證系統都能與任何的「使用者」Class 搭配使用。預設情況下,Laravel 在 `app/Models` 目錄內包含了一個 `App\\Models\\User` Class,`App\\Models\\User` 就實作了這個介面。" - -#: docs/9.x/authentication.md:block 31 (paragraph) -msgid "*[Laravel Jetstream](https://jetstream.laravel.com)* is a robust application starter kit that consumes and exposes Laravel Fortify's authentication services with a beautiful, modern UI powered by [Tailwind CSS](https://tailwindcss.com), [Livewire](https://laravel-livewire.com), and / or [Inertia](https://inertiajs.com). Laravel Jetstream includes optional support for two-factor authentication, team support, browser session management, profile management, and built-in integration with [Laravel Sanctum](/docs/{{version}}/sanctum) to offer API token authentication. Laravel's API authentication offerings are discussed below." -msgstr "**[Laravel Jetstream](https://jetstream.laravel.com)** 是一個強大的入門套件,該套件使用者 Laravel Fortify 的驗證服務,並將其通過 [Tailwind CSS](https://tailwindcss.com), [Livewire](https://laravel-livewire.com),與/或 [Inertia](https://inertiajs.com) 來提供美麗且現代的 UI。Laravel Jetstream 也提供了對二步驟驗證、團隊支援、瀏覽器啟程管理、個人檔案管理、以及內建與 [Laravel Sanctum](/docs/{{version}}/sunctum) 整合來提供 API 權杖驗證的可選支援。Laravel 提供的 API 驗證功能將在下方討論。" - -#: docs/9.x/authentication.md:block 55 (paragraph) -msgid "[Laravel Jetstream](https://jetstream.laravel.com) is a more robust application starter kit that includes support for scaffolding your application with [Livewire](https://laravel-livewire.com) or [Inertia and Vue](https://inertiajs.com). In addition, Jetstream features optional support for two-factor authentication, teams, profile management, browser session management, API support via [Laravel Sanctum](/docs/{{version}}/sanctum), account deletion, and more." -msgstr "[Laravel Jetstream](https://jetstream.laravel.com) 是一個更複雜的專案入門套件,其中包含了使用 [Livewire](https://laravel-livewire.com) 或 [Inertia 與 Vue](https://inertiajs.com) 來對應用程式 Scaffolding 的支援。此外,Jetstream 也提供了對二步驟認證、團隊、個人檔案管理、瀏覽器啟程管理、通過 [Laravel Sanctum](/docs/{{version}}/sanctum) 提供的 API 支援、帳號刪除…等功能的可選支援。" - -#: docs/9.x/authentication.md:block 87 (code) -msgid "validate([\n" -" 'email' => ['required', 'email'],\n" -" 'password' => ['required'],\n" -" ]);\n\n" -" if (Auth::attempt($credentials)) {\n" -" $request->session()->regenerate();\n\n" -" return redirect()->intended('dashboard');\n" -" }\n\n" -" return back()->withErrors([\n" -" 'email' => 'The provided credentials do not match our records.',\n" -" ])->onlyInput('email');\n" -" }\n" -"}\n" -msgstr "validate([\n" -" 'email' => ['required', 'email'],\n" -" 'password' => ['required'],\n" -" ]);\n\n" -" if (Auth::attempt($credentials)) {\n" -" $request->session()->regenerate();\n\n" -" return redirect()->intended('dashboard');\n" -" }\n\n" -" return back()->withErrors([\n" -" 'email' => 'The provided credentials do not match our records.',\n" -" ])->onlyInput('email');\n" -" }\n" -"}\n" - -#: docs/9.x/authentication.md:block 97 (code) -msgid "if (Auth::attempt([\n" -" 'email' => $email, \n" -" 'password' => $password, \n" -" fn ($query) => $query->has('activeSubscription'),\n" -"])) {\n" -" // Authentication was successful...\n" -"}\n" -msgstr "if (Auth::attempt([\n" -" 'email' => $email, \n" -" 'password' => $password, \n" -" fn ($query) => $query->has('activeSubscription'),\n" -"])) {\n" -" // 登入成功...\n" -"}\n" - -#: docs/9.x/authentication.md:block 100 (code) -msgid "if (Auth::attemptWhen([\n" -" 'email' => $email,\n" -" 'password' => $password,\n" -"], function ($user) {\n" -" return $user->isNotBanned();\n" -"})) {\n" -" // Authentication was successful...\n" -"}\n" -msgstr "if (Auth::attemptWhen([\n" -" 'email' => $email,\n" -" 'password' => $password,\n" -"], function ($user) {\n" -" return $user->isNotBanned();\n" -"})) {\n" -" // 登入成功...\n" -"}\n" - -#: docs/9.x/authentication.md:block 156 (paragraph) -msgid "Before getting started, you should make sure that the `Illuminate\\Session\\Middleware\\AuthenticateSession` middleware is included on the routes that should receive session authentication. Typically, you should place this middleware on a route group definition so that it can be applied to the majority of your application's routes. By default, the `AuthenticateSession` middleware may be attached to a route using the `auth.session` route middleware key as defined in your application's HTTP kernel:" -msgstr "在開始之前,請先確保要收到 Session 身份驗證的 Route 都有包含 `Illuminate\\Session\\Middleware\\AuthenticateSession` Middleware。一般來說,應在 Route 群組定義內放入這個 Middleware,好讓該 Middleware 被套用到專案中大多數的 Route。預設情況下,`AuthenticateSession` Middleware 可使用專案 HTTP Kernel 中所定義的 `auth.session` 這個 Route Middleware 索引鍵來附加到 Route 上:" - -#: docs/9.x/authentication.md:block 194 (code) -msgid "use App\\Models\\User;\n" -"use Illuminate\\Http\\Request;\n" -"use Illuminate\\Support\\Facades\\Auth;\n\n" -"/**\n" -" * Register any application authentication / authorization services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" $this->registerPolicies();\n\n" -" Auth::viaRequest('custom-token', function (Request $request) {\n" -" return User::where('token', (string) $request->token)->first();\n" -" });\n" -"}\n" -msgstr "use App\\Models\\User;\n" -"use Illuminate\\Http\\Request;\n" -"use Illuminate\\Support\\Facades\\Auth;\n\n" -"/**\n" -" * Register any application authentication / authorization services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" $this->registerPolicies();\n\n" -" Auth::viaRequest('custom-token', function (Request $request) {\n" -" return User::where('token', (string) $request->token)->first();\n" -" });\n" -"}\n" - -#: docs/9.x/authentication.md:block 198 (code) -msgid "Route::middleware('auth:api')->group(function () {\n" -" // ...\n" -"}\n" -msgstr "Route::middleware('auth:api')->group(function () {\n" -" // ...\n" -"}\n" - -#: docs/master/authentication.md:block 61 (code) -msgid "user()\n\n" -" return response()->noContent();\n" -" }\n" -"}\n" -msgstr "user()\n\n" -" return response()->noContent();\n" -" }\n" -"}\n" - -#: docs/master/authentication.md:block 187 (code) -msgid "registerPolicies();\n\n" -" Auth::extend('jwt', function (Application $app, string $name, array $config) {\n" -" // Return an instance of Illuminate\\Contracts\\Auth\\Guard...\n\n" -" return new JwtGuard(Auth::createUserProvider($config['provider']));\n" -" });\n" -" }\n" -"}\n" -msgstr "registerPolicies();\n\n" -" Auth::extend('jwt', function (Application $app, string $name, array $config) {\n" -" // 回傳 Illuminate\\Contracts\\Auth\\Guard 實體...\n\n" -" return new JwtGuard(Auth::createUserProvider($config['provider']));\n" -" });\n" -" }\n" -"}\n" - -#: docs/master/authentication.md:block 194 (code) -msgid "use App\\Models\\User;\n" -"use Illuminate\\Http\\Request;\n" -"use Illuminate\\Support\\Facades\\Auth;\n\n" -"/**\n" -" * Register any application authentication / authorization services.\n" -" */\n" -"public function boot(): void\n" -"{\n" -" $this->registerPolicies();\n\n" -" Auth::viaRequest('custom-token', function (Request $request) {\n" -" return User::where('token', $request->token)->first();\n" -" });\n" -"}\n" -msgstr "use App\\Models\\User;\n" -"use Illuminate\\Http\\Request;\n" -"use Illuminate\\Support\\Facades\\Auth;\n\n" -"/**\n" -" * Register any application authentication / authorization services.\n" -" */\n" -"public function boot(): void\n" -"{\n" -" $this->registerPolicies();\n\n" -" Auth::viaRequest('custom-token', function (Request $request) {\n" -" return User::where('token', $request->token)->first();\n" -" });\n" -"}\n" - -#: docs/master/authentication.md:block 202 (code) -msgid "registerPolicies();\n\n" -" Auth::provider('mongo', function (Application $app, array $config) {\n" -" // Return an instance of Illuminate\\Contracts\\Auth\\UserProvider...\n\n" -" return new MongoUserProvider($app->make('mongo.connection'));\n" -" });\n" -" }\n" -"}\n" -msgstr "registerPolicies();\n\n" -" Auth::provider('mongo', function (Application $app, array $config) {\n" -" // Return an instance of Illuminate\\Contracts\\Auth\\UserProvider...\n\n" -" return new MongoUserProvider($app->make('mongo.connection'));\n" -" });\n" -" }\n" -"}\n" +# P +#: ./docs/11.x/authentication.md:744 +#: ./docs/master/authentication.md:722 +msgid "Laravel dispatches a variety of [events](/docs/{{version}}/events) during the authentication process. You may [define listeners](/docs/{{version}}/events) for any of the following events:" +msgstr "" diff --git a/po/zh_TW/authorization.po b/po/zh_TW/authorization.po index b2fb6c617..828d73163 100644 --- a/po/zh_TW/authorization.po +++ b/po/zh_TW/authorization.po @@ -10,150 +10,451 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" +"PO-Revision-Date: 2024-11-30 08:38\n" -#: docs/10.x/authorization.md:block 1 (header) +# TD +#: ./docs/8.x/authorization.md +#: ./docs/9.x/authorization.md +#: ./docs/10.x/authorization.md +msgid "Controller Method" +msgstr "" + +# TD +#: ./docs/8.x/authorization.md +#: ./docs/9.x/authorization.md +#: ./docs/10.x/authorization.md +msgid "Policy Method" +msgstr "" + +# TD +#: ./docs/8.x/authorization.md +#: ./docs/9.x/authorization.md +#: ./docs/10.x/authorization.md +msgid "index" +msgstr "" + +# TD +#: ./docs/8.x/authorization.md +#: ./docs/9.x/authorization.md +#: ./docs/10.x/authorization.md +msgid "viewAny" +msgstr "" + +# TD +#: ./docs/8.x/authorization.md +#: ./docs/9.x/authorization.md +#: ./docs/10.x/authorization.md +msgid "show" +msgstr "" + +# TD +#: ./docs/8.x/authorization.md +#: ./docs/9.x/authorization.md +#: ./docs/10.x/authorization.md +msgid "view" +msgstr "" + +# TD +#: ./docs/8.x/authorization.md +#: ./docs/9.x/authorization.md +#: ./docs/10.x/authorization.md +msgid "create" +msgstr "" + +# TD +#: ./docs/8.x/authorization.md +#: ./docs/9.x/authorization.md +#: ./docs/10.x/authorization.md +msgid "store" +msgstr "" + +# TD +#: ./docs/8.x/authorization.md +#: ./docs/9.x/authorization.md +#: ./docs/10.x/authorization.md +msgid "edit" +msgstr "" + +# TD +#: ./docs/8.x/authorization.md +#: ./docs/9.x/authorization.md +#: ./docs/10.x/authorization.md +msgid "update" +msgstr "" + +# TD +#: ./docs/8.x/authorization.md +#: ./docs/9.x/authorization.md +#: ./docs/10.x/authorization.md +msgid "destroy" +msgstr "" + +# TD +#: ./docs/8.x/authorization.md +#: ./docs/9.x/authorization.md +#: ./docs/10.x/authorization.md +msgid "delete" +msgstr "" + +# H1 +#: ./docs/8.x/authorization.md:1 +#: ./docs/9.x/authorization.md:1 +#: ./docs/10.x/authorization.md:1 +#: ./docs/11.x/authorization.md:1 +#: ./docs/master/authorization.md:1 msgid "Authorization" -msgstr "授權" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:3 +#: ./docs/9.x/authorization.md:3 +#: ./docs/10.x/authorization.md:3 +#: ./docs/11.x/authorization.md:3 +#: ./docs/master/authorization.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:4 +#: ./docs/9.x/authorization.md:4 +#: ./docs/10.x/authorization.md:4 +#: ./docs/11.x/authorization.md:4 +#: ./docs/master/authorization.md:4 msgid "[Gates](#gates)" -msgstr "[Gate](#gates)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:5 +#: ./docs/9.x/authorization.md:5 +#: ./docs/10.x/authorization.md:5 +#: ./docs/11.x/authorization.md:5 +#: ./docs/master/authorization.md:5 msgid "[Writing Gates](#writing-gates)" -msgstr "[撰寫 Gate](#writing-gates)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:6 +#: ./docs/9.x/authorization.md:6 +#: ./docs/10.x/authorization.md:6 +#: ./docs/11.x/authorization.md:6 +#: ./docs/master/authorization.md:6 msgid "[Authorizing Actions](#authorizing-actions-via-gates)" -msgstr "[授權動作](#authorizing-actions-via-gates)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:7 +#: ./docs/9.x/authorization.md:7 +#: ./docs/10.x/authorization.md:7 +#: ./docs/11.x/authorization.md:7 +#: ./docs/master/authorization.md:7 msgid "[Gate Responses](#gate-responses)" -msgstr "[Gate Response](#gate-responses)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:8 +#: ./docs/9.x/authorization.md:8 +#: ./docs/10.x/authorization.md:8 +#: ./docs/11.x/authorization.md:8 +#: ./docs/master/authorization.md:8 msgid "[Intercepting Gate Checks](#intercepting-gate-checks)" -msgstr "[攔截 Gate 檢查](#intercepting-gate-checks)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:9 +#: ./docs/9.x/authorization.md:9 +#: ./docs/10.x/authorization.md:9 +#: ./docs/11.x/authorization.md:9 +#: ./docs/master/authorization.md:9 msgid "[Inline Authorization](#inline-authorization)" -msgstr "[內嵌授權](#inline-authorization)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:10 +#: ./docs/9.x/authorization.md:10 +#: ./docs/10.x/authorization.md:10 +#: ./docs/11.x/authorization.md:10 +#: ./docs/master/authorization.md:10 msgid "[Creating Policies](#creating-policies)" -msgstr "[建立 Policy](#creating-policies)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:11 +#: ./docs/9.x/authorization.md:11 +#: ./docs/10.x/authorization.md:11 +#: ./docs/11.x/authorization.md:11 +#: ./docs/master/authorization.md:11 msgid "[Generating Policies](#generating-policies)" -msgstr "[產生 Policy](#generating-policies)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:12 +#: ./docs/9.x/authorization.md:12 +#: ./docs/10.x/authorization.md:12 +#: ./docs/11.x/authorization.md:12 +#: ./docs/master/authorization.md:12 msgid "[Registering Policies](#registering-policies)" -msgstr "[註冊 Policy](#registering-policies)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:13 +#: ./docs/9.x/authorization.md:13 +#: ./docs/10.x/authorization.md:13 +#: ./docs/11.x/authorization.md:13 +#: ./docs/master/authorization.md:13 msgid "[Writing Policies](#writing-policies)" -msgstr "[撰寫 Policy](#writing-policies)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:14 +#: ./docs/9.x/authorization.md:14 +#: ./docs/10.x/authorization.md:14 +#: ./docs/11.x/authorization.md:14 +#: ./docs/master/authorization.md:14 msgid "[Policy Methods](#policy-methods)" -msgstr "[Policy 方法](#policy-methods)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:15 +#: ./docs/9.x/authorization.md:15 +#: ./docs/10.x/authorization.md:15 +#: ./docs/11.x/authorization.md:15 +#: ./docs/master/authorization.md:15 msgid "[Policy Responses](#policy-responses)" -msgstr "[Policy Response](#policy-responses)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:16 +#: ./docs/9.x/authorization.md:16 +#: ./docs/10.x/authorization.md:16 +#: ./docs/11.x/authorization.md:16 +#: ./docs/master/authorization.md:16 msgid "[Methods Without Models](#methods-without-models)" -msgstr "[不使用 Model 的方法](#methods-without-models)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:17 +#: ./docs/9.x/authorization.md:17 +#: ./docs/10.x/authorization.md:17 +#: ./docs/11.x/authorization.md:17 +#: ./docs/master/authorization.md:17 msgid "[Guest Users](#guest-users)" -msgstr "[訪客使用者](#guest-users)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:18 +#: ./docs/9.x/authorization.md:18 +#: ./docs/10.x/authorization.md:18 +#: ./docs/11.x/authorization.md:18 +#: ./docs/master/authorization.md:18 msgid "[Policy Filters](#policy-filters)" -msgstr "[Policy 篩選器](#policy-filters)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:19 +#: ./docs/9.x/authorization.md:19 +#: ./docs/10.x/authorization.md:19 +#: ./docs/11.x/authorization.md:19 +#: ./docs/master/authorization.md:19 msgid "[Authorizing Actions Using Policies](#authorizing-actions-using-policies)" -msgstr "[通過 Policy 來授權動作](#authorizing-actions-using-policies)" +msgstr "" + +# P +#: ./docs/10.x/authorization.md:20 +#: ./docs/11.x/authorization.md:20 +#: ./docs/master/authorization.md:20 +msgid "[Via the User Model](#via-the-user-model)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:20 +#: ./docs/9.x/authorization.md:20 msgid "[Via The User Model](#via-the-user-model)" -msgstr "[通過使用者 Model](#via-the-user-model)" +msgstr "" + +# P +#: ./docs/11.x/authorization.md:21 +#: ./docs/master/authorization.md:21 +msgid "[Via the Gate Facade](#via-the-gate-facade)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:21 +#: ./docs/9.x/authorization.md:21 +#: ./docs/10.x/authorization.md:21 msgid "[Via Controller Helpers](#via-controller-helpers)" -msgstr "[通過 Controller 的輔助函式](#via-controller-helpers)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:22 +#: ./docs/9.x/authorization.md:22 +#: ./docs/10.x/authorization.md:22 +#: ./docs/11.x/authorization.md:22 +#: ./docs/master/authorization.md:22 msgid "[Via Middleware](#via-middleware)" -msgstr "[通過 Middleware](#via-middleware)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:23 +#: ./docs/9.x/authorization.md:23 +#: ./docs/10.x/authorization.md:23 +#: ./docs/11.x/authorization.md:23 +#: ./docs/master/authorization.md:23 msgid "[Via Blade Templates](#via-blade-templates)" -msgstr "[通過 Blade 樣板](#via-blade-templates)" +msgstr "" -#: docs/10.x/authorization.md:block 2 (unordered list) +# P +#: ./docs/8.x/authorization.md:24 +#: ./docs/9.x/authorization.md:24 +#: ./docs/10.x/authorization.md:24 +#: ./docs/11.x/authorization.md:24 +#: ./docs/master/authorization.md:24 msgid "[Supplying Additional Context](#supplying-additional-context)" -msgstr "[提供額外的上下文](#supplying-additional-context)" +msgstr "" + +# P +#: ./docs/11.x/authorization.md:25 +msgid "[Authorization & Inertia](#authorization-and-inertia)" +msgstr "" -#: docs/10.x/authorization.md:block 4 (header) +# P +#: ./docs/8.x/authorization.md:26 +#: ./docs/9.x/authorization.md:26 +#: ./docs/10.x/authorization.md:26 +#: ./docs/11.x/authorization.md:27 +#: ./docs/master/authorization.md:26 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authorization.md:27 +#: ./docs/9.x/authorization.md:27 +#: ./docs/10.x/authorization.md:27 +#: ./docs/11.x/authorization.md:28 +#: ./docs/master/authorization.md:27 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/authorization.md:block 5 (paragraph) +# P +#: ./docs/8.x/authorization.md:29 +#: ./docs/9.x/authorization.md:29 +#: ./docs/10.x/authorization.md:29 +#: ./docs/11.x/authorization.md:30 +#: ./docs/master/authorization.md:29 msgid "In addition to providing built-in [authentication](/docs/{{version}}/authentication) services, Laravel also provides a simple way to authorize user actions against a given resource. For example, even though a user is authenticated, they may not be authorized to update or delete certain Eloquent models or database records managed by your application. Laravel's authorization features provide an easy, organized way of managing these types of authorization checks." -msgstr "除了提供內建的[認證](/docs/{{version}}/authentication)服務,Laravel 也提供了一種能依給定資源來授權使用者的簡單功能。舉例來說,雖然使用者已登入,但這個使用者可能未被授權可更新或刪除網站所管理的特定的 Eloquent Model 或資料庫記錄。Laravel 的授權功能提供了一種簡單且有條理的方法來管理這些種類的授權。" +msgstr "" -#: docs/10.x/authorization.md:block 6 (paragraph) +# P +#: ./docs/8.x/authorization.md:31 +#: ./docs/9.x/authorization.md:31 +#: ./docs/10.x/authorization.md:31 +#: ./docs/11.x/authorization.md:32 +#: ./docs/master/authorization.md:31 msgid "Laravel provides two primary ways of authorizing actions: [gates](#gates) and [policies](#creating-policies). Think of gates and policies like routes and controllers. Gates provide a simple, closure-based approach to authorization while policies, like controllers, group logic around a particular model or resource. In this documentation, we'll explore gates first and then examine policies." -msgstr "Laravel 提供了兩種主要方法來授權動作:[Gate](#gates) 與 [Policy](#creating-policies)。可以把 Gate 與 Policy 想成是路由與 Controller。Gate 提供了一種簡單、基於閉包的方法來進行授權;而 Policy 就像 Controller 一樣,可以將授權邏輯依照特定的 Model 或資源來進行分組。在本說明文件中,我們會先來探討 Gate,然後再來看看 Policy。" +msgstr "" -#: docs/10.x/authorization.md:block 7 (paragraph) +# P +#: ./docs/8.x/authorization.md:33 +msgid "You do not need to choose between exclusively using gates or exclusively using policies when building an application. Most applications will most likely contain some mixture of gates and policies, and that is perfectly fine! Gates are most applicable to actions which are not related to any model or resource, such as viewing an administrator dashboard. In contrast, policies should be used when you wish to authorize an action for a particular model or resource." +msgstr "" + +# P +#: ./docs/9.x/authorization.md:33 +#: ./docs/10.x/authorization.md:33 +#: ./docs/11.x/authorization.md:34 +#: ./docs/master/authorization.md:33 msgid "You do not need to choose between exclusively using gates or exclusively using policies when building an application. Most applications will most likely contain some mixture of gates and policies, and that is perfectly fine! Gates are most applicable to actions that are not related to any model or resource, such as viewing an administrator dashboard. In contrast, policies should be used when you wish to authorize an action for a particular model or resource." -msgstr "在製作應用程式時,不需要只使用 Gate 或只使用 Policy。大多數應用程式都在某種程度上組合使用 Gate 與 Policy,這樣完全沒問題!Gate 最適合用來處理與 Model 或資源沒關係的操作,如檢視管理員縱覽頁。相較之下,Policy 則應使用於想授權對特定 Model 或 Resource 的操作時" +msgstr "" -#: docs/10.x/authorization.md:block 9 (header) +# P +#: ./docs/8.x/authorization.md:35 +#: ./docs/9.x/authorization.md:35 +#: ./docs/10.x/authorization.md:35 +#: ./docs/11.x/authorization.md:36 +#: ./docs/master/authorization.md:35 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authorization.md:36 +#: ./docs/9.x/authorization.md:36 +#: ./docs/10.x/authorization.md:36 +#: ./docs/11.x/authorization.md:37 +#: ./docs/master/authorization.md:36 msgid "Gates" -msgstr "Gate" +msgstr "" -#: docs/10.x/authorization.md:block 11 (header) +# P +#: ./docs/8.x/authorization.md:38 +#: ./docs/9.x/authorization.md:38 +#: ./docs/10.x/authorization.md:38 +#: ./docs/11.x/authorization.md:39 +#: ./docs/master/authorization.md:38 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:39 +#: ./docs/9.x/authorization.md:39 +#: ./docs/10.x/authorization.md:39 +#: ./docs/11.x/authorization.md:40 +#: ./docs/master/authorization.md:39 msgid "Writing Gates" -msgstr "撰寫 Gate" +msgstr "" -#: docs/10.x/authorization.md:block 12 (quote) -msgid "**Warning** Gates are a great way to learn the basics of Laravel's authorization features; however, when building robust Laravel applications you should consider using [policies](#creating-policies) to organize your authorization rules." -msgstr "**Warning** Gate 是學習基礎 Laravel 授權功能的最好的方法。但是,在製作大型 Laravel 應用程式時,應考慮通過 [Policy](#creating-policies) 來整理各個授權規則。" +# P +#: ./docs/8.x/authorization.md:41 +#: ./docs/9.x/authorization.md:42 +#: ./docs/10.x/authorization.md:42 +#: ./docs/11.x/authorization.md:43 +#: ./docs/master/authorization.md:42 +msgid "Gates are a great way to learn the basics of Laravel's authorization features; however, when building robust Laravel applications you should consider using [policies](#creating-policies) to organize your authorization rules." +msgstr "" -#: docs/10.x/authorization.md:block 13 (paragraph) +# P +#: ./docs/8.x/authorization.md:43 +#: ./docs/9.x/authorization.md:44 +#: ./docs/10.x/authorization.md:44 msgid "Gates are simply closures that determine if a user is authorized to perform a given action. Typically, gates are defined within the `boot` method of the `App\\Providers\\AuthServiceProvider` class using the `Gate` facade. Gates always receive a user instance as their first argument and may optionally receive additional arguments such as a relevant Eloquent model." -msgstr "Gate 是簡單的閉包,用來判斷使用者是否已被授權執行特定的動作。通常來說,Gate 會在 `App\\Providers\\AuthServiceProvider` 類別中的 `boot` 方法內通過 `Gate` Facade 來定義。Gate 會收到一個使用者實體作為其第一個引數,並且可能還會接受到額外的引數,如相關的 Eloquent Model。" +msgstr "" -#: docs/10.x/authorization.md:block 14 (paragraph) +# P +#: ./docs/11.x/authorization.md:45 +#: ./docs/master/authorization.md:44 +msgid "Gates are simply closures that determine if a user is authorized to perform a given action. Typically, gates are defined within the `boot` method of the `App\\Providers\\AppServiceProvider` class using the `Gate` facade. Gates always receive a user instance as their first argument and may optionally receive additional arguments such as a relevant Eloquent model." +msgstr "" + +# P +#: ./docs/8.x/authorization.md:45 +#: ./docs/9.x/authorization.md:46 +#: ./docs/10.x/authorization.md:46 +#: ./docs/11.x/authorization.md:47 +#: ./docs/master/authorization.md:46 msgid "In this example, we'll define a gate to determine if a user can update a given `App\\Models\\Post` model. The gate will accomplish this by comparing the user's `id` against the `user_id` of the user that created the post:" -msgstr "在此範例中,我們會定義一個用來判斷使用者能否更新給定 `App\\Models\\Post` Model 的 Gate。這個 Gate 會通過比對使用者的 `id` 與建立該貼文的 `user_id` 來進行判斷:" +msgstr "" -#: docs/10.x/authorization.md:block 15 (code) +# CODE +#: ./docs/8.x/authorization.md:47 +#: ./docs/9.x/authorization.md:48 msgid "use App\\Models\\Post;\n" "use App\\Models\\User;\n" "use Illuminate\\Support\\Facades\\Gate;\n\n" "/**\n" " * Register any authentication / authorization services.\n" +" *\n" +" * @return void\n" " */\n" -"public function boot(): void\n" +"public function boot()\n" "{\n" +" $this->registerPolicies();\n\n" " Gate::define('update-post', function (User $user, Post $post) {\n" " return $user->id === $post->user_id;\n" " });\n" -"}\n" -msgstr "use App\\Models\\Post;\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/authorization.md:48 +msgid "use App\\Models\\Post;\n" "use App\\Models\\User;\n" "use Illuminate\\Support\\Facades\\Gate;\n\n" "/**\n" @@ -164,13 +465,28 @@ msgstr "use App\\Models\\Post;\n" " Gate::define('update-post', function (User $user, Post $post) {\n" " return $user->id === $post->user_id;\n" " });\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 16 (paragraph) -msgid "Like controllers, gates may also be defined using a class callback array:" -msgstr "就像 Controller 一樣,Gate 也可以通過類別回呼陣列來定義:" +# CODE +#: ./docs/11.x/authorization.md:49 +#: ./docs/master/authorization.md:48 +msgid "use App\\Models\\Post;\n" +"use App\\Models\\User;\n" +"use Illuminate\\Support\\Facades\\Gate;\n\n" +"/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Gate::define('update-post', function (User $user, Post $post) {\n" +" return $user->id === $post->user_id;\n" +" });\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 17 (code) +# CODE +#: ./docs/10.x/authorization.md:64 msgid "use App\\Policies\\PostPolicy;\n" "use Illuminate\\Support\\Facades\\Gate;\n\n" "/**\n" @@ -179,26 +495,53 @@ msgid "use App\\Policies\\PostPolicy;\n" "public function boot(): void\n" "{\n" " Gate::define('update-post', [PostPolicy::class, 'update']);\n" -"}\n" -msgstr "use App\\Policies\\PostPolicy;\n" +"}" +msgstr "" + +# CODE +#: ./docs/11.x/authorization.md:65 +#: ./docs/master/authorization.md:64 +msgid "use App\\Policies\\PostPolicy;\n" "use Illuminate\\Support\\Facades\\Gate;\n\n" "/**\n" -" * Register any authentication / authorization services.\n" +" * Bootstrap any application services.\n" " */\n" "public function boot(): void\n" "{\n" " Gate::define('update-post', [PostPolicy::class, 'update']);\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 19 (header) -msgid "Authorizing Actions" -msgstr "授權動作" +# P +#: ./docs/8.x/authorization.md:65 +#: ./docs/9.x/authorization.md:66 +#: ./docs/10.x/authorization.md:62 +#: ./docs/11.x/authorization.md:63 +#: ./docs/master/authorization.md:62 +msgid "Like controllers, gates may also be defined using a class callback array:" +msgstr "" -#: docs/10.x/authorization.md:block 20 (paragraph) -msgid "To authorize an action using gates, you should use the `allows` or `denies` methods provided by the `Gate` facade. Note that you are not required to pass the currently authenticated user to these methods. Laravel will automatically take care of passing the user into the gate closure. It is typical to call the gate authorization methods within your application's controllers before performing an action that requires authorization:" -msgstr "若要通過 Gate 來授權某個動作,可以使用 `Gate` Facade 提供的 `allows` 或 `denies` 方法。請注意,不需要將目前已登入的使用者傳給這幾個方法。Laravel 會自動處理好將使用者傳給 Gate 閉包。通常,我們會在 Controller 執行需要授權的特定動作前呼叫這些 Gate 授權方法:" +# CODE +#: ./docs/8.x/authorization.md:67 +#: ./docs/9.x/authorization.md:68 +msgid "use App\\Policies\\PostPolicy;\n" +"use Illuminate\\Support\\Facades\\Gate;\n\n" +"/**\n" +" * Register any authentication / authorization services.\n" +" *\n" +" * @return void\n" +" */\n" +"public function boot()\n" +"{\n" +" $this->registerPolicies();\n\n" +" Gate::define('update-post', [PostPolicy::class, 'update']);\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 21 (code) +# CODE +#: ./docs/10.x/authorization.md:80 +#: ./docs/11.x/authorization.md:81 +#: ./docs/master/authorization.md:80 msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:83 +#: ./docs/9.x/authorization.md:84 +#: ./docs/10.x/authorization.md:76 +#: ./docs/11.x/authorization.md:77 +#: ./docs/master/authorization.md:76 +msgid "Authorizing Actions" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:85 +#: ./docs/9.x/authorization.md:86 +#: ./docs/10.x/authorization.md:78 +#: ./docs/11.x/authorization.md:79 +#: ./docs/master/authorization.md:78 +msgid "To authorize an action using gates, you should use the `allows` or `denies` methods provided by the `Gate` facade. Note that you are not required to pass the currently authenticated user to these methods. Laravel will automatically take care of passing the user into the gate closure. It is typical to call the gate authorization methods within your application's controllers before performing an action that requires authorization:" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:87 +#: ./docs/9.x/authorization.md:88 +msgid "allows('update-post', $post)) {\n" " // The user can update the post...\n" "}\n\n" "if (Gate::forUser($user)->denies('update-post', $post)) {\n" " // The user can't update the post...\n" -"}\n" -msgstr "if (Gate::forUser($user)->allows('update-post', $post)) {\n" -" // 該使用者可更新此貼文...\n" -"}\n\n" -"if (Gate::forUser($user)->denies('update-post', $post)) {\n" -" // 該使用者不能更新此貼文...\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 24 (paragraph) +# P +#: ./docs/8.x/authorization.md:125 +#: ./docs/9.x/authorization.md:126 +#: ./docs/10.x/authorization.md:117 +#: ./docs/11.x/authorization.md:118 +#: ./docs/master/authorization.md:117 msgid "You may authorize multiple actions at a time using the `any` or `none` methods:" -msgstr "可以通過 `any` 或 `none` 方法來在任何時候授權多個動作:" +msgstr "" -#: docs/10.x/authorization.md:block 25 (code) +# CODE +#: ./docs/8.x/authorization.md:127 +#: ./docs/9.x/authorization.md:128 +#: ./docs/10.x/authorization.md:119 +#: ./docs/11.x/authorization.md:120 +#: ./docs/master/authorization.md:119 msgid "if (Gate::any(['update-post', 'delete-post'], $post)) {\n" " // The user can update or delete the post...\n" "}\n\n" "if (Gate::none(['update-post', 'delete-post'], $post)) {\n" " // The user can't update or delete the post...\n" -"}\n" -msgstr "if (Gate::any(['update-post', 'delete-post'], $post)) {\n" -" // 該使用者可更新或刪除此貼文...\n" -"}\n\n" -"if (Gate::none(['update-post', 'delete-post'], $post)) {\n" -" // 該使用者不能更新或刪除此貼文...\n" -"}\n" +"}" +msgstr "" + +# H4 +#: ./docs/10.x/authorization.md:128 +#: ./docs/11.x/authorization.md:129 +#: ./docs/master/authorization.md:128 +msgid "Authorizing or Throwing Exceptions" +msgstr "" + +# P +#: ./docs/11.x/authorization.md:131 +#: ./docs/master/authorization.md:130 +msgid "If you would like to attempt to authorize an action and automatically throw an `Illuminate\\Auth\\Access\\AuthorizationException` if the user is not allowed to perform the given action, you may use the `Gate` facade's `authorize` method. Instances of `AuthorizationException` are automatically converted to a 403 HTTP response by Laravel:" +msgstr "" -#: docs/10.x/authorization.md:block 27 (header) +# P +#: ./docs/8.x/authorization.md:135 +#: ./docs/9.x/authorization.md:136 +#: ./docs/10.x/authorization.md:127 +#: ./docs/11.x/authorization.md:128 +#: ./docs/master/authorization.md:127 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authorization.md:136 +#: ./docs/9.x/authorization.md:137 msgid "Authorizing Or Throwing Exceptions" -msgstr "授權或擲回例外" +msgstr "" -#: docs/10.x/authorization.md:block 28 (paragraph) +# P +#: ./docs/8.x/authorization.md:138 +#: ./docs/9.x/authorization.md:139 +#: ./docs/10.x/authorization.md:130 msgid "If you would like to attempt to authorize an action and automatically throw an `Illuminate\\Auth\\Access\\AuthorizationException` if the user is not allowed to perform the given action, you may use the `Gate` facade's `authorize` method. Instances of `AuthorizationException` are automatically converted to a 403 HTTP response by Laravel's exception handler:" -msgstr "如果想在使用者不允許執行給定動作時自動擲回 `Illuminate\\Auth\\Access\\AuthorizationException`,可以使用 `Gate` Facade 的 `authorize` 方法。`AuthorizationException` 的實體會自動被 Laravel 的例外處理常式轉換為 403 HTTP 回應:" +msgstr "" -#: docs/10.x/authorization.md:block 29 (code) +# CODE +#: ./docs/8.x/authorization.md:140 +#: ./docs/9.x/authorization.md:141 +#: ./docs/10.x/authorization.md:132 +#: ./docs/11.x/authorization.md:133 +#: ./docs/master/authorization.md:132 msgid "Gate::authorize('update-post', $post);\n\n" -"// The action is authorized...\n" -msgstr "Gate::authorize('update-post', $post);\n\n" -"// 已授權可進行該動作...\n" - -#: docs/10.x/authorization.md:block 31 (header) -msgid "Supplying Additional Context" -msgstr "提供額外的上下文" - -#: docs/10.x/authorization.md:block 32 (paragraph) -msgid "The gate methods for authorizing abilities (`allows`, `denies`, `check`, `any`, `none`, `authorize`, `can`, `cannot`) and the authorization [Blade directives](#via-blade-templates) (`@can`, `@cannot`, `@canany`) can receive an array as their second argument. These array elements are passed as parameters to the gate closure, and can be used for additional context when making authorization decisions:" -msgstr "用於授權權限的 Gate 方法 (`allows`, `denies`, `check`, `any`, `none`, `authorize`, `can`, `cannot`) 與授權的 [Blade 指示詞](#via-blade-templates) (`@can`, `@cannot`, `@canany`) 都接受一個陣列作為其第二引數。這些陣列的元素會被作為引數傳給 Gate 閉包,並且可在進行權限認證時提供額外的上下文:" +"// The action is authorized..." +msgstr "" -#: docs/10.x/authorization.md:block 33 (code) +# CODE +#: ./docs/10.x/authorization.md:141 +#: ./docs/11.x/authorization.md:142 +#: ./docs/master/authorization.md:141 msgid "use App\\Models\\Category;\n" "use App\\Models\\User;\n" "use Illuminate\\Support\\Facades\\Gate;\n\n" @@ -314,11 +728,49 @@ msgid "use App\\Models\\Category;\n" "});\n\n" "if (Gate::check('create-post', [$category, $pinned])) {\n" " // The user can create the post...\n" -"}\n" -msgstr "use App\\Models\\Category;\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:144 +#: ./docs/9.x/authorization.md:145 +#: ./docs/10.x/authorization.md:136 +#: ./docs/11.x/authorization.md:137 +#: ./docs/master/authorization.md:136 +#~ msgid "" +#~ msgstr "" + +# H4 +# H3 +#: ./docs/8.x/authorization.md:145 +#: ./docs/8.x/authorization.md:720 +#: ./docs/9.x/authorization.md:146 +#: ./docs/9.x/authorization.md:799 +#: ./docs/10.x/authorization.md:137 +#: ./docs/10.x/authorization.md:764 +#: ./docs/11.x/authorization.md:138 +#: ./docs/11.x/authorization.md:704 +#: ./docs/master/authorization.md:137 +#: ./docs/master/authorization.md:703 +msgid "Supplying Additional Context" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:147 +#: ./docs/9.x/authorization.md:148 +#: ./docs/10.x/authorization.md:139 +#: ./docs/11.x/authorization.md:140 +#: ./docs/master/authorization.md:139 +msgid "The gate methods for authorizing abilities (`allows`, `denies`, `check`, `any`, `none`, `authorize`, `can`, `cannot`) and the authorization [Blade directives](#via-blade-templates) (`@can`, `@cannot`, `@canany`) can receive an array as their second argument. These array elements are passed as parameters to the gate closure, and can be used for additional context when making authorization decisions:" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:149 +#: ./docs/9.x/authorization.md:150 +msgid "use App\\Models\\Category;\n" "use App\\Models\\User;\n" "use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::define('create-post', function (User $user, Category $category, bool $pinned) {\n" +"Gate::define('create-post', function (User $user, Category $category, $pinned) {\n" " if (! $user->canPublishToGroup($category->group)) {\n" " return false;\n" " } elseif ($pinned && ! $user->canPinPosts()) {\n" @@ -328,17 +780,42 @@ msgstr "use App\\Models\\Category;\n" "});\n\n" "if (Gate::check('create-post', [$category, $pinned])) {\n" " // The user can create the post...\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 35 (header) +# P +#: ./docs/8.x/authorization.md:167 +#: ./docs/9.x/authorization.md:168 +#: ./docs/10.x/authorization.md:159 +#: ./docs/11.x/authorization.md:160 +#: ./docs/master/authorization.md:159 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:168 +#: ./docs/9.x/authorization.md:169 +#: ./docs/10.x/authorization.md:160 +#: ./docs/11.x/authorization.md:161 +#: ./docs/master/authorization.md:160 msgid "Gate Responses" -msgstr "Gate 回應" +msgstr "" -#: docs/10.x/authorization.md:block 36 (paragraph) +# P +#: ./docs/8.x/authorization.md:170 +#: ./docs/9.x/authorization.md:171 +#: ./docs/10.x/authorization.md:162 +#: ./docs/11.x/authorization.md:163 +#: ./docs/master/authorization.md:162 msgid "So far, we have only examined gates that return simple boolean values. However, sometimes you may wish to return a more detailed response, including an error message. To do so, you may return an `Illuminate\\Auth\\Access\\Response` from your gate:" -msgstr "到目前為止,我們只看過了回傳簡單布林值的 Gate。但,有時候我們可能會想回傳一些更具體的回覆,並在其中包含錯誤訊息。為此,可以在 Gate 內回傳 `Illuminate\\Auth\\Access\\Response`:" +msgstr "" -#: docs/10.x/authorization.md:block 37 (code) +# CODE +#: ./docs/8.x/authorization.md:172 +#: ./docs/9.x/authorization.md:173 +#: ./docs/10.x/authorization.md:164 +#: ./docs/11.x/authorization.md:165 +#: ./docs/master/authorization.md:164 msgid "use App\\Models\\User;\n" "use Illuminate\\Auth\\Access\\Response;\n" "use Illuminate\\Support\\Facades\\Gate;\n\n" @@ -346,53 +823,128 @@ msgid "use App\\Models\\User;\n" " return $user->isAdmin\n" " ? Response::allow()\n" " : Response::deny('You must be an administrator.');\n" -"});\n" -msgstr "use App\\Models\\User;\n" -"use Illuminate\\Auth\\Access\\Response;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::define('edit-settings', function (User $user) {\n" -" return $user->isAdmin\n" -" ? Response::allow()\n" -" : Response::deny('You must be an administrator.');\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/authorization.md:block 38 (paragraph) +# P +#: ./docs/8.x/authorization.md:182 +#: ./docs/9.x/authorization.md:183 +#: ./docs/10.x/authorization.md:174 +#: ./docs/11.x/authorization.md:175 +#: ./docs/master/authorization.md:174 msgid "Even when you return an authorization response from your gate, the `Gate::allows` method will still return a simple boolean value; however, you may use the `Gate::inspect` method to get the full authorization response returned by the gate:" -msgstr "即使從 Gate 內回傳授權回應,`Gate::allows` 方法依然會回傳簡單的布林值。不過,可以使用 `Gate::inspect` 方法來取得 Gate 回傳的完整授權回應:" +msgstr "" -#: docs/10.x/authorization.md:block 39 (code) +# CODE +#: ./docs/8.x/authorization.md:184 +#: ./docs/9.x/authorization.md:185 +#: ./docs/10.x/authorization.md:176 +#: ./docs/11.x/authorization.md:177 +#: ./docs/master/authorization.md:176 msgid "$response = Gate::inspect('edit-settings');\n\n" "if ($response->allowed()) {\n" " // The action is authorized...\n" "} else {\n" " echo $response->message();\n" -"}\n" -msgstr "$response = Gate::inspect('edit-settings');\n\n" -"if ($response->allowed()) {\n" -" // 已授權可進行該動作...\n" -"} else {\n" -" echo $response->message();\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 40 (paragraph) +# P +#: ./docs/11.x/authorization.md:191 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/authorization.md:192 +#: ./docs/8.x/authorization.md:382 +#: ./docs/9.x/authorization.md:193 +#: ./docs/9.x/authorization.md:416 +#: ./docs/10.x/authorization.md:184 +#: ./docs/10.x/authorization.md:399 +#: ./docs/11.x/authorization.md:185 +#: ./docs/11.x/authorization.md:381 +#: ./docs/master/authorization.md:184 +#: ./docs/master/authorization.md:380 msgid "When using the `Gate::authorize` method, which throws an `AuthorizationException` if the action is not authorized, the error message provided by the authorization response will be propagated to the HTTP response:" -msgstr "在使用 `Gate::authorize` 方法時,若動作未被授權,會回傳 `AuthorizationException`。這時,授權回應所提供的錯誤訊息會進一步被傳給 HTTP 回應:" +msgstr "" -#: docs/10.x/authorization.md:block 41 (code) +# CODE +#: ./docs/8.x/authorization.md:194 +#: ./docs/9.x/authorization.md:195 +#: ./docs/10.x/authorization.md:186 +#: ./docs/11.x/authorization.md:187 +#: ./docs/master/authorization.md:186 msgid "Gate::authorize('edit-settings');\n\n" -"// The action is authorized...\n" -msgstr "Gate::authorize('edit-settings');\n\n" -"// 已授權可進行該動作...\n" +"// The action is authorized..." +msgstr "" + +# P +#: ./docs/8.x/authorization.md:198 +#: ./docs/9.x/authorization.md:226 +#: ./docs/10.x/authorization.md:217 +#: ./docs/11.x/authorization.md:218 +#: ./docs/master/authorization.md:217 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:199 +#: ./docs/9.x/authorization.md:227 +#: ./docs/10.x/authorization.md:218 +#: ./docs/11.x/authorization.md:219 +#: ./docs/master/authorization.md:218 +msgid "Intercepting Gate Checks" +msgstr "" -#: docs/10.x/authorization.md:block 43 (header) +# P +#: ./docs/9.x/authorization.md:199 +#: ./docs/10.x/authorization.md:190 +#: ./docs/master/authorization.md:190 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/authorization.md:200 +#: ./docs/9.x/authorization.md:423 +#: ./docs/10.x/authorization.md:191 +#: ./docs/11.x/authorization.md:192 +#: ./docs/master/authorization.md:191 msgid "Customizing The HTTP Response Status" -msgstr "自定 HTTP Response 狀態" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:201 +#: ./docs/9.x/authorization.md:229 +#: ./docs/10.x/authorization.md:220 +#: ./docs/11.x/authorization.md:221 +#: ./docs/master/authorization.md:220 +msgid "Sometimes, you may wish to grant all abilities to a specific user. You may use the `before` method to define a closure that is run before all other authorization checks:" +msgstr "" -#: docs/10.x/authorization.md:block 44 (paragraph) +# P +#: ./docs/9.x/authorization.md:202 +#: ./docs/10.x/authorization.md:193 +#: ./docs/11.x/authorization.md:194 +#: ./docs/master/authorization.md:193 msgid "When an action is denied via a Gate, a `403` HTTP response is returned; however, it can sometimes be useful to return an alternative HTTP status code. You may customize the HTTP status code returned for a failed authorization check using the `denyWithStatus` static constructor on the `Illuminate\\Auth\\Access\\Response` class:" -msgstr "當 Gate 拒絕某個動作時,會回傳 `403` HTTP Response。不過,在某些情況下,若能回傳其他的 HTTP 狀態碼更好。我們可以使用 `Illuminate\\Auth\\Access\\Response` 類別的 `denyWithStatus` 靜態建構函式來自訂在授權檢查失敗的時候要回傳的 HTTP 狀態碼:" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:203 +#: ./docs/9.x/authorization.md:231 +msgid "use Illuminate\\Support\\Facades\\Gate;\n\n" +"Gate::before(function ($user, $ability) {\n" +" if ($user->isAdministrator()) {\n" +" return true;\n" +" }\n" +"});" +msgstr "" -#: docs/10.x/authorization.md:block 45 (code) +# CODE +#: ./docs/9.x/authorization.md:204 +#: ./docs/10.x/authorization.md:195 +#: ./docs/11.x/authorization.md:196 +#: ./docs/master/authorization.md:195 msgid "use App\\Models\\User;\n" "use Illuminate\\Auth\\Access\\Response;\n" "use Illuminate\\Support\\Facades\\Gate;\n\n" @@ -400,21 +952,54 @@ msgid "use App\\Models\\User;\n" " return $user->isAdmin\n" " ? Response::allow()\n" " : Response::denyWithStatus(404);\n" -"});\n" -msgstr "use App\\Models\\User;\n" -"use Illuminate\\Auth\\Access\\Response;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::define('edit-settings', function (User $user) {\n" -" return $user->isAdmin\n" -" ? Response::allow()\n" -" : Response::denyWithStatus(404);\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:211 +#: ./docs/9.x/authorization.md:239 +#: ./docs/10.x/authorization.md:231 +#: ./docs/11.x/authorization.md:232 +#: ./docs/master/authorization.md:231 +msgid "If the `before` closure returns a non-null result that result will be considered the result of the authorization check." +msgstr "" -#: docs/10.x/authorization.md:block 46 (paragraph) +# P +#: ./docs/8.x/authorization.md:213 +#: ./docs/9.x/authorization.md:241 +#: ./docs/10.x/authorization.md:233 +#: ./docs/11.x/authorization.md:234 +#: ./docs/master/authorization.md:233 +msgid "You may use the `after` method to define a closure to be executed after all other authorization checks:" +msgstr "" + +# P +#: ./docs/9.x/authorization.md:214 +#: ./docs/9.x/authorization.md:445 +#: ./docs/10.x/authorization.md:205 +#: ./docs/10.x/authorization.md:424 +#: ./docs/11.x/authorization.md:206 +#: ./docs/11.x/authorization.md:406 +#: ./docs/master/authorization.md:205 +#: ./docs/master/authorization.md:405 msgid "Because hiding resources via a `404` response is such a common pattern for web applications, the `denyAsNotFound` method is offered for convenience:" -msgstr "而因為使用 `404` Response 來隱藏資源是在 Web App 中常見的手段,因此為了方便, Laravel 也提供了 `denyAsNotFound` 方法:" +msgstr "" -#: docs/10.x/authorization.md:block 47 (code) +# CODE +#: ./docs/8.x/authorization.md:215 +#: ./docs/9.x/authorization.md:243 +msgid "Gate::after(function ($user, $ability, $result, $arguments) {\n" +" if ($user->isAdministrator()) {\n" +" return true;\n" +" }\n" +"});" +msgstr "" + +# CODE +#: ./docs/9.x/authorization.md:216 +#: ./docs/10.x/authorization.md:207 +#: ./docs/11.x/authorization.md:208 +#: ./docs/master/authorization.md:207 msgid "use App\\Models\\User;\n" "use Illuminate\\Auth\\Access\\Response;\n" "use Illuminate\\Support\\Facades\\Gate;\n\n" @@ -422,129 +1007,226 @@ msgid "use App\\Models\\User;\n" " return $user->isAdmin\n" " ? Response::allow()\n" " : Response::denyAsNotFound();\n" -"});\n" -msgstr "use App\\Models\\User;\n" -"use Illuminate\\Auth\\Access\\Response;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::define('edit-settings', function (User $user) {\n" -" return $user->isAdmin\n" -" ? Response::allow()\n" -" : Response::denyAsNotFound();\n" -"});\n" - -#: docs/10.x/authorization.md:block 49 (header) -msgid "Intercepting Gate Checks" -msgstr "攔截 Gate 檢查" +"});" +msgstr "" -#: docs/10.x/authorization.md:block 50 (paragraph) -msgid "Sometimes, you may wish to grant all abilities to a specific user. You may use the `before` method to define a closure that is run before all other authorization checks:" -msgstr "有的時候,我們可能會想授權特定使用者所有的權限。可以使用 `before` 方法來定義會在所有權限檢查前執行的閉包:" +# P +#: ./docs/8.x/authorization.md:221 +#: ./docs/9.x/authorization.md:249 +#: ./docs/10.x/authorization.md:243 +#: ./docs/master/authorization.md:243 +msgid "Similar to the `before` method, if the `after` closure returns a non-null result that result will be considered the result of the authorization check." +msgstr "" -#: docs/10.x/authorization.md:block 51 (code) +# CODE +#: ./docs/10.x/authorization.md:222 +#: ./docs/11.x/authorization.md:223 +#: ./docs/master/authorization.md:222 msgid "use App\\Models\\User;\n" "use Illuminate\\Support\\Facades\\Gate;\n\n" "Gate::before(function (User $user, string $ability) {\n" " if ($user->isAdministrator()) {\n" " return true;\n" " }\n" -"});\n" -msgstr "use App\\Models\\User;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::before(function (User $user, string $ability) {\n" -" if ($user->isAdministrator()) {\n" -" return true;\n" -" }\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/authorization.md:block 52 (paragraph) -msgid "If the `before` closure returns a non-null result that result will be considered the result of the authorization check." -msgstr "若 `before` 閉包回傳了一個非 null 的結果,則該結果值會被當作權限檢查的結果。" +# P +#: ./docs/8.x/authorization.md:223 +#: ./docs/9.x/authorization.md:251 +#: ./docs/10.x/authorization.md:245 +#: ./docs/11.x/authorization.md:246 +#: ./docs/master/authorization.md:245 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:224 +#: ./docs/9.x/authorization.md:252 +#: ./docs/10.x/authorization.md:246 +#: ./docs/11.x/authorization.md:247 +#: ./docs/master/authorization.md:246 +msgid "Inline Authorization" +msgstr "" -#: docs/10.x/authorization.md:block 53 (paragraph) -msgid "You may use the `after` method to define a closure to be executed after all other authorization checks:" -msgstr "可以使用 `after` 方法來定義一個會在所有其他權限檢查後執行的閉包:" +# P +#: ./docs/8.x/authorization.md:226 +#: ./docs/9.x/authorization.md:254 +msgid "Occasionally, you may wish to determine if the currently authenticated user is authorized to perform a given action without writing a dedicated gate that corresponds to the action. Laravel allows you to perform these types of \"inline\" authorization checks via the `Gate::allowIf` and `Gate::denyIf` methods:" +msgstr "" + +# CODE: php +#: ./docs/8.x/authorization.md:228 +msgid "use Illuminate\\Support\\Facades\\Auth;\n\n" +"Gate::allowIf(fn ($user) => $user->isAdministrator());\n\n" +"Gate::denyIf(fn ($user) => $user->banned());" +msgstr "" -#: docs/10.x/authorization.md:block 54 (code) +# CODE +#: ./docs/10.x/authorization.md:235 +#: ./docs/11.x/authorization.md:236 +#: ./docs/master/authorization.md:235 msgid "use App\\Models\\User;\n\n" "Gate::after(function (User $user, string $ability, bool|null $result, mixed $arguments) {\n" " if ($user->isAdministrator()) {\n" " return true;\n" " }\n" -"});\n" -msgstr "use App\\Models\\User;\n\n" -"Gate::after(function (User $user, string $ability, bool|null $result, mixed $arguments) {\n" -" if ($user->isAdministrator()) {\n" -" return true;\n" -" }\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/authorization.md:block 55 (paragraph) -msgid "Similar to the `before` method, if the `after` closure returns a non-null result that result will be considered the result of the authorization check." -msgstr "與 `before` 方法類似,若 `after` 閉包回傳了非 null 的結果,則該結果會被當作權限檢查的結果。" - -#: docs/10.x/authorization.md:block 57 (header) -msgid "Inline Authorization" -msgstr "內嵌授權" - -#: docs/10.x/authorization.md:block 58 (paragraph) -msgid "Occasionally, you may wish to determine if the currently authenticated user is authorized to perform a given action without writing a dedicated gate that corresponds to the action. Laravel allows you to perform these types of \"inline\" authorization checks via the `Gate::allowIf` and `Gate::denyIf` methods:" -msgstr "有時候,我們可能需要判斷目前登入的使用者是否有權限進行給定動作,但我們不想給這個動作撰寫獨立的 Gate。在 Laravel,我們可以使用 `Gate::allowIf` 與 `Gate::denyIf` 方法來進行這類的「內嵌」授權檢查:" - -#: docs/10.x/authorization.md:block 59 (code) -msgid "use App\\Models\\User;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::allowIf(fn (User $user) => $user->isAdministrator());\n\n" -"Gate::denyIf(fn (User $user) => $user->banned());\n" -msgstr "use App\\Models\\User;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::allowIf(fn (User $user) => $user->isAdministrator());\n\n" -"Gate::denyIf(fn (User $user) => $user->banned());\n" - -#: docs/10.x/authorization.md:block 60 (paragraph) +# P +#: ./docs/8.x/authorization.md:236 +#: ./docs/9.x/authorization.md:264 +#: ./docs/10.x/authorization.md:259 +#: ./docs/11.x/authorization.md:260 +#: ./docs/master/authorization.md:259 msgid "If the action is not authorized or if no user is currently authenticated, Laravel will automatically throw an `Illuminate\\Auth\\Access\\AuthorizationException` exception. Instances of `AuthorizationException` are automatically converted to a 403 HTTP response by Laravel's exception handler." -msgstr "若該動作未授權、或是使用者未登入,則 Laravel 會自動擲回 `Illuminate\\Auth\\Access\\AuthorizationException` 例外。`AuthorizationException` 實體會自動由 Laravel 的例外處理常式轉換為 403 HTTP 回應。" +msgstr "" -#: docs/10.x/authorization.md:block 62 (header) +# P +#: ./docs/8.x/authorization.md:238 +#: ./docs/9.x/authorization.md:266 +#: ./docs/10.x/authorization.md:261 +#: ./docs/11.x/authorization.md:262 +#: ./docs/master/authorization.md:261 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authorization.md:239 +#: ./docs/9.x/authorization.md:267 +#: ./docs/10.x/authorization.md:262 +#: ./docs/11.x/authorization.md:263 +#: ./docs/master/authorization.md:262 msgid "Creating Policies" -msgstr "建立 Policy" +msgstr "" -#: docs/10.x/authorization.md:block 64 (header) +# P +#: ./docs/8.x/authorization.md:241 +#: ./docs/9.x/authorization.md:269 +#: ./docs/10.x/authorization.md:264 +#: ./docs/11.x/authorization.md:265 +#: ./docs/master/authorization.md:264 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:242 +#: ./docs/9.x/authorization.md:270 +#: ./docs/10.x/authorization.md:265 +#: ./docs/11.x/authorization.md:266 +#: ./docs/master/authorization.md:265 msgid "Generating Policies" -msgstr "產生 Policy" +msgstr "" -#: docs/10.x/authorization.md:block 65 (paragraph) -msgid "Policies are classes that organize authorization logic around a particular model or resource. For example, if your application is a blog, you may have an `App\\Models\\Post` model and a corresponding `App\\Policies\\PostPolicy` to authorize user actions such as creating or updating posts." -msgstr "Policy 是用來依照特定 Model 或資源阻止授權邏輯的類別。舉例來說,若你的專案是個部落格,則可能會有 `App\\Models\\Post` Model 以及對應的 `App\\Policies\\PostPolicy` 來授權使用者進行建立或更新貼文之類的動作。" +# P +#: ./docs/11.x/authorization.md:244 +msgid "Values returned by `after` closures will not override the result of the authorization check unless the gate or policy returned `null`." +msgstr "" -#: docs/10.x/authorization.md:block 66 (paragraph) +# P +#: ./docs/8.x/authorization.md:244 +#: ./docs/9.x/authorization.md:272 +msgid "Policies are classes that organize authorization logic around a particular model or resource. For example, if your application is a blog, you may have a `App\\Models\\Post` model and a corresponding `App\\Policies\\PostPolicy` to authorize user actions such as creating or updating posts." +msgstr "" + +# P +#: ./docs/8.x/authorization.md:246 +#: ./docs/9.x/authorization.md:274 +#: ./docs/10.x/authorization.md:269 +#: ./docs/11.x/authorization.md:270 +#: ./docs/master/authorization.md:269 msgid "You may generate a policy using the `make:policy` Artisan command. The generated policy will be placed in the `app/Policies` directory. If this directory does not exist in your application, Laravel will create it for you:" -msgstr "可以通過 `make:policy` Artisan 指令來產生 Policy。產生的 Policy 會被放在 `app/Policies` 目錄內。若專案中沒有該目錄中,則 Laravel 會自動建立:" +msgstr "" + +# P +#: ./docs/10.x/authorization.md:248 +#: ./docs/11.x/authorization.md:249 +#: ./docs/master/authorization.md:248 +msgid "Occasionally, you may wish to determine if the currently authenticated user is authorized to perform a given action without writing a dedicated gate that corresponds to the action. Laravel allows you to perform these types of \"inline\" authorization checks via the `Gate::allowIf` and `Gate::denyIf` methods. Inline authorization does not execute any defined [\"before\" or \"after\" authorization hooks](#intercepting-gate-checks):" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/authorization.md:248 +#: ./docs/9.x/authorization.md:276 +#: ./docs/10.x/authorization.md:271 +#: ./docs/11.x/authorization.md:272 +#: ./docs/master/authorization.md:271 +msgid "php artisan make:policy PostPolicy" +msgstr "" -#: docs/10.x/authorization.md:block 67 (code) -msgid "php artisan make:policy PostPolicy\n" -msgstr "php artisan make:policy PostPolicy\n" +# CODE: php +#: ./docs/10.x/authorization.md:250 +#: ./docs/11.x/authorization.md:251 +#: ./docs/master/authorization.md:250 +msgid "use App\\Models\\User;\n" +"use Illuminate\\Support\\Facades\\Gate;\n\n" +"Gate::allowIf(fn (User $user) => $user->isAdministrator());\n\n" +"Gate::denyIf(fn (User $user) => $user->banned());" +msgstr "" -#: docs/10.x/authorization.md:block 68 (paragraph) +# P +#: ./docs/8.x/authorization.md:250 +#: ./docs/9.x/authorization.md:280 +#: ./docs/10.x/authorization.md:275 +#: ./docs/11.x/authorization.md:276 +#: ./docs/master/authorization.md:275 msgid "The `make:policy` command will generate an empty policy class. If you would like to generate a class with example policy methods related to viewing, creating, updating, and deleting the resource, you may provide a `--model` option when executing the command:" -msgstr "`make:policy` 指令會產生一個空的 Policy 類別。若想產生一個與檢視 (View)、建立 (Create)、更新 (Update)、刪除 (Delete) 資源有關的範例 方法的 Policy 類別,可以在執行指令時提供 `--model` 選項:" +msgstr "" -#: docs/10.x/authorization.md:block 69 (code) -msgid "php artisan make:policy PostPolicy --model=Post\n" -msgstr "php artisan make:policy PostPolicy --model=Post\n" +# CODE +# CODE: shell +#: ./docs/8.x/authorization.md:252 +#: ./docs/9.x/authorization.md:282 +#: ./docs/10.x/authorization.md:277 +#: ./docs/11.x/authorization.md:278 +#: ./docs/master/authorization.md:277 +msgid "php artisan make:policy PostPolicy --model=Post" +msgstr "" -#: docs/10.x/authorization.md:block 71 (header) +# P +#: ./docs/8.x/authorization.md:254 +#: ./docs/9.x/authorization.md:286 +#: ./docs/10.x/authorization.md:281 +#: ./docs/11.x/authorization.md:282 +#: ./docs/master/authorization.md:281 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:255 +#: ./docs/9.x/authorization.md:287 +#: ./docs/10.x/authorization.md:282 +#: ./docs/11.x/authorization.md:283 +#: ./docs/master/authorization.md:282 msgid "Registering Policies" -msgstr "註冊 Policy" +msgstr "" + +# CODE: php +#: ./docs/9.x/authorization.md:256 +msgid "use Illuminate\\Support\\Facades\\Gate;\n\n" +"Gate::allowIf(fn ($user) => $user->isAdministrator());\n\n" +"Gate::denyIf(fn ($user) => $user->banned());" +msgstr "" -#: docs/10.x/authorization.md:block 72 (paragraph) +# P +#: ./docs/8.x/authorization.md:257 +#: ./docs/9.x/authorization.md:289 +#: ./docs/10.x/authorization.md:284 msgid "Once the policy class has been created, it needs to be registered. Registering policies is how we can inform Laravel which policy to use when authorizing actions against a given model type." -msgstr "建立好 Policy 類別後,需要註冊 Policy。註冊 Policy 就能告訴 Laravel:在進行授權動作時,遇到特定 Model 時要使用哪個對應 Policy。" +msgstr "" -#: docs/10.x/authorization.md:block 73 (paragraph) +# P +#: ./docs/8.x/authorization.md:259 +#: ./docs/9.x/authorization.md:291 +#: ./docs/10.x/authorization.md:286 msgid "The `App\\Providers\\AuthServiceProvider` included with fresh Laravel applications contains a `policies` property which maps your Eloquent models to their corresponding policies. Registering a policy will instruct Laravel which policy to utilize when authorizing actions against a given Eloquent model:" -msgstr "在新安裝的 Laravel 專案中的 `App\\Providers\\AuthServiceProvider` 內,有一個 `policies` 屬性。該屬性會將 Eloquent Model 映射到其對應的 Policy。通過註冊 Policy,就可以告訴 Laravel 在權限檢查時遇到的 Eloquent Model 要使用哪個 Policy:" +msgstr "" -#: docs/10.x/authorization.md:block 74 (code) +# CODE +#: ./docs/8.x/authorization.md:261 +#: ./docs/9.x/authorization.md:293 msgid "registerPolicies();\n\n" +" //\n" " }\n" -"}\n" -msgstr "" +#~ msgstr "" + +# H4 +#: ./docs/11.x/authorization.md:286 +#: ./docs/master/authorization.md:285 +msgid "Policy Discovery" +msgstr "" + +# CODE +#: ./docs/10.x/authorization.md:288 +msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authorization.md:295 +#: ./docs/9.x/authorization.md:327 +#: ./docs/10.x/authorization.md:318 msgid "Policy Auto-Discovery" -msgstr "Policy Auto-Discovery" +msgstr "" -#: docs/10.x/authorization.md:block 77 (paragraph) +# P +#: ./docs/8.x/authorization.md:297 +#: ./docs/9.x/authorization.md:329 +#: ./docs/10.x/authorization.md:320 msgid "Instead of manually registering model policies, Laravel can automatically discover policies as long as the model and policy follow standard Laravel naming conventions. Specifically, the policies must be in a `Policies` directory at or above the directory that contains your models. So, for example, the models may be placed in the `app/Models` directory while the policies may be placed in the `app/Policies` directory. In this situation, Laravel will check for policies in `app/Models/Policies` then `app/Policies`. In addition, the policy name must match the model name and have a `Policy` suffix. So, a `User` model would correspond to a `UserPolicy` policy class." -msgstr "除了手動註冊 Model Policy,只要 Model 與 Policy 都遵守 Laravel 的命名常規,Laravel 就能自動找到 Policy。講得更仔細一點,各個 Policy 應放置與 Model 目錄下或 Model 目錄上層的 `Policies` 目錄內。因此,舉例來說,Model 可能被放在 `app/Models` 目錄內,而模型則可能被放在 `app/Policies` 目錄內。此時,Laravel 會先在 `app/Models/Policies` 內檢查 Policy,然後才到 `app/Policies` 內尋找。另外,Policy 名稱也必須與 Model 名稱相同,然後在後方加上 `Policy` 後綴。如此一來,`User` Model 對應的 Policy 類別就是 `UserPolicy`。" +msgstr "" -#: docs/10.x/authorization.md:block 78 (paragraph) +# P +#: ./docs/11.x/authorization.md:298 +#: ./docs/master/authorization.md:297 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/11.x/authorization.md:299 +#: ./docs/master/authorization.md:298 +msgid "Manually Registering Policies" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:299 +#: ./docs/9.x/authorization.md:331 +#: ./docs/10.x/authorization.md:322 msgid "If you would like to define your own policy discovery logic, you may register a custom policy discovery callback using the `Gate::guessPolicyNamesUsing` method. Typically, this method should be called from the `boot` method of your application's `AuthServiceProvider`:" -msgstr "若讀者想定義自己的 Policy Discovery 邏輯,可以通過 `Gate::guessPolicyNamesUsing` 方法來註冊自訂 Policy Discovery 閉包。通常來說,這個方法應該在專案的 `AuthServiceProvider` 內的 `boot` 方法內呼叫:" +msgstr "" -#: docs/10.x/authorization.md:block 79 (code) +# P +#: ./docs/11.x/authorization.md:301 +#: ./docs/master/authorization.md:300 +msgid "Using the `Gate` facade, you may manually register policies and their corresponding models within the `boot` method of your application's `AppServiceProvider`:" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:301 +#: ./docs/9.x/authorization.md:333 msgid "use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::guessPolicyNamesUsing(function (string $modelClass) {\n" +"Gate::guessPolicyNamesUsing(function ($modelClass) {\n" " // Return the name of the policy class for the given model...\n" -"});\n" -msgstr "use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::guessPolicyNamesUsing(function (string $modelClass) {\n" -" // 為給定 Model 回傳 Policy 類別的名稱...\n" -"});\n" +"});" +msgstr "" + +# CODE +#: ./docs/11.x/authorization.md:303 +#: ./docs/master/authorization.md:302 +msgid "use App\\Models\\Order;\n" +"use App\\Policies\\OrderPolicy;\n" +"use Illuminate\\Support\\Facades\\Gate;\n\n" +"/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Gate::policy(Order::class, OrderPolicy::class);\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 80 (quote) -msgid "**Warning** Any policies that are explicitly mapped in your `AuthServiceProvider` will take precedence over any potentially auto-discovered policies." -msgstr "**Warning** 所有在 `AuthServiceProvider` 中顯式映射之 Policy 的優先級都會比 Auto-Discover 的 Policy 高。" +# P +#: ./docs/8.x/authorization.md:307 +#: ./docs/9.x/authorization.md:340 +#: ./docs/10.x/authorization.md:331 +msgid "Any policies that are explicitly mapped in your `AuthServiceProvider` will take precedence over any potentially auto-discovered policies." +msgstr "" -#: docs/10.x/authorization.md:block 82 (header) +# P +#: ./docs/8.x/authorization.md:309 +#: ./docs/9.x/authorization.md:342 +#: ./docs/10.x/authorization.md:333 +#: ./docs/11.x/authorization.md:315 +#: ./docs/master/authorization.md:314 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authorization.md:310 +#: ./docs/9.x/authorization.md:343 +#: ./docs/10.x/authorization.md:334 +#: ./docs/11.x/authorization.md:316 +#: ./docs/master/authorization.md:315 msgid "Writing Policies" -msgstr "撰寫 Policy" +msgstr "" -#: docs/10.x/authorization.md:block 84 (header) +# P +#: ./docs/8.x/authorization.md:312 +#: ./docs/9.x/authorization.md:345 +#: ./docs/10.x/authorization.md:336 +#: ./docs/11.x/authorization.md:318 +#: ./docs/master/authorization.md:317 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:313 +#: ./docs/9.x/authorization.md:346 +#: ./docs/10.x/authorization.md:337 +#: ./docs/11.x/authorization.md:319 +#: ./docs/master/authorization.md:318 msgid "Policy Methods" -msgstr "Policy 方法" +msgstr "" -#: docs/10.x/authorization.md:block 85 (paragraph) +# P +#: ./docs/8.x/authorization.md:315 +#: ./docs/9.x/authorization.md:348 +#: ./docs/10.x/authorization.md:339 +#: ./docs/11.x/authorization.md:321 +#: ./docs/master/authorization.md:320 msgid "Once the policy class has been registered, you may add methods for each action it authorizes. For example, let's define an `update` method on our `PostPolicy` which determines if a given `App\\Models\\User` can update a given `App\\Models\\Post` instance." -msgstr "註冊好 Policy 類別後,可以為每個授權的動作加上方法。舉例來說,我們來在 `PostPolicy` 中定義一個 `update` 方法,用來判斷給定的 `App\\Models\\User` 可否更新給定的 `App\\Models\\Post` 實體。" +msgstr "" -#: docs/10.x/authorization.md:block 86 (paragraph) +# P +#: ./docs/8.x/authorization.md:317 +#: ./docs/9.x/authorization.md:350 +#: ./docs/10.x/authorization.md:341 +#: ./docs/11.x/authorization.md:323 +#: ./docs/master/authorization.md:322 msgid "The `update` method will receive a `User` and a `Post` instance as its arguments, and should return `true` or `false` indicating whether the user is authorized to update the given `Post`. So, in this example, we will verify that the user's `id` matches the `user_id` on the post:" -msgstr "`update` 方法會在其引數內收到 `User` 與 `Post` 實體,並且應回傳 `true` 或 `false` 來判斷該使用者是否有權限更新給定的 `Post`。因此,在這個例子中,我們會認證使用者的 `id` 是否與貼文的 `user_id` 相符:" +msgstr "" -#: docs/10.x/authorization.md:block 87 (code) +# CODE +#: ./docs/8.x/authorization.md:319 +#: ./docs/9.x/authorization.md:352 msgid "id === $post->user_id;\n" " }\n" -"}\n" -msgstr "id === $post->user_id;\n" " }\n" -"}\n" - -#: docs/10.x/authorization.md:block 88 (paragraph) -msgid "You may continue to define additional methods on the policy as needed for the various actions it authorizes. For example, you might define `view` or `delete` methods to authorize various `Post` related actions, but remember you are free to give your policy methods any name you like." -msgstr "我們可以繼續在 Policy 內為各種所需的權限檢查定義更多額外方法。舉例來說,我們可以定義 `view` 或 `delete` 方法來對各種與 `Post` 有關的動作進行權限檢查。但不要忘了,你可以隨意為 Policy 的方法命名。" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 89 (paragraph) +# P +#: ./docs/8.x/authorization.md:343 +#: ./docs/9.x/authorization.md:376 +#: ./docs/10.x/authorization.md:363 +#: ./docs/11.x/authorization.md:345 +#: ./docs/master/authorization.md:344 msgid "If you used the `--model` option when generating your policy via the Artisan console, it will already contain methods for the `viewAny`, `view`, `create`, `update`, `delete`, `restore`, and `forceDelete` actions." -msgstr "通過 Artisan 主控台產生 Policy 時若有使用 `--model` 選項,則 Policy 就已經包含了 `viewAny`, `view`, `create`, `update`, `delete`, `restore` 與 `forceDelete` 動作的方法。" +msgstr "" -#: docs/10.x/authorization.md:block 90 (quote) -msgid "**Note** All policies are resolved via the Laravel [service container](/docs/{{version}}/container), allowing you to type-hint any needed dependencies in the policy's constructor to have them automatically injected." -msgstr "**Note** 所有的 Policy 都經由 Laravel 的 [Service Container](/docs/{{version}}/container) 進行解析,這樣一來,可以在 Policy 的建構函式 (Constructor) 內對任何所需的相依項進行型別提示,這些相依項會被自動插入到 Class 內。" +# P +#: ./docs/8.x/authorization.md:345 +#: ./docs/9.x/authorization.md:379 +#: ./docs/10.x/authorization.md:366 +#: ./docs/11.x/authorization.md:348 +#: ./docs/master/authorization.md:347 +msgid "All policies are resolved via the Laravel [service container](/docs/{{version}}/container), allowing you to type-hint any needed dependencies in the policy's constructor to have them automatically injected." +msgstr "" -#: docs/10.x/authorization.md:block 92 (header) +# P +#: ./docs/8.x/authorization.md:347 +#: ./docs/9.x/authorization.md:381 +#: ./docs/10.x/authorization.md:368 +#: ./docs/11.x/authorization.md:350 +#: ./docs/master/authorization.md:349 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:348 +#: ./docs/9.x/authorization.md:382 +#: ./docs/10.x/authorization.md:369 +#: ./docs/11.x/authorization.md:351 +#: ./docs/master/authorization.md:350 msgid "Policy Responses" -msgstr "Policy 回應" +msgstr "" -#: docs/10.x/authorization.md:block 93 (paragraph) +# P +#: ./docs/8.x/authorization.md:350 +#: ./docs/9.x/authorization.md:384 +#: ./docs/10.x/authorization.md:371 +#: ./docs/11.x/authorization.md:353 +#: ./docs/master/authorization.md:352 msgid "So far, we have only examined policy methods that return simple boolean values. However, sometimes you may wish to return a more detailed response, including an error message. To do so, you may return an `Illuminate\\Auth\\Access\\Response` instance from your policy method:" -msgstr "到目前為止,我們只看過了回傳簡單布林值的 Policy 方法。但,有時候我們可能會想回傳一些更具體的回覆,並在其中包含錯誤訊息。為此,可以在 Policy 方法內回傳 `Illuminate\\Auth\\Access\\Response`:" +msgstr "" -#: docs/10.x/authorization.md:block 94 (code) +# CODE +#: ./docs/8.x/authorization.md:352 +#: ./docs/9.x/authorization.md:386 msgid "use App\\Models\\Post;\n" "use App\\Models\\User;\n" "use Illuminate\\Auth\\Access\\Response;\n\n" "/**\n" " * Determine if the given post can be updated by the user.\n" +" *\n" +" * @param \\App\\Models\\User $user\n" +" * @param \\App\\Models\\Post $post\n" +" * @return \\Illuminate\\Auth\\Access\\Response\n" " */\n" -"public function update(User $user, Post $post): Response\n" -"{\n" -" return $user->id === $post->user_id\n" -" ? Response::allow()\n" -" : Response::deny('You do not own this post.');\n" -"}\n" -msgstr "use App\\Models\\Post;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Auth\\Access\\Response;\n\n" -"/**\n" -" * Determine if the given post can be updated by the user.\n" -" */\n" -"public function update(User $user, Post $post): Response\n" +"public function update(User $user, Post $post)\n" "{\n" " return $user->id === $post->user_id\n" " ? Response::allow()\n" " : Response::deny('You do not own this post.');\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 95 (paragraph) +# P +#: ./docs/8.x/authorization.md:370 +#: ./docs/9.x/authorization.md:404 +#: ./docs/10.x/authorization.md:387 +#: ./docs/11.x/authorization.md:369 +#: ./docs/master/authorization.md:368 msgid "When returning an authorization response from your policy, the `Gate::allows` method will still return a simple boolean value; however, you may use the `Gate::inspect` method to get the full authorization response returned by the gate:" -msgstr "當從 Policy 內回傳授權回應時,`Gate::allows` 方法依然會回傳簡單的布林值。不過,可以使用 `Gate::inspect` 方法來取得 Gate 回傳的完整授權回應:" +msgstr "" -#: docs/10.x/authorization.md:block 96 (code) +# CODE +#: ./docs/8.x/authorization.md:372 +#: ./docs/9.x/authorization.md:406 +#: ./docs/10.x/authorization.md:389 +#: ./docs/11.x/authorization.md:371 +#: ./docs/master/authorization.md:370 msgid "use Illuminate\\Support\\Facades\\Gate;\n\n" "$response = Gate::inspect('update', $post);\n\n" "if ($response->allowed()) {\n" " // The action is authorized...\n" "} else {\n" " echo $response->message();\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Gate;\n\n" -"$response = Gate::inspect('update', $post);\n\n" -"if ($response->allowed()) {\n" -" // 已授權可進行該動作...\n" -"} else {\n" -" echo $response->message();\n" -"}\n" - -#: docs/10.x/authorization.md:block 98 (code) -msgid "Gate::authorize('update', $post);\n\n" -"// The action is authorized...\n" -msgstr "Gate::authorize('update', $post);\n\n" -"// The action is authorized...\n" - -#: docs/10.x/authorization.md:block 101 (paragraph) -msgid "When an action is denied via a policy method, a `403` HTTP response is returned; however, it can sometimes be useful to return an alternative HTTP status code. You may customize the HTTP status code returned for a failed authorization check using the `denyWithStatus` static constructor on the `Illuminate\\Auth\\Access\\Response` class:" -msgstr "當 Policy 方法拒絕某個動作時,會回傳 `403` HTTP Response。不過,在某些情況下,若能回傳其他的 HTTP 狀態碼更好。我們可以使用 `Illuminate\\Auth\\Access\\Response` 類別的 `denyWithStatus` 靜態建構函式來自訂在授權檢查失敗的時候要回傳的 HTTP 狀態碼:" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 102 (code) +# CODE +#: ./docs/10.x/authorization.md:373 +#: ./docs/11.x/authorization.md:355 +#: ./docs/master/authorization.md:354 msgid "use App\\Models\\Post;\n" "use App\\Models\\User;\n" "use Illuminate\\Auth\\Access\\Response;\n\n" @@ -753,9 +1612,129 @@ msgid "use App\\Models\\Post;\n" "{\n" " return $user->id === $post->user_id\n" " ? Response::allow()\n" -" : Response::denyWithStatus(404);\n" -"}\n" -msgstr "use App\\Models\\Post;\n" +" : Response::deny('You do not own this post.');\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:384 +#: ./docs/9.x/authorization.md:418 +#: ./docs/10.x/authorization.md:401 +#: ./docs/11.x/authorization.md:383 +#: ./docs/master/authorization.md:382 +msgid "Gate::authorize('update', $post);\n\n" +"// The action is authorized..." +msgstr "" + +# P +#: ./docs/11.x/authorization.md:387 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/authorization.md:388 +#: ./docs/9.x/authorization.md:465 +#: ./docs/10.x/authorization.md:440 +#: ./docs/11.x/authorization.md:422 +#: ./docs/master/authorization.md:421 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:389 +#: ./docs/9.x/authorization.md:466 +#: ./docs/10.x/authorization.md:441 +#: ./docs/11.x/authorization.md:423 +#: ./docs/master/authorization.md:422 +msgid "Methods Without Models" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:391 +#: ./docs/9.x/authorization.md:468 +#: ./docs/10.x/authorization.md:443 +#: ./docs/11.x/authorization.md:425 +#: ./docs/master/authorization.md:424 +msgid "Some policy methods only receive an instance of the currently authenticated user. This situation is most common when authorizing `create` actions. For example, if you are creating a blog, you may wish to determine if a user is authorized to create any posts at all. In these situations, your policy method should only expect to receive a user instance:" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:393 +#: ./docs/9.x/authorization.md:470 +msgid "/**\n" +" * Determine if the given user can create posts.\n" +" *\n" +" * @param \\App\\Models\\User $user\n" +" * @return bool\n" +" */\n" +"public function create(User $user)\n" +"{\n" +" return $user->role == 'writer';\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:404 +#: ./docs/9.x/authorization.md:481 +#: ./docs/10.x/authorization.md:453 +#: ./docs/11.x/authorization.md:435 +#: ./docs/master/authorization.md:434 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:405 +#: ./docs/9.x/authorization.md:482 +#: ./docs/10.x/authorization.md:454 +#: ./docs/11.x/authorization.md:436 +#: ./docs/master/authorization.md:435 +msgid "Guest Users" +msgstr "" + +# H4 +#: ./docs/10.x/authorization.md:406 +#: ./docs/11.x/authorization.md:388 +#: ./docs/master/authorization.md:387 +msgid "Customizing the HTTP Response Status" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:407 +#: ./docs/9.x/authorization.md:484 +#: ./docs/10.x/authorization.md:456 +#: ./docs/11.x/authorization.md:438 +#: ./docs/master/authorization.md:437 +msgid "By default, all gates and policies automatically return `false` if the incoming HTTP request was not initiated by an authenticated user. However, you may allow these authorization checks to pass through to your gates and policies by declaring an \"optional\" type-hint or supplying a `null` default value for the user argument definition:" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:409 +#: ./docs/9.x/authorization.md:486 +msgid "id === $post->user_id;\n" +" }\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/authorization.md:410 +#: ./docs/11.x/authorization.md:392 +#: ./docs/master/authorization.md:391 +msgid "use App\\Models\\Post;\n" "use App\\Models\\User;\n" "use Illuminate\\Auth\\Access\\Response;\n\n" "/**\n" @@ -766,9 +1745,28 @@ msgstr "use App\\Models\\Post;\n" " return $user->id === $post->user_id\n" " ? Response::allow()\n" " : Response::denyWithStatus(404);\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/authorization.md:422 +#: ./docs/10.x/authorization.md:405 +#: ./docs/master/authorization.md:386 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/authorization.md:425 +#: ./docs/10.x/authorization.md:408 +#: ./docs/11.x/authorization.md:390 +#: ./docs/master/authorization.md:389 +msgid "When an action is denied via a policy method, a `403` HTTP response is returned; however, it can sometimes be useful to return an alternative HTTP status code. You may customize the HTTP status code returned for a failed authorization check using the `denyWithStatus` static constructor on the `Illuminate\\Auth\\Access\\Response` class:" +msgstr "" -#: docs/10.x/authorization.md:block 104 (code) +# CODE +#: ./docs/10.x/authorization.md:426 +#: ./docs/11.x/authorization.md:408 +#: ./docs/master/authorization.md:407 msgid "use App\\Models\\Post;\n" "use App\\Models\\User;\n" "use Illuminate\\Auth\\Access\\Response;\n\n" @@ -780,53 +1778,148 @@ msgid "use App\\Models\\Post;\n" " return $user->id === $post->user_id\n" " ? Response::allow()\n" " : Response::denyAsNotFound();\n" -"}\n" -msgstr "use App\\Models\\Post;\n" +"}" +msgstr "" + +# CODE +#: ./docs/9.x/authorization.md:427 +msgid "use App\\Models\\Post;\n" "use App\\Models\\User;\n" "use Illuminate\\Auth\\Access\\Response;\n\n" "/**\n" " * Determine if the given post can be updated by the user.\n" +" *\n" +" * @param \\App\\Models\\User $user\n" +" * @param \\App\\Models\\Post $post\n" +" * @return \\Illuminate\\Auth\\Access\\Response\n" " */\n" -"public function update(User $user, Post $post): Response\n" +"public function update(User $user, Post $post)\n" "{\n" " return $user->id === $post->user_id\n" " ? Response::allow()\n" -" : Response::denyAsNotFound();\n" -"}\n" +" : Response::denyWithStatus(404);\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 106 (header) -msgid "Methods Without Models" -msgstr "沒有 Model 的方法" +# P +#: ./docs/8.x/authorization.md:431 +#: ./docs/9.x/authorization.md:508 +#: ./docs/10.x/authorization.md:476 +#: ./docs/11.x/authorization.md:458 +#: ./docs/master/authorization.md:457 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:432 +#: ./docs/9.x/authorization.md:509 +#: ./docs/10.x/authorization.md:477 +#: ./docs/11.x/authorization.md:459 +#: ./docs/master/authorization.md:458 +msgid "Policy Filters" +msgstr "" -#: docs/10.x/authorization.md:block 107 (paragraph) -msgid "Some policy methods only receive an instance of the currently authenticated user. This situation is most common when authorizing `create` actions. For example, if you are creating a blog, you may wish to determine if a user is authorized to create any posts at all. In these situations, your policy method should only expect to receive a user instance:" -msgstr "有些 Policy 方法只會收到目前登入使用者的實體。最常見的情況就是在授權 `create` 動作時。舉例來說,若正在建立部落格,則可能會想判斷某個使用者是否有權限建立任何貼文。在這種情況想,Policy 方法應該只會收到使用者實體:" +# P +#: ./docs/8.x/authorization.md:434 +#: ./docs/9.x/authorization.md:511 +#: ./docs/10.x/authorization.md:479 +#: ./docs/11.x/authorization.md:461 +#: ./docs/master/authorization.md:460 +msgid "For certain users, you may wish to authorize all actions within a given policy. To accomplish this, define a `before` method on the policy. The `before` method will be executed before any other methods on the policy, giving you an opportunity to authorize the action before the intended policy method is actually called. This feature is most commonly used for authorizing application administrators to perform any action:" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:436 +#: ./docs/9.x/authorization.md:513 +msgid "use App\\Models\\User;\n\n" +"/**\n" +" * Perform pre-authorization checks.\n" +" *\n" +" * @param \\App\\Models\\User $user\n" +" * @param string $ability\n" +" * @return void|bool\n" +" */\n" +"public function before(User $user, $ability)\n" +"{\n" +" if ($user->isAdministrator()) {\n" +" return true;\n" +" }\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 108 (code) +# CODE +#: ./docs/10.x/authorization.md:445 +#: ./docs/11.x/authorization.md:427 +#: ./docs/master/authorization.md:426 msgid "/**\n" " * Determine if the given user can create posts.\n" " */\n" "public function create(User $user): bool\n" "{\n" " return $user->role == 'writer';\n" -"}\n" -msgstr "/**\n" -" * Determine if the given user can create posts.\n" +"}" +msgstr "" + +# CODE +#: ./docs/9.x/authorization.md:447 +msgid "use App\\Models\\Post;\n" +"use App\\Models\\User;\n" +"use Illuminate\\Auth\\Access\\Response;\n\n" +"/**\n" +" * Determine if the given post can be updated by the user.\n" +" *\n" +" * @param \\App\\Models\\User $user\n" +" * @param \\App\\Models\\Post $post\n" +" * @return \\Illuminate\\Auth\\Access\\Response\n" " */\n" -"public function create(User $user): bool\n" +"public function update(User $user, Post $post)\n" "{\n" -" return $user->role == 'writer';\n" -"}\n" +" return $user->id === $post->user_id\n" +" ? Response::allow()\n" +" : Response::denyAsNotFound();\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 110 (header) -msgid "Guest Users" -msgstr "訪客使用者" +# P +#: ./docs/8.x/authorization.md:452 +#: ./docs/9.x/authorization.md:529 +#: ./docs/10.x/authorization.md:495 +#: ./docs/11.x/authorization.md:477 +#: ./docs/master/authorization.md:476 +msgid "If you would like to deny all authorization checks for a particular type of user then you may return `false` from the `before` method. If `null` is returned, the authorization check will fall through to the policy method." +msgstr "" -#: docs/10.x/authorization.md:block 111 (paragraph) -msgid "By default, all gates and policies automatically return `false` if the incoming HTTP request was not initiated by an authenticated user. However, you may allow these authorization checks to pass through to your gates and policies by declaring an \"optional\" type-hint or supplying a `null` default value for the user argument definition:" -msgstr "預設情況下,當連入 HTTP 請求並不是由已登入使用者發起的時候,所有的 Gate 與 Policy 都會回傳 `false`。不過,我們可以通過在使用者的引數定義上定義「可選」的型別提示,或是提供一個 `null` 預設值,來讓這些權限檢查可以進到 Gate 與 Policy 中:" +# P +#: ./docs/8.x/authorization.md:454 +#: ./docs/9.x/authorization.md:532 +#: ./docs/10.x/authorization.md:498 +#: ./docs/11.x/authorization.md:480 +#: ./docs/master/authorization.md:479 +msgid "The `before` method of a policy class will not be called if the class doesn't contain a method with a name matching the name of the ability being checked." +msgstr "" + +# P +#: ./docs/8.x/authorization.md:456 +#: ./docs/9.x/authorization.md:534 +#: ./docs/10.x/authorization.md:500 +#: ./docs/11.x/authorization.md:482 +#: ./docs/master/authorization.md:481 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/authorization.md:457 +#: ./docs/9.x/authorization.md:535 +#: ./docs/10.x/authorization.md:501 +#: ./docs/11.x/authorization.md:483 +#: ./docs/master/authorization.md:482 +msgid "Authorizing Actions Using Policies" +msgstr "" -#: docs/10.x/authorization.md:block 112 (code) +# CODE +#: ./docs/10.x/authorization.md:458 +#: ./docs/11.x/authorization.md:440 +#: ./docs/master/authorization.md:439 msgid "id === $post->user_id;\n" " }\n" -"}\n" -msgstr "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:460 +#: ./docs/9.x/authorization.md:538 +msgid "Via The User Model" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:462 +#: ./docs/9.x/authorization.md:540 +#: ./docs/10.x/authorization.md:506 +#: ./docs/11.x/authorization.md:488 +#: ./docs/master/authorization.md:487 +msgid "The `App\\Models\\User` model that is included with your Laravel application includes two helpful methods for authorizing actions: `can` and `cannot`. The `can` and `cannot` methods receive the name of the action you wish to authorize and the relevant model. For example, let's determine if a user is authorized to update a given `App\\Models\\Post` model. Typically, this will be done within a controller method:" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:464 +#: ./docs/9.x/authorization.md:542 +msgid "id === $post->user_id;\n" +" if ($request->user()->cannot('update', $post)) {\n" +" abort(403);\n" +" }\n\n" +" // Update the post...\n" " }\n" -"}\n" - -#: docs/10.x/authorization.md:block 114 (header) -msgid "Policy Filters" -msgstr "Policy 篩選器" - -#: docs/10.x/authorization.md:block 115 (paragraph) -msgid "For certain users, you may wish to authorize all actions within a given policy. To accomplish this, define a `before` method on the policy. The `before` method will be executed before any other methods on the policy, giving you an opportunity to authorize the action before the intended policy method is actually called. This feature is most commonly used for authorizing application administrators to perform any action:" -msgstr "我們可能會想讓特定使用者擁有某個 Policy 中擁有的所有權限。為此,可以在 Policy 內定義一個 `before` 方法。`before` 方法會在 Policy 內任何其他方法之前被執行,如此一來我們便有機會可以在預定的 Policy 方法被實際執行前對該行為進行授權。這個功能最常見的使用情況就是用來授權網站管理員來進行所有動作:" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 116 (code) +# CODE +#: ./docs/10.x/authorization.md:481 +#: ./docs/11.x/authorization.md:463 +#: ./docs/master/authorization.md:462 msgid "use App\\Models\\User;\n\n" "/**\n" " * Perform pre-authorization checks.\n" @@ -875,61 +2001,98 @@ msgid "use App\\Models\\User;\n\n" " return true;\n" " }\n\n" " return null;\n" -"}\n" -msgstr "use App\\Models\\User;\n\n" -"/**\n" -" * Perform pre-authorization checks.\n" -" */\n" -"public function before(User $user, string $ability): bool|null\n" -"{\n" -" if ($user->isAdministrator()) {\n" -" return true;\n" -" }\n\n" -" return null;\n" -"}\n" - -#: docs/10.x/authorization.md:block 117 (paragraph) -msgid "If you would like to deny all authorization checks for a particular type of user then you may return `false` from the `before` method. If `null` is returned, the authorization check will fall through to the policy method." -msgstr "若拒絕特定類型的使用者的所有授權,可以在 `before` 方法內回傳 `false`。若回傳 `null`,則權限檢查會繼續傳到 Policy 方法內。" - -#: docs/10.x/authorization.md:block 118 (quote) -msgid "**Warning** The `before` method of a policy class will not be called if the class doesn't contain a method with a name matching the name of the ability being checked." -msgstr "**Warning** 若 Policy 類別內不含要檢查權限名稱的方法,則 `before` 方法將不會被呼叫。" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 120 (header) -msgid "Authorizing Actions Using Policies" -msgstr "通過 Policy 來授權動作" +# P +#: ./docs/8.x/authorization.md:491 +#: ./docs/9.x/authorization.md:569 +#: ./docs/10.x/authorization.md:534 +#: ./docs/11.x/authorization.md:516 +#: ./docs/master/authorization.md:515 +msgid "If a [policy is registered](#registering-policies) for the given model, the `can` method will automatically call the appropriate policy and return the boolean result. If no policy is registered for the model, the `can` method will attempt to call the closure-based Gate matching the given action name." +msgstr "" -#: docs/10.x/authorization.md:block 122 (header) -msgid "Via The User Model" -msgstr "通過 User Model" +# P +#: ./docs/8.x/authorization.md:493 +#: ./docs/9.x/authorization.md:571 +#: ./docs/10.x/authorization.md:536 +#: ./docs/11.x/authorization.md:518 +#: ./docs/master/authorization.md:517 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authorization.md:494 +#: ./docs/8.x/authorization.md:559 +#: ./docs/8.x/authorization.md:645 +#: ./docs/8.x/authorization.md:705 +#: ./docs/9.x/authorization.md:572 +#: ./docs/9.x/authorization.md:637 +#: ./docs/9.x/authorization.md:724 +#: ./docs/9.x/authorization.md:784 +#: ./docs/10.x/authorization.md:537 +#: ./docs/10.x/authorization.md:601 +#: ./docs/10.x/authorization.md:689 +#: ./docs/10.x/authorization.md:749 +#: ./docs/11.x/authorization.md:519 +#: ./docs/11.x/authorization.md:584 +#: ./docs/11.x/authorization.md:629 +#: ./docs/11.x/authorization.md:689 +#: ./docs/master/authorization.md:518 +#: ./docs/master/authorization.md:583 +#: ./docs/master/authorization.md:628 +#: ./docs/master/authorization.md:688 +msgid "Actions That Don't Require Models" +msgstr "" -#: docs/10.x/authorization.md:block 123 (paragraph) -msgid "The `App\\Models\\User` model that is included with your Laravel application includes two helpful methods for authorizing actions: `can` and `cannot`. The `can` and `cannot` methods receive the name of the action you wish to authorize and the relevant model. For example, let's determine if a user is authorized to update a given `App\\Models\\Post` model. Typically, this will be done within a controller method:" -msgstr "Laravel 專案內建的 `App\\Models\\User` Model 中包含了兩個實用的方法,可以用來進行權限檢查:`can` 與 `cannot`。`can` 與 `cannot` 方法接收用要進行權限檢查的動作名稱,以及相關的 Model。舉例來說,讓我們來判斷某個使用者是否有權限更新給定的 `App\\Models\\Post` Model。一般來說,這個檢查會在 Controller 的方法內進行:" +# P +#: ./docs/8.x/authorization.md:496 +#: ./docs/9.x/authorization.md:574 +#: ./docs/10.x/authorization.md:539 +#: ./docs/11.x/authorization.md:521 +#: ./docs/master/authorization.md:520 +msgid "Remember, some actions may correspond to policy methods like `create` that do not require a model instance. In these situations, you may pass a class name to the `can` method. The class name will be used to determine which policy to use when authorizing the action:" +msgstr "" -#: docs/10.x/authorization.md:block 124 (code) +# CODE +#: ./docs/8.x/authorization.md:498 +#: ./docs/9.x/authorization.md:576 msgid "user()->cannot('update', $post)) {\n" +" if ($request->user()->cannot('create', Post::class)) {\n" " abort(403);\n" " }\n\n" -" // Update the post...\n\n" -" return redirect('/posts');\n" +" // Create the post...\n" " }\n" -"}\n" -msgstr "user()->cannot('update', $post)) {\n" " abort(403);\n" " }\n\n" -" // 更新貼文...\n\n" +" // Update the post...\n\n" " return redirect('/posts');\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 125 (paragraph) -msgid "If a [policy is registered](#registering-policies) for the given model, the `can` method will automatically call the appropriate policy and return the boolean result. If no policy is registered for the model, the `can` method will attempt to call the closure-based Gate matching the given action name." -msgstr "若已為給定的 Model [註冊好 Policy](#registering-policies),則 `can` 方法會自動呼叫適當的 Policy,並回傳布林結果值。若沒有為該 Model 註冊好的 Policy,則 `can` 方法會呼叫符合給定動作名稱的閉包 Gate。" +# P +#: ./docs/8.x/authorization.md:524 +#: ./docs/9.x/authorization.md:602 +#: ./docs/10.x/authorization.md:567 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:525 +#: ./docs/9.x/authorization.md:603 +#: ./docs/10.x/authorization.md:568 +msgid "Via Controller Helpers" +msgstr "" -#: docs/10.x/authorization.md:block 127 (header) -msgid "Actions That Don't Require Models" -msgstr "不需要 Model 的動作" +# P +#: ./docs/8.x/authorization.md:527 +#: ./docs/9.x/authorization.md:605 +#: ./docs/10.x/authorization.md:570 +msgid "In addition to helpful methods provided to the `App\\Models\\User` model, Laravel provides a helpful `authorize` method to any of your controllers which extend the `App\\Http\\Controllers\\Controller` base class." +msgstr "" -#: docs/10.x/authorization.md:block 128 (paragraph) -msgid "Remember, some actions may correspond to policy methods like `create` that do not require a model instance. In these situations, you may pass a class name to the `can` method. The class name will be used to determine which policy to use when authorizing the action:" -msgstr "請記得,某些對應到 Policy 方法的動作,如 `create`,並不要求 Model 實體。這種情況下,可以將類別名稱傳給 `can` 方法。類別名稱會用來判斷對動作進行權限檢查時要使用哪個 Policy:" +# P +#: ./docs/8.x/authorization.md:529 +#: ./docs/9.x/authorization.md:607 +#: ./docs/10.x/authorization.md:572 +#: ./docs/11.x/authorization.md:554 +#: ./docs/master/authorization.md:553 +msgid "Like the `can` method, this method accepts the name of the action you wish to authorize and the relevant model. If the action is not authorized, the `authorize` method will throw an `Illuminate\\Auth\\Access\\AuthorizationException` exception which the Laravel exception handler will automatically convert to an HTTP response with a 403 status code:" +msgstr "" -#: docs/10.x/authorization.md:block 129 (code) +# CODE +#: ./docs/8.x/authorization.md:531 +#: ./docs/9.x/authorization.md:609 msgid "user()->cannot('create', Post::class)) {\n" -" abort(403);\n" -" }\n\n" -" // Create the post...\n\n" -" return redirect('/posts');\n" +" $this->authorize('update', $post);\n\n" +" // The current user can update the blog post...\n" " }\n" -"}\n" -msgstr "user()->cannot('create', Post::class)) {\n" " abort(403);\n" " }\n\n" -" // 更新貼文...\n\n" +" // Create the post...\n\n" " return redirect('/posts');\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 131 (header) -msgid "Via Controller Helpers" -msgstr "通過 Controller 輔助函式" +# P +#: ./docs/11.x/authorization.md:549 +#: ./docs/master/authorization.md:548 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/authorization.md:block 132 (paragraph) -msgid "In addition to helpful methods provided to the `App\\Models\\User` model, Laravel provides a helpful `authorize` method to any of your controllers which extend the `App\\Http\\Controllers\\Controller` base class." -msgstr "除了 `App\\Models\\User` Model 上提供的實用方法外,Laravel 還為所有繼承了 `App\\Http\\Controller` 基礎類別的 Controller 提供了一個實用的 `authorize` 方法。" +# H3 +#: ./docs/11.x/authorization.md:550 +#: ./docs/master/authorization.md:549 +msgid "Via the `Gate` Facade" +msgstr "" -#: docs/10.x/authorization.md:block 133 (paragraph) -msgid "Like the `can` method, this method accepts the name of the action you wish to authorize and the relevant model. If the action is not authorized, the `authorize` method will throw an `Illuminate\\Auth\\Access\\AuthorizationException` exception which the Laravel exception handler will automatically convert to an HTTP response with a 403 status code:" -msgstr "與 `can` 方法類似,這個方法接收要進行權限檢查的動作名稱、以及相關的 Model。若該動作未被授權,則 `authorize` 方法會擲回 `Illuminate\\Auth\\Access\\AuthroizationException` 例外,Laravel 的例外處理常式會自動將該例外轉成有 403 狀態碼的 HTTP 回應:" +# P +#: ./docs/11.x/authorization.md:552 +#: ./docs/master/authorization.md:551 +msgid "In addition to helpful methods provided to the `App\\Models\\User` model, you can always authorize actions via the `Gate` facade's `authorize` method." +msgstr "" -#: docs/10.x/authorization.md:block 134 (code) +# CODE +#: ./docs/11.x/authorization.md:556 +#: ./docs/master/authorization.md:555 msgid "authorize('update', $post);\n\n" +" Gate::authorize('update', $post);\n\n" " // The current user can update the blog post...\n\n" " return redirect('/posts');\n" " }\n" -"}\n" -msgstr "" +#~ msgstr "" + +# P +#: ./docs/8.x/authorization.md:561 +#: ./docs/9.x/authorization.md:639 +#: ./docs/10.x/authorization.md:603 +#: ./docs/11.x/authorization.md:586 +#: ./docs/master/authorization.md:585 +msgid "As previously discussed, some policy methods like `create` do not require a model instance. In these situations, you should pass a class name to the `authorize` method. The class name will be used to determine which policy to use when authorizing the action:" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:563 +#: ./docs/9.x/authorization.md:641 +msgid "use App\\Models\\Post;\n" +"use Illuminate\\Http\\Request;\n\n" +"/**\n" +" * Create a new blog post.\n" +" *\n" +" * @param \\Illuminate\\Http\\Request $request\n" +" * @return \\Illuminate\\Http\\Response\n" +" *\n" +" * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n" +" */\n" +"public function create(Request $request)\n" +"{\n" +" $this->authorize('create', Post::class);\n\n" +" // The current user can create blog posts...\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/authorization.md:574 +msgid "authorize('update', $post);\n\n" -" // 目前使用者可更新此部落格貼文...\n\n" +" // The current user can update the blog post...\n\n" " return redirect('/posts');\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 137 (paragraph) -msgid "As previously discussed, some policy methods like `create` do not require a model instance. In these situations, you should pass a class name to the `authorize` method. The class name will be used to determine which policy to use when authorizing the action:" -msgstr "與前面討論過的一樣,某些 Policy 方法,如 `create`,並不要求 Model 實體。這種情況下,應將類別名稱傳給 `authorize` 方法。類別名稱會用來判斷對動作進行權限檢查時要使用哪個 Policy:" +# P +#: ./docs/8.x/authorization.md:581 +#: ./docs/9.x/authorization.md:659 +#: ./docs/10.x/authorization.md:623 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/authorization.md:582 +#: ./docs/9.x/authorization.md:660 +#: ./docs/10.x/authorization.md:624 +msgid "Authorizing Resource Controllers" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:584 +#: ./docs/9.x/authorization.md:662 +#: ./docs/10.x/authorization.md:626 +msgid "If you are utilizing [resource controllers](/docs/{{version}}/controllers#resource-controllers), you may make use of the `authorizeResource` method in your controller's constructor. This method will attach the appropriate `can` middleware definitions to the resource controller's methods." +msgstr "" + +# P +#: ./docs/8.x/authorization.md:586 +#: ./docs/9.x/authorization.md:664 +#: ./docs/10.x/authorization.md:628 +msgid "The `authorizeResource` method accepts the model's class name as its first argument, and the name of the route / request parameter that will contain the model's ID as its second argument. You should ensure your [resource controller](/docs/{{version}}/controllers#resource-controllers) is created using the `--model` flag so that it has the required method signatures and type hints:" +msgstr "" -#: docs/10.x/authorization.md:block 138 (code) +# CODE +#: ./docs/11.x/authorization.md:588 +#: ./docs/master/authorization.md:587 msgid "use App\\Models\\Post;\n" "use Illuminate\\Http\\RedirectResponse;\n" -"use Illuminate\\Http\\Request;\n\n" +"use Illuminate\\Http\\Request;\n" +"use Illuminate\\Support\\Facades\\Gate;\n\n" "/**\n" " * Create a new blog post.\n" " *\n" @@ -1073,11 +2345,37 @@ msgid "use App\\Models\\Post;\n" " */\n" "public function create(Request $request): RedirectResponse\n" "{\n" -" $this->authorize('create', Post::class);\n\n" +" Gate::authorize('create', Post::class);\n\n" " // The current user can create blog posts...\n\n" " return redirect('/posts');\n" -"}\n" -msgstr "use App\\Models\\Post;\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:588 +#: ./docs/9.x/authorization.md:666 +msgid "authorizeResource(Post::class, 'post');\n" +" }\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/authorization.md:605 +msgid "use App\\Models\\Post;\n" "use Illuminate\\Http\\RedirectResponse;\n" "use Illuminate\\Http\\Request;\n\n" "/**\n" @@ -1088,23 +2386,74 @@ msgstr "use App\\Models\\Post;\n" "public function create(Request $request): RedirectResponse\n" "{\n" " $this->authorize('create', Post::class);\n\n" -" // 目前使用者可建立部落格貼文...\n\n" +" // The current user can create blog posts...\n\n" " return redirect('/posts');\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 140 (header) -msgid "Authorizing Resource Controllers" -msgstr "授權 Resource Controller" +# P +#: ./docs/8.x/authorization.md:609 +#: ./docs/9.x/authorization.md:687 +#: ./docs/10.x/authorization.md:648 +msgid "The following controller methods will be mapped to their corresponding policy method. When requests are routed to the given controller method, the corresponding policy method will automatically be invoked before the controller method is executed:" +msgstr "" -#: docs/10.x/authorization.md:block 141 (paragraph) -msgid "If you are utilizing [resource controllers](/docs/{{version}}/controllers#resource-controllers), you may make use of the `authorizeResource` method in your controller's constructor. This method will attach the appropriate `can` middleware definitions to the resource controller's methods." -msgstr "若使用 [Resource Controller](/docs/{{version}}/controllers#resource-controllers),則可以在 Controller 建構函式中使用 `authorizeResource` 方法。這個方法會將適當的 `can` Middleware 定義附加到該 Resource Controller 的方法內。" +# P +#: ./docs/master/authorization.md:609 +msgid "Laravel includes a middleware that can authorize actions before the incoming request even reaches your routes or controllers. By default, the `Illuminate\\Auth\\Middleware\\Authorize` middleware may be attached to a route using the `can` [middleware alias](/docs/{{version}}/middleware#middleware-alias), which is automatically registered by Laravel. Let's explore an example of using the `can` middleware to authorize that a user can update a post:" +msgstr "" -#: docs/10.x/authorization.md:block 142 (paragraph) -msgid "The `authorizeResource` method accepts the model's class name as its first argument, and the name of the route / request parameter that will contain the model's ID as its second argument. You should ensure your [resource controller](/docs/{{version}}/controllers#resource-controllers) is created using the `--model` flag so that it has the required method signatures and type hints:" -msgstr "`authorizeResource` 方法接受 Model 類別名稱作為其第一個引數,而路由名稱或包含 Model ID 的請求參數將為第二個引數。請先確定 [Resource Controller](/docs/{{version}}/controllers#resource-controllers) 是使用 `--model` 旗標建立的,這樣該類別才有所需的方法簽章與型別提示:" +# P +#: ./docs/11.x/authorization.md:610 +msgid "Laravel includes a middleware that can authorize actions before the incoming request even reaches your routes or controllers. By default, the `Illuminate\\Auth\\Middleware\\Authorize` middleware may be attached to a route using the `can` [middleware alias](/docs/{{version}}/middleware#middleware-aliases), which is automatically registered by Laravel. Let's explore an example of using the `can` middleware to authorize that a user can update a post:" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:621 +#: ./docs/9.x/authorization.md:700 +#: ./docs/10.x/authorization.md:665 +msgid "You may use the `make:policy` command with the `--model` option to quickly generate a policy class for a given model: `php artisan make:policy PostPolicy --model=Post`." +msgstr "" + +# P +#: ./docs/8.x/authorization.md:623 +#: ./docs/9.x/authorization.md:702 +#: ./docs/10.x/authorization.md:667 +#: ./docs/11.x/authorization.md:607 +#: ./docs/master/authorization.md:606 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:624 +#: ./docs/9.x/authorization.md:703 +#: ./docs/10.x/authorization.md:668 +#: ./docs/11.x/authorization.md:608 +#: ./docs/master/authorization.md:607 +msgid "Via Middleware" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:626 +#: ./docs/9.x/authorization.md:705 +#: ./docs/10.x/authorization.md:670 +msgid "Laravel includes a middleware that can authorize actions before the incoming request even reaches your routes or controllers. By default, the `Illuminate\\Auth\\Middleware\\Authorize` middleware is assigned the `can` key in your `App\\Http\\Kernel` class. Let's explore an example of using the `can` middleware to authorize that a user can update a post:" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:628 +#: ./docs/9.x/authorization.md:707 +#: ./docs/10.x/authorization.md:672 +#: ./docs/11.x/authorization.md:612 +#: ./docs/master/authorization.md:611 +msgid "use App\\Models\\Post;\n\n" +"Route::put('/post/{post}', function (Post $post) {\n" +" // The current user may update the post...\n" +"})->middleware('can:update,post');" +msgstr "" -#: docs/10.x/authorization.md:block 143 (code) +# CODE +#: ./docs/10.x/authorization.md:630 msgid "authorizeResource(Post::class, 'post');\n" " }\n" -"}\n" -msgstr "authorizeResource(Post::class, 'post');\n" -" }\n" -"}\n" - -#: docs/10.x/authorization.md:block 144 (paragraph) -msgid "The following controller methods will be mapped to their corresponding policy method. When requests are routed to the given controller method, the corresponding policy method will automatically be invoked before the controller method is executed:" -msgstr "下列 Controller 方法會映射到其對應的 Policy 方法。當請求被路由到給定的 Controller 方法時,對應的 Policy 方法會在 Controller 方法執行前被自動叫用:" - -#: docs/10.x/authorization.md:block 146 (table) -msgid "Controller Method" -msgstr "Controller 方法" - -#: docs/10.x/authorization.md:block 146 (table) -msgid "Policy Method" -msgstr "Policy 方法" - -#: docs/10.x/authorization.md:block 146 (table) -msgid "index" -msgstr "index" - -#: docs/10.x/authorization.md:block 146 (table) -msgid "viewAny" -msgstr "viewAny" - -#: docs/10.x/authorization.md:block 146 (table) -msgid "show" -msgstr "show" - -#: docs/10.x/authorization.md:block 146 (table) -msgid "view" -msgstr "view" - -#: docs/10.x/authorization.md:block 146 (table) -msgid "create" -msgstr "create" - -#: docs/10.x/authorization.md:block 146 (table) -msgid "store" -msgstr "store" - -#: docs/10.x/authorization.md:block 146 (table) -msgid "edit" -msgstr "edit" - -#: docs/10.x/authorization.md:block 146 (table) -msgid "update" -msgstr "update" - -#: docs/10.x/authorization.md:block 146 (table) -msgid "destroy" -msgstr "destroy" - -#: docs/10.x/authorization.md:block 146 (table) -msgid "delete" -msgstr "delete" - -#: docs/10.x/authorization.md:block 148 (quote) -msgid "**Note** You may use the `make:policy` command with the `--model` option to quickly generate a policy class for a given model: `php artisan make:policy PostPolicy --model=Post`." -msgstr "**Note** 可以使用 `--model` 選項搭配 `make:policy` 指令來快速為給定的 Model 產生 Policy:`php artisan make:policy PostPolicy --model=Post`。" - -#: docs/10.x/authorization.md:block 150 (header) -msgid "Via Middleware" -msgstr "通過 Middleware" - -#: docs/10.x/authorization.md:block 151 (paragraph) -msgid "Laravel includes a middleware that can authorize actions before the incoming request even reaches your routes or controllers. By default, the `Illuminate\\Auth\\Middleware\\Authorize` middleware is assigned the `can` key in your `App\\Http\\Kernel` class. Let's explore an example of using the `can` middleware to authorize that a user can update a post:" -msgstr "Laravel 提供了一個可以用來在連入請求進入路由或 Controller 前進行權限檢查的 Middleware。預設情況下,`Illuminate\\Auth\\Middleware\\Authorize` Middleware 在 `App\\Http\\Kernel` 類別內被指派到 `can` 索引鍵上。我們來看看一個使用 `can` Middleware 對使用者能否更新貼文進行權限檢查的例子:" - -#: docs/10.x/authorization.md:block 152 (code) -msgid "use App\\Models\\Post;\n\n" -"Route::put('/post/{post}', function (Post $post) {\n" -" // The current user may update the post...\n" -"})->middleware('can:update,post');\n" -msgstr "use App\\Models\\Post;\n\n" -"Route::put('/post/{post}', function (Post $post) {\n" -" // 目前使用者可更新該貼文...\n" -"})->middleware('can:update,post');\n" +"}" +msgstr "" -#: docs/10.x/authorization.md:block 153 (paragraph) -msgid "In this example, we're passing the `can` middleware two arguments. The first is the name of the action we wish to authorize and the second is the route parameter we wish to pass to the policy method. In this case, since we are using [implicit model binding](/docs/{{version}}/routing#implicit-binding), an `App\\Models\\Post` model will be passed to the policy method. If the user is not authorized to perform the given action, an HTTP response with a 403 status code will be returned by the middleware." -msgstr "在此例子中,我們將兩個引數傳給了 `can` Middleware。第一個引數是我們想進行權限檢查的動作名稱,而第二個引數是我們想傳給 Policy 方法的路由參數。在這個例子中,由於我們使用了[隱式 Model 繫結](/docs/{{version}}/routing#implicit-binding),所以會將 `App\\Models\\Post` Model 傳給 Policy 方法。若使用者沒有權限執行給定的動作,則這個 Middleware 會回傳狀態碼 403 的 HTTP 回應。" +# P +#: ./docs/8.x/authorization.md:634 +#: ./docs/9.x/authorization.md:713 +msgid "In this example, we're passing the `can` middleware two arguments. The first is the name of the action we wish to authorize and the second is the route parameter we wish to pass to the policy method. In this case, since we are using [implicit model binding](/docs/{{version}}/routing#implicit-binding), a `App\\Models\\Post` model will be passed to the policy method. If the user is not authorized to perform the given action, an HTTP response with a 403 status code will be returned by the middleware." +msgstr "" -#: docs/10.x/authorization.md:block 154 (paragraph) +# P +#: ./docs/8.x/authorization.md:636 +#: ./docs/9.x/authorization.md:715 +#: ./docs/10.x/authorization.md:680 +#: ./docs/11.x/authorization.md:620 +#: ./docs/master/authorization.md:619 msgid "For convenience, you may also attach the `can` middleware to your route using the `can` method:" -msgstr "為了方便起見,也可以使用 `can` 方法來將 `can` Middleware 附加到路由上:" +msgstr "" -#: docs/10.x/authorization.md:block 155 (code) +# CODE +#: ./docs/8.x/authorization.md:638 +#: ./docs/9.x/authorization.md:717 +#: ./docs/10.x/authorization.md:682 +#: ./docs/11.x/authorization.md:622 +#: ./docs/master/authorization.md:621 msgid "use App\\Models\\Post;\n\n" "Route::put('/post/{post}', function (Post $post) {\n" " // The current user may update the post...\n" -"})->can('update', 'post');\n" -msgstr "use App\\Models\\Post;\n\n" -"Route::put('/post/{post}', function (Post $post) {\n" -" // 目前使用者可更新該貼文...\n" -"})->can('update', 'post');\n" +"})->can('update', 'post');" +msgstr "" -#: docs/10.x/authorization.md:block 158 (paragraph) +# P +#: ./docs/8.x/authorization.md:644 +#: ./docs/9.x/authorization.md:723 +#: ./docs/10.x/authorization.md:688 +#: ./docs/11.x/authorization.md:628 +#: ./docs/master/authorization.md:627 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/authorization.md:647 +#: ./docs/9.x/authorization.md:726 +#: ./docs/10.x/authorization.md:691 +#: ./docs/11.x/authorization.md:631 +#: ./docs/master/authorization.md:630 msgid "Again, some policy methods like `create` do not require a model instance. In these situations, you may pass a class name to the middleware. The class name will be used to determine which policy to use when authorizing the action:" -msgstr "再強調一次,某些 Policy 方法,如 `create`,並不要求 Model 實體。這種情況下,可以將類別名稱傳給 Middleware。這個類別名稱會用來判斷對動作進行權限檢查時要使用哪個 Policy:" +msgstr "" -#: docs/10.x/authorization.md:block 159 (code) +# CODE +#: ./docs/8.x/authorization.md:649 +#: ./docs/9.x/authorization.md:728 +#: ./docs/10.x/authorization.md:693 +#: ./docs/11.x/authorization.md:633 +#: ./docs/master/authorization.md:632 msgid "Route::post('/post', function () {\n" " // The current user may create posts...\n" -"})->middleware('can:create,App\\Models\\Post');\n" -msgstr "Route::post('/post', function () {\n" -" // 目前使用者可建立貼文...\n" -"})->middleware('can:create,App\\Models\\Post');\n" +"})->middleware('can:create,App\\Models\\Post');" +msgstr "" -#: docs/10.x/authorization.md:block 160 (paragraph) +# P +#: ./docs/8.x/authorization.md:653 +#: ./docs/9.x/authorization.md:732 +#: ./docs/10.x/authorization.md:697 +#: ./docs/11.x/authorization.md:637 +#: ./docs/master/authorization.md:636 msgid "Specifying the entire class name within a string middleware definition can become cumbersome. For that reason, you may choose to attach the `can` middleware to your route using the `can` method:" -msgstr "在字串形式的 Middleware 定義中指定完整的類別名稱可能會有點麻煩。因此,我們也可以使用 `can` 方法來將 `can` Middleware 附加到路由上:" +msgstr "" -#: docs/10.x/authorization.md:block 161 (code) +# CODE +#: ./docs/8.x/authorization.md:655 +#: ./docs/9.x/authorization.md:734 +#: ./docs/10.x/authorization.md:699 +#: ./docs/11.x/authorization.md:639 +#: ./docs/master/authorization.md:638 msgid "use App\\Models\\Post;\n\n" "Route::post('/post', function () {\n" " // The current user may create posts...\n" -"})->can('create', Post::class);\n" -msgstr "use App\\Models\\Post;\n\n" -"Route::post('/post', function () {\n" -" // 目前使用者可建立貼文...\n" -"})->can('create', Post::class);\n" +"})->can('create', Post::class);" +msgstr "" -#: docs/10.x/authorization.md:block 163 (header) +# P +#: ./docs/8.x/authorization.md:661 +#: ./docs/9.x/authorization.md:740 +#: ./docs/10.x/authorization.md:705 +#: ./docs/11.x/authorization.md:645 +#: ./docs/master/authorization.md:644 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/authorization.md:662 +#: ./docs/9.x/authorization.md:741 +#: ./docs/10.x/authorization.md:706 +#: ./docs/11.x/authorization.md:646 +#: ./docs/master/authorization.md:645 msgid "Via Blade Templates" -msgstr "通過 Blade 樣板" +msgstr "" -#: docs/10.x/authorization.md:block 164 (paragraph) +# P +#: ./docs/8.x/authorization.md:664 +#: ./docs/9.x/authorization.md:743 +#: ./docs/10.x/authorization.md:708 +#: ./docs/11.x/authorization.md:648 +#: ./docs/master/authorization.md:647 msgid "When writing Blade templates, you may wish to display a portion of the page only if the user is authorized to perform a given action. For example, you may wish to show an update form for a blog post only if the user can actually update the post. In this situation, you may use the `@can` and `@cannot` directives:" -msgstr "在撰寫 Blade 樣板時,我們可能會在使用者有權限執行給定動作時顯示某一部分的頁面。舉例來說,我們可能想在使用者真的可以更新貼文時才顯示更新表單。這時,可以使用 `@can` 與 `@cannot` 指示詞:" +msgstr "" -#: docs/10.x/authorization.md:block 165 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/authorization.md:666 +#: ./docs/9.x/authorization.md:745 +#: ./docs/10.x/authorization.md:710 +#: ./docs/11.x/authorization.md:650 +#: ./docs/master/authorization.md:649 msgid "@can('update', $post)\n" " \n" "@elsecan('create', App\\Models\\Post::class)\n" @@ -1272,99 +2592,99 @@ msgid "@can('update', $post)\n" " \n" "@elsecannot('create', App\\Models\\Post::class)\n" " \n" -"@endcannot\n" -msgstr "@can('update', $post)\n" -" \n" -"@elsecan('create', App\\Models\\Post::class)\n" -" \n" -"@else\n" -" \n" -"@endcan\n\n" -"@cannot('update', $post)\n" -" \n" -"@elsecannot('create', App\\Models\\Post::class)\n" -" \n" -"@endcannot\n" +"@endcannot" +msgstr "" + +# P +#: ./docs/10.x/authorization.md:678 +#: ./docs/11.x/authorization.md:618 +#: ./docs/master/authorization.md:617 +msgid "In this example, we're passing the `can` middleware two arguments. The first is the name of the action we wish to authorize and the second is the route parameter we wish to pass to the policy method. In this case, since we are using [implicit model binding](/docs/{{version}}/routing#implicit-binding), an `App\\Models\\Post` model will be passed to the policy method. If the user is not authorized to perform the given action, an HTTP response with a 403 status code will be returned by the middleware." +msgstr "" -#: docs/10.x/authorization.md:block 166 (paragraph) +# P +#: ./docs/8.x/authorization.md:682 +#: ./docs/9.x/authorization.md:761 +#: ./docs/10.x/authorization.md:726 +#: ./docs/11.x/authorization.md:666 +#: ./docs/master/authorization.md:665 msgid "These directives are convenient shortcuts for writing `@if` and `@unless` statements. The `@can` and `@cannot` statements above are equivalent to the following statements:" -msgstr "這些指示詞是撰寫 `@if` 與 `@unless` 陳述式時的方便捷徑。上方的 `@can` 與 `@cannot` 陳述式與下列陳述式相同:" +msgstr "" -#: docs/10.x/authorization.md:block 167 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/authorization.md:684 +#: ./docs/9.x/authorization.md:763 +#: ./docs/10.x/authorization.md:728 +#: ./docs/11.x/authorization.md:668 +#: ./docs/master/authorization.md:667 msgid "@if (Auth::user()->can('update', $post))\n" " \n" "@endif\n\n" "@unless (Auth::user()->can('update', $post))\n" " \n" -"@endunless\n" -msgstr "@if (Auth::user()->can('update', $post))\n" -" \n" -"@endif\n\n" -"@unless (Auth::user()->can('update', $post))\n" -" \n" -"@endunless\n" +"@endunless" +msgstr "" -#: docs/10.x/authorization.md:block 168 (paragraph) +# P +#: ./docs/8.x/authorization.md:694 +#: ./docs/9.x/authorization.md:773 +#: ./docs/10.x/authorization.md:738 +#: ./docs/11.x/authorization.md:678 +#: ./docs/master/authorization.md:677 msgid "You may also determine if a user is authorized to perform any action from a given array of actions. To accomplish this, use the `@canany` directive:" -msgstr "可以在包含一系列動作的陣列中判斷某個使用者是否有權限執行其中的任意動作。為此,請使用 `@canany` 指示詞:" +msgstr "" -#: docs/10.x/authorization.md:block 169 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/authorization.md:696 +#: ./docs/9.x/authorization.md:775 +#: ./docs/10.x/authorization.md:740 +#: ./docs/11.x/authorization.md:680 +#: ./docs/master/authorization.md:679 msgid "@canany(['update', 'view', 'delete'], $post)\n" " \n" "@elsecanany(['create'], \\App\\Models\\Post::class)\n" " \n" -"@endcanany\n" -msgstr "@canany(['update', 'view', 'delete'], $post)\n" -" \n" -"@elsecanany(['create'], \\App\\Models\\Post::class)\n" -" \n" -"@endcanany\n" +"@endcanany" +msgstr "" -#: docs/10.x/authorization.md:block 172 (paragraph) +# P +#: ./docs/8.x/authorization.md:704 +#: ./docs/9.x/authorization.md:783 +#: ./docs/10.x/authorization.md:748 +#: ./docs/11.x/authorization.md:688 +#: ./docs/master/authorization.md:687 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/authorization.md:707 +#: ./docs/9.x/authorization.md:786 +#: ./docs/10.x/authorization.md:751 +#: ./docs/11.x/authorization.md:691 +#: ./docs/master/authorization.md:690 msgid "Like most of the other authorization methods, you may pass a class name to the `@can` and `@cannot` directives if the action does not require a model instance:" -msgstr "與其他大多數的授權方法一樣,當某個動作不需要 Model 實體時,可以將類別名稱傳給 `@can` 與 `@cannot` 指示詞:" +msgstr "" -#: docs/10.x/authorization.md:block 173 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/authorization.md:709 +#: ./docs/9.x/authorization.md:788 +#: ./docs/10.x/authorization.md:753 +#: ./docs/11.x/authorization.md:693 +#: ./docs/master/authorization.md:692 msgid "@can('create', App\\Models\\Post::class)\n" " \n" "@endcan\n\n" "@cannot('create', App\\Models\\Post::class)\n" " \n" -"@endcannot\n" -msgstr "@can('create', App\\Models\\Post::class)\n" -" \n" -"@endcan\n\n" -"@cannot('create', App\\Models\\Post::class)\n" -" \n" -"@endcannot\n" - -#: docs/10.x/authorization.md:block 176 (paragraph) -msgid "When authorizing actions using policies, you may pass an array as the second argument to the various authorization functions and helpers. The first element in the array will be used to determine which policy should be invoked, while the rest of the array elements are passed as parameters to the policy method and can be used for additional context when making authorization decisions. For example, consider the following `PostPolicy` method definition which contains an additional `$category` parameter:" -msgstr "當使用 Policy 對動作進行權限檢查時,可以將陣列作為第二引數傳給各種權限檢查函式與輔助函式。陣列中的第一個元素是用來判斷要叫用哪個 Policy 的,而剩下的元素則會作為參數傳給 Policy 方法,可用來在做權限檢查時提供額外的上下文。舉例來說,假設有下列 `PostPolicy` 方法定義,其中包含了一個額外的 `$category` 參數:" - -#: docs/10.x/authorization.md:block 177 (code) -msgid "/**\n" -" * Determine if the given post can be updated by the user.\n" -" */\n" -"public function update(User $user, Post $post, int $category): bool\n" -"{\n" -" return $user->id === $post->user_id &&\n" -" $user->canUpdateCategory($category);\n" -"}\n" -msgstr "/**\n" -" * Determine if the given post can be updated by the user.\n" -" */\n" -"public function update(User $user, Post $post, int $category): bool\n" -"{\n" -" return $user->id === $post->user_id &&\n" -" $user->canUpdateCategory($category);\n" -"}\n" - -#: docs/10.x/authorization.md:block 178 (paragraph) -msgid "When attempting to determine if the authenticated user can update a given post, we can invoke this policy method like so:" -msgstr "在嘗試判斷登入使用者能否更新給定貼文時,我們可以像這樣叫用該 Policy 方法:" +"@endcannot" +msgstr "" -#: docs/10.x/authorization.md:block 179 (code) +# CODE +#: ./docs/11.x/authorization.md:719 +#: ./docs/master/authorization.md:718 msgid "/**\n" " * Update the given blog post.\n" " *\n" @@ -1372,1175 +2692,154 @@ msgid "/**\n" " */\n" "public function update(Request $request, Post $post): RedirectResponse\n" "{\n" -" $this->authorize('update', [$post, $request->category]);\n\n" +" Gate::authorize('update', [$post, $request->category]);\n\n" " // The current user can update the blog post...\n\n" " return redirect('/posts');\n" -"}\n" -msgstr "/**\n" -" * Update the given blog post.\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/authorization.md:719 +#: ./docs/9.x/authorization.md:798 +#: ./docs/10.x/authorization.md:763 +#: ./docs/11.x/authorization.md:703 +#: ./docs/master/authorization.md:702 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/authorization.md:722 +#: ./docs/9.x/authorization.md:801 +#: ./docs/10.x/authorization.md:766 +#: ./docs/11.x/authorization.md:706 +#: ./docs/master/authorization.md:705 +msgid "When authorizing actions using policies, you may pass an array as the second argument to the various authorization functions and helpers. The first element in the array will be used to determine which policy should be invoked, while the rest of the array elements are passed as parameters to the policy method and can be used for additional context when making authorization decisions. For example, consider the following `PostPolicy` method definition which contains an additional `$category` parameter:" +msgstr "" + +# CODE +#: ./docs/8.x/authorization.md:724 +#: ./docs/9.x/authorization.md:803 +msgid "/**\n" +" * Determine if the given post can be updated by the user.\n" " *\n" -" * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n" +" * @param \\App\\Models\\User $user\n" +" * @param \\App\\Models\\Post $post\n" +" * @param int $category\n" +" * @return bool\n" " */\n" -"public function update(Request $request, Post $post): RedirectResponse\n" +"public function update(User $user, Post $post, int $category)\n" "{\n" -" $this->authorize('update', [$post, $request->category]);\n\n" -" // 目前使用者可更新部落格貼文...\n\n" -" return redirect('/posts');\n" -"}\n" +" return $user->id === $post->user_id &&\n" +" $user->canUpdateCategory($category);\n" +"}" +msgstr "" -#: docs/8.x/authorization.md:block 7 (paragraph) -msgid "You do not need to choose between exclusively using gates or exclusively using policies when building an application. Most applications will most likely contain some mixture of gates and policies, and that is perfectly fine! Gates are most applicable to actions which are not related to any model or resource, such as viewing an administrator dashboard. In contrast, policies should be used when you wish to authorize an action for a particular model or resource." -msgstr "在製作網站時,不需要在 Gate 或 Policy 間二選一。大多數的專案都在某種程度上組合使用 Gate 與 Policy,混著用完全沒問題!Gate 最適合用來處理與 Model 或資源無關的動作,如檢視後台的「縱覽」頁。相較之下,Policy 則應使用於想授權對特定 Model 或 Resource 的動作時。" +# P +#: ./docs/11.x/authorization.md:733 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/authorization.md:734 +msgid "Authorization & Inertia" +msgstr "" -#: docs/8.x/authorization.md:block 12 (quote) -msgid "{note} Gates are a great way to learn the basics of Laravel's authorization features; however, when building robust Laravel applications you should consider using [policies](#creating-policies) to organize your authorization rules." -msgstr "{note} Gate 是學習基礎 Laravel 授權功能的最好的方法。但是,在製作大型 Laravel 應用程式時,應考慮通過 [Policy](#creating-policies) 來整理各個授權規則。" +# P +#: ./docs/11.x/authorization.md:736 +msgid "Although authorization must always be handled on the server, it can often be convenient to provide your frontend application with authorization data in order to properly render your application's UI. Laravel does not define a required convention for exposing authorization information to an Inertia powered frontend." +msgstr "" -#: docs/8.x/authorization.md:block 15 (code) -msgid "use App\\Models\\Post;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"/**\n" -" * Register any authentication / authorization services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" $this->registerPolicies();\n\n" -" Gate::define('update-post', function (User $user, Post $post) {\n" -" return $user->id === $post->user_id;\n" -" });\n" -"}\n" -msgstr "use App\\Models\\Post;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"/**\n" -" * Register any authentication / authorization services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" $this->registerPolicies();\n\n" -" Gate::define('update-post', function (User $user, Post $post) {\n" -" return $user->id === $post->user_id;\n" -" });\n" -"}\n" +# P +#: ./docs/11.x/authorization.md:738 +msgid "However, if you are using one of Laravel's Inertia-based [starter kits](/docs/{{version}}/starter-kits), your application already contains a `HandleInertiaRequests` middleware. Within this middleware's `share` method, you may return shared data that will be provided to all Inertia pages in your application. This shared data can serve as a convenient location to define authorization information for the user:" +msgstr "" -#: docs/8.x/authorization.md:block 17 (code) -msgid "use App\\Policies\\PostPolicy;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"/**\n" -" * Register any authentication / authorization services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" $this->registerPolicies();\n\n" -" Gate::define('update-post', [PostPolicy::class, 'update']);\n" -"}\n" -msgstr "use App\\Policies\\PostPolicy;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"/**\n" -" * Register any authentication / authorization services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" $this->registerPolicies();\n\n" -" Gate::define('update-post', [PostPolicy::class, 'update']);\n" -"}\n" +# P +#: ./docs/8.x/authorization.md:738 +#: ./docs/9.x/authorization.md:817 +#: ./docs/10.x/authorization.md:777 +#: ./docs/11.x/authorization.md:717 +#: ./docs/master/authorization.md:716 +msgid "When attempting to determine if the authenticated user can update a given post, we can invoke this policy method like so:" +msgstr "" -#: docs/8.x/authorization.md:block 21 (code) +# CODE: php +#: ./docs/11.x/authorization.md:740 msgid "\n" " */\n" -" public function update(Request $request, Post $post)\n" +" public function share(Request $request)\n" " {\n" -" if (! Gate::allows('update-post', $post)) {\n" -" abort(403);\n" -" }\n\n" -" // Update the post...\n" -" }\n" -"}\n" - -#: docs/8.x/authorization.md:block 33 (code) -msgid "use App\\Models\\Category;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::define('create-post', function (User $user, Category $category, $pinned) {\n" -" if (! $user->canPublishToGroup($category->group)) {\n" -" return false;\n" -" } elseif ($pinned && ! $user->canPinPosts()) {\n" -" return false;\n" -" }\n\n" -" return true;\n" -"});\n\n" -"if (Gate::check('create-post', [$category, $pinned])) {\n" -" // The user can create the post...\n" -"}\n" -msgstr "use App\\Models\\Category;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::define('create-post', function (User $user, Category $category, $pinned) {\n" -" if (! $user->canPublishToGroup($category->group)) {\n" -" return false;\n" -" } elseif ($pinned && ! $user->canPinPosts()) {\n" -" return false;\n" -" }\n\n" -" return true;\n" -"});\n\n" -"if (Gate::check('create-post', [$category, $pinned])) {\n" -" // The user can create the post...\n" -"}\n" - -#: docs/8.x/authorization.md:block 45 (code) -msgid "use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::before(function ($user, $ability) {\n" -" if ($user->isAdministrator()) {\n" -" return true;\n" -" }\n" -"});\n" -msgstr "use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::before(function ($user, $ability) {\n" -" if ($user->isAdministrator()) {\n" -" return true;\n" -" }\n" -"});\n" - -#: docs/8.x/authorization.md:block 48 (code) -msgid "Gate::after(function ($user, $ability, $result, $arguments) {\n" -" if ($user->isAdministrator()) {\n" -" return true;\n" +" return [\n" +" ...parent::share($request),\n" +" 'auth' => [\n" +" 'user' => $request->user(),\n" +" 'permissions' => [\n" +" 'post' => [\n" +" 'create' => $request->user()->can('create', Post::class),\n" +" ],\n" +" ],\n" +" ],\n" +" ];\n" " }\n" -"});\n" -msgstr "Gate::after(function ($user, $ability, $result, $arguments) {\n" -" if ($user->isAdministrator()) {\n" -" return true;\n" -" }\n" -"});\n" +"}" +msgstr "" -#: docs/8.x/authorization.md:block 53 (code) -msgid "use Illuminate\\Support\\Facades\\Auth;\n\n" -"Gate::allowIf(fn ($user) => $user->isAdministrator());\n\n" -"Gate::denyIf(fn ($user) => $user->banned());\n" -msgstr "use Illuminate\\Support\\Facades\\Auth;\n\n" -"Gate::allowIf(fn ($user) => $user->isAdministrator());\n\n" -"Gate::denyIf(fn ($user) => $user->banned());\n" +# CODE +#: ./docs/8.x/authorization.md:740 +#: ./docs/9.x/authorization.md:819 +msgid "/**\n" +" * Update the given blog post.\n" +" *\n" +" * @param \\Illuminate\\Http\\Request $request\n" +" * @param \\App\\Models\\Post $post\n" +" * @return \\Illuminate\\Http\\Response\n" +" *\n" +" * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n" +" */\n" +"public function update(Request $request, Post $post)\n" +"{\n" +" $this->authorize('update', [$post, $request->category]);\n\n" +" // The current user can update the blog post...\n" +"}" +msgstr "" -#: docs/8.x/authorization.md:block 59 (paragraph) -msgid "Policies are classes that organize authorization logic around a particular model or resource. For example, if your application is a blog, you may have a `App\\Models\\Post` model and a corresponding `App\\Policies\\PostPolicy` to authorize user actions such as creating or updating posts." -msgstr "Policy 是用來依照特定 Model 或資源阻止授權邏輯的類別。舉例來說,若你的專案是個部落格,則可能會有 `App\\Models\\Post` Model 以及對應的 `App\\Policies\\PostPolicy` 來授權使用者進行建立或更新貼文之類的動作。" +# CODE +#: ./docs/10.x/authorization.md:768 +#: ./docs/11.x/authorization.md:708 +#: ./docs/master/authorization.md:707 +msgid "/**\n" +" * Determine if the given post can be updated by the user.\n" +" */\n" +"public function update(User $user, Post $post, int $category): bool\n" +"{\n" +" return $user->id === $post->user_id &&\n" +" $user->canUpdateCategory($category);\n" +"}" +msgstr "" -#: docs/8.x/authorization.md:block 68 (code) -msgid " PostPolicy::class,\n" -" ];\n\n" -" /**\n" -" * Register any application authentication / authorization services.\n" -" *\n" -" * @return void\n" -" */\n" -" public function boot()\n" -" {\n" -" $this->registerPolicies();\n\n" -" //\n" -" }\n" -"}\n" -msgstr " PostPolicy::class,\n" -" ];\n\n" -" /**\n" -" * Register any application authentication / authorization services.\n" -" *\n" -" * @return void\n" -" */\n" -" public function boot()\n" -" {\n" -" $this->registerPolicies();\n\n" -" //\n" -" }\n" -"}\n" - -#: docs/8.x/authorization.md:block 73 (code) -msgid "use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::guessPolicyNamesUsing(function ($modelClass) {\n" -" // Return the name of the policy class for the given model...\n" -"});\n" -msgstr "use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::guessPolicyNamesUsing(function ($modelClass) {\n" -" // 為給定 Model 回傳 Policy 類別的名稱...\n" -"});\n" - -#: docs/8.x/authorization.md:block 74 (quote) -msgid "{note} Any policies that are explicitly mapped in your `AuthServiceProvider` will take precedence over any potentially auto-discovered policies." -msgstr "{note} 所有在 `AuthServiceProvider` 中顯式映射之 Policy 的優先級都會比 Auto-Discover 的 Policy 高。" - -#: docs/8.x/authorization.md:block 81 (code) -msgid "id === $post->user_id;\n" -" }\n" -"}\n" -msgstr "id === $post->user_id;\n" -" }\n" -"}\n" - -#: docs/8.x/authorization.md:block 84 (quote) -msgid "{tip} All policies are resolved via the Laravel [service container](/docs/{{version}}/container), allowing you to type-hint any needed dependencies in the policy's constructor to have them automatically injected." -msgstr "{tip} 所有的 Policy 都經由 Laravel 的 [Service Container](/docs/{{version}}/container) 進行解析,這樣一來,可以在 Policy 的 ^[Constructor](建構函式) 內對任何所需的相依性項目進行型別提示,這些相依性項目會被自動插入到類別內。" - -#: docs/8.x/authorization.md:block 88 (code) -msgid "use App\\Models\\Post;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Auth\\Access\\Response;\n\n" -"/**\n" -" * Determine if the given post can be updated by the user.\n" -" *\n" -" * @param \\App\\Models\\User $user\n" -" * @param \\App\\Models\\Post $post\n" -" * @return \\Illuminate\\Auth\\Access\\Response\n" -" */\n" -"public function update(User $user, Post $post)\n" -"{\n" -" return $user->id === $post->user_id\n" -" ? Response::allow()\n" -" : Response::deny('You do not own this post.');\n" -"}\n" -msgstr "use App\\Models\\Post;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Auth\\Access\\Response;\n\n" -"/**\n" -" * Determine if the given post can be updated by the user.\n" -" *\n" -" * @param \\App\\Models\\User $user\n" -" * @param \\App\\Models\\Post $post\n" -" * @return \\Illuminate\\Auth\\Access\\Response\n" -" */\n" -"public function update(User $user, Post $post)\n" -"{\n" -" return $user->id === $post->user_id\n" -" ? Response::allow()\n" -" : Response::deny('You do not own this post.');\n" -"}\n" - -#: docs/8.x/authorization.md:block 96 (code) -msgid "/**\n" -" * Determine if the given user can create posts.\n" -" *\n" -" * @param \\App\\Models\\User $user\n" -" * @return bool\n" -" */\n" -"public function create(User $user)\n" -"{\n" -" return $user->role == 'writer';\n" -"}\n" -msgstr "/**\n" -" * Determine if the given user can create posts.\n" -" *\n" -" * @param \\App\\Models\\User $user\n" -" * @return bool\n" -" */\n" -"public function create(User $user)\n" -"{\n" -" return $user->role == 'writer';\n" -"}\n" - -#: docs/8.x/authorization.md:block 100 (code) -msgid "id === $post->user_id;\n" -" }\n" -"}\n" -msgstr "id === $post->user_id;\n" -" }\n" -"}\n" - -#: docs/8.x/authorization.md:block 104 (code) -msgid "use App\\Models\\User;\n\n" -"/**\n" -" * Perform pre-authorization checks.\n" -" *\n" -" * @param \\App\\Models\\User $user\n" -" * @param string $ability\n" -" * @return void|bool\n" -" */\n" -"public function before(User $user, $ability)\n" -"{\n" -" if ($user->isAdministrator()) {\n" -" return true;\n" -" }\n" -"}\n" -msgstr "use App\\Models\\User;\n\n" -"/**\n" -" * Perform pre-authorization checks.\n" -" *\n" -" * @param \\App\\Models\\User $user\n" -" * @param string $ability\n" -" * @return void|bool\n" -" */\n" -"public function before(User $user, $ability)\n" -"{\n" -" if ($user->isAdministrator()) {\n" -" return true;\n" -" }\n" -"}\n" - -#: docs/8.x/authorization.md:block 106 (quote) -msgid "{note} The `before` method of a policy class will not be called if the class doesn't contain a method with a name matching the name of the ability being checked." -msgstr "{note} 若 Policy 類別內不含要檢查權限名稱的方法,則 `before` 方法將不會被呼叫。" - -#: docs/8.x/authorization.md:block 112 (code) -msgid "user()->cannot('update', $post)) {\n" -" abort(403);\n" -" }\n\n" -" // Update the post...\n" -" }\n" -"}\n" -msgstr "user()->cannot('update', $post)) {\n" -" abort(403);\n" -" }\n\n" -" // Update the post...\n" -" }\n" -"}\n" - -#: docs/8.x/authorization.md:block 117 (code) -msgid "user()->cannot('create', Post::class)) {\n" -" abort(403);\n" -" }\n\n" -" // Create the post...\n" -" }\n" -"}\n" -msgstr "user()->cannot('create', Post::class)) {\n" -" abort(403);\n" -" }\n\n" -" // Create the post...\n" -" }\n" -"}\n" - -#: docs/8.x/authorization.md:block 122 (code) -msgid "authorize('update', $post);\n\n" -" // The current user can update the blog post...\n" -" }\n" -"}\n" -msgstr "authorize('update', $post);\n\n" -" // The current user can update the blog post...\n" -" }\n" -"}\n" - -#: docs/8.x/authorization.md:block 126 (code) -msgid "use App\\Models\\Post;\n" -"use Illuminate\\Http\\Request;\n\n" -"/**\n" -" * Create a new blog post.\n" -" *\n" -" * @param \\Illuminate\\Http\\Request $request\n" -" * @return \\Illuminate\\Http\\Response\n" -" *\n" -" * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n" -" */\n" -"public function create(Request $request)\n" -"{\n" -" $this->authorize('create', Post::class);\n\n" -" // The current user can create blog posts...\n" -"}\n" -msgstr "use App\\Models\\Post;\n" -"use Illuminate\\Http\\Request;\n\n" -"/**\n" -" * Create a new blog post.\n" -" *\n" -" * @param \\Illuminate\\Http\\Request $request\n" -" * @return \\Illuminate\\Http\\Response\n" -" *\n" -" * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n" -" */\n" -"public function create(Request $request)\n" -"{\n" -" $this->authorize('create', Post::class);\n\n" -" // The current user can create blog posts...\n" -"}\n" - -#: docs/8.x/authorization.md:block 131 (code) -msgid "authorizeResource(Post::class, 'post');\n" -" }\n" -"}\n" -msgstr "authorizeResource(Post::class, 'post');\n" -" }\n" -"}\n" - -#: docs/8.x/authorization.md:block 134 (quote) -msgid "{tip} You may use the `make:policy` command with the `--model` option to quickly generate a policy class for a given model: `php artisan make:policy PostPolicy --model=Post`." -msgstr "{tip} 可以使用 `--model` 選項搭配 `make:policy` 指令來快速為給定的 Model 產生 Policy:`php artisan make:policy PostPolicy --model=Post`。" - -#: docs/8.x/authorization.md:block 139 (paragraph) -msgid "In this example, we're passing the `can` middleware two arguments. The first is the name of the action we wish to authorize and the second is the route parameter we wish to pass to the policy method. In this case, since we are using [implicit model binding](/docs/{{version}}/routing#implicit-binding), a `App\\Models\\Post` model will be passed to the policy method. If the user is not authorized to perform the given action, an HTTP response with a 403 status code will be returned by the middleware." -msgstr "在此例子中,我們將兩個引數傳給了 `can` Middleware。第一個引數是我們想進行權限檢查的動作名稱,而第二個引數是我們想傳給 Policy 方法的路由參數。在這個例子中,由於我們使用了[隱式 Model 繫結](/docs/{{version}}/routing#implicit-binding),所以會將 `App\\Models\\Post` Model 傳給 Policy 方法。若使用者沒有權限執行給定的動作,則這個 Middleware 會回傳狀態碼 403 的 HTTP 回應。" - -#: docs/8.x/authorization.md:block 163 (code) -msgid "/**\n" -" * Determine if the given post can be updated by the user.\n" -" *\n" -" * @param \\App\\Models\\User $user\n" -" * @param \\App\\Models\\Post $post\n" -" * @param int $category\n" -" * @return bool\n" -" */\n" -"public function update(User $user, Post $post, int $category)\n" -"{\n" -" return $user->id === $post->user_id &&\n" -" $user->canUpdateCategory($category);\n" -"}\n" -msgstr "/**\n" -" * Determine if the given post can be updated by the user.\n" -" *\n" -" * @param \\App\\Models\\User $user\n" -" * @param \\App\\Models\\Post $post\n" -" * @param int $category\n" -" * @return bool\n" -" */\n" -"public function update(User $user, Post $post, int $category)\n" -"{\n" -" return $user->id === $post->user_id &&\n" -" $user->canUpdateCategory($category);\n" -"}\n" - -#: docs/8.x/authorization.md:block 165 (code) -msgid "/**\n" -" * Update the given blog post.\n" -" *\n" -" * @param \\Illuminate\\Http\\Request $request\n" -" * @param \\App\\Models\\Post $post\n" -" * @return \\Illuminate\\Http\\Response\n" -" *\n" -" * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n" -" */\n" -"public function update(Request $request, Post $post)\n" -"{\n" -" $this->authorize('update', [$post, $request->category]);\n\n" -" // The current user can update the blog post...\n" -"}\n" -msgstr "/**\n" -" * Update the given blog post.\n" -" *\n" -" * @param \\Illuminate\\Http\\Request $request\n" -" * @param \\App\\Models\\Post $post\n" -" * @return \\Illuminate\\Http\\Response\n" -" *\n" -" * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n" -" */\n" -"public function update(Request $request, Post $post)\n" -"{\n" -" $this->authorize('update', [$post, $request->category]);\n\n" -" // The current user can update the blog post...\n" -"}\n" - -#: docs/9.x/authorization.md:block 59 (code) -msgid "use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::allowIf(fn ($user) => $user->isAdministrator());\n\n" -"Gate::denyIf(fn ($user) => $user->banned());\n" -msgstr "use Illuminate\\Support\\Facades\\Gate;\n\n" -"Gate::allowIf(fn ($user) => $user->isAdministrator());\n\n" -"Gate::denyIf(fn ($user) => $user->banned());\n" - -#: docs/9.x/authorization.md:block 102 (code) -msgid "use App\\Models\\Post;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Auth\\Access\\Response;\n\n" -"/**\n" -" * Determine if the given post can be updated by the user.\n" -" *\n" -" * @param \\App\\Models\\User $user\n" -" * @param \\App\\Models\\Post $post\n" -" * @return \\Illuminate\\Auth\\Access\\Response\n" -" */\n" -"public function update(User $user, Post $post)\n" -"{\n" -" return $user->id === $post->user_id\n" -" ? Response::allow()\n" -" : Response::denyWithStatus(404);\n" -"}\n" -msgstr "use App\\Models\\Post;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Auth\\Access\\Response;\n\n" -"/**\n" -" * Determine if the given post can be updated by the user.\n" -" *\n" -" * @param \\App\\Models\\User $user\n" -" * @param \\App\\Models\\Post $post\n" -" * @return \\Illuminate\\Auth\\Access\\Response\n" -" */\n" -"public function update(User $user, Post $post)\n" -"{\n" -" return $user->id === $post->user_id\n" -" ? Response::allow()\n" -" : Response::denyWithStatus(404);\n" -"}\n" - -#: docs/9.x/authorization.md:block 104 (code) -msgid "use App\\Models\\Post;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Auth\\Access\\Response;\n\n" -"/**\n" -" * Determine if the given post can be updated by the user.\n" -" *\n" -" * @param \\App\\Models\\User $user\n" -" * @param \\App\\Models\\Post $post\n" -" * @return \\Illuminate\\Auth\\Access\\Response\n" -" */\n" -"public function update(User $user, Post $post)\n" -"{\n" -" return $user->id === $post->user_id\n" -" ? Response::allow()\n" -" : Response::denyAsNotFound();\n" -"}\n" -msgstr "use App\\Models\\Post;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Auth\\Access\\Response;\n\n" -"/**\n" -" * Determine if the given post can be updated by the user.\n" -" *\n" -" * @param \\App\\Models\\User $user\n" -" * @param \\App\\Models\\Post $post\n" -" * @return \\Illuminate\\Auth\\Access\\Response\n" -" */\n" -"public function update(User $user, Post $post)\n" -"{\n" -" return $user->id === $post->user_id\n" -" ? Response::allow()\n" -" : Response::denyAsNotFound();\n" -"}\n" - -#: docs/master/authorization.md:block 15 (code) -msgid "use App\\Models\\Post;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"/**\n" -" * Register any authentication / authorization services.\n" -" */\n" -"public function boot(): void\n" -"{\n" -" $this->registerPolicies();\n\n" -" Gate::define('update-post', function (User $user, Post $post) {\n" -" return $user->id === $post->user_id;\n" -" });\n" -"}\n" -msgstr "use App\\Models\\Post;\n" -"use App\\Models\\User;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"/**\n" -" * Register any authentication / authorization services.\n" -" */\n" -"public function boot(): void\n" -"{\n" -" $this->registerPolicies();\n\n" -" Gate::define('update-post', function (User $user, Post $post) {\n" -" return $user->id === $post->user_id;\n" -" });\n" -"}\n" - -#: docs/master/authorization.md:block 17 (code) -msgid "use App\\Policies\\PostPolicy;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"/**\n" -" * Register any authentication / authorization services.\n" -" */\n" -"public function boot(): void\n" -"{\n" -" $this->registerPolicies();\n\n" -" Gate::define('update-post', [PostPolicy::class, 'update']);\n" -"}\n" -msgstr "use App\\Policies\\PostPolicy;\n" -"use Illuminate\\Support\\Facades\\Gate;\n\n" -"/**\n" -" * Register any authentication / authorization services.\n" -" */\n" -"public function boot(): void\n" -"{\n" -" $this->registerPolicies();\n\n" -" Gate::define('update-post', [PostPolicy::class, 'update']);\n" -"}\n" - -#: docs/master/authorization.md:block 21 (code) -msgid "noContent();\n" -" }\n" -"}\n" -msgstr "noContent();\n" -" }\n" -"}\n" - -#: docs/master/authorization.md:block 74 (code) -msgid " PostPolicy::class,\n" -" ];\n\n" -" /**\n" -" * Register any application authentication / authorization services.\n" -" */\n" -" public function boot(): void\n" -" {\n" -" $this->registerPolicies();\n\n" -" // ...\n" -" }\n" -"}\n" -msgstr " PostPolicy::class,\n" -" ];\n\n" -" /**\n" -" * Register any application authentication / authorization services.\n" -" */\n" -" public function boot(): void\n" -" {\n" -" $this->registerPolicies();\n\n" -" // ...\n" -" }\n" -"}\n" - -#: docs/master/authorization.md:block 112 (code) -msgid "id === $post->user_id;\n" -" }\n" -"}\n" -msgstr "id === $post->user_id;\n" -" }\n" -"}\n" - -#: docs/master/authorization.md:block 124 (code) -msgid "user()->cannot('update', $post)) {\n" -" abort(403);\n" -" }\n\n" -" // Update the post...\n\n" -" return response()->noContent();\n" -" }\n" -"}\n" -msgstr "user()->cannot('update', $post)) {\n" -" abort(403);\n" -" }\n\n" -" // 更新貼文...\n\n" -" return response()->noContent();\n" -" }\n" -"}\n" - -#: docs/master/authorization.md:block 129 (code) -msgid "user()->cannot('create', Post::class)) {\n" -" abort(403);\n" -" }\n\n" -" // Create the post...\n\n" -" return response()->noContent();\n" -" }\n" -"}\n" -msgstr "user()->cannot('create', Post::class)) {\n" -" abort(403);\n" -" }\n\n" -" // 建立貼文...\n\n" -" return response()->noContent();\n" -" }\n" -"}\n" - -#: docs/master/authorization.md:block 134 (code) -msgid "authorize('update', $post);\n\n" -" // The current user can update the blog post...\n\n" -" return response()->noContent();\n" -" }\n" -"}\n" -msgstr "authorize('update', $post);\n\n" -" // 目前使用者可更新此部落格貼文...\n\n" -" return response()->noContent();\n" -" }\n" -"}\n" - -#: docs/master/authorization.md:block 138 (code) -msgid "use App\\Models\\Post;\n" -"use Illuminate\\Http\\Request;\n" -"use Illuminate\\Http\\Response;\n\n" -"/**\n" -" * Create a new blog post.\n" -" *\n" -" * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n" -" */\n" -"public function create(Request $request): Response\n" -"{\n" -" $this->authorize('create', Post::class);\n\n" -" // The current user can create blog posts...\n\n" -" return response()->noContent();\n" -"}\n" -msgstr "use App\\Models\\Post;\n" -"use Illuminate\\Http\\Request;\n" -"use Illuminate\\Http\\Response;\n\n" -"/**\n" -" * Create a new blog post.\n" -" *\n" -" * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n" -" */\n" -"public function create(Request $request): Response\n" -"{\n" -" $this->authorize('create', Post::class);\n\n" -" // 目前使用者可建立部落格貼文...\n\n" -" return response()->noContent();\n" -"}\n" - -#: docs/master/authorization.md:block 143 (code) -msgid "authorizeResource(Post::class, 'post');\n" -" }\n" -"}\n" -msgstr "authorizeResource(Post::class, 'post');\n" -" }\n" -"}\n" - -#: docs/master/authorization.md:block 179 (code) -msgid "/**\n" -" * Update the given blog post.\n" -" *\n" -" * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n" -" */\n" -"public function update(Request $request, Post $post): Response\n" +# CODE +#: ./docs/10.x/authorization.md:779 +msgid "/**\n" +" * Update the given blog post.\n" +" *\n" +" * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n" +" */\n" +"public function update(Request $request, Post $post): RedirectResponse\n" "{\n" " $this->authorize('update', [$post, $request->category]);\n\n" " // The current user can update the blog post...\n\n" -" return response()->noContent();\n" -"}\n" -msgstr "/**\n" -" * Update the given blog post.\n" -" *\n" -" * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n" -" */\n" -"public function update(Request $request, Post $post): Response\n" -"{\n" -" $this->authorize('update', [$post, $request->category]);\n\n" -" // 目前使用者可更新部落格貼文...\n\n" -" return response()->noContent();\n" -"}\n" +" return redirect('/posts');\n" +"}" +msgstr "" diff --git a/po/zh_TW/billing.po b/po/zh_TW/billing.po index e314ddfb0..6b06a7998 100644 --- a/po/zh_TW/billing.po +++ b/po/zh_TW/billing.po @@ -10,619 +10,1722 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" - -#: docs/10.x/billing.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H1 +#: ./docs/8.x/billing.md:1 +#: ./docs/9.x/billing.md:1 +#: ./docs/10.x/billing.md:1 +#: ./docs/11.x/billing.md:1 +#: ./docs/master/billing.md:1 msgid "Laravel Cashier (Stripe)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:3 +#: ./docs/9.x/billing.md:3 +#: ./docs/10.x/billing.md:3 +#: ./docs/11.x/billing.md:3 +#: ./docs/master/billing.md:3 msgid "[Introduction](#introduction)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:4 +#: ./docs/9.x/billing.md:4 +#: ./docs/10.x/billing.md:4 +#: ./docs/11.x/billing.md:4 +#: ./docs/master/billing.md:4 msgid "[Upgrading Cashier](#upgrading-cashier)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:5 +#: ./docs/9.x/billing.md:5 +#: ./docs/10.x/billing.md:5 +#: ./docs/11.x/billing.md:5 +#: ./docs/master/billing.md:5 msgid "[Installation](#installation)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:6 +#: ./docs/9.x/billing.md:6 msgid "[Database Migrations](#database-migrations)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:7 +#: ./docs/9.x/billing.md:7 +#: ./docs/10.x/billing.md:6 +#: ./docs/11.x/billing.md:6 +#: ./docs/master/billing.md:6 msgid "[Configuration](#configuration)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:8 +#: ./docs/9.x/billing.md:8 +#: ./docs/10.x/billing.md:7 +#: ./docs/11.x/billing.md:7 +#: ./docs/master/billing.md:7 msgid "[Billable Model](#billable-model)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:9 +#: ./docs/9.x/billing.md:9 +#: ./docs/10.x/billing.md:8 +#: ./docs/11.x/billing.md:8 +#: ./docs/master/billing.md:8 msgid "[API Keys](#api-keys)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:10 +#: ./docs/9.x/billing.md:10 +#: ./docs/10.x/billing.md:9 +#: ./docs/11.x/billing.md:9 +#: ./docs/master/billing.md:9 msgid "[Currency Configuration](#currency-configuration)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:11 +#: ./docs/9.x/billing.md:11 +#: ./docs/10.x/billing.md:10 +#: ./docs/11.x/billing.md:10 +#: ./docs/master/billing.md:10 msgid "[Tax Configuration](#tax-configuration)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:12 +#: ./docs/9.x/billing.md:12 +#: ./docs/10.x/billing.md:11 +#: ./docs/11.x/billing.md:11 +#: ./docs/master/billing.md:11 msgid "[Logging](#logging)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/10.x/billing.md:13 +#: ./docs/11.x/billing.md:13 +#: ./docs/master/billing.md:13 +msgid "[Quickstart](#quickstart)" +msgstr "" + +# P +#: ./docs/8.x/billing.md:13 +#: ./docs/9.x/billing.md:13 +#: ./docs/10.x/billing.md:12 +#: ./docs/11.x/billing.md:12 +#: ./docs/master/billing.md:12 msgid "[Using Custom Models](#using-custom-models)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/10.x/billing.md:14 +#: ./docs/11.x/billing.md:14 +#: ./docs/master/billing.md:14 +msgid "[Selling Products](#quickstart-selling-products)" +msgstr "" + +# P +#: ./docs/8.x/billing.md:14 +#: ./docs/9.x/billing.md:14 +#: ./docs/10.x/billing.md:16 +#: ./docs/11.x/billing.md:16 +#: ./docs/master/billing.md:16 msgid "[Customers](#customers)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/10.x/billing.md:15 +#: ./docs/11.x/billing.md:15 +#: ./docs/master/billing.md:15 +msgid "[Selling Subscriptions](#quickstart-selling-subscriptions)" +msgstr "" + +# P +#: ./docs/8.x/billing.md:15 +#: ./docs/9.x/billing.md:15 +#: ./docs/10.x/billing.md:17 +#: ./docs/11.x/billing.md:17 +#: ./docs/master/billing.md:17 msgid "[Retrieving Customers](#retrieving-customers)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:16 +#: ./docs/9.x/billing.md:16 +#: ./docs/10.x/billing.md:18 +#: ./docs/11.x/billing.md:18 +#: ./docs/master/billing.md:18 msgid "[Creating Customers](#creating-customers)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:17 +#: ./docs/9.x/billing.md:17 +#: ./docs/10.x/billing.md:19 +#: ./docs/11.x/billing.md:19 +#: ./docs/master/billing.md:19 msgid "[Updating Customers](#updating-customers)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:18 +#: ./docs/9.x/billing.md:18 +#: ./docs/10.x/billing.md:20 +#: ./docs/11.x/billing.md:20 +#: ./docs/master/billing.md:20 msgid "[Balances](#balances)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:19 +#: ./docs/9.x/billing.md:19 +#: ./docs/10.x/billing.md:21 +#: ./docs/11.x/billing.md:21 +#: ./docs/master/billing.md:21 msgid "[Tax IDs](#tax-ids)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:20 +#: ./docs/9.x/billing.md:20 +#: ./docs/10.x/billing.md:22 +#: ./docs/11.x/billing.md:22 +#: ./docs/master/billing.md:22 msgid "[Syncing Customer Data With Stripe](#syncing-customer-data-with-stripe)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:21 +#: ./docs/9.x/billing.md:21 +#: ./docs/10.x/billing.md:23 +#: ./docs/11.x/billing.md:23 +#: ./docs/master/billing.md:23 msgid "[Billing Portal](#billing-portal)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:22 +#: ./docs/9.x/billing.md:22 +#: ./docs/10.x/billing.md:24 +#: ./docs/11.x/billing.md:24 +#: ./docs/master/billing.md:24 msgid "[Payment Methods](#payment-methods)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:23 +#: ./docs/9.x/billing.md:23 +#: ./docs/10.x/billing.md:25 +#: ./docs/11.x/billing.md:25 +#: ./docs/master/billing.md:25 msgid "[Storing Payment Methods](#storing-payment-methods)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:24 +#: ./docs/9.x/billing.md:24 +#: ./docs/10.x/billing.md:26 +#: ./docs/11.x/billing.md:26 +#: ./docs/master/billing.md:26 msgid "[Retrieving Payment Methods](#retrieving-payment-methods)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:25 +#: ./docs/9.x/billing.md:25 msgid "[Determining If A User Has A Payment Method](#check-for-a-payment-method)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:26 +#: ./docs/9.x/billing.md:26 msgid "[Updating The Default Payment Method](#updating-the-default-payment-method)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/10.x/billing.md:27 +#: ./docs/11.x/billing.md:27 +#: ./docs/master/billing.md:27 +msgid "[Payment Method Presence](#payment-method-presence)" +msgstr "" + +# P +#: ./docs/8.x/billing.md:27 +#: ./docs/9.x/billing.md:27 +#: ./docs/10.x/billing.md:29 +#: ./docs/11.x/billing.md:29 +#: ./docs/master/billing.md:29 msgid "[Adding Payment Methods](#adding-payment-methods)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/10.x/billing.md:28 +#: ./docs/11.x/billing.md:28 +#: ./docs/master/billing.md:28 +msgid "[Updating the Default Payment Method](#updating-the-default-payment-method)" +msgstr "" + +# P +#: ./docs/8.x/billing.md:28 +#: ./docs/9.x/billing.md:28 +#: ./docs/10.x/billing.md:30 +#: ./docs/11.x/billing.md:30 +#: ./docs/master/billing.md:30 msgid "[Deleting Payment Methods](#deleting-payment-methods)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:29 +#: ./docs/9.x/billing.md:29 +#: ./docs/10.x/billing.md:31 +#: ./docs/11.x/billing.md:31 +#: ./docs/master/billing.md:31 msgid "[Subscriptions](#subscriptions)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:30 +#: ./docs/9.x/billing.md:30 +#: ./docs/10.x/billing.md:32 +#: ./docs/11.x/billing.md:32 +#: ./docs/master/billing.md:32 msgid "[Creating Subscriptions](#creating-subscriptions)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:31 +#: ./docs/9.x/billing.md:31 +#: ./docs/10.x/billing.md:33 +#: ./docs/11.x/billing.md:33 +#: ./docs/master/billing.md:33 msgid "[Checking Subscription Status](#checking-subscription-status)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:32 +#: ./docs/9.x/billing.md:32 +#: ./docs/10.x/billing.md:34 +#: ./docs/11.x/billing.md:34 +#: ./docs/master/billing.md:34 msgid "[Changing Prices](#changing-prices)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:33 +#: ./docs/9.x/billing.md:33 +#: ./docs/10.x/billing.md:35 +#: ./docs/11.x/billing.md:35 +#: ./docs/master/billing.md:35 msgid "[Subscription Quantity](#subscription-quantity)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) -msgid "[Subscriptions With Multiple Products](#subscriptions-with-multiple-products)" +# P +#: ./docs/8.x/billing.md:34 +msgid "[Multiprice Subscriptions](#multiprice-subscriptions)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) -msgid "[Multiple Subscriptions](#multiple-subscriptions)" +# P +#: ./docs/9.x/billing.md:34 +#: ./docs/10.x/billing.md:36 +#: ./docs/11.x/billing.md:36 +#: ./docs/master/billing.md:36 +msgid "[Subscriptions With Multiple Products](#subscriptions-with-multiple-products)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:35 +#: ./docs/9.x/billing.md:36 +#: ./docs/10.x/billing.md:38 +#: ./docs/11.x/billing.md:38 +#: ./docs/master/billing.md:38 msgid "[Metered Billing](#metered-billing)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/9.x/billing.md:35 +#: ./docs/10.x/billing.md:37 +#: ./docs/11.x/billing.md:37 +#: ./docs/master/billing.md:37 +msgid "[Multiple Subscriptions](#multiple-subscriptions)" +msgstr "" + +# P +#: ./docs/8.x/billing.md:36 +#: ./docs/9.x/billing.md:37 +#: ./docs/10.x/billing.md:39 +#: ./docs/11.x/billing.md:39 +#: ./docs/master/billing.md:39 msgid "[Subscription Taxes](#subscription-taxes)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:37 +#: ./docs/9.x/billing.md:38 +#: ./docs/10.x/billing.md:40 +#: ./docs/11.x/billing.md:40 +#: ./docs/master/billing.md:40 msgid "[Subscription Anchor Date](#subscription-anchor-date)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:38 +#: ./docs/9.x/billing.md:39 +#: ./docs/10.x/billing.md:41 +#: ./docs/11.x/billing.md:41 +#: ./docs/master/billing.md:41 msgid "[Canceling Subscriptions](#cancelling-subscriptions)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:39 +#: ./docs/9.x/billing.md:40 +#: ./docs/10.x/billing.md:42 +#: ./docs/11.x/billing.md:42 +#: ./docs/master/billing.md:42 msgid "[Resuming Subscriptions](#resuming-subscriptions)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:40 +#: ./docs/9.x/billing.md:41 +#: ./docs/10.x/billing.md:43 +#: ./docs/11.x/billing.md:43 +#: ./docs/master/billing.md:43 msgid "[Subscription Trials](#subscription-trials)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:41 +#: ./docs/9.x/billing.md:42 +#: ./docs/10.x/billing.md:44 +#: ./docs/11.x/billing.md:44 +#: ./docs/master/billing.md:44 msgid "[With Payment Method Up Front](#with-payment-method-up-front)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:42 +#: ./docs/9.x/billing.md:43 +#: ./docs/10.x/billing.md:45 +#: ./docs/11.x/billing.md:45 +#: ./docs/master/billing.md:45 msgid "[Without Payment Method Up Front](#without-payment-method-up-front)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:43 +#: ./docs/9.x/billing.md:44 +#: ./docs/10.x/billing.md:46 +#: ./docs/11.x/billing.md:46 +#: ./docs/master/billing.md:46 msgid "[Extending Trials](#extending-trials)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:44 +#: ./docs/9.x/billing.md:45 +#: ./docs/10.x/billing.md:47 +#: ./docs/11.x/billing.md:47 +#: ./docs/master/billing.md:47 msgid "[Handling Stripe Webhooks](#handling-stripe-webhooks)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:45 +#: ./docs/9.x/billing.md:46 +#: ./docs/10.x/billing.md:48 +#: ./docs/11.x/billing.md:48 +#: ./docs/master/billing.md:48 msgid "[Defining Webhook Event Handlers](#defining-webhook-event-handlers)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:46 +#: ./docs/9.x/billing.md:47 +#: ./docs/10.x/billing.md:49 +#: ./docs/11.x/billing.md:49 +#: ./docs/master/billing.md:49 msgid "[Verifying Webhook Signatures](#verifying-webhook-signatures)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:47 +#: ./docs/9.x/billing.md:48 +#: ./docs/10.x/billing.md:50 +#: ./docs/11.x/billing.md:50 +#: ./docs/master/billing.md:50 msgid "[Single Charges](#single-charges)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:48 +#: ./docs/9.x/billing.md:49 +#: ./docs/10.x/billing.md:51 +#: ./docs/11.x/billing.md:51 +#: ./docs/master/billing.md:51 msgid "[Simple Charge](#simple-charge)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:49 +#: ./docs/9.x/billing.md:50 +#: ./docs/10.x/billing.md:52 +#: ./docs/11.x/billing.md:52 +#: ./docs/master/billing.md:52 msgid "[Charge With Invoice](#charge-with-invoice)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) -msgid "[Creating Payment Intents](#creating-payment-intents)" -msgstr "" - -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:50 +#: ./docs/9.x/billing.md:52 +#: ./docs/10.x/billing.md:54 +#: ./docs/11.x/billing.md:54 +#: ./docs/master/billing.md:54 msgid "[Refunding Charges](#refunding-charges)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:51 +#: ./docs/9.x/billing.md:53 +#: ./docs/10.x/billing.md:55 +#: ./docs/11.x/billing.md:55 +#: ./docs/master/billing.md:55 msgid "[Checkout](#checkout)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/9.x/billing.md:51 +#: ./docs/10.x/billing.md:53 +#: ./docs/11.x/billing.md:53 +#: ./docs/master/billing.md:53 +msgid "[Creating Payment Intents](#creating-payment-intents)" +msgstr "" + +# P +#: ./docs/8.x/billing.md:52 +#: ./docs/9.x/billing.md:54 +#: ./docs/10.x/billing.md:56 +#: ./docs/11.x/billing.md:56 +#: ./docs/master/billing.md:56 msgid "[Product Checkouts](#product-checkouts)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:53 +#: ./docs/9.x/billing.md:55 +#: ./docs/10.x/billing.md:57 +#: ./docs/11.x/billing.md:57 +#: ./docs/master/billing.md:57 msgid "[Single Charge Checkouts](#single-charge-checkouts)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:54 +#: ./docs/9.x/billing.md:56 +#: ./docs/10.x/billing.md:58 +#: ./docs/11.x/billing.md:58 +#: ./docs/master/billing.md:58 msgid "[Subscription Checkouts](#subscription-checkouts)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:55 +#: ./docs/9.x/billing.md:57 +#: ./docs/10.x/billing.md:59 +#: ./docs/11.x/billing.md:59 +#: ./docs/master/billing.md:59 msgid "[Collecting Tax IDs](#collecting-tax-ids)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) -msgid "[Guest Checkouts](#guest-checkouts)" -msgstr "" - -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:56 +#: ./docs/9.x/billing.md:59 +#: ./docs/10.x/billing.md:61 +#: ./docs/11.x/billing.md:61 +#: ./docs/master/billing.md:61 msgid "[Invoices](#invoices)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:57 +#: ./docs/9.x/billing.md:60 +#: ./docs/10.x/billing.md:62 +#: ./docs/11.x/billing.md:62 +#: ./docs/master/billing.md:62 msgid "[Retrieving Invoices](#retrieving-invoices)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:58 +#: ./docs/9.x/billing.md:61 +#: ./docs/10.x/billing.md:63 +#: ./docs/11.x/billing.md:63 +#: ./docs/master/billing.md:63 msgid "[Upcoming Invoices](#upcoming-invoices)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/9.x/billing.md:58 +#: ./docs/10.x/billing.md:60 +#: ./docs/11.x/billing.md:60 +#: ./docs/master/billing.md:60 +msgid "[Guest Checkouts](#guest-checkouts)" +msgstr "" + +# P +#: ./docs/8.x/billing.md:59 +#: ./docs/9.x/billing.md:62 +#: ./docs/10.x/billing.md:64 +#: ./docs/11.x/billing.md:64 +#: ./docs/master/billing.md:64 msgid "[Previewing Subscription Invoices](#previewing-subscription-invoices)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:60 +#: ./docs/9.x/billing.md:63 +#: ./docs/10.x/billing.md:65 +#: ./docs/11.x/billing.md:65 +#: ./docs/master/billing.md:65 msgid "[Generating Invoice PDFs](#generating-invoice-pdfs)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:61 +#: ./docs/9.x/billing.md:64 +#: ./docs/10.x/billing.md:66 +#: ./docs/11.x/billing.md:66 +#: ./docs/master/billing.md:66 msgid "[Handling Failed Payments](#handling-failed-payments)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) -msgid "[Confirming Payments](#confirming-payments)" -msgstr "" - -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:62 +#: ./docs/9.x/billing.md:65 +#: ./docs/10.x/billing.md:68 +#: ./docs/11.x/billing.md:68 +#: ./docs/master/billing.md:68 msgid "[Strong Customer Authentication (SCA)](#strong-customer-authentication)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:63 +#: ./docs/9.x/billing.md:66 +#: ./docs/10.x/billing.md:69 +#: ./docs/11.x/billing.md:69 +#: ./docs/master/billing.md:69 msgid "[Payments Requiring Additional Confirmation](#payments-requiring-additional-confirmation)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:64 +#: ./docs/9.x/billing.md:67 +#: ./docs/10.x/billing.md:70 +#: ./docs/11.x/billing.md:70 +#: ./docs/master/billing.md:70 msgid "[Off-session Payment Notifications](#off-session-payment-notifications)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:65 +#: ./docs/9.x/billing.md:68 +#: ./docs/10.x/billing.md:71 +#: ./docs/11.x/billing.md:71 +#: ./docs/master/billing.md:71 msgid "[Stripe SDK](#stripe-sdk)" msgstr "" -#: docs/10.x/billing.md:block 2 (unordered list) +# P +#: ./docs/8.x/billing.md:66 +#: ./docs/9.x/billing.md:69 +#: ./docs/10.x/billing.md:72 +#: ./docs/11.x/billing.md:72 +#: ./docs/master/billing.md:72 msgid "[Testing](#testing)" msgstr "" -#: docs/10.x/billing.md:block 4 (header) +# P +#: ./docs/10.x/billing.md:67 +#: ./docs/11.x/billing.md:67 +#: ./docs/master/billing.md:67 +msgid "[Confirming Payments](#confirming-payments)" +msgstr "" + +# P +#: ./docs/8.x/billing.md:68 +#: ./docs/9.x/billing.md:71 +#: ./docs/10.x/billing.md:74 +#: ./docs/11.x/billing.md:74 +#: ./docs/master/billing.md:74 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:69 +#: ./docs/9.x/billing.md:72 +#: ./docs/10.x/billing.md:75 +#: ./docs/11.x/billing.md:75 +#: ./docs/master/billing.md:75 msgid "Introduction" msgstr "" -#: docs/10.x/billing.md:block 5 (paragraph) +# P +#: ./docs/8.x/billing.md:71 +#: ./docs/9.x/billing.md:74 +#: ./docs/10.x/billing.md:77 +#: ./docs/11.x/billing.md:77 +#: ./docs/master/billing.md:77 msgid "[Laravel Cashier Stripe](https://github.com/laravel/cashier-stripe) provides an expressive, fluent interface to [Stripe's](https://stripe.com) subscription billing services. It handles almost all of the boilerplate subscription billing code you are dreading writing. In addition to basic subscription management, Cashier can handle coupons, swapping subscription, subscription \"quantities\", cancellation grace periods, and even generate invoice PDFs." msgstr "" -#: docs/10.x/billing.md:block 7 (header) +# P +#: ./docs/8.x/billing.md:73 +#: ./docs/9.x/billing.md:76 +#: ./docs/10.x/billing.md:79 +#: ./docs/11.x/billing.md:79 +#: ./docs/master/billing.md:79 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:74 +#: ./docs/9.x/billing.md:77 +#: ./docs/10.x/billing.md:80 +#: ./docs/11.x/billing.md:80 +#: ./docs/master/billing.md:80 msgid "Upgrading Cashier" msgstr "" -#: docs/10.x/billing.md:block 8 (paragraph) +# P +#: ./docs/8.x/billing.md:76 +#: ./docs/9.x/billing.md:79 +#: ./docs/10.x/billing.md:82 +#: ./docs/11.x/billing.md:82 +#: ./docs/master/billing.md:82 msgid "When upgrading to a new version of Cashier, it's important that you carefully review [the upgrade guide](https://github.com/laravel/cashier-stripe/blob/master/UPGRADE.md)." msgstr "" -#: docs/10.x/billing.md:block 9 (quote) -msgid "**Warning** To prevent breaking changes, Cashier uses a fixed Stripe API version. Cashier 14 utilizes Stripe API version `2022-11-15`. The Stripe API version will be updated on minor releases in order to make use of new Stripe features and improvements." +# P +#: ./docs/8.x/billing.md:78 +msgid "To prevent breaking changes, Cashier uses a fixed Stripe API version. Cashier 13 utilizes Stripe API version `2020-08-27`. The Stripe API version will be updated on minor releases in order to make use of new Stripe features and improvements." msgstr "" -#: docs/10.x/billing.md:block 11 (header) +# P +#: ./docs/8.x/billing.md:80 +#: ./docs/9.x/billing.md:84 +#: ./docs/10.x/billing.md:87 +#: ./docs/11.x/billing.md:87 +#: ./docs/master/billing.md:87 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:81 +#: ./docs/9.x/billing.md:85 +#: ./docs/10.x/billing.md:88 +#: ./docs/11.x/billing.md:88 +#: ./docs/master/billing.md:88 msgid "Installation" msgstr "" -#: docs/10.x/billing.md:block 12 (paragraph) +# P +#: ./docs/9.x/billing.md:82 +msgid "To prevent breaking changes, Cashier uses a fixed Stripe API version. Cashier 14 utilizes Stripe API version `2022-11-15`. The Stripe API version will be updated on minor releases in order to make use of new Stripe features and improvements." +msgstr "" + +# P +#: ./docs/8.x/billing.md:83 +#: ./docs/9.x/billing.md:87 +#: ./docs/10.x/billing.md:90 +#: ./docs/11.x/billing.md:90 +#: ./docs/master/billing.md:90 msgid "First, install the Cashier package for Stripe using the Composer package manager:" msgstr "" -#: docs/10.x/billing.md:block 13 (code) -msgid "composer require laravel/cashier\n" +# P +#: ./docs/10.x/billing.md:85 +#: ./docs/11.x/billing.md:85 +#: ./docs/master/billing.md:85 +msgid "To prevent breaking changes, Cashier uses a fixed Stripe API version. Cashier 15 utilizes Stripe API version `2023-10-16`. The Stripe API version will be updated on minor releases in order to make use of new Stripe features and improvements." +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/billing.md:85 +#: ./docs/9.x/billing.md:89 +#: ./docs/10.x/billing.md:92 +#: ./docs/11.x/billing.md:92 +#: ./docs/master/billing.md:92 +msgid "composer require laravel/cashier" msgstr "" -#: docs/10.x/billing.md:block 14 (quote) -msgid "**Warning** To ensure Cashier properly handles all Stripe events, remember to [set up Cashier's webhook handling](#handling-stripe-webhooks)." +# P +#: ./docs/8.x/billing.md:87 +#: ./docs/9.x/billing.md:94 +msgid "To ensure Cashier properly handles all Stripe events, remember to [set up Cashier's webhook handling](#handling-stripe-webhooks)." msgstr "" -#: docs/10.x/billing.md:block 16 (header) +# P +#: ./docs/8.x/billing.md:89 +#: ./docs/9.x/billing.md:96 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:90 +#: ./docs/9.x/billing.md:97 msgid "Database Migrations" msgstr "" -#: docs/10.x/billing.md:block 17 (paragraph) -msgid "Cashier's service provider registers its own database migration directory, so remember to migrate your database after installing the package. The Cashier migrations will add several columns to your `users` table. It will also create a new `subscriptions` table to hold all of your customer's subscriptions and a `subscription_items` table for subscriptions with multiple prices:" +# P +#: ./docs/8.x/billing.md:92 +#: ./docs/9.x/billing.md:99 +msgid "Cashier's service provider registers its own database migration directory, so remember to migrate your database after installing the package. The Cashier migrations will add several columns to your `users` table as well as create a new `subscriptions` table to hold all of your customer's subscriptions:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/billing.md:94 +#: ./docs/9.x/billing.md:101 +#: ./docs/10.x/billing.md:104 +#: ./docs/11.x/billing.md:104 +#: ./docs/master/billing.md:104 +msgid "php artisan migrate" msgstr "" -#: docs/10.x/billing.md:block 18 (code) -msgid "php artisan migrate\n" +# P +#: ./docs/10.x/billing.md:96 +#: ./docs/11.x/billing.md:96 +#: ./docs/master/billing.md:96 +msgid "After installing the package, publish Cashier's migrations using the `vendor:publish` Artisan command:" msgstr "" -#: docs/10.x/billing.md:block 19 (paragraph) +# P +#: ./docs/8.x/billing.md:96 +#: ./docs/9.x/billing.md:105 msgid "If you need to overwrite the migrations that ship with Cashier, you can publish them using the `vendor:publish` Artisan command:" msgstr "" -#: docs/10.x/billing.md:block 20 (code) -msgid "php artisan vendor:publish --tag=\"cashier-migrations\"\n" +# CODE +# CODE: shell +#: ./docs/8.x/billing.md:98 +#: ./docs/9.x/billing.md:107 +#: ./docs/10.x/billing.md:98 +#: ./docs/11.x/billing.md:98 +#: ./docs/master/billing.md:98 +msgid "php artisan vendor:publish --tag=\"cashier-migrations\"" msgstr "" -#: docs/10.x/billing.md:block 21 (paragraph) +# P +#: ./docs/8.x/billing.md:100 +#: ./docs/9.x/billing.md:111 msgid "If you would like to prevent Cashier's migrations from running entirely, you may use the `ignoreMigrations` method provided by Cashier. Typically, this method should be called in the `register` method of your `AppServiceProvider`:" msgstr "" -#: docs/10.x/billing.md:block 22 (code) +# P +#: ./docs/10.x/billing.md:102 +#: ./docs/11.x/billing.md:102 +#: ./docs/master/billing.md:102 +msgid "Then, migrate your database:" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:102 +#: ./docs/9.x/billing.md:113 msgid "use Laravel\\Cashier\\Cashier;\n\n" "/**\n" " * Register any application services.\n" +" *\n" +" * @return void\n" " */\n" -"public function register(): void\n" +"public function register()\n" "{\n" " Cashier::ignoreMigrations();\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/billing.md:108 +#: ./docs/11.x/billing.md:108 +#: ./docs/master/billing.md:108 +msgid "Cashier's migrations will add several columns to your `users` table. They will also create a new `subscriptions` table to hold all of your customer's subscriptions and a `subscription_items` table for subscriptions with multiple prices." +msgstr "" + +# P +#: ./docs/10.x/billing.md:110 +#: ./docs/11.x/billing.md:110 +#: ./docs/master/billing.md:110 +msgid "If you wish, you can also publish Cashier's configuration file using the `vendor:publish` Artisan command:" +msgstr "" + +# CODE: shell +#: ./docs/10.x/billing.md:112 +#: ./docs/11.x/billing.md:112 +#: ./docs/master/billing.md:112 +msgid "php artisan vendor:publish --tag=\"cashier-config\"" +msgstr "" + +# P +#: ./docs/8.x/billing.md:114 +#: ./docs/9.x/billing.md:126 +#: ./docs/10.x/billing.md:119 +#: ./docs/11.x/billing.md:119 +#: ./docs/master/billing.md:119 +msgid "Stripe recommends that any column used for storing Stripe identifiers should be case-sensitive. Therefore, you should ensure the column collation for the `stripe_id` column is set to `utf8_bin` when using MySQL. More information regarding this can be found in the [Stripe documentation](https://stripe.com/docs/upgrades#what-changes-does-stripe-consider-to-be-backwards-compatible)." msgstr "" -#: docs/10.x/billing.md:block 23 (quote) -msgid "**Warning** Stripe recommends that any column used for storing Stripe identifiers should be case-sensitive. Therefore, you should ensure the column collation for the `stripe_id` column is set to `utf8_bin` when using MySQL. More information regarding this can be found in the [Stripe documentation](https://stripe.com/docs/upgrades#what-changes-does-stripe-consider-to-be-backwards-compatible)." +# P +#: ./docs/10.x/billing.md:116 +#: ./docs/11.x/billing.md:116 +#: ./docs/master/billing.md:116 +msgid "Lastly, to ensure Cashier properly handles all Stripe events, remember to [configure Cashier's webhook handling](#handling-stripe-webhooks)." msgstr "" -#: docs/10.x/billing.md:block 25 (header) +# P +#: ./docs/8.x/billing.md:116 +#: ./docs/9.x/billing.md:128 +#: ./docs/10.x/billing.md:121 +#: ./docs/11.x/billing.md:121 +#: ./docs/master/billing.md:121 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:117 +#: ./docs/9.x/billing.md:129 +#: ./docs/10.x/billing.md:122 +#: ./docs/11.x/billing.md:122 +#: ./docs/master/billing.md:122 msgid "Configuration" msgstr "" -#: docs/10.x/billing.md:block 27 (header) +# P +#: ./docs/8.x/billing.md:119 +#: ./docs/9.x/billing.md:131 +#: ./docs/10.x/billing.md:124 +#: ./docs/11.x/billing.md:124 +#: ./docs/master/billing.md:124 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:120 +#: ./docs/9.x/billing.md:132 +#: ./docs/10.x/billing.md:125 +#: ./docs/11.x/billing.md:125 +#: ./docs/master/billing.md:125 msgid "Billable Model" msgstr "" -#: docs/10.x/billing.md:block 28 (paragraph) +# P +#: ./docs/8.x/billing.md:122 +#: ./docs/9.x/billing.md:134 +#: ./docs/10.x/billing.md:127 +#: ./docs/11.x/billing.md:127 +#: ./docs/master/billing.md:127 msgid "Before using Cashier, add the `Billable` trait to your billable model definition. Typically, this will be the `App\\Models\\User` model. This trait provides various methods to allow you to perform common billing tasks, such as creating subscriptions, applying coupons, and updating payment method information:" msgstr "" -#: docs/10.x/billing.md:block 29 (code) +# CODE +#: ./docs/8.x/billing.md:124 +#: ./docs/9.x/billing.md:136 +#: ./docs/10.x/billing.md:129 +#: ./docs/11.x/billing.md:129 +#: ./docs/master/billing.md:129 msgid "use Laravel\\Cashier\\Billable;\n\n" "class User extends Authenticatable\n" "{\n" " use Billable;\n" -"}\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 30 (paragraph) +# P +#: ./docs/8.x/billing.md:131 +#: ./docs/9.x/billing.md:143 +#: ./docs/10.x/billing.md:136 +#: ./docs/11.x/billing.md:136 +#: ./docs/master/billing.md:136 msgid "Cashier assumes your billable model will be the `App\\Models\\User` class that ships with Laravel. If you wish to change this you may specify a different model via the `useCustomerModel` method. This method should typically be called in the `boot` method of your `AppServiceProvider` class:" msgstr "" -#: docs/10.x/billing.md:block 31 (code) +# CODE +#: ./docs/8.x/billing.md:133 +#: ./docs/9.x/billing.md:145 msgid "use App\\Models\\Cashier\\User;\n" "use Laravel\\Cashier\\Cashier;\n\n" "/**\n" " * Bootstrap any application services.\n" +" *\n" +" * @return void\n" " */\n" -"public function boot(): void\n" +"public function boot()\n" "{\n" " Cashier::useCustomerModel(User::class);\n" -"}\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 32 (quote) -msgid "**Warning** If you're using a model other than Laravel's supplied `App\\Models\\User` model, you'll need to publish and alter the [Cashier migrations](#installation) provided to match your alternative model's table name." -msgstr "" - -#: docs/10.x/billing.md:block 34 (header) +# CODE +#: ./docs/10.x/billing.md:138 +#: ./docs/11.x/billing.md:138 +#: ./docs/master/billing.md:138 +msgid "use App\\Models\\Cashier\\User;\n" +"use Laravel\\Cashier\\Cashier;\n\n" +"/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Cashier::useCustomerModel(User::class);\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:146 +#: ./docs/9.x/billing.md:159 +#: ./docs/10.x/billing.md:150 +#: ./docs/11.x/billing.md:150 +#: ./docs/master/billing.md:150 +msgid "If you're using a model other than Laravel's supplied `App\\Models\\User` model, you'll need to publish and alter the [Cashier migrations](#installation) provided to match your alternative model's table name." +msgstr "" + +# P +#: ./docs/8.x/billing.md:148 +#: ./docs/9.x/billing.md:161 +#: ./docs/10.x/billing.md:152 +#: ./docs/11.x/billing.md:152 +#: ./docs/master/billing.md:152 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:149 +#: ./docs/9.x/billing.md:162 +#: ./docs/10.x/billing.md:153 +#: ./docs/11.x/billing.md:153 +#: ./docs/master/billing.md:153 msgid "API Keys" msgstr "" -#: docs/10.x/billing.md:block 35 (paragraph) +# P +#: ./docs/8.x/billing.md:151 +#: ./docs/9.x/billing.md:164 +#: ./docs/10.x/billing.md:155 +#: ./docs/11.x/billing.md:155 +#: ./docs/master/billing.md:155 msgid "Next, you should configure your Stripe API keys in your application's `.env` file. You can retrieve your Stripe API keys from the Stripe control panel:" msgstr "" -#: docs/10.x/billing.md:block 36 (code) +# CODE +#: ./docs/8.x/billing.md:153 msgid "STRIPE_KEY=your-stripe-key\n" -"STRIPE_SECRET=your-stripe-secret\n" -"STRIPE_WEBHOOK_SECRET=your-stripe-webhook-secret\n" -msgstr "" - -#: docs/10.x/billing.md:block 37 (quote) -msgid "**Warning** You should ensure that the `STRIPE_WEBHOOK_SECRET` environment variable is defined in your application's `.env` file, as this variable is used to ensure that incoming webhooks are actually from Stripe." -msgstr "" - -#: docs/10.x/billing.md:block 39 (header) +"STRIPE_SECRET=your-stripe-secret" +msgstr "" + +# P +#: ./docs/8.x/billing.md:156 +#: ./docs/9.x/billing.md:175 +#: ./docs/10.x/billing.md:166 +#: ./docs/11.x/billing.md:166 +#: ./docs/master/billing.md:166 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:157 +#: ./docs/9.x/billing.md:176 +#: ./docs/10.x/billing.md:167 +#: ./docs/11.x/billing.md:167 +#: ./docs/master/billing.md:167 msgid "Currency Configuration" msgstr "" -#: docs/10.x/billing.md:block 40 (paragraph) +# P +#: ./docs/8.x/billing.md:159 +#: ./docs/9.x/billing.md:178 +#: ./docs/10.x/billing.md:169 +#: ./docs/11.x/billing.md:169 +#: ./docs/master/billing.md:169 msgid "The default Cashier currency is United States Dollars (USD). You can change the default currency by setting the `CASHIER_CURRENCY` environment variable within your application's `.env` file:" msgstr "" -#: docs/10.x/billing.md:block 41 (code) -msgid "CASHIER_CURRENCY=eur\n" +# CODE +# CODE: ini +#: ./docs/8.x/billing.md:161 +#: ./docs/9.x/billing.md:180 +#: ./docs/10.x/billing.md:171 +#: ./docs/11.x/billing.md:171 +#: ./docs/master/billing.md:171 +msgid "CASHIER_CURRENCY=eur" msgstr "" -#: docs/10.x/billing.md:block 42 (paragraph) +# P +#: ./docs/8.x/billing.md:163 +#: ./docs/9.x/billing.md:184 +#: ./docs/10.x/billing.md:175 +#: ./docs/11.x/billing.md:175 +#: ./docs/master/billing.md:175 msgid "In addition to configuring Cashier's currency, you may also specify a locale to be used when formatting money values for display on invoices. Internally, Cashier utilizes [PHP's `NumberFormatter` class](https://www.php.net/manual/en/class.numberformatter.php) to set the currency locale:" msgstr "" -#: docs/10.x/billing.md:block 43 (code) -msgid "CASHIER_CURRENCY_LOCALE=nl_BE\n" -msgstr "" - -#: docs/10.x/billing.md:block 44 (quote) -msgid "**Warning** In order to use locales other than `en`, ensure the `ext-intl` PHP extension is installed and configured on your server." +# CODE +# CODE: ini +#: ./docs/8.x/billing.md:165 +#: ./docs/9.x/billing.md:186 +#: ./docs/10.x/billing.md:177 +#: ./docs/11.x/billing.md:177 +#: ./docs/master/billing.md:177 +msgid "CASHIER_CURRENCY_LOCALE=nl_BE" msgstr "" -#: docs/10.x/billing.md:block 46 (header) +# CODE: ini +#: ./docs/9.x/billing.md:166 +#: ./docs/10.x/billing.md:157 +#: ./docs/11.x/billing.md:157 +#: ./docs/master/billing.md:157 +msgid "STRIPE_KEY=your-stripe-key\n" +"STRIPE_SECRET=your-stripe-secret\n" +"STRIPE_WEBHOOK_SECRET=your-stripe-webhook-secret" +msgstr "" + +# P +#: ./docs/8.x/billing.md:167 +#: ./docs/9.x/billing.md:191 +#: ./docs/10.x/billing.md:182 +#: ./docs/11.x/billing.md:182 +#: ./docs/master/billing.md:182 +msgid "In order to use locales other than `en`, ensure the `ext-intl` PHP extension is installed and configured on your server." +msgstr "" + +# P +#: ./docs/8.x/billing.md:169 +#: ./docs/9.x/billing.md:193 +#: ./docs/10.x/billing.md:184 +#: ./docs/11.x/billing.md:184 +#: ./docs/master/billing.md:184 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:170 +#: ./docs/9.x/billing.md:194 +#: ./docs/10.x/billing.md:185 +#: ./docs/11.x/billing.md:185 +#: ./docs/master/billing.md:185 msgid "Tax Configuration" msgstr "" -#: docs/10.x/billing.md:block 47 (paragraph) +# P +#: ./docs/8.x/billing.md:172 +#: ./docs/9.x/billing.md:196 +#: ./docs/10.x/billing.md:187 +#: ./docs/11.x/billing.md:187 +#: ./docs/master/billing.md:187 msgid "Thanks to [Stripe Tax](https://stripe.com/tax), it's possible to automatically calculate taxes for all invoices generated by Stripe. You can enable automatic tax calculation by invoking the `calculateTaxes` method in the `boot` method of your application's `App\\Providers\\AppServiceProvider` class:" msgstr "" -#: docs/10.x/billing.md:block 48 (code) +# P +#: ./docs/9.x/billing.md:173 +#: ./docs/10.x/billing.md:164 +#: ./docs/11.x/billing.md:164 +#: ./docs/master/billing.md:164 +msgid "You should ensure that the `STRIPE_WEBHOOK_SECRET` environment variable is defined in your application's `.env` file, as this variable is used to ensure that incoming webhooks are actually from Stripe." +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:174 +#: ./docs/9.x/billing.md:198 msgid "use Laravel\\Cashier\\Cashier;\n\n" "/**\n" " * Bootstrap any application services.\n" +" *\n" +" * @return void\n" " */\n" -"public function boot(): void\n" +"public function boot()\n" "{\n" " Cashier::calculateTaxes();\n" -"}\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 49 (paragraph) +# P +#: ./docs/8.x/billing.md:186 +#: ./docs/9.x/billing.md:210 +#: ./docs/10.x/billing.md:199 +#: ./docs/11.x/billing.md:199 +#: ./docs/master/billing.md:199 msgid "Once tax calculation has been enabled, any new subscriptions and any one-off invoices that are generated will receive automatic tax calculation." msgstr "" -#: docs/10.x/billing.md:block 50 (paragraph) +# P +#: ./docs/8.x/billing.md:188 +#: ./docs/9.x/billing.md:212 +#: ./docs/10.x/billing.md:201 +#: ./docs/11.x/billing.md:201 +#: ./docs/master/billing.md:201 msgid "For this feature to work properly, your customer's billing details, such as the customer's name, address, and tax ID, need to be synced to Stripe. You may use the [customer data synchronization](#syncing-customer-data-with-stripe) and [Tax ID](#tax-ids) methods offered by Cashier to accomplish this." msgstr "" -#: docs/10.x/billing.md:block 51 (quote) -msgid "**Warning** No tax is calculated for [single charges](#single-charges) or [single charge checkouts](#single-charge-checkouts)." +# CODE +#: ./docs/10.x/billing.md:189 +#: ./docs/11.x/billing.md:189 +#: ./docs/master/billing.md:189 +msgid "use Laravel\\Cashier\\Cashier;\n\n" +"/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Cashier::calculateTaxes();\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:190 +msgid "Unfortunately, for now, no tax is calculated for [single charges](#single-charges) or [single charge checkouts](#single-charge-checkouts). In addition, Stripe Tax is currently \"invite-only\" during its beta period. You can request access to Stripe Tax via the [Stripe Tax website](https://stripe.com/tax#request-access)." msgstr "" -#: docs/10.x/billing.md:block 53 (header) +# P +#: ./docs/8.x/billing.md:192 +#: ./docs/9.x/billing.md:217 +#: ./docs/10.x/billing.md:206 +#: ./docs/11.x/billing.md:203 +#: ./docs/master/billing.md:206 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:193 +#: ./docs/9.x/billing.md:218 +#: ./docs/10.x/billing.md:207 +#: ./docs/11.x/billing.md:204 +#: ./docs/master/billing.md:207 msgid "Logging" msgstr "" -#: docs/10.x/billing.md:block 54 (paragraph) +# P +#: ./docs/8.x/billing.md:195 +#: ./docs/9.x/billing.md:220 +#: ./docs/10.x/billing.md:209 +#: ./docs/11.x/billing.md:206 +#: ./docs/master/billing.md:209 msgid "Cashier allows you to specify the log channel to be used when logging fatal Stripe errors. You may specify the log channel by defining the `CASHIER_LOGGER` environment variable within your application's `.env` file:" msgstr "" -#: docs/10.x/billing.md:block 55 (code) -msgid "CASHIER_LOGGER=stack\n" +# CODE +# CODE: ini +#: ./docs/8.x/billing.md:197 +#: ./docs/9.x/billing.md:222 +#: ./docs/10.x/billing.md:211 +#: ./docs/11.x/billing.md:208 +#: ./docs/master/billing.md:211 +msgid "CASHIER_LOGGER=stack" msgstr "" -#: docs/10.x/billing.md:block 56 (paragraph) +# P +#: ./docs/8.x/billing.md:199 +#: ./docs/9.x/billing.md:226 +#: ./docs/10.x/billing.md:215 +#: ./docs/11.x/billing.md:212 +#: ./docs/master/billing.md:215 msgid "Exceptions that are generated by API calls to Stripe will be logged through your application's default log channel." msgstr "" -#: docs/10.x/billing.md:block 58 (header) +# P +#: ./docs/8.x/billing.md:201 +#: ./docs/9.x/billing.md:228 +#: ./docs/10.x/billing.md:217 +#: ./docs/11.x/billing.md:214 +#: ./docs/master/billing.md:217 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:202 +#: ./docs/9.x/billing.md:229 +#: ./docs/10.x/billing.md:218 +#: ./docs/11.x/billing.md:215 +#: ./docs/master/billing.md:218 msgid "Using Custom Models" msgstr "" -#: docs/10.x/billing.md:block 59 (paragraph) +# P +#: ./docs/8.x/billing.md:204 +#: ./docs/9.x/billing.md:231 +#: ./docs/10.x/billing.md:220 +#: ./docs/11.x/billing.md:217 +#: ./docs/master/billing.md:220 msgid "You are free to extend the models used internally by Cashier by defining your own model and extending the corresponding Cashier model:" msgstr "" -#: docs/10.x/billing.md:block 60 (code) +# CODE +#: ./docs/8.x/billing.md:206 +#: ./docs/9.x/billing.md:233 +#: ./docs/10.x/billing.md:222 +#: ./docs/11.x/billing.md:219 +#: ./docs/master/billing.md:222 msgid "use Laravel\\Cashier\\Subscription as CashierSubscription;\n\n" "class Subscription extends CashierSubscription\n" "{\n" " // ...\n" -"}\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 61 (paragraph) +# P +#: ./docs/8.x/billing.md:213 +#: ./docs/9.x/billing.md:240 +#: ./docs/10.x/billing.md:229 +#: ./docs/11.x/billing.md:226 +#: ./docs/master/billing.md:229 msgid "After defining your model, you may instruct Cashier to use your custom model via the `Laravel\\Cashier\\Cashier` class. Typically, you should inform Cashier about your custom models in the `boot` method of your application's `App\\Providers\\AppServiceProvider` class:" msgstr "" -#: docs/10.x/billing.md:block 62 (code) +# CODE +#: ./docs/8.x/billing.md:215 +#: ./docs/9.x/billing.md:242 msgid "use App\\Models\\Cashier\\Subscription;\n" "use App\\Models\\Cashier\\SubscriptionItem;\n\n" "/**\n" " * Bootstrap any application services.\n" +" *\n" +" * @return void\n" " */\n" -"public function boot(): void\n" +"public function boot()\n" "{\n" " Cashier::useSubscriptionModel(Subscription::class);\n" " Cashier::useSubscriptionItemModel(SubscriptionItem::class);\n" -"}\n" -msgstr "" - -#: docs/10.x/billing.md:block 64 (header) +"}" +msgstr "" + +# P +#: ./docs/9.x/billing.md:215 +#: ./docs/10.x/billing.md:204 +#: ./docs/master/billing.md:204 +msgid "No tax is calculated for [single charges](#single-charges) or [single charge checkouts](#single-charge-checkouts)." +msgstr "" + +# P +#: ./docs/8.x/billing.md:229 +#: ./docs/9.x/billing.md:256 +#: ./docs/10.x/billing.md:441 +#: ./docs/11.x/billing.md:438 +#: ./docs/master/billing.md:441 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:230 +#: ./docs/9.x/billing.md:257 +#: ./docs/10.x/billing.md:442 +#: ./docs/11.x/billing.md:439 +#: ./docs/master/billing.md:442 msgid "Customers" msgstr "" -#: docs/10.x/billing.md:block 66 (header) +# CODE +#: ./docs/10.x/billing.md:231 +#: ./docs/11.x/billing.md:228 +#: ./docs/master/billing.md:231 +msgid "use App\\Models\\Cashier\\Subscription;\n" +"use App\\Models\\Cashier\\SubscriptionItem;\n\n" +"/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Cashier::useSubscriptionModel(Subscription::class);\n" +" Cashier::useSubscriptionItemModel(SubscriptionItem::class);\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:232 +#: ./docs/9.x/billing.md:259 +#: ./docs/10.x/billing.md:444 +#: ./docs/11.x/billing.md:441 +#: ./docs/master/billing.md:444 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:233 +#: ./docs/9.x/billing.md:260 +#: ./docs/10.x/billing.md:445 +#: ./docs/11.x/billing.md:442 +#: ./docs/master/billing.md:445 msgid "Retrieving Customers" msgstr "" -#: docs/10.x/billing.md:block 67 (paragraph) +# P +#: ./docs/8.x/billing.md:235 +#: ./docs/9.x/billing.md:262 +#: ./docs/10.x/billing.md:447 +#: ./docs/11.x/billing.md:444 +#: ./docs/master/billing.md:447 msgid "You can retrieve a customer by their Stripe ID using the `Cashier::findBillable` method. This method will return an instance of the billable model:" msgstr "" -#: docs/10.x/billing.md:block 68 (code) +# CODE +#: ./docs/8.x/billing.md:237 +#: ./docs/9.x/billing.md:264 +#: ./docs/10.x/billing.md:449 +#: ./docs/11.x/billing.md:446 +#: ./docs/master/billing.md:449 msgid "use Laravel\\Cashier\\Cashier;\n\n" -"$user = Cashier::findBillable($stripeId);\n" +"$user = Cashier::findBillable($stripeId);" +msgstr "" + +# P +#: ./docs/8.x/billing.md:241 +#: ./docs/9.x/billing.md:268 +#: ./docs/10.x/billing.md:453 +#: ./docs/11.x/billing.md:450 +#: ./docs/master/billing.md:453 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:242 +#: ./docs/9.x/billing.md:269 +#: ./docs/10.x/billing.md:454 +#: ./docs/11.x/billing.md:451 +#: ./docs/master/billing.md:454 +msgid "Creating Customers" msgstr "" -#: docs/10.x/billing.md:block 70 (header) -msgid "Creating Customers" +# P +#: ./docs/10.x/billing.md:243 +#: ./docs/11.x/billing.md:240 +#: ./docs/master/billing.md:243 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/billing.md:244 +#: ./docs/11.x/billing.md:241 +#: ./docs/master/billing.md:244 +msgid "Quickstart" msgstr "" -#: docs/10.x/billing.md:block 71 (paragraph) +# P +#: ./docs/8.x/billing.md:244 +#: ./docs/9.x/billing.md:271 +#: ./docs/10.x/billing.md:456 +#: ./docs/11.x/billing.md:453 +#: ./docs/master/billing.md:456 msgid "Occasionally, you may wish to create a Stripe customer without beginning a subscription. You may accomplish this using the `createAsStripeCustomer` method:" msgstr "" -#: docs/10.x/billing.md:block 72 (code) -msgid "$stripeCustomer = $user->createAsStripeCustomer();\n" +# P +#: ./docs/10.x/billing.md:246 +#: ./docs/11.x/billing.md:243 +#: ./docs/master/billing.md:246 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/8.x/billing.md:246 +#: ./docs/9.x/billing.md:273 +#: ./docs/10.x/billing.md:458 +#: ./docs/11.x/billing.md:455 +#: ./docs/master/billing.md:458 +msgid "$stripeCustomer = $user->createAsStripeCustomer();" msgstr "" -#: docs/10.x/billing.md:block 73 (paragraph) -msgid "Once the customer has been created in Stripe, you may begin a subscription at a later date. You may provide an optional `$options` array to pass in any additional [customer creation parameters that are supported by the Stripe API](https://stripe.com/docs/api/customers/create):" +# H3 +#: ./docs/10.x/billing.md:247 +#: ./docs/11.x/billing.md:244 +#: ./docs/master/billing.md:247 +msgid "Selling Products" msgstr "" -#: docs/10.x/billing.md:block 74 (code) -msgid "$stripeCustomer = $user->createAsStripeCustomer($options);\n" +# P +#: ./docs/8.x/billing.md:248 +#: ./docs/9.x/billing.md:275 +#: ./docs/10.x/billing.md:460 +#: ./docs/11.x/billing.md:457 +#: ./docs/master/billing.md:460 +msgid "Once the customer has been created in Stripe, you may begin a subscription at a later date. You may provide an optional `$options` array to pass in any additional [customer creation parameters that are supported by the Stripe API](https://stripe.com/docs/api/customers/create):" msgstr "" -#: docs/10.x/billing.md:block 75 (paragraph) +# P +#: ./docs/10.x/billing.md:250 +#: ./docs/10.x/billing.md:337 +#: ./docs/11.x/billing.md:247 +#: ./docs/11.x/billing.md:334 +#: ./docs/master/billing.md:250 +#: ./docs/master/billing.md:337 +msgid "Before utilizing Stripe Checkout, you should define Products with fixed prices in your Stripe dashboard. In addition, you should [configure Cashier's webhook handling](#handling-stripe-webhooks)." +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:250 +#: ./docs/9.x/billing.md:277 +#: ./docs/10.x/billing.md:462 +#: ./docs/11.x/billing.md:459 +#: ./docs/master/billing.md:462 +msgid "$stripeCustomer = $user->createAsStripeCustomer($options);" +msgstr "" + +# P +#: ./docs/10.x/billing.md:252 +#: ./docs/10.x/billing.md:339 +#: ./docs/11.x/billing.md:249 +#: ./docs/11.x/billing.md:336 +#: ./docs/master/billing.md:252 +#: ./docs/master/billing.md:339 +msgid "Offering product and subscription billing via your application can be intimidating. However, thanks to Cashier and [Stripe Checkout](https://stripe.com/payments/checkout), you can easily build modern, robust payment integrations." +msgstr "" + +# P +#: ./docs/8.x/billing.md:252 +#: ./docs/9.x/billing.md:279 +#: ./docs/10.x/billing.md:464 +#: ./docs/11.x/billing.md:461 +#: ./docs/master/billing.md:464 msgid "You may use the `asStripeCustomer` method if you want to return the Stripe customer object for a billable model:" msgstr "" -#: docs/10.x/billing.md:block 76 (code) -msgid "$stripeCustomer = $user->asStripeCustomer();\n" +# CODE +#: ./docs/11.x/billing.md:253 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/checkout', function (Request $request) {\n" +" $stripePriceId = 'price_deluxe_album';\n\n" +" $quantity = 1;\n\n" +" return $request->user()->checkout([$stripePriceId => $quantity], [\n" +" 'success_url' => route('checkout-success'),\n" +" 'cancel_url' => route('checkout-cancel'),\n" +" ]);\n" +"})->name('checkout');\n\n" +"Route::view('/checkout/success', 'checkout.success')->name('checkout-success');\n" +"Route::view('/checkout/cancel', 'checkout.cancel')->name('checkout-cancel');" msgstr "" -#: docs/10.x/billing.md:block 77 (paragraph) -msgid "The `createOrGetStripeCustomer` method may be used if you would like to retrieve the Stripe customer object for a given billable model but are not sure whether the billable model is already a customer within Stripe. This method will create a new customer in Stripe if one does not already exist:" +# P +#: ./docs/10.x/billing.md:254 +#: ./docs/11.x/billing.md:251 +#: ./docs/master/billing.md:254 +msgid "To charge customers for non-recurring, single-charge products, we'll utilize Cashier to direct customers to Stripe Checkout, where they will provide their payment details and confirm their purchase. Once the payment has been made via Checkout, the customer will be redirected to a success URL of your choosing within your application:" msgstr "" -#: docs/10.x/billing.md:block 78 (code) -msgid "$stripeCustomer = $user->createOrGetStripeCustomer();\n" +# CODE +#: ./docs/8.x/billing.md:254 +#: ./docs/9.x/billing.md:281 +#: ./docs/10.x/billing.md:466 +#: ./docs/11.x/billing.md:463 +#: ./docs/master/billing.md:466 +msgid "$stripeCustomer = $user->asStripeCustomer();" msgstr "" -#: docs/10.x/billing.md:block 80 (header) -msgid "Updating Customers" +# CODE +#: ./docs/10.x/billing.md:256 +#: ./docs/master/billing.md:256 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/checkout', function (Request $request) {\n" +" $stripePriceId = 'price_deluxe_album';\n\n" +" $quantity = 1;\n\n" +" return $request->user()->checkout([$stripePriceId => $quantity], [\n" +" 'success_url' => route('checkout-success'),\n" +" 'cancel_url' => route('checkout-cancel'),\n" +" ]);\n" +"})->name('checkout');\n\n" +"Route::view('checkout.success')->name('checkout-success');\n" +"Route::view('checkout.cancel')->name('checkout-cancel');" msgstr "" -#: docs/10.x/billing.md:block 81 (paragraph) -msgid "Occasionally, you may wish to update the Stripe customer directly with additional information. You may accomplish this using the `updateStripeCustomer` method. This method accepts an array of [customer update options supported by the Stripe API](https://stripe.com/docs/api/customers/update):" +# P +#: ./docs/8.x/billing.md:256 +#: ./docs/9.x/billing.md:283 +#: ./docs/10.x/billing.md:468 +#: ./docs/11.x/billing.md:465 +#: ./docs/master/billing.md:468 +msgid "The `createOrGetStripeCustomer` method may be used if you would like to retrieve the Stripe customer object for a given billable model but are not sure whether the billable model is already a customer within Stripe. This method will create a new customer in Stripe if one does not already exist:" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:258 +#: ./docs/9.x/billing.md:285 +#: ./docs/10.x/billing.md:470 +#: ./docs/11.x/billing.md:467 +#: ./docs/master/billing.md:470 +msgid "$stripeCustomer = $user->createOrGetStripeCustomer();" +msgstr "" + +# P +#: ./docs/8.x/billing.md:260 +#: ./docs/9.x/billing.md:287 +#: ./docs/10.x/billing.md:472 +#: ./docs/11.x/billing.md:469 +#: ./docs/master/billing.md:472 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:261 +#: ./docs/9.x/billing.md:288 +#: ./docs/10.x/billing.md:473 +#: ./docs/11.x/billing.md:470 +#: ./docs/master/billing.md:473 +msgid "Updating Customers" msgstr "" -#: docs/10.x/billing.md:block 82 (code) -msgid "$stripeCustomer = $user->updateStripeCustomer($options);\n" +# P +#: ./docs/8.x/billing.md:263 +#: ./docs/9.x/billing.md:290 +#: ./docs/10.x/billing.md:475 +#: ./docs/11.x/billing.md:472 +#: ./docs/master/billing.md:475 +msgid "Occasionally, you may wish to update the Stripe customer directly with additional information. You may accomplish this using the `updateStripeCustomer` method. This method accepts an array of [customer update options supported by the Stripe API](https://stripe.com/docs/api/customers/update):" msgstr "" -#: docs/10.x/billing.md:block 84 (header) +# CODE +#: ./docs/8.x/billing.md:265 +#: ./docs/9.x/billing.md:292 +#: ./docs/10.x/billing.md:477 +#: ./docs/11.x/billing.md:474 +#: ./docs/master/billing.md:477 +msgid "$stripeCustomer = $user->updateStripeCustomer($options);" +msgstr "" + +# P +#: ./docs/8.x/billing.md:267 +#: ./docs/9.x/billing.md:294 +#: ./docs/10.x/billing.md:479 +#: ./docs/11.x/billing.md:476 +#: ./docs/master/billing.md:479 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:268 +#: ./docs/9.x/billing.md:295 +#: ./docs/10.x/billing.md:480 +#: ./docs/11.x/billing.md:477 +#: ./docs/master/billing.md:480 msgid "Balances" msgstr "" -#: docs/10.x/billing.md:block 85 (paragraph) +# P +#: ./docs/8.x/billing.md:270 +#: ./docs/9.x/billing.md:297 +#: ./docs/10.x/billing.md:482 +#: ./docs/11.x/billing.md:479 +#: ./docs/master/billing.md:482 msgid "Stripe allows you to credit or debit a customer's \"balance\". Later, this balance will be credited or debited on new invoices. To check the customer's total balance you may use the `balance` method that is available on your billable model. The `balance` method will return a formatted string representation of the balance in the customer's currency:" msgstr "" -#: docs/10.x/billing.md:block 86 (code) -msgid "$balance = $user->balance();\n" +# P +#: ./docs/10.x/billing.md:272 +#: ./docs/11.x/billing.md:269 +#: ./docs/master/billing.md:272 +msgid "As you can see in the example above, we will utilize Cashier's provided `checkout` method to redirect the customer to Stripe Checkout for a given \"price identifier\". When using Stripe, \"prices\" refer to [defined prices for specific products](https://stripe.com/docs/products-prices/how-products-and-prices-work)." msgstr "" -#: docs/10.x/billing.md:block 87 (paragraph) -msgid "To credit a customer's balance, you may provide a value to the `creditBalance` method. If you wish, you may also provide a description:" +# CODE +#: ./docs/8.x/billing.md:272 +#: ./docs/9.x/billing.md:299 +#: ./docs/10.x/billing.md:484 +#: ./docs/11.x/billing.md:481 +#: ./docs/master/billing.md:484 +msgid "$balance = $user->balance();" msgstr "" -#: docs/10.x/billing.md:block 88 (code) -msgid "$user->creditBalance(500, 'Premium customer top-up.');\n" +# P +#: ./docs/10.x/billing.md:274 +#: ./docs/11.x/billing.md:271 +#: ./docs/master/billing.md:274 +msgid "If necessary, the `checkout` method will automatically create a customer in Stripe and connect that Stripe customer record to the corresponding user in your application's database. After completing the checkout session, the customer will be redirected to a dedicated success or cancellation page where you can display an informational message to the customer." msgstr "" -#: docs/10.x/billing.md:block 89 (paragraph) -msgid "Providing a value to the `debitBalance` method will debit the customer's balance:" +# P +#: ./docs/8.x/billing.md:274 +msgid "To credit a customer's balance, you may provide a negative value to the `applyBalance` method. If you wish, you may also provide a description:" +msgstr "" + +# P +#: ./docs/10.x/billing.md:276 +#: ./docs/11.x/billing.md:273 +#: ./docs/master/billing.md:276 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/8.x/billing.md:276 +msgid "$user->applyBalance(-500, 'Premium customer top-up.');" +msgstr "" + +# H4 +#: ./docs/10.x/billing.md:277 +#: ./docs/11.x/billing.md:274 +#: ./docs/master/billing.md:277 +msgid "Providing Meta Data to Stripe Checkout" +msgstr "" + +# P +#: ./docs/8.x/billing.md:278 +msgid "Providing a positive value to the `applyBalance` method will debit the customer's balance:" +msgstr "" + +# P +#: ./docs/10.x/billing.md:279 +#: ./docs/11.x/billing.md:276 +#: ./docs/master/billing.md:279 +msgid "When selling products, it's common to keep track of completed orders and purchased products via `Cart` and `Order` models defined by your own application. When redirecting customers to Stripe Checkout to complete a purchase, you may need to provide an existing order identifier so that you can associate the completed purchase with the corresponding order when the customer is redirected back to your application." +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:280 +msgid "$user->applyBalance(300, 'Bad usage penalty.');" msgstr "" -#: docs/10.x/billing.md:block 90 (code) -msgid "$user->debitBalance(300, 'Bad usage penalty.');\n" +# P +#: ./docs/10.x/billing.md:281 +#: ./docs/11.x/billing.md:278 +#: ./docs/master/billing.md:281 +msgid "To accomplish this, you may provide an array of `metadata` to the `checkout` method. Let's imagine that a pending `Order` is created within our application when a user begins the checkout process. Remember, the `Cart` and `Order` models in this example are illustrative and not provided by Cashier. You are free to implement these concepts based on the needs of your own application:" msgstr "" -#: docs/10.x/billing.md:block 91 (paragraph) +# P +#: ./docs/8.x/billing.md:282 +#: ./docs/9.x/billing.md:309 +#: ./docs/10.x/billing.md:494 +#: ./docs/11.x/billing.md:491 +#: ./docs/master/billing.md:494 msgid "The `applyBalance` method will create new customer balance transactions for the customer. You may retrieve these transaction records using the `balanceTransactions` method, which may be useful in order to provide a log of credits and debits for the customer to review:" msgstr "" -#: docs/10.x/billing.md:block 92 (code) +# CODE +#: ./docs/10.x/billing.md:283 +#: ./docs/11.x/billing.md:280 +#: ./docs/master/billing.md:283 +msgid "use App\\Models\\Cart;\n" +"use App\\Models\\Order;\n" +"use Illuminate\\Http\\Request;\n\n" +"Route::get('/cart/{cart}/checkout', function (Request $request, Cart $cart) {\n" +" $order = Order::create([\n" +" 'cart_id' => $cart->id,\n" +" 'price_ids' => $cart->price_ids,\n" +" 'status' => 'incomplete',\n" +" ]);\n\n" +" return $request->user()->checkout($order->price_ids, [\n" +" 'success_url' => route('checkout-success').'?session_id={CHECKOUT_SESSION_ID}',\n" +" 'cancel_url' => route('checkout-cancel'),\n" +" 'metadata' => ['order_id' => $order->id],\n" +" ]);\n" +"})->name('checkout');" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:284 +#: ./docs/9.x/billing.md:311 +#: ./docs/10.x/billing.md:496 +#: ./docs/11.x/billing.md:493 +#: ./docs/master/billing.md:496 msgid "// Retrieve all transactions...\n" "$transactions = $user->balanceTransactions();\n\n" "foreach ($transactions as $transaction) {\n" @@ -630,191 +1733,700 @@ msgid "// Retrieve all transactions...\n" " $amount = $transaction->amount(); // $2.31\n\n" " // Retrieve the related invoice when available...\n" " $invoice = $transaction->invoice();\n" -"}\n" -msgstr "" - -#: docs/10.x/billing.md:block 94 (header) +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:295 +#: ./docs/9.x/billing.md:322 +#: ./docs/10.x/billing.md:507 +#: ./docs/11.x/billing.md:504 +#: ./docs/master/billing.md:507 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:296 +#: ./docs/9.x/billing.md:323 +#: ./docs/10.x/billing.md:508 +#: ./docs/11.x/billing.md:505 +#: ./docs/master/billing.md:508 msgid "Tax IDs" msgstr "" -#: docs/10.x/billing.md:block 95 (paragraph) +# P +#: ./docs/8.x/billing.md:298 +#: ./docs/9.x/billing.md:325 +#: ./docs/10.x/billing.md:510 +#: ./docs/11.x/billing.md:507 +#: ./docs/master/billing.md:510 msgid "Cashier offers an easy way to manage a customer's tax IDs. For example, the `taxIds` method may be used to retrieve all of the [tax IDs](https://stripe.com/docs/api/customer_tax_ids/object) that are assigned to a customer as a collection:" msgstr "" -#: docs/10.x/billing.md:block 96 (code) -msgid "$taxIds = $user->taxIds();\n" +# CODE +#: ./docs/8.x/billing.md:300 +#: ./docs/9.x/billing.md:327 +#: ./docs/10.x/billing.md:512 +#: ./docs/11.x/billing.md:509 +#: ./docs/master/billing.md:512 +msgid "$taxIds = $user->taxIds();" +msgstr "" + +# P +#: ./docs/10.x/billing.md:301 +#: ./docs/11.x/billing.md:298 +#: ./docs/master/billing.md:301 +msgid "As you can see in the example above, when a user begins the checkout process, we will provide all of the cart / order's associated Stripe price identifiers to the `checkout` method. Of course, your application is responsible for associating these items with the \"shopping cart\" or order as a customer adds them. We also provide the order's ID to the Stripe Checkout session via the `metadata` array. Finally, we have added the `CHECKOUT_SESSION_ID` template variable to the Checkout success route. When Stripe redirects customers back to your application, this template variable will automatically be populated with the Checkout session ID." +msgstr "" + +# P +#: ./docs/9.x/billing.md:301 +#: ./docs/10.x/billing.md:486 +#: ./docs/11.x/billing.md:483 +#: ./docs/master/billing.md:486 +msgid "To credit a customer's balance, you may provide a value to the `creditBalance` method. If you wish, you may also provide a description:" msgstr "" -#: docs/10.x/billing.md:block 97 (paragraph) +# P +#: ./docs/8.x/billing.md:302 +#: ./docs/9.x/billing.md:329 +#: ./docs/10.x/billing.md:514 +#: ./docs/11.x/billing.md:511 +#: ./docs/master/billing.md:514 msgid "You can also retrieve a specific tax ID for a customer by its identifier:" msgstr "" -#: docs/10.x/billing.md:block 98 (code) -msgid "$taxId = $user->findTaxId('txi_belgium');\n" +# P +#: ./docs/10.x/billing.md:303 +#: ./docs/11.x/billing.md:300 +#: ./docs/master/billing.md:303 +msgid "Next, let's build the Checkout success route. This is the route that users will be redirected to after their purchase has been completed via Stripe Checkout. Within this route, we can retrieve the Stripe Checkout session ID and the associated Stripe Checkout instance in order to access our provided meta data and update our customer's order accordingly:" +msgstr "" + +# CODE +#: ./docs/9.x/billing.md:303 +#: ./docs/10.x/billing.md:488 +#: ./docs/11.x/billing.md:485 +#: ./docs/master/billing.md:488 +msgid "$user->creditBalance(500, 'Premium customer top-up.');" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:304 +#: ./docs/9.x/billing.md:331 +#: ./docs/10.x/billing.md:516 +#: ./docs/11.x/billing.md:513 +#: ./docs/master/billing.md:516 +msgid "$taxId = $user->findTaxId('txi_belgium');" +msgstr "" + +# CODE +#: ./docs/10.x/billing.md:305 +#: ./docs/11.x/billing.md:302 +#: ./docs/master/billing.md:305 +msgid "use App\\Models\\Order;\n" +"use Illuminate\\Http\\Request;\n" +"use Laravel\\Cashier\\Cashier;\n\n" +"Route::get('/checkout/success', function (Request $request) {\n" +" $sessionId = $request->get('session_id');\n\n" +" if ($sessionId === null) {\n" +" return;\n" +" }\n\n" +" $session = Cashier::stripe()->checkout->sessions->retrieve($sessionId);\n\n" +" if ($session->payment_status !== 'paid') {\n" +" return;\n" +" }\n\n" +" $orderId = $session['metadata']['order_id'] ?? null;\n\n" +" $order = Order::findOrFail($orderId);\n\n" +" $order->update(['status' => 'completed']);\n\n" +" return view('checkout-success', ['order' => $order]);\n" +"})->name('checkout-success');" +msgstr "" + +# P +#: ./docs/9.x/billing.md:305 +#: ./docs/10.x/billing.md:490 +#: ./docs/11.x/billing.md:487 +#: ./docs/master/billing.md:490 +msgid "Providing a value to the `debitBalance` method will debit the customer's balance:" msgstr "" -#: docs/10.x/billing.md:block 99 (paragraph) +# P +#: ./docs/8.x/billing.md:306 +#: ./docs/9.x/billing.md:333 +#: ./docs/10.x/billing.md:518 +#: ./docs/11.x/billing.md:515 +#: ./docs/master/billing.md:518 msgid "You may create a new Tax ID by providing a valid [type](https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-type) and value to the `createTaxId` method:" msgstr "" -#: docs/10.x/billing.md:block 100 (code) -msgid "$taxId = $user->createTaxId('eu_vat', 'BE0123456789');\n" +# CODE +#: ./docs/9.x/billing.md:307 +#: ./docs/10.x/billing.md:492 +#: ./docs/11.x/billing.md:489 +#: ./docs/master/billing.md:492 +msgid "$user->debitBalance(300, 'Bad usage penalty.');" msgstr "" -#: docs/10.x/billing.md:block 101 (paragraph) -msgid "The `createTaxId` method will immediately add the VAT ID to the customer's account. [Verification of VAT IDs is also done by Stripe](https://stripe.com/docs/invoicing/customer/tax-ids#validation); however, this is an asynchronous process. You can be notified of verification updates by subscribing to the `customer.tax_id.updated` webhook event and inspecting [the VAT IDs `verification` parameter](https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-verification). For more information on handling webhooks, please consult the [documentation on defining webhook handlers](#handling-stripe-webhooks)." +# CODE +#: ./docs/8.x/billing.md:308 +#: ./docs/9.x/billing.md:335 +#: ./docs/10.x/billing.md:520 +#: ./docs/11.x/billing.md:517 +#: ./docs/master/billing.md:520 +msgid "$taxId = $user->createTaxId('eu_vat', 'BE0123456789');" msgstr "" -#: docs/10.x/billing.md:block 102 (paragraph) -msgid "You may delete a tax ID using the `deleteTaxId` method:" +# P +#: ./docs/8.x/billing.md:310 +#: ./docs/9.x/billing.md:337 +#: ./docs/10.x/billing.md:522 +#: ./docs/11.x/billing.md:519 +#: ./docs/master/billing.md:522 +msgid "The `createTaxId` method will immediately add the VAT ID to the customer's account. [Verification of VAT IDs is also done by Stripe](https://stripe.com/docs/invoicing/customer/tax-ids#validation); however, this is an asynchronous process. You can be notified of verification updates by subscribing to the `customer.tax_id.updated` webhook event and inspecting [the VAT IDs `verification` parameter](https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-verification). For more information on handling webhooks, please consult the [documentation on defining webhook handlers](#handling-stripe-webhooks)." msgstr "" -#: docs/10.x/billing.md:block 103 (code) -msgid "$user->deleteTaxId('txi_belgium');\n" +# P +#: ./docs/8.x/billing.md:312 +#: ./docs/9.x/billing.md:339 +#: ./docs/10.x/billing.md:524 +#: ./docs/11.x/billing.md:521 +#: ./docs/master/billing.md:524 +msgid "You may delete a tax ID using the `deleteTaxId` method:" msgstr "" -#: docs/10.x/billing.md:block 105 (header) +# CODE +#: ./docs/8.x/billing.md:314 +#: ./docs/9.x/billing.md:341 +#: ./docs/10.x/billing.md:526 +#: ./docs/11.x/billing.md:523 +#: ./docs/master/billing.md:526 +msgid "$user->deleteTaxId('txi_belgium');" +msgstr "" + +# P +#: ./docs/8.x/billing.md:316 +#: ./docs/9.x/billing.md:343 +#: ./docs/10.x/billing.md:528 +#: ./docs/11.x/billing.md:525 +#: ./docs/master/billing.md:528 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:317 +#: ./docs/9.x/billing.md:344 +#: ./docs/10.x/billing.md:529 +#: ./docs/11.x/billing.md:526 +#: ./docs/master/billing.md:529 msgid "Syncing Customer Data With Stripe" msgstr "" -#: docs/10.x/billing.md:block 106 (paragraph) +# P +#: ./docs/8.x/billing.md:319 +#: ./docs/9.x/billing.md:346 +#: ./docs/10.x/billing.md:531 +#: ./docs/11.x/billing.md:528 +#: ./docs/master/billing.md:531 msgid "Typically, when your application's users update their name, email address, or other information that is also stored by Stripe, you should inform Stripe of the updates. By doing so, Stripe's copy of the information will be in sync with your application's." msgstr "" -#: docs/10.x/billing.md:block 107 (paragraph) +# P +#: ./docs/8.x/billing.md:321 +#: ./docs/9.x/billing.md:348 +#: ./docs/10.x/billing.md:533 +#: ./docs/11.x/billing.md:530 +#: ./docs/master/billing.md:533 msgid "To automate this, you may define an event listener on your billable model that reacts to the model's `updated` event. Then, within your event listener, you may invoke the `syncStripeCustomerDetails` method on the model:" msgstr "" -#: docs/10.x/billing.md:block 108 (code) -msgid "use App\\Models\\User;\n" -"use function Illuminate\\Events\\queueable;\n\n" +# CODE +#: ./docs/8.x/billing.md:323 +#: ./docs/9.x/billing.md:350 +msgid "use function Illuminate\\Events\\queueable;\n\n" "/**\n" " * The \"booted\" method of the model.\n" +" *\n" +" * @return void\n" " */\n" -"protected static function booted(): void\n" +"protected static function booted()\n" "{\n" -" static::updated(queueable(function (User $customer) {\n" +" static::updated(queueable(function ($customer) {\n" " if ($customer->hasStripeId()) {\n" " $customer->syncStripeCustomerDetails();\n" " }\n" " }));\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/billing.md:331 +#: ./docs/11.x/billing.md:328 +#: ./docs/master/billing.md:331 +msgid "Please refer to Stripe's documentation for more information on the [data contained by the Checkout session object](https://stripe.com/docs/api/checkout/sessions/object)." +msgstr "" + +# P +#: ./docs/10.x/billing.md:333 +#: ./docs/11.x/billing.md:330 +#: ./docs/master/billing.md:333 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/billing.md:334 +#: ./docs/11.x/billing.md:331 +#: ./docs/master/billing.md:334 +msgid "Selling Subscriptions" msgstr "" -#: docs/10.x/billing.md:block 109 (paragraph) +# P +#: ./docs/8.x/billing.md:339 +#: ./docs/9.x/billing.md:366 +#: ./docs/10.x/billing.md:550 +#: ./docs/11.x/billing.md:547 +#: ./docs/master/billing.md:550 msgid "Now, every time your customer model is updated, its information will be synced with Stripe. For convenience, Cashier will automatically sync your customer's information with Stripe on the initial creation of the customer." msgstr "" -#: docs/10.x/billing.md:block 110 (paragraph) +# P +#: ./docs/10.x/billing.md:341 +#: ./docs/11.x/billing.md:338 +#: ./docs/master/billing.md:341 +msgid "To learn how to sell subscriptions using Cashier and Stripe Checkout, let's consider the simple scenario of a subscription service with a basic monthly (`price_basic_monthly`) and yearly (`price_basic_yearly`) plan. These two prices could be grouped under a \"Basic\" product (`pro_basic`) in our Stripe dashboard. In addition, our subscription service might offer an Expert plan as `pro_expert`." +msgstr "" + +# P +#: ./docs/8.x/billing.md:341 +#: ./docs/9.x/billing.md:368 +#: ./docs/10.x/billing.md:552 +#: ./docs/11.x/billing.md:549 +#: ./docs/master/billing.md:552 msgid "You may customize the columns used for syncing customer information to Stripe by overriding a variety of methods provided by Cashier. For example, you may override the `stripeName` method to customize the attribute that should be considered the customer's \"name\" when Cashier syncs customer information to Stripe:" msgstr "" -#: docs/10.x/billing.md:block 111 (code) +# P +#: ./docs/10.x/billing.md:343 +#: ./docs/11.x/billing.md:340 +#: ./docs/master/billing.md:343 +msgid "First, let's discover how a customer can subscribe to our services. Of course, you can imagine the customer might click a \"subscribe\" button for the Basic plan on our application's pricing page. This button or link should direct the user to a Laravel route which creates the Stripe Checkout session for their chosen plan:" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:343 +#: ./docs/9.x/billing.md:370 msgid "/**\n" " * Get the customer name that should be synced to Stripe.\n" +" *\n" +" * @return string|null\n" " */\n" -"public function stripeName(): string|null\n" +"public function stripeName()\n" "{\n" " return $this->company_name;\n" -"}\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 112 (paragraph) -msgid "Similarly, you may override the `stripeEmail`, `stripePhone`, `stripeAddress`, and `stripePreferredLocales` methods. These methods will sync information to their corresponding customer parameters when [updating the Stripe customer object](https://stripe.com/docs/api/customers/update). If you wish to take total control over the customer information sync process, you may override the `syncStripeCustomerDetails` method." +# CODE +#: ./docs/10.x/billing.md:345 +#: ./docs/11.x/billing.md:342 +#: ./docs/master/billing.md:345 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/subscription-checkout', function (Request $request) {\n" +" return $request->user()\n" +" ->newSubscription('default', 'price_basic_monthly')\n" +" ->trialDays(5)\n" +" ->allowPromotionCodes()\n" +" ->checkout([\n" +" 'success_url' => route('your-success-route'),\n" +" 'cancel_url' => route('your-cancel-route'),\n" +" ]);\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/billing.md:353 +msgid "Similarly, you may override the `stripeEmail`, `stripePhone`, and `stripeAddress` methods. These methods will sync information to their corresponding customer parameters when [updating the Stripe customer object](https://stripe.com/docs/api/customers/update). If you wish to take total control over the customer information sync process, you may override the `syncStripeCustomerDetails` method." msgstr "" -#: docs/10.x/billing.md:block 114 (header) +# P +#: ./docs/8.x/billing.md:355 +#: ./docs/9.x/billing.md:382 +#: ./docs/10.x/billing.md:564 +#: ./docs/11.x/billing.md:561 +#: ./docs/master/billing.md:564 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:356 +#: ./docs/9.x/billing.md:383 +#: ./docs/10.x/billing.md:565 +#: ./docs/11.x/billing.md:562 +#: ./docs/master/billing.md:565 msgid "Billing Portal" msgstr "" -#: docs/10.x/billing.md:block 115 (paragraph) +# P +#: ./docs/10.x/billing.md:358 +#: ./docs/11.x/billing.md:355 +#: ./docs/master/billing.md:358 +msgid "As you can see in the example above, we will redirect the customer to a Stripe Checkout session which will allow them to subscribe to our Basic plan. After a successful checkout or cancellation, the customer will be redirected back to the URL we provided to the `checkout` method. To know when their subscription has actually started (since some payment methods require a few seconds to process), we'll also need to [configure Cashier's webhook handling](#handling-stripe-webhooks)." +msgstr "" + +# P +#: ./docs/8.x/billing.md:358 +#: ./docs/9.x/billing.md:385 +#: ./docs/10.x/billing.md:567 +#: ./docs/11.x/billing.md:564 +#: ./docs/master/billing.md:567 msgid "Stripe offers [an easy way to set up a billing portal](https://stripe.com/docs/billing/subscriptions/customer-portal) so that your customer can manage their subscription, payment methods, and view their billing history. You can redirect your users to the billing portal by invoking the `redirectToBillingPortal` method on the billable model from a controller or route:" msgstr "" -#: docs/10.x/billing.md:block 116 (code) +# P +#: ./docs/10.x/billing.md:360 +#: ./docs/11.x/billing.md:357 +#: ./docs/master/billing.md:360 +msgid "Now that customers can start subscriptions, we need to restrict certain portions of our application so that only subscribed users can access them. Of course, we can always determine a user's current subscription status via the `subscribed` method provided by Cashier's `Billable` trait:" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:360 +#: ./docs/9.x/billing.md:387 +#: ./docs/10.x/billing.md:569 +#: ./docs/11.x/billing.md:566 +#: ./docs/master/billing.md:569 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/billing-portal', function (Request $request) {\n" " return $request->user()->redirectToBillingPortal();\n" -"});\n" +"});" msgstr "" -#: docs/10.x/billing.md:block 117 (paragraph) +# CODE: blade +#: ./docs/10.x/billing.md:362 +#: ./docs/11.x/billing.md:359 +#: ./docs/master/billing.md:362 +msgid "@if ($user->subscribed())\n" +"

You are subscribed.

\n" +"@endif" +msgstr "" + +# P +#: ./docs/8.x/billing.md:366 +#: ./docs/9.x/billing.md:393 +#: ./docs/10.x/billing.md:575 +#: ./docs/11.x/billing.md:572 +#: ./docs/master/billing.md:575 msgid "By default, when the user is finished managing their subscription, they will be able to return to the `home` route of your application via a link within the Stripe billing portal. You may provide a custom URL that the user should return to by passing the URL as an argument to the `redirectToBillingPortal` method:" msgstr "" -#: docs/10.x/billing.md:block 118 (code) +# P +#: ./docs/10.x/billing.md:368 +#: ./docs/11.x/billing.md:365 +#: ./docs/master/billing.md:368 +msgid "We can even easily determine if a user is subscribed to specific product or price:" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:368 +#: ./docs/9.x/billing.md:395 +#: ./docs/10.x/billing.md:577 +#: ./docs/11.x/billing.md:574 +#: ./docs/master/billing.md:577 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/billing-portal', function (Request $request) {\n" " return $request->user()->redirectToBillingPortal(route('billing'));\n" -"});\n" -msgstr "" - -#: docs/10.x/billing.md:block 119 (paragraph) +"});" +msgstr "" + +# CODE: blade +#: ./docs/10.x/billing.md:370 +#: ./docs/11.x/billing.md:367 +#: ./docs/master/billing.md:370 +msgid "@if ($user->subscribedToProduct('pro_basic'))\n" +"

You are subscribed to our Basic product.

\n" +"@endif\n\n" +"@if ($user->subscribedToPrice('price_basic_monthly'))\n" +"

You are subscribed to our monthly Basic plan.

\n" +"@endif" +msgstr "" + +# P +#: ./docs/8.x/billing.md:374 +#: ./docs/9.x/billing.md:401 +#: ./docs/10.x/billing.md:583 +#: ./docs/11.x/billing.md:580 +#: ./docs/master/billing.md:583 msgid "If you would like to generate the URL to the billing portal without generating an HTTP redirect response, you may invoke the `billingPortalUrl` method:" msgstr "" -#: docs/10.x/billing.md:block 120 (code) -msgid "$url = $request->user()->billingPortalUrl(route('billing'));\n" +# CODE +#: ./docs/8.x/billing.md:376 +#: ./docs/9.x/billing.md:403 +#: ./docs/10.x/billing.md:585 +#: ./docs/11.x/billing.md:582 +#: ./docs/master/billing.md:585 +msgid "$url = $request->user()->billingPortalUrl(route('billing'));" +msgstr "" + +# P +#: ./docs/8.x/billing.md:378 +#: ./docs/9.x/billing.md:405 +#: ./docs/10.x/billing.md:587 +#: ./docs/11.x/billing.md:584 +#: ./docs/master/billing.md:587 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:379 +#: ./docs/9.x/billing.md:406 +#: ./docs/10.x/billing.md:588 +#: ./docs/11.x/billing.md:585 +#: ./docs/master/billing.md:588 +msgid "Payment Methods" msgstr "" -#: docs/10.x/billing.md:block 122 (header) -msgid "Payment Methods" +# P +#: ./docs/10.x/billing.md:380 +#: ./docs/11.x/billing.md:377 +#: ./docs/master/billing.md:380 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/billing.md:380 +#: ./docs/10.x/billing.md:562 +#: ./docs/11.x/billing.md:559 +#: ./docs/master/billing.md:562 +msgid "Similarly, you may override the `stripeEmail`, `stripePhone`, `stripeAddress`, and `stripePreferredLocales` methods. These methods will sync information to their corresponding customer parameters when [updating the Stripe customer object](https://stripe.com/docs/api/customers/update). If you wish to take total control over the customer information sync process, you may override the `syncStripeCustomerDetails` method." msgstr "" -#: docs/10.x/billing.md:block 124 (header) +# H4 +#: ./docs/10.x/billing.md:381 +#: ./docs/11.x/billing.md:378 +#: ./docs/master/billing.md:381 +msgid "Building a Subscribed Middleware" +msgstr "" + +# P +#: ./docs/8.x/billing.md:381 +#: ./docs/9.x/billing.md:408 +#: ./docs/10.x/billing.md:590 +#: ./docs/11.x/billing.md:587 +#: ./docs/master/billing.md:590 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:382 +#: ./docs/9.x/billing.md:409 +#: ./docs/10.x/billing.md:591 +#: ./docs/11.x/billing.md:588 +#: ./docs/master/billing.md:591 msgid "Storing Payment Methods" msgstr "" -#: docs/10.x/billing.md:block 125 (paragraph) -msgid "In order to create subscriptions or perform \"one-off\" charges with Stripe, you will need to store a payment method and retrieve its identifier from Stripe. The approach used to accomplish this differs based on whether you plan to use the payment method for subscriptions or single charges, so we will examine both below." +# P +#: ./docs/10.x/billing.md:383 +#: ./docs/11.x/billing.md:380 +#: ./docs/master/billing.md:383 +msgid "For convenience, you may wish to create a [middleware](/docs/{{version}}/middleware) which determines if the incoming request is from a subscribed user. Once this middleware has been defined, you may easily assign it to a route to prevent users that are not subscribed from accessing the route:" +msgstr "" + +# P +#: ./docs/8.x/billing.md:384 +msgid "In order to create subscriptions or perform \"one off\" charges with Stripe, you will need to store a payment method and retrieve its identifier from Stripe. The approach used to accomplish this differs based on whether you plan to use the payment method for subscriptions or single charges, so we will examine both below." +msgstr "" + +# CODE +#: ./docs/10.x/billing.md:385 +#: ./docs/11.x/billing.md:382 +#: ./docs/master/billing.md:385 +msgid "user()?->subscribed()) {\n" +" // Redirect user to billing page and ask them to subscribe...\n" +" return redirect('/billing');\n" +" }\n\n" +" return $next($request);\n" +" }\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 127 (header) +# P +#: ./docs/8.x/billing.md:386 +#: ./docs/9.x/billing.md:413 +#: ./docs/10.x/billing.md:595 +#: ./docs/11.x/billing.md:592 +#: ./docs/master/billing.md:595 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:387 +#: ./docs/9.x/billing.md:414 msgid "Payment Methods For Subscriptions" msgstr "" -#: docs/10.x/billing.md:block 128 (paragraph) +# P +#: ./docs/8.x/billing.md:389 +#: ./docs/9.x/billing.md:416 +#: ./docs/10.x/billing.md:598 +#: ./docs/11.x/billing.md:595 +#: ./docs/master/billing.md:598 msgid "When storing a customer's credit card information for future use by a subscription, the Stripe \"Setup Intents\" API must be used to securely gather the customer's payment method details. A \"Setup Intent\" indicates to Stripe the intention to charge a customer's payment method. Cashier's `Billable` trait includes the `createSetupIntent` method to easily create a new Setup Intent. You should invoke this method from the route or controller that will render the form which gathers your customer's payment method details:" msgstr "" -#: docs/10.x/billing.md:block 129 (code) +# CODE +#: ./docs/8.x/billing.md:391 +#: ./docs/9.x/billing.md:418 +#: ./docs/10.x/billing.md:600 +#: ./docs/11.x/billing.md:597 +#: ./docs/master/billing.md:600 msgid "return view('update-payment-method', [\n" " 'intent' => $user->createSetupIntent()\n" -"]);\n" +"]);" msgstr "" -#: docs/10.x/billing.md:block 130 (paragraph) +# P +#: ./docs/8.x/billing.md:395 +#: ./docs/9.x/billing.md:422 +#: ./docs/10.x/billing.md:604 +#: ./docs/11.x/billing.md:601 +#: ./docs/master/billing.md:604 msgid "After you have created the Setup Intent and passed it to the view, you should attach its secret to the element that will gather the payment method. For example, consider this \"update payment method\" form:" msgstr "" -#: docs/10.x/billing.md:block 131 (code) +# CODE: html +#: ./docs/8.x/billing.md:397 +#: ./docs/9.x/billing.md:424 +#: ./docs/10.x/billing.md:606 +#: ./docs/11.x/billing.md:603 +#: ./docs/master/billing.md:606 msgid "\n\n" "\n" "
\n\n" "\n" +"" msgstr "" -#: docs/10.x/billing.md:block 132 (paragraph) +# P +#: ./docs/8.x/billing.md:408 +#: ./docs/9.x/billing.md:435 +#: ./docs/10.x/billing.md:617 +#: ./docs/11.x/billing.md:614 +#: ./docs/master/billing.md:617 msgid "Next, the Stripe.js library may be used to attach a [Stripe Element](https://stripe.com/docs/stripe-js) to the form and securely gather the customer's payment details:" msgstr "" -#: docs/10.x/billing.md:block 133 (code) +# P +#: ./docs/10.x/billing.md:409 +#: ./docs/11.x/billing.md:406 +#: ./docs/master/billing.md:409 +msgid "Once the middleware has been defined, you may assign it to a route:" +msgstr "" + +# CODE: html +#: ./docs/8.x/billing.md:410 +#: ./docs/8.x/billing.md:470 +#: ./docs/9.x/billing.md:437 +#: ./docs/9.x/billing.md:498 +#: ./docs/10.x/billing.md:619 +#: ./docs/10.x/billing.md:680 +#: ./docs/11.x/billing.md:616 +#: ./docs/11.x/billing.md:677 +#: ./docs/master/billing.md:619 +#: ./docs/master/billing.md:680 msgid "\n\n" "\n" +"" +msgstr "" + +# CODE +#: ./docs/10.x/billing.md:411 +#: ./docs/11.x/billing.md:408 +#: ./docs/master/billing.md:411 +msgid "use App\\Http\\Middleware\\Subscribed;\n\n" +"Route::get('/dashboard', function () {\n" +" // ...\n" +"})->middleware([Subscribed::class]);" +msgstr "" + +# P +#: ./docs/9.x/billing.md:411 +#: ./docs/10.x/billing.md:593 +#: ./docs/11.x/billing.md:590 +#: ./docs/master/billing.md:593 +msgid "In order to create subscriptions or perform \"one-off\" charges with Stripe, you will need to store a payment method and retrieve its identifier from Stripe. The approach used to accomplish this differs based on whether you plan to use the payment method for subscriptions or single charges, so we will examine both below." +msgstr "" + +# P +#: ./docs/10.x/billing.md:417 +#: ./docs/11.x/billing.md:414 +#: ./docs/master/billing.md:417 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/billing.md:418 +#: ./docs/11.x/billing.md:415 +#: ./docs/master/billing.md:418 +msgid "Allowing Customers to Manage Their Billing Plan" +msgstr "" + +# P +#: ./docs/10.x/billing.md:420 +#: ./docs/11.x/billing.md:417 +#: ./docs/master/billing.md:420 +msgid "Of course, customers may want to change their subscription plan to another product or \"tier\". The easiest way to allow this is by directing customers to Stripe's [Customer Billing Portal](https://stripe.com/docs/no-code/customer-portal), which provides a hosted user interface that allows customers to download invoices, update their payment method, and change subscription plans." +msgstr "" + +# P +#: ./docs/10.x/billing.md:422 +#: ./docs/11.x/billing.md:419 +#: ./docs/master/billing.md:422 +msgid "First, define a link or button within your application that directs users to a Laravel route which we will utilize to initiate a Billing Portal session:" msgstr "" -#: docs/10.x/billing.md:block 134 (paragraph) +# P +#: ./docs/8.x/billing.md:423 +#: ./docs/9.x/billing.md:450 +#: ./docs/10.x/billing.md:632 +#: ./docs/11.x/billing.md:629 +#: ./docs/master/billing.md:632 msgid "Next, the card can be verified and a secure \"payment method identifier\" can be retrieved from Stripe using [Stripe's `confirmCardSetup` method](https://stripe.com/docs/js/setup_intents/confirm_card_setup):" msgstr "" -#: docs/10.x/billing.md:block 135 (code) +# CODE: blade +#: ./docs/10.x/billing.md:424 +#: ./docs/11.x/billing.md:421 +#: ./docs/master/billing.md:424 +msgid "\n" +" Billing\n" +"" +msgstr "" + +# CODE: js +#: ./docs/8.x/billing.md:425 +#: ./docs/9.x/billing.md:452 +#: ./docs/10.x/billing.md:634 +#: ./docs/11.x/billing.md:631 +#: ./docs/master/billing.md:634 msgid "const cardHolderName = document.getElementById('card-holder-name');\n" "const cardButton = document.getElementById('card-button');\n" "const clientSecret = cardButton.dataset.secret;\n\n" @@ -832,43 +2444,117 @@ msgid "const cardHolderName = document.getElementById('card-holder-name');\n" " } else {\n" " // The card has been verified successfully...\n" " }\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/billing.md:430 +#: ./docs/11.x/billing.md:427 +#: ./docs/master/billing.md:430 +msgid "Next, let's define the route that initiates a Stripe Customer Billing Portal session and redirects the user to the Portal. The `redirectToBillingPortal` method accepts the URL that users should be returned to when exiting the Portal:" +msgstr "" + +# CODE +#: ./docs/10.x/billing.md:432 +#: ./docs/11.x/billing.md:429 +#: ./docs/master/billing.md:432 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/billing', function (Request $request) {\n" +" return $request->user()->redirectToBillingPortal(route('dashboard'));\n" +"})->middleware(['auth'])->name('billing');" +msgstr "" + +# P +#: ./docs/11.x/billing.md:436 +msgid "As long as you have configured Cashier's webhook handling, Cashier will automatically keep your application's Cashier-related database tables in sync by inspecting the incoming webhooks from Stripe. So, for example, when a user cancels their subscription via Stripe's Customer Billing Portal, Cashier will receive the corresponding webhook and mark the subscription as \"canceled\" in your application's database." +msgstr "" + +# P +#: ./docs/10.x/billing.md:439 +#: ./docs/master/billing.md:439 +msgid "As long as you have configured Cashier's webhook handling, Cashier will automatically keep your application's Cashier-related database tables in sync by inspecting the incoming webhooks from Stripe. So, for example, when a user cancels their subscription via Stripe's Customer Billing Portal, Cashier will receive the corresponding webhook and mark the subscription as \"cancelled\" in your application's database." msgstr "" -#: docs/10.x/billing.md:block 136 (paragraph) +# P +#: ./docs/8.x/billing.md:448 +#: ./docs/9.x/billing.md:475 +#: ./docs/10.x/billing.md:657 +#: ./docs/11.x/billing.md:654 +#: ./docs/master/billing.md:657 msgid "After the card has been verified by Stripe, you may pass the resulting `setupIntent.payment_method` identifier to your Laravel application, where it can be attached to the customer. The payment method can either be [added as a new payment method](#adding-payment-methods) or [used to update the default payment method](#updating-the-default-payment-method). You can also immediately use the payment method identifier to [create a new subscription](#creating-subscriptions)." msgstr "" -#: docs/10.x/billing.md:block 137 (quote) -msgid "**Note** If you would like more information about Setup Intents and gathering customer payment details please [review this overview provided by Stripe](https://stripe.com/docs/payments/save-and-reuse#php)." +# P +#: ./docs/8.x/billing.md:450 +#: ./docs/9.x/billing.md:478 +#: ./docs/10.x/billing.md:660 +#: ./docs/11.x/billing.md:657 +#: ./docs/master/billing.md:660 +msgid "If you would like more information about Setup Intents and gathering customer payment details please [review this overview provided by Stripe](https://stripe.com/docs/payments/save-and-reuse#php)." msgstr "" -#: docs/10.x/billing.md:block 139 (header) +# P +#: ./docs/8.x/billing.md:452 +#: ./docs/9.x/billing.md:480 +#: ./docs/10.x/billing.md:662 +#: ./docs/11.x/billing.md:659 +#: ./docs/master/billing.md:662 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:453 +#: ./docs/9.x/billing.md:481 msgid "Payment Methods For Single Charges" msgstr "" -#: docs/10.x/billing.md:block 140 (paragraph) +# P +#: ./docs/8.x/billing.md:455 +#: ./docs/9.x/billing.md:483 +#: ./docs/10.x/billing.md:665 +#: ./docs/11.x/billing.md:662 +#: ./docs/master/billing.md:665 msgid "Of course, when making a single charge against a customer's payment method, we will only need to use a payment method identifier once. Due to Stripe limitations, you may not use the stored default payment method of a customer for single charges. You must allow the customer to enter their payment method details using the Stripe.js library. For example, consider the following form:" msgstr "" -#: docs/10.x/billing.md:block 141 (code) +# CODE: html +#: ./docs/8.x/billing.md:457 +#: ./docs/9.x/billing.md:485 +#: ./docs/10.x/billing.md:667 +#: ./docs/11.x/billing.md:664 +#: ./docs/master/billing.md:667 msgid "\n\n" "\n" "
\n\n" "\n" +"" msgstr "" -#: docs/10.x/billing.md:block 142 (paragraph) +# P +#: ./docs/8.x/billing.md:468 +#: ./docs/9.x/billing.md:496 +#: ./docs/10.x/billing.md:678 +#: ./docs/11.x/billing.md:675 +#: ./docs/master/billing.md:678 msgid "After defining such a form, the Stripe.js library may be used to attach a [Stripe Element](https://stripe.com/docs/stripe-js) to the form and securely gather the customer's payment details:" msgstr "" -#: docs/10.x/billing.md:block 144 (paragraph) +# P +#: ./docs/8.x/billing.md:483 +#: ./docs/9.x/billing.md:511 +#: ./docs/10.x/billing.md:693 +#: ./docs/11.x/billing.md:690 +#: ./docs/master/billing.md:693 msgid "Next, the card can be verified and a secure \"payment method identifier\" can be retrieved from Stripe using [Stripe's `createPaymentMethod` method](https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method):" msgstr "" -#: docs/10.x/billing.md:block 145 (code) +# CODE: js +#: ./docs/8.x/billing.md:485 +#: ./docs/9.x/billing.md:513 +#: ./docs/10.x/billing.md:695 +#: ./docs/11.x/billing.md:692 +#: ./docs/master/billing.md:695 msgid "const cardHolderName = document.getElementById('card-holder-name');\n" "const cardButton = document.getElementById('card-button');\n\n" "cardButton.addEventListener('click', async (e) => {\n" @@ -882,406 +2568,827 @@ msgid "const cardHolderName = document.getElementById('card-holder-name');\n" " } else {\n" " // The card has been verified successfully...\n" " }\n" -"});\n" +"});" msgstr "" -#: docs/10.x/billing.md:block 146 (paragraph) +# P +#: ./docs/8.x/billing.md:504 +#: ./docs/9.x/billing.md:532 +#: ./docs/10.x/billing.md:714 +#: ./docs/11.x/billing.md:711 +#: ./docs/master/billing.md:714 msgid "If the card is verified successfully, you may pass the `paymentMethod.id` to your Laravel application and process a [single charge](#simple-charge)." msgstr "" -#: docs/10.x/billing.md:block 148 (header) +# P +#: ./docs/8.x/billing.md:506 +#: ./docs/9.x/billing.md:534 +#: ./docs/10.x/billing.md:716 +#: ./docs/11.x/billing.md:713 +#: ./docs/master/billing.md:716 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:507 +#: ./docs/9.x/billing.md:535 +#: ./docs/10.x/billing.md:717 +#: ./docs/11.x/billing.md:714 +#: ./docs/master/billing.md:717 msgid "Retrieving Payment Methods" msgstr "" -#: docs/10.x/billing.md:block 149 (paragraph) +# P +#: ./docs/8.x/billing.md:509 +#: ./docs/9.x/billing.md:537 +#: ./docs/10.x/billing.md:719 +#: ./docs/11.x/billing.md:716 +#: ./docs/master/billing.md:719 msgid "The `paymentMethods` method on the billable model instance returns a collection of `Laravel\\Cashier\\PaymentMethod` instances:" msgstr "" -#: docs/10.x/billing.md:block 150 (code) -msgid "$paymentMethods = $user->paymentMethods();\n" +# CODE +#: ./docs/8.x/billing.md:511 +#: ./docs/9.x/billing.md:539 +#: ./docs/10.x/billing.md:721 +#: ./docs/11.x/billing.md:718 +#: ./docs/master/billing.md:721 +msgid "$paymentMethods = $user->paymentMethods();" msgstr "" -#: docs/10.x/billing.md:block 151 (paragraph) +# P +#: ./docs/8.x/billing.md:513 +#: ./docs/9.x/billing.md:541 msgid "By default, this method will return payment methods of the `card` type. To retrieve payment methods of a different type, you may pass the `type` as an argument to the method:" msgstr "" -#: docs/10.x/billing.md:block 152 (code) -msgid "$paymentMethods = $user->paymentMethods('sepa_debit');\n" +# CODE +#: ./docs/8.x/billing.md:515 +#: ./docs/9.x/billing.md:543 +#: ./docs/10.x/billing.md:725 +#: ./docs/11.x/billing.md:722 +#: ./docs/master/billing.md:725 +msgid "$paymentMethods = $user->paymentMethods('sepa_debit');" msgstr "" -#: docs/10.x/billing.md:block 153 (paragraph) +# P +#: ./docs/8.x/billing.md:517 +#: ./docs/9.x/billing.md:545 +#: ./docs/10.x/billing.md:727 +#: ./docs/11.x/billing.md:724 +#: ./docs/master/billing.md:727 msgid "To retrieve the customer's default payment method, the `defaultPaymentMethod` method may be used:" msgstr "" -#: docs/10.x/billing.md:block 154 (code) -msgid "$paymentMethod = $user->defaultPaymentMethod();\n" +# CODE +#: ./docs/8.x/billing.md:519 +#: ./docs/9.x/billing.md:547 +#: ./docs/10.x/billing.md:729 +#: ./docs/11.x/billing.md:726 +#: ./docs/master/billing.md:729 +msgid "$paymentMethod = $user->defaultPaymentMethod();" msgstr "" -#: docs/10.x/billing.md:block 155 (paragraph) +# P +#: ./docs/8.x/billing.md:521 +#: ./docs/9.x/billing.md:549 +#: ./docs/10.x/billing.md:731 +#: ./docs/11.x/billing.md:728 +#: ./docs/master/billing.md:731 msgid "You can retrieve a specific payment method that is attached to the billable model using the `findPaymentMethod` method:" msgstr "" -#: docs/10.x/billing.md:block 156 (code) -msgid "$paymentMethod = $user->findPaymentMethod($paymentMethodId);\n" +# CODE +#: ./docs/8.x/billing.md:523 +#: ./docs/9.x/billing.md:551 +#: ./docs/10.x/billing.md:733 +#: ./docs/11.x/billing.md:730 +#: ./docs/master/billing.md:733 +msgid "$paymentMethod = $user->findPaymentMethod($paymentMethodId);" msgstr "" -#: docs/10.x/billing.md:block 158 (header) +# P +#: ./docs/8.x/billing.md:525 +#: ./docs/9.x/billing.md:553 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:526 +#: ./docs/9.x/billing.md:554 msgid "Determining If A User Has A Payment Method" msgstr "" -#: docs/10.x/billing.md:block 159 (paragraph) +# P +#: ./docs/8.x/billing.md:528 +#: ./docs/9.x/billing.md:556 +#: ./docs/10.x/billing.md:738 +#: ./docs/11.x/billing.md:735 +#: ./docs/master/billing.md:738 msgid "To determine if a billable model has a default payment method attached to their account, invoke the `hasDefaultPaymentMethod` method:" msgstr "" -#: docs/10.x/billing.md:block 160 (code) +# CODE +#: ./docs/8.x/billing.md:530 +#: ./docs/9.x/billing.md:558 msgid "if ($user->hasDefaultPaymentMethod()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 161 (paragraph) +# P +#: ./docs/8.x/billing.md:534 +#: ./docs/9.x/billing.md:562 +#: ./docs/10.x/billing.md:744 +#: ./docs/11.x/billing.md:741 +#: ./docs/master/billing.md:744 msgid "You may use the `hasPaymentMethod` method to determine if a billable model has at least one payment method attached to their account:" msgstr "" -#: docs/10.x/billing.md:block 162 (code) +# CODE +#: ./docs/10.x/billing.md:535 +#: ./docs/11.x/billing.md:532 +#: ./docs/master/billing.md:535 +msgid "use App\\Models\\User;\n" +"use function Illuminate\\Events\\queueable;\n\n" +"/**\n" +" * The \"booted\" method of the model.\n" +" */\n" +"protected static function booted(): void\n" +"{\n" +" static::updated(queueable(function (User $customer) {\n" +" if ($customer->hasStripeId()) {\n" +" $customer->syncStripeCustomerDetails();\n" +" }\n" +" }));\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:536 +#: ./docs/9.x/billing.md:564 msgid "if ($user->hasPaymentMethod()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 163 (paragraph) +# P +#: ./docs/8.x/billing.md:540 +#: ./docs/9.x/billing.md:568 msgid "This method will determine if the billable model has payment methods of the `card` type. To determine if a payment method of another type exists for the model, you may pass the `type` as an argument to the method:" msgstr "" -#: docs/10.x/billing.md:block 164 (code) +# CODE +#: ./docs/8.x/billing.md:542 +#: ./docs/9.x/billing.md:570 msgid "if ($user->hasPaymentMethod('sepa_debit')) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 166 (header) +# P +#: ./docs/8.x/billing.md:546 +#: ./docs/9.x/billing.md:574 +#: ./docs/10.x/billing.md:756 +#: ./docs/11.x/billing.md:753 +#: ./docs/master/billing.md:756 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:547 +#: ./docs/9.x/billing.md:575 msgid "Updating The Default Payment Method" msgstr "" -#: docs/10.x/billing.md:block 167 (paragraph) +# P +#: ./docs/8.x/billing.md:549 +#: ./docs/9.x/billing.md:577 +#: ./docs/10.x/billing.md:759 +#: ./docs/11.x/billing.md:756 +#: ./docs/master/billing.md:759 msgid "The `updateDefaultPaymentMethod` method may be used to update a customer's default payment method information. This method accepts a Stripe payment method identifier and will assign the new payment method as the default billing payment method:" msgstr "" -#: docs/10.x/billing.md:block 168 (code) -msgid "$user->updateDefaultPaymentMethod($paymentMethod);\n" +# CODE +#: ./docs/8.x/billing.md:551 +#: ./docs/9.x/billing.md:579 +#: ./docs/10.x/billing.md:761 +#: ./docs/11.x/billing.md:758 +#: ./docs/master/billing.md:761 +msgid "$user->updateDefaultPaymentMethod($paymentMethod);" msgstr "" -#: docs/10.x/billing.md:block 169 (paragraph) +# P +#: ./docs/8.x/billing.md:553 +#: ./docs/9.x/billing.md:581 +#: ./docs/10.x/billing.md:763 +#: ./docs/11.x/billing.md:760 +#: ./docs/master/billing.md:763 msgid "To sync your default payment method information with the customer's default payment method information in Stripe, you may use the `updateDefaultPaymentMethodFromStripe` method:" msgstr "" -#: docs/10.x/billing.md:block 170 (code) -msgid "$user->updateDefaultPaymentMethodFromStripe();\n" -msgstr "" - -#: docs/10.x/billing.md:block 171 (quote) -msgid "**Warning** The default payment method on a customer can only be used for invoicing and creating new subscriptions. Due to limitations imposed by Stripe, it may not be used for single charges." -msgstr "" - -#: docs/10.x/billing.md:block 173 (header) +# CODE +#: ./docs/10.x/billing.md:554 +#: ./docs/11.x/billing.md:551 +#: ./docs/master/billing.md:554 +msgid "/**\n" +" * Get the customer name that should be synced to Stripe.\n" +" */\n" +"public function stripeName(): string|null\n" +"{\n" +" return $this->company_name;\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:555 +#: ./docs/9.x/billing.md:583 +#: ./docs/10.x/billing.md:765 +#: ./docs/11.x/billing.md:762 +#: ./docs/master/billing.md:765 +msgid "$user->updateDefaultPaymentMethodFromStripe();" +msgstr "" + +# P +#: ./docs/8.x/billing.md:557 +#: ./docs/9.x/billing.md:586 +#: ./docs/10.x/billing.md:768 +#: ./docs/11.x/billing.md:765 +#: ./docs/master/billing.md:768 +msgid "The default payment method on a customer can only be used for invoicing and creating new subscriptions. Due to limitations imposed by Stripe, it may not be used for single charges." +msgstr "" + +# P +#: ./docs/8.x/billing.md:559 +#: ./docs/9.x/billing.md:588 +#: ./docs/10.x/billing.md:770 +#: ./docs/11.x/billing.md:767 +#: ./docs/master/billing.md:770 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:560 +#: ./docs/9.x/billing.md:589 +#: ./docs/10.x/billing.md:771 +#: ./docs/11.x/billing.md:768 +#: ./docs/master/billing.md:771 msgid "Adding Payment Methods" msgstr "" -#: docs/10.x/billing.md:block 174 (paragraph) +# P +#: ./docs/8.x/billing.md:562 +#: ./docs/9.x/billing.md:591 +#: ./docs/10.x/billing.md:773 +#: ./docs/11.x/billing.md:770 +#: ./docs/master/billing.md:773 msgid "To add a new payment method, you may call the `addPaymentMethod` method on the billable model, passing the payment method identifier:" msgstr "" -#: docs/10.x/billing.md:block 175 (code) -msgid "$user->addPaymentMethod($paymentMethod);\n" -msgstr "" - -#: docs/10.x/billing.md:block 176 (quote) -msgid "**Note** To learn how to retrieve payment method identifiers please review the [payment method storage documentation](#storing-payment-methods)." -msgstr "" - -#: docs/10.x/billing.md:block 178 (header) +# CODE +#: ./docs/8.x/billing.md:564 +#: ./docs/9.x/billing.md:593 +#: ./docs/10.x/billing.md:775 +#: ./docs/11.x/billing.md:772 +#: ./docs/master/billing.md:775 +msgid "$user->addPaymentMethod($paymentMethod);" +msgstr "" + +# P +#: ./docs/8.x/billing.md:566 +#: ./docs/9.x/billing.md:596 +#: ./docs/10.x/billing.md:778 +#: ./docs/11.x/billing.md:775 +#: ./docs/master/billing.md:778 +msgid "To learn how to retrieve payment method identifiers please review the [payment method storage documentation](#storing-payment-methods)." +msgstr "" + +# P +#: ./docs/8.x/billing.md:568 +#: ./docs/9.x/billing.md:598 +#: ./docs/10.x/billing.md:780 +#: ./docs/11.x/billing.md:777 +#: ./docs/master/billing.md:780 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:569 +#: ./docs/9.x/billing.md:599 +#: ./docs/10.x/billing.md:781 +#: ./docs/11.x/billing.md:778 +#: ./docs/master/billing.md:781 msgid "Deleting Payment Methods" msgstr "" -#: docs/10.x/billing.md:block 179 (paragraph) +# P +#: ./docs/8.x/billing.md:571 +#: ./docs/9.x/billing.md:601 +#: ./docs/10.x/billing.md:783 +#: ./docs/11.x/billing.md:780 +#: ./docs/master/billing.md:783 msgid "To delete a payment method, you may call the `delete` method on the `Laravel\\Cashier\\PaymentMethod` instance you wish to delete:" msgstr "" -#: docs/10.x/billing.md:block 180 (code) -msgid "$paymentMethod->delete();\n" +# CODE +#: ./docs/8.x/billing.md:573 +#: ./docs/9.x/billing.md:603 +#: ./docs/10.x/billing.md:785 +#: ./docs/11.x/billing.md:782 +#: ./docs/master/billing.md:785 +msgid "$paymentMethod->delete();" msgstr "" -#: docs/10.x/billing.md:block 181 (paragraph) +# P +#: ./docs/8.x/billing.md:575 +#: ./docs/9.x/billing.md:605 +#: ./docs/10.x/billing.md:787 +#: ./docs/11.x/billing.md:784 +#: ./docs/master/billing.md:787 msgid "The `deletePaymentMethod` method will delete a specific payment method from the billable model:" msgstr "" -#: docs/10.x/billing.md:block 182 (code) -msgid "$user->deletePaymentMethod('pm_visa');\n" +# CODE +#: ./docs/8.x/billing.md:577 +#: ./docs/9.x/billing.md:607 +#: ./docs/10.x/billing.md:789 +#: ./docs/11.x/billing.md:786 +#: ./docs/master/billing.md:789 +msgid "$user->deletePaymentMethod('pm_visa');" msgstr "" -#: docs/10.x/billing.md:block 183 (paragraph) +# P +#: ./docs/8.x/billing.md:579 +#: ./docs/9.x/billing.md:609 +#: ./docs/10.x/billing.md:791 +#: ./docs/11.x/billing.md:788 +#: ./docs/master/billing.md:791 msgid "The `deletePaymentMethods` method will delete all of the payment method information for the billable model:" msgstr "" -#: docs/10.x/billing.md:block 184 (code) -msgid "$user->deletePaymentMethods();\n" +# CODE +#: ./docs/8.x/billing.md:581 +#: ./docs/9.x/billing.md:611 +#: ./docs/10.x/billing.md:793 +#: ./docs/11.x/billing.md:790 +#: ./docs/master/billing.md:793 +msgid "$user->deletePaymentMethods();" msgstr "" -#: docs/10.x/billing.md:block 185 (paragraph) +# P +#: ./docs/8.x/billing.md:583 +#: ./docs/9.x/billing.md:613 msgid "By default, this method will delete payment methods of the `card` type. To delete payment methods of a different type you can pass the `type` as an argument to the method:" msgstr "" -#: docs/10.x/billing.md:block 186 (code) -msgid "$user->deletePaymentMethods('sepa_debit');\n" -msgstr "" - -#: docs/10.x/billing.md:block 187 (quote) -msgid "**Warning** If a user has an active subscription, your application should not allow them to delete their default payment method." -msgstr "" - -#: docs/10.x/billing.md:block 189 (header) +# CODE +#: ./docs/8.x/billing.md:585 +#: ./docs/9.x/billing.md:615 +#: ./docs/10.x/billing.md:797 +#: ./docs/11.x/billing.md:794 +#: ./docs/master/billing.md:797 +msgid "$user->deletePaymentMethods('sepa_debit');" +msgstr "" + +# P +#: ./docs/8.x/billing.md:587 +#: ./docs/9.x/billing.md:618 +#: ./docs/10.x/billing.md:800 +#: ./docs/11.x/billing.md:797 +#: ./docs/master/billing.md:800 +msgid "If a user has an active subscription, your application should not allow them to delete their default payment method." +msgstr "" + +# P +#: ./docs/8.x/billing.md:589 +#: ./docs/9.x/billing.md:620 +#: ./docs/10.x/billing.md:802 +#: ./docs/11.x/billing.md:799 +#: ./docs/master/billing.md:802 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:590 +#: ./docs/9.x/billing.md:621 +#: ./docs/10.x/billing.md:803 +#: ./docs/11.x/billing.md:800 +#: ./docs/master/billing.md:803 msgid "Subscriptions" msgstr "" -#: docs/10.x/billing.md:block 190 (paragraph) +# P +#: ./docs/8.x/billing.md:592 +#: ./docs/9.x/billing.md:623 +#: ./docs/10.x/billing.md:805 +#: ./docs/11.x/billing.md:802 +#: ./docs/master/billing.md:805 msgid "Subscriptions provide a way to set up recurring payments for your customers. Stripe subscriptions managed by Cashier provide support for multiple subscription prices, subscription quantities, trials, and more." msgstr "" -#: docs/10.x/billing.md:block 192 (header) +# P +#: ./docs/8.x/billing.md:594 +#: ./docs/9.x/billing.md:625 +#: ./docs/10.x/billing.md:807 +#: ./docs/11.x/billing.md:804 +#: ./docs/master/billing.md:807 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:595 +#: ./docs/9.x/billing.md:626 +#: ./docs/10.x/billing.md:808 +#: ./docs/11.x/billing.md:805 +#: ./docs/master/billing.md:808 msgid "Creating Subscriptions" msgstr "" -#: docs/10.x/billing.md:block 193 (paragraph) +# H4 +#: ./docs/10.x/billing.md:596 +#: ./docs/11.x/billing.md:593 +#: ./docs/master/billing.md:596 +msgid "Payment Methods for Subscriptions" +msgstr "" + +# P +#: ./docs/8.x/billing.md:597 +#: ./docs/9.x/billing.md:628 +#: ./docs/10.x/billing.md:810 +#: ./docs/11.x/billing.md:807 +#: ./docs/master/billing.md:810 msgid "To create a subscription, first retrieve an instance of your billable model, which typically will be an instance of `App\\Models\\User`. Once you have retrieved the model instance, you may use the `newSubscription` method to create the model's subscription:" msgstr "" -#: docs/10.x/billing.md:block 194 (code) +# CODE +#: ./docs/8.x/billing.md:599 +#: ./docs/9.x/billing.md:630 +#: ./docs/10.x/billing.md:812 +#: ./docs/11.x/billing.md:809 +#: ./docs/master/billing.md:812 msgid "use Illuminate\\Http\\Request;\n\n" "Route::post('/user/subscribe', function (Request $request) {\n" " $request->user()->newSubscription(\n" " 'default', 'price_monthly'\n" " )->create($request->paymentMethodId);\n\n" " // ...\n" -"});\n" +"});" msgstr "" -#: docs/10.x/billing.md:block 195 (paragraph) +# P +#: ./docs/8.x/billing.md:609 +#: ./docs/9.x/billing.md:640 msgid "The first argument passed to the `newSubscription` method should be the internal name of the subscription. If your application only offers a single subscription, you might call this `default` or `primary`. This subscription name is only for internal application usage and is not meant to be shown to users. In addition, it should not contain spaces and it should never be changed after creating the subscription. The second argument is the specific price the user is subscribing to. This value should correspond to the price's identifier in Stripe." msgstr "" -#: docs/10.x/billing.md:block 196 (paragraph) +# P +#: ./docs/8.x/billing.md:611 +#: ./docs/9.x/billing.md:642 +#: ./docs/10.x/billing.md:824 +#: ./docs/11.x/billing.md:821 +#: ./docs/master/billing.md:824 msgid "The `create` method, which accepts [a Stripe payment method identifier](#storing-payment-methods) or Stripe `PaymentMethod` object, will begin the subscription as well as update your database with the billable model's Stripe customer ID and other relevant billing information." msgstr "" -#: docs/10.x/billing.md:block 197 (quote) -msgid "**Warning** Passing a payment method identifier directly to the `create` subscription method will also automatically add it to the user's stored payment methods." +# P +#: ./docs/8.x/billing.md:613 +#: ./docs/9.x/billing.md:645 +#: ./docs/10.x/billing.md:827 +#: ./docs/11.x/billing.md:824 +#: ./docs/master/billing.md:827 +msgid "Passing a payment method identifier directly to the `create` subscription method will also automatically add it to the user's stored payment methods." msgstr "" -#: docs/10.x/billing.md:block 199 (header) +# P +#: ./docs/8.x/billing.md:615 +#: ./docs/9.x/billing.md:647 +#: ./docs/10.x/billing.md:829 +#: ./docs/11.x/billing.md:826 +#: ./docs/master/billing.md:829 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:616 +#: ./docs/9.x/billing.md:648 msgid "Collecting Recurring Payments Via Invoice Emails" msgstr "" -#: docs/10.x/billing.md:block 200 (paragraph) +# P +#: ./docs/8.x/billing.md:618 +#: ./docs/9.x/billing.md:650 +#: ./docs/10.x/billing.md:832 +#: ./docs/11.x/billing.md:829 +#: ./docs/master/billing.md:832 msgid "Instead of collecting a customer's recurring payments automatically, you may instruct Stripe to email an invoice to the customer each time their recurring payment is due. Then, the customer may manually pay the invoice once they receive it. The customer does not need to provide a payment method up front when collecting recurring payments via invoices:" msgstr "" -#: docs/10.x/billing.md:block 201 (code) -msgid "$user->newSubscription('default', 'price_monthly')->createAndSendInvoice();\n" -msgstr "" - -#: docs/10.x/billing.md:block 202 (paragraph) -msgid "The amount of time a customer has to pay their invoice before their subscription is cancelled is determined by the `days_until_due` option. By default, this is 30 days; however, you may provide a specific value for this option if you wish:" +# CODE +#: ./docs/8.x/billing.md:620 +#: ./docs/9.x/billing.md:652 +#: ./docs/10.x/billing.md:834 +#: ./docs/11.x/billing.md:831 +#: ./docs/master/billing.md:834 +msgid "$user->newSubscription('default', 'price_monthly')->createAndSendInvoice();" msgstr "" -#: docs/10.x/billing.md:block 203 (code) -msgid "$user->newSubscription('default', 'price_monthly')->createAndSendInvoice([], [\n" -" 'days_until_due' => 30\n" -"]);\n" +# P +#: ./docs/8.x/billing.md:622 +msgid "The amount of time a customer has to pay their invoice before their subscription is canceled is determined by your subscription and invoice settings within the [Stripe dashboard](https://dashboard.stripe.com/settings/billing/automatic)." msgstr "" -#: docs/10.x/billing.md:block 205 (header) +# P +#: ./docs/8.x/billing.md:624 +#: ./docs/9.x/billing.md:660 +#: ./docs/10.x/billing.md:842 +#: ./docs/11.x/billing.md:839 +#: ./docs/master/billing.md:842 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:625 +#: ./docs/8.x/billing.md:991 +#: ./docs/9.x/billing.md:661 +#: ./docs/9.x/billing.md:1074 +#: ./docs/10.x/billing.md:843 +#: ./docs/10.x/billing.md:1254 +#: ./docs/11.x/billing.md:840 +#: ./docs/11.x/billing.md:1251 +#: ./docs/master/billing.md:843 +#: ./docs/master/billing.md:1254 msgid "Quantities" msgstr "" -#: docs/10.x/billing.md:block 206 (paragraph) +# P +#: ./docs/8.x/billing.md:627 +#: ./docs/9.x/billing.md:663 +#: ./docs/10.x/billing.md:845 +#: ./docs/11.x/billing.md:842 +#: ./docs/master/billing.md:845 msgid "If you would like to set a specific [quantity](https://stripe.com/docs/billing/subscriptions/quantities) for the price when creating the subscription, you should invoke the `quantity` method on the subscription builder before creating the subscription:" msgstr "" -#: docs/10.x/billing.md:block 207 (code) +# CODE +#: ./docs/8.x/billing.md:629 +#: ./docs/9.x/billing.md:665 +#: ./docs/10.x/billing.md:847 +#: ./docs/11.x/billing.md:844 +#: ./docs/master/billing.md:847 msgid "$user->newSubscription('default', 'price_monthly')\n" " ->quantity(5)\n" -" ->create($paymentMethod);\n" -msgstr "" - -#: docs/10.x/billing.md:block 209 (header) +" ->create($paymentMethod);" +msgstr "" + +# P +#: ./docs/8.x/billing.md:633 +#: ./docs/9.x/billing.md:669 +#: ./docs/10.x/billing.md:851 +#: ./docs/11.x/billing.md:848 +#: ./docs/master/billing.md:851 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:634 +#: ./docs/9.x/billing.md:670 +#: ./docs/10.x/billing.md:852 +#: ./docs/11.x/billing.md:849 +#: ./docs/master/billing.md:852 msgid "Additional Details" msgstr "" -#: docs/10.x/billing.md:block 210 (paragraph) +# P +#: ./docs/8.x/billing.md:636 +#: ./docs/9.x/billing.md:672 +#: ./docs/10.x/billing.md:854 +#: ./docs/11.x/billing.md:851 +#: ./docs/master/billing.md:854 msgid "If you would like to specify additional [customer](https://stripe.com/docs/api/customers/create) or [subscription](https://stripe.com/docs/api/subscriptions/create) options supported by Stripe, you may do so by passing them as the second and third arguments to the `create` method:" msgstr "" -#: docs/10.x/billing.md:block 211 (code) +# CODE +#: ./docs/8.x/billing.md:638 +#: ./docs/9.x/billing.md:674 +#: ./docs/10.x/billing.md:856 +#: ./docs/11.x/billing.md:853 +#: ./docs/master/billing.md:856 msgid "$user->newSubscription('default', 'price_monthly')->create($paymentMethod, [\n" " 'email' => $email,\n" "], [\n" " 'metadata' => ['note' => 'Some extra information.'],\n" -"]);\n" -msgstr "" - -#: docs/10.x/billing.md:block 213 (header) +"]);" +msgstr "" + +# P +#: ./docs/8.x/billing.md:644 +#: ./docs/9.x/billing.md:680 +#: ./docs/10.x/billing.md:862 +#: ./docs/11.x/billing.md:859 +#: ./docs/master/billing.md:862 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:645 +#: ./docs/9.x/billing.md:681 +#: ./docs/10.x/billing.md:863 +#: ./docs/11.x/billing.md:860 +#: ./docs/master/billing.md:863 msgid "Coupons" msgstr "" -#: docs/10.x/billing.md:block 214 (paragraph) +# P +#: ./docs/8.x/billing.md:647 +#: ./docs/9.x/billing.md:683 +#: ./docs/10.x/billing.md:865 +#: ./docs/11.x/billing.md:862 +#: ./docs/master/billing.md:865 msgid "If you would like to apply a coupon when creating the subscription, you may use the `withCoupon` method:" msgstr "" -#: docs/10.x/billing.md:block 215 (code) +# CODE +#: ./docs/8.x/billing.md:649 +#: ./docs/9.x/billing.md:685 +#: ./docs/10.x/billing.md:867 +#: ./docs/11.x/billing.md:864 +#: ./docs/master/billing.md:867 msgid "$user->newSubscription('default', 'price_monthly')\n" " ->withCoupon('code')\n" -" ->create($paymentMethod);\n" -msgstr "" - -#: docs/10.x/billing.md:block 216 (paragraph) -msgid "Or, if you would like to apply a [Stripe promotion code](https://stripe.com/docs/billing/subscriptions/discounts/codes), you may use the `withPromotionCode` method:" -msgstr "" - -#: docs/10.x/billing.md:block 217 (code) -msgid "$user->newSubscription('default', 'price_monthly')\n" -" ->withPromotionCode('promo_code_id')\n" -" ->create($paymentMethod);\n" -msgstr "" - -#: docs/10.x/billing.md:block 218 (paragraph) -msgid "The given promotion code ID should be the Stripe API ID assigned to the promotion code and not the customer facing promotion code. If you need to find a promotion code ID based on a given customer facing promotion code, you may use the `findPromotionCode` method:" -msgstr "" - -#: docs/10.x/billing.md:block 219 (code) -msgid "// Find a promotion code ID by its customer facing code...\n" -"$promotionCode = $user->findPromotionCode('SUMMERSALE');\n\n" -"// Find an active promotion code ID by its customer facing code...\n" -"$promotionCode = $user->findActivePromotionCode('SUMMERSALE');\n" -msgstr "" - -#: docs/10.x/billing.md:block 220 (paragraph) -msgid "In the example above, the returned `$promotionCode` object is an instance of `Laravel\\Cashier\\PromotionCode`. This class decorates an underlying `Stripe\\PromotionCode` object. You can retrieve the coupon related to the promotion code by invoking the `coupon` method:" -msgstr "" - -#: docs/10.x/billing.md:block 221 (code) -msgid "$coupon = $user->findPromotionCode('SUMMERSALE')->coupon();\n" -msgstr "" - -#: docs/10.x/billing.md:block 222 (paragraph) -msgid "The coupon instance allows you to determine the discount amount and whether the coupon represents a fixed discount or percentage based discount:" -msgstr "" - -#: docs/10.x/billing.md:block 223 (code) -msgid "if ($coupon->isPercentage()) {\n" -" return $coupon->percentOff().'%'; // 21.5%\n" -"} else {\n" -" return $coupon->amountOff(); // $5.99\n" -"}\n" -msgstr "" - -#: docs/10.x/billing.md:block 224 (paragraph) -msgid "You can also retrieve the discounts that are currently applied to a customer or subscription:" -msgstr "" - -#: docs/10.x/billing.md:block 225 (code) -msgid "$discount = $billable->discount();\n\n" -"$discount = $subscription->discount();\n" -msgstr "" - -#: docs/10.x/billing.md:block 226 (paragraph) -msgid "The returned `Laravel\\Cashier\\Discount` instances decorate an underlying `Stripe\\Discount` object instance. You may retrieve the coupon related to this discount by invoking the `coupon` method:" -msgstr "" - -#: docs/10.x/billing.md:block 227 (code) -msgid "$coupon = $subscription->discount()->coupon();\n" -msgstr "" - -#: docs/10.x/billing.md:block 228 (paragraph) -msgid "If you would like to apply a new coupon or promotion code to a customer or subscription, you may do so via the `applyCoupon` or `applyPromotionCode` methods:" +" ->create($paymentMethod);" msgstr "" -#: docs/10.x/billing.md:block 229 (code) -msgid "$billable->applyCoupon('coupon_id');\n" -"$billable->applyPromotionCode('promotion_code_id');\n\n" -"$subscription->applyCoupon('coupon_id');\n" -"$subscription->applyPromotionCode('promotion_code_id');\n" +# P +#: ./docs/8.x/billing.md:653 +msgid "Or, if you would like to apply a [Stripe promotion code](https://stripe.com/docs/billing/subscriptions/discounts/codes), you may use the `withPromotionCode` method. The given promotion code ID should be the Stripe API ID assigned to the promotion code and not the customer facing promotion code:" msgstr "" -#: docs/10.x/billing.md:block 230 (paragraph) -msgid "Remember, you should use the Stripe API ID assigned to the promotion code and not the customer facing promotion code. Only one coupon or promotion code can be applied to a customer or subscription at a given time." +# P +#: ./docs/9.x/billing.md:654 +#: ./docs/10.x/billing.md:836 +#: ./docs/master/billing.md:836 +msgid "The amount of time a customer has to pay their invoice before their subscription is cancelled is determined by the `days_until_due` option. By default, this is 30 days; however, you may provide a specific value for this option if you wish:" msgstr "" -#: docs/10.x/billing.md:block 231 (paragraph) -msgid "For more info on this subject, please consult the Stripe documentation regarding [coupons](https://stripe.com/docs/billing/subscriptions/coupons) and [promotion codes](https://stripe.com/docs/billing/subscriptions/coupons/codes)." +# CODE +#: ./docs/8.x/billing.md:655 +msgid "$user->newSubscription('default', 'price_monthly')\n" +" ->withPromotionCode('promo_code')\n" +" ->create($paymentMethod);" msgstr "" -#: docs/10.x/billing.md:block 233 (header) +# CODE +#: ./docs/9.x/billing.md:656 +#: ./docs/10.x/billing.md:838 +#: ./docs/11.x/billing.md:835 +#: ./docs/master/billing.md:838 +msgid "$user->newSubscription('default', 'price_monthly')->createAndSendInvoice([], [\n" +" 'days_until_due' => 30\n" +"]);" +msgstr "" + +# P +#: ./docs/8.x/billing.md:659 +#: ./docs/9.x/billing.md:737 +#: ./docs/10.x/billing.md:919 +#: ./docs/11.x/billing.md:916 +#: ./docs/master/billing.md:919 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:660 +#: ./docs/9.x/billing.md:738 +#: ./docs/10.x/billing.md:920 +#: ./docs/11.x/billing.md:917 +#: ./docs/master/billing.md:920 msgid "Adding Subscriptions" msgstr "" -#: docs/10.x/billing.md:block 234 (paragraph) +# P +#: ./docs/8.x/billing.md:662 +#: ./docs/9.x/billing.md:740 +#: ./docs/10.x/billing.md:922 +#: ./docs/11.x/billing.md:919 +#: ./docs/master/billing.md:922 msgid "If you would like to add a subscription to a customer who already has a default payment method you may invoke the `add` method on the subscription builder:" msgstr "" -#: docs/10.x/billing.md:block 235 (code) +# H4 +#: ./docs/10.x/billing.md:663 +#: ./docs/11.x/billing.md:660 +#: ./docs/master/billing.md:663 +msgid "Payment Methods for Single Charges" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:664 +#: ./docs/9.x/billing.md:742 +#: ./docs/10.x/billing.md:924 +#: ./docs/11.x/billing.md:921 +#: ./docs/master/billing.md:924 msgid "use App\\Models\\User;\n\n" "$user = User::find(1);\n\n" -"$user->newSubscription('default', 'price_monthly')->add();\n" +"$user->newSubscription('default', 'price_monthly')->add();" msgstr "" -#: docs/10.x/billing.md:block 237 (header) +# P +#: ./docs/8.x/billing.md:670 +#: ./docs/9.x/billing.md:748 +#: ./docs/10.x/billing.md:930 +#: ./docs/11.x/billing.md:927 +#: ./docs/master/billing.md:930 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:671 +#: ./docs/9.x/billing.md:749 msgid "Creating Subscriptions From The Stripe Dashboard" msgstr "" -#: docs/10.x/billing.md:block 238 (paragraph) -msgid "You may also create subscriptions from the Stripe dashboard itself. When doing so, Cashier will sync newly added subscriptions and assign them a name of `default`. To customize the subscription name that is assigned to dashboard created subscriptions, [extend the `WebhookController`](#defining-webhook-event-handlers) and overwrite the `newSubscriptionName` method." +# P +#: ./docs/8.x/billing.md:673 +msgid "You may also create subscriptions from the Stripe dashboard itself. When doing so, Cashier will sync newly added subscriptions and assign them a name of `default`. To customize the subscription name that is assigned to dashboard created subscriptions, [extend the `WebhookController`](/docs/{{version}}/billing#defining-webhook-event-handlers) and overwrite the `newSubscriptionName` method." msgstr "" -#: docs/10.x/billing.md:block 239 (paragraph) +# P +#: ./docs/8.x/billing.md:675 +#: ./docs/9.x/billing.md:753 msgid "In addition, you may only create one type of subscription via the Stripe dashboard. If your application offers multiple subscriptions that use different names, only one type of subscription may be added through the Stripe dashboard." msgstr "" -#: docs/10.x/billing.md:block 240 (paragraph) -msgid "Finally, you should always make sure to only add one active subscription per type of subscription offered by your application. If a customer has two `default` subscriptions, only the most recently added subscription will be used by Cashier even though both would be synced with your application's database." +# P +#: ./docs/8.x/billing.md:677 +msgid "Finally, you should always make sure to only add one active subscription per type of subscription offered by your application. If customer has two `default` subscriptions, only the most recently added subscription will be used by Cashier even though both would be synced with your application's database." msgstr "" -#: docs/10.x/billing.md:block 242 (header) +# P +#: ./docs/8.x/billing.md:679 +#: ./docs/9.x/billing.md:757 +#: ./docs/10.x/billing.md:939 +#: ./docs/11.x/billing.md:936 +#: ./docs/master/billing.md:939 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:680 +#: ./docs/9.x/billing.md:758 +#: ./docs/10.x/billing.md:940 +#: ./docs/11.x/billing.md:937 +#: ./docs/master/billing.md:940 msgid "Checking Subscription Status" msgstr "" -#: docs/10.x/billing.md:block 243 (paragraph) +# P +#: ./docs/8.x/billing.md:682 +#: ./docs/9.x/billing.md:760 msgid "Once a customer is subscribed to your application, you may easily check their subscription status using a variety of convenient methods. First, the `subscribed` method returns `true` if the customer has an active subscription, even if the subscription is currently within its trial period. The `subscribed` method accepts the name of the subscription as its first argument:" msgstr "" -#: docs/10.x/billing.md:block 244 (code) +# CODE +#: ./docs/8.x/billing.md:684 +#: ./docs/9.x/billing.md:762 msgid "if ($user->subscribed('default')) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 245 (paragraph) +# P +#: ./docs/8.x/billing.md:688 +#: ./docs/9.x/billing.md:766 +#: ./docs/10.x/billing.md:948 +#: ./docs/11.x/billing.md:945 +#: ./docs/master/billing.md:948 msgid "The `subscribed` method also makes a great candidate for a [route middleware](/docs/{{version}}/middleware), allowing you to filter access to routes and controllers based on the user's subscription status:" msgstr "" -#: docs/10.x/billing.md:block 246 (code) +# P +#: ./docs/9.x/billing.md:689 +#: ./docs/10.x/billing.md:871 +#: ./docs/11.x/billing.md:868 +#: ./docs/master/billing.md:871 +msgid "Or, if you would like to apply a [Stripe promotion code](https://stripe.com/docs/billing/subscriptions/discounts/codes), you may use the `withPromotionCode` method:" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:690 +#: ./docs/9.x/billing.md:768 msgid "user() && ! $request->user()->subscribed('default')) {\n" " // This user is not a paying customer...\n" @@ -1289,168 +3396,537 @@ msgid "newSubscription('default', 'price_monthly')\n" +" ->withPromotionCode('promo_code_id')\n" +" ->create($paymentMethod);" +msgstr "" + +# P +#: ./docs/9.x/billing.md:695 +#: ./docs/10.x/billing.md:877 +#: ./docs/11.x/billing.md:874 +#: ./docs/master/billing.md:877 +msgid "The given promotion code ID should be the Stripe API ID assigned to the promotion code and not the customer facing promotion code. If you need to find a promotion code ID based on a given customer facing promotion code, you may use the `findPromotionCode` method:" +msgstr "" + +# CODE +#: ./docs/9.x/billing.md:697 +#: ./docs/10.x/billing.md:879 +#: ./docs/11.x/billing.md:876 +#: ./docs/master/billing.md:879 +msgid "// Find a promotion code ID by its customer facing code...\n" +"$promotionCode = $user->findPromotionCode('SUMMERSALE');\n\n" +"// Find an active promotion code ID by its customer facing code...\n" +"$promotionCode = $user->findActivePromotionCode('SUMMERSALE');" +msgstr "" + +# P +#: ./docs/9.x/billing.md:703 +#: ./docs/10.x/billing.md:885 +#: ./docs/11.x/billing.md:882 +#: ./docs/master/billing.md:885 +msgid "In the example above, the returned `$promotionCode` object is an instance of `Laravel\\Cashier\\PromotionCode`. This class decorates an underlying `Stripe\\PromotionCode` object. You can retrieve the coupon related to the promotion code by invoking the `coupon` method:" +msgstr "" + +# CODE +#: ./docs/9.x/billing.md:705 +#: ./docs/10.x/billing.md:887 +#: ./docs/11.x/billing.md:884 +#: ./docs/master/billing.md:887 +msgid "$coupon = $user->findPromotionCode('SUMMERSALE')->coupon();" +msgstr "" + +# P +#: ./docs/9.x/billing.md:707 +#: ./docs/10.x/billing.md:889 +#: ./docs/11.x/billing.md:886 +#: ./docs/master/billing.md:889 +msgid "The coupon instance allows you to determine the discount amount and whether the coupon represents a fixed discount or percentage based discount:" +msgstr "" + +# CODE +#: ./docs/9.x/billing.md:709 +#: ./docs/10.x/billing.md:891 +#: ./docs/11.x/billing.md:888 +#: ./docs/master/billing.md:891 +msgid "if ($coupon->isPercentage()) {\n" +" return $coupon->percentOff().'%'; // 21.5%\n" +"} else {\n" +" return $coupon->amountOff(); // $5.99\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/billing.md:715 +#: ./docs/10.x/billing.md:897 +#: ./docs/11.x/billing.md:894 +#: ./docs/master/billing.md:897 +msgid "You can also retrieve the discounts that are currently applied to a customer or subscription:" msgstr "" -#: docs/10.x/billing.md:block 247 (paragraph) +# P +#: ./docs/8.x/billing.md:716 +#: ./docs/9.x/billing.md:794 +#: ./docs/10.x/billing.md:976 +#: ./docs/11.x/billing.md:973 +#: ./docs/master/billing.md:976 msgid "If you would like to determine if a user is still within their trial period, you may use the `onTrial` method. This method can be useful for determining if you should display a warning to the user that they are still on their trial period:" msgstr "" -#: docs/10.x/billing.md:block 248 (code) +# CODE +#: ./docs/9.x/billing.md:717 +#: ./docs/10.x/billing.md:899 +#: ./docs/11.x/billing.md:896 +#: ./docs/master/billing.md:899 +msgid "$discount = $billable->discount();\n\n" +"$discount = $subscription->discount();" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:718 +#: ./docs/9.x/billing.md:796 msgid "if ($user->subscription('default')->onTrial()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/billing.md:721 +#: ./docs/10.x/billing.md:903 +#: ./docs/11.x/billing.md:900 +#: ./docs/master/billing.md:903 +msgid "The returned `Laravel\\Cashier\\Discount` instances decorate an underlying `Stripe\\Discount` object instance. You may retrieve the coupon related to this discount by invoking the `coupon` method:" msgstr "" -#: docs/10.x/billing.md:block 249 (paragraph) +# P +#: ./docs/8.x/billing.md:722 +#: ./docs/9.x/billing.md:800 +#: ./docs/10.x/billing.md:982 +#: ./docs/11.x/billing.md:979 +#: ./docs/master/billing.md:982 msgid "The `subscribedToProduct` method may be used to determine if the user is subscribed to a given product based on a given Stripe product's identifier. In Stripe, products are collections of prices. In this example, we will determine if the user's `default` subscription is actively subscribed to the application's \"premium\" product. The given Stripe product identifier should correspond to one of your product's identifiers in the Stripe dashboard:" msgstr "" -#: docs/10.x/billing.md:block 250 (code) +# P +#: ./docs/10.x/billing.md:723 +#: ./docs/11.x/billing.md:720 +#: ./docs/master/billing.md:723 +msgid "By default, this method will return payment methods of every type. To retrieve payment methods of a specific type, you may pass the `type` as an argument to the method:" +msgstr "" + +# CODE +#: ./docs/9.x/billing.md:723 +#: ./docs/10.x/billing.md:905 +#: ./docs/11.x/billing.md:902 +#: ./docs/master/billing.md:905 +msgid "$coupon = $subscription->discount()->coupon();" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:724 +#: ./docs/9.x/billing.md:802 msgid "if ($user->subscribedToProduct('prod_premium', 'default')) {\n" -" // ...\n" -"}\n" +" //\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/billing.md:725 +#: ./docs/10.x/billing.md:907 +#: ./docs/11.x/billing.md:904 +#: ./docs/master/billing.md:907 +msgid "If you would like to apply a new coupon or promotion code to a customer or subscription, you may do so via the `applyCoupon` or `applyPromotionCode` methods:" +msgstr "" + +# CODE +#: ./docs/9.x/billing.md:727 +#: ./docs/10.x/billing.md:909 +#: ./docs/11.x/billing.md:906 +#: ./docs/master/billing.md:909 +msgid "$billable->applyCoupon('coupon_id');\n" +"$billable->applyPromotionCode('promotion_code_id');\n\n" +"$subscription->applyCoupon('coupon_id');\n" +"$subscription->applyPromotionCode('promotion_code_id');" msgstr "" -#: docs/10.x/billing.md:block 251 (paragraph) +# P +#: ./docs/8.x/billing.md:728 +#: ./docs/9.x/billing.md:806 +#: ./docs/10.x/billing.md:988 +#: ./docs/11.x/billing.md:985 +#: ./docs/master/billing.md:988 msgid "By passing an array to the `subscribedToProduct` method, you may determine if the user's `default` subscription is actively subscribed to the application's \"basic\" or \"premium\" product:" msgstr "" -#: docs/10.x/billing.md:block 252 (code) +# CODE +#: ./docs/8.x/billing.md:730 +#: ./docs/9.x/billing.md:808 msgid "if ($user->subscribedToProduct(['prod_basic', 'prod_premium'], 'default')) {\n" -" // ...\n" -"}\n" +" //\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/billing.md:733 +#: ./docs/10.x/billing.md:915 +#: ./docs/11.x/billing.md:912 +#: ./docs/master/billing.md:915 +msgid "Remember, you should use the Stripe API ID assigned to the promotion code and not the customer facing promotion code. Only one coupon or promotion code can be applied to a customer or subscription at a given time." msgstr "" -#: docs/10.x/billing.md:block 253 (paragraph) +# P +#: ./docs/8.x/billing.md:734 +#: ./docs/9.x/billing.md:812 +#: ./docs/10.x/billing.md:994 +#: ./docs/11.x/billing.md:991 +#: ./docs/master/billing.md:994 msgid "The `subscribedToPrice` method may be used to determine if a customer's subscription corresponds to a given price ID:" msgstr "" -#: docs/10.x/billing.md:block 254 (code) +# P +#: ./docs/10.x/billing.md:735 +#: ./docs/11.x/billing.md:732 +#: ./docs/master/billing.md:735 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/billing.md:735 +#: ./docs/10.x/billing.md:917 +#: ./docs/11.x/billing.md:914 +#: ./docs/master/billing.md:917 +msgid "For more info on this subject, please consult the Stripe documentation regarding [coupons](https://stripe.com/docs/billing/subscriptions/coupons) and [promotion codes](https://stripe.com/docs/billing/subscriptions/coupons/codes)." +msgstr "" + +# H3 +#: ./docs/10.x/billing.md:736 +#: ./docs/11.x/billing.md:733 +#: ./docs/master/billing.md:736 +msgid "Payment Method Presence" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:736 +#: ./docs/9.x/billing.md:814 msgid "if ($user->subscribedToPrice('price_basic_monthly', 'default')) {\n" +" //\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/billing.md:740 +#: ./docs/11.x/billing.md:737 +#: ./docs/master/billing.md:740 +msgid "if ($user->hasDefaultPaymentMethod()) {\n" " // ...\n" -"}\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 255 (paragraph) +# P +#: ./docs/8.x/billing.md:740 +#: ./docs/9.x/billing.md:818 +#: ./docs/10.x/billing.md:1000 +#: ./docs/11.x/billing.md:997 +#: ./docs/master/billing.md:1000 msgid "The `recurring` method may be used to determine if the user is currently subscribed and is no longer within their trial period:" msgstr "" -#: docs/10.x/billing.md:block 256 (code) +# CODE +#: ./docs/8.x/billing.md:742 +#: ./docs/9.x/billing.md:820 msgid "if ($user->subscription('default')->recurring()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 257 (quote) -msgid "**Warning** If a user has two subscriptions with the same name, the most recent subscription will always be returned by the `subscription` method. For example, a user might have two subscription records named `default`; however, one of the subscriptions may be an old, expired subscription, while the other is the current, active subscription. The most recent subscription will always be returned while older subscriptions are kept in the database for historical review." +# CODE +#: ./docs/10.x/billing.md:746 +#: ./docs/11.x/billing.md:743 +#: ./docs/master/billing.md:746 +msgid "if ($user->hasPaymentMethod()) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:746 +#: ./docs/9.x/billing.md:825 +msgid "If a user has two subscriptions with the same name, the most recent subscription will always be returned by the `subscription` method. For example, a user might have two subscription records named `default`; however, one of the subscriptions may be an old, expired subscription, while the other is the current, active subscription. The most recent subscription will always be returned while older subscriptions are kept in the database for historical review." +msgstr "" + +# P +#: ./docs/8.x/billing.md:748 +#: ./docs/9.x/billing.md:827 +#: ./docs/10.x/billing.md:1009 +#: ./docs/11.x/billing.md:1006 +#: ./docs/master/billing.md:1009 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:749 +#: ./docs/9.x/billing.md:828 +#: ./docs/10.x/billing.md:1010 +#: ./docs/11.x/billing.md:1007 +#: ./docs/master/billing.md:1010 +msgid "Canceled Subscription Status" msgstr "" -#: docs/10.x/billing.md:block 259 (header) -msgid "Canceled Subscription Status" +# P +#: ./docs/10.x/billing.md:750 +#: ./docs/11.x/billing.md:747 +#: ./docs/master/billing.md:750 +msgid "This method will determine if the billable model has any payment method at all. To determine if a payment method of a specific type exists for the model, you may pass the `type` as an argument to the method:" msgstr "" -#: docs/10.x/billing.md:block 260 (paragraph) +# P +#: ./docs/8.x/billing.md:751 +#: ./docs/9.x/billing.md:830 +#: ./docs/10.x/billing.md:1012 +#: ./docs/11.x/billing.md:1009 +#: ./docs/master/billing.md:1012 msgid "To determine if the user was once an active subscriber but has canceled their subscription, you may use the `canceled` method:" msgstr "" -#: docs/10.x/billing.md:block 261 (code) -msgid "if ($user->subscription('default')->canceled()) {\n" +# P +#: ./docs/9.x/billing.md:751 +msgid "You may also create subscriptions from the Stripe dashboard itself. When doing so, Cashier will sync newly added subscriptions and assign them a name of `default`. To customize the subscription name that is assigned to dashboard created subscriptions, [extend the `WebhookController`](#defining-webhook-event-handlers) and overwrite the `newSubscriptionName` method." +msgstr "" + +# CODE +#: ./docs/10.x/billing.md:752 +#: ./docs/11.x/billing.md:749 +#: ./docs/master/billing.md:752 +msgid "if ($user->hasPaymentMethod('sepa_debit')) {\n" " // ...\n" -"}\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:753 +#: ./docs/9.x/billing.md:832 +msgid "if ($user->subscription('default')->canceled()) {\n" +" //\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/billing.md:755 +#: ./docs/10.x/billing.md:937 +#: ./docs/11.x/billing.md:934 +#: ./docs/master/billing.md:937 +msgid "Finally, you should always make sure to only add one active subscription per type of subscription offered by your application. If a customer has two `default` subscriptions, only the most recently added subscription will be used by Cashier even though both would be synced with your application's database." +msgstr "" + +# H3 +#: ./docs/10.x/billing.md:757 +#: ./docs/11.x/billing.md:754 +#: ./docs/master/billing.md:757 +msgid "Updating the Default Payment Method" msgstr "" -#: docs/10.x/billing.md:block 262 (paragraph) +# P +#: ./docs/8.x/billing.md:757 +#: ./docs/9.x/billing.md:836 +#: ./docs/10.x/billing.md:1018 +#: ./docs/11.x/billing.md:1015 +#: ./docs/master/billing.md:1018 msgid "You may also determine if a user has canceled their subscription but are still on their \"grace period\" until the subscription fully expires. For example, if a user cancels a subscription on March 5th that was originally scheduled to expire on March 10th, the user is on their \"grace period\" until March 10th. Note that the `subscribed` method still returns `true` during this time:" msgstr "" -#: docs/10.x/billing.md:block 263 (code) +# CODE +#: ./docs/8.x/billing.md:759 +#: ./docs/8.x/billing.md:1197 +#: ./docs/9.x/billing.md:838 +#: ./docs/9.x/billing.md:1309 msgid "if ($user->subscription('default')->onGracePeriod()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 264 (paragraph) +# P +#: ./docs/8.x/billing.md:763 +#: ./docs/9.x/billing.md:842 +#: ./docs/10.x/billing.md:1024 +#: ./docs/11.x/billing.md:1021 +#: ./docs/master/billing.md:1024 msgid "To determine if the user has canceled their subscription and is no longer within their \"grace period\", you may use the `ended` method:" msgstr "" -#: docs/10.x/billing.md:block 265 (code) +# CODE +#: ./docs/8.x/billing.md:765 +#: ./docs/9.x/billing.md:844 msgid "if ($user->subscription('default')->ended()) {\n" -" // ...\n" -"}\n" -msgstr "" - -#: docs/10.x/billing.md:block 267 (header) +" //\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:769 +#: ./docs/9.x/billing.md:848 +#: ./docs/10.x/billing.md:1030 +#: ./docs/11.x/billing.md:1027 +#: ./docs/master/billing.md:1030 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:770 +#: ./docs/9.x/billing.md:849 +#: ./docs/10.x/billing.md:1031 +#: ./docs/11.x/billing.md:1028 +#: ./docs/master/billing.md:1031 msgid "Incomplete and Past Due Status" msgstr "" -#: docs/10.x/billing.md:block 268 (paragraph) +# P +#: ./docs/8.x/billing.md:772 +#: ./docs/9.x/billing.md:851 +#: ./docs/10.x/billing.md:1033 +#: ./docs/11.x/billing.md:1030 +#: ./docs/master/billing.md:1033 msgid "If a subscription requires a secondary payment action after creation the subscription will be marked as `incomplete`. Subscription statuses are stored in the `stripe_status` column of Cashier's `subscriptions` database table." msgstr "" -#: docs/10.x/billing.md:block 269 (paragraph) +# P +#: ./docs/8.x/billing.md:774 +#: ./docs/9.x/billing.md:853 +#: ./docs/10.x/billing.md:1035 +#: ./docs/11.x/billing.md:1032 +#: ./docs/master/billing.md:1035 msgid "Similarly, if a secondary payment action is required when swapping prices the subscription will be marked as `past_due`. When your subscription is in either of these states it will not be active until the customer has confirmed their payment. Determining if a subscription has an incomplete payment may be accomplished using the `hasIncompletePayment` method on the billable model or a subscription instance:" msgstr "" -#: docs/10.x/billing.md:block 270 (code) +# CODE +#: ./docs/8.x/billing.md:776 +#: ./docs/8.x/billing.md:1812 +#: ./docs/9.x/billing.md:855 +#: ./docs/9.x/billing.md:2026 msgid "if ($user->hasIncompletePayment('default')) {\n" -" // ...\n" +" //\n" "}\n\n" "if ($user->subscription('default')->hasIncompletePayment()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 271 (paragraph) +# P +#: ./docs/8.x/billing.md:784 +#: ./docs/9.x/billing.md:863 +#: ./docs/10.x/billing.md:1045 +#: ./docs/11.x/billing.md:1042 +#: ./docs/master/billing.md:1045 msgid "When a subscription has an incomplete payment, you should direct the user to Cashier's payment confirmation page, passing the `latestPayment` identifier. You may use the `latestPayment` method available on subscription instance to retrieve this identifier:" msgstr "" -#: docs/10.x/billing.md:block 272 (code) +# CODE: html +#: ./docs/8.x/billing.md:786 +#: ./docs/9.x/billing.md:865 +#: ./docs/10.x/billing.md:1047 +#: ./docs/11.x/billing.md:1044 +#: ./docs/master/billing.md:1047 msgid "latestPayment()->id) }}\">\n" " Please confirm your payment.\n" -"\n" +"" msgstr "" -#: docs/10.x/billing.md:block 273 (paragraph) -msgid "If you would like the subscription to still be considered active when it's in a `past_due` or `incomplete` state, you may use the `keepPastDueSubscriptionsActive` and `keepIncompleteSubscriptionsActive` methods provided by Cashier. Typically, these methods should be called in the `register` method of your `App\\Providers\\AppServiceProvider`:" +# P +#: ./docs/8.x/billing.md:792 +msgid "If you would like the subscription to still be considered active when it's in a `past_due` state, you may use the `keepPastDueSubscriptionsActive` method provided by Cashier. Typically, this method should be called in the `register` method of your `App\\Providers\\AppServiceProvider`:" msgstr "" -#: docs/10.x/billing.md:block 274 (code) +# CODE +#: ./docs/8.x/billing.md:794 msgid "use Laravel\\Cashier\\Cashier;\n\n" "/**\n" " * Register any application services.\n" +" *\n" +" * @return void\n" " */\n" -"public function register(): void\n" +"public function register()\n" "{\n" " Cashier::keepPastDueSubscriptionsActive();\n" -" Cashier::keepIncompleteSubscriptionsActive();\n" -"}\n" -msgstr "" - -#: docs/10.x/billing.md:block 275 (quote) -msgid "**Warning** When a subscription is in an `incomplete` state it cannot be changed until the payment is confirmed. Therefore, the `swap` and `updateQuantity` methods will throw an exception when the subscription is in an `incomplete` state." -msgstr "" - -#: docs/10.x/billing.md:block 277 (header) +"}" +msgstr "" + +# P +#: ./docs/10.x/billing.md:795 +#: ./docs/11.x/billing.md:792 +#: ./docs/master/billing.md:795 +msgid "By default, this method will delete payment methods of every type. To delete payment methods of a specific type you can pass the `type` as an argument to the method:" +msgstr "" + +# P +#: ./docs/8.x/billing.md:806 +#: ./docs/9.x/billing.md:887 +#: ./docs/10.x/billing.md:1067 +#: ./docs/11.x/billing.md:1064 +#: ./docs/master/billing.md:1067 +msgid "When a subscription is in an `incomplete` state it cannot be changed until the payment is confirmed. Therefore, the `swap` and `updateQuantity` methods will throw an exception when the subscription is in an `incomplete` state." +msgstr "" + +# P +#: ./docs/8.x/billing.md:808 +#: ./docs/9.x/billing.md:889 +#: ./docs/10.x/billing.md:1069 +#: ./docs/11.x/billing.md:1066 +#: ./docs/master/billing.md:1069 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:809 +#: ./docs/9.x/billing.md:890 +#: ./docs/10.x/billing.md:1070 +#: ./docs/11.x/billing.md:1067 +#: ./docs/master/billing.md:1070 msgid "Subscription Scopes" msgstr "" -#: docs/10.x/billing.md:block 278 (paragraph) +# P +#: ./docs/8.x/billing.md:811 +#: ./docs/9.x/billing.md:892 +#: ./docs/10.x/billing.md:1072 +#: ./docs/11.x/billing.md:1069 +#: ./docs/master/billing.md:1072 msgid "Most subscription states are also available as query scopes so that you may easily query your database for subscriptions that are in a given state:" msgstr "" -#: docs/10.x/billing.md:block 279 (code) +# CODE +#: ./docs/8.x/billing.md:813 +#: ./docs/9.x/billing.md:894 +#: ./docs/10.x/billing.md:1074 +#: ./docs/11.x/billing.md:1071 +#: ./docs/master/billing.md:1074 msgid "// Get all active subscriptions...\n" "$subscriptions = Subscription::query()->active()->get();\n\n" "// Get all of the canceled subscriptions for a user...\n" -"$subscriptions = $user->subscriptions()->canceled()->get();\n" +"$subscriptions = $user->subscriptions()->canceled()->get();" msgstr "" -#: docs/10.x/billing.md:block 280 (paragraph) +# P +#: ./docs/8.x/billing.md:819 +#: ./docs/9.x/billing.md:900 +#: ./docs/10.x/billing.md:1080 +#: ./docs/11.x/billing.md:1077 +#: ./docs/master/billing.md:1080 msgid "A complete list of available scopes is available below:" msgstr "" -#: docs/10.x/billing.md:block 281 (code) +# CODE +#: ./docs/8.x/billing.md:821 +#: ./docs/9.x/billing.md:902 +#: ./docs/10.x/billing.md:1082 +#: ./docs/11.x/billing.md:1079 +#: ./docs/master/billing.md:1082 msgid "Subscription::query()->active();\n" "Subscription::query()->canceled();\n" "Subscription::query()->ended();\n" @@ -1461,75 +3937,224 @@ msgid "Subscription::query()->active();\n" "Subscription::query()->onGracePeriod();\n" "Subscription::query()->onTrial();\n" "Subscription::query()->pastDue();\n" -"Subscription::query()->recurring();\n" +"Subscription::query()->recurring();" msgstr "" -#: docs/10.x/billing.md:block 283 (header) +# P +#: ./docs/10.x/billing.md:822 +#: ./docs/11.x/billing.md:819 +#: ./docs/master/billing.md:822 +msgid "The first argument passed to the `newSubscription` method should be the internal type of the subscription. If your application only offers a single subscription, you might call this `default` or `primary`. This subscription type is only for internal application usage and is not meant to be shown to users. In addition, it should not contain spaces and it should never be changed after creating the subscription. The second argument is the specific price the user is subscribing to. This value should correspond to the price's identifier in Stripe." +msgstr "" + +# H4 +#: ./docs/10.x/billing.md:830 +#: ./docs/11.x/billing.md:827 +#: ./docs/master/billing.md:830 +msgid "Collecting Recurring Payments via Invoice Emails" +msgstr "" + +# P +#: ./docs/11.x/billing.md:833 +msgid "The amount of time a customer has to pay their invoice before their subscription is canceled is determined by the `days_until_due` option. By default, this is 30 days; however, you may provide a specific value for this option if you wish:" +msgstr "" + +# P +#: ./docs/8.x/billing.md:833 +#: ./docs/9.x/billing.md:914 +#: ./docs/10.x/billing.md:1094 +#: ./docs/11.x/billing.md:1091 +#: ./docs/master/billing.md:1094 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:834 +#: ./docs/9.x/billing.md:915 +#: ./docs/10.x/billing.md:1095 +#: ./docs/11.x/billing.md:1092 +#: ./docs/master/billing.md:1095 msgid "Changing Prices" msgstr "" -#: docs/10.x/billing.md:block 284 (paragraph) +# P +#: ./docs/8.x/billing.md:836 +#: ./docs/9.x/billing.md:917 +#: ./docs/10.x/billing.md:1097 +#: ./docs/11.x/billing.md:1094 +#: ./docs/master/billing.md:1097 msgid "After a customer is subscribed to your application, they may occasionally want to change to a new subscription price. To swap a customer to a new price, pass the Stripe price's identifier to the `swap` method. When swapping prices, it is assumed that the user would like to re-activate their subscription if it was previously canceled. The given price identifier should correspond to a Stripe price identifier available in the Stripe dashboard:" msgstr "" -#: docs/10.x/billing.md:block 285 (code) +# CODE +#: ./docs/8.x/billing.md:838 +#: ./docs/9.x/billing.md:919 +#: ./docs/10.x/billing.md:1099 +#: ./docs/11.x/billing.md:1096 +#: ./docs/master/billing.md:1099 msgid "use App\\Models\\User;\n\n" "$user = App\\Models\\User::find(1);\n\n" -"$user->subscription('default')->swap('price_yearly');\n" +"$user->subscription('default')->swap('price_yearly');" msgstr "" -#: docs/10.x/billing.md:block 286 (paragraph) +# P +#: ./docs/8.x/billing.md:844 +#: ./docs/9.x/billing.md:925 +#: ./docs/10.x/billing.md:1105 +#: ./docs/11.x/billing.md:1102 +#: ./docs/master/billing.md:1105 msgid "If the customer is on trial, the trial period will be maintained. Additionally, if a \"quantity\" exists for the subscription, that quantity will also be maintained." msgstr "" -#: docs/10.x/billing.md:block 287 (paragraph) +# P +#: ./docs/8.x/billing.md:846 +#: ./docs/9.x/billing.md:927 +#: ./docs/10.x/billing.md:1107 +#: ./docs/11.x/billing.md:1104 +#: ./docs/master/billing.md:1107 msgid "If you would like to swap prices and cancel any trial period the customer is currently on, you may invoke the `skipTrial` method:" msgstr "" -#: docs/10.x/billing.md:block 288 (code) +# CODE +#: ./docs/8.x/billing.md:848 +#: ./docs/9.x/billing.md:929 +#: ./docs/10.x/billing.md:1109 +#: ./docs/11.x/billing.md:1106 +#: ./docs/master/billing.md:1109 msgid "$user->subscription('default')\n" " ->skipTrial()\n" -" ->swap('price_yearly');\n" +" ->swap('price_yearly');" msgstr "" -#: docs/10.x/billing.md:block 289 (paragraph) +# P +#: ./docs/8.x/billing.md:852 +#: ./docs/9.x/billing.md:933 +#: ./docs/10.x/billing.md:1113 +#: ./docs/11.x/billing.md:1110 +#: ./docs/master/billing.md:1113 msgid "If you would like to swap prices and immediately invoice the customer instead of waiting for their next billing cycle, you may use the `swapAndInvoice` method:" msgstr "" -#: docs/10.x/billing.md:block 290 (code) +# CODE +#: ./docs/8.x/billing.md:854 +#: ./docs/9.x/billing.md:935 +#: ./docs/10.x/billing.md:1115 +#: ./docs/11.x/billing.md:1112 +#: ./docs/master/billing.md:1115 msgid "$user = User::find(1);\n\n" -"$user->subscription('default')->swapAndInvoice('price_yearly');\n" +"$user->subscription('default')->swapAndInvoice('price_yearly');" +msgstr "" + +# P +#: ./docs/8.x/billing.md:858 +#: ./docs/9.x/billing.md:939 +#: ./docs/10.x/billing.md:1119 +#: ./docs/11.x/billing.md:1116 +#: ./docs/master/billing.md:1119 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:859 +#: ./docs/9.x/billing.md:940 +#: ./docs/10.x/billing.md:1120 +#: ./docs/11.x/billing.md:1117 +#: ./docs/master/billing.md:1120 +msgid "Prorations" msgstr "" -#: docs/10.x/billing.md:block 292 (header) -msgid "Prorations" -msgstr "" - -#: docs/10.x/billing.md:block 293 (paragraph) +# P +#: ./docs/8.x/billing.md:861 +#: ./docs/9.x/billing.md:942 +#: ./docs/10.x/billing.md:1122 +#: ./docs/11.x/billing.md:1119 +#: ./docs/master/billing.md:1122 msgid "By default, Stripe prorates charges when swapping between prices. The `noProrate` method may be used to update the subscription's price without prorating the charges:" msgstr "" -#: docs/10.x/billing.md:block 294 (code) -msgid "$user->subscription('default')->noProrate()->swap('price_yearly');\n" +# CODE +#: ./docs/8.x/billing.md:863 +#: ./docs/9.x/billing.md:944 +#: ./docs/10.x/billing.md:1124 +#: ./docs/11.x/billing.md:1121 +#: ./docs/master/billing.md:1124 +msgid "$user->subscription('default')->noProrate()->swap('price_yearly');" msgstr "" -#: docs/10.x/billing.md:block 295 (paragraph) +# P +#: ./docs/8.x/billing.md:865 +#: ./docs/9.x/billing.md:946 +#: ./docs/10.x/billing.md:1126 +#: ./docs/11.x/billing.md:1123 +#: ./docs/master/billing.md:1126 msgid "For more information on subscription proration, consult the [Stripe documentation](https://stripe.com/docs/billing/subscriptions/prorations)." msgstr "" -#: docs/10.x/billing.md:block 296 (quote) -msgid "**Warning** Executing the `noProrate` method before the `swapAndInvoice` method will have no effect on proration. An invoice will always be issued." +# P +#: ./docs/8.x/billing.md:867 +#: ./docs/9.x/billing.md:949 +#: ./docs/10.x/billing.md:1129 +#: ./docs/11.x/billing.md:1126 +#: ./docs/master/billing.md:1129 +msgid "Executing the `noProrate` method before the `swapAndInvoice` method will have no effect on proration. An invoice will always be issued." +msgstr "" + +# P +#: ./docs/8.x/billing.md:869 +#: ./docs/9.x/billing.md:951 +#: ./docs/10.x/billing.md:1131 +#: ./docs/11.x/billing.md:1128 +#: ./docs/master/billing.md:1131 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:870 +#: ./docs/9.x/billing.md:952 +#: ./docs/10.x/billing.md:1132 +#: ./docs/11.x/billing.md:1129 +#: ./docs/master/billing.md:1132 +msgid "Subscription Quantity" msgstr "" -#: docs/10.x/billing.md:block 298 (header) -msgid "Subscription Quantity" +# P +#: ./docs/9.x/billing.md:871 +#: ./docs/10.x/billing.md:1053 +#: ./docs/11.x/billing.md:1050 +#: ./docs/master/billing.md:1053 +msgid "If you would like the subscription to still be considered active when it's in a `past_due` or `incomplete` state, you may use the `keepPastDueSubscriptionsActive` and `keepIncompleteSubscriptionsActive` methods provided by Cashier. Typically, these methods should be called in the `register` method of your `App\\Providers\\AppServiceProvider`:" msgstr "" -#: docs/10.x/billing.md:block 299 (paragraph) +# P +#: ./docs/8.x/billing.md:872 +#: ./docs/9.x/billing.md:954 +#: ./docs/10.x/billing.md:1134 +#: ./docs/11.x/billing.md:1131 +#: ./docs/master/billing.md:1134 msgid "Sometimes subscriptions are affected by \"quantity\". For example, a project management application might charge $10 per month per project. You may use the `incrementQuantity` and `decrementQuantity` methods to easily increment or decrement your subscription quantity:" msgstr "" -#: docs/10.x/billing.md:block 300 (code) +# CODE +#: ./docs/9.x/billing.md:873 +msgid "use Laravel\\Cashier\\Cashier;\n\n" +"/**\n" +" * Register any application services.\n" +" *\n" +" * @return void\n" +" */\n" +"public function register()\n" +"{\n" +" Cashier::keepPastDueSubscriptionsActive();\n" +" Cashier::keepIncompleteSubscriptionsActive();\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:874 +#: ./docs/9.x/billing.md:956 +#: ./docs/10.x/billing.md:1136 +#: ./docs/11.x/billing.md:1133 +#: ./docs/master/billing.md:1136 msgid "use App\\Models\\User;\n\n" "$user = User::find(1);\n\n" "$user->subscription('default')->incrementQuantity();\n\n" @@ -1537,54 +4162,104 @@ msgid "use App\\Models\\User;\n\n" "$user->subscription('default')->incrementQuantity(5);\n\n" "$user->subscription('default')->decrementQuantity();\n\n" "// Subtract five from the subscription's current quantity...\n" -"$user->subscription('default')->decrementQuantity(5);\n" +"$user->subscription('default')->decrementQuantity(5);" msgstr "" -#: docs/10.x/billing.md:block 301 (paragraph) +# P +#: ./docs/8.x/billing.md:888 +#: ./docs/9.x/billing.md:970 +#: ./docs/10.x/billing.md:1150 +#: ./docs/11.x/billing.md:1147 +#: ./docs/master/billing.md:1150 msgid "Alternatively, you may set a specific quantity using the `updateQuantity` method:" msgstr "" -#: docs/10.x/billing.md:block 302 (code) -msgid "$user->subscription('default')->updateQuantity(10);\n" +# CODE +#: ./docs/8.x/billing.md:890 +#: ./docs/9.x/billing.md:972 +#: ./docs/10.x/billing.md:1152 +#: ./docs/11.x/billing.md:1149 +#: ./docs/master/billing.md:1152 +msgid "$user->subscription('default')->updateQuantity(10);" msgstr "" -#: docs/10.x/billing.md:block 303 (paragraph) +# P +#: ./docs/8.x/billing.md:892 +#: ./docs/9.x/billing.md:974 +#: ./docs/10.x/billing.md:1154 +#: ./docs/11.x/billing.md:1151 +#: ./docs/master/billing.md:1154 msgid "The `noProrate` method may be used to update the subscription's quantity without prorating the charges:" msgstr "" -#: docs/10.x/billing.md:block 304 (code) -msgid "$user->subscription('default')->noProrate()->updateQuantity(10);\n" +# CODE +#: ./docs/8.x/billing.md:894 +#: ./docs/9.x/billing.md:976 +#: ./docs/10.x/billing.md:1156 +#: ./docs/11.x/billing.md:1153 +#: ./docs/master/billing.md:1156 +msgid "$user->subscription('default')->noProrate()->updateQuantity(10);" msgstr "" -#: docs/10.x/billing.md:block 305 (paragraph) +# P +#: ./docs/8.x/billing.md:896 +#: ./docs/9.x/billing.md:978 +#: ./docs/10.x/billing.md:1158 +#: ./docs/11.x/billing.md:1155 +#: ./docs/master/billing.md:1158 msgid "For more information on subscription quantities, consult the [Stripe documentation](https://stripe.com/docs/subscriptions/quantities)." msgstr "" -#: docs/10.x/billing.md:block 307 (header) -msgid "Quantities For Subscriptions With Multiple Products" +# P +#: ./docs/8.x/billing.md:898 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:899 +msgid "Multiprice Subscription Quantities" msgstr "" -#: docs/10.x/billing.md:block 308 (paragraph) -msgid "If your subscription is a [subscription with multiple products](#subscriptions-with-multiple-products), you should pass the ID of the price whose quantity you wish to increment or decrement as the second argument to the increment / decrement methods:" +# P +#: ./docs/8.x/billing.md:901 +msgid "If your subscription is a [multiprice subscription](#multiprice-subscriptions), you should pass the name of the price whose quantity you wish to increment or decrement as the second argument to the increment / decrement methods:" msgstr "" -#: docs/10.x/billing.md:block 309 (code) -msgid "$user->subscription('default')->incrementQuantity(1, 'price_chat');\n" +# CODE +#: ./docs/8.x/billing.md:903 +#: ./docs/9.x/billing.md:985 +#: ./docs/10.x/billing.md:1165 +#: ./docs/11.x/billing.md:1162 +#: ./docs/master/billing.md:1165 +msgid "$user->subscription('default')->incrementQuantity(1, 'price_chat');" msgstr "" -#: docs/10.x/billing.md:block 311 (header) -msgid "Subscriptions With Multiple Products" +# P +#: ./docs/8.x/billing.md:905 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:906 +msgid "Multiprice Subscriptions" msgstr "" -#: docs/10.x/billing.md:block 312 (paragraph) -msgid "[Subscription with multiple products](https://stripe.com/docs/billing/subscriptions/multiple-products) allow you to assign multiple billing products to a single subscription. For example, imagine you are building a customer service \"helpdesk\" application that has a base subscription price of $10 per month but offers a live chat add-on product for an additional $15 per month. Information for subscriptions with multiple products is stored in Cashier's `subscription_items` database table." +# P +#: ./docs/8.x/billing.md:908 +msgid "[Multiprice subscriptions](https://stripe.com/docs/billing/subscriptions/multiple-products) allow you to assign multiple billing prices to a single subscription. For example, imagine you are building a customer service \"helpdesk\" application that has a base subscription price of $10 per month but offers a live chat add-on price for an additional $15 per month. Multiprice subscription information is stored in Cashier's `subscription_items` database table." msgstr "" -#: docs/10.x/billing.md:block 313 (paragraph) -msgid "You may specify multiple products for a given subscription by passing an array of prices as the second argument to the `newSubscription` method:" +# P +#: ./docs/8.x/billing.md:910 +msgid "You may specify multiple prices for a given subscription by passing an array of prices as the second argument to the `newSubscription` method:" msgstr "" -#: docs/10.x/billing.md:block 314 (code) +# CODE +#: ./docs/8.x/billing.md:912 +#: ./docs/9.x/billing.md:994 +#: ./docs/10.x/billing.md:1174 +#: ./docs/11.x/billing.md:1171 +#: ./docs/master/billing.md:1174 msgid "use Illuminate\\Http\\Request;\n\n" "Route::post('/user/subscribe', function (Request $request) {\n" " $request->user()->newSubscription('default', [\n" @@ -1592,399 +4267,1142 @@ msgid "use Illuminate\\Http\\Request;\n\n" " 'price_chat',\n" " ])->create($request->paymentMethodId);\n\n" " // ...\n" -"});\n" +"});" msgstr "" -#: docs/10.x/billing.md:block 315 (paragraph) +# P +#: ./docs/8.x/billing.md:923 +#: ./docs/9.x/billing.md:1005 +#: ./docs/10.x/billing.md:1185 +#: ./docs/11.x/billing.md:1182 +#: ./docs/master/billing.md:1185 msgid "In the example above, the customer will have two prices attached to their `default` subscription. Both prices will be charged on their respective billing intervals. If necessary, you may use the `quantity` method to indicate a specific quantity for each price:" msgstr "" -#: docs/10.x/billing.md:block 316 (code) +# CODE +#: ./docs/8.x/billing.md:925 +#: ./docs/9.x/billing.md:1007 +#: ./docs/10.x/billing.md:1187 +#: ./docs/11.x/billing.md:1184 +#: ./docs/master/billing.md:1187 msgid "$user = User::find(1);\n\n" "$user->newSubscription('default', ['price_monthly', 'price_chat'])\n" " ->quantity(5, 'price_chat')\n" -" ->create($paymentMethod);\n" +" ->create($paymentMethod);" +msgstr "" + +# H4 +#: ./docs/10.x/billing.md:931 +#: ./docs/11.x/billing.md:928 +#: ./docs/master/billing.md:931 +msgid "Creating Subscriptions From the Stripe Dashboard" msgstr "" -#: docs/10.x/billing.md:block 317 (paragraph) +# P +#: ./docs/8.x/billing.md:931 +#: ./docs/9.x/billing.md:1013 +#: ./docs/10.x/billing.md:1193 +#: ./docs/11.x/billing.md:1190 +#: ./docs/master/billing.md:1193 msgid "If you would like to add another price to an existing subscription, you may invoke the subscription's `addPrice` method:" msgstr "" -#: docs/10.x/billing.md:block 318 (code) +# P +#: ./docs/10.x/billing.md:933 +#: ./docs/11.x/billing.md:930 +#: ./docs/master/billing.md:933 +msgid "You may also create subscriptions from the Stripe dashboard itself. When doing so, Cashier will sync newly added subscriptions and assign them a type of `default`. To customize the subscription type that is assigned to dashboard created subscriptions, [define webhook event handlers](#defining-webhook-event-handlers)." +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:933 +#: ./docs/9.x/billing.md:1015 +#: ./docs/10.x/billing.md:1195 +#: ./docs/11.x/billing.md:1192 +#: ./docs/master/billing.md:1195 msgid "$user = User::find(1);\n\n" -"$user->subscription('default')->addPrice('price_chat');\n" +"$user->subscription('default')->addPrice('price_chat');" +msgstr "" + +# P +#: ./docs/10.x/billing.md:935 +#: ./docs/11.x/billing.md:932 +#: ./docs/master/billing.md:935 +msgid "In addition, you may only create one type of subscription via the Stripe dashboard. If your application offers multiple subscriptions that use different types, only one type of subscription may be added through the Stripe dashboard." msgstr "" -#: docs/10.x/billing.md:block 319 (paragraph) +# P +#: ./docs/8.x/billing.md:937 +#: ./docs/9.x/billing.md:1019 +#: ./docs/10.x/billing.md:1199 +#: ./docs/11.x/billing.md:1196 +#: ./docs/master/billing.md:1199 msgid "The example above will add the new price and the customer will be billed for it on their next billing cycle. If you would like to bill the customer immediately you may use the `addPriceAndInvoice` method:" msgstr "" -#: docs/10.x/billing.md:block 320 (code) -msgid "$user->subscription('default')->addPriceAndInvoice('price_chat');\n" +# CODE +#: ./docs/8.x/billing.md:939 +#: ./docs/9.x/billing.md:1021 +#: ./docs/10.x/billing.md:1201 +#: ./docs/11.x/billing.md:1198 +#: ./docs/master/billing.md:1201 +msgid "$user->subscription('default')->addPriceAndInvoice('price_chat');" msgstr "" -#: docs/10.x/billing.md:block 321 (paragraph) +# P +#: ./docs/8.x/billing.md:941 +#: ./docs/9.x/billing.md:1023 +#: ./docs/10.x/billing.md:1203 +#: ./docs/11.x/billing.md:1200 +#: ./docs/master/billing.md:1203 msgid "If you would like to add a price with a specific quantity, you can pass the quantity as the second argument of the `addPrice` or `addPriceAndInvoice` methods:" msgstr "" -#: docs/10.x/billing.md:block 322 (code) +# P +#: ./docs/10.x/billing.md:942 +#: ./docs/11.x/billing.md:939 +#: ./docs/master/billing.md:942 +msgid "Once a customer is subscribed to your application, you may easily check their subscription status using a variety of convenient methods. First, the `subscribed` method returns `true` if the customer has an active subscription, even if the subscription is currently within its trial period. The `subscribed` method accepts the type of the subscription as its first argument:" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:943 +#: ./docs/9.x/billing.md:1025 +#: ./docs/10.x/billing.md:1205 +#: ./docs/11.x/billing.md:1202 +#: ./docs/master/billing.md:1205 msgid "$user = User::find(1);\n\n" -"$user->subscription('default')->addPrice('price_chat', 5);\n" +"$user->subscription('default')->addPrice('price_chat', 5);" msgstr "" -#: docs/10.x/billing.md:block 323 (paragraph) -msgid "You may remove prices from subscriptions using the `removePrice` method:" +# CODE +#: ./docs/10.x/billing.md:944 +#: ./docs/11.x/billing.md:941 +#: ./docs/master/billing.md:944 +msgid "if ($user->subscribed('default')) {\n" +" // ...\n" +"}" +msgstr "" + +# CODE +#: ./docs/11.x/billing.md:947 +msgid "user() && ! $request->user()->subscribed('default')) {\n" +" // This user is not a paying customer...\n" +" return redirect('/billing');\n" +" }\n\n" +" return $next($request);\n" +" }\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 324 (code) -msgid "$user->subscription('default')->removePrice('price_chat');\n" +# P +#: ./docs/8.x/billing.md:947 +#: ./docs/9.x/billing.md:1029 +#: ./docs/10.x/billing.md:1209 +#: ./docs/11.x/billing.md:1206 +#: ./docs/master/billing.md:1209 +msgid "You may remove prices from subscriptions using the `removePrice` method:" msgstr "" -#: docs/10.x/billing.md:block 325 (quote) -msgid "**Warning** You may not remove the last price on a subscription. Instead, you should simply cancel the subscription." +# CODE +#: ./docs/8.x/billing.md:949 +#: ./docs/9.x/billing.md:1031 +#: ./docs/10.x/billing.md:1211 +#: ./docs/11.x/billing.md:1208 +#: ./docs/master/billing.md:1211 +msgid "$user->subscription('default')->removePrice('price_chat');" msgstr "" -#: docs/10.x/billing.md:block 327 (header) +# CODE +#: ./docs/10.x/billing.md:950 +#: ./docs/master/billing.md:950 +msgid "user() && ! $request->user()->subscribed('default')) {\n" +" // This user is not a paying customer...\n" +" return redirect('billing');\n" +" }\n\n" +" return $next($request);\n" +" }\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:951 +#: ./docs/9.x/billing.md:1034 +#: ./docs/10.x/billing.md:1214 +#: ./docs/11.x/billing.md:1211 +#: ./docs/master/billing.md:1214 +msgid "You may not remove the last price on a subscription. Instead, you should simply cancel the subscription." +msgstr "" + +# P +#: ./docs/8.x/billing.md:953 +#: ./docs/9.x/billing.md:1036 +#: ./docs/10.x/billing.md:1216 +#: ./docs/11.x/billing.md:1213 +#: ./docs/master/billing.md:1216 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:954 +#: ./docs/9.x/billing.md:1037 +#: ./docs/10.x/billing.md:1217 +#: ./docs/11.x/billing.md:1214 +#: ./docs/master/billing.md:1217 msgid "Swapping Prices" msgstr "" -#: docs/10.x/billing.md:block 328 (paragraph) -msgid "You may also change the prices attached to a subscription with multiple products. For example, imagine a customer has a `price_basic` subscription with a `price_chat` add-on product and you want to upgrade the customer from the `price_basic` to the `price_pro` price:" +# P +#: ./docs/8.x/billing.md:956 +msgid "You may also change the prices attached to a multiprice subscription. For example, imagine a customer has a `price_basic` subscription with a `price_chat` add-on price and you want to upgrade the customer from the `price_basic` to the `price_pro` price:" msgstr "" -#: docs/10.x/billing.md:block 329 (code) +# CODE +#: ./docs/8.x/billing.md:958 +#: ./docs/9.x/billing.md:1041 +#: ./docs/10.x/billing.md:1221 +#: ./docs/11.x/billing.md:1218 +#: ./docs/master/billing.md:1221 msgid "use App\\Models\\User;\n\n" "$user = User::find(1);\n\n" -"$user->subscription('default')->swap(['price_pro', 'price_chat']);\n" +"$user->subscription('default')->swap(['price_pro', 'price_chat']);" msgstr "" -#: docs/10.x/billing.md:block 330 (paragraph) +# P +#: ./docs/8.x/billing.md:964 +#: ./docs/9.x/billing.md:1047 +#: ./docs/10.x/billing.md:1227 +#: ./docs/11.x/billing.md:1224 +#: ./docs/master/billing.md:1227 msgid "When executing the example above, the underlying subscription item with the `price_basic` is deleted and the one with the `price_chat` is preserved. Additionally, a new subscription item for the `price_pro` is created." msgstr "" -#: docs/10.x/billing.md:block 331 (paragraph) +# P +#: ./docs/8.x/billing.md:966 +#: ./docs/9.x/billing.md:1049 +#: ./docs/10.x/billing.md:1229 +#: ./docs/11.x/billing.md:1226 +#: ./docs/master/billing.md:1229 msgid "You can also specify subscription item options by passing an array of key / value pairs to the `swap` method. For example, you may need to specify the subscription price quantities:" msgstr "" -#: docs/10.x/billing.md:block 332 (code) +# CODE +#: ./docs/8.x/billing.md:968 +#: ./docs/9.x/billing.md:1051 +#: ./docs/10.x/billing.md:1231 +#: ./docs/11.x/billing.md:1228 +#: ./docs/master/billing.md:1231 msgid "$user = User::find(1);\n\n" "$user->subscription('default')->swap([\n" " 'price_pro' => ['quantity' => 5],\n" " 'price_chat'\n" -"]);\n" +"]);" msgstr "" -#: docs/10.x/billing.md:block 333 (paragraph) +# P +#: ./docs/8.x/billing.md:975 +#: ./docs/9.x/billing.md:1058 +#: ./docs/10.x/billing.md:1238 +#: ./docs/11.x/billing.md:1235 +#: ./docs/master/billing.md:1238 msgid "If you want to swap a single price on a subscription, you may do so using the `swap` method on the subscription item itself. This approach is particularly useful if you would like to preserve all of the existing metadata on the subscription's other prices:" msgstr "" -#: docs/10.x/billing.md:block 334 (code) +# CODE +#: ./docs/8.x/billing.md:977 +#: ./docs/9.x/billing.md:1060 +#: ./docs/10.x/billing.md:1240 +#: ./docs/11.x/billing.md:1237 +#: ./docs/master/billing.md:1240 msgid "$user = User::find(1);\n\n" "$user->subscription('default')\n" " ->findItemOrFail('price_basic')\n" -" ->swap('price_pro');\n" +" ->swap('price_pro');" msgstr "" -#: docs/10.x/billing.md:block 336 (header) -msgid "Proration" +# CODE +#: ./docs/10.x/billing.md:978 +#: ./docs/11.x/billing.md:975 +#: ./docs/master/billing.md:978 +msgid "if ($user->subscription('default')->onTrial()) {\n" +" // ...\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 337 (paragraph) -msgid "By default, Stripe will prorate charges when adding or removing prices from a subscription with multiple products. If you would like to make a price adjustment without proration, you should chain the `noProrate` method onto your price operation:" +# P +#: ./docs/9.x/billing.md:980 +#: ./docs/10.x/billing.md:1160 +#: ./docs/11.x/billing.md:1157 +#: ./docs/master/billing.md:1160 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/billing.md:981 +msgid "Quantities For Subscriptions With Multiple Products" msgstr "" -#: docs/10.x/billing.md:block 338 (code) -msgid "$user->subscription('default')->noProrate()->removePrice('price_chat');\n" +# P +#: ./docs/8.x/billing.md:983 +#: ./docs/9.x/billing.md:1066 +#: ./docs/10.x/billing.md:1246 +#: ./docs/11.x/billing.md:1243 +#: ./docs/master/billing.md:1246 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/billing.md:983 +#: ./docs/10.x/billing.md:1163 +#: ./docs/11.x/billing.md:1160 +#: ./docs/master/billing.md:1163 +msgid "If your subscription is a [subscription with multiple products](#subscriptions-with-multiple-products), you should pass the ID of the price whose quantity you wish to increment or decrement as the second argument to the increment / decrement methods:" msgstr "" -#: docs/10.x/billing.md:block 341 (paragraph) -msgid "If you would like to update quantities on individual subscription prices, you may do so using the [existing quantity methods](#subscription-quantity) by passing the name of the price as an additional argument to the method:" +# CODE +#: ./docs/10.x/billing.md:984 +#: ./docs/11.x/billing.md:981 +#: ./docs/master/billing.md:984 +msgid "if ($user->subscribedToProduct('prod_premium', 'default')) {\n" +" // ...\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 342 (code) -msgid "$user = User::find(1);\n\n" -"$user->subscription('default')->incrementQuantity(5, 'price_chat');\n\n" -"$user->subscription('default')->decrementQuantity(3, 'price_chat');\n\n" -"$user->subscription('default')->updateQuantity(10, 'price_chat');\n" +# H4 +#: ./docs/8.x/billing.md:984 +#: ./docs/9.x/billing.md:1067 +#: ./docs/10.x/billing.md:1247 +#: ./docs/11.x/billing.md:1244 +#: ./docs/master/billing.md:1247 +msgid "Proration" msgstr "" -#: docs/10.x/billing.md:block 343 (quote) -msgid "**Warning** When a subscription has multiple prices the `stripe_price` and `quantity` attributes on the `Subscription` model will be `null`. To access the individual price attributes, you should use the `items` relationship available on the `Subscription` model." +# P +#: ./docs/8.x/billing.md:986 +msgid "By default, Stripe will prorate charges when adding or removing prices from a multiprice subscription. If you would like to make a price adjustment without proration, you should chain the `noProrate` method onto your price operation:" msgstr "" -#: docs/10.x/billing.md:block 345 (header) -msgid "Subscription Items" +# P +#: ./docs/9.x/billing.md:987 +#: ./docs/10.x/billing.md:1167 +#: ./docs/11.x/billing.md:1164 +#: ./docs/master/billing.md:1167 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/8.x/billing.md:988 +#: ./docs/9.x/billing.md:1071 +#: ./docs/10.x/billing.md:1251 +#: ./docs/11.x/billing.md:1248 +#: ./docs/master/billing.md:1251 +msgid "$user->subscription('default')->noProrate()->removePrice('price_chat');" +msgstr "" + +# H3 +#: ./docs/9.x/billing.md:988 +#: ./docs/10.x/billing.md:1168 +#: ./docs/11.x/billing.md:1165 +#: ./docs/master/billing.md:1168 +msgid "Subscriptions With Multiple Products" msgstr "" -#: docs/10.x/billing.md:block 346 (paragraph) -msgid "When a subscription has multiple prices, it will have multiple subscription \"items\" stored in your database's `subscription_items` table. You may access these via the `items` relationship on the subscription:" +# CODE +#: ./docs/10.x/billing.md:990 +#: ./docs/11.x/billing.md:987 +#: ./docs/master/billing.md:990 +msgid "if ($user->subscribedToProduct(['prod_basic', 'prod_premium'], 'default')) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:990 +#: ./docs/9.x/billing.md:1073 +#: ./docs/10.x/billing.md:1253 +#: ./docs/11.x/billing.md:1250 +#: ./docs/master/billing.md:1253 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/billing.md:990 +#: ./docs/10.x/billing.md:1170 +#: ./docs/11.x/billing.md:1167 +#: ./docs/master/billing.md:1170 +msgid "[Subscription with multiple products](https://stripe.com/docs/billing/subscriptions/multiple-products) allow you to assign multiple billing products to a single subscription. For example, imagine you are building a customer service \"helpdesk\" application that has a base subscription price of $10 per month but offers a live chat add-on product for an additional $15 per month. Information for subscriptions with multiple products is stored in Cashier's `subscription_items` database table." msgstr "" -#: docs/10.x/billing.md:block 347 (code) -msgid "use App\\Models\\User;\n\n" -"$user = User::find(1);\n\n" -"$subscriptionItem = $user->subscription('default')->items->first();\n\n" -"// Retrieve the Stripe price and quantity for a specific item...\n" -"$stripePrice = $subscriptionItem->stripe_price;\n" -"$quantity = $subscriptionItem->quantity;\n" +# P +#: ./docs/9.x/billing.md:992 +#: ./docs/10.x/billing.md:1172 +#: ./docs/11.x/billing.md:1169 +#: ./docs/master/billing.md:1172 +msgid "You may specify multiple products for a given subscription by passing an array of prices as the second argument to the `newSubscription` method:" msgstr "" -#: docs/10.x/billing.md:block 348 (paragraph) -msgid "You can also retrieve a specific price using the `findItemOrFail` method:" +# P +#: ./docs/8.x/billing.md:993 +#: ./docs/9.x/billing.md:1076 +msgid "If you would like to update quantities on individual subscription prices, you may do so using the [existing quantity methods](#subscription-quantity) by passing the name of the price as an additional argument to the method:" msgstr "" -#: docs/10.x/billing.md:block 349 (code) +# CODE +#: ./docs/8.x/billing.md:995 +#: ./docs/9.x/billing.md:1078 +#: ./docs/10.x/billing.md:1258 +#: ./docs/11.x/billing.md:1255 +#: ./docs/master/billing.md:1258 msgid "$user = User::find(1);\n\n" -"$subscriptionItem = $user->subscription('default')->findItemOrFail('price_chat');\n" +"$user->subscription('default')->incrementQuantity(5, 'price_chat');\n\n" +"$user->subscription('default')->decrementQuantity(3, 'price_chat');\n\n" +"$user->subscription('default')->updateQuantity(10, 'price_chat');" msgstr "" -#: docs/10.x/billing.md:block 351 (header) -msgid "Multiple Subscriptions" +# CODE +#: ./docs/10.x/billing.md:996 +#: ./docs/11.x/billing.md:993 +#: ./docs/master/billing.md:996 +msgid "if ($user->subscribedToPrice('price_basic_monthly', 'default')) {\n" +" // ...\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 352 (paragraph) -msgid "Stripe allows your customers to have multiple subscriptions simultaneously. For example, you may run a gym that offers a swimming subscription and a weight-lifting subscription, and each subscription may have different pricing. Of course, customers should be able to subscribe to either or both plans." +# CODE +#: ./docs/10.x/billing.md:1002 +#: ./docs/11.x/billing.md:999 +#: ./docs/master/billing.md:1002 +msgid "if ($user->subscription('default')->recurring()) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1003 +#: ./docs/9.x/billing.md:1087 +#: ./docs/10.x/billing.md:1267 +#: ./docs/11.x/billing.md:1264 +#: ./docs/master/billing.md:1267 +msgid "When a subscription has multiple prices the `stripe_price` and `quantity` attributes on the `Subscription` model will be `null`. To access the individual price attributes, you should use the `items` relationship available on the `Subscription` model." +msgstr "" + +# P +#: ./docs/8.x/billing.md:1005 +#: ./docs/9.x/billing.md:1089 +#: ./docs/10.x/billing.md:1269 +#: ./docs/11.x/billing.md:1266 +#: ./docs/master/billing.md:1269 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:1006 +#: ./docs/9.x/billing.md:1090 +#: ./docs/10.x/billing.md:1270 +#: ./docs/11.x/billing.md:1267 +#: ./docs/master/billing.md:1270 +msgid "Subscription Items" msgstr "" -#: docs/10.x/billing.md:block 353 (paragraph) -msgid "When your application creates subscriptions, you may provide the name of the subscription to the `newSubscription` method. The name may be any string that represents the type of subscription the user is initiating:" +# P +#: ./docs/10.x/billing.md:1007 +#: ./docs/11.x/billing.md:1004 +#: ./docs/master/billing.md:1007 +msgid "If a user has two subscriptions with the same type, the most recent subscription will always be returned by the `subscription` method. For example, a user might have two subscription records with the type of `default`; however, one of the subscriptions may be an old, expired subscription, while the other is the current, active subscription. The most recent subscription will always be returned while older subscriptions are kept in the database for historical review." msgstr "" -#: docs/10.x/billing.md:block 354 (code) -msgid "use Illuminate\\Http\\Request;\n\n" -"Route::post('/swimming/subscribe', function (Request $request) {\n" -" $request->user()->newSubscription('swimming')\n" -" ->price('price_swimming_monthly')\n" -" ->create($request->paymentMethodId);\n\n" -" // ...\n" -"});\n" +# P +#: ./docs/8.x/billing.md:1008 +#: ./docs/9.x/billing.md:1092 +#: ./docs/10.x/billing.md:1272 +#: ./docs/11.x/billing.md:1269 +#: ./docs/master/billing.md:1272 +msgid "When a subscription has multiple prices, it will have multiple subscription \"items\" stored in your database's `subscription_items` table. You may access these via the `items` relationship on the subscription:" msgstr "" -#: docs/10.x/billing.md:block 355 (paragraph) -msgid "In this example, we initiated a monthly swimming subscription for the customer. However, they may want to swap to a yearly subscription at a later time. When adjusting the customer's subscription, we can simply swap the price on the `swimming` subscription:" +# CODE +#: ./docs/8.x/billing.md:1010 +#: ./docs/9.x/billing.md:1094 +#: ./docs/10.x/billing.md:1274 +#: ./docs/11.x/billing.md:1271 +#: ./docs/master/billing.md:1274 +msgid "use App\\Models\\User;\n\n" +"$user = User::find(1);\n\n" +"$subscriptionItem = $user->subscription('default')->items->first();\n\n" +"// Retrieve the Stripe price and quantity for a specific item...\n" +"$stripePrice = $subscriptionItem->stripe_price;\n" +"$quantity = $subscriptionItem->quantity;" msgstr "" -#: docs/10.x/billing.md:block 356 (code) -msgid "$user->subscription('swimming')->swap('price_swimming_yearly');\n" +# CODE +#: ./docs/10.x/billing.md:1014 +#: ./docs/11.x/billing.md:1011 +#: ./docs/master/billing.md:1014 +msgid "if ($user->subscription('default')->canceled()) {\n" +" // ...\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 357 (paragraph) -msgid "Of course, you may also cancel the subscription entirely:" +# CODE +#: ./docs/10.x/billing.md:1020 +#: ./docs/10.x/billing.md:1489 +#: ./docs/11.x/billing.md:1017 +#: ./docs/11.x/billing.md:1486 +#: ./docs/master/billing.md:1020 +#: ./docs/master/billing.md:1489 +msgid "if ($user->subscription('default')->onGracePeriod()) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1020 +#: ./docs/9.x/billing.md:1104 +#: ./docs/10.x/billing.md:1284 +#: ./docs/11.x/billing.md:1281 +#: ./docs/master/billing.md:1284 +msgid "You can also retrieve a specific price using the `findItemOrFail` method:" msgstr "" -#: docs/10.x/billing.md:block 358 (code) -msgid "$user->subscription('swimming')->cancel();\n" +# CODE +#: ./docs/8.x/billing.md:1022 +#: ./docs/9.x/billing.md:1106 +#: ./docs/10.x/billing.md:1286 +#: ./docs/11.x/billing.md:1283 +#: ./docs/master/billing.md:1286 +msgid "$user = User::find(1);\n\n" +"$subscriptionItem = $user->subscription('default')->findItemOrFail('price_chat');" msgstr "" -#: docs/10.x/billing.md:block 360 (header) +# CODE +#: ./docs/10.x/billing.md:1026 +#: ./docs/11.x/billing.md:1023 +#: ./docs/master/billing.md:1026 +msgid "if ($user->subscription('default')->ended()) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1026 +#: ./docs/9.x/billing.md:1135 +#: ./docs/10.x/billing.md:1315 +#: ./docs/11.x/billing.md:1312 +#: ./docs/master/billing.md:1315 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1027 +#: ./docs/9.x/billing.md:1136 +#: ./docs/10.x/billing.md:1316 +#: ./docs/11.x/billing.md:1313 +#: ./docs/master/billing.md:1316 msgid "Metered Billing" msgstr "" -#: docs/10.x/billing.md:block 361 (paragraph) +# P +#: ./docs/8.x/billing.md:1029 +#: ./docs/9.x/billing.md:1138 +#: ./docs/10.x/billing.md:1318 +#: ./docs/11.x/billing.md:1315 +#: ./docs/master/billing.md:1318 msgid "[Metered billing](https://stripe.com/docs/billing/subscriptions/metered-billing) allows you to charge customers based on their product usage during a billing cycle. For example, you may charge customers based on the number of text messages or emails they send per month." msgstr "" -#: docs/10.x/billing.md:block 362 (paragraph) +# P +#: ./docs/8.x/billing.md:1031 +#: ./docs/9.x/billing.md:1140 +#: ./docs/10.x/billing.md:1320 +#: ./docs/11.x/billing.md:1317 +#: ./docs/master/billing.md:1320 msgid "To start using metered billing, you will first need to create a new product in your Stripe dashboard with a metered price. Then, use the `meteredPrice` to add the metered price ID to a customer subscription:" msgstr "" -#: docs/10.x/billing.md:block 363 (code) +# CODE +#: ./docs/8.x/billing.md:1033 +#: ./docs/9.x/billing.md:1142 +#: ./docs/10.x/billing.md:1322 +#: ./docs/11.x/billing.md:1319 +#: ./docs/master/billing.md:1322 msgid "use Illuminate\\Http\\Request;\n\n" "Route::post('/user/subscribe', function (Request $request) {\n" " $request->user()->newSubscription('default')\n" " ->meteredPrice('price_metered')\n" " ->create($request->paymentMethodId);\n\n" " // ...\n" -"});\n" +"});" +msgstr "" + +# CODE +#: ./docs/10.x/billing.md:1037 +#: ./docs/10.x/billing.md:2204 +#: ./docs/11.x/billing.md:1034 +#: ./docs/11.x/billing.md:2184 +#: ./docs/master/billing.md:1037 +#: ./docs/master/billing.md:2187 +msgid "if ($user->hasIncompletePayment('default')) {\n" +" // ...\n" +"}\n\n" +"if ($user->subscription('default')->hasIncompletePayment()) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1039 +#: ./docs/10.x/billing.md:1219 +#: ./docs/11.x/billing.md:1216 +#: ./docs/master/billing.md:1219 +msgid "You may also change the prices attached to a subscription with multiple products. For example, imagine a customer has a `price_basic` subscription with a `price_chat` add-on product and you want to upgrade the customer from the `price_basic` to the `price_pro` price:" msgstr "" -#: docs/10.x/billing.md:block 364 (paragraph) +# P +#: ./docs/8.x/billing.md:1043 +#: ./docs/9.x/billing.md:1152 +#: ./docs/10.x/billing.md:1332 +#: ./docs/11.x/billing.md:1329 +#: ./docs/master/billing.md:1332 msgid "You may also start a metered subscription via [Stripe Checkout](#checkout):" msgstr "" -#: docs/10.x/billing.md:block 365 (code) +# CODE +#: ./docs/8.x/billing.md:1045 +#: ./docs/9.x/billing.md:1154 +#: ./docs/10.x/billing.md:1334 +#: ./docs/11.x/billing.md:1331 +#: ./docs/master/billing.md:1334 msgid "$checkout = Auth::user()\n" " ->newSubscription('default', [])\n" " ->meteredPrice('price_metered')\n" " ->checkout();\n\n" "return view('your-checkout-view', [\n" " 'checkout' => $checkout,\n" -"]);\n" +"]);" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1054 +#: ./docs/9.x/billing.md:1163 +#: ./docs/10.x/billing.md:1343 +#: ./docs/11.x/billing.md:1340 +#: ./docs/master/billing.md:1343 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/billing.md:1055 +#: ./docs/11.x/billing.md:1052 +#: ./docs/master/billing.md:1055 +msgid "use Laravel\\Cashier\\Cashier;\n\n" +"/**\n" +" * Register any application services.\n" +" */\n" +"public function register(): void\n" +"{\n" +" Cashier::keepPastDueSubscriptionsActive();\n" +" Cashier::keepIncompleteSubscriptionsActive();\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 367 (header) +# H4 +#: ./docs/8.x/billing.md:1055 +#: ./docs/9.x/billing.md:1164 +#: ./docs/10.x/billing.md:1344 +#: ./docs/11.x/billing.md:1341 +#: ./docs/master/billing.md:1344 msgid "Reporting Usage" msgstr "" -#: docs/10.x/billing.md:block 368 (paragraph) +# P +#: ./docs/8.x/billing.md:1057 +#: ./docs/9.x/billing.md:1166 +#: ./docs/10.x/billing.md:1346 +#: ./docs/11.x/billing.md:1343 +#: ./docs/master/billing.md:1346 msgid "As your customer uses your application, you will report their usage to Stripe so that they can be billed accurately. To increment the usage of a metered subscription, you may use the `reportUsage` method:" msgstr "" -#: docs/10.x/billing.md:block 369 (code) +# CODE +#: ./docs/8.x/billing.md:1059 +#: ./docs/9.x/billing.md:1168 +#: ./docs/10.x/billing.md:1348 +#: ./docs/11.x/billing.md:1345 +#: ./docs/master/billing.md:1348 msgid "$user = User::find(1);\n\n" -"$user->subscription('default')->reportUsage();\n" +"$user->subscription('default')->reportUsage();" msgstr "" -#: docs/10.x/billing.md:block 370 (paragraph) +# P +#: ./docs/8.x/billing.md:1063 +#: ./docs/9.x/billing.md:1172 +#: ./docs/10.x/billing.md:1352 +#: ./docs/11.x/billing.md:1349 +#: ./docs/master/billing.md:1352 msgid "By default, a \"usage quantity\" of 1 is added to the billing period. Alternatively, you may pass a specific amount of \"usage\" to add to the customer's usage for the billing period:" msgstr "" -#: docs/10.x/billing.md:block 371 (code) +# CODE +#: ./docs/8.x/billing.md:1065 +#: ./docs/9.x/billing.md:1174 +#: ./docs/10.x/billing.md:1354 +#: ./docs/11.x/billing.md:1351 +#: ./docs/master/billing.md:1354 msgid "$user = User::find(1);\n\n" -"$user->subscription('default')->reportUsage(15);\n" +"$user->subscription('default')->reportUsage(15);" msgstr "" -#: docs/10.x/billing.md:block 372 (paragraph) +# P +#: ./docs/8.x/billing.md:1069 +#: ./docs/9.x/billing.md:1178 +#: ./docs/10.x/billing.md:1358 +#: ./docs/11.x/billing.md:1355 +#: ./docs/master/billing.md:1358 msgid "If your application offers multiple prices on a single subscription, you will need to use the `reportUsageFor` method to specify the metered price you want to report usage for:" msgstr "" -#: docs/10.x/billing.md:block 373 (code) +# P +#: ./docs/9.x/billing.md:1069 +#: ./docs/10.x/billing.md:1249 +#: ./docs/11.x/billing.md:1246 +#: ./docs/master/billing.md:1249 +msgid "By default, Stripe will prorate charges when adding or removing prices from a subscription with multiple products. If you would like to make a price adjustment without proration, you should chain the `noProrate` method onto your price operation:" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:1071 +#: ./docs/9.x/billing.md:1180 +#: ./docs/10.x/billing.md:1360 +#: ./docs/11.x/billing.md:1357 +#: ./docs/master/billing.md:1360 msgid "$user = User::find(1);\n\n" -"$user->subscription('default')->reportUsageFor('price_metered', 15);\n" +"$user->subscription('default')->reportUsageFor('price_metered', 15);" msgstr "" -#: docs/10.x/billing.md:block 374 (paragraph) +# P +#: ./docs/8.x/billing.md:1075 +#: ./docs/9.x/billing.md:1184 +#: ./docs/10.x/billing.md:1364 +#: ./docs/11.x/billing.md:1361 +#: ./docs/master/billing.md:1364 msgid "Sometimes, you may need to update usage which you have previously reported. To accomplish this, you may pass a timestamp or a `DateTimeInterface` instance as the second parameter to `reportUsage`. When doing so, Stripe will update the usage that was reported at that given time. You can continue to update previous usage records as the given date and time is still within the current billing period:" msgstr "" -#: docs/10.x/billing.md:block 375 (code) +# CODE +#: ./docs/8.x/billing.md:1077 +#: ./docs/9.x/billing.md:1186 +#: ./docs/10.x/billing.md:1366 +#: ./docs/11.x/billing.md:1363 +#: ./docs/master/billing.md:1366 msgid "$user = User::find(1);\n\n" -"$user->subscription('default')->reportUsage(5, $timestamp);\n" -msgstr "" - -#: docs/10.x/billing.md:block 377 (header) +"$user->subscription('default')->reportUsage(5, $timestamp);" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1081 +#: ./docs/9.x/billing.md:1190 +#: ./docs/10.x/billing.md:1370 +#: ./docs/11.x/billing.md:1367 +#: ./docs/master/billing.md:1370 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:1082 +#: ./docs/9.x/billing.md:1191 +#: ./docs/10.x/billing.md:1371 +#: ./docs/11.x/billing.md:1368 +#: ./docs/master/billing.md:1371 msgid "Retrieving Usage Records" msgstr "" -#: docs/10.x/billing.md:block 378 (paragraph) +# P +#: ./docs/8.x/billing.md:1084 +#: ./docs/9.x/billing.md:1193 +#: ./docs/10.x/billing.md:1373 +#: ./docs/11.x/billing.md:1370 +#: ./docs/master/billing.md:1373 msgid "To retrieve a customer's past usage, you may use a subscription instance's `usageRecords` method:" msgstr "" -#: docs/10.x/billing.md:block 379 (code) +# CODE +#: ./docs/8.x/billing.md:1086 +#: ./docs/9.x/billing.md:1195 +#: ./docs/10.x/billing.md:1375 +#: ./docs/11.x/billing.md:1372 +#: ./docs/master/billing.md:1375 msgid "$user = User::find(1);\n\n" -"$usageRecords = $user->subscription('default')->usageRecords();\n" +"$usageRecords = $user->subscription('default')->usageRecords();" msgstr "" -#: docs/10.x/billing.md:block 380 (paragraph) +# P +#: ./docs/8.x/billing.md:1090 +#: ./docs/9.x/billing.md:1199 +#: ./docs/10.x/billing.md:1379 +#: ./docs/11.x/billing.md:1376 +#: ./docs/master/billing.md:1379 msgid "If your application offers multiple prices on a single subscription, you may use the `usageRecordsFor` method to specify the metered price that you wish to retrieve usage records for:" msgstr "" -#: docs/10.x/billing.md:block 381 (code) +# CODE +#: ./docs/8.x/billing.md:1092 +#: ./docs/9.x/billing.md:1201 +#: ./docs/10.x/billing.md:1381 +#: ./docs/11.x/billing.md:1378 +#: ./docs/master/billing.md:1381 msgid "$user = User::find(1);\n\n" -"$usageRecords = $user->subscription('default')->usageRecordsFor('price_metered');\n" +"$usageRecords = $user->subscription('default')->usageRecordsFor('price_metered');" msgstr "" -#: docs/10.x/billing.md:block 382 (paragraph) +# P +#: ./docs/8.x/billing.md:1096 +#: ./docs/9.x/billing.md:1205 +#: ./docs/10.x/billing.md:1385 +#: ./docs/11.x/billing.md:1382 +#: ./docs/master/billing.md:1385 msgid "The `usageRecords` and `usageRecordsFor` methods return a Collection instance containing an associative array of usage records. You may iterate over this array to display a customer's total usage:" msgstr "" -#: docs/10.x/billing.md:block 383 (code) +# CODE +#: ./docs/8.x/billing.md:1098 +#: ./docs/9.x/billing.md:1207 +#: ./docs/10.x/billing.md:1387 +#: ./docs/11.x/billing.md:1384 +#: ./docs/master/billing.md:1387 msgid "@foreach ($usageRecords as $usageRecord)\n" " - Period Starting: {{ $usageRecord['period']['start'] }}\n" " - Period Ending: {{ $usageRecord['period']['end'] }}\n" " - Total Usage: {{ $usageRecord['total_usage'] }}\n" -"@endforeach\n" +"@endforeach" msgstr "" -#: docs/10.x/billing.md:block 384 (paragraph) +# P +#: ./docs/8.x/billing.md:1104 +#: ./docs/9.x/billing.md:1213 +#: ./docs/10.x/billing.md:1393 +#: ./docs/11.x/billing.md:1390 +#: ./docs/master/billing.md:1393 msgid "For a full reference of all usage data returned and how to use Stripe's cursor based pagination, please consult [the official Stripe API documentation](https://stripe.com/docs/api/usage_records/subscription_item_summary_list)." msgstr "" -#: docs/10.x/billing.md:block 386 (header) +# P +#: ./docs/8.x/billing.md:1106 +#: ./docs/9.x/billing.md:1215 +#: ./docs/10.x/billing.md:1395 +#: ./docs/11.x/billing.md:1392 +#: ./docs/master/billing.md:1395 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1107 +#: ./docs/9.x/billing.md:1216 +#: ./docs/10.x/billing.md:1396 +#: ./docs/11.x/billing.md:1393 +#: ./docs/master/billing.md:1396 msgid "Subscription Taxes" msgstr "" -#: docs/10.x/billing.md:block 387 (quote) -msgid "**Warning** Instead of calculating Tax Rates manually, you can [automatically calculate taxes using Stripe Tax](#tax-configuration)" +# P +#: ./docs/8.x/billing.md:1109 +#: ./docs/9.x/billing.md:1219 +#: ./docs/10.x/billing.md:1399 +#: ./docs/11.x/billing.md:1396 +#: ./docs/master/billing.md:1399 +msgid "Instead of calculating Tax Rates manually, you can [automatically calculate taxes using Stripe Tax](#tax-configuration)" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1110 +#: ./docs/10.x/billing.md:1290 +#: ./docs/11.x/billing.md:1287 +#: ./docs/master/billing.md:1290 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/billing.md:1111 +#: ./docs/9.x/billing.md:1221 +#: ./docs/10.x/billing.md:1401 +#: ./docs/11.x/billing.md:1398 +#: ./docs/master/billing.md:1401 +msgid "To specify the tax rates a user pays on a subscription, you should implement the `taxRates` method on your billable model and return an array containing the Stripe tax rate IDs. You can define these tax rates in [your Stripe dashboard](https://dashboard.stripe.com/test/tax-rates):" msgstr "" -#: docs/10.x/billing.md:block 388 (paragraph) -msgid "To specify the tax rates a user pays on a subscription, you should implement the `taxRates` method on your billable model and return an array containing the Stripe tax rate IDs. You can define these tax rates in [your Stripe dashboard](https://dashboard.stripe.com/test/tax-rates):" +# H3 +#: ./docs/9.x/billing.md:1111 +#: ./docs/10.x/billing.md:1291 +#: ./docs/11.x/billing.md:1288 +#: ./docs/master/billing.md:1291 +msgid "Multiple Subscriptions" msgstr "" -#: docs/10.x/billing.md:block 389 (code) +# CODE +#: ./docs/8.x/billing.md:1113 +#: ./docs/9.x/billing.md:1223 msgid "/**\n" " * The tax rates that should apply to the customer's subscriptions.\n" " *\n" -" * @return array\n" +" * @return array\n" " */\n" -"public function taxRates(): array\n" +"public function taxRates()\n" "{\n" " return ['txr_id'];\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1113 +#: ./docs/10.x/billing.md:1293 +#: ./docs/11.x/billing.md:1290 +#: ./docs/master/billing.md:1293 +msgid "Stripe allows your customers to have multiple subscriptions simultaneously. For example, you may run a gym that offers a swimming subscription and a weight-lifting subscription, and each subscription may have different pricing. Of course, customers should be able to subscribe to either or both plans." +msgstr "" + +# P +#: ./docs/9.x/billing.md:1115 +msgid "When your application creates subscriptions, you may provide the name of the subscription to the `newSubscription` method. The name may be any string that represents the type of subscription the user is initiating:" +msgstr "" + +# CODE +#: ./docs/9.x/billing.md:1117 +#: ./docs/10.x/billing.md:1297 +#: ./docs/11.x/billing.md:1294 +#: ./docs/master/billing.md:1297 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::post('/swimming/subscribe', function (Request $request) {\n" +" $request->user()->newSubscription('swimming')\n" +" ->price('price_swimming_monthly')\n" +" ->create($request->paymentMethodId);\n\n" +" // ...\n" +"});" msgstr "" -#: docs/10.x/billing.md:block 390 (paragraph) +# P +#: ./docs/8.x/billing.md:1123 +#: ./docs/9.x/billing.md:1233 +#: ./docs/10.x/billing.md:1413 +#: ./docs/11.x/billing.md:1410 +#: ./docs/master/billing.md:1413 msgid "The `taxRates` method enables you to apply a tax rate on a customer-by-customer basis, which may be helpful for a user base that spans multiple countries and tax rates." msgstr "" -#: docs/10.x/billing.md:block 391 (paragraph) -msgid "If you're offering subscriptions with multiple products, you may define different tax rates for each price by implementing a `priceTaxRates` method on your billable model:" +# P +#: ./docs/8.x/billing.md:1125 +msgid "If you're offering multiprice subscriptions, you may define different tax rates for each price by implementing a `priceTaxRates` method on your billable model:" msgstr "" -#: docs/10.x/billing.md:block 392 (code) +# CODE +#: ./docs/8.x/billing.md:1127 +#: ./docs/9.x/billing.md:1237 msgid "/**\n" " * The tax rates that should apply to the customer's subscriptions.\n" " *\n" -" * @return array>\n" +" * @return array\n" " */\n" -"public function priceTaxRates(): array\n" +"public function priceTaxRates()\n" "{\n" " return [\n" " 'price_monthly' => ['txr_id'],\n" " ];\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1127 +#: ./docs/10.x/billing.md:1307 +#: ./docs/11.x/billing.md:1304 +#: ./docs/master/billing.md:1307 +msgid "In this example, we initiated a monthly swimming subscription for the customer. However, they may want to swap to a yearly subscription at a later time. When adjusting the customer's subscription, we can simply swap the price on the `swimming` subscription:" +msgstr "" + +# CODE +#: ./docs/9.x/billing.md:1129 +#: ./docs/10.x/billing.md:1309 +#: ./docs/11.x/billing.md:1306 +#: ./docs/master/billing.md:1309 +msgid "$user->subscription('swimming')->swap('price_swimming_yearly');" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1131 +#: ./docs/10.x/billing.md:1311 +#: ./docs/11.x/billing.md:1308 +#: ./docs/master/billing.md:1311 +msgid "Of course, you may also cancel the subscription entirely:" +msgstr "" + +# CODE +#: ./docs/9.x/billing.md:1133 +#: ./docs/10.x/billing.md:1313 +#: ./docs/11.x/billing.md:1310 +#: ./docs/master/billing.md:1313 +msgid "$user->subscription('swimming')->cancel();" msgstr "" -#: docs/10.x/billing.md:block 393 (quote) -msgid "**Warning** The `taxRates` method only applies to subscription charges. If you use Cashier to make \"one-off\" charges, you will need to manually specify the tax rate at that time." +# P +#: ./docs/8.x/billing.md:1139 +msgid "The `taxRates` method only applies to subscription charges. If you use Cashier to make \"one off\" charges, you will need to manually specify the tax rate at that time." msgstr "" -#: docs/10.x/billing.md:block 395 (header) +# P +#: ./docs/8.x/billing.md:1141 +#: ./docs/9.x/billing.md:1252 +#: ./docs/10.x/billing.md:1432 +#: ./docs/11.x/billing.md:1429 +#: ./docs/master/billing.md:1432 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:1142 +#: ./docs/9.x/billing.md:1253 +#: ./docs/10.x/billing.md:1433 +#: ./docs/11.x/billing.md:1430 +#: ./docs/master/billing.md:1433 msgid "Syncing Tax Rates" msgstr "" -#: docs/10.x/billing.md:block 396 (paragraph) +# P +#: ./docs/8.x/billing.md:1144 +#: ./docs/9.x/billing.md:1255 +#: ./docs/10.x/billing.md:1435 +#: ./docs/11.x/billing.md:1432 +#: ./docs/master/billing.md:1435 msgid "When changing the hard-coded tax rate IDs returned by the `taxRates` method, the tax settings on any existing subscriptions for the user will remain the same. If you wish to update the tax value for existing subscriptions with the new `taxRates` values, you should call the `syncTaxRates` method on the user's subscription instance:" msgstr "" -#: docs/10.x/billing.md:block 397 (code) -msgid "$user->subscription('default')->syncTaxRates();\n" +# CODE +#: ./docs/8.x/billing.md:1146 +#: ./docs/9.x/billing.md:1257 +#: ./docs/10.x/billing.md:1437 +#: ./docs/11.x/billing.md:1434 +#: ./docs/master/billing.md:1437 +msgid "$user->subscription('default')->syncTaxRates();" msgstr "" -#: docs/10.x/billing.md:block 398 (paragraph) -msgid "This will also sync any item tax rates for a subscription with multiple products. If your application is offering subscriptions with multiple products, you should ensure that your billable model implements the `priceTaxRates` method [discussed above](#subscription-taxes)." +# P +#: ./docs/8.x/billing.md:1148 +msgid "This will also sync any multiprice subscription item tax rates. If your application is offering multiprice subscriptions, you should ensure that your billable model implements the `priceTaxRates` method [discussed above](#subscription-taxes)." msgstr "" -#: docs/10.x/billing.md:block 400 (header) +# P +#: ./docs/8.x/billing.md:1150 +#: ./docs/9.x/billing.md:1261 +#: ./docs/10.x/billing.md:1441 +#: ./docs/11.x/billing.md:1438 +#: ./docs/master/billing.md:1441 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:1151 +#: ./docs/9.x/billing.md:1262 +#: ./docs/10.x/billing.md:1442 +#: ./docs/11.x/billing.md:1439 +#: ./docs/master/billing.md:1442 msgid "Tax Exemption" msgstr "" -#: docs/10.x/billing.md:block 401 (paragraph) +# P +#: ./docs/8.x/billing.md:1153 +#: ./docs/9.x/billing.md:1264 +#: ./docs/10.x/billing.md:1444 +#: ./docs/11.x/billing.md:1441 +#: ./docs/master/billing.md:1444 msgid "Cashier also offers the `isNotTaxExempt`, `isTaxExempt`, and `reverseChargeApplies` methods to determine if the customer is tax exempt. These methods will call the Stripe API to determine a customer's tax exemption status:" msgstr "" -#: docs/10.x/billing.md:block 402 (code) +# CODE +#: ./docs/8.x/billing.md:1155 +#: ./docs/9.x/billing.md:1266 +#: ./docs/10.x/billing.md:1446 +#: ./docs/11.x/billing.md:1443 +#: ./docs/master/billing.md:1446 msgid "use App\\Models\\User;\n\n" "$user = User::find(1);\n\n" "$user->isTaxExempt();\n" "$user->isNotTaxExempt();\n" -"$user->reverseChargeApplies();\n" -msgstr "" - -#: docs/10.x/billing.md:block 403 (quote) -msgid "**Warning** These methods are also available on any `Laravel\\Cashier\\Invoice` object. However, when invoked on an `Invoice` object, the methods will determine the exemption status at the time the invoice was created." -msgstr "" - -#: docs/10.x/billing.md:block 405 (header) +"$user->reverseChargeApplies();" +msgstr "" + +# H4 +#: ./docs/10.x/billing.md:1161 +#: ./docs/11.x/billing.md:1158 +#: ./docs/master/billing.md:1161 +msgid "Quantities for Subscriptions With Multiple Products" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1163 +#: ./docs/9.x/billing.md:1275 +#: ./docs/10.x/billing.md:1455 +#: ./docs/11.x/billing.md:1452 +#: ./docs/master/billing.md:1455 +msgid "These methods are also available on any `Laravel\\Cashier\\Invoice` object. However, when invoked on an `Invoice` object, the methods will determine the exemption status at the time the invoice was created." +msgstr "" + +# P +#: ./docs/8.x/billing.md:1165 +#: ./docs/9.x/billing.md:1277 +#: ./docs/10.x/billing.md:1457 +#: ./docs/11.x/billing.md:1454 +#: ./docs/master/billing.md:1457 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1166 +#: ./docs/9.x/billing.md:1278 +#: ./docs/10.x/billing.md:1458 +#: ./docs/11.x/billing.md:1455 +#: ./docs/master/billing.md:1458 msgid "Subscription Anchor Date" msgstr "" -#: docs/10.x/billing.md:block 406 (paragraph) +# P +#: ./docs/8.x/billing.md:1168 +#: ./docs/9.x/billing.md:1280 +#: ./docs/10.x/billing.md:1460 +#: ./docs/11.x/billing.md:1457 +#: ./docs/master/billing.md:1460 msgid "By default, the billing cycle anchor is the date the subscription was created or, if a trial period is used, the date that the trial ends. If you would like to modify the billing anchor date, you may use the `anchorBillingCycleOn` method:" msgstr "" -#: docs/10.x/billing.md:block 407 (code) +# CODE +#: ./docs/8.x/billing.md:1170 +#: ./docs/9.x/billing.md:1282 +#: ./docs/10.x/billing.md:1462 +#: ./docs/11.x/billing.md:1459 +#: ./docs/master/billing.md:1462 msgid "use Illuminate\\Http\\Request;\n\n" "Route::post('/user/subscribe', function (Request $request) {\n" " $anchor = Carbon::parse('first day of next month');\n\n" @@ -1992,230 +5410,535 @@ msgid "use Illuminate\\Http\\Request;\n\n" " ->anchorBillingCycleOn($anchor->startOfDay())\n" " ->create($request->paymentMethodId);\n\n" " // ...\n" -"});\n" +"});" msgstr "" -#: docs/10.x/billing.md:block 408 (paragraph) +# P +#: ./docs/8.x/billing.md:1182 +#: ./docs/9.x/billing.md:1294 +#: ./docs/10.x/billing.md:1474 +#: ./docs/11.x/billing.md:1471 +#: ./docs/master/billing.md:1474 msgid "For more information on managing subscription billing cycles, consult the [Stripe billing cycle documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle)" msgstr "" -#: docs/10.x/billing.md:block 410 (header) +# P +#: ./docs/8.x/billing.md:1184 +#: ./docs/9.x/billing.md:1296 +#: ./docs/10.x/billing.md:1476 +#: ./docs/11.x/billing.md:1473 +#: ./docs/master/billing.md:1476 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1185 +#: ./docs/9.x/billing.md:1297 +#: ./docs/10.x/billing.md:1477 +#: ./docs/11.x/billing.md:1474 +#: ./docs/master/billing.md:1477 msgid "Cancelling Subscriptions" msgstr "" -#: docs/10.x/billing.md:block 411 (paragraph) +# P +#: ./docs/8.x/billing.md:1187 +#: ./docs/9.x/billing.md:1299 +#: ./docs/10.x/billing.md:1479 +#: ./docs/11.x/billing.md:1476 +#: ./docs/master/billing.md:1479 msgid "To cancel a subscription, call the `cancel` method on the user's subscription:" msgstr "" -#: docs/10.x/billing.md:block 412 (code) -msgid "$user->subscription('default')->cancel();\n" +# CODE +#: ./docs/8.x/billing.md:1189 +#: ./docs/9.x/billing.md:1301 +#: ./docs/10.x/billing.md:1481 +#: ./docs/11.x/billing.md:1478 +#: ./docs/master/billing.md:1481 +msgid "$user->subscription('default')->cancel();" msgstr "" -#: docs/10.x/billing.md:block 413 (paragraph) +# P +#: ./docs/8.x/billing.md:1191 +#: ./docs/9.x/billing.md:1303 +#: ./docs/10.x/billing.md:1483 +#: ./docs/11.x/billing.md:1480 +#: ./docs/master/billing.md:1483 msgid "When a subscription is canceled, Cashier will automatically set the `ends_at` column in your `subscriptions` database table. This column is used to know when the `subscribed` method should begin returning `false`." msgstr "" -#: docs/10.x/billing.md:block 414 (paragraph) +# P +#: ./docs/8.x/billing.md:1193 +#: ./docs/9.x/billing.md:1305 +#: ./docs/10.x/billing.md:1485 +#: ./docs/11.x/billing.md:1482 +#: ./docs/master/billing.md:1485 msgid "For example, if a customer cancels a subscription on March 1st, but the subscription was not scheduled to end until March 5th, the `subscribed` method will continue to return `true` until March 5th. This is done because a user is typically allowed to continue using an application until the end of their billing cycle." msgstr "" -#: docs/10.x/billing.md:block 415 (paragraph) +# P +#: ./docs/8.x/billing.md:1195 +#: ./docs/9.x/billing.md:1307 +#: ./docs/10.x/billing.md:1487 +#: ./docs/11.x/billing.md:1484 +#: ./docs/master/billing.md:1487 msgid "You may determine if a user has canceled their subscription but are still on their \"grace period\" using the `onGracePeriod` method:" msgstr "" -#: docs/10.x/billing.md:block 417 (paragraph) +# P +#: ./docs/8.x/billing.md:1201 +#: ./docs/9.x/billing.md:1313 +#: ./docs/10.x/billing.md:1493 +#: ./docs/11.x/billing.md:1490 +#: ./docs/master/billing.md:1493 msgid "If you wish to cancel a subscription immediately, call the `cancelNow` method on the user's subscription:" msgstr "" -#: docs/10.x/billing.md:block 418 (code) -msgid "$user->subscription('default')->cancelNow();\n" +# CODE +#: ./docs/8.x/billing.md:1203 +#: ./docs/9.x/billing.md:1315 +#: ./docs/10.x/billing.md:1495 +#: ./docs/11.x/billing.md:1492 +#: ./docs/master/billing.md:1495 +msgid "$user->subscription('default')->cancelNow();" msgstr "" -#: docs/10.x/billing.md:block 419 (paragraph) +# P +#: ./docs/8.x/billing.md:1205 +#: ./docs/9.x/billing.md:1317 +#: ./docs/10.x/billing.md:1497 +#: ./docs/11.x/billing.md:1494 +#: ./docs/master/billing.md:1497 msgid "If you wish to cancel a subscription immediately and invoice any remaining un-invoiced metered usage or new / pending proration invoice items, call the `cancelNowAndInvoice` method on the user's subscription:" msgstr "" -#: docs/10.x/billing.md:block 420 (code) -msgid "$user->subscription('default')->cancelNowAndInvoice();\n" +# CODE +#: ./docs/8.x/billing.md:1207 +#: ./docs/9.x/billing.md:1319 +#: ./docs/10.x/billing.md:1499 +#: ./docs/11.x/billing.md:1496 +#: ./docs/master/billing.md:1499 +msgid "$user->subscription('default')->cancelNowAndInvoice();" msgstr "" -#: docs/10.x/billing.md:block 421 (paragraph) +# P +#: ./docs/8.x/billing.md:1209 +#: ./docs/9.x/billing.md:1321 +#: ./docs/10.x/billing.md:1501 +#: ./docs/11.x/billing.md:1498 +#: ./docs/master/billing.md:1501 msgid "You may also choose to cancel the subscription at a specific moment in time:" msgstr "" -#: docs/10.x/billing.md:block 422 (code) +# CODE +#: ./docs/8.x/billing.md:1211 +#: ./docs/9.x/billing.md:1323 +#: ./docs/10.x/billing.md:1503 +#: ./docs/11.x/billing.md:1500 +#: ./docs/master/billing.md:1503 msgid "$user->subscription('default')->cancelAt(\n" " now()->addDays(10)\n" -");\n" -msgstr "" - -#: docs/10.x/billing.md:block 424 (header) +");" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1215 +#: ./docs/9.x/billing.md:1327 +#: ./docs/10.x/billing.md:1513 +#: ./docs/11.x/billing.md:1510 +#: ./docs/master/billing.md:1513 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1216 +#: ./docs/9.x/billing.md:1328 +#: ./docs/10.x/billing.md:1514 +#: ./docs/11.x/billing.md:1511 +#: ./docs/master/billing.md:1514 msgid "Resuming Subscriptions" msgstr "" -#: docs/10.x/billing.md:block 425 (paragraph) +# P +#: ./docs/8.x/billing.md:1218 +#: ./docs/9.x/billing.md:1330 +#: ./docs/10.x/billing.md:1516 +#: ./docs/11.x/billing.md:1513 +#: ./docs/master/billing.md:1516 msgid "If a customer has canceled their subscription and you wish to resume it, you may invoke the `resume` method on the subscription. The customer must still be within their \"grace period\" in order to resume a subscription:" msgstr "" -#: docs/10.x/billing.md:block 426 (code) -msgid "$user->subscription('default')->resume();\n" +# CODE +#: ./docs/8.x/billing.md:1220 +#: ./docs/9.x/billing.md:1332 +#: ./docs/10.x/billing.md:1518 +#: ./docs/11.x/billing.md:1515 +#: ./docs/master/billing.md:1518 +msgid "$user->subscription('default')->resume();" msgstr "" -#: docs/10.x/billing.md:block 427 (paragraph) +# P +#: ./docs/8.x/billing.md:1222 +#: ./docs/9.x/billing.md:1334 +#: ./docs/10.x/billing.md:1520 +#: ./docs/11.x/billing.md:1517 +#: ./docs/master/billing.md:1520 msgid "If the customer cancels a subscription and then resumes that subscription before the subscription has fully expired the customer will not be billed immediately. Instead, their subscription will be re-activated and they will be billed on the original billing cycle." msgstr "" -#: docs/10.x/billing.md:block 429 (header) +# P +#: ./docs/8.x/billing.md:1224 +#: ./docs/9.x/billing.md:1336 +#: ./docs/10.x/billing.md:1522 +#: ./docs/11.x/billing.md:1519 +#: ./docs/master/billing.md:1522 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:1225 +#: ./docs/9.x/billing.md:1337 +#: ./docs/10.x/billing.md:1523 +#: ./docs/11.x/billing.md:1520 +#: ./docs/master/billing.md:1523 msgid "Subscription Trials" msgstr "" -#: docs/10.x/billing.md:block 431 (header) +# P +#: ./docs/8.x/billing.md:1227 +#: ./docs/9.x/billing.md:1339 +#: ./docs/10.x/billing.md:1525 +#: ./docs/11.x/billing.md:1522 +#: ./docs/master/billing.md:1525 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1228 +#: ./docs/9.x/billing.md:1340 +#: ./docs/10.x/billing.md:1526 +#: ./docs/11.x/billing.md:1523 +#: ./docs/master/billing.md:1526 msgid "With Payment Method Up Front" msgstr "" -#: docs/10.x/billing.md:block 432 (paragraph) +# P +#: ./docs/8.x/billing.md:1230 +#: ./docs/9.x/billing.md:1342 +#: ./docs/10.x/billing.md:1528 +#: ./docs/11.x/billing.md:1525 +#: ./docs/master/billing.md:1528 msgid "If you would like to offer trial periods to your customers while still collecting payment method information up front, you should use the `trialDays` method when creating your subscriptions:" msgstr "" -#: docs/10.x/billing.md:block 433 (code) +# CODE +#: ./docs/8.x/billing.md:1232 +#: ./docs/9.x/billing.md:1344 +#: ./docs/10.x/billing.md:1530 +#: ./docs/11.x/billing.md:1527 +#: ./docs/master/billing.md:1530 msgid "use Illuminate\\Http\\Request;\n\n" "Route::post('/user/subscribe', function (Request $request) {\n" " $request->user()->newSubscription('default', 'price_monthly')\n" " ->trialDays(10)\n" " ->create($request->paymentMethodId);\n\n" " // ...\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1235 +#: ./docs/10.x/billing.md:1415 +#: ./docs/11.x/billing.md:1412 +#: ./docs/master/billing.md:1415 +msgid "If you're offering subscriptions with multiple products, you may define different tax rates for each price by implementing a `priceTaxRates` method on your billable model:" msgstr "" -#: docs/10.x/billing.md:block 434 (paragraph) +# P +#: ./docs/8.x/billing.md:1242 +#: ./docs/9.x/billing.md:1354 +#: ./docs/10.x/billing.md:1540 +#: ./docs/11.x/billing.md:1537 +#: ./docs/master/billing.md:1540 msgid "This method will set the trial period ending date on the subscription record within the database and instruct Stripe to not begin billing the customer until after this date. When using the `trialDays` method, Cashier will overwrite any default trial period configured for the price in Stripe." msgstr "" -#: docs/10.x/billing.md:block 435 (quote) -msgid "**Warning** If the customer's subscription is not canceled before the trial ending date they will be charged as soon as the trial expires, so you should be sure to notify your users of their trial ending date." +# P +#: ./docs/8.x/billing.md:1244 +#: ./docs/9.x/billing.md:1357 +#: ./docs/10.x/billing.md:1543 +#: ./docs/11.x/billing.md:1540 +#: ./docs/master/billing.md:1543 +msgid "If the customer's subscription is not canceled before the trial ending date they will be charged as soon as the trial expires, so you should be sure to notify your users of their trial ending date." msgstr "" -#: docs/10.x/billing.md:block 436 (paragraph) +# P +#: ./docs/8.x/billing.md:1246 +#: ./docs/9.x/billing.md:1359 +#: ./docs/10.x/billing.md:1545 +#: ./docs/11.x/billing.md:1542 +#: ./docs/master/billing.md:1545 msgid "The `trialUntil` method allows you to provide a `DateTime` instance that specifies when the trial period should end:" msgstr "" -#: docs/10.x/billing.md:block 437 (code) +# CODE +#: ./docs/8.x/billing.md:1248 +#: ./docs/9.x/billing.md:1361 +#: ./docs/10.x/billing.md:1547 +#: ./docs/11.x/billing.md:1544 +#: ./docs/master/billing.md:1547 msgid "use Carbon\\Carbon;\n\n" "$user->newSubscription('default', 'price_monthly')\n" " ->trialUntil(Carbon::now()->addDays(10))\n" -" ->create($paymentMethod);\n" +" ->create($paymentMethod);" msgstr "" -#: docs/10.x/billing.md:block 438 (paragraph) +# P +#: ./docs/9.x/billing.md:1250 +#: ./docs/10.x/billing.md:1430 +#: ./docs/11.x/billing.md:1427 +#: ./docs/master/billing.md:1430 +msgid "The `taxRates` method only applies to subscription charges. If you use Cashier to make \"one-off\" charges, you will need to manually specify the tax rate at that time." +msgstr "" + +# P +#: ./docs/8.x/billing.md:1254 +#: ./docs/9.x/billing.md:1367 +#: ./docs/10.x/billing.md:1553 +#: ./docs/11.x/billing.md:1550 +#: ./docs/master/billing.md:1553 msgid "You may determine if a user is within their trial period using either the `onTrial` method of the user instance or the `onTrial` method of the subscription instance. The two examples below are equivalent:" msgstr "" -#: docs/10.x/billing.md:block 439 (code) +# P +#: ./docs/10.x/billing.md:1256 +#: ./docs/11.x/billing.md:1253 +#: ./docs/master/billing.md:1256 +msgid "If you would like to update quantities on individual subscription prices, you may do so using the [existing quantity methods](#subscription-quantity) by passing the ID of the price as an additional argument to the method:" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:1256 +#: ./docs/9.x/billing.md:1369 msgid "if ($user->onTrial('default')) {\n" -" // ...\n" +" //\n" "}\n\n" "if ($user->subscription('default')->onTrial()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 440 (paragraph) -msgid "You may use the `endTrial` method to immediately end a subscription trial:" +# P +#: ./docs/9.x/billing.md:1259 +#: ./docs/10.x/billing.md:1439 +#: ./docs/11.x/billing.md:1436 +#: ./docs/master/billing.md:1439 +msgid "This will also sync any item tax rates for a subscription with multiple products. If your application is offering subscriptions with multiple products, you should ensure that your billable model implements the `priceTaxRates` method [discussed above](#subscription-taxes)." msgstr "" -#: docs/10.x/billing.md:block 441 (code) -msgid "$user->subscription('default')->endTrial();\n" +# P +#: ./docs/8.x/billing.md:1264 +#: ./docs/9.x/billing.md:1377 +#: ./docs/10.x/billing.md:1563 +#: ./docs/11.x/billing.md:1560 +#: ./docs/master/billing.md:1563 +msgid "You may use the `endTrial` method to immediately end a subscription trial:" msgstr "" -#: docs/10.x/billing.md:block 442 (paragraph) -msgid "To determine if an existing trial has expired, you may use the `hasExpiredTrial` methods:" +# CODE +#: ./docs/8.x/billing.md:1266 +#: ./docs/9.x/billing.md:1379 +#: ./docs/10.x/billing.md:1565 +#: ./docs/11.x/billing.md:1562 +#: ./docs/master/billing.md:1565 +msgid "$user->subscription('default')->endTrial();" msgstr "" -#: docs/10.x/billing.md:block 443 (code) -msgid "if ($user->hasExpiredTrial('default')) {\n" -" // ...\n" -"}\n\n" -"if ($user->subscription('default')->hasExpiredTrial()) {\n" -" // ...\n" -"}\n" -msgstr "" +# P +#: ./docs/8.x/billing.md:1268 +#: ./docs/9.x/billing.md:1391 +#: ./docs/10.x/billing.md:1577 +#: ./docs/11.x/billing.md:1574 +#: ./docs/master/billing.md:1577 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/billing.md:block 445 (header) +# H4 +#: ./docs/8.x/billing.md:1269 +#: ./docs/9.x/billing.md:1392 msgid "Defining Trial Days In Stripe / Cashier" msgstr "" -#: docs/10.x/billing.md:block 446 (paragraph) +# P +#: ./docs/8.x/billing.md:1271 +#: ./docs/9.x/billing.md:1394 +#: ./docs/10.x/billing.md:1580 +#: ./docs/11.x/billing.md:1577 +#: ./docs/master/billing.md:1580 msgid "You may choose to define how many trial days your price's receive in the Stripe dashboard or always pass them explicitly using Cashier. If you choose to define your price's trial days in Stripe you should be aware that new subscriptions, including new subscriptions for a customer that had a subscription in the past, will always receive a trial period unless you explicitly call the `skipTrial()` method." msgstr "" -#: docs/10.x/billing.md:block 448 (header) +# P +#: ./docs/8.x/billing.md:1273 +#: ./docs/9.x/billing.md:1396 +#: ./docs/10.x/billing.md:1582 +#: ./docs/11.x/billing.md:1579 +#: ./docs/master/billing.md:1582 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1274 +#: ./docs/9.x/billing.md:1397 +#: ./docs/10.x/billing.md:1583 +#: ./docs/11.x/billing.md:1580 +#: ./docs/master/billing.md:1583 msgid "Without Payment Method Up Front" msgstr "" -#: docs/10.x/billing.md:block 449 (paragraph) +# P +#: ./docs/8.x/billing.md:1276 +#: ./docs/9.x/billing.md:1399 +#: ./docs/10.x/billing.md:1585 +#: ./docs/11.x/billing.md:1582 +#: ./docs/master/billing.md:1585 msgid "If you would like to offer trial periods without collecting the user's payment method information up front, you may set the `trial_ends_at` column on the user record to your desired trial ending date. This is typically done during user registration:" msgstr "" -#: docs/10.x/billing.md:block 450 (code) +# CODE +#: ./docs/8.x/billing.md:1278 +#: ./docs/9.x/billing.md:1401 +#: ./docs/10.x/billing.md:1587 +#: ./docs/11.x/billing.md:1584 +#: ./docs/master/billing.md:1587 msgid "use App\\Models\\User;\n\n" "$user = User::create([\n" " // ...\n" " 'trial_ends_at' => now()->addDays(10),\n" -"]);\n" +"]);" msgstr "" -#: docs/10.x/billing.md:block 451 (quote) -msgid "**Warning** Be sure to add a [date cast](/docs/{{version}}/eloquent-mutators#date-casting) for the `trial_ends_at` attribute within your billable model's class definition." +# P +#: ./docs/8.x/billing.md:1285 +msgid "Be sure to add a [date cast](/docs/{{version}}/eloquent-mutators##date-casting) for the `trial_ends_at` attribute within your billable model's class definition." msgstr "" -#: docs/10.x/billing.md:block 452 (paragraph) +# P +#: ./docs/8.x/billing.md:1287 +#: ./docs/9.x/billing.md:1411 +#: ./docs/10.x/billing.md:1597 +#: ./docs/11.x/billing.md:1594 +#: ./docs/master/billing.md:1597 msgid "Cashier refers to this type of trial as a \"generic trial\", since it is not attached to any existing subscription. The `onTrial` method on the billable model instance will return `true` if the current date is not past the value of `trial_ends_at`:" msgstr "" -#: docs/10.x/billing.md:block 453 (code) +# CODE +#: ./docs/8.x/billing.md:1289 +#: ./docs/9.x/billing.md:1413 +#: ./docs/10.x/billing.md:1599 +#: ./docs/11.x/billing.md:1596 +#: ./docs/master/billing.md:1599 msgid "if ($user->onTrial()) {\n" " // User is within their trial period...\n" -"}\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 454 (paragraph) +# P +#: ./docs/8.x/billing.md:1293 +#: ./docs/9.x/billing.md:1417 +#: ./docs/10.x/billing.md:1603 +#: ./docs/11.x/billing.md:1600 +#: ./docs/master/billing.md:1603 msgid "Once you are ready to create an actual subscription for the user, you may use the `newSubscription` method as usual:" msgstr "" -#: docs/10.x/billing.md:block 455 (code) +# P +#: ./docs/10.x/billing.md:1295 +#: ./docs/11.x/billing.md:1292 +#: ./docs/master/billing.md:1295 +msgid "When your application creates subscriptions, you may provide the type of the subscription to the `newSubscription` method. The type may be any string that represents the type of subscription the user is initiating:" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:1295 +#: ./docs/9.x/billing.md:1419 +#: ./docs/10.x/billing.md:1605 +#: ./docs/11.x/billing.md:1602 +#: ./docs/master/billing.md:1605 msgid "$user = User::find(1);\n\n" -"$user->newSubscription('default', 'price_monthly')->create($paymentMethod);\n" +"$user->newSubscription('default', 'price_monthly')->create($paymentMethod);" msgstr "" -#: docs/10.x/billing.md:block 456 (paragraph) +# P +#: ./docs/8.x/billing.md:1299 +#: ./docs/9.x/billing.md:1423 msgid "To retrieve the user's trial ending date, you may use the `trialEndsAt` method. This method will return a Carbon date instance if a user is on a trial or `null` if they aren't. You may also pass an optional subscription name parameter if you would like to get the trial ending date for a specific subscription other than the default one:" msgstr "" -#: docs/10.x/billing.md:block 457 (code) +# CODE +#: ./docs/8.x/billing.md:1301 +#: ./docs/9.x/billing.md:1425 +#: ./docs/10.x/billing.md:1611 +#: ./docs/11.x/billing.md:1608 +#: ./docs/master/billing.md:1611 msgid "if ($user->onTrial()) {\n" " $trialEndsAt = $user->trialEndsAt('main');\n" -"}\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 458 (paragraph) +# P +#: ./docs/8.x/billing.md:1305 +#: ./docs/9.x/billing.md:1429 +#: ./docs/10.x/billing.md:1615 +#: ./docs/11.x/billing.md:1612 +#: ./docs/master/billing.md:1615 msgid "You may also use the `onGenericTrial` method if you wish to know specifically that the user is within their \"generic\" trial period and has not yet created an actual subscription:" msgstr "" -#: docs/10.x/billing.md:block 459 (code) +# CODE +#: ./docs/8.x/billing.md:1307 +#: ./docs/9.x/billing.md:1431 +#: ./docs/10.x/billing.md:1617 +#: ./docs/11.x/billing.md:1614 +#: ./docs/master/billing.md:1617 msgid "if ($user->onGenericTrial()) {\n" " // User is within their \"generic\" trial period...\n" -"}\n" -msgstr "" - -#: docs/10.x/billing.md:block 461 (header) +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1311 +#: ./docs/9.x/billing.md:1435 +#: ./docs/10.x/billing.md:1621 +#: ./docs/11.x/billing.md:1618 +#: ./docs/master/billing.md:1621 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1312 +#: ./docs/9.x/billing.md:1436 +#: ./docs/10.x/billing.md:1622 +#: ./docs/11.x/billing.md:1619 +#: ./docs/master/billing.md:1622 msgid "Extending Trials" msgstr "" -#: docs/10.x/billing.md:block 462 (paragraph) +# P +#: ./docs/8.x/billing.md:1314 +#: ./docs/9.x/billing.md:1438 +#: ./docs/10.x/billing.md:1624 +#: ./docs/11.x/billing.md:1621 +#: ./docs/master/billing.md:1624 msgid "The `extendTrial` method allows you to extend the trial period of a subscription after the subscription has been created. If the trial has already expired and the customer is already being billed for the subscription, you can still offer them an extended trial. The time spent within the trial period will be deducted from the customer's next invoice:" msgstr "" -#: docs/10.x/billing.md:block 463 (code) +# CODE +#: ./docs/8.x/billing.md:1316 +#: ./docs/9.x/billing.md:1440 +#: ./docs/10.x/billing.md:1626 +#: ./docs/11.x/billing.md:1623 +#: ./docs/master/billing.md:1626 msgid "use App\\Models\\User;\n\n" "$subscription = User::find(1)->subscription('default');\n\n" "// End the trial 7 days from now...\n" @@ -2225,132 +5948,308 @@ msgid "use App\\Models\\User;\n\n" "// Add an additional 5 days to the trial...\n" "$subscription->extendTrial(\n" " $subscription->trial_ends_at->addDays(5)\n" -");\n" -msgstr "" - -#: docs/10.x/billing.md:block 465 (header) +");" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1330 +#: ./docs/9.x/billing.md:1454 +#: ./docs/10.x/billing.md:1640 +#: ./docs/11.x/billing.md:1637 +#: ./docs/master/billing.md:1640 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:1331 +#: ./docs/9.x/billing.md:1455 +#: ./docs/10.x/billing.md:1641 +#: ./docs/11.x/billing.md:1638 +#: ./docs/master/billing.md:1641 msgid "Handling Stripe Webhooks" msgstr "" -#: docs/10.x/billing.md:block 466 (quote) -msgid "**Note** You may use [the Stripe CLI](https://stripe.com/docs/stripe-cli) to help test webhooks during local development." +# P +#: ./docs/8.x/billing.md:1333 +#: ./docs/9.x/billing.md:1458 +#: ./docs/10.x/billing.md:1644 +#: ./docs/11.x/billing.md:1641 +#: ./docs/master/billing.md:1644 +msgid "You may use [the Stripe CLI](https://stripe.com/docs/stripe-cli) to help test webhooks during local development." msgstr "" -#: docs/10.x/billing.md:block 467 (paragraph) +# P +#: ./docs/8.x/billing.md:1335 +#: ./docs/9.x/billing.md:1460 +#: ./docs/10.x/billing.md:1646 +#: ./docs/11.x/billing.md:1643 +#: ./docs/master/billing.md:1646 msgid "Stripe can notify your application of a variety of events via webhooks. By default, a route that points to Cashier's webhook controller is automatically registered by the Cashier service provider. This controller will handle all incoming webhook requests." msgstr "" -#: docs/10.x/billing.md:block 468 (paragraph) +# P +#: ./docs/8.x/billing.md:1337 +#: ./docs/9.x/billing.md:1462 +#: ./docs/10.x/billing.md:1648 +#: ./docs/11.x/billing.md:1645 +#: ./docs/master/billing.md:1648 msgid "By default, the Cashier webhook controller will automatically handle cancelling subscriptions that have too many failed charges (as defined by your Stripe settings), customer updates, customer deletions, subscription updates, and payment method changes; however, as we'll soon discover, you can extend this controller to handle any Stripe webhook event you like." msgstr "" -#: docs/10.x/billing.md:block 469 (paragraph) +# P +#: ./docs/8.x/billing.md:1339 +#: ./docs/9.x/billing.md:1464 +#: ./docs/10.x/billing.md:1650 +#: ./docs/11.x/billing.md:1647 +#: ./docs/master/billing.md:1650 msgid "To ensure your application can handle Stripe webhooks, be sure to configure the webhook URL in the Stripe control panel. By default, Cashier's webhook controller responds to the `/stripe/webhook` URL path. The full list of all webhooks you should enable in the Stripe control panel are:" msgstr "" -#: docs/10.x/billing.md:block 470 (unordered list) +# P +#: ./docs/8.x/billing.md:1341 +#: ./docs/9.x/billing.md:1466 +#: ./docs/10.x/billing.md:1652 +#: ./docs/11.x/billing.md:1649 +#: ./docs/master/billing.md:1652 msgid "`customer.subscription.created`" msgstr "" -#: docs/10.x/billing.md:block 470 (unordered list) +# P +#: ./docs/8.x/billing.md:1342 +#: ./docs/9.x/billing.md:1467 +#: ./docs/10.x/billing.md:1653 +#: ./docs/11.x/billing.md:1650 +#: ./docs/master/billing.md:1653 msgid "`customer.subscription.updated`" msgstr "" -#: docs/10.x/billing.md:block 470 (unordered list) +# P +#: ./docs/8.x/billing.md:1343 +#: ./docs/9.x/billing.md:1468 +#: ./docs/10.x/billing.md:1654 +#: ./docs/11.x/billing.md:1651 +#: ./docs/master/billing.md:1654 msgid "`customer.subscription.deleted`" msgstr "" -#: docs/10.x/billing.md:block 470 (unordered list) +# P +#: ./docs/8.x/billing.md:1344 +#: ./docs/9.x/billing.md:1469 +#: ./docs/10.x/billing.md:1655 +#: ./docs/11.x/billing.md:1652 +#: ./docs/master/billing.md:1655 msgid "`customer.updated`" msgstr "" -#: docs/10.x/billing.md:block 470 (unordered list) +# P +#: ./docs/8.x/billing.md:1345 +#: ./docs/9.x/billing.md:1470 +#: ./docs/10.x/billing.md:1656 +#: ./docs/11.x/billing.md:1653 +#: ./docs/master/billing.md:1656 msgid "`customer.deleted`" msgstr "" -#: docs/10.x/billing.md:block 470 (unordered list) -msgid "`payment_method.automatically_updated`" -msgstr "" - -#: docs/10.x/billing.md:block 470 (unordered list) +# P +#: ./docs/8.x/billing.md:1346 +#: ./docs/9.x/billing.md:1472 +#: ./docs/10.x/billing.md:1658 +#: ./docs/11.x/billing.md:1655 +#: ./docs/master/billing.md:1658 msgid "`invoice.payment_action_required`" msgstr "" -#: docs/10.x/billing.md:block 470 (unordered list) -msgid "`invoice.payment_succeeded`" -msgstr "" - -#: docs/10.x/billing.md:block 471 (paragraph) +# P +#: ./docs/8.x/billing.md:1348 +#: ./docs/9.x/billing.md:1475 +#: ./docs/10.x/billing.md:1661 +#: ./docs/11.x/billing.md:1658 +#: ./docs/master/billing.md:1661 msgid "For convenience, Cashier includes a `cashier:webhook` Artisan command. This command will create a webhook in Stripe that listens to all of the events required by Cashier:" msgstr "" -#: docs/10.x/billing.md:block 472 (code) -msgid "php artisan cashier:webhook\n" +# CODE +# CODE: shell +#: ./docs/8.x/billing.md:1350 +#: ./docs/9.x/billing.md:1477 +#: ./docs/10.x/billing.md:1663 +#: ./docs/11.x/billing.md:1660 +#: ./docs/master/billing.md:1663 +msgid "php artisan cashier:webhook" msgstr "" -#: docs/10.x/billing.md:block 473 (paragraph) +# P +#: ./docs/8.x/billing.md:1352 +#: ./docs/9.x/billing.md:1481 +#: ./docs/10.x/billing.md:1667 +#: ./docs/11.x/billing.md:1664 +#: ./docs/master/billing.md:1667 msgid "By default, the created webhook will point to the URL defined by the `APP_URL` environment variable and the `cashier.webhook` route that is included with Cashier. You may provide the `--url` option when invoking the command if you would like to use a different URL:" msgstr "" -#: docs/10.x/billing.md:block 474 (code) -msgid "php artisan cashier:webhook --url \"https://example.com/stripe/webhook\"\n" +# CODE +# CODE: shell +#: ./docs/8.x/billing.md:1354 +#: ./docs/9.x/billing.md:1483 +#: ./docs/10.x/billing.md:1669 +#: ./docs/11.x/billing.md:1666 +#: ./docs/master/billing.md:1669 +msgid "php artisan cashier:webhook --url \"https://example.com/stripe/webhook\"" msgstr "" -#: docs/10.x/billing.md:block 475 (paragraph) +# P +#: ./docs/8.x/billing.md:1356 +#: ./docs/9.x/billing.md:1487 +#: ./docs/10.x/billing.md:1673 +#: ./docs/11.x/billing.md:1670 +#: ./docs/master/billing.md:1673 msgid "The webhook that is created will use the Stripe API version that your version of Cashier is compatible with. If you would like to use a different Stripe version, you may provide the `--api-version` option:" msgstr "" -#: docs/10.x/billing.md:block 476 (code) -msgid "php artisan cashier:webhook --api-version=\"2019-12-03\"\n" +# CODE +# CODE: shell +#: ./docs/8.x/billing.md:1358 +#: ./docs/9.x/billing.md:1489 +#: ./docs/10.x/billing.md:1675 +#: ./docs/11.x/billing.md:1672 +#: ./docs/master/billing.md:1675 +msgid "php artisan cashier:webhook --api-version=\"2019-12-03\"" msgstr "" -#: docs/10.x/billing.md:block 477 (paragraph) +# P +#: ./docs/8.x/billing.md:1360 +#: ./docs/9.x/billing.md:1493 +#: ./docs/10.x/billing.md:1679 +#: ./docs/11.x/billing.md:1676 +#: ./docs/master/billing.md:1679 msgid "After creation, the webhook will be immediately active. If you wish to create the webhook but have it disabled until you're ready, you may provide the `--disabled` option when invoking the command:" msgstr "" -#: docs/10.x/billing.md:block 478 (code) -msgid "php artisan cashier:webhook --disabled\n" -msgstr "" - -#: docs/10.x/billing.md:block 479 (quote) -msgid "**Warning** Make sure you protect incoming Stripe webhook requests with Cashier's included [webhook signature verification](#verifying-webhook-signatures) middleware." -msgstr "" - -#: docs/10.x/billing.md:block 481 (header) +# CODE +# CODE: shell +#: ./docs/8.x/billing.md:1362 +#: ./docs/9.x/billing.md:1495 +#: ./docs/10.x/billing.md:1681 +#: ./docs/11.x/billing.md:1678 +#: ./docs/master/billing.md:1681 +msgid "php artisan cashier:webhook --disabled" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1364 +#: ./docs/9.x/billing.md:1500 +#: ./docs/10.x/billing.md:1686 +#: ./docs/11.x/billing.md:1683 +#: ./docs/master/billing.md:1686 +msgid "Make sure you protect incoming Stripe webhook requests with Cashier's included [webhook signature verification](#verifying-webhook-signatures) middleware." +msgstr "" + +# P +#: ./docs/8.x/billing.md:1366 +#: ./docs/9.x/billing.md:1502 +#: ./docs/10.x/billing.md:1688 +#: ./docs/11.x/billing.md:1685 +#: ./docs/master/billing.md:1688 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:1367 +#: ./docs/9.x/billing.md:1503 msgid "Webhooks & CSRF Protection" msgstr "" -#: docs/10.x/billing.md:block 482 (paragraph) +# P +#: ./docs/8.x/billing.md:1369 +#: ./docs/9.x/billing.md:1505 +#: ./docs/10.x/billing.md:1691 msgid "Since Stripe webhooks need to bypass Laravel's [CSRF protection](/docs/{{version}}/csrf), be sure to list the URI as an exception in your application's `App\\Http\\Middleware\\VerifyCsrfToken` middleware or list the route outside of the `web` middleware group:" msgstr "" -#: docs/10.x/billing.md:block 483 (code) +# CODE +#: ./docs/8.x/billing.md:1371 +#: ./docs/9.x/billing.md:1507 +#: ./docs/10.x/billing.md:1693 msgid "protected $except = [\n" " 'stripe/*',\n" -"];\n" -msgstr "" - -#: docs/10.x/billing.md:block 485 (header) +"];" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1375 +#: ./docs/9.x/billing.md:1511 +#: ./docs/10.x/billing.md:1697 +#: ./docs/11.x/billing.md:1696 +#: ./docs/master/billing.md:1699 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1376 +#: ./docs/9.x/billing.md:1512 +#: ./docs/10.x/billing.md:1698 +#: ./docs/11.x/billing.md:1697 +#: ./docs/master/billing.md:1700 msgid "Defining Webhook Event Handlers" msgstr "" -#: docs/10.x/billing.md:block 486 (paragraph) +# P +#: ./docs/8.x/billing.md:1378 +#: ./docs/9.x/billing.md:1514 +#: ./docs/10.x/billing.md:1700 +#: ./docs/11.x/billing.md:1699 +#: ./docs/master/billing.md:1702 msgid "Cashier automatically handles subscription cancellations for failed charges and other common Stripe webhook events. However, if you have additional webhook events you would like to handle, you may do so by listening to the following events that are dispatched by Cashier:" msgstr "" -#: docs/10.x/billing.md:block 487 (unordered list) +# P +#: ./docs/8.x/billing.md:1380 +#: ./docs/9.x/billing.md:1516 +#: ./docs/10.x/billing.md:1702 +#: ./docs/11.x/billing.md:1701 +#: ./docs/master/billing.md:1704 msgid "`Laravel\\Cashier\\Events\\WebhookReceived`" msgstr "" -#: docs/10.x/billing.md:block 487 (unordered list) +# P +#: ./docs/8.x/billing.md:1381 +#: ./docs/9.x/billing.md:1517 +#: ./docs/10.x/billing.md:1703 +#: ./docs/11.x/billing.md:1702 +#: ./docs/master/billing.md:1705 msgid "`Laravel\\Cashier\\Events\\WebhookHandled`" msgstr "" -#: docs/10.x/billing.md:block 488 (paragraph) +# P +#: ./docs/9.x/billing.md:1381 +#: ./docs/10.x/billing.md:1567 +#: ./docs/11.x/billing.md:1564 +#: ./docs/master/billing.md:1567 +msgid "To determine if an existing trial has expired, you may use the `hasExpiredTrial` methods:" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1383 +#: ./docs/9.x/billing.md:1519 +#: ./docs/10.x/billing.md:1705 +#: ./docs/11.x/billing.md:1704 +#: ./docs/master/billing.md:1707 msgid "Both events contain the full payload of the Stripe webhook. For example, if you wish to handle the `invoice.payment_succeeded` webhook, you may register a [listener](/docs/{{version}}/events#defining-listeners) that will handle the event:" msgstr "" -#: docs/10.x/billing.md:block 489 (code) +# CODE +#: ./docs/9.x/billing.md:1383 +msgid "if ($user->hasExpiredTrial('default')) {\n" +" //\n" +"}\n\n" +"if ($user->subscription('default')->hasExpiredTrial()) {\n" +" //\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:1385 +#: ./docs/9.x/billing.md:1521 msgid "payload['type'] === 'invoice.payment_succeeded') {\n" " // Handle the incoming event...\n" " }\n" " }\n" -"}\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/billing.md:1403 +#: ./docs/11.x/billing.md:1400 +#: ./docs/master/billing.md:1403 +msgid "/**\n" +" * The tax rates that should apply to the customer's subscriptions.\n" +" *\n" +" * @return array\n" +" */\n" +"public function taxRates(): array\n" +"{\n" +" return ['txr_id'];\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 490 (paragraph) +# P +#: ./docs/8.x/billing.md:1407 +#: ./docs/9.x/billing.md:1543 +#: ./docs/10.x/billing.md:1726 msgid "Once your listener has been defined, you may register it within your application's `EventServiceProvider`:" msgstr "" -#: docs/10.x/billing.md:block 491 (code) +# CODE +#: ./docs/8.x/billing.md:1409 +#: ./docs/9.x/billing.md:1545 +#: ./docs/10.x/billing.md:1728 msgid ">\n" +" */\n" +"public function priceTaxRates(): array\n" +"{\n" +" return [\n" +" 'price_monthly' => ['txr_id'],\n" +" ];\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1426 +#: ./docs/9.x/billing.md:1562 +#: ./docs/10.x/billing.md:1745 +#: ./docs/11.x/billing.md:1725 +#: ./docs/master/billing.md:1728 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1427 +#: ./docs/9.x/billing.md:1563 +#: ./docs/10.x/billing.md:1746 +#: ./docs/11.x/billing.md:1726 +#: ./docs/master/billing.md:1729 msgid "Verifying Webhook Signatures" msgstr "" -#: docs/10.x/billing.md:block 494 (paragraph) +# P +#: ./docs/8.x/billing.md:1429 +#: ./docs/9.x/billing.md:1565 +#: ./docs/10.x/billing.md:1748 +#: ./docs/11.x/billing.md:1728 +#: ./docs/master/billing.md:1731 msgid "To secure your webhooks, you may use [Stripe's webhook signatures](https://stripe.com/docs/webhooks/signatures). For convenience, Cashier automatically includes a middleware which validates that the incoming Stripe webhook request is valid." msgstr "" -#: docs/10.x/billing.md:block 495 (paragraph) +# P +#: ./docs/8.x/billing.md:1431 +#: ./docs/9.x/billing.md:1567 +#: ./docs/10.x/billing.md:1750 +#: ./docs/11.x/billing.md:1730 +#: ./docs/master/billing.md:1733 msgid "To enable webhook verification, ensure that the `STRIPE_WEBHOOK_SECRET` environment variable is set in your application's `.env` file. The webhook `secret` may be retrieved from your Stripe account dashboard." msgstr "" -#: docs/10.x/billing.md:block 497 (header) +# P +#: ./docs/8.x/billing.md:1433 +#: ./docs/9.x/billing.md:1569 +#: ./docs/10.x/billing.md:1752 +#: ./docs/11.x/billing.md:1732 +#: ./docs/master/billing.md:1735 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:1434 +#: ./docs/9.x/billing.md:1570 +#: ./docs/10.x/billing.md:1753 +#: ./docs/11.x/billing.md:1733 +#: ./docs/master/billing.md:1736 msgid "Single Charges" msgstr "" -#: docs/10.x/billing.md:block 499 (header) +# P +#: ./docs/8.x/billing.md:1436 +#: ./docs/9.x/billing.md:1572 +#: ./docs/10.x/billing.md:1755 +#: ./docs/11.x/billing.md:1735 +#: ./docs/master/billing.md:1738 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1437 +#: ./docs/9.x/billing.md:1573 +#: ./docs/10.x/billing.md:1756 +#: ./docs/11.x/billing.md:1736 +#: ./docs/master/billing.md:1739 msgid "Simple Charge" msgstr "" -#: docs/10.x/billing.md:block 500 (paragraph) +# P +#: ./docs/8.x/billing.md:1439 +msgid "The `charge` method accepts the amount you would like to charge in the lowest denominator of the currency used by your application. For example, when using United States Dollars, amounts should be specified in pennies." +msgstr "" + +# P +#: ./docs/8.x/billing.md:1441 +#: ./docs/9.x/billing.md:1575 +#: ./docs/10.x/billing.md:1758 +#: ./docs/11.x/billing.md:1738 +#: ./docs/master/billing.md:1741 msgid "If you would like to make a one-time charge against a customer, you may use the `charge` method on a billable model instance. You will need to [provide a payment method identifier](#payment-methods-for-single-charges) as the second argument to the `charge` method:" msgstr "" -#: docs/10.x/billing.md:block 501 (code) +# CODE +#: ./docs/8.x/billing.md:1443 +#: ./docs/9.x/billing.md:1577 +#: ./docs/10.x/billing.md:1760 +#: ./docs/11.x/billing.md:1740 +#: ./docs/master/billing.md:1743 msgid "use Illuminate\\Http\\Request;\n\n" "Route::post('/purchase', function (Request $request) {\n" " $stripeCharge = $request->user()->charge(\n" " 100, $request->paymentMethodId\n" " );\n\n" " // ...\n" -"});\n" +"});" msgstr "" -#: docs/10.x/billing.md:block 502 (paragraph) +# P +#: ./docs/8.x/billing.md:1453 +#: ./docs/9.x/billing.md:1587 +#: ./docs/10.x/billing.md:1770 +#: ./docs/11.x/billing.md:1750 +#: ./docs/master/billing.md:1753 msgid "The `charge` method accepts an array as its third argument, allowing you to pass any options you wish to the underlying Stripe charge creation. More information regarding the options available to you when creating charges may be found in the [Stripe documentation](https://stripe.com/docs/api/charges/create):" msgstr "" -#: docs/10.x/billing.md:block 503 (code) +# CODE +#: ./docs/8.x/billing.md:1455 +#: ./docs/9.x/billing.md:1589 +#: ./docs/10.x/billing.md:1772 +#: ./docs/11.x/billing.md:1752 +#: ./docs/master/billing.md:1755 msgid "$user->charge(100, $paymentMethod, [\n" " 'custom_option' => $value,\n" -"]);\n" +"]);" msgstr "" -#: docs/10.x/billing.md:block 504 (paragraph) +# P +#: ./docs/8.x/billing.md:1459 +#: ./docs/9.x/billing.md:1593 +#: ./docs/10.x/billing.md:1776 +#: ./docs/11.x/billing.md:1756 +#: ./docs/master/billing.md:1759 msgid "You may also use the `charge` method without an underlying customer or user. To accomplish this, invoke the `charge` method on a new instance of your application's billable model:" msgstr "" -#: docs/10.x/billing.md:block 505 (code) +# CODE +#: ./docs/8.x/billing.md:1461 +#: ./docs/9.x/billing.md:1595 +#: ./docs/10.x/billing.md:1778 +#: ./docs/11.x/billing.md:1758 +#: ./docs/master/billing.md:1761 msgid "use App\\Models\\User;\n\n" -"$stripeCharge = (new User)->charge(100, $paymentMethod);\n" +"$stripeCharge = (new User)->charge(100, $paymentMethod);" msgstr "" -#: docs/10.x/billing.md:block 506 (paragraph) +# P +#: ./docs/8.x/billing.md:1465 +#: ./docs/9.x/billing.md:1599 +#: ./docs/10.x/billing.md:1782 +#: ./docs/11.x/billing.md:1762 +#: ./docs/master/billing.md:1765 msgid "The `charge` method will throw an exception if the charge fails. If the charge is successful, an instance of `Laravel\\Cashier\\Payment` will be returned from the method:" msgstr "" -#: docs/10.x/billing.md:block 507 (code) +# CODE +#: ./docs/8.x/billing.md:1467 +#: ./docs/9.x/billing.md:1601 msgid "try {\n" " $payment = $user->charge(100, $paymentMethod);\n" "} catch (Exception $e) {\n" -" // ...\n" -"}\n" +" //\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1471 +#: ./docs/10.x/billing.md:1657 +#: ./docs/11.x/billing.md:1654 +#: ./docs/master/billing.md:1657 +msgid "`payment_method.automatically_updated`" msgstr "" -#: docs/10.x/billing.md:block 508 (quote) -msgid "**Warning** The `charge` method accepts the payment amount in the lowest denominator of the currency used by your application. For example, if customers are paying in United States Dollars, amounts should be specified in pennies." +# P +#: ./docs/8.x/billing.md:1473 +#: ./docs/9.x/billing.md:1610 +#: ./docs/10.x/billing.md:1793 +#: ./docs/11.x/billing.md:1773 +#: ./docs/master/billing.md:1776 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/billing.md:1473 +#: ./docs/10.x/billing.md:1659 +#: ./docs/11.x/billing.md:1656 +#: ./docs/master/billing.md:1659 +msgid "`invoice.payment_succeeded`" msgstr "" -#: docs/10.x/billing.md:block 510 (header) +# H3 +#: ./docs/8.x/billing.md:1474 +#: ./docs/9.x/billing.md:1611 +#: ./docs/10.x/billing.md:1794 +#: ./docs/11.x/billing.md:1774 +#: ./docs/master/billing.md:1777 msgid "Charge With Invoice" msgstr "" -#: docs/10.x/billing.md:block 511 (paragraph) +# P +#: ./docs/8.x/billing.md:1476 +#: ./docs/9.x/billing.md:1613 msgid "Sometimes you may need to make a one-time charge and offer a PDF receipt to your customer. The `invoicePrice` method lets you do just that. For example, let's invoice a customer for five new shirts:" msgstr "" -#: docs/10.x/billing.md:block 512 (code) -msgid "$user->invoicePrice('price_tshirt', 5);\n" +# CODE +#: ./docs/8.x/billing.md:1478 +#: ./docs/9.x/billing.md:1615 +#: ./docs/10.x/billing.md:1798 +#: ./docs/11.x/billing.md:1778 +#: ./docs/master/billing.md:1781 +msgid "$user->invoicePrice('price_tshirt', 5);" msgstr "" -#: docs/10.x/billing.md:block 513 (paragraph) +# P +#: ./docs/8.x/billing.md:1480 +#: ./docs/9.x/billing.md:1617 +#: ./docs/10.x/billing.md:1800 +#: ./docs/11.x/billing.md:1780 +#: ./docs/master/billing.md:1783 msgid "The invoice will be immediately charged against the user's default payment method. The `invoicePrice` method also accepts an array as its third argument. This array contains the billing options for the invoice item. The fourth argument accepted by the method is also an array which should contain the billing options for the invoice itself:" msgstr "" -#: docs/10.x/billing.md:block 514 (code) +# CODE +#: ./docs/8.x/billing.md:1482 +#: ./docs/9.x/billing.md:1619 +#: ./docs/10.x/billing.md:1802 +#: ./docs/11.x/billing.md:1782 +#: ./docs/master/billing.md:1785 msgid "$user->invoicePrice('price_tshirt', 5, [\n" " 'discounts' => [\n" " ['coupon' => 'SUMMER21SALE']\n" " ],\n" "], [\n" " 'default_tax_rates' => ['txr_id'],\n" -"]);\n" -msgstr "" - -#: docs/10.x/billing.md:block 515 (paragraph) -msgid "Similarly to `invoicePrice`, you may use the `tabPrice` method to create a one-time charge for multiple items (up to 250 items per invoice) by adding them to the customer's \"tab\" and then invoicing the customer. For example, we may invoice a customer for five shirts and two mugs:" +"]);" msgstr "" -#: docs/10.x/billing.md:block 516 (code) -msgid "$user->tabPrice('price_tshirt', 5);\n" -"$user->tabPrice('price_mug', 2);\n" -"$user->invoice();\n" -msgstr "" - -#: docs/10.x/billing.md:block 517 (paragraph) +# P +#: ./docs/8.x/billing.md:1490 +#: ./docs/9.x/billing.md:1633 +#: ./docs/10.x/billing.md:1816 +#: ./docs/11.x/billing.md:1796 +#: ./docs/master/billing.md:1799 msgid "Alternatively, you may use the `invoiceFor` method to make a \"one-off\" charge against the customer's default payment method:" msgstr "" -#: docs/10.x/billing.md:block 518 (code) -msgid "$user->invoiceFor('One Time Fee', 500);\n" -msgstr "" - -#: docs/10.x/billing.md:block 519 (paragraph) -msgid "Although the `invoiceFor` method is available for you to use, it is recommended that you use the `invoicePrice` and `tabPrice` methods with pre-defined prices. By doing so, you will have access to better analytics and data within your Stripe dashboard regarding your sales on a per-product basis." -msgstr "" - -#: docs/10.x/billing.md:block 520 (quote) -msgid "**Warning** The `invoice`, `invoicePrice`, and `invoiceFor` methods will create a Stripe invoice which will retry failed billing attempts. If you do not want invoices to retry failed charges, you will need to close them using the Stripe API after the first failed charge." -msgstr "" - -#: docs/10.x/billing.md:block 522 (header) -msgid "Creating Payment Intents" -msgstr "" - -#: docs/10.x/billing.md:block 523 (paragraph) -msgid "You can create a new Stripe payment intent by invoking the `pay` method on a billable model instance. Calling this method will create a payment intent that is wrapped in a `Laravel\\Cashier\\Payment` instance:" -msgstr "" - -#: docs/10.x/billing.md:block 524 (code) -msgid "use Illuminate\\Http\\Request;\n\n" -"Route::post('/pay', function (Request $request) {\n" -" $payment = $request->user()->pay(\n" -" $request->get('amount')\n" -" );\n\n" -" return $payment->client_secret;\n" -"});\n" -msgstr "" - -#: docs/10.x/billing.md:block 525 (paragraph) -msgid "After creating the payment intent, you can return the client secret to your application's frontend so that the user can complete the payment in their browser. To read more about building entire payment flows using Stripe payment intents, please consult the [Stripe documentation](https://stripe.com/docs/payments/accept-a-payment?platform=web)." +# CODE +#: ./docs/8.x/billing.md:1492 +#: ./docs/9.x/billing.md:1635 +#: ./docs/10.x/billing.md:1818 +#: ./docs/11.x/billing.md:1798 +#: ./docs/master/billing.md:1801 +msgid "$user->invoiceFor('One Time Fee', 500);" msgstr "" -#: docs/10.x/billing.md:block 526 (paragraph) -msgid "When using the `pay` method, the default payment methods that are enabled within your Stripe dashboard will be available to the customer. Alternatively, if you only want to allow for some specific payment methods to be used, you may use the `payWith` method:" +# P +#: ./docs/8.x/billing.md:1494 +msgid "Although the `invoiceFor` method is available for you to use, it is recommendeded that you use the `invoicePrice` method with pre-defined prices. By doing so, you will have access to better analytics and data within your Stripe dashboard regarding your sales on a per-product basis." msgstr "" -#: docs/10.x/billing.md:block 527 (code) -msgid "use Illuminate\\Http\\Request;\n\n" -"Route::post('/pay', function (Request $request) {\n" -" $payment = $request->user()->payWith(\n" -" $request->get('amount'), ['card', 'bancontact']\n" -" );\n\n" -" return $payment->client_secret;\n" -"});\n" +# P +#: ./docs/8.x/billing.md:1496 +msgid "The `invoicePrice` and `invoiceFor` methods will create a Stripe invoice which will retry failed billing attempts. If you do not want invoices to retry failed charges, you will need to close them using the Stripe API after the first failed charge." msgstr "" -#: docs/10.x/billing.md:block 528 (quote) -msgid "**Warning** The `pay` and `payWith` methods accept the payment amount in the lowest denominator of the currency used by your application. For example, if customers are paying in United States Dollars, amounts should be specified in pennies." -msgstr "" +# P +#: ./docs/8.x/billing.md:1498 +#: ./docs/9.x/billing.md:1674 +#: ./docs/10.x/billing.md:1857 +#: ./docs/11.x/billing.md:1837 +#: ./docs/master/billing.md:1840 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/billing.md:block 530 (header) +# H3 +#: ./docs/8.x/billing.md:1499 +#: ./docs/9.x/billing.md:1675 +#: ./docs/10.x/billing.md:1858 +#: ./docs/11.x/billing.md:1838 +#: ./docs/master/billing.md:1841 msgid "Refunding Charges" msgstr "" -#: docs/10.x/billing.md:block 531 (paragraph) +# P +#: ./docs/8.x/billing.md:1501 +#: ./docs/9.x/billing.md:1677 +#: ./docs/10.x/billing.md:1860 +#: ./docs/11.x/billing.md:1840 +#: ./docs/master/billing.md:1843 msgid "If you need to refund a Stripe charge, you may use the `refund` method. This method accepts the Stripe [payment intent ID](#payment-methods-for-single-charges) as its first argument:" msgstr "" -#: docs/10.x/billing.md:block 532 (code) +# CODE +#: ./docs/8.x/billing.md:1503 +#: ./docs/9.x/billing.md:1679 +#: ./docs/10.x/billing.md:1862 +#: ./docs/11.x/billing.md:1842 +#: ./docs/master/billing.md:1845 msgid "$payment = $user->charge(100, $paymentMethodId);\n\n" -"$user->refund($payment->id);\n" -msgstr "" - -#: docs/10.x/billing.md:block 534 (header) +"$user->refund($payment->id);" +msgstr "" + +# P +#: ./docs/10.x/billing.md:1507 +#: ./docs/11.x/billing.md:1504 +#: ./docs/master/billing.md:1507 +msgid "Finally, you should always cancel user subscriptions before deleting the associated user model:" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1507 +#: ./docs/9.x/billing.md:1683 +#: ./docs/10.x/billing.md:1866 +#: ./docs/11.x/billing.md:1846 +#: ./docs/master/billing.md:1849 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:1508 +#: ./docs/9.x/billing.md:1684 +#: ./docs/10.x/billing.md:1867 +#: ./docs/11.x/billing.md:1847 +#: ./docs/master/billing.md:1850 msgid "Invoices" msgstr "" -#: docs/10.x/billing.md:block 536 (header) +# CODE +#: ./docs/10.x/billing.md:1509 +#: ./docs/11.x/billing.md:1506 +#: ./docs/master/billing.md:1509 +msgid "$user->subscription('default')->cancelNow();\n\n" +"$user->delete();" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1510 +#: ./docs/9.x/billing.md:1686 +#: ./docs/10.x/billing.md:1869 +#: ./docs/11.x/billing.md:1849 +#: ./docs/master/billing.md:1852 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1511 +#: ./docs/9.x/billing.md:1687 +#: ./docs/10.x/billing.md:1870 +#: ./docs/11.x/billing.md:1850 +#: ./docs/master/billing.md:1853 msgid "Retrieving Invoices" msgstr "" -#: docs/10.x/billing.md:block 537 (paragraph) +# P +#: ./docs/8.x/billing.md:1513 +#: ./docs/9.x/billing.md:1689 +#: ./docs/10.x/billing.md:1872 +#: ./docs/11.x/billing.md:1852 +#: ./docs/master/billing.md:1855 msgid "You may easily retrieve an array of a billable model's invoices using the `invoices` method. The `invoices` method returns a collection of `Laravel\\Cashier\\Invoice` instances:" msgstr "" -#: docs/10.x/billing.md:block 538 (code) -msgid "$invoices = $user->invoices();\n" +# CODE +#: ./docs/8.x/billing.md:1515 +#: ./docs/9.x/billing.md:1691 +#: ./docs/10.x/billing.md:1874 +#: ./docs/11.x/billing.md:1854 +#: ./docs/master/billing.md:1857 +msgid "$invoices = $user->invoices();" msgstr "" -#: docs/10.x/billing.md:block 539 (paragraph) +# P +#: ./docs/8.x/billing.md:1517 +#: ./docs/9.x/billing.md:1693 +#: ./docs/10.x/billing.md:1876 +#: ./docs/11.x/billing.md:1856 +#: ./docs/master/billing.md:1859 msgid "If you would like to include pending invoices in the results, you may use the `invoicesIncludingPending` method:" msgstr "" -#: docs/10.x/billing.md:block 540 (code) -msgid "$invoices = $user->invoicesIncludingPending();\n" +# CODE +#: ./docs/8.x/billing.md:1519 +#: ./docs/9.x/billing.md:1695 +#: ./docs/10.x/billing.md:1878 +#: ./docs/11.x/billing.md:1858 +#: ./docs/master/billing.md:1861 +msgid "$invoices = $user->invoicesIncludingPending();" msgstr "" -#: docs/10.x/billing.md:block 541 (paragraph) +# P +#: ./docs/8.x/billing.md:1521 +#: ./docs/9.x/billing.md:1697 +#: ./docs/10.x/billing.md:1880 +#: ./docs/11.x/billing.md:1860 +#: ./docs/master/billing.md:1863 msgid "You may use the `findInvoice` method to retrieve a specific invoice by its ID:" msgstr "" -#: docs/10.x/billing.md:block 542 (code) -msgid "$invoice = $user->findInvoice($invoiceId);\n" -msgstr "" - -#: docs/10.x/billing.md:block 544 (header) +# CODE +#: ./docs/8.x/billing.md:1523 +#: ./docs/9.x/billing.md:1699 +#: ./docs/10.x/billing.md:1882 +#: ./docs/11.x/billing.md:1862 +#: ./docs/master/billing.md:1865 +msgid "$invoice = $user->findInvoice($invoiceId);" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1525 +#: ./docs/9.x/billing.md:1701 +#: ./docs/10.x/billing.md:1884 +#: ./docs/11.x/billing.md:1864 +#: ./docs/master/billing.md:1867 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:1526 +#: ./docs/9.x/billing.md:1702 +#: ./docs/10.x/billing.md:1885 +#: ./docs/11.x/billing.md:1865 +#: ./docs/master/billing.md:1868 msgid "Displaying Invoice Information" msgstr "" -#: docs/10.x/billing.md:block 545 (paragraph) +# P +#: ./docs/8.x/billing.md:1528 +#: ./docs/9.x/billing.md:1704 +#: ./docs/10.x/billing.md:1887 +#: ./docs/11.x/billing.md:1867 +#: ./docs/master/billing.md:1870 msgid "When listing the invoices for the customer, you may use the invoice's methods to display the relevant invoice information. For example, you may wish to list every invoice in a table, allowing the user to easily download any of them:" msgstr "" -#: docs/10.x/billing.md:block 546 (code) +# CODE +#: ./docs/8.x/billing.md:1530 +#: ./docs/9.x/billing.md:1706 +#: ./docs/10.x/billing.md:1889 +#: ./docs/11.x/billing.md:1869 +#: ./docs/master/billing.md:1872 msgid "\n" " @foreach ($invoices as $invoice)\n" " \n" @@ -2611,77 +6779,185 @@ msgid "
\n" " \n" " \n" " @endforeach\n" -"
id }}\">Download
\n" -msgstr "" - -#: docs/10.x/billing.md:block 548 (header) +"" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1540 +#: ./docs/9.x/billing.md:1716 +#: ./docs/10.x/billing.md:1899 +#: ./docs/11.x/billing.md:1879 +#: ./docs/master/billing.md:1882 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1541 +#: ./docs/9.x/billing.md:1717 +#: ./docs/10.x/billing.md:1900 +#: ./docs/11.x/billing.md:1880 +#: ./docs/master/billing.md:1883 msgid "Upcoming Invoices" msgstr "" -#: docs/10.x/billing.md:block 549 (paragraph) +# P +#: ./docs/8.x/billing.md:1543 +#: ./docs/9.x/billing.md:1719 +#: ./docs/10.x/billing.md:1902 +#: ./docs/11.x/billing.md:1882 +#: ./docs/master/billing.md:1885 msgid "To retrieve the upcoming invoice for a customer, you may use the `upcomingInvoice` method:" msgstr "" -#: docs/10.x/billing.md:block 550 (code) -msgid "$invoice = $user->upcomingInvoice();\n" +# CODE +#: ./docs/8.x/billing.md:1545 +#: ./docs/9.x/billing.md:1721 +#: ./docs/10.x/billing.md:1904 +#: ./docs/11.x/billing.md:1884 +#: ./docs/master/billing.md:1887 +msgid "$invoice = $user->upcomingInvoice();" msgstr "" -#: docs/10.x/billing.md:block 551 (paragraph) -msgid "Similarly, if the customer has multiple subscriptions, you can also retrieve the upcoming invoice for a specific subscription:" +# P +#: ./docs/8.x/billing.md:1547 +msgid "Similary, if the customer has multiple subscriptions, you can also retrieve the upcoming invoice for a specific subscription:" msgstr "" -#: docs/10.x/billing.md:block 552 (code) -msgid "$invoice = $user->subscription('default')->upcomingInvoice();\n" +# CODE +#: ./docs/8.x/billing.md:1549 +#: ./docs/9.x/billing.md:1725 +#: ./docs/10.x/billing.md:1908 +#: ./docs/11.x/billing.md:1888 +#: ./docs/master/billing.md:1891 +msgid "$invoice = $user->subscription('default')->upcomingInvoice();" msgstr "" -#: docs/10.x/billing.md:block 554 (header) -msgid "Previewing Subscription Invoices" +# P +#: ./docs/8.x/billing.md:1551 +#: ./docs/9.x/billing.md:1727 +#: ./docs/10.x/billing.md:1910 +#: ./docs/11.x/billing.md:1890 +#: ./docs/master/billing.md:1893 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1552 +msgid "Previewing Subscription Invoice" msgstr "" -#: docs/10.x/billing.md:block 555 (paragraph) +# P +#: ./docs/8.x/billing.md:1554 +#: ./docs/9.x/billing.md:1730 +#: ./docs/10.x/billing.md:1913 +#: ./docs/11.x/billing.md:1893 +#: ./docs/master/billing.md:1896 msgid "Using the `previewInvoice` method, you can preview an invoice before making price changes. This will allow you to determine what your customer's invoice will look like when a given price change is made:" msgstr "" -#: docs/10.x/billing.md:block 556 (code) -msgid "$invoice = $user->subscription('default')->previewInvoice('price_yearly');\n" +# CODE +#: ./docs/10.x/billing.md:1555 +#: ./docs/11.x/billing.md:1552 +#: ./docs/master/billing.md:1555 +msgid "if ($user->onTrial('default')) {\n" +" // ...\n" +"}\n\n" +"if ($user->subscription('default')->onTrial()) {\n" +" // ...\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 557 (paragraph) -msgid "You may pass an array of prices to the `previewInvoice` method in order to preview invoices with multiple new prices:" +# CODE +#: ./docs/8.x/billing.md:1556 +#: ./docs/9.x/billing.md:1732 +#: ./docs/10.x/billing.md:1915 +#: ./docs/11.x/billing.md:1895 +#: ./docs/master/billing.md:1898 +msgid "$invoice = $user->subscription('default')->previewInvoice('price_yearly');" msgstr "" -#: docs/10.x/billing.md:block 558 (code) -msgid "$invoice = $user->subscription('default')->previewInvoice(['price_yearly', 'price_metered']);\n" +# P +#: ./docs/8.x/billing.md:1558 +#: ./docs/9.x/billing.md:1734 +#: ./docs/10.x/billing.md:1917 +#: ./docs/11.x/billing.md:1897 +#: ./docs/master/billing.md:1900 +msgid "You may pass an array of prices to the `previewInvoice` method in order to preview invoices with multiple new prices:" msgstr "" -#: docs/10.x/billing.md:block 560 (header) +# CODE +#: ./docs/8.x/billing.md:1560 +#: ./docs/9.x/billing.md:1736 +#: ./docs/10.x/billing.md:1919 +#: ./docs/11.x/billing.md:1899 +#: ./docs/master/billing.md:1902 +msgid "$invoice = $user->subscription('default')->previewInvoice(['price_yearly', 'price_metered']);" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1562 +#: ./docs/9.x/billing.md:1738 +#: ./docs/10.x/billing.md:1921 +#: ./docs/11.x/billing.md:1901 +#: ./docs/master/billing.md:1904 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1563 +#: ./docs/9.x/billing.md:1739 +#: ./docs/10.x/billing.md:1922 +#: ./docs/11.x/billing.md:1902 +#: ./docs/master/billing.md:1905 msgid "Generating Invoice PDFs" msgstr "" -#: docs/10.x/billing.md:block 561 (paragraph) -msgid "Before generating invoice PDFs, you should use Composer to install the Dompdf library, which is the default invoice renderer for Cashier:" +# P +#: ./docs/8.x/billing.md:1565 +#: ./docs/9.x/billing.md:1747 +#: ./docs/10.x/billing.md:1930 +#: ./docs/11.x/billing.md:1910 +#: ./docs/master/billing.md:1913 +msgid "From within a route or controller, you may use the `downloadInvoice` method to generate a PDF download of a given invoice. This method will automatically generate the proper HTTP response needed to download the invoice:" msgstr "" -#: docs/10.x/billing.md:block 562 (code) -msgid "composer require dompdf/dompdf\n" +# CODE +#: ./docs/8.x/billing.md:1567 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/user/invoice/{invoice}', function (Request $request, $invoiceId) {\n" +" return $request->user()->downloadInvoice($invoiceId, [\n" +" 'vendor' => 'Your Company',\n" +" 'product' => 'Your Product',\n" +" ]);\n" +"});" msgstr "" -#: docs/10.x/billing.md:block 563 (paragraph) -msgid "From within a route or controller, you may use the `downloadInvoice` method to generate a PDF download of a given invoice. This method will automatically generate the proper HTTP response needed to download the invoice:" +# CODE +#: ./docs/10.x/billing.md:1569 +#: ./docs/11.x/billing.md:1566 +#: ./docs/master/billing.md:1569 +msgid "if ($user->hasExpiredTrial('default')) {\n" +" // ...\n" +"}\n\n" +"if ($user->subscription('default')->hasExpiredTrial()) {\n" +" // ...\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 564 (code) -msgid "use Illuminate\\Http\\Request;\n\n" -"Route::get('/user/invoice/{invoice}', function (Request $request, string $invoiceId) {\n" -" return $request->user()->downloadInvoice($invoiceId);\n" -"});\n" +# P +#: ./docs/8.x/billing.md:1576 +msgid "By default, all data on the invoice is derived from the customer and invoice data stored in Stripe. However, you can customize some of this data by providing an array as the second argument to the `downloadInvoice` method. This array allows you to customize information such as your company and product details:" msgstr "" -#: docs/10.x/billing.md:block 565 (paragraph) -msgid "By default, all data on the invoice is derived from the customer and invoice data stored in Stripe. The filename is based on your `app.name` config value. However, you can customize some of this data by providing an array as the second argument to the `downloadInvoice` method. This array allows you to customize information such as your company and product details:" +# H4 +#: ./docs/10.x/billing.md:1578 +#: ./docs/11.x/billing.md:1575 +#: ./docs/master/billing.md:1578 +msgid "Defining Trial Days in Stripe / Cashier" msgstr "" -#: docs/10.x/billing.md:block 566 (code) +# CODE +#: ./docs/8.x/billing.md:1578 msgid "return $request->user()->downloadInvoice($invoiceId, [\n" " 'vendor' => 'Your Company',\n" " 'product' => 'Your Product',\n" @@ -2691,26 +6967,57 @@ msgid "return $request->user()->downloadInvoice($invoiceId, [\n" " 'email' => 'info@example.com',\n" " 'url' => 'https://example.com',\n" " 'vendorVat' => 'BE123456789',\n" -"]);\n" +"], 'my-invoice');" msgstr "" -#: docs/10.x/billing.md:block 567 (paragraph) +# P +#: ./docs/8.x/billing.md:1589 +#: ./docs/9.x/billing.md:1768 +#: ./docs/10.x/billing.md:1951 +#: ./docs/11.x/billing.md:1931 +#: ./docs/master/billing.md:1934 msgid "The `downloadInvoice` method also allows for a custom filename via its third argument. This filename will automatically be suffixed with `.pdf`:" msgstr "" -#: docs/10.x/billing.md:block 568 (code) -msgid "return $request->user()->downloadInvoice($invoiceId, [], 'my-invoice');\n" -msgstr "" - -#: docs/10.x/billing.md:block 570 (header) +# CODE +#: ./docs/8.x/billing.md:1591 +#: ./docs/9.x/billing.md:1770 +#: ./docs/10.x/billing.md:1953 +#: ./docs/11.x/billing.md:1933 +#: ./docs/master/billing.md:1936 +msgid "return $request->user()->downloadInvoice($invoiceId, [], 'my-invoice');" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1593 +#: ./docs/9.x/billing.md:1772 +#: ./docs/10.x/billing.md:1955 +#: ./docs/11.x/billing.md:1935 +#: ./docs/master/billing.md:1938 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:1594 +#: ./docs/9.x/billing.md:1773 +#: ./docs/10.x/billing.md:1956 +#: ./docs/11.x/billing.md:1936 +#: ./docs/master/billing.md:1939 msgid "Custom Invoice Renderer" msgstr "" -#: docs/10.x/billing.md:block 571 (paragraph) +# P +#: ./docs/8.x/billing.md:1596 +#: ./docs/9.x/billing.md:1775 +#: ./docs/10.x/billing.md:1958 +#: ./docs/11.x/billing.md:1938 +#: ./docs/master/billing.md:1941 msgid "Cashier also makes it possible to use a custom invoice renderer. By default, Cashier uses the `DompdfInvoiceRenderer` implementation, which utilizes the [dompdf](https://github.com/dompdf/dompdf) PHP library to generate Cashier's invoices. However, you may use any renderer you wish by implementing the `Laravel\\Cashier\\Contracts\\InvoiceRenderer` interface. For example, you may wish to render an invoice PDF using an API call to a third-party PDF rendering service:" msgstr "" -#: docs/10.x/billing.md:block 572 (code) +# CODE +#: ./docs/8.x/billing.md:1598 +#: ./docs/9.x/billing.md:1777 msgid "use Illuminate\\Support\\Facades\\Http;\n" "use Laravel\\Cashier\\Contracts\\InvoiceRenderer;\n" "use Laravel\\Cashier\\Invoice;\n\n" @@ -2718,153 +7025,498 @@ msgid "use Illuminate\\Support\\Facades\\Http;\n" "{\n" " /**\n" " * Render the given invoice and return the raw PDF bytes.\n" +" *\n" +" * @param \\Laravel\\Cashier\\Invoice. $invoice\n" +" * @param array $data\n" +" * @param array $options\n" +" * @return string\n" " */\n" " public function render(Invoice $invoice, array $data = [], array $options = []): string\n" " {\n" " $html = $invoice->view($data)->render();\n\n" " return Http::get('https://example.com/html-to-pdf', ['html' => $html])->get()->body();\n" " }\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1608 +#: ./docs/10.x/billing.md:1791 +#: ./docs/11.x/billing.md:1771 +#: ./docs/master/billing.md:1774 +msgid "The `charge` method accepts the payment amount in the lowest denominator of the currency used by your application. For example, if customers are paying in United States Dollars, amounts should be specified in pennies." +msgstr "" + +# P +#: ./docs/10.x/billing.md:1609 +#: ./docs/11.x/billing.md:1606 +#: ./docs/master/billing.md:1609 +msgid "To retrieve the user's trial ending date, you may use the `trialEndsAt` method. This method will return a Carbon date instance if a user is on a trial or `null` if they aren't. You may also pass an optional subscription type parameter if you would like to get the trial ending date for a specific subscription other than the default one:" msgstr "" -#: docs/10.x/billing.md:block 573 (paragraph) +# P +#: ./docs/8.x/billing.md:1620 +#: ./docs/9.x/billing.md:1799 +#: ./docs/10.x/billing.md:1977 +#: ./docs/11.x/billing.md:1957 +#: ./docs/master/billing.md:1960 msgid "Once you have implemented the invoice renderer contract, you should update the `cashier.invoices.renderer` configuration value in your application's `config/cashier.php` configuration file. This configuration value should be set to the class name of your custom renderer implementation." msgstr "" -#: docs/10.x/billing.md:block 575 (header) +# P +#: ./docs/8.x/billing.md:1622 +#: ./docs/9.x/billing.md:1801 +#: ./docs/10.x/billing.md:1979 +#: ./docs/11.x/billing.md:1959 +#: ./docs/master/billing.md:1962 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:1623 +#: ./docs/9.x/billing.md:1802 +#: ./docs/10.x/billing.md:1980 +#: ./docs/11.x/billing.md:1960 +#: ./docs/master/billing.md:1963 msgid "Checkout" msgstr "" -#: docs/10.x/billing.md:block 576 (paragraph) +# P +#: ./docs/8.x/billing.md:1625 +#: ./docs/9.x/billing.md:1804 +#: ./docs/10.x/billing.md:1982 +#: ./docs/11.x/billing.md:1962 +#: ./docs/master/billing.md:1965 msgid "Cashier Stripe also provides support for [Stripe Checkout](https://stripe.com/payments/checkout). Stripe Checkout takes the pain out of implementing custom pages to accept payments by providing a pre-built, hosted payment page." msgstr "" -#: docs/10.x/billing.md:block 577 (paragraph) +# P +#: ./docs/8.x/billing.md:1627 +#: ./docs/9.x/billing.md:1806 +#: ./docs/10.x/billing.md:1984 +#: ./docs/11.x/billing.md:1964 +#: ./docs/master/billing.md:1967 msgid "The following documentation contains information on how to get started using Stripe Checkout with Cashier. To learn more about Stripe Checkout, you should also consider reviewing [Stripe's own documentation on Checkout](https://stripe.com/docs/payments/checkout)." msgstr "" -#: docs/10.x/billing.md:block 579 (header) +# P +#: ./docs/9.x/billing.md:1627 +#: ./docs/10.x/billing.md:1810 +#: ./docs/11.x/billing.md:1790 +#: ./docs/master/billing.md:1793 +msgid "Similarly to `invoicePrice`, you may use the `tabPrice` method to create a one-time charge for multiple items (up to 250 items per invoice) by adding them to the customer's \"tab\" and then invoicing the customer. For example, we may invoice a customer for five shirts and two mugs:" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1629 +#: ./docs/9.x/billing.md:1808 +#: ./docs/10.x/billing.md:1986 +#: ./docs/11.x/billing.md:1966 +#: ./docs/master/billing.md:1969 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/9.x/billing.md:1629 +#: ./docs/10.x/billing.md:1812 +#: ./docs/11.x/billing.md:1792 +#: ./docs/master/billing.md:1795 +msgid "$user->tabPrice('price_tshirt', 5);\n" +"$user->tabPrice('price_mug', 2);\n" +"$user->invoice();" +msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1630 +#: ./docs/9.x/billing.md:1809 +#: ./docs/10.x/billing.md:1987 +#: ./docs/11.x/billing.md:1967 +#: ./docs/master/billing.md:1970 msgid "Product Checkouts" msgstr "" -#: docs/10.x/billing.md:block 580 (paragraph) +# P +#: ./docs/8.x/billing.md:1632 +#: ./docs/9.x/billing.md:1811 +#: ./docs/10.x/billing.md:1989 +#: ./docs/11.x/billing.md:1969 +#: ./docs/master/billing.md:1972 msgid "You may perform a checkout for an existing product that has been created within your Stripe dashboard using the `checkout` method on a billable model. The `checkout` method will initiate a new Stripe Checkout session. By default, you're required to pass a Stripe Price ID:" msgstr "" -#: docs/10.x/billing.md:block 581 (code) +# CODE +#: ./docs/8.x/billing.md:1634 +#: ./docs/9.x/billing.md:1813 +#: ./docs/10.x/billing.md:1991 +#: ./docs/11.x/billing.md:1971 +#: ./docs/master/billing.md:1974 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/product-checkout', function (Request $request) {\n" " return $request->user()->checkout('price_tshirt');\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1637 +#: ./docs/10.x/billing.md:1820 +#: ./docs/11.x/billing.md:1800 +#: ./docs/master/billing.md:1803 +msgid "Although the `invoiceFor` method is available for you to use, it is recommended that you use the `invoicePrice` and `tabPrice` methods with pre-defined prices. By doing so, you will have access to better analytics and data within your Stripe dashboard regarding your sales on a per-product basis." msgstr "" -#: docs/10.x/billing.md:block 582 (paragraph) +# P +#: ./docs/8.x/billing.md:1640 +#: ./docs/9.x/billing.md:1819 +#: ./docs/10.x/billing.md:1997 +#: ./docs/11.x/billing.md:1977 +#: ./docs/master/billing.md:1980 msgid "If needed, you may also specify a product quantity:" msgstr "" -#: docs/10.x/billing.md:block 583 (code) +# P +#: ./docs/9.x/billing.md:1640 +#: ./docs/10.x/billing.md:1823 +#: ./docs/11.x/billing.md:1803 +#: ./docs/master/billing.md:1806 +msgid "The `invoice`, `invoicePrice`, and `invoiceFor` methods will create a Stripe invoice which will retry failed billing attempts. If you do not want invoices to retry failed charges, you will need to close them using the Stripe API after the first failed charge." +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:1642 +#: ./docs/9.x/billing.md:1821 +#: ./docs/10.x/billing.md:1999 +#: ./docs/11.x/billing.md:1979 +#: ./docs/master/billing.md:1982 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/product-checkout', function (Request $request) {\n" " return $request->user()->checkout(['price_tshirt' => 15]);\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1642 +#: ./docs/10.x/billing.md:1825 +#: ./docs/11.x/billing.md:1805 +#: ./docs/master/billing.md:1808 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/billing.md:1643 +#: ./docs/10.x/billing.md:1826 +#: ./docs/11.x/billing.md:1806 +#: ./docs/master/billing.md:1809 +msgid "Creating Payment Intents" msgstr "" -#: docs/10.x/billing.md:block 584 (paragraph) +# P +#: ./docs/9.x/billing.md:1645 +#: ./docs/10.x/billing.md:1828 +#: ./docs/11.x/billing.md:1808 +#: ./docs/master/billing.md:1811 +msgid "You can create a new Stripe payment intent by invoking the `pay` method on a billable model instance. Calling this method will create a payment intent that is wrapped in a `Laravel\\Cashier\\Payment` instance:" +msgstr "" + +# CODE +#: ./docs/9.x/billing.md:1647 +#: ./docs/10.x/billing.md:1830 +#: ./docs/11.x/billing.md:1810 +#: ./docs/master/billing.md:1813 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::post('/pay', function (Request $request) {\n" +" $payment = $request->user()->pay(\n" +" $request->get('amount')\n" +" );\n\n" +" return $payment->client_secret;\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1648 +#: ./docs/9.x/billing.md:1827 +#: ./docs/10.x/billing.md:2005 +#: ./docs/11.x/billing.md:1985 +#: ./docs/master/billing.md:1988 msgid "When a customer visits this route they will be redirected to Stripe's Checkout page. By default, when a user successfully completes or cancels a purchase they will be redirected to your `home` route location, but you may specify custom callback URLs using the `success_url` and `cancel_url` options:" msgstr "" -#: docs/10.x/billing.md:block 585 (code) +# CODE +#: ./docs/8.x/billing.md:1650 +#: ./docs/9.x/billing.md:1829 +#: ./docs/10.x/billing.md:2007 +#: ./docs/11.x/billing.md:1987 +#: ./docs/master/billing.md:1990 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/product-checkout', function (Request $request) {\n" " return $request->user()->checkout(['price_tshirt' => 1], [\n" " 'success_url' => route('your-success-route'),\n" " 'cancel_url' => route('your-cancel-route'),\n" " ]);\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1657 +#: ./docs/10.x/billing.md:1840 +#: ./docs/11.x/billing.md:1820 +#: ./docs/master/billing.md:1823 +msgid "After creating the payment intent, you can return the client secret to your application's frontend so that the user can complete the payment in their browser. To read more about building entire payment flows using Stripe payment intents, please consult the [Stripe documentation](https://stripe.com/docs/payments/accept-a-payment?platform=web)." msgstr "" -#: docs/10.x/billing.md:block 586 (paragraph) +# P +#: ./docs/8.x/billing.md:1659 +#: ./docs/9.x/billing.md:1838 +#: ./docs/10.x/billing.md:2016 +#: ./docs/11.x/billing.md:1996 +#: ./docs/master/billing.md:1999 msgid "When defining your `success_url` checkout option, you may instruct Stripe to add the checkout session ID as a query string parameter when invoking your URL. To do so, add the literal string `{CHECKOUT_SESSION_ID}` to your `success_url` query string. Stripe will replace this placeholder with the actual checkout session ID:" msgstr "" -#: docs/10.x/billing.md:block 587 (code) +# P +#: ./docs/9.x/billing.md:1659 +#: ./docs/10.x/billing.md:1842 +#: ./docs/11.x/billing.md:1822 +#: ./docs/master/billing.md:1825 +msgid "When using the `pay` method, the default payment methods that are enabled within your Stripe dashboard will be available to the customer. Alternatively, if you only want to allow for some specific payment methods to be used, you may use the `payWith` method:" +msgstr "" + +# CODE +#: ./docs/8.x/billing.md:1661 msgid "use Illuminate\\Http\\Request;\n" "use Stripe\\Checkout\\Session;\n" "use Stripe\\Customer;\n\n" "Route::get('/product-checkout', function (Request $request) {\n" " return $request->user()->checkout(['price_tshirt' => 1], [\n" -" 'success_url' => route('checkout-success').'?session_id={CHECKOUT_SESSION_ID}',\n" +" 'success_url' => route('checkout-success') . '?session_id={CHECKOUT_SESSION_ID}',\n" " 'cancel_url' => route('checkout-cancel'),\n" " ]);\n" "});\n\n" "Route::get('/checkout-success', function (Request $request) {\n" " $checkoutSession = $request->user()->stripe()->checkout->sessions->retrieve($request->get('session_id'));\n\n" " return view('checkout.success', ['checkoutSession' => $checkoutSession]);\n" -"})->name('checkout-success');\n" +"})->name('checkout-success');" msgstr "" -#: docs/10.x/billing.md:block 589 (header) +# CODE +#: ./docs/9.x/billing.md:1661 +#: ./docs/10.x/billing.md:1844 +#: ./docs/11.x/billing.md:1824 +#: ./docs/master/billing.md:1827 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::post('/pay', function (Request $request) {\n" +" $payment = $request->user()->payWith(\n" +" $request->get('amount'), ['card', 'bancontact']\n" +" );\n\n" +" return $payment->client_secret;\n" +"});" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1672 +#: ./docs/10.x/billing.md:1855 +#: ./docs/11.x/billing.md:1835 +#: ./docs/master/billing.md:1838 +msgid "The `pay` and `payWith` methods accept the payment amount in the lowest denominator of the currency used by your application. For example, if customers are paying in United States Dollars, amounts should be specified in pennies." +msgstr "" + +# P +#: ./docs/8.x/billing.md:1678 +#: ./docs/9.x/billing.md:1857 +#: ./docs/10.x/billing.md:2035 +#: ./docs/11.x/billing.md:2015 +#: ./docs/master/billing.md:2018 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:1679 +#: ./docs/9.x/billing.md:1858 +#: ./docs/10.x/billing.md:2036 +#: ./docs/11.x/billing.md:2016 +#: ./docs/master/billing.md:2019 msgid "Promotion Codes" msgstr "" -#: docs/10.x/billing.md:block 590 (paragraph) +# P +#: ./docs/8.x/billing.md:1681 +#: ./docs/9.x/billing.md:1860 +#: ./docs/10.x/billing.md:2038 +#: ./docs/11.x/billing.md:2018 +#: ./docs/master/billing.md:2021 msgid "By default, Stripe Checkout does not allow [user redeemable promotion codes](https://stripe.com/docs/billing/subscriptions/discounts/codes). Luckily, there's an easy way to enable these for your Checkout page. To do so, you may invoke the `allowPromotionCodes` method:" msgstr "" -#: docs/10.x/billing.md:block 591 (code) +# CODE +#: ./docs/8.x/billing.md:1683 +#: ./docs/9.x/billing.md:1862 +#: ./docs/10.x/billing.md:2040 +#: ./docs/11.x/billing.md:2020 +#: ./docs/master/billing.md:2023 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/product-checkout', function (Request $request) {\n" " return $request->user()\n" " ->allowPromotionCodes()\n" " ->checkout('price_tshirt');\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/11.x/billing.md:1688 +#: ./docs/master/billing.md:1691 +msgid "Since Stripe webhooks need to bypass Laravel's [CSRF protection](/docs/{{version}}/csrf), you should ensure that Laravel does not attempt to validate the CSRF token for incoming Stripe webhooks. To accomplish this, you should exclude `stripe/*` from CSRF protection in your application's `bootstrap/app.php` file:" +msgstr "" + +# H4 +#: ./docs/10.x/billing.md:1689 +#: ./docs/11.x/billing.md:1686 +#: ./docs/master/billing.md:1689 +msgid "Webhooks and CSRF Protection" msgstr "" -#: docs/10.x/billing.md:block 593 (header) +# CODE +#: ./docs/11.x/billing.md:1690 +#: ./docs/master/billing.md:1693 +msgid "->withMiddleware(function (Middleware $middleware) {\n" +" $middleware->validateCsrfTokens(except: [\n" +" 'stripe/*',\n" +" ]);\n" +"})" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1691 +#: ./docs/9.x/billing.md:1870 +#: ./docs/10.x/billing.md:2048 +#: ./docs/11.x/billing.md:2028 +#: ./docs/master/billing.md:2031 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1692 +#: ./docs/9.x/billing.md:1871 +#: ./docs/10.x/billing.md:2049 +#: ./docs/11.x/billing.md:2029 +#: ./docs/master/billing.md:2032 msgid "Single Charge Checkouts" msgstr "" -#: docs/10.x/billing.md:block 594 (paragraph) +# P +#: ./docs/8.x/billing.md:1694 +#: ./docs/9.x/billing.md:1873 +#: ./docs/10.x/billing.md:2051 +#: ./docs/11.x/billing.md:2031 +#: ./docs/master/billing.md:2034 msgid "You can also perform a simple charge for an ad-hoc product that has not been created in your Stripe dashboard. To do so you may use the `checkoutCharge` method on a billable model and pass it a chargeable amount, a product name, and an optional quantity. When a customer visits this route they will be redirected to Stripe's Checkout page:" msgstr "" -#: docs/10.x/billing.md:block 595 (code) +# CODE +#: ./docs/8.x/billing.md:1696 +#: ./docs/9.x/billing.md:1875 +#: ./docs/10.x/billing.md:2053 +#: ./docs/11.x/billing.md:2033 +#: ./docs/master/billing.md:2036 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/charge-checkout', function (Request $request) {\n" " return $request->user()->checkoutCharge(1200, 'T-Shirt', 5);\n" -"});\n" -msgstr "" - -#: docs/10.x/billing.md:block 596 (quote) -msgid "**Warning** When using the `checkoutCharge` method, Stripe will always create a new product and price in your Stripe dashboard. Therefore, we recommend that you create the products up front in your Stripe dashboard and use the `checkout` method instead." +"});" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1702 +#: ./docs/9.x/billing.md:1882 +#: ./docs/10.x/billing.md:2060 +#: ./docs/11.x/billing.md:2040 +#: ./docs/master/billing.md:2043 +msgid "When using the `checkoutCharge` method, Stripe will always create a new product and price in your Stripe dashboard. Therefore, we recommend that you create the products up front in your Stripe dashboard and use the `checkout` method instead." +msgstr "" + +# P +#: ./docs/8.x/billing.md:1704 +#: ./docs/9.x/billing.md:1884 +#: ./docs/10.x/billing.md:2062 +#: ./docs/11.x/billing.md:2042 +#: ./docs/master/billing.md:2045 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1705 +#: ./docs/9.x/billing.md:1885 +#: ./docs/10.x/billing.md:2063 +#: ./docs/11.x/billing.md:2043 +#: ./docs/master/billing.md:2046 +msgid "Subscription Checkouts" msgstr "" -#: docs/10.x/billing.md:block 598 (header) -msgid "Subscription Checkouts" +# CODE +#: ./docs/10.x/billing.md:1707 +#: ./docs/11.x/billing.md:1706 +#: ./docs/master/billing.md:1709 +msgid "payload['type'] === 'invoice.payment_succeeded') {\n" +" // Handle the incoming event...\n" +" }\n" +" }\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 599 (quote) -msgid "**Warning** Using Stripe Checkout for subscriptions requires you to enable the `customer.subscription.created` webhook in your Stripe dashboard. This webhook will create the subscription record in your database and store all of the relevant subscription items." +# P +#: ./docs/8.x/billing.md:1707 +#: ./docs/9.x/billing.md:1888 +#: ./docs/10.x/billing.md:2066 +#: ./docs/11.x/billing.md:2046 +#: ./docs/master/billing.md:2049 +msgid "Using Stripe Checkout for subscriptions requires you to enable the `customer.subscription.created` webhook in your Stripe dashboard. This webhook will create the subscription record in your database and store all of the relevant subscription items." msgstr "" -#: docs/10.x/billing.md:block 600 (paragraph) +# P +#: ./docs/8.x/billing.md:1709 +#: ./docs/9.x/billing.md:1890 +#: ./docs/10.x/billing.md:2068 +#: ./docs/11.x/billing.md:2048 +#: ./docs/master/billing.md:2051 msgid "You may also use Stripe Checkout to initiate subscriptions. After defining your subscription with Cashier's subscription builder methods, you may call the `checkout `method. When a customer visits this route they will be redirected to Stripe's Checkout page:" msgstr "" -#: docs/10.x/billing.md:block 601 (code) +# CODE +#: ./docs/8.x/billing.md:1711 +#: ./docs/9.x/billing.md:1892 +#: ./docs/10.x/billing.md:2070 +#: ./docs/11.x/billing.md:2050 +#: ./docs/master/billing.md:2053 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/subscription-checkout', function (Request $request) {\n" " return $request->user()\n" " ->newSubscription('default', 'price_monthly')\n" " ->checkout();\n" -"});\n" +"});" msgstr "" -#: docs/10.x/billing.md:block 602 (paragraph) +# P +#: ./docs/8.x/billing.md:1719 +#: ./docs/9.x/billing.md:1900 +#: ./docs/10.x/billing.md:2078 +#: ./docs/11.x/billing.md:2058 +#: ./docs/master/billing.md:2061 msgid "Just as with product checkouts, you may customize the success and cancellation URLs:" msgstr "" -#: docs/10.x/billing.md:block 603 (code) +# CODE +#: ./docs/8.x/billing.md:1721 +#: ./docs/9.x/billing.md:1902 +#: ./docs/10.x/billing.md:2080 +#: ./docs/11.x/billing.md:2060 +#: ./docs/master/billing.md:2063 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/subscription-checkout', function (Request $request) {\n" " return $request->user()\n" @@ -2873,126 +7525,271 @@ msgid "use Illuminate\\Http\\Request;\n\n" " 'success_url' => route('your-success-route'),\n" " 'cancel_url' => route('your-cancel-route'),\n" " ]);\n" -"});\n" +"});" msgstr "" -#: docs/10.x/billing.md:block 604 (paragraph) +# P +#: ./docs/9.x/billing.md:1723 +#: ./docs/10.x/billing.md:1906 +#: ./docs/11.x/billing.md:1886 +#: ./docs/master/billing.md:1889 +msgid "Similarly, if the customer has multiple subscriptions, you can also retrieve the upcoming invoice for a specific subscription:" +msgstr "" + +# H3 +#: ./docs/9.x/billing.md:1728 +#: ./docs/10.x/billing.md:1911 +#: ./docs/11.x/billing.md:1891 +#: ./docs/master/billing.md:1894 +msgid "Previewing Subscription Invoices" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1732 +#: ./docs/9.x/billing.md:1913 +#: ./docs/10.x/billing.md:2091 +#: ./docs/11.x/billing.md:2071 +#: ./docs/master/billing.md:2074 msgid "Of course, you can also enable promotion codes for subscription checkouts:" msgstr "" -#: docs/10.x/billing.md:block 605 (code) +# CODE +#: ./docs/8.x/billing.md:1734 +#: ./docs/9.x/billing.md:1915 +#: ./docs/10.x/billing.md:2093 +#: ./docs/11.x/billing.md:2073 +#: ./docs/master/billing.md:2076 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/subscription-checkout', function (Request $request) {\n" " return $request->user()\n" " ->newSubscription('default', 'price_monthly')\n" " ->allowPromotionCodes()\n" " ->checkout();\n" -"});\n" +"});" msgstr "" -#: docs/10.x/billing.md:block 606 (quote) -msgid "**Warning** Unfortunately Stripe Checkout does not support all subscription billing options when starting subscriptions. Using the `anchorBillingCycleOn` method on the subscription builder, setting proration behavior, or setting payment behavior will not have any effect during Stripe Checkout sessions. Please consult [the Stripe Checkout Session API documentation](https://stripe.com/docs/api/checkout/sessions/create) to review which parameters are available." +# P +#: ./docs/9.x/billing.md:1741 +#: ./docs/10.x/billing.md:1924 +#: ./docs/11.x/billing.md:1904 +#: ./docs/master/billing.md:1907 +msgid "Before generating invoice PDFs, you should use Composer to install the Dompdf library, which is the default invoice renderer for Cashier:" msgstr "" -#: docs/10.x/billing.md:block 608 (header) -msgid "Stripe Checkout & Trial Periods" +# P +#: ./docs/8.x/billing.md:1743 +#: ./docs/9.x/billing.md:1925 +#: ./docs/10.x/billing.md:2103 +#: ./docs/11.x/billing.md:2083 +#: ./docs/master/billing.md:2086 +msgid "Unfortunately Stripe Checkout does not support all subscription billing options when starting subscriptions. Using the `anchorBillingCycleOn` method on the subscription builder, setting proration behavior, or setting payment behavior will not have any effect during Stripe Checkout sessions. Please consult [the Stripe Checkout Session API documentation](https://stripe.com/docs/api/checkout/sessions/create) to review which parameters are available." msgstr "" -#: docs/10.x/billing.md:block 609 (paragraph) -msgid "Of course, you can define a trial period when building a subscription that will be completed using Stripe Checkout:" +# CODE: php +#: ./docs/9.x/billing.md:1743 +#: ./docs/10.x/billing.md:1926 +#: ./docs/11.x/billing.md:1906 +#: ./docs/master/billing.md:1909 +msgid "composer require dompdf/dompdf" msgstr "" -#: docs/10.x/billing.md:block 610 (code) -msgid "$checkout = Auth::user()->newSubscription('default', 'price_monthly')\n" -" ->trialDays(3)\n" -" ->checkout();\n" -msgstr "" +# P +#: ./docs/8.x/billing.md:1745 +#: ./docs/9.x/billing.md:1927 +#: ./docs/10.x/billing.md:2105 +#: ./docs/11.x/billing.md:2085 +#: ./docs/master/billing.md:2088 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/billing.md:block 611 (paragraph) -msgid "However, the trial period must be at least 48 hours, which is the minimum amount of trial time supported by Stripe Checkout." +# H4 +#: ./docs/8.x/billing.md:1746 +#: ./docs/9.x/billing.md:1928 +msgid "Stripe Checkout & Trial Periods" msgstr "" -#: docs/10.x/billing.md:block 613 (header) -msgid "Subscriptions & Webhooks" +# P +#: ./docs/8.x/billing.md:1748 +#: ./docs/9.x/billing.md:1930 +#: ./docs/10.x/billing.md:2108 +#: ./docs/11.x/billing.md:2088 +#: ./docs/master/billing.md:2091 +msgid "Of course, you can define a trial period when building a subscription that will be completed using Stripe Checkout:" msgstr "" -#: docs/10.x/billing.md:block 614 (paragraph) -msgid "Remember, Stripe and Cashier update subscription statuses via webhooks, so there's a possibility a subscription might not yet be active when the customer returns to the application after entering their payment information. To handle this scenario, you may wish to display a message informing the user that their payment or subscription is pending." +# CODE +#: ./docs/9.x/billing.md:1749 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/user/invoice/{invoice}', function (Request $request, $invoiceId) {\n" +" return $request->user()->downloadInvoice($invoiceId);\n" +"});" msgstr "" -#: docs/10.x/billing.md:block 616 (header) -msgid "Collecting Tax IDs" +# CODE +#: ./docs/8.x/billing.md:1750 +#: ./docs/9.x/billing.md:1932 +#: ./docs/10.x/billing.md:2110 +#: ./docs/11.x/billing.md:2090 +#: ./docs/master/billing.md:2093 +msgid "$checkout = Auth::user()->newSubscription('default', 'price_monthly')\n" +" ->trialDays(3)\n" +" ->checkout();" msgstr "" -#: docs/10.x/billing.md:block 617 (paragraph) -msgid "Checkout also supports collecting a customer's Tax ID. To enable this on a checkout session, invoke the `collectTaxIds` method when creating the session:" +# P +#: ./docs/8.x/billing.md:1754 +#: ./docs/9.x/billing.md:1936 +#: ./docs/10.x/billing.md:2114 +#: ./docs/11.x/billing.md:2094 +#: ./docs/master/billing.md:2097 +msgid "However, the trial period must be at least 48 hours, which is the minimum amount of trial time supported by Stripe Checkout." msgstr "" -#: docs/10.x/billing.md:block 618 (code) -msgid "$checkout = $user->collectTaxIds()->checkout('price_tshirt');\n" +# P +#: ./docs/9.x/billing.md:1755 +#: ./docs/10.x/billing.md:1938 +#: ./docs/11.x/billing.md:1918 +#: ./docs/master/billing.md:1921 +msgid "By default, all data on the invoice is derived from the customer and invoice data stored in Stripe. The filename is based on your `app.name` config value. However, you can customize some of this data by providing an array as the second argument to the `downloadInvoice` method. This array allows you to customize information such as your company and product details:" msgstr "" -#: docs/10.x/billing.md:block 619 (paragraph) -msgid "When this method is invoked, a new checkbox will be available to the customer that allows them to indicate if they're purchasing as a company. If so, they will have the opportunity to provide their Tax ID number." -msgstr "" +# P +#: ./docs/8.x/billing.md:1756 +#: ./docs/9.x/billing.md:1938 +#: ./docs/10.x/billing.md:2116 +#: ./docs/11.x/billing.md:2096 +#: ./docs/master/billing.md:2099 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/billing.md:block 620 (quote) -msgid "**Warning** If you have already configured [automatic tax collection](#tax-configuration) in your application's service provider then this feature will be enabled automatically and there is no need to invoke the `collectTaxIds` method." +# H4 +#: ./docs/8.x/billing.md:1757 +#: ./docs/9.x/billing.md:1939 +msgid "Subscriptions & Webhooks" msgstr "" -#: docs/10.x/billing.md:block 622 (header) -msgid "Guest Checkouts" +# CODE +#: ./docs/9.x/billing.md:1757 +#: ./docs/10.x/billing.md:1940 +#: ./docs/11.x/billing.md:1920 +#: ./docs/master/billing.md:1923 +msgid "return $request->user()->downloadInvoice($invoiceId, [\n" +" 'vendor' => 'Your Company',\n" +" 'product' => 'Your Product',\n" +" 'street' => 'Main Str. 1',\n" +" 'location' => '2000 Antwerp, Belgium',\n" +" 'phone' => '+32 499 00 00 00',\n" +" 'email' => 'info@example.com',\n" +" 'url' => 'https://example.com',\n" +" 'vendorVat' => 'BE123456789',\n" +"]);" msgstr "" -#: docs/10.x/billing.md:block 623 (paragraph) -msgid "Using the `Checkout::guest` method, you may initiate checkout sessions for guests of your application that do not have an \"account\":" +# P +#: ./docs/8.x/billing.md:1759 +#: ./docs/9.x/billing.md:1941 +#: ./docs/10.x/billing.md:2119 +#: ./docs/11.x/billing.md:2099 +#: ./docs/master/billing.md:2102 +msgid "Remember, Stripe and Cashier update subscription statuses via webhooks, so there's a possibility a subscription might not yet be active when the customer returns to the application after entering their payment information. To handle this scenario, you may wish to display a message informing the user that their payment or subscription is pending." msgstr "" -#: docs/10.x/billing.md:block 624 (code) -msgid "use Illuminate\\Http\\Request;\n" -"use Laravel\\Cashier\\Checkout;\n\n" -"Route::get('/product-checkout', function (Request $request) {\n" -" return Checkout::guest()->create('price_tshirt', [\n" -" 'success_url' => route('your-success-route'),\n" -" 'cancel_url' => route('your-cancel-route'),\n" -" ]);\n" -"});\n" +# P +#: ./docs/8.x/billing.md:1761 +#: ./docs/9.x/billing.md:1943 +#: ./docs/10.x/billing.md:2121 +#: ./docs/11.x/billing.md:2101 +#: ./docs/master/billing.md:2104 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1762 +#: ./docs/9.x/billing.md:1944 +#: ./docs/10.x/billing.md:2122 +#: ./docs/11.x/billing.md:2102 +#: ./docs/master/billing.md:2105 +msgid "Collecting Tax IDs" msgstr "" -#: docs/10.x/billing.md:block 625 (paragraph) -msgid "Similarly to when creating checkout sessions for existing users, you may utilize additional methods available on the `Laravel\\Cashier\\CheckoutBuilder` instance to customize the guest checkout session:" +# P +#: ./docs/8.x/billing.md:1764 +#: ./docs/9.x/billing.md:1946 +#: ./docs/10.x/billing.md:2124 +#: ./docs/11.x/billing.md:2104 +#: ./docs/master/billing.md:2107 +msgid "Checkout also supports collecting a customer's Tax ID. To enable this on a checkout session, invoke the `collectTaxIds` method when creating the session:" msgstr "" -#: docs/10.x/billing.md:block 626 (code) -msgid "use Illuminate\\Http\\Request;\n" -"use Laravel\\Cashier\\Checkout;\n\n" -"Route::get('/product-checkout', function (Request $request) {\n" -" return Checkout::guest()\n" -" ->withPromotionCode('promo-code')\n" -" ->create('price_tshirt', [\n" -" 'success_url' => route('your-success-route'),\n" -" 'cancel_url' => route('your-cancel-route'),\n" -" ]);\n" -"});\n" +# CODE +#: ./docs/8.x/billing.md:1766 +#: ./docs/9.x/billing.md:1948 +#: ./docs/10.x/billing.md:2126 +#: ./docs/11.x/billing.md:2106 +#: ./docs/master/billing.md:2109 +msgid "$checkout = $user->collectTaxIds()->checkout('price_tshirt');" msgstr "" -#: docs/10.x/billing.md:block 627 (paragraph) -msgid "After a guest checkout has been completed, Stripe can dispatch a `checkout.session.completed` webhook event, so make sure to [configure your Stripe webhook](https://dashboard.stripe.com/webhooks) to actually send this event to your application. Once the webhook has been enabled within the Stripe dashboard, you may [handle the webhook with Cashier](#handling-stripe-webhooks). The object contained in the webhook payload will be a [`checkout` object](https://stripe.com/docs/api/checkout/sessions/object) that you may inspect in order to fulfill your customer's order." +# P +#: ./docs/8.x/billing.md:1768 +#: ./docs/9.x/billing.md:1950 +#: ./docs/10.x/billing.md:2128 +#: ./docs/11.x/billing.md:2108 +#: ./docs/master/billing.md:2111 +msgid "When this method is invoked, a new checkbox will be available to the customer that allows them to indicate if they're purchasing as a company. If so, they will have the opportunity to provide their Tax ID number." msgstr "" -#: docs/10.x/billing.md:block 629 (header) +# P +#: ./docs/8.x/billing.md:1770 +#: ./docs/9.x/billing.md:1953 +#: ./docs/10.x/billing.md:2131 +#: ./docs/11.x/billing.md:2111 +#: ./docs/master/billing.md:2114 +msgid "If you have already configured [automatic tax collection](#tax-configuration) in your application's service provider then this feature will be enabled automatically and there is no need to invoke the `collectTaxIds` method." +msgstr "" + +# P +#: ./docs/8.x/billing.md:1772 +#: ./docs/9.x/billing.md:1986 +#: ./docs/10.x/billing.md:2164 +#: ./docs/11.x/billing.md:2144 +#: ./docs/master/billing.md:2147 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:1773 +#: ./docs/9.x/billing.md:1987 +#: ./docs/10.x/billing.md:2165 +#: ./docs/11.x/billing.md:2145 +#: ./docs/master/billing.md:2148 msgid "Handling Failed Payments" msgstr "" -#: docs/10.x/billing.md:block 630 (paragraph) +# P +#: ./docs/8.x/billing.md:1775 +#: ./docs/9.x/billing.md:1989 +#: ./docs/10.x/billing.md:2167 +#: ./docs/11.x/billing.md:2147 +#: ./docs/master/billing.md:2150 msgid "Sometimes, payments for subscriptions or single charges can fail. When this happens, Cashier will throw an `Laravel\\Cashier\\Exceptions\\IncompletePayment` exception that informs you that this happened. After catching this exception, you have two options on how to proceed." msgstr "" -#: docs/10.x/billing.md:block 631 (paragraph) +# P +#: ./docs/8.x/billing.md:1777 +#: ./docs/9.x/billing.md:1991 +#: ./docs/10.x/billing.md:2169 +#: ./docs/11.x/billing.md:2149 +#: ./docs/master/billing.md:2152 msgid "First, you could redirect your customer to the dedicated payment confirmation page which is included with Cashier. This page already has an associated named route that is registered via Cashier's service provider. So, you may catch the `IncompletePayment` exception and redirect the user to the payment confirmation page:" msgstr "" -#: docs/10.x/billing.md:block 632 (code) +# CODE +#: ./docs/8.x/billing.md:1779 +#: ./docs/9.x/billing.md:1993 +#: ./docs/10.x/billing.md:2171 +#: ./docs/11.x/billing.md:2151 +#: ./docs/master/billing.md:2154 msgid "use Laravel\\Cashier\\Exceptions\\IncompletePayment;\n\n" "try {\n" " $subscription = $user->newSubscription('default', 'price_monthly')\n" @@ -3002,62 +7799,150 @@ msgid "use Laravel\\Cashier\\Exceptions\\IncompletePayment;\n\n" " 'cashier.payment',\n" " [$exception->payment->id, 'redirect' => route('home')]\n" " );\n" -"}\n" +"}" msgstr "" -#: docs/10.x/billing.md:block 633 (paragraph) -msgid "On the payment confirmation page, the customer will be prompted to enter their credit card information again and perform any additional actions required by Stripe, such as \"3D Secure\" confirmation. After confirming their payment, the user will be redirected to the URL provided by the `redirect` parameter specified above. Upon redirection, `message` (string) and `success` (integer) query string variables will be added to the URL. The payment page currently supports the following payment method types:" -msgstr "" +# CODE +#: ./docs/10.x/billing.md:1784 +#: ./docs/11.x/billing.md:1764 +#: ./docs/master/billing.md:1767 +msgid "try {\n" +" $payment = $user->charge(100, $paymentMethod);\n" +"} catch (Exception $e) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1791 +#: ./docs/9.x/billing.md:2005 +#: ./docs/10.x/billing.md:2183 +#: ./docs/11.x/billing.md:2163 +#: ./docs/master/billing.md:2166 +msgid "On the payment confirmation page, the customer will be prompted to enter their credit card information again and perform any additional actions required by Stripe, such as \"3D Secure\" confirmation. After confirming their payment, the user will be redirected to the URL provided by the `redirect` parameter specified above. Upon redirection, `message` (string) and `success` (integer) query string variables will be added to the URL. The payment page currently supports the following payment method types:" +msgstr "" -#: docs/10.x/billing.md:block 635 (unordered list) +# P +#: ./docs/8.x/billing.md:1795 +#: ./docs/9.x/billing.md:2009 +#: ./docs/10.x/billing.md:2187 +#: ./docs/11.x/billing.md:2167 +#: ./docs/master/billing.md:2170 msgid "Credit Cards" msgstr "" -#: docs/10.x/billing.md:block 635 (unordered list) +# P +#: ./docs/10.x/billing.md:1796 +#: ./docs/11.x/billing.md:1776 +#: ./docs/master/billing.md:1779 +msgid "Sometimes you may need to make a one-time charge and offer a PDF invoice to your customer. The `invoicePrice` method lets you do just that. For example, let's invoice a customer for five new shirts:" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1796 +#: ./docs/9.x/billing.md:2010 +#: ./docs/10.x/billing.md:2188 +#: ./docs/11.x/billing.md:2168 +#: ./docs/master/billing.md:2171 msgid "Alipay" msgstr "" -#: docs/10.x/billing.md:block 635 (unordered list) +# P +#: ./docs/8.x/billing.md:1797 +#: ./docs/9.x/billing.md:2011 +#: ./docs/10.x/billing.md:2189 +#: ./docs/11.x/billing.md:2169 +#: ./docs/master/billing.md:2172 msgid "Bancontact" msgstr "" -#: docs/10.x/billing.md:block 635 (unordered list) +# P +#: ./docs/8.x/billing.md:1798 +#: ./docs/9.x/billing.md:2012 +#: ./docs/10.x/billing.md:2190 +#: ./docs/11.x/billing.md:2170 +#: ./docs/master/billing.md:2173 msgid "BECS Direct Debit" msgstr "" -#: docs/10.x/billing.md:block 635 (unordered list) +# P +#: ./docs/8.x/billing.md:1799 +#: ./docs/9.x/billing.md:2013 +#: ./docs/10.x/billing.md:2191 +#: ./docs/11.x/billing.md:2171 +#: ./docs/master/billing.md:2174 msgid "EPS" msgstr "" -#: docs/10.x/billing.md:block 635 (unordered list) +# P +#: ./docs/8.x/billing.md:1800 +#: ./docs/9.x/billing.md:2014 +#: ./docs/10.x/billing.md:2192 +#: ./docs/11.x/billing.md:2172 +#: ./docs/master/billing.md:2175 msgid "Giropay" msgstr "" -#: docs/10.x/billing.md:block 635 (unordered list) +# P +#: ./docs/8.x/billing.md:1801 +#: ./docs/9.x/billing.md:2015 +#: ./docs/10.x/billing.md:2193 +#: ./docs/11.x/billing.md:2173 +#: ./docs/master/billing.md:2176 msgid "iDEAL" msgstr "" -#: docs/10.x/billing.md:block 635 (unordered list) +# P +#: ./docs/8.x/billing.md:1802 +#: ./docs/9.x/billing.md:2016 +#: ./docs/10.x/billing.md:2194 +#: ./docs/11.x/billing.md:2174 +#: ./docs/master/billing.md:2177 msgid "SEPA Direct Debit" msgstr "" -#: docs/10.x/billing.md:block 637 (paragraph) +# P +#: ./docs/8.x/billing.md:1806 +#: ./docs/9.x/billing.md:2020 +#: ./docs/10.x/billing.md:2198 +#: ./docs/11.x/billing.md:2178 +#: ./docs/master/billing.md:2181 msgid "Alternatively, you could allow Stripe to handle the payment confirmation for you. In this case, instead of redirecting to the payment confirmation page, you may [setup Stripe's automatic billing emails](https://dashboard.stripe.com/account/billing/automatic) in your Stripe dashboard. However, if an `IncompletePayment` exception is caught, you should still inform the user they will receive an email with further payment confirmation instructions." msgstr "" -#: docs/10.x/billing.md:block 638 (paragraph) +# P +#: ./docs/8.x/billing.md:1808 +#: ./docs/9.x/billing.md:2022 +#: ./docs/10.x/billing.md:2200 +#: ./docs/11.x/billing.md:2180 +#: ./docs/master/billing.md:2183 msgid "Payment exceptions may be thrown for the following methods: `charge`, `invoiceFor`, and `invoice` on models using the `Billable` trait. When interacting with subscriptions, the `create` method on the `SubscriptionBuilder`, and the `incrementAndInvoice` and `swapAndInvoice` methods on the `Subscription` and `SubscriptionItem` models may throw incomplete payment exceptions." msgstr "" -#: docs/10.x/billing.md:block 639 (paragraph) +# P +#: ./docs/8.x/billing.md:1810 +#: ./docs/9.x/billing.md:2024 +#: ./docs/10.x/billing.md:2202 +#: ./docs/11.x/billing.md:2182 +#: ./docs/master/billing.md:2185 msgid "Determining if an existing subscription has an incomplete payment may be accomplished using the `hasIncompletePayment` method on the billable model or a subscription instance:" msgstr "" -#: docs/10.x/billing.md:block 641 (paragraph) +# P +#: ./docs/8.x/billing.md:1820 +#: ./docs/9.x/billing.md:2034 +#: ./docs/10.x/billing.md:2212 +#: ./docs/11.x/billing.md:2192 +#: ./docs/master/billing.md:2195 msgid "You can derive the specific status of an incomplete payment by inspecting the `payment` property on the exception instance:" msgstr "" -#: docs/10.x/billing.md:block 642 (code) +# CODE +#: ./docs/8.x/billing.md:1822 +#: ./docs/9.x/billing.md:2036 +#: ./docs/10.x/billing.md:2214 +#: ./docs/11.x/billing.md:2194 +#: ./docs/master/billing.md:2197 msgid "use Laravel\\Cashier\\Exceptions\\IncompletePayment;\n\n" "try {\n" " $user->charge(1000, 'pm_card_threeDSecure2Required');\n" @@ -3070,647 +7955,375 @@ msgid "use Laravel\\Cashier\\Exceptions\\IncompletePayment;\n\n" " } elseif ($exception->payment->requiresConfirmation()) {\n" " // ...\n" " }\n" -"}\n" -msgstr "" - -#: docs/10.x/billing.md:block 644 (header) -msgid "Confirming Payments" -msgstr "" - -#: docs/10.x/billing.md:block 645 (paragraph) -msgid "Some payment methods require additional data in order to confirm payments. For example, SEPA payment methods require additional \"mandate\" data during the payment process. You may provide this data to Cashier using the `withPaymentConfirmationOptions` method:" -msgstr "" - -#: docs/10.x/billing.md:block 646 (code) -msgid "$subscription->withPaymentConfirmationOptions([\n" -" 'mandate_data' => '...',\n" -"])->swap('price_xxx');\n" -msgstr "" - -#: docs/10.x/billing.md:block 647 (paragraph) -msgid "You may consult the [Stripe API documentation](https://stripe.com/docs/api/payment_intents/confirm) to review all of the options accepted when confirming payments." -msgstr "" - -#: docs/10.x/billing.md:block 649 (header) +"}" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1838 +#: ./docs/9.x/billing.md:2052 +#: ./docs/10.x/billing.md:2241 +#: ./docs/11.x/billing.md:2221 +#: ./docs/master/billing.md:2224 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:1839 +#: ./docs/9.x/billing.md:2053 +#: ./docs/10.x/billing.md:2242 +#: ./docs/11.x/billing.md:2222 +#: ./docs/master/billing.md:2225 msgid "Strong Customer Authentication" msgstr "" -#: docs/10.x/billing.md:block 650 (paragraph) -msgid "If your business or one of your customers is based in Europe you will need to abide by the EU's Strong Customer Authentication (SCA) regulations. These regulations were imposed in September 2019 by the European Union to prevent payment fraud. Luckily, Stripe and Cashier are prepared for building SCA compliant applications." +# CODE +#: ./docs/9.x/billing.md:1840 +#: ./docs/10.x/billing.md:2018 +#: ./docs/11.x/billing.md:1998 +#: ./docs/master/billing.md:2001 +msgid "use Illuminate\\Http\\Request;\n" +"use Stripe\\Checkout\\Session;\n" +"use Stripe\\Customer;\n\n" +"Route::get('/product-checkout', function (Request $request) {\n" +" return $request->user()->checkout(['price_tshirt' => 1], [\n" +" 'success_url' => route('checkout-success').'?session_id={CHECKOUT_SESSION_ID}',\n" +" 'cancel_url' => route('checkout-cancel'),\n" +" ]);\n" +"});\n\n" +"Route::get('/checkout-success', function (Request $request) {\n" +" $checkoutSession = $request->user()->stripe()->checkout->sessions->retrieve($request->get('session_id'));\n\n" +" return view('checkout.success', ['checkoutSession' => $checkoutSession]);\n" +"})->name('checkout-success');" msgstr "" -#: docs/10.x/billing.md:block 651 (quote) -msgid "**Warning** Before getting started, review [Stripe's guide on PSD2 and SCA](https://stripe.com/guides/strong-customer-authentication) as well as their [documentation on the new SCA APIs](https://stripe.com/docs/strong-customer-authentication)." +# P +#: ./docs/8.x/billing.md:1841 +#: ./docs/9.x/billing.md:2055 +#: ./docs/10.x/billing.md:2244 +#: ./docs/11.x/billing.md:2224 +#: ./docs/master/billing.md:2227 +msgid "If your business or one of your customers is based in Europe you will need to abide by the EU's Strong Customer Authentication (SCA) regulations. These regulations were imposed in September 2019 by the European Union to prevent payment fraud. Luckily, Stripe and Cashier are prepared for building SCA compliant applications." msgstr "" -#: docs/10.x/billing.md:block 653 (header) +# P +#: ./docs/8.x/billing.md:1843 +#: ./docs/9.x/billing.md:2058 +#: ./docs/10.x/billing.md:2247 +#: ./docs/11.x/billing.md:2227 +#: ./docs/master/billing.md:2230 +msgid "Before getting started, review [Stripe's guide on PSD2 and SCA](https://stripe.com/guides/strong-customer-authentication) as well as their [documentation on the new SCA APIs](https://stripe.com/docs/strong-customer-authentication)." +msgstr "" + +# P +#: ./docs/8.x/billing.md:1845 +#: ./docs/9.x/billing.md:2060 +#: ./docs/10.x/billing.md:2249 +#: ./docs/11.x/billing.md:2229 +#: ./docs/master/billing.md:2232 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1846 +#: ./docs/9.x/billing.md:2061 +#: ./docs/10.x/billing.md:2250 +#: ./docs/11.x/billing.md:2230 +#: ./docs/master/billing.md:2233 msgid "Payments Requiring Additional Confirmation" msgstr "" -#: docs/10.x/billing.md:block 654 (paragraph) +# P +#: ./docs/8.x/billing.md:1848 +#: ./docs/9.x/billing.md:2063 +#: ./docs/10.x/billing.md:2252 +#: ./docs/11.x/billing.md:2232 +#: ./docs/master/billing.md:2235 msgid "SCA regulations often require extra verification in order to confirm and process a payment. When this happens, Cashier will throw a `Laravel\\Cashier\\Exceptions\\IncompletePayment` exception that informs you that extra verification is needed. More information on how to handle these exceptions be found can be found in the documentation on [handling failed payments](#handling-failed-payments)." msgstr "" -#: docs/10.x/billing.md:block 655 (paragraph) +# P +#: ./docs/8.x/billing.md:1850 +#: ./docs/9.x/billing.md:2065 +#: ./docs/10.x/billing.md:2254 +#: ./docs/11.x/billing.md:2234 +#: ./docs/master/billing.md:2237 msgid "Payment confirmation screens presented by Stripe or Cashier may be tailored to a specific bank or card issuer's payment flow and can include additional card confirmation, a temporary small charge, separate device authentication, or other forms of verification." msgstr "" -#: docs/10.x/billing.md:block 657 (header) +# P +#: ./docs/8.x/billing.md:1852 +#: ./docs/9.x/billing.md:2067 +#: ./docs/10.x/billing.md:2256 +#: ./docs/11.x/billing.md:2236 +#: ./docs/master/billing.md:2239 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/billing.md:1853 +#: ./docs/9.x/billing.md:2068 +#: ./docs/10.x/billing.md:2257 +#: ./docs/11.x/billing.md:2237 +#: ./docs/master/billing.md:2240 msgid "Incomplete and Past Due State" msgstr "" -#: docs/10.x/billing.md:block 658 (paragraph) +# P +#: ./docs/8.x/billing.md:1855 +#: ./docs/9.x/billing.md:2070 +#: ./docs/10.x/billing.md:2259 +#: ./docs/11.x/billing.md:2239 +#: ./docs/master/billing.md:2242 msgid "When a payment needs additional confirmation, the subscription will remain in an `incomplete` or `past_due` state as indicated by its `stripe_status` database column. Cashier will automatically activate the customer's subscription as soon as payment confirmation is complete and your application is notified by Stripe via webhook of its completion." msgstr "" -#: docs/10.x/billing.md:block 659 (paragraph) +# P +#: ./docs/8.x/billing.md:1857 +#: ./docs/9.x/billing.md:2072 +#: ./docs/10.x/billing.md:2261 +#: ./docs/11.x/billing.md:2241 +#: ./docs/master/billing.md:2244 msgid "For more information on `incomplete` and `past_due` states, please refer to [our additional documentation on these states](#incomplete-and-past-due-status)." msgstr "" -#: docs/10.x/billing.md:block 661 (header) +# P +#: ./docs/8.x/billing.md:1859 +#: ./docs/9.x/billing.md:2074 +#: ./docs/10.x/billing.md:2263 +#: ./docs/11.x/billing.md:2243 +#: ./docs/master/billing.md:2246 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/billing.md:1860 +#: ./docs/9.x/billing.md:2075 +#: ./docs/10.x/billing.md:2264 +#: ./docs/11.x/billing.md:2244 +#: ./docs/master/billing.md:2247 msgid "Off-Session Payment Notifications" msgstr "" -#: docs/10.x/billing.md:block 662 (paragraph) +# P +#: ./docs/8.x/billing.md:1862 +#: ./docs/9.x/billing.md:2077 +#: ./docs/10.x/billing.md:2266 +#: ./docs/11.x/billing.md:2246 +#: ./docs/master/billing.md:2249 msgid "Since SCA regulations require customers to occasionally verify their payment details even while their subscription is active, Cashier can send a notification to the customer when off-session payment confirmation is required. For example, this may occur when a subscription is renewing. Cashier's payment notification can be enabled by setting the `CASHIER_PAYMENT_NOTIFICATION` environment variable to a notification class. By default, this notification is disabled. Of course, Cashier includes a notification class you may use for this purpose, but you are free to provide your own notification class if desired:" msgstr "" -#: docs/10.x/billing.md:block 663 (code) -msgid "CASHIER_PAYMENT_NOTIFICATION=Laravel\\Cashier\\Notifications\\ConfirmPayment\n" +# CODE +# CODE: ini +#: ./docs/8.x/billing.md:1864 +#: ./docs/9.x/billing.md:2079 +#: ./docs/10.x/billing.md:2268 +#: ./docs/11.x/billing.md:2248 +#: ./docs/master/billing.md:2251 +msgid "CASHIER_PAYMENT_NOTIFICATION=Laravel\\Cashier\\Notifications\\ConfirmPayment" msgstr "" -#: docs/10.x/billing.md:block 664 (paragraph) +# P +#: ./docs/8.x/billing.md:1866 +#: ./docs/9.x/billing.md:2083 +#: ./docs/10.x/billing.md:2272 +#: ./docs/11.x/billing.md:2252 +#: ./docs/master/billing.md:2255 msgid "To ensure that off-session payment confirmation notifications are delivered, verify that [Stripe webhooks are configured](#handling-stripe-webhooks) for your application and the `invoice.payment_action_required` webhook is enabled in your Stripe dashboard. In addition, your `Billable` model should also use Laravel's `Illuminate\\Notifications\\Notifiable` trait." msgstr "" -#: docs/10.x/billing.md:block 665 (quote) -msgid "**Warning** Notifications will be sent even when customers are manually making a payment that requires additional confirmation. Unfortunately, there is no way for Stripe to know that the payment was done manually or \"off-session\". But, a customer will simply see a \"Payment Successful\" message if they visit the payment page after already confirming their payment. The customer will not be allowed to accidentally confirm the same payment twice and incur an accidental second charge." -msgstr "" - -#: docs/10.x/billing.md:block 667 (header) +# P +#: ./docs/8.x/billing.md:1868 +#: ./docs/9.x/billing.md:2086 +#: ./docs/10.x/billing.md:2275 +#: ./docs/11.x/billing.md:2255 +#: ./docs/master/billing.md:2258 +msgid "Notifications will be sent even when customers are manually making a payment that requires additional confirmation. Unfortunately, there is no way for Stripe to know that the payment was done manually or \"off-session\". But, a customer will simply see a \"Payment Successful\" message if they visit the payment page after already confirming their payment. The customer will not be allowed to accidentally confirm the same payment twice and incur an accidental second charge." +msgstr "" + +# P +#: ./docs/8.x/billing.md:1870 +#: ./docs/9.x/billing.md:2088 +#: ./docs/10.x/billing.md:2277 +#: ./docs/11.x/billing.md:2257 +#: ./docs/master/billing.md:2260 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:1871 +#: ./docs/9.x/billing.md:2089 +#: ./docs/10.x/billing.md:2278 +#: ./docs/11.x/billing.md:2258 +#: ./docs/master/billing.md:2261 msgid "Stripe SDK" msgstr "" -#: docs/10.x/billing.md:block 668 (paragraph) +# P +#: ./docs/8.x/billing.md:1873 +#: ./docs/9.x/billing.md:2091 +#: ./docs/10.x/billing.md:2280 +#: ./docs/11.x/billing.md:2260 +#: ./docs/master/billing.md:2263 msgid "Many of Cashier's objects are wrappers around Stripe SDK objects. If you would like to interact with the Stripe objects directly, you may conveniently retrieve them using the `asStripe` method:" msgstr "" -#: docs/10.x/billing.md:block 669 (code) +# CODE +#: ./docs/8.x/billing.md:1875 +#: ./docs/9.x/billing.md:2093 +#: ./docs/10.x/billing.md:2282 +#: ./docs/11.x/billing.md:2262 +#: ./docs/master/billing.md:2265 msgid "$stripeSubscription = $subscription->asStripeSubscription();\n\n" "$stripeSubscription->application_fee_percent = 5;\n\n" -"$stripeSubscription->save();\n" +"$stripeSubscription->save();" msgstr "" -#: docs/10.x/billing.md:block 670 (paragraph) +# P +#: ./docs/8.x/billing.md:1881 +#: ./docs/9.x/billing.md:2099 +#: ./docs/10.x/billing.md:2288 +#: ./docs/11.x/billing.md:2268 +#: ./docs/master/billing.md:2271 msgid "You may also use the `updateStripeSubscription` method to update a Stripe subscription directly:" msgstr "" -#: docs/10.x/billing.md:block 671 (code) -msgid "$subscription->updateStripeSubscription(['application_fee_percent' => 5]);\n" +# CODE +#: ./docs/8.x/billing.md:1883 +#: ./docs/9.x/billing.md:2101 +#: ./docs/10.x/billing.md:2290 +#: ./docs/11.x/billing.md:2270 +#: ./docs/master/billing.md:2273 +msgid "$subscription->updateStripeSubscription(['application_fee_percent' => 5]);" msgstr "" -#: docs/10.x/billing.md:block 672 (paragraph) +# P +#: ./docs/8.x/billing.md:1885 +#: ./docs/9.x/billing.md:2103 +#: ./docs/10.x/billing.md:2292 +#: ./docs/11.x/billing.md:2272 +#: ./docs/master/billing.md:2275 msgid "You may invoke the `stripe` method on the `Cashier` class if you would like to use the `Stripe\\StripeClient` client directly. For example, you could use this method to access the `StripeClient` instance and retrieve a list of prices from your Stripe account:" msgstr "" -#: docs/10.x/billing.md:block 673 (code) +# CODE +#: ./docs/8.x/billing.md:1887 +#: ./docs/9.x/billing.md:2105 +#: ./docs/10.x/billing.md:2294 +#: ./docs/11.x/billing.md:2274 +#: ./docs/master/billing.md:2277 msgid "use Laravel\\Cashier\\Cashier;\n\n" -"$prices = Cashier::stripe()->prices->all();\n" -msgstr "" - -#: docs/10.x/billing.md:block 675 (header) +"$prices = Cashier::stripe()->prices->all();" +msgstr "" + +# P +#: ./docs/8.x/billing.md:1891 +#: ./docs/9.x/billing.md:2109 +#: ./docs/10.x/billing.md:2298 +#: ./docs/11.x/billing.md:2278 +#: ./docs/master/billing.md:2281 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/billing.md:1892 +#: ./docs/9.x/billing.md:2110 +#: ./docs/10.x/billing.md:2299 +#: ./docs/11.x/billing.md:2279 +#: ./docs/master/billing.md:2282 msgid "Testing" msgstr "" -#: docs/10.x/billing.md:block 676 (paragraph) +# P +#: ./docs/8.x/billing.md:1894 +#: ./docs/9.x/billing.md:2112 +#: ./docs/10.x/billing.md:2301 msgid "When testing an application that uses Cashier, you may mock the actual HTTP requests to the Stripe API; however, this requires you to partially re-implement Cashier's own behavior. Therefore, we recommend allowing your tests to hit the actual Stripe API. While this is slower, it provides more confidence that your application is working as expected and any slow tests may be placed within their own PHPUnit testing group." msgstr "" -#: docs/10.x/billing.md:block 677 (paragraph) +# P +#: ./docs/8.x/billing.md:1896 +#: ./docs/9.x/billing.md:2114 +#: ./docs/10.x/billing.md:2303 +#: ./docs/11.x/billing.md:2283 +#: ./docs/master/billing.md:2286 msgid "When testing, remember that Cashier itself already has a great test suite, so you should only focus on testing the subscription and payment flow of your own application and not every underlying Cashier behavior." msgstr "" -#: docs/10.x/billing.md:block 678 (paragraph) +# P +#: ./docs/8.x/billing.md:1898 +#: ./docs/9.x/billing.md:2116 +#: ./docs/10.x/billing.md:2305 +#: ./docs/11.x/billing.md:2285 +#: ./docs/master/billing.md:2288 msgid "To get started, add the **testing** version of your Stripe secret to your `phpunit.xml` file:" msgstr "" -#: docs/10.x/billing.md:block 679 (code) -msgid "\"/>\n" +# CODE +#: ./docs/8.x/billing.md:1900 +#: ./docs/9.x/billing.md:2118 +#: ./docs/10.x/billing.md:2307 +#: ./docs/11.x/billing.md:2287 +#: ./docs/master/billing.md:2290 +msgid "\"/>" msgstr "" -#: docs/10.x/billing.md:block 680 (paragraph) +# P +#: ./docs/8.x/billing.md:1902 +#: ./docs/9.x/billing.md:2120 +#: ./docs/10.x/billing.md:2309 +#: ./docs/11.x/billing.md:2289 +#: ./docs/master/billing.md:2292 msgid "Now, whenever you interact with Cashier while testing, it will send actual API requests to your Stripe testing environment. For convenience, you should pre-fill your Stripe testing account with subscriptions / prices that you may use during testing." msgstr "" -#: docs/10.x/billing.md:block 681 (quote) -msgid "**Note** In order to test a variety of billing scenarios, such as credit card denials and failures, you may use the vast range of [testing card numbers and tokens](https://stripe.com/docs/testing) provided by Stripe." -msgstr "" - -#: docs/8.x/billing.md:block 2 (unordered list) -msgid "[Multiprice Subscriptions](#multiprice-subscriptions)" -msgstr "" - -#: docs/8.x/billing.md:block 9 (quote) -msgid "{note} To prevent breaking changes, Cashier uses a fixed Stripe API version. Cashier 13 utilizes Stripe API version `2020-08-27`. The Stripe API version will be updated on minor releases in order to make use of new Stripe features and improvements." -msgstr "" - -#: docs/8.x/billing.md:block 14 (quote) -msgid "{note} To ensure Cashier properly handles all Stripe events, remember to [set up Cashier's webhook handling](#handling-stripe-webhooks)." -msgstr "" - -#: docs/8.x/billing.md:block 17 (paragraph) -msgid "Cashier's service provider registers its own database migration directory, so remember to migrate your database after installing the package. The Cashier migrations will add several columns to your `users` table as well as create a new `subscriptions` table to hold all of your customer's subscriptions:" -msgstr "" - -#: docs/8.x/billing.md:block 22 (code) -msgid "use Laravel\\Cashier\\Cashier;\n\n" -"/**\n" -" * Register any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function register()\n" -"{\n" -" Cashier::ignoreMigrations();\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 23 (quote) -msgid "{note} Stripe recommends that any column used for storing Stripe identifiers should be case-sensitive. Therefore, you should ensure the column collation for the `stripe_id` column is set to `utf8_bin` when using MySQL. More information regarding this can be found in the [Stripe documentation](https://stripe.com/docs/upgrades#what-changes-does-stripe-consider-to-be-backwards-compatible)." -msgstr "" - -#: docs/8.x/billing.md:block 31 (code) -msgid "use App\\Models\\Cashier\\User;\n" -"use Laravel\\Cashier\\Cashier;\n\n" -"/**\n" -" * Bootstrap any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Cashier::useCustomerModel(User::class);\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 32 (quote) -msgid "{note} If you're using a model other than Laravel's supplied `App\\Models\\User` model, you'll need to publish and alter the [Cashier migrations](#installation) provided to match your alternative model's table name." -msgstr "" - -#: docs/8.x/billing.md:block 36 (code) -msgid "STRIPE_KEY=your-stripe-key\n" -"STRIPE_SECRET=your-stripe-secret\n" -msgstr "" - -#: docs/8.x/billing.md:block 43 (quote) -msgid "{note} In order to use locales other than `en`, ensure the `ext-intl` PHP extension is installed and configured on your server." -msgstr "" - -#: docs/8.x/billing.md:block 47 (code) -msgid "use Laravel\\Cashier\\Cashier;\n\n" -"/**\n" -" * Bootstrap any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Cashier::calculateTaxes();\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 50 (quote) -msgid "{note} Unfortunately, for now, no tax is calculated for [single charges](#single-charges) or [single charge checkouts](#single-charge-checkouts). In addition, Stripe Tax is currently \"invite-only\" during its beta period. You can request access to Stripe Tax via the [Stripe Tax website](https://stripe.com/tax#request-access)." -msgstr "" - -#: docs/8.x/billing.md:block 61 (code) -msgid "use App\\Models\\Cashier\\Subscription;\n" -"use App\\Models\\Cashier\\SubscriptionItem;\n\n" -"/**\n" -" * Bootstrap any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Cashier::useSubscriptionModel(Subscription::class);\n" -" Cashier::useSubscriptionItemModel(SubscriptionItem::class);\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 86 (paragraph) -msgid "To credit a customer's balance, you may provide a negative value to the `applyBalance` method. If you wish, you may also provide a description:" -msgstr "" - -#: docs/8.x/billing.md:block 87 (code) -msgid "$user->applyBalance(-500, 'Premium customer top-up.');\n" -msgstr "" - -#: docs/8.x/billing.md:block 88 (paragraph) -msgid "Providing a positive value to the `applyBalance` method will debit the customer's balance:" -msgstr "" - -#: docs/8.x/billing.md:block 89 (code) -msgid "$user->applyBalance(300, 'Bad usage penalty.');\n" -msgstr "" - -#: docs/8.x/billing.md:block 107 (code) -msgid "use function Illuminate\\Events\\queueable;\n\n" -"/**\n" -" * The \"booted\" method of the model.\n" -" *\n" -" * @return void\n" -" */\n" -"protected static function booted()\n" -"{\n" -" static::updated(queueable(function ($customer) {\n" -" if ($customer->hasStripeId()) {\n" -" $customer->syncStripeCustomerDetails();\n" -" }\n" -" }));\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 110 (code) -msgid "/**\n" -" * Get the customer name that should be synced to Stripe.\n" -" *\n" -" * @return string|null\n" -" */\n" -"public function stripeName()\n" -"{\n" -" return $this->company_name;\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 111 (paragraph) -msgid "Similarly, you may override the `stripeEmail`, `stripePhone`, and `stripeAddress` methods. These methods will sync information to their corresponding customer parameters when [updating the Stripe customer object](https://stripe.com/docs/api/customers/update). If you wish to take total control over the customer information sync process, you may override the `syncStripeCustomerDetails` method." -msgstr "" - -#: docs/8.x/billing.md:block 124 (paragraph) -msgid "In order to create subscriptions or perform \"one off\" charges with Stripe, you will need to store a payment method and retrieve its identifier from Stripe. The approach used to accomplish this differs based on whether you plan to use the payment method for subscriptions or single charges, so we will examine both below." -msgstr "" - -#: docs/8.x/billing.md:block 136 (quote) -msgid "{tip} If you would like more information about Setup Intents and gathering customer payment details please [review this overview provided by Stripe](https://stripe.com/docs/payments/save-and-reuse#php)." -msgstr "" - -#: docs/8.x/billing.md:block 159 (code) -msgid "if ($user->hasDefaultPaymentMethod()) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 161 (code) -msgid "if ($user->hasPaymentMethod()) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 163 (code) -msgid "if ($user->hasPaymentMethod('sepa_debit')) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 170 (quote) -msgid "{note} The default payment method on a customer can only be used for invoicing and creating new subscriptions. Due to limitations imposed by Stripe, it may not be used for single charges." -msgstr "" - -#: docs/8.x/billing.md:block 175 (quote) -msgid "{tip} To learn how to retrieve payment method identifiers please review the [payment method storage documentation](#storing-payment-methods)." -msgstr "" - -#: docs/8.x/billing.md:block 186 (quote) -msgid "{note} If a user has an active subscription, your application should not allow them to delete their default payment method." -msgstr "" - -#: docs/8.x/billing.md:block 196 (quote) -msgid "{note} Passing a payment method identifier directly to the `create` subscription method will also automatically add it to the user's stored payment methods." -msgstr "" - -#: docs/8.x/billing.md:block 201 (paragraph) -msgid "The amount of time a customer has to pay their invoice before their subscription is canceled is determined by your subscription and invoice settings within the [Stripe dashboard](https://dashboard.stripe.com/settings/billing/automatic)." -msgstr "" - -#: docs/8.x/billing.md:block 214 (paragraph) -msgid "Or, if you would like to apply a [Stripe promotion code](https://stripe.com/docs/billing/subscriptions/discounts/codes), you may use the `withPromotionCode` method. The given promotion code ID should be the Stripe API ID assigned to the promotion code and not the customer facing promotion code:" -msgstr "" - -#: docs/8.x/billing.md:block 215 (code) -msgid "$user->newSubscription('default', 'price_monthly')\n" -" ->withPromotionCode('promo_code')\n" -" ->create($paymentMethod);\n" -msgstr "" - -#: docs/8.x/billing.md:block 222 (paragraph) -msgid "You may also create subscriptions from the Stripe dashboard itself. When doing so, Cashier will sync newly added subscriptions and assign them a name of `default`. To customize the subscription name that is assigned to dashboard created subscriptions, [extend the `WebhookController`](/docs/{{version}}/billing#defining-webhook-event-handlers) and overwrite the `newSubscriptionName` method." -msgstr "" - -#: docs/8.x/billing.md:block 224 (paragraph) -msgid "Finally, you should always make sure to only add one active subscription per type of subscription offered by your application. If customer has two `default` subscriptions, only the most recently added subscription will be used by Cashier even though both would be synced with your application's database." -msgstr "" - -#: docs/8.x/billing.md:block 228 (code) -msgid "if ($user->subscribed('default')) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 230 (code) -msgid "user() && ! $request->user()->subscribed('default')) {\n" -" // This user is not a paying customer...\n" -" return redirect('billing');\n" -" }\n\n" -" return $next($request);\n" -" }\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 232 (code) -msgid "if ($user->subscription('default')->onTrial()) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 234 (code) -msgid "if ($user->subscribedToProduct('prod_premium', 'default')) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 236 (code) -msgid "if ($user->subscribedToProduct(['prod_basic', 'prod_premium'], 'default')) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 238 (code) -msgid "if ($user->subscribedToPrice('price_basic_monthly', 'default')) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 240 (code) -msgid "if ($user->subscription('default')->recurring()) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 241 (quote) -msgid "{note} If a user has two subscriptions with the same name, the most recent subscription will always be returned by the `subscription` method. For example, a user might have two subscription records named `default`; however, one of the subscriptions may be an old, expired subscription, while the other is the current, active subscription. The most recent subscription will always be returned while older subscriptions are kept in the database for historical review." -msgstr "" - -#: docs/8.x/billing.md:block 245 (code) -msgid "if ($user->subscription('default')->canceled()) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 247 (code) -msgid "if ($user->subscription('default')->onGracePeriod()) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 249 (code) -msgid "if ($user->subscription('default')->ended()) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 254 (code) -msgid "if ($user->hasIncompletePayment('default')) {\n" -" //\n" -"}\n\n" -"if ($user->subscription('default')->hasIncompletePayment()) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 257 (paragraph) -msgid "If you would like the subscription to still be considered active when it's in a `past_due` state, you may use the `keepPastDueSubscriptionsActive` method provided by Cashier. Typically, this method should be called in the `register` method of your `App\\Providers\\AppServiceProvider`:" -msgstr "" - -#: docs/8.x/billing.md:block 258 (code) -msgid "use Laravel\\Cashier\\Cashier;\n\n" -"/**\n" -" * Register any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function register()\n" -"{\n" -" Cashier::keepPastDueSubscriptionsActive();\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 259 (quote) -msgid "{note} When a subscription is in an `incomplete` state it cannot be changed until the payment is confirmed. Therefore, the `swap` and `updateQuantity` methods will throw an exception when the subscription is in an `incomplete` state." -msgstr "" - -#: docs/8.x/billing.md:block 280 (quote) -msgid "{note} Executing the `noProrate` method before the `swapAndInvoice` method will have no effect on proration. An invoice will always be issued." -msgstr "" - -#: docs/8.x/billing.md:block 291 (header) -msgid "Multiprice Subscription Quantities" -msgstr "" - -#: docs/8.x/billing.md:block 292 (paragraph) -msgid "If your subscription is a [multiprice subscription](#multiprice-subscriptions), you should pass the name of the price whose quantity you wish to increment or decrement as the second argument to the increment / decrement methods:" -msgstr "" - -#: docs/8.x/billing.md:block 295 (header) -msgid "Multiprice Subscriptions" -msgstr "" - -#: docs/8.x/billing.md:block 296 (paragraph) -msgid "[Multiprice subscriptions](https://stripe.com/docs/billing/subscriptions/multiple-products) allow you to assign multiple billing prices to a single subscription. For example, imagine you are building a customer service \"helpdesk\" application that has a base subscription price of $10 per month but offers a live chat add-on price for an additional $15 per month. Multiprice subscription information is stored in Cashier's `subscription_items` database table." -msgstr "" - -#: docs/8.x/billing.md:block 297 (paragraph) -msgid "You may specify multiple prices for a given subscription by passing an array of prices as the second argument to the `newSubscription` method:" -msgstr "" - -#: docs/8.x/billing.md:block 309 (quote) -msgid "{note} You may not remove the last price on a subscription. Instead, you should simply cancel the subscription." -msgstr "" - -#: docs/8.x/billing.md:block 312 (paragraph) -msgid "You may also change the prices attached to a multiprice subscription. For example, imagine a customer has a `price_basic` subscription with a `price_chat` add-on price and you want to upgrade the customer from the `price_basic` to the `price_pro` price:" -msgstr "" - -#: docs/8.x/billing.md:block 321 (paragraph) -msgid "By default, Stripe will prorate charges when adding or removing prices from a multiprice subscription. If you would like to make a price adjustment without proration, you should chain the `noProrate` method onto your price operation:" -msgstr "" - -#: docs/8.x/billing.md:block 327 (quote) -msgid "{note} When a subscription has multiple prices the `stripe_price` and `quantity` attributes on the `Subscription` model will be `null`. To access the individual price attributes, you should use the `items` relationship available on the `Subscription` model." -msgstr "" - -#: docs/8.x/billing.md:block 362 (quote) -msgid "{note} Instead of calculating Tax Rates manually, you can [automatically calculate taxes using Stripe Tax](#tax-configuration)" -msgstr "" - -#: docs/8.x/billing.md:block 364 (code) -msgid "/**\n" -" * The tax rates that should apply to the customer's subscriptions.\n" -" *\n" -" * @return array\n" -" */\n" -"public function taxRates()\n" -"{\n" -" return ['txr_id'];\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 366 (paragraph) -msgid "If you're offering multiprice subscriptions, you may define different tax rates for each price by implementing a `priceTaxRates` method on your billable model:" -msgstr "" - -#: docs/8.x/billing.md:block 367 (code) -msgid "/**\n" -" * The tax rates that should apply to the customer's subscriptions.\n" -" *\n" -" * @return array\n" -" */\n" -"public function priceTaxRates()\n" -"{\n" -" return [\n" -" 'price_monthly' => ['txr_id'],\n" -" ];\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 368 (quote) -msgid "{note} The `taxRates` method only applies to subscription charges. If you use Cashier to make \"one off\" charges, you will need to manually specify the tax rate at that time." -msgstr "" - -#: docs/8.x/billing.md:block 373 (paragraph) -msgid "This will also sync any multiprice subscription item tax rates. If your application is offering multiprice subscriptions, you should ensure that your billable model implements the `priceTaxRates` method [discussed above](#subscription-taxes)." +# P +#: ./docs/8.x/billing.md:1904 +#: ./docs/9.x/billing.md:2123 +#: ./docs/10.x/billing.md:2312 +#: ./docs/11.x/billing.md:2292 +#: ./docs/master/billing.md:2295 +msgid "In order to test a variety of billing scenarios, such as credit card denials and failures, you may use the vast range of [testing card numbers and tokens](https://stripe.com/docs/testing) provided by Stripe." msgstr "" -#: docs/8.x/billing.md:block 378 (quote) -msgid "{note} These methods are also available on any `Laravel\\Cashier\\Invoice` object. However, when invoked on an `Invoice` object, the methods will determine the exemption status at the time the invoice was created." -msgstr "" - -#: docs/8.x/billing.md:block 410 (quote) -msgid "{note} If the customer's subscription is not canceled before the trial ending date they will be charged as soon as the trial expires, so you should be sure to notify your users of their trial ending date." -msgstr "" - -#: docs/8.x/billing.md:block 414 (code) -msgid "if ($user->onTrial('default')) {\n" -" //\n" -"}\n\n" -"if ($user->subscription('default')->onTrial()) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 424 (quote) -msgid "{note} Be sure to add a [date cast](/docs/{{version}}/eloquent-mutators##date-casting) for the `trial_ends_at` attribute within your billable model's class definition." -msgstr "" - -#: docs/8.x/billing.md:block 439 (quote) -msgid "{tip} You may use [the Stripe CLI](https://stripe.com/docs/stripe-cli) to help test webhooks during local development." -msgstr "" - -#: docs/8.x/billing.md:block 452 (quote) -msgid "{note} Make sure you protect incoming Stripe webhook requests with Cashier's included [webhook signature verification](#verifying-webhook-signatures) middleware." -msgstr "" - -#: docs/8.x/billing.md:block 462 (code) -msgid "payload['type'] === 'invoice.payment_succeeded') {\n" -" // Handle the incoming event...\n" -" }\n" -" }\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 473 (quote) -msgid "{note} The `charge` method accepts the amount you would like to charge in the lowest denominator of the currency used by your application. For example, when using United States Dollars, amounts should be specified in pennies." -msgstr "" - -#: docs/8.x/billing.md:block 481 (code) -msgid "try {\n" -" $payment = $user->charge(100, $paymentMethod);\n" -"} catch (Exception $e) {\n" -" //\n" -"}\n" -msgstr "" - -#: docs/8.x/billing.md:block 490 (paragraph) -msgid "Although the `invoiceFor` method is available for you to use, it is recommendeded that you use the `invoicePrice` method with pre-defined prices. By doing so, you will have access to better analytics and data within your Stripe dashboard regarding your sales on a per-product basis." -msgstr "" - -#: docs/8.x/billing.md:block 491 (quote) -msgid "{note} The `invoicePrice` and `invoiceFor` methods will create a Stripe invoice which will retry failed billing attempts. If you do not want invoices to retry failed charges, you will need to close them using the Stripe API after the first failed charge." -msgstr "" - -#: docs/8.x/billing.md:block 514 (paragraph) -msgid "Similary, if the customer has multiple subscriptions, you can also retrieve the upcoming invoice for a specific subscription:" -msgstr "" - -#: docs/8.x/billing.md:block 517 (header) -msgid "Previewing Subscription Invoice" -msgstr "" - -#: docs/8.x/billing.md:block 525 (code) +# CODE +#: ./docs/10.x/billing.md:1932 +#: ./docs/11.x/billing.md:1912 +#: ./docs/master/billing.md:1915 msgid "use Illuminate\\Http\\Request;\n\n" -"Route::get('/user/invoice/{invoice}', function (Request $request, $invoiceId) {\n" -" return $request->user()->downloadInvoice($invoiceId, [\n" -" 'vendor' => 'Your Company',\n" -" 'product' => 'Your Product',\n" -" ]);\n" -"});\n" -msgstr "" - -#: docs/8.x/billing.md:block 526 (paragraph) -msgid "By default, all data on the invoice is derived from the customer and invoice data stored in Stripe. However, you can customize some of this data by providing an array as the second argument to the `downloadInvoice` method. This array allows you to customize information such as your company and product details:" +"Route::get('/user/invoice/{invoice}', function (Request $request, string $invoiceId) {\n" +" return $request->user()->downloadInvoice($invoiceId);\n" +"});" +msgstr "" + +# P +#: ./docs/9.x/billing.md:1955 +#: ./docs/10.x/billing.md:2133 +#: ./docs/11.x/billing.md:2113 +#: ./docs/master/billing.md:2116 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/billing.md:1956 +#: ./docs/10.x/billing.md:2134 +#: ./docs/11.x/billing.md:2114 +#: ./docs/master/billing.md:2117 +msgid "Guest Checkouts" msgstr "" -#: docs/8.x/billing.md:block 527 (code) -msgid "return $request->user()->downloadInvoice($invoiceId, [\n" -" 'vendor' => 'Your Company',\n" -" 'product' => 'Your Product',\n" -" 'street' => 'Main Str. 1',\n" -" 'location' => '2000 Antwerp, Belgium',\n" -" 'phone' => '+32 499 00 00 00',\n" -" 'email' => 'info@example.com',\n" -" 'url' => 'https://example.com',\n" -" 'vendorVat' => 'BE123456789',\n" -"], 'my-invoice');\n" +# P +#: ./docs/9.x/billing.md:1958 +#: ./docs/10.x/billing.md:2136 +#: ./docs/11.x/billing.md:2116 +#: ./docs/master/billing.md:2119 +msgid "Using the `Checkout::guest` method, you may initiate checkout sessions for guests of your application that do not have an \"account\":" msgstr "" -#: docs/8.x/billing.md:block 533 (code) +# CODE +#: ./docs/10.x/billing.md:1960 +#: ./docs/11.x/billing.md:1940 +#: ./docs/master/billing.md:1943 msgid "use Illuminate\\Support\\Facades\\Http;\n" "use Laravel\\Cashier\\Contracts\\InvoiceRenderer;\n" "use Laravel\\Cashier\\Invoice;\n\n" @@ -3718,91 +8331,117 @@ msgid "use Illuminate\\Support\\Facades\\Http;\n" "{\n" " /**\n" " * Render the given invoice and return the raw PDF bytes.\n" -" *\n" -" * @param \\Laravel\\Cashier\\Invoice. $invoice\n" -" * @param array $data\n" -" * @param array $options\n" -" * @return string\n" " */\n" " public function render(Invoice $invoice, array $data = [], array $options = []): string\n" " {\n" " $html = $invoice->view($data)->render();\n\n" " return Http::get('https://example.com/html-to-pdf', ['html' => $html])->get()->body();\n" " }\n" -"}\n" +"}" msgstr "" -#: docs/8.x/billing.md:block 548 (code) +# CODE +#: ./docs/9.x/billing.md:1960 +#: ./docs/10.x/billing.md:2138 +#: ./docs/11.x/billing.md:2118 +#: ./docs/master/billing.md:2121 msgid "use Illuminate\\Http\\Request;\n" -"use Stripe\\Checkout\\Session;\n" -"use Stripe\\Customer;\n\n" +"use Laravel\\Cashier\\Checkout;\n\n" "Route::get('/product-checkout', function (Request $request) {\n" -" return $request->user()->checkout(['price_tshirt' => 1], [\n" -" 'success_url' => route('checkout-success') . '?session_id={CHECKOUT_SESSION_ID}',\n" -" 'cancel_url' => route('checkout-cancel'),\n" +" return Checkout::guest()->create('price_tshirt', [\n" +" 'success_url' => route('your-success-route'),\n" +" 'cancel_url' => route('your-cancel-route'),\n" " ]);\n" -"});\n\n" -"Route::get('/checkout-success', function (Request $request) {\n" -" $checkoutSession = $request->user()->stripe()->checkout->sessions->retrieve($request->get('session_id'));\n\n" -" return view('checkout.success', ['checkoutSession' => $checkoutSession]);\n" -"})->name('checkout-success');\n" +"});" msgstr "" -#: docs/8.x/billing.md:block 557 (quote) -msgid "{note} When using the `checkoutCharge` method, Stripe will always create a new product and price in your Stripe dashboard. Therefore, we recommend that you create the products up front in your Stripe dashboard and use the `checkout` method instead." +# P +#: ./docs/9.x/billing.md:1970 +#: ./docs/10.x/billing.md:2148 +#: ./docs/11.x/billing.md:2128 +#: ./docs/master/billing.md:2131 +msgid "Similarly to when creating checkout sessions for existing users, you may utilize additional methods available on the `Laravel\\Cashier\\CheckoutBuilder` instance to customize the guest checkout session:" msgstr "" -#: docs/8.x/billing.md:block 560 (quote) -msgid "{note} Using Stripe Checkout for subscriptions requires you to enable the `customer.subscription.created` webhook in your Stripe dashboard. This webhook will create the subscription record in your database and store all of the relevant subscription items." +# CODE +#: ./docs/9.x/billing.md:1972 +#: ./docs/10.x/billing.md:2150 +#: ./docs/11.x/billing.md:2130 +#: ./docs/master/billing.md:2133 +msgid "use Illuminate\\Http\\Request;\n" +"use Laravel\\Cashier\\Checkout;\n\n" +"Route::get('/product-checkout', function (Request $request) {\n" +" return Checkout::guest()\n" +" ->withPromotionCode('promo-code')\n" +" ->create('price_tshirt', [\n" +" 'success_url' => route('your-success-route'),\n" +" 'cancel_url' => route('your-cancel-route'),\n" +" ]);\n" +"});" msgstr "" -#: docs/8.x/billing.md:block 567 (quote) -msgid "{note} Unfortunately Stripe Checkout does not support all subscription billing options when starting subscriptions. Using the `anchorBillingCycleOn` method on the subscription builder, setting proration behavior, or setting payment behavior will not have any effect during Stripe Checkout sessions. Please consult [the Stripe Checkout Session API documentation](https://stripe.com/docs/api/checkout/sessions/create) to review which parameters are available." +# P +#: ./docs/9.x/billing.md:1984 +#: ./docs/10.x/billing.md:2162 +#: ./docs/11.x/billing.md:2142 +#: ./docs/master/billing.md:2145 +msgid "After a guest checkout has been completed, Stripe can dispatch a `checkout.session.completed` webhook event, so make sure to [configure your Stripe webhook](https://dashboard.stripe.com/webhooks) to actually send this event to your application. Once the webhook has been enabled within the Stripe dashboard, you may [handle the webhook with Cashier](#handling-stripe-webhooks). The object contained in the webhook payload will be a [`checkout` object](https://stripe.com/docs/api/checkout/sessions/object) that you may inspect in order to fulfill your customer's order." msgstr "" -#: docs/8.x/billing.md:block 581 (quote) -msgid "{note} If you have already configured [automatic tax collection](#tax-configuration) in your application's service provider then this feature will be enabled automatically and there is no need to invoke the `collectTaxIds` method." +# H4 +#: ./docs/10.x/billing.md:2106 +#: ./docs/11.x/billing.md:2086 +#: ./docs/master/billing.md:2089 +msgid "Stripe Checkout and Trial Periods" msgstr "" -#: docs/8.x/billing.md:block 600 (quote) -msgid "{note} Before getting started, review [Stripe's guide on PSD2 and SCA](https://stripe.com/guides/strong-customer-authentication) as well as their [documentation on the new SCA APIs](https://stripe.com/docs/strong-customer-authentication)." +# H4 +#: ./docs/10.x/billing.md:2117 +#: ./docs/11.x/billing.md:2097 +#: ./docs/master/billing.md:2100 +msgid "Subscriptions and Webhooks" msgstr "" -#: docs/8.x/billing.md:block 614 (quote) -msgid "{note} Notifications will be sent even when customers are manually making a payment that requires additional confirmation. Unfortunately, there is no way for Stripe to know that the payment was done manually or \"off-session\". But, a customer will simply see a \"Payment Successful\" message if they visit the payment page after already confirming their payment. The customer will not be allowed to accidentally confirm the same payment twice and incur an accidental second charge." +# P +#: ./docs/10.x/billing.md:2230 +#: ./docs/11.x/billing.md:2210 +#: ./docs/master/billing.md:2213 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/billing.md:2231 +#: ./docs/11.x/billing.md:2211 +#: ./docs/master/billing.md:2214 +msgid "Confirming Payments" msgstr "" -#: docs/8.x/billing.md:block 630 (quote) -msgid "{tip} In order to test a variety of billing scenarios, such as credit card denials and failures, you may use the vast range of [testing card numbers and tokens](https://stripe.com/docs/testing) provided by Stripe." +# P +#: ./docs/10.x/billing.md:2233 +#: ./docs/11.x/billing.md:2213 +#: ./docs/master/billing.md:2216 +msgid "Some payment methods require additional data in order to confirm payments. For example, SEPA payment methods require additional \"mandate\" data during the payment process. You may provide this data to Cashier using the `withPaymentConfirmationOptions` method:" msgstr "" -#: docs/9.x/billing.md:block 274 (code) -msgid "use Laravel\\Cashier\\Cashier;\n\n" -"/**\n" -" * Register any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function register()\n" -"{\n" -" Cashier::keepPastDueSubscriptionsActive();\n" -" Cashier::keepIncompleteSubscriptionsActive();\n" -"}\n" +# CODE +#: ./docs/10.x/billing.md:2235 +#: ./docs/11.x/billing.md:2215 +#: ./docs/master/billing.md:2218 +msgid "$subscription->withPaymentConfirmationOptions([\n" +" 'mandate_data' => '...',\n" +"])->swap('price_xxx');" msgstr "" -#: docs/9.x/billing.md:block 443 (code) -msgid "if ($user->hasExpiredTrial('default')) {\n" -" //\n" -"}\n\n" -"if ($user->subscription('default')->hasExpiredTrial()) {\n" -" //\n" -"}\n" +# P +#: ./docs/10.x/billing.md:2239 +#: ./docs/11.x/billing.md:2219 +#: ./docs/master/billing.md:2222 +msgid "You may consult the [Stripe API documentation](https://stripe.com/docs/api/payment_intents/confirm) to review all of the options accepted when confirming payments." msgstr "" -#: docs/9.x/billing.md:block 564 (code) -msgid "use Illuminate\\Http\\Request;\n\n" -"Route::get('/user/invoice/{invoice}', function (Request $request, $invoiceId) {\n" -" return $request->user()->downloadInvoice($invoiceId);\n" -"});\n" +# P +#: ./docs/11.x/billing.md:2281 +#: ./docs/master/billing.md:2284 +msgid "When testing an application that uses Cashier, you may mock the actual HTTP requests to the Stripe API; however, this requires you to partially re-implement Cashier's own behavior. Therefore, we recommend allowing your tests to hit the actual Stripe API. While this is slower, it provides more confidence that your application is working as expected and any slow tests may be placed within their own Pest / PHPUnit testing group." msgstr "" diff --git a/po/zh_TW/blade.po b/po/zh_TW/blade.po index 113552319..3c260f207 100644 --- a/po/zh_TW/blade.po +++ b/po/zh_TW/blade.po @@ -10,261 +10,812 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" +"PO-Revision-Date: 2024-11-30 08:38\n" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "Property" +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "Description" +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "`$loop->index`" +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "The index of the current loop iteration (starts at 0)." +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "`$loop->iteration`" +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "The current loop iteration (starts at 1)." +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "`$loop->remaining`" +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "The iterations remaining in the loop." +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "`$loop->count`" +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "The total number of items in the array being iterated." +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "`$loop->first`" +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "Whether this is the first iteration through the loop." +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "`$loop->last`" +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "Whether this is the last iteration through the loop." +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "`$loop->even`" +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "Whether this is an even iteration through the loop." +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "`$loop->odd`" +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "Whether this is an odd iteration through the loop." +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "`$loop->depth`" +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "The nesting level of the current loop." +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "`$loop->parent`" +msgstr "" + +# TD +#: ./docs/8.x/blade.md +#: ./docs/9.x/blade.md +#: ./docs/10.x/blade.md +#: ./docs/11.x/blade.md +#: ./docs/master/blade.md +msgid "When in a nested loop, the parent's loop variable." +msgstr "" -#: docs/10.x/blade.md:block 1 (header) +# H1 +#: ./docs/8.x/blade.md:1 +#: ./docs/9.x/blade.md:1 +#: ./docs/10.x/blade.md:1 +#: ./docs/11.x/blade.md:1 +#: ./docs/master/blade.md:1 msgid "Blade Templates" -msgstr "Blade 樣板" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:3 +#: ./docs/9.x/blade.md:3 +#: ./docs/10.x/blade.md:3 +#: ./docs/11.x/blade.md:3 +#: ./docs/master/blade.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" - -#: docs/10.x/blade.md:block 2 (unordered list) -msgid "[Supercharging Blade With Livewire](#supercharging-blade-with-livewire)" -msgstr "[使用 Livewire 來增強 Blade 的功能](#supercharging-blade-with-livewire)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:4 +#: ./docs/9.x/blade.md:5 +#: ./docs/10.x/blade.md:5 +#: ./docs/11.x/blade.md:5 +#: ./docs/master/blade.md:5 msgid "[Displaying Data](#displaying-data)" -msgstr "[顯示資料](#displaying-data)" +msgstr "" + +# P +#: ./docs/9.x/blade.md:4 +#: ./docs/10.x/blade.md:4 +#: ./docs/11.x/blade.md:4 +#: ./docs/master/blade.md:4 +msgid "[Supercharging Blade With Livewire](#supercharging-blade-with-livewire)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:5 +#: ./docs/9.x/blade.md:6 +#: ./docs/10.x/blade.md:6 +#: ./docs/11.x/blade.md:6 +#: ./docs/master/blade.md:6 msgid "[HTML Entity Encoding](#html-entity-encoding)" -msgstr "[HTML 實體編碼](#html-entity-encoding)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:6 +#: ./docs/9.x/blade.md:7 msgid "[Blade & JavaScript Frameworks](#blade-and-javascript-frameworks)" -msgstr "[Blade 與 JavaScript 框架](#blade-and-javascript-frameworks)" +msgstr "" + +# P +#: ./docs/10.x/blade.md:7 +#: ./docs/11.x/blade.md:7 +#: ./docs/master/blade.md:7 +msgid "[Blade and JavaScript Frameworks](#blade-and-javascript-frameworks)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:7 +#: ./docs/9.x/blade.md:8 +#: ./docs/10.x/blade.md:8 +#: ./docs/11.x/blade.md:8 +#: ./docs/master/blade.md:8 msgid "[Blade Directives](#blade-directives)" -msgstr "[Blade 指示詞](#blade-directives)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:8 +#: ./docs/9.x/blade.md:9 +#: ./docs/10.x/blade.md:9 +#: ./docs/11.x/blade.md:9 +#: ./docs/master/blade.md:9 msgid "[If Statements](#if-statements)" -msgstr "[If 陳述式](#if-statements)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:9 +#: ./docs/9.x/blade.md:10 +#: ./docs/10.x/blade.md:10 +#: ./docs/11.x/blade.md:10 +#: ./docs/master/blade.md:10 msgid "[Switch Statements](#switch-statements)" -msgstr "[Switch 陳述式](#switch-statements)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:10 +#: ./docs/9.x/blade.md:11 +#: ./docs/10.x/blade.md:11 +#: ./docs/11.x/blade.md:11 +#: ./docs/master/blade.md:11 msgid "[Loops](#loops)" -msgstr "[迴圈](#loops)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:11 +#: ./docs/9.x/blade.md:12 +#: ./docs/10.x/blade.md:12 +#: ./docs/11.x/blade.md:12 +#: ./docs/master/blade.md:12 msgid "[The Loop Variable](#the-loop-variable)" -msgstr "[迴圈變數](#the-loop-variable)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:12 +#: ./docs/9.x/blade.md:13 +#: ./docs/10.x/blade.md:13 +#: ./docs/11.x/blade.md:13 +#: ./docs/master/blade.md:13 msgid "[Conditional Classes](#conditional-classes)" -msgstr "[條件式 Class](#conditional-classes)" - -#: docs/10.x/blade.md:block 2 (unordered list) -msgid "[Additional Attributes](#additional-attributes)" -msgstr "[額外屬性](#additional-attributes)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:13 +#: ./docs/9.x/blade.md:15 +#: ./docs/10.x/blade.md:15 +#: ./docs/11.x/blade.md:15 +#: ./docs/master/blade.md:15 msgid "[Including Subviews](#including-subviews)" -msgstr "[Include 子 View](#including-subviews)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:14 +#: ./docs/9.x/blade.md:16 +#: ./docs/10.x/blade.md:16 +#: ./docs/11.x/blade.md:16 +#: ./docs/master/blade.md:16 msgid "[The `@once` Directive](#the-once-directive)" -msgstr "[`@once` 指示詞](#the-once-directive)" +msgstr "" + +# P +#: ./docs/9.x/blade.md:14 +#: ./docs/10.x/blade.md:14 +#: ./docs/11.x/blade.md:14 +#: ./docs/master/blade.md:14 +msgid "[Additional Attributes](#additional-attributes)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:15 +#: ./docs/9.x/blade.md:17 +#: ./docs/10.x/blade.md:17 +#: ./docs/11.x/blade.md:17 +#: ./docs/master/blade.md:17 msgid "[Raw PHP](#raw-php)" -msgstr "[原始 PHP](#raw-php)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:16 +#: ./docs/9.x/blade.md:18 +#: ./docs/10.x/blade.md:18 +#: ./docs/11.x/blade.md:18 +#: ./docs/master/blade.md:18 msgid "[Comments](#comments)" -msgstr "[註解](#comments)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:17 +#: ./docs/9.x/blade.md:19 +#: ./docs/10.x/blade.md:19 +#: ./docs/11.x/blade.md:19 +#: ./docs/master/blade.md:19 msgid "[Components](#components)" -msgstr "[元件](#components)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:18 +#: ./docs/9.x/blade.md:20 +#: ./docs/10.x/blade.md:20 +#: ./docs/11.x/blade.md:20 +#: ./docs/master/blade.md:20 msgid "[Rendering Components](#rendering-components)" -msgstr "[轉譯元件](#rendering-components)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:19 +#: ./docs/9.x/blade.md:21 msgid "[Passing Data To Components](#passing-data-to-components)" -msgstr "[將資料傳給元件](#passing-data-to-components)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:20 +#: ./docs/9.x/blade.md:22 +#: ./docs/10.x/blade.md:22 +#: ./docs/11.x/blade.md:23 +#: ./docs/master/blade.md:22 msgid "[Component Attributes](#component-attributes)" -msgstr "[元件屬性](#component-attributes)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/10.x/blade.md:21 +#: ./docs/11.x/blade.md:22 +#: ./docs/master/blade.md:21 +msgid "[Passing Data to Components](#passing-data-to-components)" +msgstr "" + +# P +#: ./docs/11.x/blade.md:21 +msgid "[Index Components](#index-components)" +msgstr "" + +# P +#: ./docs/8.x/blade.md:21 +#: ./docs/9.x/blade.md:23 +#: ./docs/10.x/blade.md:23 +#: ./docs/11.x/blade.md:24 +#: ./docs/master/blade.md:23 msgid "[Reserved Keywords](#reserved-keywords)" -msgstr "[保留字](#reserved-keywords)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:22 +#: ./docs/9.x/blade.md:24 +#: ./docs/10.x/blade.md:24 +#: ./docs/11.x/blade.md:25 +#: ./docs/master/blade.md:24 msgid "[Slots](#slots)" -msgstr "[Slot](#slots)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:23 +#: ./docs/9.x/blade.md:25 +#: ./docs/10.x/blade.md:25 +#: ./docs/11.x/blade.md:26 +#: ./docs/master/blade.md:25 msgid "[Inline Component Views](#inline-component-views)" -msgstr "[內嵌元件 View](#inline-component-views)" - -#: docs/10.x/blade.md:block 2 (unordered list) -msgid "[Dynamic Components](#dynamic-components)" -msgstr "[動態元件](#dynamic-components)" - -#: docs/10.x/blade.md:block 2 (unordered list) -msgid "[Manually Registering Components](#manually-registering-components)" -msgstr "[手動註冊元件](#manually-registering-components)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:24 +#: ./docs/9.x/blade.md:28 +#: ./docs/10.x/blade.md:28 +#: ./docs/11.x/blade.md:29 +#: ./docs/master/blade.md:28 msgid "[Anonymous Components](#anonymous-components)" -msgstr "[匿名元件](#anonymous-components)" - -#: docs/10.x/blade.md:block 2 (unordered list) -msgid "[Anonymous Index Components](#anonymous-index-components)" -msgstr "[匿名 Index 原件](#anonymous-index-components)" - -#: docs/10.x/blade.md:block 2 (unordered list) -msgid "[Data Properties / Attributes](#data-properties-attributes)" -msgstr "[Data 屬性](#data-properties-attributes)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) -msgid "[Accessing Parent Data](#accessing-parent-data)" -msgstr "[存取上層資料](#accessing-parent-data)" +# P +#: ./docs/8.x/blade.md:25 +#: ./docs/9.x/blade.md:26 +#: ./docs/10.x/blade.md:26 +#: ./docs/11.x/blade.md:27 +#: ./docs/master/blade.md:26 +msgid "[Dynamic Components](#dynamic-components)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) -msgid "[Anonymous Components Paths](#anonymous-component-paths)" -msgstr "[匿名元件的路徑](#anonymous-component-paths)" +# P +#: ./docs/8.x/blade.md:26 +#: ./docs/9.x/blade.md:27 +#: ./docs/10.x/blade.md:27 +#: ./docs/11.x/blade.md:28 +#: ./docs/master/blade.md:27 +msgid "[Manually Registering Components](#manually-registering-components)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:27 +#: ./docs/9.x/blade.md:33 +#: ./docs/10.x/blade.md:33 +#: ./docs/11.x/blade.md:34 +#: ./docs/master/blade.md:33 msgid "[Building Layouts](#building-layouts)" -msgstr "[製作 Layout](#building-layouts)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:28 +#: ./docs/9.x/blade.md:34 +#: ./docs/10.x/blade.md:34 +#: ./docs/11.x/blade.md:35 +#: ./docs/master/blade.md:34 msgid "[Layouts Using Components](#layouts-using-components)" -msgstr "[使用元件的 Layout](#layouts-using-components)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:29 +#: ./docs/9.x/blade.md:35 +#: ./docs/10.x/blade.md:35 +#: ./docs/11.x/blade.md:36 +#: ./docs/master/blade.md:35 msgid "[Layouts Using Template Inheritance](#layouts-using-template-inheritance)" -msgstr "[使用樣板繼承的 Layout](#layouts-using-template-inheritance)" +msgstr "" + +# P +#: ./docs/9.x/blade.md:29 +#: ./docs/10.x/blade.md:29 +#: ./docs/11.x/blade.md:30 +#: ./docs/master/blade.md:29 +msgid "[Anonymous Index Components](#anonymous-index-components)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:30 +#: ./docs/9.x/blade.md:36 +#: ./docs/10.x/blade.md:36 +#: ./docs/11.x/blade.md:37 +#: ./docs/master/blade.md:36 msgid "[Forms](#forms)" -msgstr "[表單](#forms)" +msgstr "" + +# P +#: ./docs/9.x/blade.md:30 +#: ./docs/10.x/blade.md:30 +#: ./docs/11.x/blade.md:31 +#: ./docs/master/blade.md:30 +msgid "[Data Properties / Attributes](#data-properties-attributes)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:31 +#: ./docs/9.x/blade.md:37 +#: ./docs/10.x/blade.md:37 +#: ./docs/11.x/blade.md:38 +#: ./docs/master/blade.md:37 msgid "[CSRF Field](#csrf-field)" -msgstr "[CSRF 欄位](#csrf-field)" +msgstr "" + +# P +#: ./docs/9.x/blade.md:31 +#: ./docs/10.x/blade.md:31 +#: ./docs/11.x/blade.md:32 +#: ./docs/master/blade.md:31 +msgid "[Accessing Parent Data](#accessing-parent-data)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:32 +#: ./docs/9.x/blade.md:38 +#: ./docs/10.x/blade.md:38 +#: ./docs/11.x/blade.md:39 +#: ./docs/master/blade.md:38 msgid "[Method Field](#method-field)" -msgstr "[方法欄位](#method-field)" +msgstr "" + +# P +#: ./docs/9.x/blade.md:32 +#: ./docs/10.x/blade.md:32 +#: ./docs/11.x/blade.md:33 +#: ./docs/master/blade.md:32 +msgid "[Anonymous Components Paths](#anonymous-component-paths)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:33 +#: ./docs/9.x/blade.md:39 +#: ./docs/10.x/blade.md:39 +#: ./docs/11.x/blade.md:40 +#: ./docs/master/blade.md:39 msgid "[Validation Errors](#validation-errors)" -msgstr "[表單驗證錯誤](#validation-errors)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:34 +#: ./docs/9.x/blade.md:40 +#: ./docs/10.x/blade.md:40 +#: ./docs/11.x/blade.md:41 +#: ./docs/master/blade.md:40 msgid "[Stacks](#stacks)" -msgstr "[Stack](#stacks)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:35 +#: ./docs/9.x/blade.md:41 +#: ./docs/10.x/blade.md:41 +#: ./docs/11.x/blade.md:42 +#: ./docs/master/blade.md:41 msgid "[Service Injection](#service-injection)" -msgstr "[插入 Service](#service-injection)" - -#: docs/10.x/blade.md:block 2 (unordered list) -msgid "[Rendering Inline Blade Templates](#rendering-inline-blade-templates)" -msgstr "[轉譯內嵌的 Blade 樣板](#rendering-inline-blade-templates)" - -#: docs/10.x/blade.md:block 2 (unordered list) -msgid "[Rendering Blade Fragments](#rendering-blade-fragments)" -msgstr "[轉譯 Blade 片段](#rendering-blade-fragments)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:36 +#: ./docs/9.x/blade.md:44 +#: ./docs/10.x/blade.md:44 +#: ./docs/11.x/blade.md:45 +#: ./docs/master/blade.md:44 msgid "[Extending Blade](#extending-blade)" -msgstr "[擴充 Blade](#extending-blade)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:37 +#: ./docs/9.x/blade.md:45 +#: ./docs/10.x/blade.md:45 +#: ./docs/11.x/blade.md:46 +#: ./docs/master/blade.md:45 msgid "[Custom Echo Handlers](#custom-echo-handlers)" -msgstr "[自訂的 Echo 處理常式](#custom-echo-handlers)" +msgstr "" -#: docs/10.x/blade.md:block 2 (unordered list) +# P +#: ./docs/8.x/blade.md:38 +#: ./docs/9.x/blade.md:46 +#: ./docs/10.x/blade.md:46 +#: ./docs/11.x/blade.md:47 +#: ./docs/master/blade.md:46 msgid "[Custom If Statements](#custom-if-statements)" -msgstr "[自訂 If 陳述式](#custom-if-statements)" +msgstr "" -#: docs/10.x/blade.md:block 4 (header) +# P +#: ./docs/8.x/blade.md:40 +#: ./docs/9.x/blade.md:48 +#: ./docs/10.x/blade.md:48 +#: ./docs/11.x/blade.md:49 +#: ./docs/master/blade.md:48 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/blade.md:41 +#: ./docs/9.x/blade.md:49 +#: ./docs/10.x/blade.md:49 +#: ./docs/11.x/blade.md:50 +#: ./docs/master/blade.md:49 msgid "Introduction" -msgstr "簡介" +msgstr "" + +# P +#: ./docs/9.x/blade.md:42 +#: ./docs/10.x/blade.md:42 +#: ./docs/11.x/blade.md:43 +#: ./docs/master/blade.md:42 +msgid "[Rendering Inline Blade Templates](#rendering-inline-blade-templates)" +msgstr "" -#: docs/10.x/blade.md:block 5 (paragraph) +# P +#: ./docs/8.x/blade.md:43 +#: ./docs/9.x/blade.md:51 +#: ./docs/10.x/blade.md:51 +#: ./docs/11.x/blade.md:52 +#: ./docs/master/blade.md:51 msgid "Blade is the simple, yet powerful templating engine that is included with Laravel. Unlike some PHP templating engines, Blade does not restrict you from using plain PHP code in your templates. In fact, all Blade templates are compiled into plain PHP code and cached until they are modified, meaning Blade adds essentially zero overhead to your application. Blade template files use the `.blade.php` file extension and are typically stored in the `resources/views` directory." -msgstr "Blade 是 Laravel 內建的一個簡單但強大的樣板引擎。與其他 PHP 樣板引擎不同,Blade 不會在樣板中限制你不能使用純 PHP 程式碼。事實上,Blade 樣板會被編譯為純 PHP 程式碼,且在被修改前都會被快取起來。這代表,使用 Blade 並不會給你的網站帶來任何額外的開銷。Blade 樣板檔使用 `.blade.php` 副檔名,且通常放在 `resources/views` 目錄內。" +msgstr "" -#: docs/10.x/blade.md:block 6 (paragraph) -msgid "Blade views may be returned from routes or controllers using the global `view` helper. Of course, as mentioned in the documentation on [views](/docs/{{version}}/views), data may be passed to the Blade view using the `view` helper's second argument:" -msgstr "在 Route 或 Controller 內,可以通過 `view` 全域輔助函式來回傳 Blade 樣板。當然,就像在 [View](/docs/{{version}}/views) 說明文件內講的一樣,使用 `view` 輔助函式的第二個引數,就可以將資料傳給 Blade View:" +# P +#: ./docs/9.x/blade.md:43 +#: ./docs/10.x/blade.md:43 +#: ./docs/11.x/blade.md:44 +#: ./docs/master/blade.md:43 +msgid "[Rendering Blade Fragments](#rendering-blade-fragments)" +msgstr "" + +# P +#: ./docs/8.x/blade.md:45 +msgid "Blade views may be returned from routes or controller using the global `view` helper. Of course, as mentioned in the documentation on [views](/docs/{{version}}/views), data may be passed to the Blade view using the `view` helper's second argument:" +msgstr "" -#: docs/10.x/blade.md:block 7 (code) +# CODE +#: ./docs/8.x/blade.md:47 +#: ./docs/9.x/blade.md:55 +#: ./docs/10.x/blade.md:55 +#: ./docs/11.x/blade.md:56 +#: ./docs/master/blade.md:55 msgid "Route::get('/', function () {\n" " return view('greeting', ['name' => 'Finn']);\n" -"});\n" -msgstr "Route::get('/', function () {\n" -" return view('greeting', ['name' => 'Finn']);\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/blade.md:block 9 (header) -msgid "Supercharging Blade With Livewire" -msgstr "使用 Livewire 來增強 Blade 的功能" +# P +#: ./docs/8.x/blade.md:51 +msgid "Want to take your Blade templates to the next level and build dynamic interfaces with ease? Check out [Laravel Livewire](https://laravel-livewire.com)." +msgstr "" -#: docs/10.x/blade.md:block 10 (paragraph) -msgid "Want to take your Blade templates to the next level and build dynamic interfaces with ease? Check out [Laravel Livewire](https://livewire.laravel.com). Livewire allows you to write Blade components that are augmented with dynamic functionality that would typically only be possible via frontend frameworks like React or Vue, providing a great approach to building modern, reactive frontends without the complexities, client-side rendering, or build steps of many JavaScript frameworks." -msgstr "想讓你的 Blade 樣板更進一步增加功能,並輕鬆使用 Blade 製作動態界面嗎?請參考看看 [Laravel Livewire](https://livewire.laravel.com)。原本只能通過 React 或 Vue 等前端框架才能達成的動態功能,使用 Liveware 後,你只需要撰寫 Blade 元件就可以實現了,不需要增加專案複雜度、不需要使用前端轉譯、不用麻煩地處理建置各種 JavaScript 框架,就能建立現代、互動性的前端。" +# P +#: ./docs/8.x/blade.md:53 +#: ./docs/9.x/blade.md:64 +#: ./docs/10.x/blade.md:64 +#: ./docs/11.x/blade.md:65 +#: ./docs/master/blade.md:64 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/blade.md:53 +#: ./docs/10.x/blade.md:53 +#: ./docs/11.x/blade.md:54 +#: ./docs/master/blade.md:53 +msgid "Blade views may be returned from routes or controllers using the global `view` helper. Of course, as mentioned in the documentation on [views](/docs/{{version}}/views), data may be passed to the Blade view using the `view` helper's second argument:" +msgstr "" -#: docs/10.x/blade.md:block 12 (header) +# H2 +#: ./docs/8.x/blade.md:54 +#: ./docs/9.x/blade.md:65 +#: ./docs/10.x/blade.md:65 +#: ./docs/11.x/blade.md:66 +#: ./docs/master/blade.md:65 msgid "Displaying Data" -msgstr "顯示資料" +msgstr "" -#: docs/10.x/blade.md:block 13 (paragraph) +# P +#: ./docs/8.x/blade.md:56 +#: ./docs/9.x/blade.md:67 +#: ./docs/10.x/blade.md:67 +#: ./docs/11.x/blade.md:68 +#: ./docs/master/blade.md:67 msgid "You may display data that is passed to your Blade views by wrapping the variable in curly braces. For example, given the following route:" -msgstr "可以通過將變數以大括號包裝起來來顯示傳給 Blade View 的資料。舉例來說,假設有下列路由:" +msgstr "" -#: docs/10.x/blade.md:block 14 (code) +# CODE +#: ./docs/8.x/blade.md:58 +#: ./docs/9.x/blade.md:69 +#: ./docs/10.x/blade.md:69 +#: ./docs/11.x/blade.md:70 +#: ./docs/master/blade.md:69 msgid "Route::get('/', function () {\n" " return view('welcome', ['name' => 'Samantha']);\n" -"});\n" -msgstr "Route::get('/', function () {\n" -" return view('welcome', ['name' => 'Samantha']);\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/blade.md:block 15 (paragraph) +# P +#: ./docs/9.x/blade.md:59 +#: ./docs/10.x/blade.md:59 +#: ./docs/11.x/blade.md:60 +#: ./docs/master/blade.md:59 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/blade.md:60 +#: ./docs/10.x/blade.md:60 +#: ./docs/11.x/blade.md:61 +#: ./docs/master/blade.md:60 +msgid "Supercharging Blade With Livewire" +msgstr "" + +# P +#: ./docs/10.x/blade.md:62 +#: ./docs/11.x/blade.md:63 +#: ./docs/master/blade.md:62 +msgid "Want to take your Blade templates to the next level and build dynamic interfaces with ease? Check out [Laravel Livewire](https://livewire.laravel.com). Livewire allows you to write Blade components that are augmented with dynamic functionality that would typically only be possible via frontend frameworks like React or Vue, providing a great approach to building modern, reactive frontends without the complexities, client-side rendering, or build steps of many JavaScript frameworks." +msgstr "" + +# P +#: ./docs/8.x/blade.md:62 +#: ./docs/9.x/blade.md:73 +#: ./docs/10.x/blade.md:73 +#: ./docs/11.x/blade.md:74 +#: ./docs/master/blade.md:73 msgid "You may display the contents of the `name` variable like so:" -msgstr "可以像這樣顯示 `name` 變數的內容:" +msgstr "" + +# P +#: ./docs/9.x/blade.md:62 +msgid "Want to take your Blade templates to the next level and build dynamic interfaces with ease? Check out [Laravel Livewire](https://laravel-livewire.com). Livewire allows you to write Blade components that are augmented with dynamic functionality that would typically only be possible via frontend frameworks like React or Vue, providing a great approach to building modern, reactive frontends without the complexities, client-side rendering, or build steps of many JavaScript frameworks." +msgstr "" -#: docs/10.x/blade.md:block 16 (code) -msgid "Hello, {{ $name }}.\n" -msgstr "Hello, {{ $name }}.\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:64 +#: ./docs/9.x/blade.md:75 +#: ./docs/10.x/blade.md:75 +#: ./docs/11.x/blade.md:76 +#: ./docs/master/blade.md:75 +msgid "Hello, {{ $name }}." +msgstr "" -#: docs/10.x/blade.md:block 17 (quote) -msgid "**Note** Blade's `{{ }}` echo statements are automatically sent through PHP's `htmlspecialchars` function to prevent XSS attacks." -msgstr "**Note** Blade 的 `{{ }}` echo 陳述式會自動通過 PHP 的 `htmlspecialchars` 函式來防止 XSS 攻擊。" +# P +#: ./docs/8.x/blade.md:66 +#: ./docs/9.x/blade.md:80 +#: ./docs/10.x/blade.md:80 +#: ./docs/11.x/blade.md:81 +#: ./docs/master/blade.md:80 +msgid "Blade's `{{ }}` echo statements are automatically sent through PHP's `htmlspecialchars` function to prevent XSS attacks." +msgstr "" -#: docs/10.x/blade.md:block 18 (paragraph) +# P +#: ./docs/8.x/blade.md:68 +#: ./docs/9.x/blade.md:82 +#: ./docs/10.x/blade.md:82 +#: ./docs/11.x/blade.md:83 +#: ./docs/master/blade.md:82 msgid "You are not limited to displaying the contents of the variables passed to the view. You may also echo the results of any PHP function. In fact, you can put any PHP code you wish inside of a Blade echo statement:" -msgstr "在 Blade 中不只可以顯示傳進來的變數,還可以 echo 任何 PHP 函式的回傳值。事實上,可以在 Blade 的 echo 陳述式中放入任何的 PHP 程式碼:" +msgstr "" -#: docs/10.x/blade.md:block 19 (code) -msgid "The current UNIX timestamp is {{ time() }}.\n" -msgstr "現在的 Unix 時戳是 {{ time() }}。\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:70 +#: ./docs/9.x/blade.md:84 +#: ./docs/10.x/blade.md:84 +#: ./docs/11.x/blade.md:85 +#: ./docs/master/blade.md:84 +msgid "The current UNIX timestamp is {{ time() }}." +msgstr "" -#: docs/10.x/blade.md:block 21 (header) +# P +#: ./docs/8.x/blade.md:72 +#: ./docs/9.x/blade.md:88 +#: ./docs/10.x/blade.md:88 +#: ./docs/11.x/blade.md:89 +#: ./docs/master/blade.md:88 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:73 +#: ./docs/9.x/blade.md:89 +#: ./docs/10.x/blade.md:89 +#: ./docs/11.x/blade.md:90 +#: ./docs/master/blade.md:89 msgid "HTML Entity Encoding" -msgstr "HTML 實體編碼" +msgstr "" -#: docs/10.x/blade.md:block 22 (paragraph) -msgid "By default, Blade (and the Laravel `e` function) will double encode HTML entities. If you would like to disable double encoding, call the `Blade::withoutDoubleEncoding` method from the `boot` method of your `AppServiceProvider`:" -msgstr "預設情況下,Blade (以及 Laravel 的 `e` 函式) 會重複轉譯 HTML 實體 (Double Encode)。若不像被重複轉譯,請在 `AppServiceProvider` 內的 `boot` 方法中呼叫 `Blade::withoutDoubleEncoding` 方法:" +# P +#: ./docs/8.x/blade.md:75 +#: ./docs/9.x/blade.md:91 +msgid "By default, Blade (and the Laravel `e` helper) will double encode HTML entities. If you would like to disable double encoding, call the `Blade::withoutDoubleEncoding` method from the `boot` method of your `AppServiceProvider`:" +msgstr "" -#: docs/10.x/blade.md:block 23 (code) +# CODE +#: ./docs/8.x/blade.md:77 +#: ./docs/9.x/blade.md:93 msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:98 +#: ./docs/9.x/blade.md:114 +#: ./docs/10.x/blade.md:112 +#: ./docs/11.x/blade.md:113 +#: ./docs/master/blade.md:112 msgid "Displaying Unescaped Data" -msgstr "顯示未逸出的資料" +msgstr "" -#: docs/10.x/blade.md:block 26 (paragraph) +# P +#: ./docs/8.x/blade.md:100 +#: ./docs/9.x/blade.md:116 +#: ./docs/10.x/blade.md:114 +#: ./docs/11.x/blade.md:115 +#: ./docs/master/blade.md:114 msgid "By default, Blade `{{ }}` statements are automatically sent through PHP's `htmlspecialchars` function to prevent XSS attacks. If you do not want your data to be escaped, you may use the following syntax:" -msgstr "預設情況下,Blade 的 `{{ }}` 陳述式會自動通過 PHP 的 `htmlspecialchars` 函式來防止 XSS 攻擊。若不想要逸出資料,可以使用下列語法:" +msgstr "" -#: docs/10.x/blade.md:block 27 (code) -msgid "Hello, {!! $name !!}.\n" -msgstr "Hello, {!! $name !!}.\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:102 +#: ./docs/9.x/blade.md:118 +#: ./docs/10.x/blade.md:116 +#: ./docs/11.x/blade.md:117 +#: ./docs/master/blade.md:116 +msgid "Hello, {!! $name !!}." +msgstr "" -#: docs/10.x/blade.md:block 28 (quote) -msgid "**Warning** Be very careful when echoing content that is supplied by users of your application. You should typically use the escaped, double curly brace syntax to prevent XSS attacks when displaying user supplied data." -msgstr "**Warning** 在輸出使用者提供的資料時,請格外小心。平常在顯示使用者提供的資料時應該要使用經過逸出的雙大括號語法來防止 XSS 攻擊。" +# P +#: ./docs/8.x/blade.md:104 +#: ./docs/9.x/blade.md:123 +#: ./docs/10.x/blade.md:121 +#: ./docs/11.x/blade.md:122 +#: ./docs/master/blade.md:121 +msgid "Be very careful when echoing content that is supplied by users of your application. You should typically use the escaped, double curly brace syntax to prevent XSS attacks when displaying user supplied data." +msgstr "" -#: docs/10.x/blade.md:block 30 (header) +# P +#: ./docs/8.x/blade.md:106 +#: ./docs/9.x/blade.md:125 +#: ./docs/10.x/blade.md:123 +#: ./docs/11.x/blade.md:124 +#: ./docs/master/blade.md:123 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:107 +#: ./docs/9.x/blade.md:126 msgid "Blade & JavaScript Frameworks" -msgstr "Blade 與 JavaScript 框架" +msgstr "" -#: docs/10.x/blade.md:block 31 (paragraph) +# P +#: ./docs/8.x/blade.md:109 +#: ./docs/9.x/blade.md:128 +#: ./docs/10.x/blade.md:126 +#: ./docs/11.x/blade.md:127 +#: ./docs/master/blade.md:126 msgid "Since many JavaScript frameworks also use \"curly\" braces to indicate a given expression should be displayed in the browser, you may use the `@` symbol to inform the Blade rendering engine an expression should remain untouched. For example:" -msgstr "由於許多 JavaScript 框架都使用「大括號」來判斷給定的運算式應顯示在瀏覽器上,因此可以使用 `@` 符號來告訴 Blade 轉譯引擎不應修改該運算式。如:" +msgstr "" -#: docs/10.x/blade.md:block 32 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:111 +#: ./docs/9.x/blade.md:130 +#: ./docs/10.x/blade.md:128 +#: ./docs/11.x/blade.md:129 +#: ./docs/master/blade.md:128 msgid "

Laravel

\n\n" -"Hello, @{{ name }}.\n" -msgstr "

Laravel

\n\n" -"Hello, @{{ name }}.\n" +"Hello, @{{ name }}." +msgstr "" -#: docs/10.x/blade.md:block 33 (paragraph) +# P +#: ./docs/8.x/blade.md:115 +#: ./docs/9.x/blade.md:136 +#: ./docs/10.x/blade.md:134 +#: ./docs/11.x/blade.md:135 +#: ./docs/master/blade.md:134 msgid "In this example, the `@` symbol will be removed by Blade; however, `{{ name }}` expression will remain untouched by the Blade engine, allowing it to be rendered by your JavaScript framework." -msgstr "在這個例子中,Blade 會將 `@` 符號逸出。而 `{{ name }}` 運算式則不會被 Blade 引擎處理,這樣一來便可讓 JavaScript 框架進行轉譯。" +msgstr "" -#: docs/10.x/blade.md:block 34 (paragraph) +# P +#: ./docs/8.x/blade.md:117 +#: ./docs/9.x/blade.md:138 +#: ./docs/10.x/blade.md:136 +#: ./docs/11.x/blade.md:137 +#: ./docs/master/blade.md:136 msgid "The `@` symbol may also be used to escape Blade directives:" -msgstr "`@` 符號也可用來逸出 Blade 指示詞:" +msgstr "" -#: docs/10.x/blade.md:block 35 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:119 +#: ./docs/9.x/blade.md:140 +#: ./docs/10.x/blade.md:138 +#: ./docs/11.x/blade.md:139 +#: ./docs/master/blade.md:138 msgid "{{-- Blade template --}}\n" "@@if()\n\n" "\n" -"@if()\n" -msgstr "{{-- Blade 樣板 --}}\n" -"@@if()\n\n" -"\n" -"@if()\n" +"@if()" +msgstr "" -#: docs/10.x/blade.md:block 37 (header) +# H3 +#: ./docs/10.x/blade.md:124 +#: ./docs/11.x/blade.md:125 +#: ./docs/master/blade.md:124 +msgid "Blade and JavaScript Frameworks" +msgstr "" + +# P +#: ./docs/8.x/blade.md:125 +#: ./docs/9.x/blade.md:148 +#: ./docs/10.x/blade.md:146 +#: ./docs/11.x/blade.md:147 +#: ./docs/master/blade.md:146 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:126 +#: ./docs/9.x/blade.md:149 +#: ./docs/10.x/blade.md:147 +#: ./docs/11.x/blade.md:148 +#: ./docs/master/blade.md:147 msgid "Rendering JSON" -msgstr "轉譯 JSON" +msgstr "" -#: docs/10.x/blade.md:block 38 (paragraph) +# P +#: ./docs/8.x/blade.md:128 +#: ./docs/9.x/blade.md:151 +#: ./docs/10.x/blade.md:149 +#: ./docs/11.x/blade.md:150 +#: ./docs/master/blade.md:149 msgid "Sometimes you may pass an array to your view with the intention of rendering it as JSON in order to initialize a JavaScript variable. For example:" -msgstr "有時候將陣列傳進 View 是為了將其轉譯為 JSON 來初始化 JavaScript 變數。如:" +msgstr "" -#: docs/10.x/blade.md:block 39 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:130 +#: ./docs/9.x/blade.md:153 +#: ./docs/10.x/blade.md:151 +#: ./docs/11.x/blade.md:152 +#: ./docs/master/blade.md:151 msgid "\n" -msgstr "\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 40 (paragraph) +# P +#: ./docs/8.x/blade.md:134 +#: ./docs/9.x/blade.md:159 +#: ./docs/10.x/blade.md:157 +#: ./docs/11.x/blade.md:158 +#: ./docs/master/blade.md:157 msgid "However, instead of manually calling `json_encode`, you may use the `Illuminate\\Support\\Js::from` method directive. The `from` method accepts the same arguments as PHP's `json_encode` function; however, it will ensure that the resulting JSON is properly escaped for inclusion within HTML quotes. The `from` method will return a string `JSON.parse` JavaScript statement that will convert the given object or array into a valid JavaScript object:" -msgstr "不過,比起手動呼叫 `json_encode`,我們應使用 `Illuminate\\Support\\Js::from` 方法指示詞。`from` 方法接受的引數與 PHP 的 `json_encode` 函式相同;不過,`from` 方法會確保即使時在 HTML 引號內,也能正確逸出 JSON。`from` 方法會回傳一個 `JSON.parse` JavaScript 陳述式字串,該陳述式會將給定的物件或陣列轉換為有效的 JavaScript 物件:" +msgstr "" -#: docs/10.x/blade.md:block 41 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:136 +#: ./docs/9.x/blade.md:161 +#: ./docs/10.x/blade.md:159 +#: ./docs/11.x/blade.md:160 +#: ./docs/master/blade.md:159 msgid "\n" -msgstr "\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 42 (paragraph) +# P +#: ./docs/8.x/blade.md:140 +#: ./docs/9.x/blade.md:167 +#: ./docs/10.x/blade.md:165 +#: ./docs/11.x/blade.md:166 +#: ./docs/master/blade.md:165 msgid "The latest versions of the Laravel application skeleton include a `Js` facade, which provides convenient access to this functionality within your Blade templates:" -msgstr "最新版本的 Laravel 專案 Skeleton 包含了一個 `Js` Facade。使用這個 Facade 就能方便地在 Blade 樣板中存取這個功能:" +msgstr "" -#: docs/10.x/blade.md:block 43 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:142 +#: ./docs/9.x/blade.md:169 +#: ./docs/10.x/blade.md:167 +#: ./docs/11.x/blade.md:168 +#: ./docs/master/blade.md:167 msgid "\n" -msgstr "\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 44 (quote) -msgid "**Warning** You should only use the `Js::from` method to render existing variables as JSON. The Blade templating is based on regular expressions and attempts to pass a complex expression to the directive may cause unexpected failures." -msgstr "**Warning** 請只在轉譯現有變數為 JSON 時使用 `Js::from` 方法。Blade 樣板引擎是是基於正規標示式實作的,若將複雜的陳述式傳給指示詞可能會導致未預期的錯誤。" +# P +#: ./docs/8.x/blade.md:146 +#: ./docs/9.x/blade.md:176 +#: ./docs/10.x/blade.md:174 +#: ./docs/11.x/blade.md:175 +#: ./docs/master/blade.md:174 +msgid "You should only use the `Js::from` method to render existing variables as JSON. The Blade templating is based on regular expressions and attempts to pass a complex expression to the directive may cause unexpected failures." +msgstr "" -#: docs/10.x/blade.md:block 46 (header) +# P +#: ./docs/8.x/blade.md:148 +#: ./docs/9.x/blade.md:178 +#: ./docs/10.x/blade.md:176 +#: ./docs/11.x/blade.md:177 +#: ./docs/master/blade.md:176 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:149 +#: ./docs/9.x/blade.md:179 +#: ./docs/10.x/blade.md:177 +#: ./docs/11.x/blade.md:178 +#: ./docs/master/blade.md:177 msgid "The `@verbatim` Directive" -msgstr "`@verbatim` 指示詞" +msgstr "" -#: docs/10.x/blade.md:block 47 (paragraph) +# P +#: ./docs/8.x/blade.md:151 +#: ./docs/9.x/blade.md:181 +#: ./docs/10.x/blade.md:179 +#: ./docs/11.x/blade.md:180 +#: ./docs/master/blade.md:179 msgid "If you are displaying JavaScript variables in a large portion of your template, you may wrap the HTML in the `@verbatim` directive so that you do not have to prefix each Blade echo statement with an `@` symbol:" -msgstr "若在樣板中顯示了很多的 JavaScript 變數,則可以將 HTML 包裝在 `@verbatim` 指示詞內。這樣一來就不需要在每個 Blade 的 echo 陳述式前面加上前置 `@` 符號:" +msgstr "" -#: docs/10.x/blade.md:block 48 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:153 +#: ./docs/9.x/blade.md:183 +#: ./docs/10.x/blade.md:181 +#: ./docs/11.x/blade.md:182 +#: ./docs/master/blade.md:181 msgid "@verbatim\n" "
\n" " Hello, {{ name }}.\n" "
\n" -"@endverbatim\n" -msgstr "@verbatim\n" -"
\n" -" Hello, {{ name }}.\n" -"
\n" -"@endverbatim\n" +"@endverbatim" +msgstr "" -#: docs/10.x/blade.md:block 50 (header) +# P +#: ./docs/8.x/blade.md:159 +#: ./docs/9.x/blade.md:191 +#: ./docs/10.x/blade.md:189 +#: ./docs/11.x/blade.md:190 +#: ./docs/master/blade.md:189 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/blade.md:160 +#: ./docs/9.x/blade.md:192 +#: ./docs/10.x/blade.md:190 +#: ./docs/11.x/blade.md:191 +#: ./docs/master/blade.md:190 msgid "Blade Directives" -msgstr "Blade 指示詞" +msgstr "" -#: docs/10.x/blade.md:block 51 (paragraph) +# P +#: ./docs/8.x/blade.md:162 +#: ./docs/9.x/blade.md:194 +#: ./docs/10.x/blade.md:192 +#: ./docs/11.x/blade.md:193 +#: ./docs/master/blade.md:192 msgid "In addition to template inheritance and displaying data, Blade also provides convenient shortcuts for common PHP control structures, such as conditional statements and loops. These shortcuts provide a very clean, terse way of working with PHP control structures while also remaining familiar to their PHP counterparts." -msgstr "除了繼承樣板與顯示資料外,Blade 也提供了常見 PHP 流程控制結構的方便捷徑,如條件陳述式以及迴圈。這些捷徑提供了一種非常乾淨簡介的方式來處理 PHP 流程控制,同時也保持了與 PHP 的相似性。" +msgstr "" -#: docs/10.x/blade.md:block 53 (header) +# P +#: ./docs/8.x/blade.md:164 +#: ./docs/9.x/blade.md:196 +#: ./docs/10.x/blade.md:194 +#: ./docs/11.x/blade.md:195 +#: ./docs/master/blade.md:194 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:165 +#: ./docs/9.x/blade.md:197 +#: ./docs/10.x/blade.md:195 +#: ./docs/11.x/blade.md:196 +#: ./docs/master/blade.md:195 msgid "If Statements" -msgstr "If 陳述式" +msgstr "" -#: docs/10.x/blade.md:block 54 (paragraph) +# P +#: ./docs/8.x/blade.md:167 +#: ./docs/9.x/blade.md:199 +#: ./docs/10.x/blade.md:197 +#: ./docs/11.x/blade.md:198 +#: ./docs/master/blade.md:197 msgid "You may construct `if` statements using the `@if`, `@elseif`, `@else`, and `@endif` directives. These directives function identically to their PHP counterparts:" -msgstr "可以通過 `@if`, `@elseif`, `@else` 與 `@endif` 指示詞來架構 `if` 陳述式。這些指示詞的功能與其 PHP 對應的部分相同:" +msgstr "" -#: docs/10.x/blade.md:block 55 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:169 +#: ./docs/9.x/blade.md:201 +#: ./docs/10.x/blade.md:199 +#: ./docs/11.x/blade.md:200 +#: ./docs/master/blade.md:199 msgid "@if (count($records) === 1)\n" " I have one record!\n" "@elseif (count($records) > 1)\n" " I have multiple records!\n" "@else\n" " I don't have any records!\n" -"@endif\n" -msgstr "@if (count($records) === 1)\n" -" 這裡有 1 筆記錄!\n" -"@elseif (count($records) > 1)\n" -" 這裡有多筆記錄!\n" -"@else\n" -" 這裡沒有任何記錄!\n" -"@endif\n" +"@endif" +msgstr "" -#: docs/10.x/blade.md:block 56 (paragraph) +# P +#: ./docs/8.x/blade.md:177 +#: ./docs/9.x/blade.md:211 +#: ./docs/10.x/blade.md:209 +#: ./docs/11.x/blade.md:210 +#: ./docs/master/blade.md:209 msgid "For convenience, Blade also provides an `@unless` directive:" -msgstr "為了方便起見,Blade 也提供了一個 `@unless` 指示詞:" +msgstr "" -#: docs/10.x/blade.md:block 57 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:179 +#: ./docs/9.x/blade.md:213 +#: ./docs/10.x/blade.md:211 +#: ./docs/11.x/blade.md:212 +#: ./docs/master/blade.md:211 msgid "@unless (Auth::check())\n" " You are not signed in.\n" -"@endunless\n" -msgstr "@unless (Auth::check())\n" -" 你還沒有登入。\n" -"@endunless\n" +"@endunless" +msgstr "" -#: docs/10.x/blade.md:block 58 (paragraph) +# P +#: ./docs/8.x/blade.md:183 +#: ./docs/9.x/blade.md:219 +#: ./docs/10.x/blade.md:217 +#: ./docs/11.x/blade.md:218 +#: ./docs/master/blade.md:217 msgid "In addition to the conditional directives already discussed, the `@isset` and `@empty` directives may be used as convenient shortcuts for their respective PHP functions:" -msgstr "除了已經討論過的條件指示詞外,也可以通過 `@isset` 與 `@empty` 指示詞來作為其對應 PHP 函式的方便捷徑:" +msgstr "" -#: docs/10.x/blade.md:block 59 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:185 +#: ./docs/9.x/blade.md:221 +#: ./docs/10.x/blade.md:219 +#: ./docs/11.x/blade.md:220 +#: ./docs/master/blade.md:219 msgid "@isset($records)\n" " // $records is defined and is not null...\n" "@endisset\n\n" "@empty($records)\n" " // $records is \"empty\"...\n" -"@endempty\n" -msgstr "@isset($records)\n" -" // $records 已定義且不為 null...\n" -"@endisset\n\n" -"@empty($records)\n" -" // $records 為「空」...\n" -"@endempty\n" +"@endempty" +msgstr "" -#: docs/10.x/blade.md:block 61 (header) +# P +#: ./docs/8.x/blade.md:193 +#: ./docs/9.x/blade.md:231 +#: ./docs/10.x/blade.md:229 +#: ./docs/11.x/blade.md:230 +#: ./docs/master/blade.md:229 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:194 +#: ./docs/9.x/blade.md:232 +#: ./docs/10.x/blade.md:230 +#: ./docs/11.x/blade.md:231 +#: ./docs/master/blade.md:230 msgid "Authentication Directives" -msgstr "認證指示詞" +msgstr "" -#: docs/10.x/blade.md:block 62 (paragraph) +# P +#: ./docs/8.x/blade.md:196 +#: ./docs/9.x/blade.md:234 +#: ./docs/10.x/blade.md:232 +#: ./docs/11.x/blade.md:233 +#: ./docs/master/blade.md:232 msgid "The `@auth` and `@guest` directives may be used to quickly determine if the current user is [authenticated](/docs/{{version}}/authentication) or is a guest:" -msgstr "`@auth` 與 `@guest` 指示詞可以用來快速判斷目前的使用者是否[已登入](/docs/{{version}}/authentication),或是該使用者是否為訪客:" +msgstr "" -#: docs/10.x/blade.md:block 63 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:198 +#: ./docs/9.x/blade.md:236 +#: ./docs/10.x/blade.md:234 +#: ./docs/11.x/blade.md:235 +#: ./docs/master/blade.md:234 msgid "@auth\n" " // The user is authenticated...\n" "@endauth\n\n" "@guest\n" " // The user is not authenticated...\n" -"@endguest\n" -msgstr "@auth\n" -" // 使用者已登入...\n" -"@endauth\n\n" -"@guest\n" -" // 使用者未登入...\n" -"@endguest\n" +"@endguest" +msgstr "" -#: docs/10.x/blade.md:block 64 (paragraph) +# P +#: ./docs/8.x/blade.md:206 +#: ./docs/9.x/blade.md:246 +#: ./docs/10.x/blade.md:244 +#: ./docs/11.x/blade.md:245 +#: ./docs/master/blade.md:244 msgid "If needed, you may specify the authentication guard that should be checked when using the `@auth` and `@guest` directives:" -msgstr "若有需要,可以在使用 `@auth` 與 `@guest` 指示詞時指定要使用哪個認證 Guard 來做檢查:" +msgstr "" -#: docs/10.x/blade.md:block 65 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:208 +#: ./docs/9.x/blade.md:248 +#: ./docs/10.x/blade.md:246 +#: ./docs/11.x/blade.md:247 +#: ./docs/master/blade.md:246 msgid "@auth('admin')\n" " // The user is authenticated...\n" "@endauth\n\n" "@guest('admin')\n" " // The user is not authenticated...\n" -"@endguest\n" -msgstr "@auth('admin')\n" -" // 使用者已登入...\n" -"@endauth\n\n" -"@guest('admin')\n" -" // 使用者未登入...\n" -"@endguest\n" +"@endguest" +msgstr "" -#: docs/10.x/blade.md:block 67 (header) +# P +#: ./docs/8.x/blade.md:216 +#: ./docs/9.x/blade.md:258 +#: ./docs/10.x/blade.md:256 +#: ./docs/11.x/blade.md:257 +#: ./docs/master/blade.md:256 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:217 +#: ./docs/9.x/blade.md:259 +#: ./docs/10.x/blade.md:257 +#: ./docs/11.x/blade.md:258 +#: ./docs/master/blade.md:257 msgid "Environment Directives" -msgstr "環境指示詞" +msgstr "" -#: docs/10.x/blade.md:block 68 (paragraph) +# P +#: ./docs/8.x/blade.md:219 +#: ./docs/9.x/blade.md:261 +#: ./docs/10.x/blade.md:259 +#: ./docs/11.x/blade.md:260 +#: ./docs/master/blade.md:259 msgid "You may check if the application is running in the production environment using the `@production` directive:" -msgstr "可以通過 `@production` 指示詞來判斷網站目前是否在正式環境上執行:" +msgstr "" -#: docs/10.x/blade.md:block 69 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:221 +#: ./docs/9.x/blade.md:263 +#: ./docs/10.x/blade.md:261 +#: ./docs/11.x/blade.md:262 +#: ./docs/master/blade.md:261 msgid "@production\n" " // Production specific content...\n" -"@endproduction\n" -msgstr "@production\n" -" // 只在正式環境上顯示的內容...\n" -"@endproduction\n" +"@endproduction" +msgstr "" -#: docs/10.x/blade.md:block 70 (paragraph) +# P +#: ./docs/8.x/blade.md:225 +#: ./docs/9.x/blade.md:269 +#: ./docs/10.x/blade.md:267 +#: ./docs/11.x/blade.md:268 +#: ./docs/master/blade.md:267 msgid "Or, you may determine if the application is running in a specific environment using the `@env` directive:" -msgstr "或者,可以通過 `@env` 指示詞來判斷網站是否在特定的環境上執行:" +msgstr "" -#: docs/10.x/blade.md:block 71 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:227 +#: ./docs/9.x/blade.md:271 +#: ./docs/10.x/blade.md:269 +#: ./docs/11.x/blade.md:270 +#: ./docs/master/blade.md:269 msgid "@env('staging')\n" " // The application is running in \"staging\"...\n" "@endenv\n\n" "@env(['staging', 'production'])\n" " // The application is running in \"staging\" or \"production\"...\n" -"@endenv\n" -msgstr "@env('staging')\n" -" // 專案在「staging」環境上執行...\n" -"@endenv\n\n" -"@env(['staging', 'production'])\n" -" // 專案在「staging」或「production」上執行...\n" -"@endenv\n" +"@endenv" +msgstr "" -#: docs/10.x/blade.md:block 73 (header) +# P +#: ./docs/8.x/blade.md:235 +#: ./docs/9.x/blade.md:281 +#: ./docs/10.x/blade.md:279 +#: ./docs/11.x/blade.md:280 +#: ./docs/master/blade.md:279 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:236 +#: ./docs/9.x/blade.md:282 +#: ./docs/10.x/blade.md:280 +#: ./docs/11.x/blade.md:281 +#: ./docs/master/blade.md:280 msgid "Section Directives" -msgstr "段落指示詞" +msgstr "" -#: docs/10.x/blade.md:block 74 (paragraph) +# P +#: ./docs/8.x/blade.md:238 +#: ./docs/9.x/blade.md:284 +#: ./docs/10.x/blade.md:282 +#: ./docs/11.x/blade.md:283 +#: ./docs/master/blade.md:282 msgid "You may determine if a template inheritance section has content using the `@hasSection` directive:" -msgstr "可以通過 `@hasSection` 指示詞來判斷某個樣板繼承段落是否有內容:" +msgstr "" -#: docs/10.x/blade.md:block 75 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:240 +#: ./docs/9.x/blade.md:286 +#: ./docs/10.x/blade.md:284 +#: ./docs/11.x/blade.md:285 +#: ./docs/master/blade.md:284 msgid "@hasSection('navigation')\n" "
\n" " @yield('navigation')\n" "
\n\n" "
\n" -"@endif\n" -msgstr "@hasSection('navigation')\n" -"
\n" -" @yield('navigation')\n" -"
\n\n" -"
\n" -"@endif\n" +"@endif" +msgstr "" -#: docs/10.x/blade.md:block 76 (paragraph) +# P +#: ./docs/8.x/blade.md:250 +#: ./docs/10.x/blade.md:294 +#: ./docs/11.x/blade.md:295 +#: ./docs/master/blade.md:294 msgid "You may use the `sectionMissing` directive to determine if a section does not have content:" -msgstr "可以通過 `sectionMissing` 指示詞來判斷某個段落是否沒有內容:" +msgstr "" -#: docs/10.x/blade.md:block 77 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:252 +#: ./docs/9.x/blade.md:298 +#: ./docs/10.x/blade.md:296 +#: ./docs/11.x/blade.md:297 +#: ./docs/master/blade.md:296 msgid "@sectionMissing('navigation')\n" "
\n" " @include('default-navigation')\n" "
\n" -"@endif\n" -msgstr "@sectionMissing('navigation')\n" -"
\n" -" @include('default-navigation')\n" -"
\n" -"@endif\n" +"@endif" +msgstr "" -#: docs/10.x/blade.md:block 79 (header) +# P +#: ./docs/8.x/blade.md:260 +#: ./docs/9.x/blade.md:306 +#: ./docs/10.x/blade.md:317 +#: ./docs/11.x/blade.md:318 +#: ./docs/master/blade.md:317 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:261 +#: ./docs/9.x/blade.md:307 +#: ./docs/10.x/blade.md:318 +#: ./docs/11.x/blade.md:319 +#: ./docs/master/blade.md:318 msgid "Switch Statements" -msgstr "Switch 陳述式" +msgstr "" -#: docs/10.x/blade.md:block 80 (paragraph) +# P +#: ./docs/8.x/blade.md:263 +#: ./docs/9.x/blade.md:309 +#: ./docs/10.x/blade.md:320 +#: ./docs/11.x/blade.md:321 +#: ./docs/master/blade.md:320 msgid "Switch statements can be constructed using the `@switch`, `@case`, `@break`, `@default` and `@endswitch` directives:" -msgstr "Switch 陳述式可以通過 `@switch`, `@case`, `@break`, `@default` 與 `@endswitch` 指示詞來架構:" +msgstr "" -#: docs/10.x/blade.md:block 81 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:265 +#: ./docs/9.x/blade.md:311 +#: ./docs/10.x/blade.md:322 +#: ./docs/11.x/blade.md:323 +#: ./docs/master/blade.md:322 msgid "@switch($i)\n" " @case(1)\n" " First case...\n" @@ -598,27 +1462,43 @@ msgid "@switch($i)\n" " @break\n\n" " @default\n" " Default case...\n" -"@endswitch\n" -msgstr "@switch($i)\n" -" @case(1)\n" -" 第一個 case...\n" -" @break\n\n" -" @case(2)\n" -" 第二個 case...\n" -" @break\n\n" -" @default\n" -" Default case...\n" -"@endswitch\n" +"@endswitch" +msgstr "" -#: docs/10.x/blade.md:block 83 (header) +# P +#: ./docs/8.x/blade.md:278 +#: ./docs/9.x/blade.md:326 +#: ./docs/10.x/blade.md:337 +#: ./docs/11.x/blade.md:338 +#: ./docs/master/blade.md:337 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:279 +#: ./docs/9.x/blade.md:327 +#: ./docs/10.x/blade.md:338 +#: ./docs/11.x/blade.md:339 +#: ./docs/master/blade.md:338 msgid "Loops" -msgstr "迴圈" +msgstr "" -#: docs/10.x/blade.md:block 84 (paragraph) +# P +#: ./docs/8.x/blade.md:281 +#: ./docs/9.x/blade.md:329 +#: ./docs/10.x/blade.md:340 +#: ./docs/11.x/blade.md:341 +#: ./docs/master/blade.md:340 msgid "In addition to conditional statements, Blade provides simple directives for working with PHP's loop structures. Again, each of these directives functions identically to their PHP counterparts:" -msgstr "除了條件陳述式外,Blade 也提供了能配合 PHP 的迴圈架構一起使用的一些簡單指示詞。同樣地,這些指示詞的功能都與其對應 PHP 的部分相同:" +msgstr "" -#: docs/10.x/blade.md:block 85 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:283 +#: ./docs/9.x/blade.md:331 +#: ./docs/10.x/blade.md:342 +#: ./docs/11.x/blade.md:343 +#: ./docs/master/blade.md:342 msgid "@for ($i = 0; $i < 10; $i++)\n" " The current value is {{ $i }}\n" "@endfor\n\n" @@ -632,31 +1512,49 @@ msgid "@for ($i = 0; $i < 10; $i++)\n" "@endforelse\n\n" "@while (true)\n" "

I'm looping forever.

\n" -"@endwhile\n" -msgstr "@for ($i = 0; $i < 10; $i++)\n" -" 目前值為 {{ $i }}\n" -"@endfor\n\n" -"@foreach ($users as $user)\n" -"

使用者 {{ $user->id }}

\n" -"@endforeach\n\n" -"@forelse ($users as $user)\n" -"
  • {{ $user->name }}
  • \n" -"@empty\n" -"

    無使用者

    \n" -"@endforelse\n\n" -"@while (true)\n" -"

    我會無限循環。

    \n" -"@endwhile\n" +"@endwhile" +msgstr "" -#: docs/10.x/blade.md:block 86 (quote) -msgid "**Note** While iterating through a `foreach` loop, you may use the [loop variable](#the-loop-variable) to gain valuable information about the loop, such as whether you are in the first or last iteration through the loop." -msgstr "**Note** 在使用 `foreach` 迴圈迭代時,可以使用[迴圈變數](#the-loop-variable)來取得有關迴圈的有用資訊,如目前是否在迴圈的第一次或最後一次迭代。" +# P +#: ./docs/9.x/blade.md:296 +msgid "You may use the `@sectionMissing` directive to determine if a section does not have content:" +msgstr "" -#: docs/10.x/blade.md:block 87 (paragraph) -msgid "When using loops you may also skip the current iteration or end the loop using the `@continue` and `@break` directives:" -msgstr "在使用迴圈時,我們可以使用 `@continue` 與 `@break` 指示詞來跳過目前的迭代或終止迴圈:" +# P +#: ./docs/8.x/blade.md:301 +#: ./docs/9.x/blade.md:352 +#: ./docs/10.x/blade.md:363 +#: ./docs/11.x/blade.md:364 +#: ./docs/master/blade.md:363 +msgid "While iterating through a `foreach` loop, you may use the [loop variable](#the-loop-variable) to gain valuable information about the loop, such as whether you are in the first or last iteration through the loop." +msgstr "" + +# P +#: ./docs/8.x/blade.md:303 +msgid "When using loops you may also end the loop or skip the current iteration using the `@continue` and `@break` directives:" +msgstr "" + +# P +#: ./docs/10.x/blade.md:304 +#: ./docs/11.x/blade.md:305 +#: ./docs/master/blade.md:304 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/blade.md:305 +#: ./docs/11.x/blade.md:306 +#: ./docs/master/blade.md:305 +msgid "Session Directives" +msgstr "" -#: docs/10.x/blade.md:block 88 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:305 +#: ./docs/9.x/blade.md:356 +#: ./docs/10.x/blade.md:367 +#: ./docs/11.x/blade.md:368 +#: ./docs/master/blade.md:367 msgid "@foreach ($users as $user)\n" " @if ($user->type == 1)\n" " @continue\n" @@ -665,42 +1563,84 @@ msgid "@foreach ($users as $user)\n" " @if ($user->number == 5)\n" " @break\n" " @endif\n" -"@endforeach\n" -msgstr "@foreach ($users as $user)\n" -" @if ($user->type == 1)\n" -" @continue\n" -" @endif\n\n" -"
  • {{ $user->name }}
  • \n\n" -" @if ($user->number == 5)\n" -" @break\n" -" @endif\n" -"@endforeach\n" +"@endforeach" +msgstr "" + +# P +#: ./docs/10.x/blade.md:307 +#: ./docs/11.x/blade.md:308 +#: ./docs/master/blade.md:307 +msgid "The `@session` directive may be used to determine if a [session](/docs/{{version}}/session) value exists. If the session value exists, the template contents within the `@session` and `@endsession` directives will be evaluated. Within the `@session` directive's contents, you may echo the `$value` variable to display the session value:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/blade.md:309 +#: ./docs/11.x/blade.md:310 +#: ./docs/master/blade.md:309 +msgid "@session('status')\n" +"
    \n" +" {{ $value }}\n" +"
    \n" +"@endsession" +msgstr "" -#: docs/10.x/blade.md:block 89 (paragraph) +# P +#: ./docs/8.x/blade.md:317 +#: ./docs/9.x/blade.md:370 +#: ./docs/10.x/blade.md:381 +#: ./docs/11.x/blade.md:382 +#: ./docs/master/blade.md:381 msgid "You may also include the continuation or break condition within the directive declaration:" -msgstr "也可以在指示詞定義中包含 continue 或 break 的條件:" +msgstr "" -#: docs/10.x/blade.md:block 90 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:319 +#: ./docs/9.x/blade.md:372 +#: ./docs/10.x/blade.md:383 +#: ./docs/11.x/blade.md:384 +#: ./docs/master/blade.md:383 msgid "@foreach ($users as $user)\n" " @continue($user->type == 1)\n\n" "
  • {{ $user->name }}
  • \n\n" " @break($user->number == 5)\n" -"@endforeach\n" -msgstr "@foreach ($users as $user)\n" -" @continue($user->type == 1)\n\n" -"
  • {{ $user->name }}
  • \n\n" -" @break($user->number == 5)\n" -"@endforeach\n" +"@endforeach" +msgstr "" -#: docs/10.x/blade.md:block 92 (header) +# P +#: ./docs/8.x/blade.md:327 +#: ./docs/9.x/blade.md:382 +#: ./docs/10.x/blade.md:393 +#: ./docs/11.x/blade.md:394 +#: ./docs/master/blade.md:393 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:328 +#: ./docs/9.x/blade.md:383 +#: ./docs/10.x/blade.md:394 +#: ./docs/11.x/blade.md:395 +#: ./docs/master/blade.md:394 msgid "The Loop Variable" -msgstr "迴圈變數" +msgstr "" -#: docs/10.x/blade.md:block 93 (paragraph) +# P +#: ./docs/8.x/blade.md:330 +#: ./docs/9.x/blade.md:385 +#: ./docs/10.x/blade.md:396 +#: ./docs/11.x/blade.md:397 +#: ./docs/master/blade.md:396 msgid "While iterating through a `foreach` loop, a `$loop` variable will be available inside of your loop. This variable provides access to some useful bits of information such as the current loop index and whether this is the first or last iteration through the loop:" -msgstr "在迭代 `foreach` 迴圈時,迴圈內提供了 `$loop` 變數可用。這個變數提供了許多實用的資訊,如目前的迴圈索引,以及本次迭代是否為迴圈的第一次或最後一次迭代:" +msgstr "" -#: docs/10.x/blade.md:block 94 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:332 +#: ./docs/9.x/blade.md:387 +#: ./docs/10.x/blade.md:398 +#: ./docs/11.x/blade.md:399 +#: ./docs/master/blade.md:398 msgid "@foreach ($users as $user)\n" " @if ($loop->first)\n" " This is the first iteration.\n" @@ -709,138 +1649,81 @@ msgid "@foreach ($users as $user)\n" " This is the last iteration.\n" " @endif\n\n" "

    This is user {{ $user->id }}

    \n" -"@endforeach\n" -msgstr "@foreach ($users as $user)\n" -" @if ($loop->first)\n" -" 第一次迭代。\n" -" @endif\n\n" -" @if ($loop->last)\n" -" 最後一次迭代。\n" -" @endif\n\n" -"

    使用者 {{ $user->id }}

    \n" -"@endforeach\n" +"@endforeach" +msgstr "" -#: docs/10.x/blade.md:block 95 (paragraph) +# P +#: ./docs/8.x/blade.md:344 +#: ./docs/9.x/blade.md:401 +#: ./docs/10.x/blade.md:412 +#: ./docs/11.x/blade.md:413 +#: ./docs/master/blade.md:412 msgid "If you are in a nested loop, you may access the parent loop's `$loop` variable via the `parent` property:" -msgstr "若在巢狀迴圈中,可以通過 `parent` 屬性來存取上層迴圈的 `$loop` 變數:" +msgstr "" -#: docs/10.x/blade.md:block 96 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:346 +#: ./docs/9.x/blade.md:403 +#: ./docs/10.x/blade.md:414 +#: ./docs/11.x/blade.md:415 +#: ./docs/master/blade.md:414 msgid "@foreach ($users as $user)\n" " @foreach ($user->posts as $post)\n" " @if ($loop->parent->first)\n" " This is the first iteration of the parent loop.\n" " @endif\n" " @endforeach\n" -"@endforeach\n" -msgstr "@foreach ($users as $user)\n" -" @foreach ($user->posts as $post)\n" -" @if ($loop->parent->first)\n" -" 這是上層迴圈的第一次迭代。\n" -" @endif\n" -" @endforeach\n" -"@endforeach\n" +"@endforeach" +msgstr "" -#: docs/10.x/blade.md:block 97 (paragraph) +# P +#: ./docs/8.x/blade.md:354 +#: ./docs/9.x/blade.md:413 +#: ./docs/10.x/blade.md:424 +#: ./docs/11.x/blade.md:425 +#: ./docs/master/blade.md:424 msgid "The `$loop` variable also contains a variety of other useful properties:" -msgstr "`$loop` 變數也包含了其他各種實用的屬性:" - -#: docs/10.x/blade.md:block 98 (table) -msgid "Property" -msgstr "屬性" - -#: docs/10.x/blade.md:block 98 (table) -msgid "Description" -msgstr "說明" - -#: docs/10.x/blade.md:block 98 (table) -msgid "`$loop->index`" -msgstr "`$loop->index`" - -#: docs/10.x/blade.md:block 98 (table) -msgid "The index of the current loop iteration (starts at 0)." -msgstr "目前迴圈迭代的索引 (從 0 開始)。" - -#: docs/10.x/blade.md:block 98 (table) -msgid "`$loop->iteration`" -msgstr "`$loop->iteration`" - -#: docs/10.x/blade.md:block 98 (table) -msgid "The current loop iteration (starts at 1)." -msgstr "目前的迴圈迭代 (從 1 開始)。" - -#: docs/10.x/blade.md:block 98 (table) -msgid "`$loop->remaining`" -msgstr "`$loop->remaining`" - -#: docs/10.x/blade.md:block 98 (table) -msgid "The iterations remaining in the loop." -msgstr "迴圈中剩餘的迭代數。" - -#: docs/10.x/blade.md:block 98 (table) -msgid "`$loop->count`" -msgstr "`$loop->count`" - -#: docs/10.x/blade.md:block 98 (table) -msgid "The total number of items in the array being iterated." -msgstr "迭代中陣列內的總項目數。" - -#: docs/10.x/blade.md:block 98 (table) -msgid "`$loop->first`" -msgstr "`$loop->first`" - -#: docs/10.x/blade.md:block 98 (table) -msgid "Whether this is the first iteration through the loop." -msgstr "目前是否為迴圈的第一次迭代。" - -#: docs/10.x/blade.md:block 98 (table) -msgid "`$loop->last`" -msgstr "`$loop->last`" - -#: docs/10.x/blade.md:block 98 (table) -msgid "Whether this is the last iteration through the loop." -msgstr "目前是否為迴圈的最後一次迭代。" - -#: docs/10.x/blade.md:block 98 (table) -msgid "`$loop->even`" -msgstr "`$loop->even`" - -#: docs/10.x/blade.md:block 98 (table) -msgid "Whether this is an even iteration through the loop." -msgstr "目前是否為迴圈的偶數次迭代。" - -#: docs/10.x/blade.md:block 98 (table) -msgid "`$loop->odd`" -msgstr "`$loop->odd`" - -#: docs/10.x/blade.md:block 98 (table) -msgid "Whether this is an odd iteration through the loop." -msgstr "目前是否為迴圈的奇數次迭代。" - -#: docs/10.x/blade.md:block 98 (table) -msgid "`$loop->depth`" -msgstr "`$loop->depth`" - -#: docs/10.x/blade.md:block 98 (table) -msgid "The nesting level of the current loop." -msgstr "目前迴圈的巢狀深度等級。" - -#: docs/10.x/blade.md:block 98 (table) -msgid "`$loop->parent`" -msgstr "`$loop->parent`" +msgstr "" -#: docs/10.x/blade.md:block 98 (table) -msgid "When in a nested loop, the parent's loop variable." -msgstr "若在巢狀迴圈內,即代表上層的迴圈變數。" +# P +#: ./docs/9.x/blade.md:354 +#: ./docs/10.x/blade.md:365 +#: ./docs/11.x/blade.md:366 +#: ./docs/master/blade.md:365 +msgid "When using loops you may also skip the current iteration or end the loop using the `@continue` and `@break` directives:" +msgstr "" -#: docs/10.x/blade.md:block 100 (header) -msgid "Conditional Classes & Styles" -msgstr "按條件顯示/隱藏 Class 與 Style" +# P +#: ./docs/8.x/blade.md:369 +#: ./docs/9.x/blade.md:428 +#: ./docs/10.x/blade.md:439 +#: ./docs/11.x/blade.md:444 +#: ./docs/master/blade.md:439 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:370 +msgid "Conditional Classes" +msgstr "" -#: docs/10.x/blade.md:block 101 (paragraph) +# P +#: ./docs/8.x/blade.md:372 +#: ./docs/9.x/blade.md:431 +#: ./docs/10.x/blade.md:442 +#: ./docs/11.x/blade.md:447 +#: ./docs/master/blade.md:442 msgid "The `@class` directive conditionally compiles a CSS class string. The directive accepts an array of classes where the array key contains the class or classes you wish to add, while the value is a boolean expression. If the array element has a numeric key, it will always be included in the rendered class list:" -msgstr "`@class` 指示詞可以有條件地編譯 CSS class 字串。`@class` 指示詞接受一組包含 class 的陣列,其中,陣列的索引鍵代表欲新增的 class,陣列值則是一個布林運算式。若陣列的元素有數字索引鍵,則該元素一定會被加到轉譯後的 Class 列表上:" +msgstr "" -#: docs/10.x/blade.md:block 102 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:374 +#: ./docs/9.x/blade.md:433 +#: ./docs/10.x/blade.md:444 +#: ./docs/11.x/blade.md:449 +#: ./docs/master/blade.md:444 msgid "@php\n" " $isActive = false;\n" " $hasError = true;\n" @@ -851,635 +1734,1216 @@ msgid "@php\n" " 'text-gray-500' => ! $isActive,\n" " 'bg-red' => $hasError,\n" "])>\n\n" -"\n" -msgstr "@php\n" -" $isActive = false;\n" -" $hasError = true;\n" -"@endphp\n\n" -" $isActive,\n" -" 'text-gray-500' => ! $isActive,\n" -" 'bg-red' => $hasError,\n" -"])>\n\n" -"\n" - -#: docs/10.x/blade.md:block 103 (paragraph) -msgid "Likewise, the `@style` directive may be used to conditionally add inline CSS styles to an HTML element:" -msgstr "類似地,`@style` 指示詞可用來依照條件在 HTML 元素內顯示或隱藏內嵌 CSS 樣式:" - -#: docs/10.x/blade.md:block 104 (code) -msgid "@php\n" -" $isActive = true;\n" -"@endphp\n\n" -" $isActive,\n" -"])>\n\n" -"\n" -msgstr "@php\n" -" $isActive = true;\n" -"@endphp\n\n" -" $isActive,\n" -"])>\n\n" -"\n" - -#: docs/10.x/blade.md:block 106 (header) -msgid "Additional Attributes" -msgstr "額外屬性" - -#: docs/10.x/blade.md:block 107 (paragraph) -msgid "For convenience, you may use the `@checked` directive to easily indicate if a given HTML checkbox input is \"checked\". This directive will echo `checked` if the provided condition evaluates to `true`:" -msgstr "為了方便起見,可以使用 `@checked` 指示詞用來可輕鬆地標示給定 HTML 勾選框為「^[已勾選](Checked)」。這個指示詞會在條件為 `true` 時 Echo `checked`:" - -#: docs/10.x/blade.md:block 108 (code) -msgid "active)) />\n" -msgstr "active)) />\n" - -#: docs/10.x/blade.md:block 109 (paragraph) -msgid "Likewise, the `@selected` directive may be used to indicate if a given select option should be \"selected\":" -msgstr "類似地,`@selected` 指示詞可用來表示給定 Select 選項應為「^[已選擇](Selected)」:" - -#: docs/10.x/blade.md:block 110 (code) -msgid "\n" -msgstr "\n" - -#: docs/10.x/blade.md:block 111 (paragraph) -msgid "Additionally, the `@disabled` directive may be used to indicate if a given element should be \"disabled\":" -msgstr "此外,可使用 `@disabled` 指示詞來表示給定元素應為「disabled」:" - -#: docs/10.x/blade.md:block 112 (code) -msgid "\n" -msgstr "\n" - -#: docs/10.x/blade.md:block 113 (paragraph) -msgid "Moreover, the `@readonly` directive may be used to indicate if a given element should be \"readonly\":" -msgstr "此外,使用 `@readonly` 指示詞可用來表示給定元素應為「readonly」:" - -#: docs/10.x/blade.md:block 114 (code) -msgid "isNotAdmin()) />\n" -msgstr "isNotAdmin()) />\n" - -#: docs/10.x/blade.md:block 115 (paragraph) -msgid "In addition, the `@required` directive may be used to indicate if a given element should be \"required\":" -msgstr "此外,`@required` 指示詞可用來表示給定元素應為「required」:" - -#: docs/10.x/blade.md:block 116 (code) -msgid "isAdmin()) />\n" -msgstr "isAdmin()) />\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 118 (header) +# P +#: ./docs/8.x/blade.md:388 +#: ./docs/9.x/blade.md:512 +#: ./docs/10.x/blade.md:523 +#: ./docs/11.x/blade.md:534 +#: ./docs/master/blade.md:523 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:389 +#: ./docs/9.x/blade.md:513 +#: ./docs/10.x/blade.md:524 +#: ./docs/11.x/blade.md:535 +#: ./docs/master/blade.md:524 msgid "Including Subviews" -msgstr "Include 子 View" +msgstr "" -#: docs/10.x/blade.md:block 119 (quote) -msgid "**Note** While you're free to use the `@include` directive, Blade [components](#components) provide similar functionality and offer several benefits over the `@include` directive such as data and attribute binding." -msgstr "**Note** 雖然可以使用 `@include` 指示詞,但 Blade 的[元件](#components)提供了類似的功能,且比起 `@include` 指示詞來說功能更強,可繫結資料與屬性。" +# P +#: ./docs/8.x/blade.md:391 +#: ./docs/9.x/blade.md:516 +#: ./docs/10.x/blade.md:527 +#: ./docs/11.x/blade.md:538 +#: ./docs/master/blade.md:527 +msgid "While you're free to use the `@include` directive, Blade [components](#components) provide similar functionality and offer several benefits over the `@include` directive such as data and attribute binding." +msgstr "" -#: docs/10.x/blade.md:block 120 (paragraph) +# P +#: ./docs/8.x/blade.md:393 +#: ./docs/9.x/blade.md:518 +#: ./docs/10.x/blade.md:529 +#: ./docs/11.x/blade.md:540 +#: ./docs/master/blade.md:529 msgid "Blade's `@include` directive allows you to include a Blade view from within another view. All variables that are available to the parent view will be made available to the included view:" -msgstr "Blade 的 `@include` 指示詞可用來在 Blade View 中包含另一個 View。所有上層 View 中可用的變數在 Include 的 View 當中都保持可用:" +msgstr "" -#: docs/10.x/blade.md:block 121 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:395 +#: ./docs/9.x/blade.md:520 +#: ./docs/10.x/blade.md:531 +#: ./docs/11.x/blade.md:542 +#: ./docs/master/blade.md:531 msgid "
    \n" " @include('shared.errors')\n\n" "
    \n" " \n" "
    \n" -"
    \n" -msgstr "
    \n" -" @include('shared.errors')\n\n" -"
    \n" -" \n" -"
    \n" -"
    \n" +"" +msgstr "" -#: docs/10.x/blade.md:block 122 (paragraph) +# P +#: ./docs/8.x/blade.md:405 +#: ./docs/9.x/blade.md:530 +#: ./docs/10.x/blade.md:541 +#: ./docs/11.x/blade.md:552 +#: ./docs/master/blade.md:541 msgid "Even though the included view will inherit all data available in the parent view, you may also pass an array of additional data that should be made available to the included view:" -msgstr "雖然 Include 的 View 會繼承其上層 View 中所有的資料,但也可以將要在包含的 View 中使用的資料作為陣列傳入:" +msgstr "" -#: docs/10.x/blade.md:block 123 (code) -msgid "@include('view.name', ['status' => 'complete'])\n" -msgstr "@include('view.name', ['status' => 'complete'])\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:407 +#: ./docs/9.x/blade.md:532 +#: ./docs/10.x/blade.md:543 +#: ./docs/11.x/blade.md:554 +#: ./docs/master/blade.md:543 +msgid "@include('view.name', ['status' => 'complete'])" +msgstr "" -#: docs/10.x/blade.md:block 124 (paragraph) +# P +#: ./docs/8.x/blade.md:409 +#: ./docs/9.x/blade.md:536 +#: ./docs/10.x/blade.md:547 +#: ./docs/11.x/blade.md:558 +#: ./docs/master/blade.md:547 msgid "If you attempt to `@include` a view which does not exist, Laravel will throw an error. If you would like to include a view that may or may not be present, you should use the `@includeIf` directive:" -msgstr "若嘗試 `@include` 一個不存在的 View,Laravel 會擲回錯誤。若想 Include 一個可能不存在的 View,應使用 `@includeIf` 指示詞:" +msgstr "" -#: docs/10.x/blade.md:block 125 (code) -msgid "@includeIf('view.name', ['status' => 'complete'])\n" -msgstr "@includeIf('view.name', ['status' => 'complete'])\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:411 +#: ./docs/9.x/blade.md:538 +#: ./docs/10.x/blade.md:549 +#: ./docs/11.x/blade.md:560 +#: ./docs/master/blade.md:549 +msgid "@includeIf('view.name', ['status' => 'complete'])" +msgstr "" -#: docs/10.x/blade.md:block 126 (paragraph) +# P +#: ./docs/8.x/blade.md:413 +#: ./docs/9.x/blade.md:542 +#: ./docs/10.x/blade.md:553 +#: ./docs/11.x/blade.md:564 +#: ./docs/master/blade.md:553 msgid "If you would like to `@include` a view if a given boolean expression evaluates to `true` or `false`, you may use the `@includeWhen` and `@includeUnless` directives:" -msgstr "若想在某個布林表達式取值為 `true` 或 `false` 的時候 `@include` 一個 View,則可以使用 `@includeWhen` 與 `@includeUnless` 指示詞:" +msgstr "" -#: docs/10.x/blade.md:block 127 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:415 +#: ./docs/9.x/blade.md:544 +#: ./docs/10.x/blade.md:555 +#: ./docs/11.x/blade.md:566 +#: ./docs/master/blade.md:555 msgid "@includeWhen($boolean, 'view.name', ['status' => 'complete'])\n\n" -"@includeUnless($boolean, 'view.name', ['status' => 'complete'])\n" -msgstr "@includeWhen($boolean, 'view.name', ['status' => 'complete'])\n\n" -"@includeUnless($boolean, 'view.name', ['status' => 'complete'])\n" +"@includeUnless($boolean, 'view.name', ['status' => 'complete'])" +msgstr "" -#: docs/10.x/blade.md:block 128 (paragraph) +# P +#: ./docs/8.x/blade.md:419 +#: ./docs/10.x/blade.md:561 +#: ./docs/11.x/blade.md:572 +#: ./docs/master/blade.md:561 msgid "To include the first view that exists from a given array of views, you may use the `includeFirst` directive:" -msgstr "若要在某個包含了一些 View 的陣列中 Include 第一個存在的 View,可以使用 `includeFirst` 指示詞:" +msgstr "" -#: docs/10.x/blade.md:block 129 (code) -msgid "@includeFirst(['custom.admin', 'admin'], ['status' => 'complete'])\n" -msgstr "@includeFirst(['custom.admin', 'admin'], ['status' => 'complete'])\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:421 +#: ./docs/9.x/blade.md:552 +#: ./docs/10.x/blade.md:563 +#: ./docs/11.x/blade.md:574 +#: ./docs/master/blade.md:563 +msgid "@includeFirst(['custom.admin', 'admin'], ['status' => 'complete'])" +msgstr "" -#: docs/10.x/blade.md:block 130 (quote) -msgid "**Warning** You should avoid using the `__DIR__` and `__FILE__` constants in your Blade views, since they will refer to the location of the cached, compiled view." -msgstr "**Warning** 應避免在 Blade View 中使用 `__DIR__` 與 `__FILE__` 常數,因為這些常數會參照到經過快取與編譯過的 View。" +# P +#: ./docs/8.x/blade.md:423 +#: ./docs/9.x/blade.md:557 +#: ./docs/10.x/blade.md:568 +#: ./docs/11.x/blade.md:579 +#: ./docs/master/blade.md:568 +msgid "You should avoid using the `__DIR__` and `__FILE__` constants in your Blade views, since they will refer to the location of the cached, compiled view." +msgstr "" -#: docs/10.x/blade.md:block 132 (header) +# P +#: ./docs/8.x/blade.md:425 +#: ./docs/9.x/blade.md:559 +#: ./docs/10.x/blade.md:570 +#: ./docs/11.x/blade.md:581 +#: ./docs/master/blade.md:570 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:426 +#: ./docs/9.x/blade.md:560 msgid "Rendering Views For Collections" -msgstr "為 Collection 轉譯 View" +msgstr "" -#: docs/10.x/blade.md:block 133 (paragraph) +# P +#: ./docs/8.x/blade.md:428 +#: ./docs/9.x/blade.md:562 +#: ./docs/10.x/blade.md:573 +#: ./docs/11.x/blade.md:584 +#: ./docs/master/blade.md:573 msgid "You may combine loops and includes into one line with Blade's `@each` directive:" -msgstr "可以通過 Blade 的 `@each` 指示詞來將迴圈與 Include 組合成一行:" +msgstr "" + +# H3 +#: ./docs/9.x/blade.md:429 +#: ./docs/10.x/blade.md:440 +#: ./docs/11.x/blade.md:445 +#: ./docs/master/blade.md:440 +msgid "Conditional Classes & Styles" +msgstr "" -#: docs/10.x/blade.md:block 134 (code) -msgid "@each('view.name', $jobs, 'job')\n" -msgstr "@each('view.name', $jobs, 'job')\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:430 +#: ./docs/9.x/blade.md:564 +#: ./docs/10.x/blade.md:575 +#: ./docs/11.x/blade.md:586 +#: ./docs/master/blade.md:575 +msgid "@each('view.name', $jobs, 'job')" +msgstr "" -#: docs/10.x/blade.md:block 135 (paragraph) +# P +#: ./docs/8.x/blade.md:432 +#: ./docs/9.x/blade.md:568 +#: ./docs/10.x/blade.md:579 +#: ./docs/11.x/blade.md:590 +#: ./docs/master/blade.md:579 msgid "The `@each` directive's first argument is the view to render for each element in the array or collection. The second argument is the array or collection you wish to iterate over, while the third argument is the variable name that will be assigned to the current iteration within the view. So, for example, if you are iterating over an array of `jobs`, typically you will want to access each job as a `job` variable within the view. The array key for the current iteration will be available as the `key` variable within the view." -msgstr "`@each` 指示詞的第一個引數是用來轉譯陣列或 Collection 中各個元素的 View。第二個引數則為要迭代的陣列或 Collection,而第三個引數則為要在 View 中被指派目前迭代的變數名稱。因此,舉例來說,若要迭代一個 `jobs` 陣列,通常我們會想在 View 中通過 `job` 變數來存取各個 Job。目前迭代的陣列索引鍵可在 View 中通過 `key` 存取。" +msgstr "" -#: docs/10.x/blade.md:block 136 (paragraph) +# P +#: ./docs/8.x/blade.md:434 +#: ./docs/9.x/blade.md:570 +#: ./docs/10.x/blade.md:581 +#: ./docs/11.x/blade.md:592 +#: ./docs/master/blade.md:581 msgid "You may also pass a fourth argument to the `@each` directive. This argument determines the view that will be rendered if the given array is empty." -msgstr "也可以傳入第四個引數給 `@each` 指示詞。這個引數用來判斷當給定陣列為空時要被轉譯的 View。" +msgstr "" -#: docs/10.x/blade.md:block 137 (code) -msgid "@each('view.name', $jobs, 'job', 'view.empty')\n" -msgstr "@each('view.name', $jobs, 'job', 'view.empty')\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:436 +#: ./docs/9.x/blade.md:572 +#: ./docs/10.x/blade.md:583 +#: ./docs/11.x/blade.md:594 +#: ./docs/master/blade.md:583 +msgid "@each('view.name', $jobs, 'job', 'view.empty')" +msgstr "" -#: docs/10.x/blade.md:block 138 (quote) -msgid "**Warning** Views rendered via `@each` do not inherit the variables from the parent view. If the child view requires these variables, you should use the `@foreach` and `@include` directives instead." -msgstr "**Warning** 通過 `@each` 所轉譯的 View 不會繼承其上層 View 的變數。若子 View 有需要這些變數,應使用 `@foreach` 與 `@include` 指示詞來代替。" +# P +#: ./docs/8.x/blade.md:438 +#: ./docs/9.x/blade.md:577 +#: ./docs/10.x/blade.md:588 +#: ./docs/11.x/blade.md:599 +#: ./docs/master/blade.md:588 +msgid "Views rendered via `@each` do not inherit the variables from the parent view. If the child view requires these variables, you should use the `@foreach` and `@include` directives instead." +msgstr "" -#: docs/10.x/blade.md:block 140 (header) +# P +#: ./docs/8.x/blade.md:440 +#: ./docs/9.x/blade.md:579 +#: ./docs/10.x/blade.md:590 +#: ./docs/11.x/blade.md:601 +#: ./docs/master/blade.md:590 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:441 +#: ./docs/9.x/blade.md:580 +#: ./docs/10.x/blade.md:591 +#: ./docs/11.x/blade.md:602 +#: ./docs/master/blade.md:591 msgid "The `@once` Directive" -msgstr "`@once` 指示詞" +msgstr "" -#: docs/10.x/blade.md:block 141 (paragraph) +# P +#: ./docs/8.x/blade.md:443 +#: ./docs/9.x/blade.md:582 +#: ./docs/10.x/blade.md:593 +#: ./docs/11.x/blade.md:604 +#: ./docs/master/blade.md:593 msgid "The `@once` directive allows you to define a portion of the template that will only be evaluated once per rendering cycle. This may be useful for pushing a given piece of JavaScript into the page's header using [stacks](#stacks). For example, if you are rendering a given [component](#components) within a loop, you may wish to only push the JavaScript to the header the first time the component is rendered:" -msgstr "`@once` 指示詞可以用來定義讓某部分的樣板在每個轉譯週期內只被轉譯一次。通常適用於想讓某部分的 JavaScript 的通過[堆疊](#stacks) Push 的頁面頭部時。舉例來說,若想在迴圈中轉譯某個給定的[元素](#components),可能會只想在第一次轉譯的時候將 JavaScript Push 到頭部:" +msgstr "" -#: docs/10.x/blade.md:block 142 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:445 +#: ./docs/9.x/blade.md:584 +#: ./docs/10.x/blade.md:595 +#: ./docs/11.x/blade.md:606 +#: ./docs/master/blade.md:595 msgid "@once\n" " @push('scripts')\n" " \n" " @endpush\n" -"@endonce\n" -msgstr "@once\n" -" @push('scripts')\n" -" \n" -" @endpush\n" -"@endonce\n" +"@endonce" +msgstr "" -#: docs/10.x/blade.md:block 143 (paragraph) -msgid "Since the `@once` directive is often used in conjunction with the `@push` or `@prepend` directives, the `@pushOnce` and `@prependOnce` directives are available for your convenience:" -msgstr "由於 `@once` 指示詞常常與 `@push` 或 `@prepend` 指示詞一起使用,所以也提供了 `@pushOnce` 與 `@prependOnce` 等方便的指示詞可使用:" +# P +#: ./docs/9.x/blade.md:449 +#: ./docs/10.x/blade.md:460 +#: ./docs/11.x/blade.md:465 +#: ./docs/master/blade.md:460 +msgid "Likewise, the `@style` directive may be used to conditionally add inline CSS styles to an HTML element:" +msgstr "" -#: docs/10.x/blade.md:block 144 (code) -msgid "@pushOnce('scripts')\n" -" \n" -"@endPushOnce\n" -msgstr "@pushOnce('scripts')\n" -" \n" -"@endPushOnce\n" +# CODE: blade +#: ./docs/9.x/blade.md:451 +#: ./docs/10.x/blade.md:462 +#: ./docs/11.x/blade.md:467 +#: ./docs/master/blade.md:462 +msgid "@php\n" +" $isActive = true;\n" +"@endphp\n\n" +" $isActive,\n" +"])>\n\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 146 (header) +# P +#: ./docs/8.x/blade.md:453 +#: ./docs/9.x/blade.md:604 +#: ./docs/10.x/blade.md:615 +#: ./docs/11.x/blade.md:626 +#: ./docs/master/blade.md:615 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:454 +#: ./docs/9.x/blade.md:605 +#: ./docs/10.x/blade.md:616 +#: ./docs/11.x/blade.md:627 +#: ./docs/master/blade.md:616 msgid "Raw PHP" -msgstr "原始 PHP" +msgstr "" -#: docs/10.x/blade.md:block 147 (paragraph) +# P +#: ./docs/8.x/blade.md:456 +#: ./docs/9.x/blade.md:607 +#: ./docs/10.x/blade.md:618 +#: ./docs/11.x/blade.md:629 +#: ./docs/master/blade.md:618 msgid "In some situations, it's useful to embed PHP code into your views. You can use the Blade `@php` directive to execute a block of plain PHP within your template:" -msgstr "在某些情況下,可能需要將 PHP 程式碼嵌入到 View 中。可以使用 Blade 的 `@php` 指示詞來在樣板中執行某一區塊的純 PHP:" +msgstr "" -#: docs/10.x/blade.md:block 148 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:458 +#: ./docs/9.x/blade.md:609 +#: ./docs/10.x/blade.md:620 +#: ./docs/11.x/blade.md:631 +#: ./docs/master/blade.md:620 msgid "@php\n" " $counter = 1;\n" -"@endphp\n" -msgstr "@php\n" -" $counter = 1;\n" -"@endphp\n" +"@endphp" +msgstr "" -#: docs/10.x/blade.md:block 150 (header) +# P +#: ./docs/8.x/blade.md:462 +#: ./docs/9.x/blade.md:621 +#: ./docs/10.x/blade.md:638 +#: ./docs/11.x/blade.md:649 +#: ./docs/master/blade.md:638 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:463 +#: ./docs/9.x/blade.md:622 +#: ./docs/10.x/blade.md:639 +#: ./docs/11.x/blade.md:650 +#: ./docs/master/blade.md:639 msgid "Comments" -msgstr "註解" +msgstr "" -#: docs/10.x/blade.md:block 151 (paragraph) +# P +#: ./docs/9.x/blade.md:464 +#: ./docs/10.x/blade.md:475 +#: ./docs/11.x/blade.md:480 +#: ./docs/master/blade.md:475 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/blade.md:465 +#: ./docs/9.x/blade.md:624 +#: ./docs/10.x/blade.md:641 +#: ./docs/11.x/blade.md:652 +#: ./docs/master/blade.md:641 msgid "Blade also allows you to define comments in your views. However, unlike HTML comments, Blade comments are not included in the HTML returned by your application:" -msgstr "在 Blade 中,我們也可以在 View 中定義註解。不過,與 HTML 註解不同,Blade 的註解不會包含在網站所回傳的 HTML 中:" - -#: docs/10.x/blade.md:block 152 (code) -msgid "{{-- This comment will not be present in the rendered HTML --}}\n" -msgstr "{{-- 這條註解將不會出現在轉譯完的 HTML 中 --}}\n" +msgstr "" -#: docs/10.x/blade.md:block 154 (header) -msgid "Components" -msgstr "元件" +# H3 +#: ./docs/9.x/blade.md:465 +#: ./docs/10.x/blade.md:476 +#: ./docs/11.x/blade.md:481 +#: ./docs/master/blade.md:476 +msgid "Additional Attributes" +msgstr "" -#: docs/10.x/blade.md:block 155 (paragraph) -msgid "Components and slots provide similar benefits to sections, layouts, and includes; however, some may find the mental model of components and slots easier to understand. There are two approaches to writing components: class based components and anonymous components." -msgstr "元件與 Slot 提供了與 Section, Layout 與 Include 類似的功能。不過,有些人可能會覺得元件跟 Slot 比較好懂。撰寫元件有兩種方法:一種是基於類別的元件,另一種則是匿名元件。" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:467 +#: ./docs/9.x/blade.md:626 +#: ./docs/10.x/blade.md:643 +#: ./docs/11.x/blade.md:654 +#: ./docs/master/blade.md:643 +msgid "{{-- This comment will not be present in the rendered HTML --}}" +msgstr "" -#: docs/10.x/blade.md:block 156 (paragraph) -msgid "To create a class based component, you may use the `make:component` Artisan command. To illustrate how to use components, we will create a simple `Alert` component. The `make:component` command will place the component in the `app/View/Components` directory:" -msgstr "若要建立基於類別的元件,可以使用 `make:component` Artisan 指令。為了解釋如何使用元件,我們將會建立一個簡單的 `Alert` 元件。`make:component` 指令會將元件放在 `app/View/Components` 目錄中:" +# P +#: ./docs/9.x/blade.md:467 +#: ./docs/10.x/blade.md:478 +#: ./docs/11.x/blade.md:483 +#: ./docs/master/blade.md:478 +msgid "For convenience, you may use the `@checked` directive to easily indicate if a given HTML checkbox input is \"checked\". This directive will echo `checked` if the provided condition evaluates to `true`:" +msgstr "" -#: docs/10.x/blade.md:block 157 (code) -msgid "php artisan make:component Alert\n" -msgstr "php artisan make:component Alert\n" +# P +#: ./docs/8.x/blade.md:469 +#: ./docs/9.x/blade.md:630 +#: ./docs/10.x/blade.md:647 +#: ./docs/11.x/blade.md:658 +#: ./docs/master/blade.md:647 +#~ msgid "" +#~ msgstr "" + +# CODE: blade +#: ./docs/9.x/blade.md:469 +#: ./docs/10.x/blade.md:480 +#: ./docs/master/blade.md:480 +msgid "active)) />" +msgstr "" + +# H2 +#: ./docs/8.x/blade.md:470 +#: ./docs/9.x/blade.md:631 +#: ./docs/10.x/blade.md:648 +#: ./docs/11.x/blade.md:659 +#: ./docs/master/blade.md:648 +msgid "Components" +msgstr "" + +# P +#: ./docs/8.x/blade.md:472 +#: ./docs/9.x/blade.md:633 +#: ./docs/10.x/blade.md:650 +#: ./docs/11.x/blade.md:661 +#: ./docs/master/blade.md:650 +msgid "Components and slots provide similar benefits to sections, layouts, and includes; however, some may find the mental model of components and slots easier to understand. There are two approaches to writing components: class based components and anonymous components." +msgstr "" + +# P +#: ./docs/8.x/blade.md:474 +#: ./docs/9.x/blade.md:635 +#: ./docs/10.x/blade.md:652 +#: ./docs/11.x/blade.md:663 +#: ./docs/master/blade.md:652 +msgid "To create a class based component, you may use the `make:component` Artisan command. To illustrate how to use components, we will create a simple `Alert` component. The `make:component` command will place the component in the `app/View/Components` directory:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/blade.md:476 +#: ./docs/9.x/blade.md:637 +#: ./docs/10.x/blade.md:654 +#: ./docs/11.x/blade.md:665 +#: ./docs/master/blade.md:654 +msgid "php artisan make:component Alert" +msgstr "" + +# P +#: ./docs/9.x/blade.md:476 +#: ./docs/10.x/blade.md:487 +#: ./docs/11.x/blade.md:494 +#: ./docs/master/blade.md:487 +msgid "Likewise, the `@selected` directive may be used to indicate if a given select option should be \"selected\":" +msgstr "" -#: docs/10.x/blade.md:block 158 (paragraph) +# P +#: ./docs/8.x/blade.md:478 +#: ./docs/9.x/blade.md:641 +#: ./docs/10.x/blade.md:658 +#: ./docs/11.x/blade.md:669 +#: ./docs/master/blade.md:658 msgid "The `make:component` command will also create a view template for the component. The view will be placed in the `resources/views/components` directory. When writing components for your own application, components are automatically discovered within the `app/View/Components` directory and `resources/views/components` directory, so no further component registration is typically required." -msgstr "`make:component` 指令也會為元件建立一個 View 樣板。這個樣板會被放在 `resources/views/components` 目錄內。當在為專案撰寫元件時,元件會在 `app/View/Components` 與 `resources/views/components` 目錄中被 Auto Discover (自動偵測),因此不需要進一步註冊元件。" +msgstr "" + +# CODE: blade +#: ./docs/9.x/blade.md:478 +#: ./docs/10.x/blade.md:489 +#: ./docs/11.x/blade.md:496 +#: ./docs/master/blade.md:489 +msgid "" +msgstr "" -#: docs/10.x/blade.md:block 159 (paragraph) +# P +#: ./docs/8.x/blade.md:480 +#: ./docs/9.x/blade.md:643 +#: ./docs/10.x/blade.md:660 +#: ./docs/11.x/blade.md:671 +#: ./docs/master/blade.md:660 msgid "You may also create components within subdirectories:" -msgstr "也可以在子資料夾內建立元件:" +msgstr "" -#: docs/10.x/blade.md:block 160 (code) -msgid "php artisan make:component Forms/Input\n" -msgstr "php artisan make:component Forms/Input\n" +# CODE +# CODE: shell +#: ./docs/8.x/blade.md:482 +#: ./docs/9.x/blade.md:645 +#: ./docs/10.x/blade.md:662 +#: ./docs/11.x/blade.md:673 +#: ./docs/master/blade.md:662 +msgid "php artisan make:component Forms/Input" +msgstr "" -#: docs/10.x/blade.md:block 161 (paragraph) +# P +#: ./docs/8.x/blade.md:484 +#: ./docs/9.x/blade.md:649 +#: ./docs/10.x/blade.md:666 +#: ./docs/11.x/blade.md:677 +#: ./docs/master/blade.md:666 msgid "The command above will create an `Input` component in the `app/View/Components/Forms` directory and the view will be placed in the `resources/views/components/forms` directory." -msgstr "上述指令會在 `app/View/Components/Forms` 目錄內建立一個 `Input` 元件,而 View 會被放在 `resources/views/components/forms` 目錄內。" - -#: docs/10.x/blade.md:block 162 (paragraph) -msgid "If you would like to create an anonymous component (a component with only a Blade template and no class), you may use the `--view` flag when invoking the `make:component` command:" -msgstr "若想建立匿名元件 (即,只有 Blade 樣板且無類別的元件),可在叫用 `make:component` 指令時使用 `--view` 旗標:" - -#: docs/10.x/blade.md:block 163 (code) -msgid "php artisan make:component forms.input --view\n" -msgstr "php artisan make:component forms.input --view\n" +msgstr "" -#: docs/10.x/blade.md:block 164 (paragraph) -msgid "The command above will create a Blade file at `resources/views/components/forms/input.blade.php` which can be rendered as a component via ``." -msgstr "上述指令會在 `resources/views/components/forms/input.blade.php` 中建立一個 Blade 檔,可通過 `` 來轉譯這個元件。" +# CODE: blade +#: ./docs/11.x/blade.md:485 +msgid "active))\n" +"/>" +msgstr "" -#: docs/10.x/blade.md:block 166 (header) +# P +#: ./docs/8.x/blade.md:486 +#: ./docs/9.x/blade.md:659 +#: ./docs/10.x/blade.md:676 +#: ./docs/11.x/blade.md:687 +#: ./docs/master/blade.md:676 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:487 +#: ./docs/9.x/blade.md:660 +#: ./docs/10.x/blade.md:677 +#: ./docs/11.x/blade.md:688 +#: ./docs/master/blade.md:677 msgid "Manually Registering Package Components" -msgstr "手動註冊套件元件" +msgstr "" -#: docs/10.x/blade.md:block 167 (paragraph) +# P +#: ./docs/9.x/blade.md:488 +#: ./docs/10.x/blade.md:499 +#: ./docs/11.x/blade.md:506 +#: ./docs/master/blade.md:499 +msgid "Additionally, the `@disabled` directive may be used to indicate if a given element should be \"disabled\":" +msgstr "" + +# P +#: ./docs/8.x/blade.md:489 +#: ./docs/8.x/blade.md:1089 +#: ./docs/9.x/blade.md:662 +#: ./docs/9.x/blade.md:1245 +#: ./docs/10.x/blade.md:679 +#: ./docs/10.x/blade.md:1277 +#: ./docs/11.x/blade.md:690 +#: ./docs/11.x/blade.md:1317 +#: ./docs/master/blade.md:679 +#: ./docs/master/blade.md:1277 msgid "When writing components for your own application, components are automatically discovered within the `app/View/Components` directory and `resources/views/components` directory." -msgstr "在為專案撰寫元件時,元件會在 `app/View/Components` 與 `resources/views/components` 目錄下被 Auto Discover (自動偵測)。" +msgstr "" -#: docs/10.x/blade.md:block 168 (paragraph) +# CODE: blade +#: ./docs/9.x/blade.md:490 +#: ./docs/10.x/blade.md:501 +#: ./docs/11.x/blade.md:508 +#: ./docs/master/blade.md:501 +msgid "" +msgstr "" + +# P +#: ./docs/8.x/blade.md:491 +#: ./docs/9.x/blade.md:664 +#: ./docs/10.x/blade.md:681 +#: ./docs/11.x/blade.md:692 +#: ./docs/master/blade.md:681 msgid "However, if you are building a package that utilizes Blade components, you will need to manually register your component class and its HTML tag alias. You should typically register your components in the `boot` method of your package's service provider:" -msgstr "不過,若想製作使用 Blade 元件的套件,則需要手動註冊元件類別與其 HTML 標籤別名。通常,應在套件的 Service Provider 內的 `boot` 方法中註冊你的元件:" +msgstr "" -#: docs/10.x/blade.md:block 169 (code) +# CODE +#: ./docs/8.x/blade.md:493 +#: ./docs/9.x/blade.md:666 msgid "use Illuminate\\Support\\Facades\\Blade;\n\n" "/**\n" " * Bootstrap your package's services.\n" " */\n" -"public function boot(): void\n" -"{\n" -" Blade::component('package-alert', Alert::class);\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Blade;\n\n" -"/**\n" -" * Bootstrap your package's services.\n" -" */\n" -"public function boot(): void\n" +"public function boot()\n" "{\n" " Blade::component('package-alert', Alert::class);\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/blade.md:494 +#: ./docs/10.x/blade.md:505 +#: ./docs/11.x/blade.md:512 +#: ./docs/master/blade.md:505 +msgid "Moreover, the `@readonly` directive may be used to indicate if a given element should be \"readonly\":" +msgstr "" + +# CODE: blade +#: ./docs/9.x/blade.md:496 +#: ./docs/10.x/blade.md:507 +#: ./docs/master/blade.md:507 +msgid "isNotAdmin()) />" +msgstr "" -#: docs/10.x/blade.md:block 170 (paragraph) +# P +#: ./docs/8.x/blade.md:503 +#: ./docs/8.x/blade.md:1106 +#: ./docs/9.x/blade.md:676 +#: ./docs/9.x/blade.md:1262 +#: ./docs/10.x/blade.md:693 +#: ./docs/10.x/blade.md:1292 +#: ./docs/11.x/blade.md:704 +#: ./docs/11.x/blade.md:1332 +#: ./docs/master/blade.md:693 +#: ./docs/master/blade.md:1292 msgid "Once your component has been registered, it may be rendered using its tag alias:" -msgstr "註冊好元件後,便可使用其標籤別名來轉譯:" +msgstr "" + +# P +#: ./docs/9.x/blade.md:503 +#: ./docs/10.x/blade.md:514 +#: ./docs/11.x/blade.md:523 +#: ./docs/master/blade.md:514 +msgid "In addition, the `@required` directive may be used to indicate if a given element should be \"required\":" +msgstr "" -#: docs/10.x/blade.md:block 171 (code) -msgid "\n" -msgstr "\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:505 +#: ./docs/8.x/blade.md:1108 +#: ./docs/9.x/blade.md:678 +#: ./docs/9.x/blade.md:1264 +#: ./docs/10.x/blade.md:695 +#: ./docs/10.x/blade.md:1294 +#: ./docs/11.x/blade.md:706 +#: ./docs/11.x/blade.md:1334 +#: ./docs/master/blade.md:695 +#: ./docs/master/blade.md:1294 +msgid "" +msgstr "" + +# CODE: blade +#: ./docs/9.x/blade.md:505 +#: ./docs/10.x/blade.md:516 +#: ./docs/master/blade.md:516 +msgid "isAdmin()) />" +msgstr "" -#: docs/10.x/blade.md:block 172 (paragraph) +# P +#: ./docs/8.x/blade.md:507 +#: ./docs/8.x/blade.md:1112 +#: ./docs/9.x/blade.md:682 +#: ./docs/9.x/blade.md:1270 +#: ./docs/10.x/blade.md:699 +#: ./docs/10.x/blade.md:1300 +#: ./docs/11.x/blade.md:710 +#: ./docs/11.x/blade.md:1340 +#: ./docs/master/blade.md:699 +#: ./docs/master/blade.md:1300 msgid "Alternatively, you may use the `componentNamespace` method to autoload component classes by convention. For example, a `Nightshade` package might have `Calendar` and `ColorPicker` components that reside within the `Package\\Views\\Components` namespace:" -msgstr "或者,也可以使用 `componentNamespace` 方法來依照慣例自動載入元件類別。舉例來說,`Nightshade` 套件可能包含了放在 `Package\\Views\\Components` Namespace 下的 `Calendar` 與 `ColorPicker` 元件:" +msgstr "" -#: docs/10.x/blade.md:block 173 (code) +# CODE +#: ./docs/8.x/blade.md:509 +#: ./docs/8.x/blade.md:1114 +#: ./docs/9.x/blade.md:684 +#: ./docs/9.x/blade.md:1272 msgid "use Illuminate\\Support\\Facades\\Blade;\n\n" "/**\n" " * Bootstrap your package's services.\n" +" *\n" +" * @return void\n" " */\n" -"public function boot(): void\n" -"{\n" -" Blade::componentNamespace('Nightshade\\\\Views\\\\Components', 'nightshade');\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Blade;\n\n" -"/**\n" -" * Bootstrap your package's services.\n" -" */\n" -"public function boot(): void\n" +"public function boot()\n" "{\n" " Blade::componentNamespace('Nightshade\\\\Views\\\\Components', 'nightshade');\n" -"}\n" +"}" +msgstr "" + +# CODE: blade +#: ./docs/11.x/blade.md:514 +msgid "isNotAdmin())\n" +"/>" +msgstr "" -#: docs/10.x/blade.md:block 174 (paragraph) +# P +#: ./docs/8.x/blade.md:521 +#: ./docs/8.x/blade.md:1126 +#: ./docs/9.x/blade.md:696 +#: ./docs/9.x/blade.md:1284 +#: ./docs/10.x/blade.md:711 +#: ./docs/10.x/blade.md:1312 +#: ./docs/11.x/blade.md:722 +#: ./docs/11.x/blade.md:1352 +#: ./docs/master/blade.md:711 +#: ./docs/master/blade.md:1312 msgid "This will allow the usage of package components by their vendor namespace using the `package-name::` syntax:" -msgstr "這樣依賴可以讓套件元件通過其 Vendor Namespace 來使用 `package-name::` 語法:" +msgstr "" -#: docs/10.x/blade.md:block 175 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:523 +#: ./docs/8.x/blade.md:1128 +#: ./docs/9.x/blade.md:698 +#: ./docs/9.x/blade.md:1286 +#: ./docs/10.x/blade.md:713 +#: ./docs/10.x/blade.md:1314 +#: ./docs/11.x/blade.md:724 +#: ./docs/11.x/blade.md:1354 +#: ./docs/master/blade.md:713 +#: ./docs/master/blade.md:1314 msgid "\n" -"\n" -msgstr "\n" -"\n" +"" +msgstr "" + +# CODE: blade +#: ./docs/11.x/blade.md:525 +msgid "isAdmin())\n" +"/>" +msgstr "" -#: docs/10.x/blade.md:block 176 (paragraph) +# P +#: ./docs/8.x/blade.md:526 +#: ./docs/8.x/blade.md:1131 +#: ./docs/9.x/blade.md:703 +#: ./docs/9.x/blade.md:1291 +#: ./docs/10.x/blade.md:718 +#: ./docs/10.x/blade.md:1319 +#: ./docs/11.x/blade.md:729 +#: ./docs/11.x/blade.md:1359 +#: ./docs/master/blade.md:718 +#: ./docs/master/blade.md:1319 msgid "Blade will automatically detect the class that's linked to this component by pascal-casing the component name. Subdirectories are also supported using \"dot\" notation." -msgstr "Blade 會通過將元件名稱轉為 Pascal 命名法 (pascal-case) 來自動偵測與這個元件關連的類別。也可以使用「點」語法來支援子目錄。" +msgstr "" -#: docs/10.x/blade.md:block 178 (header) +# P +#: ./docs/8.x/blade.md:528 +#: ./docs/9.x/blade.md:705 +#: ./docs/10.x/blade.md:720 +#: ./docs/11.x/blade.md:731 +#: ./docs/master/blade.md:720 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:529 +#: ./docs/9.x/blade.md:706 +#: ./docs/10.x/blade.md:721 +#: ./docs/11.x/blade.md:732 +#: ./docs/master/blade.md:721 msgid "Rendering Components" -msgstr "轉譯元件" +msgstr "" -#: docs/10.x/blade.md:block 179 (paragraph) +# P +#: ./docs/8.x/blade.md:531 +#: ./docs/9.x/blade.md:708 +#: ./docs/10.x/blade.md:723 +#: ./docs/11.x/blade.md:734 +#: ./docs/master/blade.md:723 msgid "To display a component, you may use a Blade component tag within one of your Blade templates. Blade component tags start with the string `x-` followed by the kebab case name of the component class:" -msgstr "若要顯示元件,可以在 Blade 樣板中使用 Blade 元件的標籤。Blade 元件標籤以 `x-` 開頭,並接上以 Kebab Case 命名法命名的元素類別:" +msgstr "" -#: docs/10.x/blade.md:block 180 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:533 +#: ./docs/9.x/blade.md:710 +#: ./docs/10.x/blade.md:725 +#: ./docs/11.x/blade.md:736 +#: ./docs/master/blade.md:725 msgid "\n\n" -"\n" -msgstr "\n\n" -"\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 181 (paragraph) +# P +#: ./docs/8.x/blade.md:537 +#: ./docs/9.x/blade.md:716 +#: ./docs/10.x/blade.md:731 +#: ./docs/11.x/blade.md:742 +#: ./docs/master/blade.md:731 msgid "If the component class is nested deeper within the `app/View/Components` directory, you may use the `.` character to indicate directory nesting. For example, if we assume a component is located at `app/View/Components/Inputs/Button.php`, we may render it like so:" -msgstr "若元件類別在 `app/View/Components` 目錄中嵌套多層,可以使用 `.` 字元來標示巢狀目錄。舉例來說,假設有個位於 `app/View/Components/Inputs/Button.php` 的元件,我們可以像這樣轉譯該元件:" - -#: docs/10.x/blade.md:block 182 (code) -msgid "\n" -msgstr "\n" - -#: docs/10.x/blade.md:block 183 (paragraph) -msgid "If you would like to conditionally render your component, you may define a `shouldRender` method on your component class. If the `shouldRender` method returns `false` the component will not be rendered:" -msgstr "若想要有條件地轉譯元件,可在 Component 類別中定義 `shouldRender` 方法。若 `shouldRender` 方法回傳 `false`,則該元件就不會被轉譯:" +msgstr "" -#: docs/10.x/blade.md:block 184 (code) -msgid "use Illuminate\\Support\\Str;\n\n" -"/**\n" -" * Whether the component should be rendered\n" -" */\n" -"public function shouldRender(): bool\n" -"{\n" -" return Str::length($this->message) > 0;\n" -"}\n" -msgstr "use Illuminate\\Support\\Str;\n\n" -"/**\n" -" * Whether the component should be rendered\n" -" */\n" -"public function shouldRender(): bool\n" -"{\n" -" return Str::length($this->message) > 0;\n" -"}\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:539 +#: ./docs/8.x/blade.md:997 +#: ./docs/9.x/blade.md:718 +#: ./docs/9.x/blade.md:1304 +#: ./docs/10.x/blade.md:733 +#: ./docs/10.x/blade.md:1332 +#: ./docs/11.x/blade.md:744 +#: ./docs/11.x/blade.md:1372 +#: ./docs/master/blade.md:733 +#: ./docs/master/blade.md:1332 +msgid "" +msgstr "" -#: docs/10.x/blade.md:block 186 (header) +# P +#: ./docs/8.x/blade.md:541 +#: ./docs/9.x/blade.md:722 +#: ./docs/10.x/blade.md:749 +#: ./docs/11.x/blade.md:780 +#: ./docs/master/blade.md:749 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:542 +#: ./docs/9.x/blade.md:723 msgid "Passing Data To Components" -msgstr "將資料傳給元件" +msgstr "" -#: docs/10.x/blade.md:block 187 (paragraph) +# P +#: ./docs/8.x/blade.md:544 +#: ./docs/9.x/blade.md:725 +#: ./docs/10.x/blade.md:752 +#: ./docs/11.x/blade.md:783 +#: ./docs/master/blade.md:752 msgid "You may pass data to Blade components using HTML attributes. Hard-coded, primitive values may be passed to the component using simple HTML attribute strings. PHP expressions and variables should be passed to the component via attributes that use the `:` character as a prefix:" -msgstr "可以使用 HTML 屬性來將資料傳給 Blade 元素。硬式編碼或原生值可以使用簡單的 HTML 屬性字串來傳給元素。PHP 表達式與變數應使用以 `:` 字元作為前綴的屬性來傳遞:" +msgstr "" -#: docs/10.x/blade.md:block 188 (code) -msgid "\n" -msgstr "\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:546 +#: ./docs/9.x/blade.md:727 +#: ./docs/10.x/blade.md:754 +#: ./docs/11.x/blade.md:785 +#: ./docs/master/blade.md:754 +msgid "" +msgstr "" -#: docs/10.x/blade.md:block 189 (paragraph) -msgid "You should define all of the component's data attributes in its class constructor. All public properties on a component will automatically be made available to the component's view. It is not necessary to pass the data to the view from the component's `render` method:" -msgstr "請在元件的類別建構函式中定義所有元件所需的資料屬性。元件中所有 Public 的屬性都會自動在元件的 View 中可用。不需要在元件的 `render` 方法中將這些資料傳給 View:" +# P +#: ./docs/8.x/blade.md:548 +msgid "You should define the component's required data in its class constructor. All public properties on a component will automatically be made available to the component's view. It is not necessary to pass the data to the view from the component's `render` method:" +msgstr "" -#: docs/10.x/blade.md:block 190 (code) +# CODE +#: ./docs/8.x/blade.md:550 +#: ./docs/9.x/blade.md:733 msgid "type = $type;\n" +" $this->message = $message;\n" +" }\n\n" " /**\n" " * Get the view / contents that represent the component.\n" +" *\n" +" * @return \\Illuminate\\View\\View|\\Closure|string\n" " */\n" -" public function render(): View\n" +" public function render()\n" " {\n" " return view('components.alert');\n" " }\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/blade.md:550 +msgid "To include the first view that exists from a given array of views, you may use the `@includeFirst` directive:" +msgstr "" + +# H4 +#: ./docs/10.x/blade.md:571 +#: ./docs/11.x/blade.md:582 +#: ./docs/master/blade.md:571 +msgid "Rendering Views for Collections" +msgstr "" + +# P +#: ./docs/9.x/blade.md:594 +#: ./docs/10.x/blade.md:605 +#: ./docs/11.x/blade.md:616 +#: ./docs/master/blade.md:605 +msgid "Since the `@once` directive is often used in conjunction with the `@push` or `@prepend` directives, the `@pushOnce` and `@prependOnce` directives are available for your convenience:" +msgstr "" -#: docs/10.x/blade.md:block 191 (paragraph) +# P +#: ./docs/8.x/blade.md:596 +#: ./docs/9.x/blade.md:779 +#: ./docs/10.x/blade.md:786 +#: ./docs/11.x/blade.md:817 +#: ./docs/master/blade.md:786 msgid "When your component is rendered, you may display the contents of your component's public variables by echoing the variables by name:" -msgstr "元件在進行轉譯時,可以通過 Echo 變數名稱來顯示元件的公用變數:" +msgstr "" + +# CODE: blade +#: ./docs/9.x/blade.md:596 +#: ./docs/10.x/blade.md:607 +#: ./docs/11.x/blade.md:618 +#: ./docs/master/blade.md:607 +msgid "@pushOnce('scripts')\n" +" \n" +"@endPushOnce" +msgstr "" -#: docs/10.x/blade.md:block 192 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:598 +#: ./docs/9.x/blade.md:781 +#: ./docs/10.x/blade.md:788 +#: ./docs/11.x/blade.md:819 +#: ./docs/master/blade.md:788 msgid "
    \n" " {{ $message }}\n" -"
    \n" -msgstr "
    \n" -" {{ $message }}\n" -"
    \n" +"" +msgstr "" -#: docs/10.x/blade.md:block 194 (header) +# P +#: ./docs/8.x/blade.md:604 +#: ./docs/9.x/blade.md:787 +#: ./docs/10.x/blade.md:794 +#: ./docs/11.x/blade.md:825 +#: ./docs/master/blade.md:794 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:605 +#: ./docs/9.x/blade.md:788 +#: ./docs/10.x/blade.md:795 +#: ./docs/11.x/blade.md:826 +#: ./docs/master/blade.md:795 msgid "Casing" -msgstr "大小寫" +msgstr "" -#: docs/10.x/blade.md:block 195 (paragraph) +# P +#: ./docs/8.x/blade.md:607 +#: ./docs/9.x/blade.md:790 +#: ./docs/10.x/blade.md:797 +#: ./docs/11.x/blade.md:828 +#: ./docs/master/blade.md:797 msgid "Component constructor arguments should be specified using `camelCase`, while `kebab-case` should be used when referencing the argument names in your HTML attributes. For example, given the following component constructor:" -msgstr "元件建構函式中的引數應以 `camelCase` 來指定,而在 HTML 屬性中參照其引數名稱時應使用 `kebab-case`。舉例來說,假設有下列元件建構函式:" +msgstr "" -#: docs/10.x/blade.md:block 196 (code) +# CODE +#: ./docs/8.x/blade.md:609 +#: ./docs/9.x/blade.md:792 msgid "/**\n" " * Create the component instance.\n" +" *\n" +" * @param string $alertType\n" +" * @return void\n" " */\n" -"public function __construct(\n" -" public string $alertType,\n" -") {}\n" -msgstr "/**\n" -" * Create the component instance.\n" -" */\n" -"public function __construct(\n" -" public string $alertType,\n" -") {}\n" - -#: docs/10.x/blade.md:block 197 (paragraph) -msgid "The `$alertType` argument may be provided to the component like so:" -msgstr "可以像這樣將 `$alertType` 引數提供給元件:" +"public function __construct($alertType)\n" +"{\n" +" $this->alertType = $alertType;\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 198 (code) -msgid "\n" -msgstr "\n" +# P +#: ./docs/9.x/blade.md:615 +msgid "If you only need to write a single PHP statement, you can include the statement within the `@php` directive:" +msgstr "" -#: docs/10.x/blade.md:block 200 (header) -msgid "Short Attribute Syntax" -msgstr "簡短的屬性語法" +# CODE: blade +#: ./docs/9.x/blade.md:617 +msgid "@php($counter = 1)" +msgstr "" -#: docs/10.x/blade.md:block 201 (paragraph) -msgid "When passing attributes to components, you may also use a \"short attribute\" syntax. This is often convenient since attribute names frequently match the variable names they correspond to:" -msgstr "將屬性傳入元件時,也可以使用「簡短屬性」語法。由於屬性名稱常常都與對應的變數名稱相同,因此此功能應該適用於大多數情況下:" +# P +#: ./docs/8.x/blade.md:620 +#: ./docs/9.x/blade.md:803 +#: ./docs/10.x/blade.md:806 +#: ./docs/11.x/blade.md:837 +#: ./docs/master/blade.md:806 +msgid "The `$alertType` argument may be provided to the component like so:" +msgstr "" -#: docs/10.x/blade.md:block 202 (code) -msgid "{{-- Short attribute syntax... --}}\n" -"\n\n" -"{{-- Is equivalent to... --}}\n" -"\n" -msgstr "{{-- 簡短屬性語法... --}}\n" -"\n\n" -"{{-- 對應於... --}}\n" -"\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:622 +#: ./docs/9.x/blade.md:805 +#: ./docs/10.x/blade.md:808 +#: ./docs/11.x/blade.md:839 +#: ./docs/master/blade.md:808 +msgid "" +msgstr "" -#: docs/10.x/blade.md:block 204 (header) +# P +#: ./docs/8.x/blade.md:624 +#: ./docs/9.x/blade.md:822 +#: ./docs/10.x/blade.md:825 +#: ./docs/11.x/blade.md:856 +#: ./docs/master/blade.md:825 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:625 +#: ./docs/9.x/blade.md:823 +#: ./docs/10.x/blade.md:826 +#: ./docs/11.x/blade.md:857 +#: ./docs/master/blade.md:826 msgid "Escaping Attribute Rendering" -msgstr "逸出屬性轉譯" +msgstr "" + +# P +#: ./docs/10.x/blade.md:626 +#: ./docs/11.x/blade.md:637 +#: ./docs/master/blade.md:626 +msgid "Or, if you only need to use PHP to import a class, you may use the `@use` directive:" +msgstr "" -#: docs/10.x/blade.md:block 205 (paragraph) +# P +#: ./docs/8.x/blade.md:627 +#: ./docs/9.x/blade.md:825 +#: ./docs/10.x/blade.md:828 +#: ./docs/11.x/blade.md:859 +#: ./docs/master/blade.md:828 msgid "Since some JavaScript frameworks such as Alpine.js also use colon-prefixed attributes, you may use a double colon (`::`) prefix to inform Blade that the attribute is not a PHP expression. For example, given the following component:" -msgstr "由於有些像 Alpine.js 的 JavaScript 框架也使用分號前綴的屬性,因此可以在 Blade 中使用雙分號(`::`)來提示 Blade 其屬性並非 PHP 運算式。舉例來說,假設有下列元件:" +msgstr "" -#: docs/10.x/blade.md:block 206 (code) +# CODE: blade +#: ./docs/10.x/blade.md:628 +#: ./docs/11.x/blade.md:639 +#: ./docs/master/blade.md:628 +msgid "@use('App\\Models\\Flight')" +msgstr "" + +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:629 +#: ./docs/9.x/blade.md:827 +#: ./docs/10.x/blade.md:830 +#: ./docs/11.x/blade.md:861 +#: ./docs/master/blade.md:830 msgid "\n" " Submit\n" -"\n" -msgstr "\n" -" 送出\n" -"\n" +"" +msgstr "" + +# P +#: ./docs/10.x/blade.md:632 +#: ./docs/11.x/blade.md:643 +#: ./docs/master/blade.md:632 +msgid "A second argument may be provided to the `@use` directive to alias the imported class:" +msgstr "" -#: docs/10.x/blade.md:block 207 (paragraph) +# P +#: ./docs/8.x/blade.md:633 +#: ./docs/9.x/blade.md:833 +#: ./docs/10.x/blade.md:836 +#: ./docs/11.x/blade.md:867 +#: ./docs/master/blade.md:836 msgid "The following HTML will be rendered by Blade:" -msgstr "Blade 會轉譯為下列 HTML:" +msgstr "" + +# CODE: php +#: ./docs/10.x/blade.md:634 +#: ./docs/11.x/blade.md:645 +#: ./docs/master/blade.md:634 +msgid "@use('App\\Models\\Flight', 'FlightModel')" +msgstr "" -#: docs/10.x/blade.md:block 208 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:635 +#: ./docs/9.x/blade.md:835 +#: ./docs/10.x/blade.md:838 +#: ./docs/11.x/blade.md:869 +#: ./docs/master/blade.md:838 msgid "\n" -msgstr "\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 210 (header) +# P +#: ./docs/8.x/blade.md:639 +#: ./docs/9.x/blade.md:841 +#: ./docs/10.x/blade.md:844 +#: ./docs/11.x/blade.md:875 +#: ./docs/master/blade.md:844 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:640 +#: ./docs/9.x/blade.md:842 +#: ./docs/10.x/blade.md:845 +#: ./docs/11.x/blade.md:876 +#: ./docs/master/blade.md:845 msgid "Component Methods" -msgstr "元件方法" +msgstr "" -#: docs/10.x/blade.md:block 211 (paragraph) +# P +#: ./docs/8.x/blade.md:642 +#: ./docs/9.x/blade.md:844 +#: ./docs/10.x/blade.md:847 +#: ./docs/11.x/blade.md:878 +#: ./docs/master/blade.md:847 msgid "In addition to public variables being available to your component template, any public methods on the component may be invoked. For example, imagine a component that has an `isSelected` method:" -msgstr "除了公用變數可以在元件樣板中使用以外,元件內的任何公用方法也可以被叫用。舉例來說,假設某個有 `isSelected` 方法的元件:" +msgstr "" -#: docs/10.x/blade.md:block 212 (code) +# CODE +#: ./docs/8.x/blade.md:644 +#: ./docs/9.x/blade.md:846 msgid "/**\n" " * Determine if the given option is the currently selected option.\n" +" *\n" +" * @param string $option\n" +" * @return bool\n" " */\n" -"public function isSelected(string $option): bool\n" -"{\n" -" return $option === $this->selected;\n" -"}\n" -msgstr "/**\n" -" * Determine if the given option is the currently selected option.\n" -" */\n" -"public function isSelected(string $option): bool\n" +"public function isSelected($option)\n" "{\n" " return $option === $this->selected;\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/blade.md:651 +#: ./docs/10.x/blade.md:668 +#: ./docs/11.x/blade.md:679 +#: ./docs/master/blade.md:668 +msgid "If you would like to create an anonymous component (a component with only a Blade template and no class), you may use the `--view` flag when invoking the `make:component` command:" +msgstr "" + +# CODE: shell +#: ./docs/9.x/blade.md:653 +#: ./docs/10.x/blade.md:670 +#: ./docs/11.x/blade.md:681 +#: ./docs/master/blade.md:670 +msgid "php artisan make:component forms.input --view" +msgstr "" -#: docs/10.x/blade.md:block 213 (paragraph) +# P +#: ./docs/8.x/blade.md:655 +#: ./docs/9.x/blade.md:857 +#: ./docs/10.x/blade.md:857 +#: ./docs/11.x/blade.md:888 +#: ./docs/master/blade.md:857 msgid "You may execute this method from your component template by invoking the variable matching the name of the method:" -msgstr "可以在元件樣板中通過叫用與方法名稱相同的變數來執行此方法:" +msgstr "" -#: docs/10.x/blade.md:block 214 (code) -msgid "\n" -msgstr "\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 216 (header) +# P +#: ./docs/9.x/blade.md:657 +#: ./docs/10.x/blade.md:674 +#: ./docs/11.x/blade.md:685 +#: ./docs/master/blade.md:674 +msgid "The command above will create a Blade file at `resources/views/components/forms/input.blade.php` which can be rendered as a component via ``." +msgstr "" + +# P +#: ./docs/8.x/blade.md:661 +#: ./docs/9.x/blade.md:865 +#: ./docs/10.x/blade.md:865 +#: ./docs/11.x/blade.md:896 +#: ./docs/master/blade.md:865 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:662 +#: ./docs/9.x/blade.md:866 msgid "Accessing Attributes & Slots Within Component Classes" -msgstr "在元件類別中存取屬性與 Slot" +msgstr "" -#: docs/10.x/blade.md:block 217 (paragraph) +# P +#: ./docs/8.x/blade.md:664 +#: ./docs/9.x/blade.md:868 +#: ./docs/10.x/blade.md:868 +#: ./docs/master/blade.md:868 msgid "Blade components also allow you to access the component name, attributes, and slot inside the class's render method. However, in order to access this data, you should return a closure from your component's `render` method. The closure will receive a `$data` array as its only argument. This array will contain several elements that provide information about the component:" -msgstr "Blade 元件也允許在類別的 `render` 方法中存取元素名稱、屬性、以及 Slot。不過,若要存取這些資料,就必須在元件 `render` 方法中回傳一個閉包。這個閉包會收到 `$data` 陣列作為其唯一的引數。該陣列將包含多個提供有關該元件資訊的元素:" +msgstr "" -#: docs/10.x/blade.md:block 218 (code) -msgid "use Closure;\n\n" -"/**\n" +# CODE +#: ./docs/8.x/blade.md:666 +#: ./docs/9.x/blade.md:870 +msgid "/**\n" " * Get the view / contents that represent the component.\n" +" *\n" +" * @return \\Illuminate\\View\\View|\\Closure|string\n" " */\n" -"public function render(): Closure\n" +"public function render()\n" "{\n" " return function (array $data) {\n" " // $data['componentName'];\n" @@ -1487,486 +2951,1180 @@ msgid "use Closure;\n\n" " // $data['slot'];\n\n" " return '
    Components content
    ';\n" " };\n" -"}\n" -msgstr "use Closure;\n\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/blade.md:682 +#: ./docs/9.x/blade.md:886 +#: ./docs/10.x/blade.md:886 +#: ./docs/11.x/blade.md:926 +#: ./docs/master/blade.md:886 +msgid "The `componentName` is equal to the name used in the HTML tag after the `x-` prefix. So ``'s `componentName` will be `alert`. The `attributes` element will contain all of the attributes that were present on the HTML tag. The `slot` element is an `Illuminate\\Support\\HtmlString` instance with the contents of the component's slot." +msgstr "" + +# CODE +#: ./docs/10.x/blade.md:683 +#: ./docs/11.x/blade.md:694 +#: ./docs/master/blade.md:683 +msgid "use Illuminate\\Support\\Facades\\Blade;\n\n" "/**\n" -" * Get the view / contents that represent the component.\n" +" * Bootstrap your package's services.\n" " */\n" -"public function render(): Closure\n" +"public function boot(): void\n" "{\n" -" return function (array $data) {\n" -" // $data['componentName'];\n" -" // $data['attributes'];\n" -" // $data['slot'];\n\n" -" return '
    Components content
    ';\n" -" };\n" -"}\n" - -#: docs/10.x/blade.md:block 219 (paragraph) -msgid "The `componentName` is equal to the name used in the HTML tag after the `x-` prefix. So ``'s `componentName` will be `alert`. The `attributes` element will contain all of the attributes that were present on the HTML tag. The `slot` element is an `Illuminate\\Support\\HtmlString` instance with the contents of the component's slot." -msgstr "`componentName` 與 HTML Tag 的 `x-` 前綴之後所使用的名稱相同。因此 `` 的 `componentName` 會是 `alert`。`attributes` 元素會包含出現在 HTML 標籤上的所有屬性。`slot` 元素是一個 `Illuminate\\Support\\HtmlString` 實體,其中包含了該元件的 Slot 內容。" +" Blade::component('package-alert', Alert::class);\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 220 (paragraph) +# P +#: ./docs/8.x/blade.md:684 +#: ./docs/9.x/blade.md:888 +#: ./docs/10.x/blade.md:888 +#: ./docs/11.x/blade.md:928 +#: ./docs/master/blade.md:888 msgid "The closure should return a string. If the returned string corresponds to an existing view, that view will be rendered; otherwise, the returned string will be evaluated as an inline Blade view." -msgstr "這個閉包應回傳字串。若該閉包回傳的字串為一個現有的 View,則會轉譯該 View。否則,回傳的字串將被轉換為內嵌的 Blade View。" +msgstr "" -#: docs/10.x/blade.md:block 222 (header) +# P +#: ./docs/8.x/blade.md:686 +#: ./docs/9.x/blade.md:890 +#: ./docs/10.x/blade.md:890 +#: ./docs/11.x/blade.md:930 +#: ./docs/master/blade.md:890 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:687 +#: ./docs/9.x/blade.md:891 +#: ./docs/10.x/blade.md:891 +#: ./docs/11.x/blade.md:931 +#: ./docs/master/blade.md:891 msgid "Additional Dependencies" -msgstr "額外的相依項" +msgstr "" -#: docs/10.x/blade.md:block 223 (paragraph) +# P +#: ./docs/8.x/blade.md:689 +#: ./docs/9.x/blade.md:893 +#: ./docs/10.x/blade.md:893 +#: ./docs/11.x/blade.md:933 +#: ./docs/master/blade.md:893 msgid "If your component requires dependencies from Laravel's [service container](/docs/{{version}}/container), you may list them before any of the component's data attributes and they will automatically be injected by the container:" -msgstr "若元件需要從 Laravel 的 [Service Container](/docs/{{version}}/container) 內取得其他相依性,則可以將這些相依性列在所有元素的資料屬性前,Container 會自動插入這些相依性項目:" +msgstr "" -#: docs/10.x/blade.md:block 224 (code) -msgid "use App\\Services\\AlertCreator;\n\n" +# CODE +#: ./docs/8.x/blade.md:691 +msgid "use App\\Services\\AlertCreator\n\n" "/**\n" " * Create the component instance.\n" +" *\n" +" * @param \\App\\Services\\AlertCreator $creator\n" +" * @param string $type\n" +" * @param string $message\n" +" * @return void\n" " */\n" -"public function __construct(\n" -" public AlertCreator $creator,\n" -" public string $type,\n" -" public string $message,\n" -") {}\n" -msgstr "use App\\Services\\AlertCreator;\n\n" +"public function __construct(AlertCreator $creator, $type, $message)\n" +"{\n" +" $this->creator = $creator;\n" +" $this->type = $type;\n" +" $this->message = $message;\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/blade.md:701 +#: ./docs/10.x/blade.md:1302 +#: ./docs/11.x/blade.md:712 +#: ./docs/11.x/blade.md:1342 +#: ./docs/master/blade.md:701 +#: ./docs/master/blade.md:1302 +msgid "use Illuminate\\Support\\Facades\\Blade;\n\n" "/**\n" -" * Create the component instance.\n" +" * Bootstrap your package's services.\n" " */\n" -"public function __construct(\n" -" public AlertCreator $creator,\n" -" public string $type,\n" -" public string $message,\n" -") {}\n" +"public function boot(): void\n" +"{\n" +" Blade::componentNamespace('Nightshade\\\\Views\\\\Components', 'nightshade');\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 226 (header) +# P +#: ./docs/8.x/blade.md:708 +#: ./docs/9.x/blade.md:914 +#: ./docs/10.x/blade.md:908 +#: ./docs/11.x/blade.md:948 +#: ./docs/master/blade.md:908 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:709 +#: ./docs/9.x/blade.md:915 +#: ./docs/10.x/blade.md:909 +#: ./docs/11.x/blade.md:949 +#: ./docs/master/blade.md:909 msgid "Hiding Attributes / Methods" -msgstr "隱藏屬性與方法" +msgstr "" -#: docs/10.x/blade.md:block 227 (paragraph) +# P +#: ./docs/8.x/blade.md:711 +#: ./docs/9.x/blade.md:917 +#: ./docs/10.x/blade.md:911 +#: ./docs/11.x/blade.md:951 +#: ./docs/master/blade.md:911 msgid "If you would like to prevent some public methods or properties from being exposed as variables to your component template, you may add them to an `$except` array property on your component:" -msgstr "若想防止一些公用方法或屬性被作為變數暴露到元件的樣板中,可以將這些項目加到元件的 `$except` 陣列屬性上:" +msgstr "" -#: docs/10.x/blade.md:block 228 (code) +# CODE +#: ./docs/8.x/blade.md:713 +#: ./docs/9.x/blade.md:919 msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/blade.md:737 +#: ./docs/11.x/blade.md:748 +#: ./docs/master/blade.md:737 +msgid "If you would like to conditionally render your component, you may define a `shouldRender` method on your component class. If the `shouldRender` method returns `false` the component will not be rendered:" +msgstr "" -#: docs/10.x/blade.md:block 230 (header) +# H3 +#: ./docs/8.x/blade.md:737 +#: ./docs/9.x/blade.md:943 +#: ./docs/10.x/blade.md:937 +#: ./docs/11.x/blade.md:977 +#: ./docs/master/blade.md:937 msgid "Component Attributes" -msgstr "元件屬性" +msgstr "" + +# CODE +#: ./docs/10.x/blade.md:739 +#: ./docs/11.x/blade.md:750 +#: ./docs/master/blade.md:739 +msgid "use Illuminate\\Support\\Str;\n\n" +"/**\n" +" * Whether the component should be rendered\n" +" */\n" +"public function shouldRender(): bool\n" +"{\n" +" return Str::length($this->message) > 0;\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 231 (paragraph) +# P +#: ./docs/8.x/blade.md:739 +#: ./docs/9.x/blade.md:945 +#: ./docs/10.x/blade.md:939 +#: ./docs/11.x/blade.md:979 +#: ./docs/master/blade.md:939 msgid "We've already examined how to pass data attributes to a component; however, sometimes you may need to specify additional HTML attributes, such as `class`, that are not part of the data required for a component to function. Typically, you want to pass these additional attributes down to the root element of the component template. For example, imagine we want to render an `alert` component like so:" -msgstr "我們已經看到了如何將資料屬性傳遞到元件內。然而,有時候可能會像指定不是元件運作所需的一些額外 HTML 屬性,如 `class`。通常來說,我們會像將這些額外的屬性向下傳遞到元件樣板中的根元素。舉例來說,假設我們想要像這樣轉譯一個 `alert` 元件:" +msgstr "" -#: docs/10.x/blade.md:block 232 (code) -msgid "\n" -msgstr "\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:741 +#: ./docs/9.x/blade.md:947 +#: ./docs/10.x/blade.md:941 +#: ./docs/11.x/blade.md:981 +#: ./docs/master/blade.md:941 +msgid "" +msgstr "" -#: docs/10.x/blade.md:block 233 (paragraph) +# P +#: ./docs/8.x/blade.md:743 +#: ./docs/9.x/blade.md:951 +#: ./docs/10.x/blade.md:945 +#: ./docs/11.x/blade.md:985 +#: ./docs/master/blade.md:945 msgid "All of the attributes that are not part of the component's constructor will automatically be added to the component's \"attribute bag\". This attribute bag is automatically made available to the component via the `$attributes` variable. All of the attributes may be rendered within the component by echoing this variable:" -msgstr "所有不在元件建構函式內的屬性都會被加到元件的「屬性包 (Attribute Bag)」內。這個屬性包會自動通過一個 `$attributes` 變數在元件內可用。可以通過 echo 這個變數來讓所有的屬性在元件內被轉譯:" +msgstr "" -#: docs/10.x/blade.md:block 234 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:745 +#: ./docs/9.x/blade.md:953 +#: ./docs/10.x/blade.md:947 +#: ./docs/11.x/blade.md:987 +#: ./docs/master/blade.md:947 msgid "
    \n" " \n" -"
    \n" -msgstr "
    \n" -" \n" -"
    \n" +"" +msgstr "" + +# P +#: ./docs/8.x/blade.md:749 +#: ./docs/9.x/blade.md:960 +#: ./docs/10.x/blade.md:954 +#: ./docs/11.x/blade.md:994 +#: ./docs/master/blade.md:954 +msgid "Using directives such as `@env` within component tags is not supported at this time. For example, `` will not be compiled." +msgstr "" -#: docs/10.x/blade.md:block 235 (quote) -msgid "**Warning** Using directives such as `@env` within component tags is not supported at this time. For example, `` will not be compiled." -msgstr "**Warning** 目前不支援在元件標籤內使用如 `@env` 的指示詞。舉例來說,`` 將不會被編譯。" +# H3 +#: ./docs/10.x/blade.md:750 +#: ./docs/11.x/blade.md:781 +#: ./docs/master/blade.md:750 +msgid "Passing Data to Components" +msgstr "" -#: docs/10.x/blade.md:block 237 (header) +# P +#: ./docs/8.x/blade.md:751 +#: ./docs/9.x/blade.md:962 +#: ./docs/10.x/blade.md:956 +#: ./docs/11.x/blade.md:996 +#: ./docs/master/blade.md:956 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:752 +#: ./docs/9.x/blade.md:963 +#: ./docs/10.x/blade.md:957 +#: ./docs/11.x/blade.md:997 +#: ./docs/master/blade.md:957 msgid "Default / Merged Attributes" -msgstr "預設與合併屬性" +msgstr "" -#: docs/10.x/blade.md:block 238 (paragraph) +# P +#: ./docs/8.x/blade.md:754 +#: ./docs/9.x/blade.md:965 +#: ./docs/10.x/blade.md:959 +#: ./docs/11.x/blade.md:999 +#: ./docs/master/blade.md:959 msgid "Sometimes you may need to specify default values for attributes or merge additional values into some of the component's attributes. To accomplish this, you may use the attribute bag's `merge` method. This method is particularly useful for defining a set of default CSS classes that should always be applied to a component:" -msgstr "有時候我們可能需要為屬性指定預設值,或是將額外的值合併到某些元件的屬性內。為此,可以使用屬性包的 `merge` 方法。這個方法特別適合用在如定義一系列永遠會被套用到元件上的預設 CSS:" +msgstr "" -#: docs/10.x/blade.md:block 239 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:756 +#: ./docs/9.x/blade.md:967 +#: ./docs/10.x/blade.md:961 +#: ./docs/11.x/blade.md:1001 +#: ./docs/master/blade.md:961 msgid "
    merge(['class' => 'alert alert-'.$type]) }}>\n" " {{ $message }}\n" -"
    \n" -msgstr "
    merge(['class' => 'alert alert-'.$type]) }}>\n" -" {{ $message }}\n" -"
    \n" +"" +msgstr "" + +# CODE +#: ./docs/10.x/blade.md:760 +#: ./docs/11.x/blade.md:791 +#: ./docs/master/blade.md:760 +msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/blade.md:760 +#: ./docs/9.x/blade.md:973 +#: ./docs/10.x/blade.md:967 +#: ./docs/11.x/blade.md:1007 +#: ./docs/master/blade.md:967 msgid "If we assume this component is utilized like so:" -msgstr "若我們假設這個元件會被這樣使用:" +msgstr "" + +# H3 +#: ./docs/11.x/blade.md:761 +msgid "Index Components" +msgstr "" + +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:762 +#: ./docs/8.x/blade.md:1045 +#: ./docs/9.x/blade.md:975 +#: ./docs/9.x/blade.md:1356 +#: ./docs/10.x/blade.md:969 +#: ./docs/10.x/blade.md:1384 +#: ./docs/11.x/blade.md:1009 +#: ./docs/11.x/blade.md:1424 +#: ./docs/master/blade.md:969 +#: ./docs/master/blade.md:1384 +msgid "" +msgstr "" -#: docs/10.x/blade.md:block 241 (code) -msgid "\n" -msgstr "\n" +# P +#: ./docs/11.x/blade.md:763 +msgid "Sometimes components are part of a component group and you may wish to group the related components within a single directory. For example, imagine a \"card\" component with the following class structure:" +msgstr "" -#: docs/10.x/blade.md:block 242 (paragraph) +# P +#: ./docs/8.x/blade.md:764 +#: ./docs/9.x/blade.md:979 +#: ./docs/10.x/blade.md:973 +#: ./docs/11.x/blade.md:1013 +#: ./docs/master/blade.md:973 msgid "The final, rendered HTML of the component will appear like the following:" -msgstr "則屬性最後經過轉譯的 HTML 會長這樣:" +msgstr "" + +# CODE: none +#: ./docs/11.x/blade.md:765 +msgid "App\\Views\\Components\\Card\\Card\n" +"App\\Views\\Components\\Card\\Header\n" +"App\\Views\\Components\\Card\\Body" +msgstr "" -#: docs/10.x/blade.md:block 243 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:766 +#: ./docs/9.x/blade.md:981 +#: ./docs/10.x/blade.md:975 +#: ./docs/11.x/blade.md:1015 +#: ./docs/master/blade.md:975 msgid "
    \n" " \n" -"
    \n" -msgstr "
    \n" -" \n" -"
    \n" +"" +msgstr "" + +# P +#: ./docs/11.x/blade.md:771 +msgid "Since the root `Card` component is nested within a `Card` directory, you might expect that you would need to render the component via ``. However, when a component's file name matches the name of the component's directory, Laravel automatically assumes that component is the \"root\" component and allows you to render the component without repeating the directory name:" +msgstr "" -#: docs/10.x/blade.md:block 245 (header) +# P +#: ./docs/8.x/blade.md:772 +#: ./docs/9.x/blade.md:987 +#: ./docs/10.x/blade.md:981 +#: ./docs/11.x/blade.md:1021 +#: ./docs/master/blade.md:981 +#~ msgid "" +#~ msgstr "" + +# CODE: blade +#: ./docs/11.x/blade.md:773 +msgid "\n" +" ...\n" +" ...\n" +"" +msgstr "" + +# H4 +#: ./docs/8.x/blade.md:773 +#: ./docs/9.x/blade.md:988 +#: ./docs/10.x/blade.md:982 +#: ./docs/11.x/blade.md:1022 +#: ./docs/master/blade.md:982 msgid "Conditionally Merge Classes" -msgstr "有條件地合併 Class" +msgstr "" -#: docs/10.x/blade.md:block 246 (paragraph) +# P +#: ./docs/8.x/blade.md:775 +#: ./docs/9.x/blade.md:990 +#: ./docs/10.x/blade.md:984 +#: ./docs/11.x/blade.md:1024 +#: ./docs/master/blade.md:984 msgid "Sometimes you may wish to merge classes if a given condition is `true`. You can accomplish this via the `class` method, which accepts an array of classes where the array key contains the class or classes you wish to add, while the value is a boolean expression. If the array element has a numeric key, it will always be included in the rendered class list:" -msgstr "有時候我們可能會依照給定條件式的結果是否為 `true` 來決定要不要合併 Class。可以通過 `class` 方法來達成,該方法接受一段含有 Class 的陣列。陣列的索引鍵包含了要新增的 Class,而陣列的值則為布林運算式。若陣列的元素有數字索引鍵,則該元素一定會被加到轉譯後的 Class 列表上:" +msgstr "" -#: docs/10.x/blade.md:block 247 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:777 +#: ./docs/9.x/blade.md:992 +#: ./docs/10.x/blade.md:986 +#: ./docs/11.x/blade.md:1026 +#: ./docs/master/blade.md:986 msgid "
    class(['p-4', 'bg-red' => $hasError]) }}>\n" " {{ $message }}\n" -"
    \n" -msgstr "
    class(['p-4', 'bg-red' => $hasError]) }}>\n" -" {{ $message }}\n" -"
    \n" +"" +msgstr "" -#: docs/10.x/blade.md:block 248 (paragraph) +# P +#: ./docs/8.x/blade.md:781 +#: ./docs/9.x/blade.md:998 +#: ./docs/10.x/blade.md:992 +#: ./docs/11.x/blade.md:1032 +#: ./docs/master/blade.md:992 msgid "If you need to merge other attributes onto your component, you can chain the `merge` method onto the `class` method:" -msgstr "若像將其他屬性合併到元件上,可以將 `merge` 方法串接到 `class` 方法後:" +msgstr "" -#: docs/10.x/blade.md:block 249 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:783 +#: ./docs/9.x/blade.md:1000 +#: ./docs/10.x/blade.md:994 +#: ./docs/11.x/blade.md:1034 +#: ./docs/master/blade.md:994 msgid "\n" -msgstr "\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 250 (quote) -msgid "**Note** If you need to conditionally compile classes on other HTML elements that shouldn't receive merged attributes, you can use the [`@class` directive](#conditional-classes)." -msgstr "**Note** 若不想讓要套用條件式編譯 Class 的 HTML 收到經過合併的屬性,請使用 [`@class` 指示詞](#conditional-classes)。" +# P +#: ./docs/8.x/blade.md:787 +#: ./docs/9.x/blade.md:1007 +#: ./docs/10.x/blade.md:1001 +#: ./docs/11.x/blade.md:1041 +#: ./docs/master/blade.md:1001 +msgid "If you need to conditionally compile classes on other HTML elements that shouldn't receive merged attributes, you can use the [`@class` directive](#conditional-classes)." +msgstr "" -#: docs/10.x/blade.md:block 252 (header) +# P +#: ./docs/8.x/blade.md:789 +#: ./docs/9.x/blade.md:1009 +#: ./docs/10.x/blade.md:1003 +#: ./docs/11.x/blade.md:1043 +#: ./docs/master/blade.md:1003 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:790 +#: ./docs/9.x/blade.md:1010 +#: ./docs/10.x/blade.md:1004 +#: ./docs/11.x/blade.md:1044 +#: ./docs/master/blade.md:1004 msgid "Non-Class Attribute Merging" -msgstr "非 Class 的屬性合併" +msgstr "" -#: docs/10.x/blade.md:block 253 (paragraph) +# P +#: ./docs/8.x/blade.md:792 +#: ./docs/9.x/blade.md:1012 +#: ./docs/10.x/blade.md:1006 +#: ./docs/11.x/blade.md:1046 +#: ./docs/master/blade.md:1006 msgid "When merging attributes that are not `class` attributes, the values provided to the `merge` method will be considered the \"default\" values of the attribute. However, unlike the `class` attribute, these attributes will not be merged with injected attribute values. Instead, they will be overwritten. For example, a `button` component's implementation may look like the following:" -msgstr "在合併 `class` 以外的屬性值時,提供給 `merge` 方法的值會被當作是屬性的「預設」值。不過,與 `class` 屬性不同,這些屬性不會跟插入的屬性值合併,而是會被複寫。舉例來說,一個 `button` 元件的實作可能會長這樣:" +msgstr "" -#: docs/10.x/blade.md:block 254 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:794 +#: ./docs/9.x/blade.md:1014 +#: ./docs/10.x/blade.md:1008 +#: ./docs/11.x/blade.md:1048 +#: ./docs/master/blade.md:1008 msgid "\n" -msgstr "\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 255 (paragraph) +# P +#: ./docs/8.x/blade.md:798 +#: ./docs/9.x/blade.md:1020 +#: ./docs/10.x/blade.md:1014 +#: ./docs/11.x/blade.md:1054 +#: ./docs/master/blade.md:1014 msgid "To render the button component with a custom `type`, it may be specified when consuming the component. If no type is specified, the `button` type will be used:" -msgstr "若要以自訂 `type` 來轉譯按鈕元素,可以在使用元素時指定。若未指定 Type,則會使用 `button` Type:" +msgstr "" + +# CODE +#: ./docs/10.x/blade.md:799 +#: ./docs/11.x/blade.md:830 +#: ./docs/master/blade.md:799 +msgid "/**\n" +" * Create the component instance.\n" +" */\n" +"public function __construct(\n" +" public string $alertType,\n" +") {}" +msgstr "" -#: docs/10.x/blade.md:block 256 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:800 +#: ./docs/9.x/blade.md:1022 +#: ./docs/10.x/blade.md:1016 +#: ./docs/11.x/blade.md:1056 +#: ./docs/master/blade.md:1016 msgid "\n" " Submit\n" -"\n" -msgstr "\n" -" 送出\n" -"\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 257 (paragraph) +# P +#: ./docs/8.x/blade.md:804 +#: ./docs/9.x/blade.md:1028 +#: ./docs/10.x/blade.md:1022 +#: ./docs/11.x/blade.md:1062 +#: ./docs/master/blade.md:1022 msgid "The rendered HTML of the `button` component in this example would be:" -msgstr "在這個範例中,`button` 元件轉譯後的 HTML 會是:" +msgstr "" -#: docs/10.x/blade.md:block 258 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:806 +#: ./docs/9.x/blade.md:1030 +#: ./docs/10.x/blade.md:1024 +#: ./docs/11.x/blade.md:1064 +#: ./docs/master/blade.md:1024 msgid "\n" -msgstr "\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 259 (paragraph) +# P +#: ./docs/9.x/blade.md:809 +#: ./docs/10.x/blade.md:812 +#: ./docs/11.x/blade.md:843 +#: ./docs/master/blade.md:812 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/blade.md:810 +#: ./docs/9.x/blade.md:1036 +#: ./docs/10.x/blade.md:1030 +#: ./docs/11.x/blade.md:1070 +#: ./docs/master/blade.md:1030 msgid "If you would like an attribute other than `class` to have its default value and injected values joined together, you may use the `prepends` method. In this example, the `data-controller` attribute will always begin with `profile-controller` and any additional injected `data-controller` values will be placed after this default value:" -msgstr "若像要讓 `class` 之外的屬性也能將其預設值與插入的值被串在一起,則可以使用 `prepends` 方法。在此例子中,`data-controller` 屬性將總是以 `profile-controller` 開頭,而任何額外插入的 `data-controller` 值都將被放在這個預設值之後:" +msgstr "" + +# H4 +#: ./docs/9.x/blade.md:810 +#: ./docs/10.x/blade.md:813 +#: ./docs/11.x/blade.md:844 +#: ./docs/master/blade.md:813 +msgid "Short Attribute Syntax" +msgstr "" -#: docs/10.x/blade.md:block 260 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:812 +#: ./docs/9.x/blade.md:1038 +#: ./docs/10.x/blade.md:1032 +#: ./docs/11.x/blade.md:1072 +#: ./docs/master/blade.md:1032 msgid "
    merge(['data-controller' => $attributes->prepends('profile-controller')]) }}>\n" " {{ $slot }}\n" -"
    \n" -msgstr "
    merge(['data-controller' => $attributes->prepends('profile-controller')]) }}>\n" -" {{ $slot }}\n" -"
    \n" +"" +msgstr "" + +# P +#: ./docs/9.x/blade.md:812 +#: ./docs/10.x/blade.md:815 +#: ./docs/11.x/blade.md:846 +#: ./docs/master/blade.md:815 +msgid "When passing attributes to components, you may also use a \"short attribute\" syntax. This is often convenient since attribute names frequently match the variable names they correspond to:" +msgstr "" + +# CODE: blade +#: ./docs/9.x/blade.md:814 +#: ./docs/10.x/blade.md:817 +#: ./docs/11.x/blade.md:848 +#: ./docs/master/blade.md:817 +msgid "{{-- Short attribute syntax... --}}\n" +"\n\n" +"{{-- Is equivalent to... --}}\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 262 (header) +# P +#: ./docs/8.x/blade.md:816 +#: ./docs/9.x/blade.md:1044 +#: ./docs/10.x/blade.md:1038 +#: ./docs/11.x/blade.md:1078 +#: ./docs/master/blade.md:1038 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:817 +#: ./docs/9.x/blade.md:1045 msgid "Retrieving & Filtering Attributes" -msgstr "取得與過濾屬性" +msgstr "" -#: docs/10.x/blade.md:block 263 (paragraph) +# P +#: ./docs/8.x/blade.md:819 +#: ./docs/9.x/blade.md:1047 +#: ./docs/10.x/blade.md:1041 +#: ./docs/11.x/blade.md:1081 +#: ./docs/master/blade.md:1041 msgid "You may filter attributes using the `filter` method. This method accepts a closure which should return `true` if you wish to retain the attribute in the attribute bag:" -msgstr "可以使用 `filter` 方法來過濾屬性。該方法接受一個閉包。若希望在屬性包內保留該屬性,則應在該閉包內回傳 `true`:" +msgstr "" -#: docs/10.x/blade.md:block 264 (code) -msgid "{{ $attributes->filter(fn (string $value, string $key) => $key == 'foo') }}\n" -msgstr "{{ $attributes->filter(fn (string $value, string $key) => $key == 'foo') }}\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:821 +#: ./docs/9.x/blade.md:1049 +msgid "{{ $attributes->filter(fn ($value, $key) => $key == 'foo') }}" +msgstr "" -#: docs/10.x/blade.md:block 265 (paragraph) +# P +#: ./docs/8.x/blade.md:823 +#: ./docs/9.x/blade.md:1053 +#: ./docs/10.x/blade.md:1047 +#: ./docs/11.x/blade.md:1087 +#: ./docs/master/blade.md:1047 msgid "For convenience, you may use the `whereStartsWith` method to retrieve all attributes whose keys begin with a given string:" -msgstr "為了方便起見,可以使用 `whereStartsWith` 方法來取得所有索引鍵以給定字串開頭的屬性:" +msgstr "" -#: docs/10.x/blade.md:block 266 (code) -msgid "{{ $attributes->whereStartsWith('wire:model') }}\n" -msgstr "{{ $attributes->whereStartsWith('wire:model') }}\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:825 +#: ./docs/9.x/blade.md:1055 +#: ./docs/10.x/blade.md:1049 +#: ./docs/11.x/blade.md:1089 +#: ./docs/master/blade.md:1049 +msgid "{{ $attributes->whereStartsWith('wire:model') }}" +msgstr "" -#: docs/10.x/blade.md:block 267 (paragraph) +# P +#: ./docs/8.x/blade.md:827 +#: ./docs/9.x/blade.md:1059 +#: ./docs/10.x/blade.md:1053 +#: ./docs/11.x/blade.md:1093 +#: ./docs/master/blade.md:1053 msgid "Conversely, the `whereDoesntStartWith` method may be used to exclude all attributes whose keys begin with a given string:" -msgstr "相對的,可以使用 `whereDoesntStartWith` 方法來排除所有索引鍵不以給定字串開頭的屬性:" +msgstr "" -#: docs/10.x/blade.md:block 268 (code) -msgid "{{ $attributes->whereDoesntStartWith('wire:model') }}\n" -msgstr "{{ $attributes->whereDoesntStartWith('wire:model') }}\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:829 +#: ./docs/9.x/blade.md:1061 +#: ./docs/10.x/blade.md:1055 +#: ./docs/11.x/blade.md:1095 +#: ./docs/master/blade.md:1055 +msgid "{{ $attributes->whereDoesntStartWith('wire:model') }}" +msgstr "" -#: docs/10.x/blade.md:block 269 (paragraph) +# P +#: ./docs/8.x/blade.md:831 +#: ./docs/9.x/blade.md:1065 +#: ./docs/10.x/blade.md:1059 +#: ./docs/11.x/blade.md:1099 +#: ./docs/master/blade.md:1059 msgid "Using the `first` method, you may render the first attribute in a given attribute bag:" -msgstr "使用 `first` 方法,就可以轉譯給定屬性包中的第一個屬性:" +msgstr "" -#: docs/10.x/blade.md:block 270 (code) -msgid "{{ $attributes->whereStartsWith('wire:model')->first() }}\n" -msgstr "{{ $attributes->whereStartsWith('wire:model')->first() }}\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:833 +#: ./docs/9.x/blade.md:1067 +#: ./docs/10.x/blade.md:1061 +#: ./docs/11.x/blade.md:1101 +#: ./docs/master/blade.md:1061 +msgid "{{ $attributes->whereStartsWith('wire:model')->first() }}" +msgstr "" -#: docs/10.x/blade.md:block 271 (paragraph) +# P +#: ./docs/8.x/blade.md:835 +#: ./docs/9.x/blade.md:1071 +#: ./docs/10.x/blade.md:1065 +#: ./docs/11.x/blade.md:1105 +#: ./docs/master/blade.md:1065 msgid "If you would like to check if an attribute is present on the component, you may use the `has` method. This method accepts the attribute name as its only argument and returns a boolean indicating whether or not the attribute is present:" -msgstr "若像檢查某個屬性是否有出現在元件內,可以使用 `has` 方法。這個方法接受一個屬性名稱作為其唯一的一個引數,並且會回傳一個布林值,來代表該屬性是否有出現:" +msgstr "" -#: docs/10.x/blade.md:block 272 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:837 +#: ./docs/9.x/blade.md:1073 +#: ./docs/10.x/blade.md:1067 +#: ./docs/11.x/blade.md:1107 +#: ./docs/master/blade.md:1067 msgid "@if ($attributes->has('class'))\n" "
    Class attribute is present
    \n" -"@endif\n" -msgstr "@if ($attributes->has('class'))\n" -"
    有該 class 屬性
    \n" -"@endif\n" - -#: docs/10.x/blade.md:block 273 (paragraph) -msgid "If an array is passed to the `has` method, the method will determine if all of the given attributes are present on the component:" -msgstr "若將陣列傳入 `has`,則該方法會判斷該元件上是否具有所有給定的屬性:" - -#: docs/10.x/blade.md:block 274 (code) -msgid "@if ($attributes->has(['name', 'class']))\n" -"
    All of the attributes are present
    \n" -"@endif\n" -msgstr "@if ($attributes->has(['name', 'class']))\n" -"
    具有給定的所有屬性
    \n" -"@endif\n" - -#: docs/10.x/blade.md:block 275 (paragraph) -msgid "The `hasAny` method may be used to determine if any of the given attributes are present on the component:" -msgstr "`hasAny` 方法可用來判斷元件中是否有任一給定的屬性:" - -#: docs/10.x/blade.md:block 276 (code) -msgid "@if ($attributes->hasAny(['href', ':href', 'v-bind:href']))\n" -"
    One of the attributes is present
    \n" -"@endif\n" -msgstr "@if ($attributes->hasAny(['href', ':href', 'v-bind:href']))\n" -"
    具有其中一個屬性
    \n" -"@endif\n" +"@endif" +msgstr "" -#: docs/10.x/blade.md:block 277 (paragraph) +# P +#: ./docs/8.x/blade.md:841 +#: ./docs/9.x/blade.md:1079 +#: ./docs/10.x/blade.md:1089 +#: ./docs/11.x/blade.md:1129 +#: ./docs/master/blade.md:1089 msgid "You may retrieve a specific attribute's value using the `get` method:" -msgstr "可以通過 `get` 方法來取得某個特定的屬性值:" +msgstr "" -#: docs/10.x/blade.md:block 278 (code) -msgid "{{ $attributes->get('class') }}\n" -msgstr "{{ $attributes->get('class') }}\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:843 +#: ./docs/9.x/blade.md:1081 +#: ./docs/10.x/blade.md:1091 +#: ./docs/11.x/blade.md:1131 +#: ./docs/master/blade.md:1091 +msgid "{{ $attributes->get('class') }}" +msgstr "" -#: docs/10.x/blade.md:block 280 (header) +# P +#: ./docs/8.x/blade.md:845 +#: ./docs/9.x/blade.md:1085 +#: ./docs/10.x/blade.md:1095 +#: ./docs/11.x/blade.md:1135 +#: ./docs/master/blade.md:1095 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:846 +#: ./docs/9.x/blade.md:1086 +#: ./docs/10.x/blade.md:1096 +#: ./docs/11.x/blade.md:1136 +#: ./docs/master/blade.md:1096 msgid "Reserved Keywords" -msgstr "保留字" +msgstr "" -#: docs/10.x/blade.md:block 281 (paragraph) +# P +#: ./docs/8.x/blade.md:848 +#: ./docs/9.x/blade.md:1088 +#: ./docs/10.x/blade.md:1098 +#: ./docs/11.x/blade.md:1138 +#: ./docs/master/blade.md:1098 msgid "By default, some keywords are reserved for Blade's internal use in order to render components. The following keywords cannot be defined as public properties or method names within your components:" -msgstr "預設情況下,Blade 中保留了一些關鍵字來作為內部使用,以用於轉譯元件。下列關鍵字將無法在元件內被定義為公用屬性或屬性名稱:" +msgstr "" + +# CODE +#: ./docs/10.x/blade.md:849 +#: ./docs/11.x/blade.md:880 +#: ./docs/master/blade.md:849 +msgid "/**\n" +" * Determine if the given option is the currently selected option.\n" +" */\n" +"public function isSelected(string $option): bool\n" +"{\n" +" return $option === $this->selected;\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 283 (unordered list) +# P +#: ./docs/8.x/blade.md:852 +#: ./docs/9.x/blade.md:1092 +#: ./docs/10.x/blade.md:1102 +#: ./docs/11.x/blade.md:1142 +#: ./docs/master/blade.md:1102 msgid "`data`" -msgstr "`data`" +msgstr "" -#: docs/10.x/blade.md:block 283 (unordered list) +# P +#: ./docs/8.x/blade.md:853 +#: ./docs/9.x/blade.md:1093 +#: ./docs/10.x/blade.md:1103 +#: ./docs/11.x/blade.md:1143 +#: ./docs/master/blade.md:1103 msgid "`render`" -msgstr "`render`" +msgstr "" -#: docs/10.x/blade.md:block 283 (unordered list) +# P +#: ./docs/8.x/blade.md:854 +#: ./docs/9.x/blade.md:1094 +#: ./docs/10.x/blade.md:1104 +#: ./docs/11.x/blade.md:1144 +#: ./docs/master/blade.md:1104 msgid "`resolveView`" -msgstr "`resolveView`" +msgstr "" -#: docs/10.x/blade.md:block 283 (unordered list) +# P +#: ./docs/8.x/blade.md:855 +#: ./docs/9.x/blade.md:1095 +#: ./docs/10.x/blade.md:1105 +#: ./docs/11.x/blade.md:1145 +#: ./docs/master/blade.md:1105 msgid "`shouldRender`" -msgstr "`shouldRender`" +msgstr "" -#: docs/10.x/blade.md:block 283 (unordered list) +# P +#: ./docs/8.x/blade.md:856 +#: ./docs/9.x/blade.md:1096 +#: ./docs/10.x/blade.md:1106 +#: ./docs/11.x/blade.md:1146 +#: ./docs/master/blade.md:1106 msgid "`view`" -msgstr "`view`" +msgstr "" -#: docs/10.x/blade.md:block 283 (unordered list) +# P +#: ./docs/8.x/blade.md:857 +#: ./docs/9.x/blade.md:1097 +#: ./docs/10.x/blade.md:1107 +#: ./docs/11.x/blade.md:1147 +#: ./docs/master/blade.md:1107 msgid "`withAttributes`" -msgstr "`withAttributes`" +msgstr "" -#: docs/10.x/blade.md:block 283 (unordered list) +# P +#: ./docs/8.x/blade.md:858 +#: ./docs/9.x/blade.md:1098 +#: ./docs/10.x/blade.md:1108 +#: ./docs/11.x/blade.md:1148 +#: ./docs/master/blade.md:1108 msgid "`withName`" -msgstr "`withName`" +msgstr "" + +# CODE: blade +#: ./docs/9.x/blade.md:859 +#: ./docs/10.x/blade.md:859 +#: ./docs/11.x/blade.md:890 +#: ./docs/master/blade.md:859 +msgid "" +msgstr "" -#: docs/10.x/blade.md:block 286 (header) +# P +#: ./docs/8.x/blade.md:862 +#: ./docs/9.x/blade.md:1102 +#: ./docs/10.x/blade.md:1112 +#: ./docs/11.x/blade.md:1152 +#: ./docs/master/blade.md:1112 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:863 +#: ./docs/9.x/blade.md:1103 +#: ./docs/10.x/blade.md:1113 +#: ./docs/11.x/blade.md:1153 +#: ./docs/master/blade.md:1113 msgid "Slots" -msgstr "Slot" +msgstr "" -#: docs/10.x/blade.md:block 287 (paragraph) +# P +#: ./docs/8.x/blade.md:865 +#: ./docs/9.x/blade.md:1105 +#: ./docs/10.x/blade.md:1115 +#: ./docs/11.x/blade.md:1155 +#: ./docs/master/blade.md:1115 msgid "You will often need to pass additional content to your component via \"slots\". Component slots are rendered by echoing the `$slot` variable. To explore this concept, let's imagine that an `alert` component has the following markup:" -msgstr "我們常常會通過「Slot」來將額外的內容傳到元件內。元件的 Slot 可以通過 Echo `$slot` 變數來進行轉譯。為了進一步探討這個概念,我們來想想有個長得像這樣的 `alert` 元件:" +msgstr "" + +# H4 +#: ./docs/10.x/blade.md:866 +#: ./docs/11.x/blade.md:897 +#: ./docs/master/blade.md:866 +msgid "Accessing Attributes and Slots Within Component Classes" +msgstr "" -#: docs/10.x/blade.md:block 288 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:867 +#: ./docs/9.x/blade.md:1107 +#: ./docs/10.x/blade.md:1117 +#: ./docs/11.x/blade.md:1157 +#: ./docs/master/blade.md:1117 msgid "\n\n" "
    \n" " {{ $slot }}\n" -"
    \n" -msgstr "\n\n" -"
    \n" -" {{ $slot }}\n" -"
    \n" +"" +msgstr "" + +# CODE +#: ./docs/10.x/blade.md:870 +#: ./docs/master/blade.md:870 +msgid "use Closure;\n\n" +"/**\n" +" * Get the view / contents that represent the component.\n" +" */\n" +"public function render(): Closure\n" +"{\n" +" return function (array $data) {\n" +" // $data['componentName'];\n" +" // $data['attributes'];\n" +" // $data['slot'];\n\n" +" return '
    Components content
    ';\n" +" };\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 289 (paragraph) +# P +#: ./docs/8.x/blade.md:875 +#: ./docs/9.x/blade.md:1115 +#: ./docs/10.x/blade.md:1125 +#: ./docs/11.x/blade.md:1165 +#: ./docs/master/blade.md:1125 msgid "We may pass content to the `slot` by injecting content into the component:" -msgstr "我們可以通過將內容插入到元件內來把內容傳給 `slot`:" +msgstr "" -#: docs/10.x/blade.md:block 290 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:877 +#: ./docs/9.x/blade.md:1117 +#: ./docs/10.x/blade.md:1127 +#: ./docs/11.x/blade.md:1167 +#: ./docs/master/blade.md:1127 msgid "\n" " Whoops! Something went wrong!\n" -"\n" -msgstr "\n" -" Whoops! Something went wrong!\n" -"\n" +"
    " +msgstr "" -#: docs/10.x/blade.md:block 291 (paragraph) +# P +#: ./docs/8.x/blade.md:883 +#: ./docs/9.x/blade.md:1123 +#: ./docs/10.x/blade.md:1133 +#: ./docs/11.x/blade.md:1173 +#: ./docs/master/blade.md:1133 msgid "Sometimes a component may need to render multiple different slots in different locations within the component. Let's modify our alert component to allow for the injection of a \"title\" slot:" -msgstr "有時候,元件可能需要在元件中不同位置來轉譯多個不同的 Slot。我們來修改一下 alert 元件,讓這個元件能允許插入「title」Slot:" +msgstr "" -#: docs/10.x/blade.md:block 292 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:885 +#: ./docs/9.x/blade.md:1125 +#: ./docs/10.x/blade.md:1135 +#: ./docs/11.x/blade.md:1175 +#: ./docs/master/blade.md:1135 msgid "\n\n" "{{ $title }}\n\n" "
    \n" " {{ $slot }}\n" -"
    \n" -msgstr "\n\n" -"{{ $title }}\n\n" -"
    \n" -" {{ $slot }}\n" -"
    \n" - -#: docs/10.x/blade.md:block 293 (paragraph) -msgid "You may define the content of the named slot using the `x-slot` tag. Any content not within an explicit `x-slot` tag will be passed to the component in the `$slot` variable:" -msgstr "可以通過 `x-slot` 標籤來定義帶名稱 Slot 的內容。任何沒有明顯放在 `x-slot` 標籤內的內容都會被傳到元素的 `$slot` 變數內:" +"" +msgstr "" -#: docs/10.x/blade.md:block 294 (code) -msgid "\n" -" \n" -" Server Error\n" -" \n\n" -" Whoops! Something went wrong!\n" -"\n" -msgstr "\n" -" \n" +# CODE: php +#: ./docs/10.x/blade.md:895 +#: ./docs/11.x/blade.md:935 +#: ./docs/master/blade.md:895 +msgid "use App\\Services\\AlertCreator;\n\n" +"/**\n" +" * Create the component instance.\n" +" */\n" +"public function __construct(\n" +" public AlertCreator $creator,\n" +" public string $type,\n" +" public string $message,\n" +") {}" +msgstr "" + +# P +#: ./docs/8.x/blade.md:895 +#: ./docs/9.x/blade.md:1135 +#: ./docs/10.x/blade.md:1145 +#: ./docs/11.x/blade.md:1185 +#: ./docs/master/blade.md:1145 +msgid "You may define the content of the named slot using the `x-slot` tag. Any content not within an explicit `x-slot` tag will be passed to the component in the `$slot` variable:" +msgstr "" + +# CODE: php +#: ./docs/9.x/blade.md:895 +msgid "use App\\Services\\AlertCreator;\n\n" +"/**\n" +" * Create the component instance.\n" +" *\n" +" * @param \\App\\Services\\AlertCreator $creator\n" +" * @param string $type\n" +" * @param string $message\n" +" * @return void\n" +" */\n" +"public function __construct(AlertCreator $creator, $type, $message)\n" +"{\n" +" $this->creator = $creator;\n" +" $this->type = $type;\n" +" $this->message = $message;\n" +"}" +msgstr "" + +# CODE: html +#: ./docs/8.x/blade.md:897 +msgid "\n" +" \n" " Server Error\n" " \n\n" " Whoops! Something went wrong!\n" -"\n" +"" +msgstr "" + +# P +#: ./docs/11.x/blade.md:899 +msgid "Blade components also allow you to access the component name, attributes, and slot inside the class's render method. However, in order to access this data, you should return a closure from your component's `render` method:" +msgstr "" + +# CODE +#: ./docs/11.x/blade.md:901 +msgid "use Closure;\n\n" +"/**\n" +" * Get the view / contents that represent the component.\n" +" */\n" +"public function render(): Closure\n" +"{\n" +" return function () {\n" +" return '
    Components content
    ';\n" +" };\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 296 (header) +# P +#: ./docs/8.x/blade.md:907 +#: ./docs/9.x/blade.md:1147 +#: ./docs/10.x/blade.md:1179 +#: ./docs/11.x/blade.md:1219 +#: ./docs/master/blade.md:1179 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:908 +#: ./docs/9.x/blade.md:1148 +#: ./docs/10.x/blade.md:1180 +#: ./docs/11.x/blade.md:1220 +#: ./docs/master/blade.md:1180 msgid "Scoped Slots" -msgstr "限定範圍的 Slot" +msgstr "" -#: docs/10.x/blade.md:block 297 (paragraph) +# P +#: ./docs/8.x/blade.md:910 +#: ./docs/9.x/blade.md:1150 +#: ./docs/10.x/blade.md:1182 +#: ./docs/11.x/blade.md:1222 +#: ./docs/master/blade.md:1182 msgid "If you have used a JavaScript framework such as Vue, you may be familiar with \"scoped slots\", which allow you to access data or methods from the component within your slot. You may achieve similar behavior in Laravel by defining public methods or properties on your component and accessing the component within your slot via the `$component` variable. In this example, we will assume that the `x-alert` component has a public `formatAlert` method defined on its component class:" -msgstr "若讀者使用過如 Vue 之類的 JavaScript 框架,可能有看過「限定區域的 Slot (Scoped Slot)」。這種 Slot 可以讓我們能在 Slot 中從元件內存取資料或方法。在 Laravel 中,可以在元素內定義公用方法或屬性,然後在 Slot 內通過 `$component` 變數來存取元件,就可以達到類似的行為。在這個例子裡,我們會假設 `x-alert` 元件中有一個在元件類別內定義的公用 `formatAlert` 方法:" +msgstr "" -#: docs/10.x/blade.md:block 298 (code) +# CODE: html +#: ./docs/8.x/blade.md:912 msgid "\n" -" \n" -" {{ $component->formatAlert('Server Error') }}\n" -" \n\n" -" Whoops! Something went wrong!\n" -"\n" -msgstr "\n" -" \n" +" \n" " {{ $component->formatAlert('Server Error') }}\n" " \n\n" " Whoops! Something went wrong!\n" -"\n" +"
    " +msgstr "" + +# CODE +#: ./docs/10.x/blade.md:913 +#: ./docs/11.x/blade.md:953 +#: ./docs/master/blade.md:913 +msgid "Components content';\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 300 (header) +# P +#: ./docs/8.x/blade.md:922 +#: ./docs/9.x/blade.md:1162 +#: ./docs/10.x/blade.md:1194 +#: ./docs/11.x/blade.md:1234 +#: ./docs/master/blade.md:1194 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:923 +#: ./docs/9.x/blade.md:1163 +#: ./docs/10.x/blade.md:1195 +#: ./docs/11.x/blade.md:1235 +#: ./docs/master/blade.md:1195 msgid "Slot Attributes" -msgstr "Slot 屬性" +msgstr "" -#: docs/10.x/blade.md:block 301 (paragraph) +# P +#: ./docs/11.x/blade.md:924 +msgid "The elements in the `$data` array should never be directly embedded into the Blade string returned by your `render` method, as doing so could allow remote code execution via malicious attribute content." +msgstr "" + +# P +#: ./docs/8.x/blade.md:925 +#: ./docs/9.x/blade.md:1165 +#: ./docs/10.x/blade.md:1197 +#: ./docs/11.x/blade.md:1237 +#: ./docs/master/blade.md:1197 msgid "Like Blade components, you may assign additional [attributes](#component-attributes) to slots such as CSS class names:" -msgstr "與 Blade 元件類似,我們可以將一些如 CSS Class 名稱等額外的[屬性](#component-attributes)指派給 Slot:" +msgstr "" -#: docs/10.x/blade.md:block 302 (code) +# CODE: html +#: ./docs/8.x/blade.md:927 msgid "\n" -" \n" -" Heading\n" -" \n\n" -" Content\n\n" -" \n" -" Footer\n" -" \n" -"\n" -msgstr "\n" -" \n" +" \n" " Heading\n" " \n\n" " Content\n\n" -" \n" +" \n" " Footer\n" " \n" -"\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 303 (paragraph) +# P +#: ./docs/8.x/blade.md:941 +#: ./docs/9.x/blade.md:1181 +#: ./docs/10.x/blade.md:1213 +#: ./docs/11.x/blade.md:1253 +#: ./docs/master/blade.md:1213 msgid "To interact with slot attributes, you may access the `attributes` property of the slot's variable. For more information on how to interact with attributes, please consult the documentation on [component attributes](#component-attributes):" -msgstr "若要與 Slot 屬性互動,可以存取 Slot 變數的 `attributes` 屬性。更多有關與屬性互動的資訊,請參考關於[元件屬性](#component-attributes)的說明文件:" +msgstr "" -#: docs/10.x/blade.md:block 304 (code) +# CODE: php +# CODE: blade +#: ./docs/8.x/blade.md:943 +#: ./docs/9.x/blade.md:1183 +#: ./docs/10.x/blade.md:1215 +#: ./docs/11.x/blade.md:1255 +#: ./docs/master/blade.md:1215 msgid "@props([\n" " 'heading',\n" " 'footer',\n" @@ -1979,330 +4137,602 @@ msgid "@props([\n" "
    attributes->class(['text-gray-700']) }}>\n" " {{ $footer }}\n" "
    \n" -"\n" -msgstr "@props([\n" -" 'heading',\n" -" 'footer',\n" -"])\n\n" -"
    class(['border']) }}>\n" -"

    attributes->class(['text-lg']) }}>\n" -" {{ $heading }}\n" -"

    \n\n" -" {{ $slot }}\n\n" -"
    attributes->class(['text-gray-700']) }}>\n" -" {{ $footer }}\n" -"
    \n" -"
    \n" +"" +msgstr "" -#: docs/10.x/blade.md:block 306 (header) +# P +#: ./docs/8.x/blade.md:962 +#: ./docs/9.x/blade.md:1202 +#: ./docs/10.x/blade.md:1234 +#: ./docs/11.x/blade.md:1274 +#: ./docs/master/blade.md:1234 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:963 +#: ./docs/9.x/blade.md:1203 +#: ./docs/10.x/blade.md:1235 +#: ./docs/11.x/blade.md:1275 +#: ./docs/master/blade.md:1235 msgid "Inline Component Views" -msgstr "內嵌元件 View" +msgstr "" -#: docs/10.x/blade.md:block 307 (paragraph) +# P +#: ./docs/8.x/blade.md:965 +#: ./docs/9.x/blade.md:1205 +#: ./docs/10.x/blade.md:1237 +#: ./docs/11.x/blade.md:1277 +#: ./docs/master/blade.md:1237 msgid "For very small components, it may feel cumbersome to manage both the component class and the component's view template. For this reason, you may return the component's markup directly from the `render` method:" -msgstr "對於非常小的元件,要同時處理元件類別與元件樣板感覺非常麻煩。為此,可以直接在 `render` 方法內回傳元件的標記:" +msgstr "" -#: docs/10.x/blade.md:block 308 (code) +# CODE +#: ./docs/8.x/blade.md:967 +#: ./docs/9.x/blade.md:1207 msgid "/**\n" " * Get the view / contents that represent the component.\n" +" *\n" +" * @return \\Illuminate\\View\\View|\\Closure|string\n" " */\n" -"public function render(): string\n" -"{\n" -" return <<<'blade'\n" -"
    \n" -" {{ $slot }}\n" -"
    \n" -" blade;\n" -"}\n" -msgstr "/**\n" -" * Get the view / contents that represent the component.\n" -" */\n" -"public function render(): string\n" +"public function render()\n" "{\n" " return <<<'blade'\n" "
    \n" " {{ $slot }}\n" "
    \n" " blade;\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 310 (header) +# P +#: ./docs/8.x/blade.md:981 +#: ./docs/9.x/blade.md:1221 +#: ./docs/10.x/blade.md:1251 +#: ./docs/11.x/blade.md:1291 +#: ./docs/master/blade.md:1251 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:982 +#: ./docs/9.x/blade.md:1222 +#: ./docs/10.x/blade.md:1252 +#: ./docs/11.x/blade.md:1292 +#: ./docs/master/blade.md:1252 msgid "Generating Inline View Components" -msgstr "產生內嵌 View 元件" +msgstr "" -#: docs/10.x/blade.md:block 311 (paragraph) +# P +#: ./docs/8.x/blade.md:984 +#: ./docs/9.x/blade.md:1224 +#: ./docs/10.x/blade.md:1254 +#: ./docs/11.x/blade.md:1294 +#: ./docs/master/blade.md:1254 msgid "To create a component that renders an inline view, you may use the `inline` option when executing the `make:component` command:" -msgstr "若要建立會轉譯內嵌 View 的元件,可以在執行 `make:component` 指令時加上 `inline` 選項:" - -#: docs/10.x/blade.md:block 312 (code) -msgid "php artisan make:component Alert --inline\n" -msgstr "php artisan make:component Alert --inline\n" - -#: docs/10.x/blade.md:block 314 (header) -msgid "Dynamic Components" -msgstr "動態元件" - -#: docs/10.x/blade.md:block 315 (paragraph) -msgid "Sometimes you may need to render a component but not know which component should be rendered until runtime. In this situation, you may use Laravel's built-in `dynamic-component` component to render the component based on a runtime value or variable:" -msgstr "有時候我們可能會需要轉譯元件,但在執行階段前並不知道要轉譯哪個元件。這種情況,可以使用 Laravel 的內建「dynamic-component」動態元件來依照執行階段的值或變數進行轉譯:" - -#: docs/10.x/blade.md:block 316 (code) -msgid "// $componentName = \"secondary-button\";\n\n" -"\n" -msgstr "// $componentName = \"secondary-button\";\n\n" -"\n" - -#: docs/10.x/blade.md:block 318 (header) -msgid "Manually Registering Components" -msgstr "手動註冊元件" - -#: docs/10.x/blade.md:block 319 (quote) -msgid "**Warning** The following documentation on manually registering components is primarily applicable to those who are writing Laravel packages that include view components. If you are not writing a package, this portion of the component documentation may not be relevant to you." -msgstr "**Warning** 下列有關手動註冊元件的說明文件主要適用於撰寫包含 View 元件的 Laravel 套件的套件作者。若你並不撰寫套件,則這部分的元件說明文件可能跟你比較沒關係。" - -#: docs/10.x/blade.md:block 321 (paragraph) -msgid "However, if you are building a package that utilizes Blade components or placing components in non-conventional directories, you will need to manually register your component class and its HTML tag alias so that Laravel knows where to find the component. You should typically register your components in the `boot` method of your package's service provider:" -msgstr "不過,若想製作使用 Blade 元件的套件或將元件放在不符合慣例的目錄內,則需要手動註冊元件類別與其 HTML 標籤別名,以讓 Laravel 知道要在哪裡尋找元件。通常,應在套件的 Service Provider 內的 `boot` 方法中註冊你的元件:" - -#: docs/10.x/blade.md:block 322 (code) -msgid "use Illuminate\\Support\\Facades\\Blade;\n" -"use VendorPackage\\View\\Components\\AlertComponent;\n\n" -"/**\n" -" * Bootstrap your package's services.\n" -" */\n" -"public function boot(): void\n" -"{\n" -" Blade::component('package-alert', AlertComponent::class);\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Blade;\n" -"use VendorPackage\\View\\Components\\AlertComponent;\n\n" -"/**\n" -" * Bootstrap your package's services.\n" -" */\n" -"public function boot(): void\n" -"{\n" -" Blade::component('package-alert', AlertComponent::class);\n" -"}\n" +msgstr "" -#: docs/10.x/blade.md:block 325 (header) -msgid "Autoloading Package Components" -msgstr "自動載入套件元件" +# CODE +# CODE: shell +#: ./docs/8.x/blade.md:986 +#: ./docs/9.x/blade.md:1226 +#: ./docs/10.x/blade.md:1256 +#: ./docs/11.x/blade.md:1296 +#: ./docs/master/blade.md:1256 +msgid "php artisan make:component Alert --inline" +msgstr "" -#: docs/10.x/blade.md:block 332 (header) +# P +#: ./docs/8.x/blade.md:988 +#: ./docs/9.x/blade.md:1293 +#: ./docs/10.x/blade.md:1321 +#: ./docs/11.x/blade.md:1361 +#: ./docs/master/blade.md:1321 +#~ msgid "" +#~ msgstr "" + +# H3 +# H2 +#: ./docs/8.x/blade.md:989 +#: ./docs/9.x/blade.md:1294 +#: ./docs/10.x/blade.md:1322 +#: ./docs/11.x/blade.md:1362 +#: ./docs/master/blade.md:1322 msgid "Anonymous Components" -msgstr "匿名元件" +msgstr "" -#: docs/10.x/blade.md:block 333 (paragraph) +# P +#: ./docs/8.x/blade.md:991 +#: ./docs/9.x/blade.md:1296 +#: ./docs/10.x/blade.md:1324 +#: ./docs/11.x/blade.md:1364 +#: ./docs/master/blade.md:1324 msgid "Similar to inline components, anonymous components provide a mechanism for managing a component via a single file. However, anonymous components utilize a single view file and have no associated class. To define an anonymous component, you only need to place a Blade template within your `resources/views/components` directory. For example, assuming you have defined a component at `resources/views/components/alert.blade.php`, you may simply render it like so:" -msgstr "與內嵌元件類似,匿名元件提供了一種能在單一檔案內管理元件的機制。不過,匿名元件使用單一 View 檔案,且沒有相關聯的類別。若要定義匿名元件,只需要將 Blade 樣板放在 `resources/views/components` 目錄內即可。舉例來說,假設有在 `resources/views/components/alert.blade.php` 內定義個了一個元件,則可以輕鬆地像這樣轉譯該元件:" +msgstr "" -#: docs/10.x/blade.md:block 334 (code) -msgid "\n" -msgstr "\n" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:993 +#: ./docs/9.x/blade.md:1298 +#: ./docs/10.x/blade.md:1326 +#: ./docs/11.x/blade.md:1366 +#: ./docs/master/blade.md:1326 +msgid "" +msgstr "" -#: docs/10.x/blade.md:block 335 (paragraph) +# P +#: ./docs/8.x/blade.md:995 +#: ./docs/9.x/blade.md:1302 +#: ./docs/10.x/blade.md:1330 +#: ./docs/11.x/blade.md:1370 +#: ./docs/master/blade.md:1330 msgid "You may use the `.` character to indicate if a component is nested deeper inside the `components` directory. For example, assuming the component is defined at `resources/views/components/inputs/button.blade.php`, you may render it like so:" -msgstr "可以使用 `.` 字元來表示該元件是嵌套放在 `components` 目錄下的。舉例來說,假設某個元件是定義在 `resources/views/components/inputs/button.blade.php`,則可以像這樣對其進行轉譯:" +msgstr "" -#: docs/10.x/blade.md:block 338 (header) +# P +#: ./docs/8.x/blade.md:999 +#: ./docs/9.x/blade.md:1308 +#: ./docs/10.x/blade.md:1336 +#: ./docs/11.x/blade.md:1376 +#: ./docs/master/blade.md:1336 +#~ msgid "" +#~ msgstr "" + +# H4 +# H3 +#: ./docs/8.x/blade.md:1000 +#: ./docs/9.x/blade.md:1309 +#: ./docs/10.x/blade.md:1337 +#: ./docs/11.x/blade.md:1377 +#: ./docs/master/blade.md:1337 msgid "Anonymous Index Components" -msgstr "匿名的 Index 元件" +msgstr "" -#: docs/10.x/blade.md:block 339 (paragraph) +# P +#: ./docs/8.x/blade.md:1002 +#: ./docs/9.x/blade.md:1311 +#: ./docs/10.x/blade.md:1339 +#: ./docs/11.x/blade.md:1379 +#: ./docs/master/blade.md:1339 msgid "Sometimes, when a component is made up of many Blade templates, you may wish to group the given component's templates within a single directory. For example, imagine an \"accordion\" component with the following directory structure:" -msgstr "有時候,若我們做了一個由多個 Blade 樣板組成的元件,我們可能會想將給定的元件樣板放在單一目錄內群組化起來。舉例來說,若有個「accordion」元件,並有下列目錄結構:" +msgstr "" -#: docs/10.x/blade.md:block 340 (code) +# CODE: none +#: ./docs/8.x/blade.md:1004 +#: ./docs/9.x/blade.md:1313 +#: ./docs/10.x/blade.md:1341 +#: ./docs/11.x/blade.md:1381 +#: ./docs/master/blade.md:1341 msgid "/resources/views/components/accordion.blade.php\n" -"/resources/views/components/accordion/item.blade.php\n" -msgstr "/resources/views/components/accordion.blade.php\n" -"/resources/views/components/accordion/item.blade.php\n" +"/resources/views/components/accordion/item.blade.php" +msgstr "" -#: docs/10.x/blade.md:block 341 (paragraph) +# P +#: ./docs/8.x/blade.md:1009 +#: ./docs/9.x/blade.md:1318 +#: ./docs/10.x/blade.md:1346 +#: ./docs/11.x/blade.md:1386 +#: ./docs/master/blade.md:1346 msgid "This directory structure allows you to render the accordion component and its item like so:" -msgstr "使用這個目錄結構能讓我們將 accordion 元件與其元素依照下列這種方式轉譯:" +msgstr "" -#: docs/10.x/blade.md:block 342 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1011 +#: ./docs/9.x/blade.md:1320 +#: ./docs/10.x/blade.md:1348 +#: ./docs/11.x/blade.md:1388 +#: ./docs/master/blade.md:1348 msgid "\n" " \n" " ...\n" " \n" -"\n" -msgstr "\n" -" \n" -" ...\n" -" \n" -"\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 343 (paragraph) +# P +#: ./docs/8.x/blade.md:1019 +#: ./docs/9.x/blade.md:1328 +#: ./docs/10.x/blade.md:1356 +#: ./docs/11.x/blade.md:1396 +#: ./docs/master/blade.md:1356 msgid "However, in order to render the accordion component via `x-accordion`, we were forced to place the \"index\" accordion component template in the `resources/views/components` directory instead of nesting it within the `accordion` directory with the other accordion related templates." -msgstr "不過,若要使用 `x-accordion` 來轉譯 accordion 元件,則我們必須強制將「index」的 accordion 元件樣板放在 `resources/views/components` 目錄,而不是與其他 accordion 相關的樣板一起放在 `accordion` 目錄下。" +msgstr "" -#: docs/10.x/blade.md:block 344 (paragraph) +# P +#: ./docs/8.x/blade.md:1021 +#: ./docs/9.x/blade.md:1330 +#: ./docs/10.x/blade.md:1358 +#: ./docs/master/blade.md:1358 msgid "Thankfully, Blade allows you to place an `index.blade.php` file within a component's template directory. When an `index.blade.php` template exists for the component, it will be rendered as the \"root\" node of the component. So, we can continue to use the same Blade syntax given in the example above; however, we will adjust our directory structure like so:" -msgstr "好佳在,Blade 能讓我們在元件的樣板目錄內放置一個 `index.blade.php` 檔案。當該元件內有 `index.blade.php` 樣板時,Laravel 會將其轉移為元件的「根節點」。因此,我們可以使用與上方範例相同的 Blade 語法。不過,我們會需要將目錄結構改成如下:" +msgstr "" -#: docs/10.x/blade.md:block 345 (code) +# CODE: none +#: ./docs/8.x/blade.md:1023 +#: ./docs/9.x/blade.md:1332 +#: ./docs/10.x/blade.md:1360 +#: ./docs/master/blade.md:1360 msgid "/resources/views/components/accordion/index.blade.php\n" -"/resources/views/components/accordion/item.blade.php\n" -msgstr "/resources/views/components/accordion/index.blade.php\n" -"/resources/views/components/accordion/item.blade.php\n" +"/resources/views/components/accordion/item.blade.php" +msgstr "" -#: docs/10.x/blade.md:block 347 (header) +# P +#: ./docs/8.x/blade.md:1028 +#: ./docs/9.x/blade.md:1337 +#: ./docs/10.x/blade.md:1365 +#: ./docs/11.x/blade.md:1405 +#: ./docs/master/blade.md:1365 +#~ msgid "" +#~ msgstr "" + +# H4 +# H3 +#: ./docs/8.x/blade.md:1029 +#: ./docs/9.x/blade.md:1338 +#: ./docs/10.x/blade.md:1366 +#: ./docs/11.x/blade.md:1406 +#: ./docs/master/blade.md:1366 msgid "Data Properties / Attributes" -msgstr "資料屬性" +msgstr "" -#: docs/10.x/blade.md:block 348 (paragraph) +# P +#: ./docs/8.x/blade.md:1031 +#: ./docs/9.x/blade.md:1340 +#: ./docs/10.x/blade.md:1368 +#: ./docs/11.x/blade.md:1408 +#: ./docs/master/blade.md:1368 msgid "Since anonymous components do not have any associated class, you may wonder how you may differentiate which data should be passed to the component as variables and which attributes should be placed in the component's [attribute bag](#component-attributes)." -msgstr "由於匿名元件沒有相關聯的類別,因此你可能像知道該如何判斷那些資料應作為變數傳給元件,而那些屬性應放在元件的 [Attribute Bag](#component-attributes) 內。" +msgstr "" -#: docs/10.x/blade.md:block 349 (paragraph) +# P +#: ./docs/8.x/blade.md:1033 +#: ./docs/9.x/blade.md:1342 +#: ./docs/10.x/blade.md:1370 +#: ./docs/11.x/blade.md:1410 +#: ./docs/master/blade.md:1370 msgid "You may specify which attributes should be considered data variables using the `@props` directive at the top of your component's Blade template. All other attributes on the component will be available via the component's attribute bag. If you wish to give a data variable a default value, you may specify the variable's name as the array key and the default value as the array value:" -msgstr "可以通過在元件的 Blade 樣板最上方使用 `@props` 指示詞來指定那個屬性應被當作資料變數使用。在元件中,所有其他的屬性都會通過元件的屬性包內可用。若像為某個資料變數設定預設值,則可以指定變數的名稱作為陣列索引鍵,並以預設值作為陣列值:" +msgstr "" -#: docs/10.x/blade.md:block 350 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:1035 +#: ./docs/9.x/blade.md:1344 +#: ./docs/10.x/blade.md:1372 +#: ./docs/11.x/blade.md:1412 +#: ./docs/master/blade.md:1372 msgid "\n\n" "@props(['type' => 'info', 'message'])\n\n" "
    merge(['class' => 'alert alert-'.$type]) }}>\n" " {{ $message }}\n" -"
    \n" -msgstr "\n\n" -"@props(['type' => 'info', 'message'])\n\n" -"
    merge(['class' => 'alert alert-'.$type]) }}>\n" -" {{ $message }}\n" -"
    \n" +"" +msgstr "" + +# H4 +#: ./docs/10.x/blade.md:1039 +#: ./docs/11.x/blade.md:1079 +#: ./docs/master/blade.md:1039 +msgid "Retrieving and Filtering Attributes" +msgstr "" -#: docs/10.x/blade.md:block 351 (paragraph) +# CODE: blade +#: ./docs/10.x/blade.md:1043 +#: ./docs/11.x/blade.md:1083 +#: ./docs/master/blade.md:1043 +msgid "{{ $attributes->filter(fn (string $value, string $key) => $key == 'foo') }}" +msgstr "" + +# P +#: ./docs/8.x/blade.md:1043 +#: ./docs/9.x/blade.md:1354 +#: ./docs/10.x/blade.md:1382 +#: ./docs/11.x/blade.md:1422 +#: ./docs/master/blade.md:1382 msgid "Given the component definition above, we may render the component like so:" -msgstr "以上方的元件定義為例,我們可能會像這樣來轉譯元件:" +msgstr "" -#: docs/10.x/blade.md:block 354 (header) +# P +#: ./docs/8.x/blade.md:1047 +#: ./docs/9.x/blade.md:1360 +#: ./docs/10.x/blade.md:1388 +#: ./docs/11.x/blade.md:1428 +#: ./docs/master/blade.md:1388 +#~ msgid "" +#~ msgstr "" + +# H4 +# H3 +#: ./docs/8.x/blade.md:1048 +#: ./docs/9.x/blade.md:1361 +#: ./docs/10.x/blade.md:1389 +#: ./docs/11.x/blade.md:1429 +#: ./docs/master/blade.md:1389 msgid "Accessing Parent Data" -msgstr "存取上層資料" +msgstr "" -#: docs/10.x/blade.md:block 355 (paragraph) +# P +#: ./docs/8.x/blade.md:1050 +#: ./docs/9.x/blade.md:1363 +#: ./docs/10.x/blade.md:1391 +#: ./docs/11.x/blade.md:1431 +#: ./docs/master/blade.md:1391 msgid "Sometimes you may want to access data from a parent component inside a child component. In these cases, you may use the `@aware` directive. For example, imagine we are building a complex menu component consisting of a parent `` and child ``:" -msgstr "有時候,我們會想從子元件中存取上層元件的資料。在這種情況下,可以使用 `@aware` 指示詞。舉例來說,假設我們正在建立一個有上層元件 `` 與子元件 `` 的複雜選單元件:" +msgstr "" -#: docs/10.x/blade.md:block 356 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:1052 +#: ./docs/9.x/blade.md:1365 +#: ./docs/10.x/blade.md:1393 +#: ./docs/11.x/blade.md:1433 +#: ./docs/master/blade.md:1393 msgid "\n" " ...\n" " ...\n" -"\n" -msgstr "\n" -" ...\n" -" ...\n" -"\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 357 (paragraph) +# P +#: ./docs/8.x/blade.md:1057 +#: ./docs/9.x/blade.md:1372 +#: ./docs/10.x/blade.md:1400 +#: ./docs/11.x/blade.md:1440 +#: ./docs/master/blade.md:1400 msgid "The `` component may have an implementation like the following:" -msgstr "`` 元件可能會有像這樣的實作:" +msgstr "" -#: docs/10.x/blade.md:block 358 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:1059 +#: ./docs/9.x/blade.md:1374 +#: ./docs/10.x/blade.md:1402 +#: ./docs/11.x/blade.md:1442 +#: ./docs/master/blade.md:1402 msgid "\n\n" "@props(['color' => 'gray'])\n\n" "
      merge(['class' => 'bg-'.$color.'-200']) }}>\n" " {{ $slot }}\n" -"
    \n" -msgstr "\n\n" -"@props(['color' => 'gray'])\n\n" -"
      merge(['class' => 'bg-'.$color.'-200']) }}>\n" -" {{ $slot }}\n" -"
    \n" +"" +msgstr "" -#: docs/10.x/blade.md:block 359 (paragraph) +# P +#: ./docs/8.x/blade.md:1067 +#: ./docs/9.x/blade.md:1384 +#: ./docs/10.x/blade.md:1412 +#: ./docs/11.x/blade.md:1452 +#: ./docs/master/blade.md:1412 msgid "Because the `color` prop was only passed into the parent (``), it won't be available inside ``. However, if we use the `@aware` directive, we can make it available inside `` as well:" -msgstr "由於 `color` 屬性只傳給了上層元件 (``),因此該屬性在 `` 中將無法存取。不過,若我們使用了 `@aware` 指示詞,就可以讓該屬性也在 `` 內可用:" +msgstr "" -#: docs/10.x/blade.md:block 360 (code) +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:1069 +#: ./docs/9.x/blade.md:1386 +#: ./docs/10.x/blade.md:1414 +#: ./docs/11.x/blade.md:1454 +#: ./docs/master/blade.md:1414 msgid "\n\n" "@aware(['color' => 'gray'])\n\n" "
  • merge(['class' => 'text-'.$color.'-800']) }}>\n" " {{ $slot }}\n" -"
  • \n" -msgstr "\n\n" -"@aware(['color' => 'gray'])\n\n" -"
  • merge(['class' => 'text-'.$color.'-800']) }}>\n" -" {{ $slot }}\n" -"
  • \n" +"" +msgstr "" -#: docs/10.x/blade.md:block 361 (quote) -msgid "**Warning** The `@aware` directive can not access parent data that is not explicitly passed to the parent component via HTML attributes. Default `@props` values that are not explicitly passed to the parent component can not be accessed by the `@aware` directive." -msgstr "**Warning** `@aware` 指示詞無法存取不是通過 HTML 屬性顯式傳遞給上層原件的上層資料。未顯式傳遞給上層元件的預設 `@props` 值無法被 `@aware` 指示詞存取。" +# P +#: ./docs/10.x/blade.md:1073 +#: ./docs/11.x/blade.md:1113 +#: ./docs/master/blade.md:1073 +msgid "If an array is passed to the `has` method, the method will determine if all of the given attributes are present on the component:" +msgstr "" -#: docs/10.x/blade.md:block 363 (header) -msgid "Anonymous Component Paths" -msgstr "匿名元件路徑" +# CODE: blade +#: ./docs/10.x/blade.md:1075 +#: ./docs/11.x/blade.md:1115 +#: ./docs/master/blade.md:1075 +msgid "@if ($attributes->has(['name', 'class']))\n" +"
    All of the attributes are present
    \n" +"@endif" +msgstr "" -#: docs/10.x/blade.md:block 364 (paragraph) -msgid "As previously discussed, anonymous components are typically defined by placing a Blade template within your `resources/views/components` directory. However, you may occasionally want to register other anonymous component paths with Laravel in addition to the default path." -msgstr "前面也提到過,若要定義匿名原件,一般是將 Blade 樣板放在 `resources/views/components` 目錄內。不過,有時候,我們可能會想向 Laravel 註冊預設路徑以外的其他路徑來放置匿名原件。" +# P +#: ./docs/8.x/blade.md:1077 +#: ./docs/9.x/blade.md:1230 +#: ./docs/10.x/blade.md:1260 +#: ./docs/11.x/blade.md:1300 +#: ./docs/master/blade.md:1260 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:1078 +#: ./docs/9.x/blade.md:1231 +#: ./docs/10.x/blade.md:1261 +#: ./docs/11.x/blade.md:1301 +#: ./docs/master/blade.md:1261 +msgid "Dynamic Components" +msgstr "" -#: docs/10.x/blade.md:block 365 (paragraph) -msgid "The `anonymousComponentPath` method accepts the \"path\" to the anonymous component location as its first argument and an optional \"namespace\" that components should be placed under as its second argument. Typically, this method should be called from the `boot` method of one of your application's [service providers](/docs/{{version}}/providers):" -msgstr " `anonymousComponentPath ` 方法的第一個引數為匿名原件位置的「路徑」,而第二個可選引數則是該元件所要被放置的「Namespace」。一般來說,應在專案的某個 [Service Provider](/docs/{{version}}/providers) 內 `boot` 方法中呼叫:" +# P +#: ./docs/8.x/blade.md:1080 +#: ./docs/9.x/blade.md:1233 +#: ./docs/10.x/blade.md:1263 +#: ./docs/11.x/blade.md:1303 +#: ./docs/master/blade.md:1263 +msgid "Sometimes you may need to render a component but not know which component should be rendered until runtime. In this situation, you may use Laravel's built-in `dynamic-component` component to render the component based on a runtime value or variable:" +msgstr "" -#: docs/10.x/blade.md:block 366 (code) -msgid "/**\n" -" * Bootstrap any application services.\n" -" */\n" -"public function boot(): void\n" -"{\n" -" Blade::anonymousComponentPath(__DIR__.'/../components');\n" -"}\n" -msgstr "/**\n" -" * Bootstrap any application services.\n" -" */\n" -"public function boot(): void\n" -"{\n" -" Blade::anonymousComponentPath(__DIR__.'/../components');\n" -"}\n" +# P +#: ./docs/10.x/blade.md:1081 +#: ./docs/11.x/blade.md:1121 +#: ./docs/master/blade.md:1081 +msgid "The `hasAny` method may be used to determine if any of the given attributes are present on the component:" +msgstr "" -#: docs/10.x/blade.md:block 367 (paragraph) -msgid "When component paths are registered without a specified prefix as in the example above, they may be rendered in your Blade components without a corresponding prefix as well. For example, if a `panel.blade.php` component exists in the path registered above, it may be rendered like so:" -msgstr "若像上述範例這樣,不指定前置詞來註冊元件路徑的話,在 Blade 元件時也就不需要使用對應的前置詞。舉例來說,若上述程式碼中註冊的路徑下有 `panel.blade.php` 元件的話,可以像這樣轉譯該元件:" +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:1082 +#: ./docs/9.x/blade.md:1235 +msgid "" +msgstr "" + +# CODE: blade +#: ./docs/10.x/blade.md:1083 +#: ./docs/11.x/blade.md:1123 +#: ./docs/master/blade.md:1083 +msgid "@if ($attributes->hasAny(['href', ':href', 'v-bind:href']))\n" +"
    One of the attributes is present
    \n" +"@endif" +msgstr "" -#: docs/10.x/blade.md:block 368 (code) -msgid "\n" -msgstr "\n" +# P +#: ./docs/8.x/blade.md:1084 +#: ./docs/9.x/blade.md:1239 +#: ./docs/10.x/blade.md:1271 +#: ./docs/11.x/blade.md:1311 +#: ./docs/master/blade.md:1271 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:1085 +#: ./docs/9.x/blade.md:1240 +#: ./docs/10.x/blade.md:1272 +#: ./docs/11.x/blade.md:1312 +#: ./docs/master/blade.md:1272 +msgid "Manually Registering Components" +msgstr "" -#: docs/10.x/blade.md:block 369 (paragraph) -msgid "Prefix \"namespaces\" may be provided as the second argument to the `anonymousComponentPath` method:" -msgstr "也可以使用 `anonymousComponentPath` 方法的第二個引來提供前置詞「Namespace」:" +# P +#: ./docs/8.x/blade.md:1087 +#: ./docs/9.x/blade.md:1243 +#: ./docs/10.x/blade.md:1275 +#: ./docs/11.x/blade.md:1315 +#: ./docs/master/blade.md:1275 +msgid "The following documentation on manually registering components is primarily applicable to those who are writing Laravel packages that include view components. If you are not writing a package, this portion of the component documentation may not be relevant to you." +msgstr "" -#: docs/10.x/blade.md:block 370 (code) -msgid "Blade::anonymousComponentPath(__DIR__.'/../components', 'dashboard');\n" -msgstr "Blade::anonymousComponentPath(__DIR__.'/../components', 'dashboard');\n" +# P +#: ./docs/8.x/blade.md:1091 +#: ./docs/9.x/blade.md:1247 +#: ./docs/10.x/blade.md:1279 +#: ./docs/11.x/blade.md:1319 +#: ./docs/master/blade.md:1279 +msgid "However, if you are building a package that utilizes Blade components or placing components in non-conventional directories, you will need to manually register your component class and its HTML tag alias so that Laravel knows where to find the component. You should typically register your components in the `boot` method of your package's service provider:" +msgstr "" -#: docs/10.x/blade.md:block 371 (paragraph) -msgid "When a prefix is provided, components within that \"namespace\" may be rendered by prefixing to the component's namespace to the component name when the component is rendered:" -msgstr "提供前置詞時,若要轉譯這些放在「Namespace」下的元件,只要在該元件的名稱前方加上其 Namespace 即可:" +# CODE +#: ./docs/8.x/blade.md:1093 +#: ./docs/9.x/blade.md:1249 +msgid "use Illuminate\\Support\\Facades\\Blade;\n" +"use VendorPackage\\View\\Components\\AlertComponent;\n\n" +"/**\n" +" * Bootstrap your package's services.\n" +" *\n" +" * @return void\n" +" */\n" +"public function boot()\n" +"{\n" +" Blade::component('package-alert', AlertComponent::class);\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 372 (code) -msgid "\n" -msgstr "\n" +# H4 +#: ./docs/8.x/blade.md:1110 +#: ./docs/9.x/blade.md:1268 +#: ./docs/10.x/blade.md:1298 +#: ./docs/11.x/blade.md:1338 +#: ./docs/master/blade.md:1298 +msgid "Autoloading Package Components" +msgstr "" -#: docs/10.x/blade.md:block 374 (header) +# P +#: ./docs/8.x/blade.md:1133 +#: ./docs/9.x/blade.md:1432 +#: ./docs/10.x/blade.md:1458 +#: ./docs/11.x/blade.md:1498 +#: ./docs/master/blade.md:1458 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/blade.md:1134 +#: ./docs/9.x/blade.md:1433 +#: ./docs/10.x/blade.md:1459 +#: ./docs/11.x/blade.md:1499 +#: ./docs/master/blade.md:1459 msgid "Building Layouts" -msgstr "製作 Layout" +msgstr "" -#: docs/10.x/blade.md:block 376 (header) +# P +#: ./docs/8.x/blade.md:1136 +#: ./docs/9.x/blade.md:1435 +#: ./docs/10.x/blade.md:1461 +#: ./docs/11.x/blade.md:1501 +#: ./docs/master/blade.md:1461 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:1137 +#: ./docs/9.x/blade.md:1436 +#: ./docs/10.x/blade.md:1462 +#: ./docs/11.x/blade.md:1502 +#: ./docs/master/blade.md:1462 msgid "Layouts Using Components" -msgstr "使用元件的 Layout" - -#: docs/10.x/blade.md:block 377 (paragraph) -msgid "Most web applications maintain the same general layout across various pages. It would be incredibly cumbersome and hard to maintain our application if we had to repeat the entire layout HTML in every view we create. Thankfully, it's convenient to define this layout as a single [Blade component](#components) and then use it throughout our application." -msgstr "大多數網站都會在許多頁面間共用同一個相同 Layout (版面配置)。如果我們每建立一個 HTML 都要重寫一整個 Layout,就會變得非常麻煩又難維護。好佳在,我們可以非常輕鬆地把這個 Layout 定義為一個 [Blade 元件](#components),並在網站中重複利用。" - -#: docs/10.x/blade.md:block 379 (header) -msgid "Defining The Layout Component" -msgstr "定義 Layout 元件" +msgstr "" -#: docs/10.x/blade.md:block 380 (paragraph) -msgid "For example, imagine we are building a \"todo\" list application. We might define a `layout` component that looks like the following:" -msgstr "舉例來說,假設我們正在製作一個「代辦事項」App。我們可能會像這樣定義一個 `layout` 元件:" +# CODE: xml +#: ./docs/9.x/blade.md:1137 +#: ./docs/10.x/blade.md:1147 +#: ./docs/11.x/blade.md:1187 +#: ./docs/master/blade.md:1147 +msgid "\n" +" \n" +" Server Error\n" +" \n\n" +" Whoops! Something went wrong!\n" +"" +msgstr "" + +# P +#: ./docs/8.x/blade.md:1139 +#: ./docs/9.x/blade.md:1438 +#: ./docs/10.x/blade.md:1464 +#: ./docs/11.x/blade.md:1504 +#: ./docs/master/blade.md:1464 +msgid "Most web applications maintain the same general layout across various pages. It would be incredibly cumbersome and hard to maintain our application if we had to repeat the entire layout HTML in every view we create. Thankfully, it's convenient to define this layout as a single [Blade component](#components) and then use it throughout our application." +msgstr "" + +# P +#: ./docs/8.x/blade.md:1141 +#: ./docs/9.x/blade.md:1440 +#: ./docs/10.x/blade.md:1466 +#: ./docs/11.x/blade.md:1506 +#: ./docs/master/blade.md:1466 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:1142 +#: ./docs/9.x/blade.md:1441 +msgid "Defining The Layout Component" +msgstr "" -#: docs/10.x/blade.md:block 381 (code) +# P +#: ./docs/8.x/blade.md:1144 +#: ./docs/9.x/blade.md:1443 +#: ./docs/10.x/blade.md:1469 +#: ./docs/11.x/blade.md:1509 +#: ./docs/master/blade.md:1469 +msgid "For example, imagine we are building a \"todo\" list application. We might define a `layout` component that looks like the following:" +msgstr "" + +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1146 +#: ./docs/9.x/blade.md:1445 +#: ./docs/10.x/blade.md:1471 +#: ./docs/11.x/blade.md:1511 +#: ./docs/master/blade.md:1471 msgid "\n\n" "\n" " \n" @@ -2313,96 +4743,214 @@ msgid "\n\n" "
    \n" " {{ $slot }}\n" " \n" -"\n" -msgstr "\n\n" -"\n" -" \n" -" {{ $title ?? 'Todo Manager' }}\n" -" \n" -" \n" -"

    代辦事項

    \n" -"
    \n" +"" +msgstr "" + +# CODE: blade +#: ./docs/9.x/blade.md:1152 +#: ./docs/10.x/blade.md:1184 +#: ./docs/11.x/blade.md:1224 +#: ./docs/master/blade.md:1184 +msgid "\n" +" \n" +" {{ $component->formatAlert('Server Error') }}\n" +" \n\n" +" Whoops! Something went wrong!\n" +"" +msgstr "" + +# P +#: ./docs/10.x/blade.md:1157 +#: ./docs/11.x/blade.md:1197 +#: ./docs/master/blade.md:1157 +msgid "You may invoke a slot's `isEmpty` method to determine if the slot contains content:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/blade.md:1159 +#: ./docs/11.x/blade.md:1199 +#: ./docs/master/blade.md:1159 +msgid "{{ $title }}\n\n" +"
    \n" +" @if ($slot->isEmpty())\n" +" This is default content if the slot is empty.\n" +" @else\n" " {{ $slot }}\n" -" \n" -"\n" +" @endif\n" +"
    " +msgstr "" -#: docs/10.x/blade.md:block 383 (header) +# P +#: ./docs/8.x/blade.md:1161 +#: ./docs/9.x/blade.md:1460 +#: ./docs/10.x/blade.md:1486 +#: ./docs/11.x/blade.md:1526 +#: ./docs/master/blade.md:1486 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:1162 +#: ./docs/9.x/blade.md:1461 msgid "Applying The Layout Component" -msgstr "套用 Layout 元件" +msgstr "" -#: docs/10.x/blade.md:block 384 (paragraph) +# P +#: ./docs/8.x/blade.md:1164 +#: ./docs/9.x/blade.md:1463 +#: ./docs/10.x/blade.md:1489 +#: ./docs/11.x/blade.md:1529 +#: ./docs/master/blade.md:1489 msgid "Once the `layout` component has been defined, we may create a Blade view that utilizes the component. In this example, we will define a simple view that displays our task list:" -msgstr "定義好 `layout` 元件後,我們就可以建立使用該元件的 Blade 樣板。舉例來說,我們可以定義一個用來顯示任務清單的一個簡單的 View:" +msgstr "" -#: docs/10.x/blade.md:block 385 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1166 +#: ./docs/9.x/blade.md:1465 +#: ./docs/10.x/blade.md:1491 +#: ./docs/master/blade.md:1491 msgid "\n\n" "\n" " @foreach ($tasks as $task)\n" " {{ $task }}\n" " @endforeach\n" -"\n" -msgstr "\n\n" -"\n" -" @foreach ($tasks as $task)\n" -" {{ $task }}\n" -" @endforeach\n" -"\n" +"" +msgstr "" + +# CODE: xml +#: ./docs/9.x/blade.md:1167 +#: ./docs/10.x/blade.md:1199 +#: ./docs/11.x/blade.md:1239 +#: ./docs/master/blade.md:1199 +msgid "\n" +" \n" +" Heading\n" +" \n\n" +" Content\n\n" +" \n" +" Footer\n" +" \n" +"" +msgstr "" + +# P +#: ./docs/10.x/blade.md:1171 +#: ./docs/11.x/blade.md:1211 +#: ./docs/master/blade.md:1171 +msgid "Additionally, the `hasActualContent` method may be used to determine if the slot contains any \"actual\" content that is not an HTML comment:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/blade.md:1173 +#: ./docs/11.x/blade.md:1213 +#: ./docs/master/blade.md:1173 +msgid "@if ($slot->hasActualContent())\n" +" The scope has non-comment content.\n" +"@endif" +msgstr "" -#: docs/10.x/blade.md:block 386 (paragraph) +# P +#: ./docs/8.x/blade.md:1176 +#: ./docs/9.x/blade.md:1475 +#: ./docs/10.x/blade.md:1501 +#: ./docs/11.x/blade.md:1541 +#: ./docs/master/blade.md:1501 msgid "Remember, content that is injected into a component will be supplied to the default `$slot` variable within our `layout` component. As you may have noticed, our `layout` also respects a `$title` slot if one is provided; otherwise, a default title is shown. We may inject a custom title from our task list view using the standard slot syntax discussed in the [component documentation](#components):" -msgstr "請記得,在 `layout` 元件,被插入的內容會被提供給預設的 `$slot` 變數。讀者可能已經注意到,我們的 `layout` 會在有提供 `$title` Slot 時對其進行處理,並在未提供 `$title` 時顯示預設標題。我們也可以通過利用在[元件說明文件](#components)中討論過的方法一樣,在任務清單 View 內通過標準的 Slot 語法來插入自訂標題。" +msgstr "" -#: docs/10.x/blade.md:block 387 (code) +# CODE: html +#: ./docs/8.x/blade.md:1178 msgid "\n\n" "\n" -" \n" -" Custom Title\n" -" \n\n" -" @foreach ($tasks as $task)\n" -" {{ $task }}\n" -" @endforeach\n" -"\n" -msgstr "\n\n" -"\n" -" \n" +" \n" " Custom Title\n" " \n\n" " @foreach ($tasks as $task)\n" " {{ $task }}\n" " @endforeach\n" -"\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 388 (paragraph) +# P +#: ./docs/8.x/blade.md:1192 +#: ./docs/9.x/blade.md:1491 +#: ./docs/10.x/blade.md:1517 +#: ./docs/11.x/blade.md:1557 +#: ./docs/master/blade.md:1517 msgid "Now that we have defined our layout and task list views, we just need to return the `task` view from a route:" -msgstr "現在我們已經定義好了畫面配置以及任務清單 View 了,接著只需要在路由內回傳 `task` View:" +msgstr "" -#: docs/10.x/blade.md:block 389 (code) +# CODE +#: ./docs/8.x/blade.md:1194 +#: ./docs/9.x/blade.md:1493 +#: ./docs/10.x/blade.md:1519 +#: ./docs/11.x/blade.md:1559 +#: ./docs/master/blade.md:1519 msgid "use App\\Models\\Task;\n\n" "Route::get('/tasks', function () {\n" " return view('tasks', ['tasks' => Task::all()]);\n" -"});\n" -msgstr "use App\\Models\\Task;\n\n" -"Route::get('/tasks', function () {\n" -" return view('tasks', ['tasks' => Task::all()]);\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/blade.md:block 391 (header) +# P +#: ./docs/8.x/blade.md:1200 +#: ./docs/9.x/blade.md:1499 +#: ./docs/10.x/blade.md:1525 +#: ./docs/11.x/blade.md:1565 +#: ./docs/master/blade.md:1525 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:1201 +#: ./docs/9.x/blade.md:1500 +#: ./docs/10.x/blade.md:1526 +#: ./docs/11.x/blade.md:1566 +#: ./docs/master/blade.md:1526 msgid "Layouts Using Template Inheritance" -msgstr "使用樣板繼承的版面配置" +msgstr "" -#: docs/10.x/blade.md:block 393 (header) +# P +#: ./docs/8.x/blade.md:1203 +#: ./docs/9.x/blade.md:1502 +#: ./docs/10.x/blade.md:1528 +#: ./docs/11.x/blade.md:1568 +#: ./docs/master/blade.md:1528 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:1204 +#: ./docs/9.x/blade.md:1503 msgid "Defining A Layout" -msgstr "定義版面配置" +msgstr "" -#: docs/10.x/blade.md:block 394 (paragraph) +# P +#: ./docs/8.x/blade.md:1206 +#: ./docs/9.x/blade.md:1505 +#: ./docs/10.x/blade.md:1531 +#: ./docs/11.x/blade.md:1571 +#: ./docs/master/blade.md:1531 msgid "Layouts may also be created via \"template inheritance\". This was the primary way of building applications prior to the introduction of [components](#components)." -msgstr "也可以通過「樣板繼承」來製作 Layout。在[元件](#components)功能問世前,我們通常都是使用這個方法來製作網站。" +msgstr "" -#: docs/10.x/blade.md:block 395 (paragraph) +# P +#: ./docs/8.x/blade.md:1208 +#: ./docs/9.x/blade.md:1507 +#: ./docs/10.x/blade.md:1533 +#: ./docs/11.x/blade.md:1573 +#: ./docs/master/blade.md:1533 msgid "To get started, let's take a look at a simple example. First, we will examine a page layout. Since most web applications maintain the same general layout across various pages, it's convenient to define this layout as a single Blade view:" -msgstr "要開始使用樣板繼承的 Layout,我們先來看一個簡單的例子。首先,我們先來看看一個 Layout 定義。由於大多數的 Web App 都會在多個不同的頁面上共用同一個 Layout,因此將這個 Layout 定義為單一 Blade View 比較方便:" +msgstr "" -#: docs/10.x/blade.md:block 396 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1210 +#: ./docs/9.x/blade.md:1509 +#: ./docs/10.x/blade.md:1535 +#: ./docs/11.x/blade.md:1575 +#: ./docs/master/blade.md:1535 msgid "\n\n" "\n" " \n" @@ -2416,39 +4964,58 @@ msgid "\n\n" " @yield('content')\n" " \n" " \n" -"\n" -msgstr "\n\n" -"\n" -" \n" -" App Name - @yield('title')\n" -" \n" -" \n" -" @section('sidebar')\n" -" This is the master sidebar.\n" -" @show\n\n" -"
    \n" -" @yield('content')\n" -"
    \n" -" \n" -"\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 397 (paragraph) +# P +#: ./docs/8.x/blade.md:1229 +#: ./docs/9.x/blade.md:1528 +#: ./docs/10.x/blade.md:1554 +#: ./docs/11.x/blade.md:1594 +#: ./docs/master/blade.md:1554 msgid "As you can see, this file contains typical HTML mark-up. However, take note of the `@section` and `@yield` directives. The `@section` directive, as the name implies, defines a section of content, while the `@yield` directive is used to display the contents of a given section." -msgstr "就像我們可以看到的一樣,這個檔案包含了普通的 HTML 標記。不過,可以注意到 `@section` 與 `@yield` 指示詞。`@section` 指示詞與其名稱代表的意思一樣,是定義一個內容的段落。而 `@yield` 指示詞則用來將給定段落的內容顯示出來。" +msgstr "" -#: docs/10.x/blade.md:block 398 (paragraph) +# P +#: ./docs/8.x/blade.md:1231 +#: ./docs/9.x/blade.md:1530 +#: ./docs/10.x/blade.md:1556 +#: ./docs/11.x/blade.md:1596 +#: ./docs/master/blade.md:1556 msgid "Now that we have defined a layout for our application, let's define a child page that inherits the layout." -msgstr "現在,我們已經定義好要在網站中使用的 Layout 了。讓我們來定義繼承該 Layout 的子頁面。" +msgstr "" -#: docs/10.x/blade.md:block 400 (header) +# P +#: ./docs/8.x/blade.md:1233 +#: ./docs/9.x/blade.md:1532 +#: ./docs/10.x/blade.md:1558 +#: ./docs/11.x/blade.md:1598 +#: ./docs/master/blade.md:1558 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/blade.md:1234 +#: ./docs/9.x/blade.md:1533 msgid "Extending A Layout" -msgstr "繼承 Layout" +msgstr "" -#: docs/10.x/blade.md:block 401 (paragraph) +# P +#: ./docs/8.x/blade.md:1236 +#: ./docs/9.x/blade.md:1535 +#: ./docs/10.x/blade.md:1561 +#: ./docs/11.x/blade.md:1601 +#: ./docs/master/blade.md:1561 msgid "When defining a child view, use the `@extends` Blade directive to specify which layout the child view should \"inherit\". Views which extend a Blade layout may inject content into the layout's sections using `@section` directives. Remember, as seen in the example above, the contents of these sections will be displayed in the layout using `@yield`:" -msgstr "在定義子 View 時,可以使用 `@extends` Blade 指示詞來指定要「繼承」哪個 Layout。繼承了 Blade 版面配置的 View 可以使用 `@section` 指示詞來將內容插入到 Layout 的段落中。請記得,就像在剛才範例中看到的一樣,這些段落的內容會在 Layout 中通過 `@yield` 來顯示:" +msgstr "" -#: docs/10.x/blade.md:block 402 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1238 +#: ./docs/9.x/blade.md:1537 +#: ./docs/10.x/blade.md:1563 +#: ./docs/11.x/blade.md:1603 +#: ./docs/master/blade.md:1563 msgid "\n\n" "@extends('layouts.app')\n\n" "@section('title', 'Page Title')\n\n" @@ -2458,323 +5025,421 @@ msgid "\n\n" "@endsection\n\n" "@section('content')\n" "

    This is my body content.

    \n" -"@endsection\n" -msgstr "\n\n" -"@extends('layouts.app')\n\n" -"@section('title', 'Page Title')\n\n" -"@section('sidebar')\n" -" @@parent\n\n" -"

    This is appended to the master sidebar.

    \n" -"@endsection\n\n" -"@section('content')\n" -"

    This is my body content.

    \n" -"@endsection\n" +"@endsection" +msgstr "" + +# CODE +#: ./docs/10.x/blade.md:1239 +#: ./docs/11.x/blade.md:1279 +#: ./docs/master/blade.md:1239 +msgid "/**\n" +" * Get the view / contents that represent the component.\n" +" */\n" +"public function render(): string\n" +"{\n" +" return <<<'blade'\n" +"
    \n" +" {{ $slot }}\n" +"
    \n" +" blade;\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 403 (paragraph) +# P +#: ./docs/8.x/blade.md:1256 +#: ./docs/9.x/blade.md:1555 +#: ./docs/10.x/blade.md:1581 +#: ./docs/11.x/blade.md:1621 +#: ./docs/master/blade.md:1581 msgid "In this example, the `sidebar` section is utilizing the `@@parent` directive to append (rather than overwriting) content to the layout's sidebar. The `@@parent` directive will be replaced by the content of the layout when the view is rendered." -msgstr "In this example, the `sidebar` section is utilizing the `@@parent` directive to append (rather than overwriting) content to the layout's sidebar. The `@@parent` directive will be replaced by the content of the layout when the view is rendered." +msgstr "" -#: docs/10.x/blade.md:block 404 (quote) -msgid "**Note** Contrary to the previous example, this `sidebar` section ends with `@endsection` instead of `@show`. The `@endsection` directive will only define a section while `@show` will define and **immediately yield** the section." -msgstr "**Note** 相較於前一個例子,`sidebar` 段落是以 `@endsection` 結束的,而不是 `@show`。`@endsection` 指示詞只會定義一個段落,而 `@show` 則會定義並 **馬上 Yield** 該段落。" +# P +#: ./docs/8.x/blade.md:1258 +#: ./docs/9.x/blade.md:1558 +#: ./docs/10.x/blade.md:1584 +#: ./docs/11.x/blade.md:1624 +#: ./docs/master/blade.md:1584 +msgid "Contrary to the previous example, this `sidebar` section ends with `@endsection` instead of `@show`. The `@endsection` directive will only define a section while `@show` will define and **immediately yield** the section." +msgstr "" -#: docs/10.x/blade.md:block 405 (paragraph) +# P +#: ./docs/8.x/blade.md:1260 +#: ./docs/9.x/blade.md:1560 +#: ./docs/10.x/blade.md:1586 +#: ./docs/11.x/blade.md:1626 +#: ./docs/master/blade.md:1586 msgid "The `@yield` directive also accepts a default value as its second parameter. This value will be rendered if the section being yielded is undefined:" -msgstr "`@yield` 指示詞也接受一個預設值作為其第二個參數。這個值會在要 Yield 的段落未定義時被轉譯:" +msgstr "" + +# CODE +# CODE: blade +#: ./docs/8.x/blade.md:1262 +#: ./docs/9.x/blade.md:1562 +#: ./docs/10.x/blade.md:1588 +#: ./docs/11.x/blade.md:1628 +#: ./docs/master/blade.md:1588 +msgid "@yield('content', 'Default content')" +msgstr "" -#: docs/10.x/blade.md:block 406 (code) -msgid "@yield('content', 'Default content')\n" -msgstr "@yield('content', '預設內容')\n" +# P +#: ./docs/8.x/blade.md:1264 +#: ./docs/9.x/blade.md:1566 +#: ./docs/10.x/blade.md:1592 +#: ./docs/11.x/blade.md:1632 +#: ./docs/master/blade.md:1592 +#~ msgid "" +#~ msgstr "" + +# CODE: blade +#: ./docs/10.x/blade.md:1265 +#: ./docs/11.x/blade.md:1305 +#: ./docs/master/blade.md:1265 +msgid "// $componentName = \"secondary-button\";\n\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 408 (header) +# H2 +#: ./docs/8.x/blade.md:1265 +#: ./docs/9.x/blade.md:1567 +#: ./docs/10.x/blade.md:1593 +#: ./docs/11.x/blade.md:1633 +#: ./docs/master/blade.md:1593 msgid "Forms" -msgstr "表單" +msgstr "" -#: docs/10.x/blade.md:block 410 (header) +# P +#: ./docs/8.x/blade.md:1267 +#: ./docs/9.x/blade.md:1569 +#: ./docs/10.x/blade.md:1595 +#: ./docs/11.x/blade.md:1635 +#: ./docs/master/blade.md:1595 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:1268 +#: ./docs/9.x/blade.md:1570 +#: ./docs/10.x/blade.md:1596 +#: ./docs/11.x/blade.md:1636 +#: ./docs/master/blade.md:1596 msgid "CSRF Field" -msgstr "CSRF 欄位" +msgstr "" -#: docs/10.x/blade.md:block 411 (paragraph) +# P +#: ./docs/8.x/blade.md:1270 +#: ./docs/9.x/blade.md:1572 +#: ./docs/10.x/blade.md:1598 +#: ./docs/11.x/blade.md:1638 +#: ./docs/master/blade.md:1598 msgid "Anytime you define an HTML form in your application, you should include a hidden CSRF token field in the form so that [the CSRF protection](/docs/{{version}}/csrf) middleware can validate the request. You may use the `@csrf` Blade directive to generate the token field:" -msgstr "只要是在專案中內定義 HTML 表單,不管是什麼時候,我們都應該要在表單內包含一個隱藏的 CSRF 權杖欄位來讓 [CSRF 保護](/docs/{{version}}/csrf) Middleware 能認證請求。我們可以使用 `@csrf` Blade 指示詞來產生這個權杖欄位:" +msgstr "" -#: docs/10.x/blade.md:block 412 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1272 +#: ./docs/9.x/blade.md:1574 +#: ./docs/10.x/blade.md:1600 +#: ./docs/11.x/blade.md:1640 +#: ./docs/master/blade.md:1600 msgid "
    \n" " @csrf\n\n" " ...\n" -"
    \n" -msgstr "
    \n" -" @csrf\n\n" -" ...\n" -"
    \n" +"" +msgstr "" + +# P +#: ./docs/8.x/blade.md:1280 +#: ./docs/9.x/blade.md:1582 +#: ./docs/10.x/blade.md:1608 +#: ./docs/11.x/blade.md:1648 +#: ./docs/master/blade.md:1608 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/blade.md:1281 +#: ./docs/11.x/blade.md:1321 +#: ./docs/master/blade.md:1281 +msgid "use Illuminate\\Support\\Facades\\Blade;\n" +"use VendorPackage\\View\\Components\\AlertComponent;\n\n" +"/**\n" +" * Bootstrap your package's services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Blade::component('package-alert', AlertComponent::class);\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 414 (header) +# H3 +#: ./docs/8.x/blade.md:1281 +#: ./docs/9.x/blade.md:1583 +#: ./docs/10.x/blade.md:1609 +#: ./docs/11.x/blade.md:1649 +#: ./docs/master/blade.md:1609 msgid "Method Field" -msgstr "方法欄位" +msgstr "" -#: docs/10.x/blade.md:block 415 (paragraph) +# P +#: ./docs/8.x/blade.md:1283 +#: ./docs/9.x/blade.md:1585 +#: ./docs/10.x/blade.md:1611 +#: ./docs/11.x/blade.md:1651 +#: ./docs/master/blade.md:1611 msgid "Since HTML forms can't make `PUT`, `PATCH`, or `DELETE` requests, you will need to add a hidden `_method` field to spoof these HTTP verbs. The `@method` Blade directive can create this field for you:" -msgstr "由於 HTML 表單沒辦法建立 `PUT`, `PATCH` 與 `DELETE` 請求,因此會需要加上一個隱藏的 `_method` 欄位來假裝成這些 HTTP 動詞。`@method` Blade 指示詞可以幫你建立這個欄位:" +msgstr "" -#: docs/10.x/blade.md:block 416 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1285 +#: ./docs/9.x/blade.md:1587 +#: ./docs/10.x/blade.md:1613 +#: ./docs/11.x/blade.md:1653 +#: ./docs/master/blade.md:1613 msgid "
    \n" " @method('PUT')\n\n" " ...\n" -"
    \n" -msgstr "
    \n" -" @method('PUT')\n\n" -" ...\n" -"
    \n" +"" +msgstr "" -#: docs/10.x/blade.md:block 418 (header) +# P +#: ./docs/8.x/blade.md:1293 +#: ./docs/9.x/blade.md:1595 +#: ./docs/10.x/blade.md:1621 +#: ./docs/11.x/blade.md:1661 +#: ./docs/master/blade.md:1621 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:1294 +#: ./docs/9.x/blade.md:1596 +#: ./docs/10.x/blade.md:1622 +#: ./docs/11.x/blade.md:1662 +#: ./docs/master/blade.md:1622 msgid "Validation Errors" -msgstr "認證錯誤" +msgstr "" -#: docs/10.x/blade.md:block 419 (paragraph) +# P +#: ./docs/8.x/blade.md:1296 +#: ./docs/9.x/blade.md:1598 +#: ./docs/10.x/blade.md:1624 +#: ./docs/11.x/blade.md:1664 +#: ./docs/master/blade.md:1624 msgid "The `@error` directive may be used to quickly check if [validation error messages](/docs/{{version}}/validation#quick-displaying-the-validation-errors) exist for a given attribute. Within an `@error` directive, you may echo the `$message` variable to display the error message:" -msgstr "可以使用 `@error` 指示詞來快速檢查給定的屬性是否有[驗證錯誤訊息](/docs/{{version}}/validation#quick-displaying-the-validation-errors)。在 `@error` 指示詞內,可以 echo `$message` 變數來顯示錯誤訊息:" +msgstr "" -#: docs/10.x/blade.md:block 420 (code) +# CODE: html +#: ./docs/8.x/blade.md:1298 msgid "\n\n" "\n\n" -"\n\n" -"@error('title')\n" -"
    {{ $message }}
    \n" -"@enderror\n" -msgstr "\n\n" -"\n\n" -"\n\n" +"\n\n" "@error('title')\n" "
    {{ $message }}
    \n" -"@enderror\n" +"@enderror" +msgstr "" -#: docs/10.x/blade.md:block 421 (paragraph) +# P +#: ./docs/8.x/blade.md:1310 +#: ./docs/9.x/blade.md:1614 +#: ./docs/10.x/blade.md:1640 +#: ./docs/11.x/blade.md:1682 +#: ./docs/master/blade.md:1640 msgid "Since the `@error` directive compiles to an \"if\" statement, you may use the `@else` directive to render content when there is not an error for an attribute:" -msgstr "由於 `@error` 指示詞匯被編譯為「if」陳述式,因此我們可以使用 `@else` 指示詞來在屬性沒有錯誤時轉譯特定內容:" +msgstr "" -#: docs/10.x/blade.md:block 422 (code) +# CODE: html +#: ./docs/8.x/blade.md:1312 msgid "\n\n" "\n\n" -"\n" -msgstr "\n\n" -"\n\n" -"\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 423 (paragraph) +# P +#: ./docs/8.x/blade.md:1320 +#: ./docs/9.x/blade.md:1626 +#: ./docs/10.x/blade.md:1652 +#: ./docs/11.x/blade.md:1696 +#: ./docs/master/blade.md:1652 msgid "You may pass [the name of a specific error bag](/docs/{{version}}/validation#named-error-bags) as the second parameter to the `@error` directive to retrieve validation error messages on pages containing multiple forms:" -msgstr "可以將[特定錯誤包的名稱](/docs/{{version}}/validation#named-error-bags)傳送給 `@error` 指示詞的第二個參數來在包含多個表單的頁面上取得驗證錯誤訊息:" +msgstr "" -#: docs/10.x/blade.md:block 424 (code) +# CODE: html +#: ./docs/8.x/blade.md:1322 msgid "\n\n" "\n\n" -"\n\n" -"@error('email', 'login')\n" -"
    {{ $message }}
    \n" -"@enderror\n" -msgstr "\n\n" -"\n\n" -"\n\n" +"\n\n" "@error('email', 'login')\n" "
    {{ $message }}
    \n" -"@enderror\n" +"@enderror" +msgstr "" -#: docs/10.x/blade.md:block 426 (header) +# P +#: ./docs/8.x/blade.md:1334 +#: ./docs/9.x/blade.md:1642 +#: ./docs/10.x/blade.md:1668 +#: ./docs/11.x/blade.md:1714 +#: ./docs/master/blade.md:1668 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/blade.md:1335 +#: ./docs/9.x/blade.md:1643 +#: ./docs/10.x/blade.md:1669 +#: ./docs/11.x/blade.md:1715 +#: ./docs/master/blade.md:1669 msgid "Stacks" -msgstr "堆疊" +msgstr "" -#: docs/10.x/blade.md:block 427 (paragraph) +# P +#: ./docs/8.x/blade.md:1337 +#: ./docs/9.x/blade.md:1645 +#: ./docs/10.x/blade.md:1671 +#: ./docs/11.x/blade.md:1717 +#: ./docs/master/blade.md:1671 msgid "Blade allows you to push to named stacks which can be rendered somewhere else in another view or layout. This can be particularly useful for specifying any JavaScript libraries required by your child views:" -msgstr "在 Blade 中可以 Push 到帶名稱的堆疊。這個堆疊可以在另一個 View 或 Layout 內進行轉譯。堆疊特別適合用來指定任何子 View 所需要的 JavaScript 函式庫:" +msgstr "" -#: docs/10.x/blade.md:block 428 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1339 +#: ./docs/9.x/blade.md:1647 +#: ./docs/10.x/blade.md:1673 +#: ./docs/11.x/blade.md:1719 +#: ./docs/master/blade.md:1673 msgid "@push('scripts')\n" " \n" -"@endpush\n" -msgstr "@push('scripts')\n" -" \n" -"@endpush\n" - -#: docs/10.x/blade.md:block 429 (paragraph) -msgid "If you would like to `@push` content if a given boolean expression evaluates to `true`, you may use the `@pushIf` directive:" -msgstr "若想要在某個布林運算式取值為 `true` 時才 `@push` 某段內容,可以使用 `@pushIf` 指示詞:" - -#: docs/10.x/blade.md:block 430 (code) -msgid "@pushIf($shouldPush, 'scripts')\n" -" \n" -"@endPushIf\n" -msgstr "@pushIf($shouldPush, 'scripts')\n" -" \n" -"@endPushIf\n" +"@endpush" +msgstr "" -#: docs/10.x/blade.md:block 431 (paragraph) +# P +#: ./docs/8.x/blade.md:1345 +#: ./docs/9.x/blade.md:1661 +#: ./docs/10.x/blade.md:1687 +#: ./docs/11.x/blade.md:1733 +#: ./docs/master/blade.md:1687 msgid "You may push to a stack as many times as needed. To render the complete stack contents, pass the name of the stack to the `@stack` directive:" -msgstr "一個堆疊可以按照需求 Push 多次。要將完成的堆疊內容轉譯出來,只需要將堆疊名稱傳給 `@stack` 指示詞:" +msgstr "" -#: docs/10.x/blade.md:block 432 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1347 +#: ./docs/9.x/blade.md:1663 +#: ./docs/10.x/blade.md:1689 +#: ./docs/11.x/blade.md:1735 +#: ./docs/master/blade.md:1689 msgid "\n" " \n\n" " @stack('scripts')\n" -"\n" -msgstr "\n" -" \n\n" -" @stack('scripts')\n" -"\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 433 (paragraph) +# P +#: ./docs/8.x/blade.md:1355 +#: ./docs/9.x/blade.md:1671 +#: ./docs/10.x/blade.md:1697 +#: ./docs/11.x/blade.md:1743 +#: ./docs/master/blade.md:1697 msgid "If you would like to prepend content onto the beginning of a stack, you should use the `@prepend` directive:" -msgstr "若想將內容加到堆疊的最前面,可以使用 `@prepend` 指示詞:" +msgstr "" -#: docs/10.x/blade.md:block 434 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1357 +#: ./docs/9.x/blade.md:1673 +#: ./docs/10.x/blade.md:1699 +#: ./docs/11.x/blade.md:1745 +#: ./docs/master/blade.md:1699 msgid "@push('scripts')\n" " This will be second...\n" "@endpush\n\n" "// Later...\n\n" "@prepend('scripts')\n" " This will be first...\n" -"@endprepend\n" -msgstr "@push('scripts')\n" -" 這個會是第二個…\n" -"@endpush\n\n" -"// 之後…\n\n" -"@prepend('scripts')\n" -" 這個會是第一個…\n" -"@endprepend\n" +"@endprepend" +msgstr "" -#: docs/10.x/blade.md:block 436 (header) +# P +#: ./docs/8.x/blade.md:1369 +#: ./docs/9.x/blade.md:1685 +#: ./docs/10.x/blade.md:1711 +#: ./docs/11.x/blade.md:1757 +#: ./docs/master/blade.md:1711 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/blade.md:1370 +#: ./docs/9.x/blade.md:1686 +#: ./docs/10.x/blade.md:1712 +#: ./docs/11.x/blade.md:1758 +#: ./docs/master/blade.md:1712 msgid "Service Injection" -msgstr "Service Injection" +msgstr "" -#: docs/10.x/blade.md:block 437 (paragraph) +# P +#: ./docs/8.x/blade.md:1372 +#: ./docs/9.x/blade.md:1688 +#: ./docs/10.x/blade.md:1714 +#: ./docs/11.x/blade.md:1760 +#: ./docs/master/blade.md:1714 msgid "The `@inject` directive may be used to retrieve a service from the Laravel [service container](/docs/{{version}}/container). The first argument passed to `@inject` is the name of the variable the service will be placed into, while the second argument is the class or interface name of the service you wish to resolve:" -msgstr "`@inject` 指示詞可以用來從 Laravel 的 [Service Container](/docs/{{version}}/container) 中取得服務。傳給 `@inject` 的第一個引數是要放置服務的變數名稱,而第二個引數則是要解析服務的類別或介面名稱:" +msgstr "" -#: docs/10.x/blade.md:block 438 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1374 +#: ./docs/9.x/blade.md:1690 +#: ./docs/10.x/blade.md:1716 +#: ./docs/11.x/blade.md:1762 +#: ./docs/master/blade.md:1716 msgid "@inject('metrics', 'App\\Services\\MetricsService')\n\n" "
    \n" " Monthly Revenue: {{ $metrics->monthlyRevenue() }}.\n" -"
    \n" -msgstr "@inject('metrics', 'App\\Services\\MetricsService')\n\n" -"
    \n" -" 月收入:{{ $metrics->monthlyRevenue() }}.\n" -"
    \n" - -#: docs/10.x/blade.md:block 440 (header) -msgid "Rendering Inline Blade Templates" -msgstr "轉譯內嵌的 Blade 樣板" - -#: docs/10.x/blade.md:block 441 (paragraph) -msgid "Sometimes you may need to transform a raw Blade template string into valid HTML. You may accomplish this using the `render` method provided by the `Blade` facade. The `render` method accepts the Blade template string and an optional array of data to provide to the template:" -msgstr "有時候,我們可能會像將原始的 Blade 樣板字串轉譯為有效的 HTML。我們可以通過 `Blade` Facade 所提供的 `render` 方法來達成。`render` 方法接受 Blade 樣板字串,以及一個用來提供給樣板的可選資料陣列:" - -#: docs/10.x/blade.md:block 442 (code) -msgid "use Illuminate\\Support\\Facades\\Blade;\n\n" -"return Blade::render('Hello, {{ $name }}', ['name' => 'Julian Bashir']);\n" -msgstr "use Illuminate\\Support\\Facades\\Blade;\n\n" -"return Blade::render('Hello, {{ $name }}', ['name' => 'Julian Bashir']);\n" - -#: docs/10.x/blade.md:block 443 (paragraph) -msgid "Laravel renders inline Blade templates by writing them to the `storage/framework/views` directory. If you would like Laravel to remove these temporary files after rendering the Blade template, you may provide the `deleteCachedView` argument to the method:" -msgstr "Laravel 會將這些樣板寫到 `storage/framework/views` 來轉譯內嵌的 Blade 樣板。若想讓 Laravel 在轉譯完這些 Blade 樣板後刪除這些臨時檔案,可以將 `deleteCachedView` 引數提供給該方法:" - -#: docs/10.x/blade.md:block 444 (code) -msgid "return Blade::render(\n" -" 'Hello, {{ $name }}',\n" -" ['name' => 'Julian Bashir'],\n" -" deleteCachedView: true\n" -");\n" -msgstr "return Blade::render(\n" -" 'Hello, {{ $name }}',\n" -" ['name' => 'Julian Bashir'],\n" -" deleteCachedView: true\n" -");\n" - -#: docs/10.x/blade.md:block 446 (header) -msgid "Rendering Blade Fragments" -msgstr "轉譯 Blade 片段" - -#: docs/10.x/blade.md:block 447 (paragraph) -msgid "When using frontend frameworks such as [Turbo](https://turbo.hotwired.dev/) and [htmx](https://htmx.org/), you may occasionally need to only return a portion of a Blade template within your HTTP response. Blade \"fragments\" allow you to do just that. To get started, place a portion of your Blade template within `@fragment` and `@endfragment` directives:" -msgstr "使用如 [Turbo](https://turbo.hotwired.dev/) 與 [htmx](https://htmx.org/) 等前端框架時,我們偶爾只需要在 HTTP Response 中回傳一部分的 Blade 樣板即可。Blade 的「片段 (Fragment)」功能可實現這一行為。若要使用 Blade 片段,請將 Blade 樣板中的一部分放在 `@fragment` 與 `@endfragment` 指示詞中:" - -#: docs/10.x/blade.md:block 448 (code) -msgid "@fragment('user-list')\n" -"
      \n" -" @foreach ($users as $user)\n" -"
    • {{ $user->name }}
    • \n" -" @endforeach\n" -"
    \n" -"@endfragment\n" -msgstr "@fragment('user-list')\n" -"
      \n" -" @foreach ($users as $user)\n" -"
    • {{ $user->name }}
    • \n" -" @endforeach\n" -"
    \n" -"@endfragment\n" - -#: docs/10.x/blade.md:block 449 (paragraph) -msgid "Then, when rendering the view that utilizes this template, you may invoke the `fragment` method to specify that only the specified fragment should be included in the outgoing HTTP response:" -msgstr "接著,在轉譯使用該樣板的 View 時,可以呼叫 `fragment` 方法來指定只在連外 HTTP Response 中包含特定的片段:" - -#: docs/10.x/blade.md:block 450 (code) -msgid "return view('dashboard', ['users' => $users])->fragment('user-list');\n" -msgstr "return view('dashboard', ['users' => $users])->fragment('user-list');\n" - -#: docs/10.x/blade.md:block 451 (paragraph) -msgid "The `fragmentIf` method allows you to conditionally return a fragment of a view based on a given condition. Otherwise, the entire view will be returned:" -msgstr "使用 `fragmentIf` 方法,就能依照給定條件來回傳 View Fragment。若不符合條件,則會回傳整個 View:" - -#: docs/10.x/blade.md:block 452 (code) -msgid "return view('dashboard', ['users' => $users])\n" -" ->fragmentIf($request->hasHeader('HX-Request'), 'user-list');\n" -msgstr "return view('dashboard', ['users' => $users])\n" -" ->fragmentIf($request->hasHeader('HX-Request'), 'user-list');\n" - -#: docs/10.x/blade.md:block 453 (paragraph) -msgid "The `fragments` and `fragmentsIf` methods allow you to return multiple view fragments in the response. The fragments will be concatenated together:" -msgstr "使用 `fragments` 與 `fragmentsIf` 方法,就能在 Response 中回傳多個 View Fragment。各個 Fragment 會被串接在一起:" - -#: docs/10.x/blade.md:block 454 (code) -msgid "view('dashboard', ['users' => $users])\n" -" ->fragments(['user-list', 'comment-list']);\n\n" -"view('dashboard', ['users' => $users])\n" -" ->fragmentsIf(\n" -" $request->hasHeader('HX-Request'),\n" -" ['user-list', 'comment-list']\n" -" );\n" -msgstr "view('dashboard', ['users' => $users])\n" -" ->fragments(['user-list', 'comment-list']);\n\n" -"view('dashboard', ['users' => $users])\n" -" ->fragmentsIf(\n" -" $request->hasHeader('HX-Request'),\n" -" ['user-list', 'comment-list']\n" -" );\n" +"" +msgstr "" -#: docs/10.x/blade.md:block 456 (header) +# P +#: ./docs/8.x/blade.md:1382 +#: ./docs/9.x/blade.md:1760 +#: ./docs/10.x/blade.md:1786 +#: ./docs/11.x/blade.md:1832 +#: ./docs/master/blade.md:1786 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/blade.md:1383 +#: ./docs/9.x/blade.md:1761 +#: ./docs/10.x/blade.md:1787 +#: ./docs/11.x/blade.md:1833 +#: ./docs/master/blade.md:1787 msgid "Extending Blade" -msgstr "擴充 Blade" +msgstr "" -#: docs/10.x/blade.md:block 457 (paragraph) +# P +#: ./docs/8.x/blade.md:1385 +#: ./docs/9.x/blade.md:1763 +#: ./docs/10.x/blade.md:1789 +#: ./docs/11.x/blade.md:1835 +#: ./docs/master/blade.md:1789 msgid "Blade allows you to define your own custom directives using the `directive` method. When the Blade compiler encounters the custom directive, it will call the provided callback with the expression that the directive contains." -msgstr "Blade 中可以通過 `directive` 方法來自訂指示詞。當 Blade 編譯器遇到自訂指示詞的時候,編譯器會呼叫所提供的回呼,並將將該指示詞內包含的運算式提供給該回呼。" +msgstr "" -#: docs/10.x/blade.md:block 458 (paragraph) +# P +#: ./docs/8.x/blade.md:1387 +#: ./docs/9.x/blade.md:1765 +#: ./docs/10.x/blade.md:1791 +#: ./docs/11.x/blade.md:1837 +#: ./docs/master/blade.md:1791 msgid "The following example creates a `@datetime($var)` directive which formats a given `$var`, which should be an instance of `DateTime`:" -msgstr "下列範例建立了一個 `@datetime($var)` 指示詞,用來將給定的 `$var` 格式化,而 `$var` 應為 `DateTime` 的實體:" +msgstr "" -#: docs/10.x/blade.md:block 459 (code) +# CODE +#: ./docs/8.x/blade.md:1389 +#: ./docs/9.x/blade.md:1767 msgid "format('m/d/Y H:i'); ?>\";\n" " });\n" " }\n" -"}\n" -msgstr "" +#~ msgstr "" + +# CODE: none +#: ./docs/11.x/blade.md:1400 +msgid "/resources/views/components/accordion/accordion.blade.php\n" +"/resources/views/components/accordion/item.blade.php" +msgstr "" + +# H3 +#: ./docs/9.x/blade.md:1400 +#: ./docs/10.x/blade.md:1428 +#: ./docs/11.x/blade.md:1468 +#: ./docs/master/blade.md:1428 +msgid "Anonymous Component Paths" +msgstr "" + +# P +#: ./docs/9.x/blade.md:1402 +#: ./docs/10.x/blade.md:1430 +#: ./docs/11.x/blade.md:1470 +#: ./docs/master/blade.md:1430 +msgid "As previously discussed, anonymous components are typically defined by placing a Blade template within your `resources/views/components` directory. However, you may occasionally want to register other anonymous component paths with Laravel in addition to the default path." +msgstr "" + +# P +#: ./docs/9.x/blade.md:1404 +#: ./docs/10.x/blade.md:1432 +#: ./docs/11.x/blade.md:1472 +#: ./docs/master/blade.md:1432 +msgid "The `anonymousComponentPath` method accepts the \"path\" to the anonymous component location as its first argument and an optional \"namespace\" that components should be placed under as its second argument. Typically, this method should be called from the `boot` method of one of your application's [service providers](/docs/{{version}}/providers):" +msgstr "" + +# CODE +#: ./docs/9.x/blade.md:1406 +msgid "/**\n" +" * Bootstrap any application services.\n" +" *\n" +" * @return void\n" +" */\n" +"public function boot()\n" "{\n" -" /**\n" -" * Register any application services.\n" -" */\n" -" public function register(): void\n" -" {\n" -" // ...\n" -" }\n\n" -" /**\n" -" * Bootstrap any application services.\n" -" */\n" -" public function boot(): void\n" -" {\n" -" Blade::directive('datetime', function (string $expression) {\n" -" return \"format('m/d/Y H:i'); ?>\";\n" -" });\n" -" }\n" -"}\n" +" Blade::anonymousComponentPath(__DIR__.'/../components');\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/blade.md:1416 +#: ./docs/10.x/blade.md:1442 +#: ./docs/11.x/blade.md:1482 +#: ./docs/master/blade.md:1442 +msgid "When component paths are registered without a specified prefix as in the example above, they may be rendered in your Blade components without a corresponding prefix as well. For example, if a `panel.blade.php` component exists in the path registered above, it may be rendered like so:" +msgstr "" + +# CODE: blade +#: ./docs/9.x/blade.md:1418 +#: ./docs/10.x/blade.md:1444 +#: ./docs/11.x/blade.md:1484 +#: ./docs/master/blade.md:1444 +msgid "" +msgstr "" -#: docs/10.x/blade.md:block 460 (paragraph) +# P +#: ./docs/8.x/blade.md:1421 +#: ./docs/9.x/blade.md:1799 +#: ./docs/10.x/blade.md:1821 +#: ./docs/11.x/blade.md:1867 +#: ./docs/master/blade.md:1821 msgid "As you can see, we will chain the `format` method onto whatever expression is passed into the directive. So, in this example, the final PHP generated by this directive will be:" -msgstr "如你所見,我們接著會將 `format` 方法接到傳入指示詞的運算式之後。因此,在這個範例中,這個指示詞最終所產生的指示詞會長這樣:" +msgstr "" + +# P +#: ./docs/9.x/blade.md:1422 +#: ./docs/10.x/blade.md:1448 +#: ./docs/11.x/blade.md:1488 +#: ./docs/master/blade.md:1448 +msgid "Prefix \"namespaces\" may be provided as the second argument to the `anonymousComponentPath` method:" +msgstr "" + +# CODE +#: ./docs/8.x/blade.md:1423 +#: ./docs/9.x/blade.md:1801 +#: ./docs/10.x/blade.md:1823 +#: ./docs/11.x/blade.md:1869 +#: ./docs/master/blade.md:1823 +msgid "format('m/d/Y H:i'); ?>" +msgstr "" + +# CODE +#: ./docs/9.x/blade.md:1424 +#: ./docs/10.x/blade.md:1450 +#: ./docs/11.x/blade.md:1490 +#: ./docs/master/blade.md:1450 +msgid "Blade::anonymousComponentPath(__DIR__.'/../components', 'dashboard');" +msgstr "" -#: docs/10.x/blade.md:block 461 (code) -msgid "format('m/d/Y H:i'); ?>\n" -msgstr "format('m/d/Y H:i'); ?>\n" +# P +#: ./docs/8.x/blade.md:1425 +#: ./docs/9.x/blade.md:1804 +#: ./docs/10.x/blade.md:1826 +#: ./docs/11.x/blade.md:1872 +#: ./docs/master/blade.md:1826 +msgid "After updating the logic of a Blade directive, you will need to delete all of the cached Blade views. The cached Blade views may be removed using the `view:clear` Artisan command." +msgstr "" -#: docs/10.x/blade.md:block 462 (quote) -msgid "**Warning** After updating the logic of a Blade directive, you will need to delete all of the cached Blade views. The cached Blade views may be removed using the `view:clear` Artisan command." -msgstr "**Warning** 更新完 Blade 的指示詞邏輯後,會需要刪除所有已快取的 Blade View。可以通過 `view:clear` Artisan 指令來移除已快取的 Blade View。" +# P +#: ./docs/9.x/blade.md:1426 +#: ./docs/10.x/blade.md:1452 +#: ./docs/11.x/blade.md:1492 +#: ./docs/master/blade.md:1452 +msgid "When a prefix is provided, components within that \"namespace\" may be rendered by prefixing to the component's namespace to the component name when the component is rendered:" +msgstr "" -#: docs/10.x/blade.md:block 464 (header) +# P +#: ./docs/8.x/blade.md:1427 +#: ./docs/9.x/blade.md:1806 +#: ./docs/10.x/blade.md:1828 +#: ./docs/11.x/blade.md:1874 +#: ./docs/master/blade.md:1828 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:1428 +#: ./docs/9.x/blade.md:1807 +#: ./docs/10.x/blade.md:1829 +#: ./docs/11.x/blade.md:1875 +#: ./docs/master/blade.md:1829 msgid "Custom Echo Handlers" -msgstr "自訂 Echo 處理常式" +msgstr "" + +# CODE: blade +#: ./docs/9.x/blade.md:1428 +#: ./docs/10.x/blade.md:1454 +#: ./docs/11.x/blade.md:1494 +#: ./docs/master/blade.md:1454 +msgid "" +msgstr "" -#: docs/10.x/blade.md:block 465 (paragraph) +# P +#: ./docs/8.x/blade.md:1430 +#: ./docs/9.x/blade.md:1809 +#: ./docs/10.x/blade.md:1831 +#: ./docs/11.x/blade.md:1877 +#: ./docs/master/blade.md:1831 msgid "If you attempt to \"echo\" an object using Blade, the object's `__toString` method will be invoked. The [`__toString`](https://www.php.net/manual/en/language.oop5.magic.php#object.tostring) method is one of PHP's built-in \"magic methods\". However, sometimes you may not have control over the `__toString` method of a given class, such as when the class that you are interacting with belongs to a third-party library." -msgstr "若有打算在 Blade 中「echo」某個物件,則 Blade 會叫用該物件的 `__toString` 方法。[`__toString`](https://www.php.net/manual/en/language.oop5.magic.php#object.tostring) 方法是 PHP 的其中一個「魔法方法」。不過,有的時候我們可能無法控制給定類別的 `__toString` 方法,如:來自第三方函式庫的類別。" +msgstr "" -#: docs/10.x/blade.md:block 466 (paragraph) +# P +#: ./docs/8.x/blade.md:1432 +#: ./docs/9.x/blade.md:1811 +#: ./docs/10.x/blade.md:1833 +#: ./docs/11.x/blade.md:1879 +#: ./docs/master/blade.md:1833 msgid "In these cases, Blade allows you to register a custom echo handler for that particular type of object. To accomplish this, you should invoke Blade's `stringable` method. The `stringable` method accepts a closure. This closure should type-hint the type of object that it is responsible for rendering. Typically, the `stringable` method should be invoked within the `boot` method of your application's `AppServiceProvider` class:" -msgstr "這個時候,Blade 能讓我們針對特定類型的物件註冊自訂的 Echo 處理常式。為此,應叫用 Blade 的 `stringable` 方法。`stringable` 方法接受一個閉包,該閉包應在型別標示中指定要負責轉譯的物件。一般情況下來說,`stringable` 方法應在專案的 `AppServiceProvider` 類別中 `boot` 方法內叫用:" +msgstr "" -#: docs/10.x/blade.md:block 467 (code) -msgid "use Illuminate\\Support\\Facades\\Blade;\n" -"use Money\\Money;\n\n" -"/**\n" +# CODE +#: ./docs/10.x/blade.md:1434 +#: ./docs/11.x/blade.md:1474 +#: ./docs/master/blade.md:1434 +msgid "/**\n" " * Bootstrap any application services.\n" " */\n" "public function boot(): void\n" "{\n" -" Blade::stringable(function (Money $money) {\n" -" return $money->formatTo('en_GB');\n" -" });\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Blade;\n" +" Blade::anonymousComponentPath(__DIR__.'/../components');\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/blade.md:1434 +#: ./docs/9.x/blade.md:1813 +msgid "use Illuminate\\Support\\Facades\\Blade;\n" "use Money\\Money;\n\n" "/**\n" " * Bootstrap any application services.\n" +" *\n" +" * @return void\n" " */\n" -"public function boot(): void\n" +"public function boot()\n" "{\n" " Blade::stringable(function (Money $money) {\n" " return $money->formatTo('en_GB');\n" " });\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/blade.md:block 468 (paragraph) +# P +#: ./docs/8.x/blade.md:1449 +#: ./docs/9.x/blade.md:1828 +#: ./docs/10.x/blade.md:1848 +#: ./docs/11.x/blade.md:1894 +#: ./docs/master/blade.md:1848 msgid "Once your custom echo handler has been defined, you may simply echo the object in your Blade template:" -msgstr "定義好自訂的 Echo 處理常式後,就可以直接在 Blade 樣板中 Echo 這個物件:" +msgstr "" -#: docs/10.x/blade.md:block 469 (code) -msgid "Cost: {{ $money }}\n" -msgstr "Cost: {{ $money }}\n" +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1451 +#: ./docs/9.x/blade.md:1830 +#: ./docs/10.x/blade.md:1850 +#: ./docs/11.x/blade.md:1896 +#: ./docs/master/blade.md:1850 +msgid "Cost: {{ $money }}" +msgstr "" -#: docs/10.x/blade.md:block 471 (header) +# P +#: ./docs/8.x/blade.md:1455 +#: ./docs/9.x/blade.md:1834 +#: ./docs/10.x/blade.md:1854 +#: ./docs/11.x/blade.md:1900 +#: ./docs/master/blade.md:1854 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/blade.md:1456 +#: ./docs/9.x/blade.md:1835 +#: ./docs/10.x/blade.md:1855 +#: ./docs/11.x/blade.md:1901 +#: ./docs/master/blade.md:1855 msgid "Custom If Statements" -msgstr "自訂 If 陳述式" +msgstr "" -#: docs/10.x/blade.md:block 472 (paragraph) +# P +#: ./docs/8.x/blade.md:1458 +#: ./docs/9.x/blade.md:1837 +#: ./docs/10.x/blade.md:1857 +#: ./docs/11.x/blade.md:1903 +#: ./docs/master/blade.md:1857 msgid "Programming a custom directive is sometimes more complex than necessary when defining simple, custom conditional statements. For that reason, Blade provides a `Blade::if` method which allows you to quickly define custom conditional directives using closures. For example, let's define a custom conditional that checks the configured default \"disk\" for the application. We may do this in the `boot` method of our `AppServiceProvider`:" -msgstr "為了定義一個簡單的自訂條件陳述式,撰寫一個自訂指示詞有時候搞得很複雜又不必要。為此,Blade 提供了一個 `Blade::if` 方法,可以讓你通過閉包來快速地定義自訂條件指示詞。舉例來說,讓我們來定義一個檢查專案設定的預設「disk」的自訂條件句。我們可以在 `AppServiceProvider` 中的 `boot` 方法內定義:" +msgstr "" -#: docs/10.x/blade.md:block 473 (code) +# CODE +#: ./docs/8.x/blade.md:1460 +#: ./docs/9.x/blade.md:1839 msgid "use Illuminate\\Support\\Facades\\Blade;\n\n" "/**\n" " * Bootstrap any application services.\n" +" *\n" +" * @return void\n" " */\n" -"public function boot(): void\n" -"{\n" -" Blade::if('disk', function (string $value) {\n" -" return config('filesystems.default') === $value;\n" -" });\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Blade;\n\n" -"/**\n" -" * Bootstrap any application services.\n" -" */\n" -"public function boot(): void\n" +"public function boot()\n" "{\n" -" Blade::if('disk', function (string $value) {\n" +" Blade::if('disk', function ($value) {\n" " return config('filesystems.default') === $value;\n" " });\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/blade.md:1465 +msgid "The `@aware` directive cannot access parent data that is not explicitly passed to the parent component via HTML attributes. Default `@props` values that are not explicitly passed to the parent component cannot be accessed by the `@aware` directive." +msgstr "" + +# H4 +#: ./docs/10.x/blade.md:1467 +#: ./docs/11.x/blade.md:1507 +#: ./docs/master/blade.md:1467 +msgid "Defining the Layout Component" +msgstr "" -#: docs/10.x/blade.md:block 474 (paragraph) +# P +#: ./docs/8.x/blade.md:1474 +#: ./docs/9.x/blade.md:1853 +#: ./docs/10.x/blade.md:1871 +#: ./docs/11.x/blade.md:1917 +#: ./docs/master/blade.md:1871 msgid "Once the custom conditional has been defined, you can use it within your templates:" -msgstr "定義好自訂條件句後,就可以在樣板中使用這個條件句:" +msgstr "" -#: docs/10.x/blade.md:block 475 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/blade.md:1476 +#: ./docs/9.x/blade.md:1855 +#: ./docs/10.x/blade.md:1873 +#: ./docs/11.x/blade.md:1919 +#: ./docs/master/blade.md:1873 msgid "@disk('local')\n" " \n" "@elsedisk('s3')\n" @@ -2922,557 +5774,314 @@ msgid "@disk('local')\n" "@enddisk\n\n" "@unlessdisk('local')\n" " \n" -"@enddisk\n" -msgstr "@disk('local')\n" -" \n" -"@elsedisk('s3')\n" -" \n" -"@else\n" -" \n" -"@enddisk\n\n" -"@unlessdisk('local')\n" -" \n" -"@enddisk\n" +"@enddisk" +msgstr "" -#: docs/8.x/blade.md:block 6 (paragraph) -msgid "Blade views may be returned from routes or controller using the global `view` helper. Of course, as mentioned in the documentation on [views](/docs/{{version}}/views), data may be passed to the Blade view using the `view` helper's second argument:" -msgstr "Blade 樣板可以在路由或 Controller 內通過 `view` 全域輔助函式來回傳。當然,就像在 [View](/docs/{{version}}/views) 說明文件內講的一樣,可以使用 `view` 輔助函式的第二個引數來將資料傳給 Blade View:" +# CODE: blade +#: ./docs/9.x/blade.md:1477 +#: ./docs/10.x/blade.md:1503 +#: ./docs/master/blade.md:1503 +msgid "\n\n" +"\n" +" \n" +" Custom Title\n" +" \n\n" +" @foreach ($tasks as $task)\n" +" {{ $task }}\n" +" @endforeach\n" +"" +msgstr "" -#: docs/8.x/blade.md:block 8 (quote) -msgid "{tip} Want to take your Blade templates to the next level and build dynamic interfaces with ease? Check out [Laravel Livewire](https://laravel-livewire.com)." -msgstr "{tip} 想要將 Blade 樣板的功能提升到新的境界並輕鬆製作動態使用者界面嗎?請參考看看 [Laravel Livewire](https://laravel-livewire.com)。" +# H4 +#: ./docs/10.x/blade.md:1487 +#: ./docs/11.x/blade.md:1527 +#: ./docs/master/blade.md:1487 +msgid "Applying the Layout Component" +msgstr "" -#: docs/8.x/blade.md:block 15 (quote) -msgid "{tip} Blade's `{{ }}` echo statements are automatically sent through PHP's `htmlspecialchars` function to prevent XSS attacks." -msgstr "{tip} Blade 的 `{{ }}` echo 陳述式會自動通過 PHP 的 `htmlspecialchars` 函式來防止 XSS 攻擊。" +# H4 +#: ./docs/10.x/blade.md:1529 +#: ./docs/11.x/blade.md:1569 +#: ./docs/master/blade.md:1529 +msgid "Defining a Layout" +msgstr "" -#: docs/8.x/blade.md:block 20 (paragraph) -msgid "By default, Blade (and the Laravel `e` helper) will double encode HTML entities. If you would like to disable double encoding, call the `Blade::withoutDoubleEncoding` method from the `boot` method of your `AppServiceProvider`:" -msgstr "預設情況下,Blade (以及 Laravel 的 `e` 輔助函式) 會重複轉譯 HTML 實體 (Double Encode)。若不像被重複轉譯,請在 `AppServiceProvider` 內的 `boot` 方法中呼叫 `Blade::withoutDoubleEncoding` 方法:" +# CODE: blade +#: ./docs/11.x/blade.md:1531 +msgid "\n\n" +"\n" +" @foreach ($tasks as $task)\n" +"
    {{ $task }}
    \n" +" @endforeach\n" +"
    " +msgstr "" -#: docs/8.x/blade.md:block 21 (code) -msgid "\n\n" +"\n" +" \n" +" Custom Title\n" +" \n\n" +" @foreach ($tasks as $task)\n" +"
    {{ $task }}
    \n" +" @endforeach\n" +"
    " +msgstr "" -#: docs/8.x/blade.md:block 26 (quote) -msgid "{note} Be very careful when echoing content that is supplied by users of your application. You should typically use the escaped, double curly brace syntax to prevent XSS attacks when displaying user supplied data." -msgstr "{note} 在輸出使用者提供的資料時,請格外小心。平常在顯示使用者提供的資料時應該要使用經過逸出的雙大括號語法來防止 XSS 攻擊。" +# H4 +#: ./docs/10.x/blade.md:1559 +#: ./docs/11.x/blade.md:1599 +#: ./docs/master/blade.md:1559 +msgid "Extending a Layout" +msgstr "" -#: docs/8.x/blade.md:block 42 (quote) -msgid "{note} You should only use the `Js::from` method to render existing variables as JSON. The Blade templating is based on regular expressions and attempts to pass a complex expression to the directive may cause unexpected failures." -msgstr "{note} 請只在轉譯現有變數為 JSON 時使用 `Js::from` 方法。Blade 樣板引擎是是基於正規標示式實作的,若將複雜的陳述式傳給指示詞可能會導致未預期的錯誤。" +# CODE: blade +#: ./docs/9.x/blade.md:1600 +#: ./docs/10.x/blade.md:1626 +#: ./docs/master/blade.md:1626 +msgid "\n\n" +"\n\n" +"\n\n" +"@error('title')\n" +"
    {{ $message }}
    \n" +"@enderror" +msgstr "" -#: docs/8.x/blade.md:block 84 (quote) -msgid "{tip} While iterating through a `foreach` loop, you may use the [loop variable](#the-loop-variable) to gain valuable information about the loop, such as whether you are in the first or last iteration through the loop." -msgstr "{tip} 在使用 `foreach` 迴圈迭代時,可以使用[迴圈變數](#the-loop-variable)來取得有關迴圈的有用資訊,如目前是否在迴圈的第一次或最後一次迭代。" +# CODE: blade +#: ./docs/9.x/blade.md:1616 +#: ./docs/10.x/blade.md:1642 +#: ./docs/master/blade.md:1642 +msgid "\n\n" +"\n\n" +"" +msgstr "" -#: docs/8.x/blade.md:block 85 (paragraph) -msgid "When using loops you may also end the loop or skip the current iteration using the `@continue` and `@break` directives:" -msgstr "在使用迴圈時,也可以通過 `@continue` 與 `@break` 指示詞來結束迴圈或跳過目前迭代:" +# CODE: blade +#: ./docs/9.x/blade.md:1628 +#: ./docs/10.x/blade.md:1654 +#: ./docs/master/blade.md:1654 +msgid "\n\n" +"\n\n" +"\n\n" +"@error('email', 'login')\n" +"
    {{ $message }}
    \n" +"@enderror" +msgstr "" -#: docs/8.x/blade.md:block 98 (header) -msgid "Conditional Classes" -msgstr "有條件的 Class" +# P +#: ./docs/9.x/blade.md:1653 +#: ./docs/10.x/blade.md:1679 +#: ./docs/11.x/blade.md:1725 +#: ./docs/master/blade.md:1679 +msgid "If you would like to `@push` content if a given boolean expression evaluates to `true`, you may use the `@pushIf` directive:" +msgstr "" -#: docs/8.x/blade.md:block 103 (quote) -msgid "{tip} While you're free to use the `@include` directive, Blade [components](#components) provide similar functionality and offer several benefits over the `@include` directive such as data and attribute binding." -msgstr "{tip} 雖然可以使用 `@include` 指示詞,但 Blade 的[元件](#components)提供了類似的功能,但比起 `@include` 指示詞來說有更多的優勢,如資料與屬性綁定。" +# CODE: blade +#: ./docs/9.x/blade.md:1655 +#: ./docs/10.x/blade.md:1681 +#: ./docs/11.x/blade.md:1727 +#: ./docs/master/blade.md:1681 +msgid "@pushIf($shouldPush, 'scripts')\n" +" \n" +"@endPushIf" +msgstr "" -#: docs/8.x/blade.md:block 114 (quote) -msgid "{note} You should avoid using the `__DIR__` and `__FILE__` constants in your Blade views, since they will refer to the location of the cached, compiled view." -msgstr "{note} 應避免在 Blade View 中使用 `__DIR__` 與 `__FILE__` 常數,因為這些常數會參照到經過快取與編譯過的 View。" +# CODE: blade +#: ./docs/11.x/blade.md:1666 +msgid "\n\n" +"\n\n" +"\n\n" +"@error('title')\n" +"
    {{ $message }}
    \n" +"@enderror" +msgstr "" -#: docs/8.x/blade.md:block 122 (quote) -msgid "{note} Views rendered via `@each` do not inherit the variables from the parent view. If the child view requires these variables, you should use the `@foreach` and `@include` directives instead." -msgstr "{note} 通過 `@each` 所轉譯的 View 不會繼承其上層 View 的變數。若子 View 有需要這些變數,應使用 `@foreach` 與 `@include` 指示詞來代替。" +# CODE: blade +#: ./docs/11.x/blade.md:1684 +msgid "\n\n" +"\n\n" +"" +msgstr "" -#: docs/8.x/blade.md:block 148 (code) -msgid "use Illuminate\\Support\\Facades\\Blade;\n\n" -"/**\n" -" * Bootstrap your package's services.\n" -" */\n" -"public function boot()\n" -"{\n" -" Blade::component('package-alert', Alert::class);\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Blade;\n\n" -"/**\n" -" * Bootstrap your package's services.\n" -" */\n" -"public function boot()\n" -"{\n" -" Blade::component('package-alert', Alert::class);\n" -"}\n" +# CODE: blade +#: ./docs/11.x/blade.md:1698 +msgid "\n\n" +"\n\n" +"\n\n" +"@error('email', 'login')\n" +"
    {{ $message }}
    \n" +"@enderror" +msgstr "" -#: docs/8.x/blade.md:block 152 (code) -msgid "use Illuminate\\Support\\Facades\\Blade;\n\n" -"/**\n" -" * Bootstrap your package's services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Blade::componentNamespace('Nightshade\\\\Views\\\\Components', 'nightshade');\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Blade;\n\n" -"/**\n" -" * Bootstrap your package's services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Blade::componentNamespace('Nightshade\\\\Views\\\\Components', 'nightshade');\n" -"}\n" +# P +#: ./docs/9.x/blade.md:1698 +#: ./docs/10.x/blade.md:1724 +#: ./docs/11.x/blade.md:1770 +#: ./docs/master/blade.md:1724 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/blade.md:1699 +#: ./docs/10.x/blade.md:1725 +#: ./docs/11.x/blade.md:1771 +#: ./docs/master/blade.md:1725 +msgid "Rendering Inline Blade Templates" +msgstr "" -#: docs/8.x/blade.md:block 166 (paragraph) -msgid "You should define the component's required data in its class constructor. All public properties on a component will automatically be made available to the component's view. It is not necessary to pass the data to the view from the component's `render` method:" -msgstr "可以在元件的類別建構函式中定義元件所需的資料。元件中所有 Public 的屬性都會自動在元件的 View 中可用。不需要在元件的 `render` 方法中將這些資料傳給 View:" +# P +#: ./docs/9.x/blade.md:1701 +#: ./docs/10.x/blade.md:1727 +#: ./docs/11.x/blade.md:1773 +#: ./docs/master/blade.md:1727 +msgid "Sometimes you may need to transform a raw Blade template string into valid HTML. You may accomplish this using the `render` method provided by the `Blade` facade. The `render` method accepts the Blade template string and an optional array of data to provide to the template:" +msgstr "" -#: docs/8.x/blade.md:block 167 (code) -msgid "type = $type;\n" -" $this->message = $message;\n" -" }\n\n" -" /**\n" -" * Get the view / contents that represent the component.\n" -" *\n" -" * @return \\Illuminate\\View\\View|\\Closure|string\n" -" */\n" -" public function render()\n" -" {\n" -" return view('components.alert');\n" -" }\n" -"}\n" -msgstr "type = $type;\n" -" $this->message = $message;\n" -" }\n\n" -" /**\n" -" * Get the view / contents that represent the component.\n" -" *\n" -" * @return \\Illuminate\\View\\View|\\Closure|string\n" -" */\n" -" public function render()\n" -" {\n" -" return view('components.alert');\n" -" }\n" -"}\n" - -#: docs/8.x/blade.md:block 173 (code) -msgid "/**\n" -" * Create the component instance.\n" -" *\n" -" * @param string $alertType\n" -" * @return void\n" -" */\n" -"public function __construct($alertType)\n" -"{\n" -" $this->alertType = $alertType;\n" -"}\n" -msgstr "/**\n" -" * Create the component instance.\n" -" *\n" -" * @param string $alertType\n" -" * @return void\n" -" */\n" -"public function __construct($alertType)\n" -"{\n" -" $this->alertType = $alertType;\n" -"}\n" - -#: docs/8.x/blade.md:block 185 (code) -msgid "/**\n" -" * Determine if the given option is the currently selected option.\n" -" *\n" -" * @param string $option\n" -" * @return bool\n" -" */\n" -"public function isSelected($option)\n" -"{\n" -" return $option === $this->selected;\n" -"}\n" -msgstr "/**\n" -" * Determine if the given option is the currently selected option.\n" -" *\n" -" * @param string $option\n" -" * @return bool\n" -" */\n" -"public function isSelected($option)\n" -"{\n" -" return $option === $this->selected;\n" -"}\n" - -#: docs/8.x/blade.md:block 187 (code) -msgid "\n" -msgstr "\n" - -#: docs/8.x/blade.md:block 191 (code) -msgid "/**\n" -" * Get the view / contents that represent the component.\n" -" *\n" -" * @return \\Illuminate\\View\\View|\\Closure|string\n" -" */\n" -"public function render()\n" -"{\n" -" return function (array $data) {\n" -" // $data['componentName'];\n" -" // $data['attributes'];\n" -" // $data['slot'];\n\n" -" return '
    Components content
    ';\n" -" };\n" -"}\n" -msgstr "/**\n" -" * Get the view / contents that represent the component.\n" -" *\n" -" * @return \\Illuminate\\View\\View|\\Closure|string\n" -" */\n" -"public function render()\n" -"{\n" -" return function (array $data) {\n" -" // $data['componentName'];\n" -" // $data['attributes'];\n" -" // $data['slot'];\n\n" -" return '
    Components content
    ';\n" -" };\n" -"}\n" - -#: docs/8.x/blade.md:block 197 (code) -msgid "use App\\Services\\AlertCreator\n\n" -"/**\n" -" * Create the component instance.\n" -" *\n" -" * @param \\App\\Services\\AlertCreator $creator\n" -" * @param string $type\n" -" * @param string $message\n" -" * @return void\n" -" */\n" -"public function __construct(AlertCreator $creator, $type, $message)\n" -"{\n" -" $this->creator = $creator;\n" -" $this->type = $type;\n" -" $this->message = $message;\n" -"}\n" -msgstr "use App\\Services\\AlertCreator\n\n" -"/**\n" -" * Create the component instance.\n" -" *\n" -" * @param \\App\\Services\\AlertCreator $creator\n" -" * @param string $type\n" -" * @param string $message\n" -" * @return void\n" -" */\n" -"public function __construct(AlertCreator $creator, $type, $message)\n" -"{\n" -" $this->creator = $creator;\n" -" $this->type = $type;\n" -" $this->message = $message;\n" -"}\n" - -#: docs/8.x/blade.md:block 201 (code) -msgid "` will not be compiled." -msgstr "{note} 目前不支援在元件標籤內使用如 `@env` 的指示詞。舉例來說,`` 將不會被編譯。" - -#: docs/8.x/blade.md:block 223 (quote) -msgid "{tip} If you need to conditionally compile classes on other HTML elements that shouldn't receive merged attributes, you can use the [`@class` directive](#conditional-classes)." -msgstr "{tip} 若不想讓要套用條件式編譯 Class 的 HTML 收到經過合併的屬性,請使用 [`@class` 指示詞](#conditional-classes)。" - -#: docs/8.x/blade.md:block 237 (code) -msgid "{{ $attributes->filter(fn ($value, $key) => $key == 'foo') }}\n" -msgstr "{{ $attributes->filter(fn ($value, $key) => $key == 'foo') }}\n" - -#: docs/8.x/blade.md:block 263 (code) -msgid "\n" -" \n" -" Server Error\n" -" \n\n" -" Whoops! Something went wrong!\n" -"\n" -msgstr "\n" -" \n" -" Server Error\n" -" \n\n" -" Whoops! Something went wrong!\n" -"\n" +# CODE: php +#: ./docs/9.x/blade.md:1703 +#: ./docs/10.x/blade.md:1729 +#: ./docs/11.x/blade.md:1775 +#: ./docs/master/blade.md:1729 +msgid "use Illuminate\\Support\\Facades\\Blade;\n\n" +"return Blade::render('Hello, {{ $name }}', ['name' => 'Julian Bashir']);" +msgstr "" -#: docs/8.x/blade.md:block 267 (code) -msgid "\n" -" \n" -" {{ $component->formatAlert('Server Error') }}\n" -" \n\n" -" Whoops! Something went wrong!\n" -"\n" -msgstr "\n" -" \n" -" {{ $component->formatAlert('Server Error') }}\n" -" \n\n" -" Whoops! Something went wrong!\n" -"\n" +# P +#: ./docs/9.x/blade.md:1709 +#: ./docs/10.x/blade.md:1735 +#: ./docs/11.x/blade.md:1781 +#: ./docs/master/blade.md:1735 +msgid "Laravel renders inline Blade templates by writing them to the `storage/framework/views` directory. If you would like Laravel to remove these temporary files after rendering the Blade template, you may provide the `deleteCachedView` argument to the method:" +msgstr "" -#: docs/8.x/blade.md:block 271 (code) -msgid "\n" -" \n" -" Heading\n" -" \n\n" -" Content\n\n" -" \n" -" Footer\n" -" \n" -"\n" -msgstr "\n" -" \n" -" Heading\n" -" \n\n" -" Content\n\n" -" \n" -" Footer\n" -" \n" -"\n" +# CODE: php +#: ./docs/9.x/blade.md:1711 +#: ./docs/10.x/blade.md:1737 +#: ./docs/11.x/blade.md:1783 +#: ./docs/master/blade.md:1737 +msgid "return Blade::render(\n" +" 'Hello, {{ $name }}',\n" +" ['name' => 'Julian Bashir'],\n" +" deleteCachedView: true\n" +");" +msgstr "" -#: docs/8.x/blade.md:block 277 (code) -msgid "/**\n" -" * Get the view / contents that represent the component.\n" -" *\n" -" * @return \\Illuminate\\View\\View|\\Closure|string\n" -" */\n" -"public function render()\n" -"{\n" -" return <<<'blade'\n" -"
    \n" -" {{ $slot }}\n" -"
    \n" -" blade;\n" -"}\n" -msgstr "/**\n" -" * Get the view / contents that represent the component.\n" -" *\n" -" * @return \\Illuminate\\View\\View|\\Closure|string\n" -" */\n" -"public function render()\n" -"{\n" -" return <<<'blade'\n" -"
    \n" -" {{ $slot }}\n" -"
    \n" -" blade;\n" -"}\n" +# P +#: ./docs/9.x/blade.md:1719 +#: ./docs/10.x/blade.md:1745 +#: ./docs/11.x/blade.md:1791 +#: ./docs/master/blade.md:1745 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/blade.md:1720 +#: ./docs/10.x/blade.md:1746 +#: ./docs/11.x/blade.md:1792 +#: ./docs/master/blade.md:1746 +msgid "Rendering Blade Fragments" +msgstr "" -#: docs/8.x/blade.md:block 315 (code) -msgid "\n" -msgstr "\n" +# P +#: ./docs/9.x/blade.md:1722 +#: ./docs/10.x/blade.md:1748 +#: ./docs/11.x/blade.md:1794 +#: ./docs/master/blade.md:1748 +msgid "When using frontend frameworks such as [Turbo](https://turbo.hotwired.dev/) and [htmx](https://htmx.org/), you may occasionally need to only return a portion of a Blade template within your HTTP response. Blade \"fragments\" allow you to do just that. To get started, place a portion of your Blade template within `@fragment` and `@endfragment` directives:" +msgstr "" -#: docs/8.x/blade.md:block 318 (quote) -msgid "{note} The following documentation on manually registering components is primarily applicable to those who are writing Laravel packages that include view components. If you are not writing a package, this portion of the component documentation may not be relevant to you." -msgstr "{note} 下列有關手動註冊元件的說明文件主要適用於撰寫包含 View 元件的 Laravel 套件的套件作者。若你並不撰寫套件,則這部分的元件說明文件可能跟你比較沒關係。" +# CODE: blade +#: ./docs/9.x/blade.md:1724 +#: ./docs/10.x/blade.md:1750 +#: ./docs/11.x/blade.md:1796 +#: ./docs/master/blade.md:1750 +msgid "@fragment('user-list')\n" +"
      \n" +" @foreach ($users as $user)\n" +"
    • {{ $user->name }}
    • \n" +" @endforeach\n" +"
    \n" +"@endfragment" +msgstr "" -#: docs/8.x/blade.md:block 321 (code) -msgid "use Illuminate\\Support\\Facades\\Blade;\n" -"use VendorPackage\\View\\Components\\AlertComponent;\n\n" -"/**\n" -" * Bootstrap your package's services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Blade::component('package-alert', AlertComponent::class);\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Blade;\n" -"use VendorPackage\\View\\Components\\AlertComponent;\n\n" -"/**\n" -" * Bootstrap your package's services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Blade::component('package-alert', AlertComponent::class);\n" -"}\n" +# P +#: ./docs/9.x/blade.md:1734 +#: ./docs/10.x/blade.md:1760 +#: ./docs/11.x/blade.md:1806 +#: ./docs/master/blade.md:1760 +msgid "Then, when rendering the view that utilizes this template, you may invoke the `fragment` method to specify that only the specified fragment should be included in the outgoing HTTP response:" +msgstr "" -#: docs/8.x/blade.md:block 344 (code) -msgid "\n\n" -"\n" -" \n" -" Custom Title\n" -" \n\n" -" @foreach ($tasks as $task)\n" -" {{ $task }}\n" -" @endforeach\n" -"\n" -msgstr "\n\n" -"\n" -" \n" -" 自訂標題\n" -" \n\n" -" @foreach ($tasks as $task)\n" -" {{ $task }}\n" -" @endforeach\n" -"\n" +# CODE: php +#: ./docs/9.x/blade.md:1736 +#: ./docs/10.x/blade.md:1762 +#: ./docs/11.x/blade.md:1808 +#: ./docs/master/blade.md:1762 +msgid "return view('dashboard', ['users' => $users])->fragment('user-list');" +msgstr "" -#: docs/8.x/blade.md:block 361 (quote) -msgid "{tip} Contrary to the previous example, this `sidebar` section ends with `@endsection` instead of `@show`. The `@endsection` directive will only define a section while `@show` will define and **immediately yield** the section." -msgstr "{tip} 相較於前一個例子,`sidebar` 段落是以 `@endsection` 結束的,而不是 `@show`。`@endsection` 指示詞只會定義一個段落,而 `@show` 則會定義並 **馬上 Yield** 該段落。" +# P +#: ./docs/9.x/blade.md:1740 +#: ./docs/10.x/blade.md:1766 +#: ./docs/11.x/blade.md:1812 +#: ./docs/master/blade.md:1766 +msgid "The `fragmentIf` method allows you to conditionally return a fragment of a view based on a given condition. Otherwise, the entire view will be returned:" +msgstr "" -#: docs/8.x/blade.md:block 377 (code) -msgid "\n\n" -"\n\n" -"\n\n" -"@error('title')\n" -"
    {{ $message }}
    \n" -"@enderror\n" -msgstr "\n\n" -"\n\n" -"\n\n" -"@error('title')\n" -"
    {{ $message }}
    \n" -"@enderror\n" +# CODE: php +#: ./docs/9.x/blade.md:1742 +#: ./docs/10.x/blade.md:1768 +#: ./docs/11.x/blade.md:1814 +#: ./docs/master/blade.md:1768 +msgid "return view('dashboard', ['users' => $users])\n" +" ->fragmentIf($request->hasHeader('HX-Request'), 'user-list');" +msgstr "" -#: docs/8.x/blade.md:block 379 (code) -msgid "\n\n" -"\n\n" -"\n" -msgstr "\n\n" -"\n\n" -"\n" +# P +#: ./docs/9.x/blade.md:1747 +#: ./docs/10.x/blade.md:1773 +#: ./docs/11.x/blade.md:1819 +#: ./docs/master/blade.md:1773 +msgid "The `fragments` and `fragmentsIf` methods allow you to return multiple view fragments in the response. The fragments will be concatenated together:" +msgstr "" -#: docs/8.x/blade.md:block 381 (code) -msgid "\n\n" -"\n\n" -"\n\n" -"@error('email', 'login')\n" -"
    {{ $message }}
    \n" -"@enderror\n" -msgstr "\n\n" -"\n\n" -"\n\n" -"@error('email', 'login')\n" -"
    {{ $message }}
    \n" -"@enderror\n" +# CODE: php +#: ./docs/9.x/blade.md:1749 +#: ./docs/10.x/blade.md:1775 +#: ./docs/11.x/blade.md:1821 +#: ./docs/master/blade.md:1775 +msgid "view('dashboard', ['users' => $users])\n" +" ->fragments(['user-list', 'comment-list']);\n\n" +"view('dashboard', ['users' => $users])\n" +" ->fragmentsIf(\n" +" $request->hasHeader('HX-Request'),\n" +" ['user-list', 'comment-list']\n" +" );" +msgstr "" -#: docs/8.x/blade.md:block 398 (code) +# CODE +#: ./docs/10.x/blade.md:1793 +#: ./docs/11.x/blade.md:1839 +#: ./docs/master/blade.md:1793 msgid "format('m/d/Y H:i'); ?>\";\n" -" });\n" -" }\n" -"}\n" -msgstr "format('m/d/Y H:i'); ?>\";\n" " });\n" " }\n" -"}\n" - -#: docs/8.x/blade.md:block 401 (quote) -msgid "{note} After updating the logic of a Blade directive, you will need to delete all of the cached Blade views. The cached Blade views may be removed using the `view:clear` Artisan command." -msgstr "{note} 更新完 Blade 的指示詞邏輯後,會需要刪除所有已快取的 Blade View。可以通過 `view:clear` Artisan 指令來移除已快取的 Blade View。" +"}" +msgstr "" -#: docs/8.x/blade.md:block 406 (code) +# CODE +#: ./docs/10.x/blade.md:1835 +#: ./docs/11.x/blade.md:1881 +#: ./docs/master/blade.md:1835 msgid "use Illuminate\\Support\\Facades\\Blade;\n" "use Money\\Money;\n\n" "/**\n" " * Bootstrap any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Blade::stringable(function (Money $money) {\n" -" return $money->formatTo('en_GB');\n" -" });\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Blade;\n" -"use Money\\Money;\n\n" -"/**\n" -" * Bootstrap any application services.\n" -" *\n" -" * @return void\n" " */\n" -"public function boot()\n" +"public function boot(): void\n" "{\n" " Blade::stringable(function (Money $money) {\n" " return $money->formatTo('en_GB');\n" " });\n" -"}\n" +"}" +msgstr "" -#: docs/8.x/blade.md:block 412 (code) +# CODE +#: ./docs/10.x/blade.md:1859 +#: ./docs/11.x/blade.md:1905 +#: ./docs/master/blade.md:1859 msgid "use Illuminate\\Support\\Facades\\Blade;\n\n" "/**\n" " * Bootstrap any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Blade::if('disk', function ($value) {\n" -" return config('filesystems.default') === $value;\n" -" });\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Blade;\n\n" -"/**\n" -" * Bootstrap any application services.\n" -" *\n" -" * @return void\n" " */\n" -"public function boot()\n" +"public function boot(): void\n" "{\n" -" Blade::if('disk', function ($value) {\n" +" Blade::if('disk', function (string $value) {\n" " return config('filesystems.default') === $value;\n" " });\n" -"}\n" - -#: docs/9.x/blade.md:block 10 (paragraph) -msgid "Want to take your Blade templates to the next level and build dynamic interfaces with ease? Check out [Laravel Livewire](https://laravel-livewire.com). Livewire allows you to write Blade components that are augmented with dynamic functionality that would typically only be possible via frontend frameworks like React or Vue, providing a great approach to building modern, reactive frontends without the complexities, client-side rendering, or build steps of many JavaScript frameworks." -msgstr "想讓你的 Blade 樣板更進一步增加功能,並輕鬆使用 Blade 製作動態界面嗎?請參考看看 [Laravel Livewire](https://laravel-livewire.com)。原本只能通過 React 或 Vue 等前端框架才能達成的動態功能,使用 Liveware 後,你只需要撰寫 Blade 元件就可以實現了,不需要增加專案複雜度、不需要使用前端轉譯、不用麻煩地處理建置各種 JavaScript 框架,就能建立現代、互動性的前端。" - -#: docs/9.x/blade.md:block 76 (paragraph) -msgid "You may use the `@sectionMissing` directive to determine if a section does not have content:" -msgstr "可以通過 `@sectionMissing` 指示詞來判斷某個段落是否沒有內容:" - -#: docs/9.x/blade.md:block 128 (paragraph) -msgid "To include the first view that exists from a given array of views, you may use the `@includeFirst` directive:" -msgstr "若要在某個包含了一些 View 的陣列中 Include 第一個存在的 View,可以使用 `@includeFirst` 指示詞:" - -#: docs/9.x/blade.md:block 149 (paragraph) -msgid "If you only need to write a single PHP statement, you can include the statement within the `@php` directive:" -msgstr "若只想撰寫單一 PHP 陳述式,可以在 `@php` 指示詞內包含該陳述式:" - -#: docs/9.x/blade.md:block 150 (code) -msgid "@php($counter = 1)\n" -msgstr "@php($counter = 1)\n" - -#: docs/9.x/blade.md:block 224 (code) -msgid "use App\\Services\\AlertCreator;\n\n" -"/**\n" -" * Create the component instance.\n" -" *\n" -" * @param \\App\\Services\\AlertCreator $creator\n" -" * @param string $type\n" -" * @param string $message\n" -" * @return void\n" -" */\n" -"public function __construct(AlertCreator $creator, $type, $message)\n" -"{\n" -" $this->creator = $creator;\n" -" $this->type = $type;\n" -" $this->message = $message;\n" -"}\n" -msgstr "use App\\Services\\AlertCreator;\n\n" -"/**\n" -" * Create the component instance.\n" -" *\n" -" * @param \\App\\Services\\AlertCreator $creator\n" -" * @param string $type\n" -" * @param string $message\n" -" * @return void\n" -" */\n" -"public function __construct(AlertCreator $creator, $type, $message)\n" -"{\n" -" $this->creator = $creator;\n" -" $this->type = $type;\n" -" $this->message = $message;\n" -"}\n" - -#: docs/9.x/blade.md:block 362 (code) -msgid "/**\n" -" * Bootstrap any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Blade::anonymousComponentPath(__DIR__.'/../components');\n" -"}\n" -msgstr "/**\n" -" * Bootstrap any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Blade::anonymousComponentPath(__DIR__.'/../components');\n" -"}\n" +"}" +msgstr "" diff --git a/po/zh_TW/broadcasting.po b/po/zh_TW/broadcasting.po index e5effcca0..3ee27ed5c 100644 --- a/po/zh_TW/broadcasting.po +++ b/po/zh_TW/broadcasting.po @@ -10,357 +10,1143 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" - -#: docs/10.x/broadcasting.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H1 +#: ./docs/8.x/broadcasting.md:1 +#: ./docs/9.x/broadcasting.md:1 +#: ./docs/10.x/broadcasting.md:1 +#: ./docs/11.x/broadcasting.md:1 +#: ./docs/master/broadcasting.md:1 msgid "Broadcasting" -msgstr "廣播 - Broadcast" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:3 +#: ./docs/9.x/broadcasting.md:3 +#: ./docs/10.x/broadcasting.md:3 +#: ./docs/11.x/broadcasting.md:3 +#: ./docs/master/broadcasting.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:4 +#: ./docs/9.x/broadcasting.md:4 +#: ./docs/10.x/broadcasting.md:4 +#: ./docs/11.x/broadcasting.md:4 +#: ./docs/master/broadcasting.md:4 msgid "[Server Side Installation](#server-side-installation)" -msgstr "[伺服器端安裝](#server-side-installation)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:5 +#: ./docs/9.x/broadcasting.md:5 +#: ./docs/10.x/broadcasting.md:5 +#: ./docs/11.x/broadcasting.md:5 +#: ./docs/master/broadcasting.md:5 msgid "[Configuration](#configuration)" -msgstr "[設定](#configuration)" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:6 +#: ./docs/11.x/broadcasting.md:6 +#: ./docs/master/broadcasting.md:6 +msgid "[Reverb](#reverb)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:6 +#: ./docs/9.x/broadcasting.md:6 +#: ./docs/10.x/broadcasting.md:7 +#: ./docs/11.x/broadcasting.md:7 +#: ./docs/master/broadcasting.md:7 msgid "[Pusher Channels](#pusher-channels)" -msgstr "[Pusher Channels](#pusher-channels)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:7 +#: ./docs/9.x/broadcasting.md:7 +#: ./docs/10.x/broadcasting.md:8 +#: ./docs/11.x/broadcasting.md:8 +#: ./docs/master/broadcasting.md:8 msgid "[Ably](#ably)" -msgstr "[Ably](#ably)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:8 +#: ./docs/9.x/broadcasting.md:8 +#: ./docs/10.x/broadcasting.md:9 msgid "[Open Source Alternatives](#open-source-alternatives)" -msgstr "[開放原始碼替代](#open-source-alternatives)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:9 +#: ./docs/9.x/broadcasting.md:9 +#: ./docs/10.x/broadcasting.md:10 +#: ./docs/11.x/broadcasting.md:9 +#: ./docs/master/broadcasting.md:9 msgid "[Client Side Installation](#client-side-installation)" -msgstr "[用戶端安裝](#client-side-installation)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:10 +#: ./docs/9.x/broadcasting.md:10 +#: ./docs/10.x/broadcasting.md:12 +#: ./docs/11.x/broadcasting.md:11 +#: ./docs/master/broadcasting.md:11 msgid "[Pusher Channels](#client-pusher-channels)" -msgstr "[Pusher Channels](#client-pusher-channels)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/10.x/broadcasting.md:11 +#: ./docs/11.x/broadcasting.md:10 +#: ./docs/master/broadcasting.md:10 +msgid "[Reverb](#client-reverb)" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:11 +#: ./docs/9.x/broadcasting.md:11 +#: ./docs/10.x/broadcasting.md:13 +#: ./docs/11.x/broadcasting.md:12 +#: ./docs/master/broadcasting.md:12 msgid "[Ably](#client-ably)" -msgstr "[Ably](#client-ably)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:12 +#: ./docs/9.x/broadcasting.md:12 +#: ./docs/10.x/broadcasting.md:14 +#: ./docs/11.x/broadcasting.md:13 +#: ./docs/master/broadcasting.md:13 msgid "[Concept Overview](#concept-overview)" -msgstr "[概念概覽](#concept-overview)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:13 +#: ./docs/9.x/broadcasting.md:13 msgid "[Using An Example Application](#using-example-application)" -msgstr "[使用現有的應用程式](#using-example-application)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:14 +#: ./docs/9.x/broadcasting.md:14 +#: ./docs/10.x/broadcasting.md:16 +#: ./docs/11.x/broadcasting.md:15 +#: ./docs/master/broadcasting.md:15 msgid "[Defining Broadcast Events](#defining-broadcast-events)" -msgstr "[定義 Broadcast 事件](#defining-broadcast-events)" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:15 +#: ./docs/11.x/broadcasting.md:14 +#: ./docs/master/broadcasting.md:14 +msgid "[Using an Example Application](#using-example-application)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:15 +#: ./docs/9.x/broadcasting.md:15 +#: ./docs/10.x/broadcasting.md:17 +#: ./docs/11.x/broadcasting.md:16 +#: ./docs/master/broadcasting.md:16 msgid "[Broadcast Name](#broadcast-name)" -msgstr "[Broadcast 名稱](#broadcast-name)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:16 +#: ./docs/9.x/broadcasting.md:16 +#: ./docs/10.x/broadcasting.md:18 +#: ./docs/11.x/broadcasting.md:17 +#: ./docs/master/broadcasting.md:17 msgid "[Broadcast Data](#broadcast-data)" -msgstr "[Broadcast 資料](#broadcast-data)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:17 +#: ./docs/9.x/broadcasting.md:17 +#: ./docs/10.x/broadcasting.md:19 +#: ./docs/11.x/broadcasting.md:18 +#: ./docs/master/broadcasting.md:18 msgid "[Broadcast Queue](#broadcast-queue)" -msgstr "[Broadcast 佇列](#broadcast-queue)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:18 +#: ./docs/9.x/broadcasting.md:18 +#: ./docs/10.x/broadcasting.md:20 +#: ./docs/11.x/broadcasting.md:19 +#: ./docs/master/broadcasting.md:19 msgid "[Broadcast Conditions](#broadcast-conditions)" -msgstr "[Broadcast 條件](#broadcast-conditions)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:19 +#: ./docs/9.x/broadcasting.md:19 msgid "[Broadcasting & Database Transactions](#broadcasting-and-database-transactions)" -msgstr "[Broadcast 與資料庫 Transaction](#broadcasting-and-database-transactions)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:20 +#: ./docs/9.x/broadcasting.md:20 +#: ./docs/10.x/broadcasting.md:22 +#: ./docs/11.x/broadcasting.md:21 +#: ./docs/master/broadcasting.md:21 msgid "[Authorizing Channels](#authorizing-channels)" -msgstr "[授權頻道](#authorizing-channels)" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:21 +#: ./docs/11.x/broadcasting.md:20 +#: ./docs/master/broadcasting.md:20 +msgid "[Broadcasting and Database Transactions](#broadcasting-and-database-transactions)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:21 +#: ./docs/9.x/broadcasting.md:21 +#: ./docs/10.x/broadcasting.md:23 +#: ./docs/master/broadcasting.md:22 msgid "[Defining Authorization Routes](#defining-authorization-routes)" -msgstr "[定義授權路由](#defining-authorization-routes)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:22 +#: ./docs/9.x/broadcasting.md:22 +#: ./docs/10.x/broadcasting.md:24 +#: ./docs/11.x/broadcasting.md:22 +#: ./docs/master/broadcasting.md:23 msgid "[Defining Authorization Callbacks](#defining-authorization-callbacks)" -msgstr "[定義授權回呼](#defining-authorization-callbacks)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:23 +#: ./docs/9.x/broadcasting.md:23 +#: ./docs/10.x/broadcasting.md:25 +#: ./docs/11.x/broadcasting.md:23 +#: ./docs/master/broadcasting.md:24 msgid "[Defining Channel Classes](#defining-channel-classes)" -msgstr "[定義頻道類別](#defining-channel-classes)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:24 +#: ./docs/9.x/broadcasting.md:24 +#: ./docs/10.x/broadcasting.md:26 +#: ./docs/11.x/broadcasting.md:24 +#: ./docs/master/broadcasting.md:25 msgid "[Broadcasting Events](#broadcasting-events)" -msgstr "[Broadcast 事件](#broadcasting-events)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:25 +#: ./docs/9.x/broadcasting.md:25 msgid "[Only To Others](#only-to-others)" -msgstr "[僅限其他](#only-to-others)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:26 +#: ./docs/9.x/broadcasting.md:26 msgid "[Customizing The Connection](#customizing-the-connection)" -msgstr "[自訂連線](#customizing-the-connection)" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:27 +#: ./docs/11.x/broadcasting.md:25 +#: ./docs/master/broadcasting.md:26 +msgid "[Only to Others](#only-to-others)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/11.x/broadcasting.md:27 +msgid "[Anonymous Events](#anonymous-events)" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:27 +#: ./docs/9.x/broadcasting.md:27 +#: ./docs/10.x/broadcasting.md:29 +#: ./docs/11.x/broadcasting.md:28 +#: ./docs/master/broadcasting.md:28 msgid "[Receiving Broadcasts](#receiving-broadcasts)" -msgstr "[接收 Broadcast](#receiving-broadcasts)" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:28 +#: ./docs/11.x/broadcasting.md:26 +#: ./docs/master/broadcasting.md:27 +msgid "[Customizing the Connection](#customizing-the-connection)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:28 +#: ./docs/9.x/broadcasting.md:28 msgid "[Listening For Events](#listening-for-events)" -msgstr "[監聽事件](#listening-for-events)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:29 +#: ./docs/9.x/broadcasting.md:29 msgid "[Leaving A Channel](#leaving-a-channel)" -msgstr "[離開頻道](#leaving-a-channel)" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:30 +#: ./docs/11.x/broadcasting.md:29 +#: ./docs/master/broadcasting.md:29 +msgid "[Listening for Events](#listening-for-events)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:30 +#: ./docs/9.x/broadcasting.md:30 +#: ./docs/10.x/broadcasting.md:32 +#: ./docs/11.x/broadcasting.md:31 +#: ./docs/master/broadcasting.md:31 msgid "[Namespaces](#namespaces)" -msgstr "[Namespace](#namespaces)" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:31 +#: ./docs/11.x/broadcasting.md:30 +#: ./docs/master/broadcasting.md:30 +msgid "[Leaving a Channel](#leaving-a-channel)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:31 +#: ./docs/9.x/broadcasting.md:31 +#: ./docs/10.x/broadcasting.md:33 +#: ./docs/11.x/broadcasting.md:32 +#: ./docs/master/broadcasting.md:32 msgid "[Presence Channels](#presence-channels)" -msgstr "[Presence 頻道](#presence-channels)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:32 +#: ./docs/9.x/broadcasting.md:32 +#: ./docs/10.x/broadcasting.md:34 +#: ./docs/11.x/broadcasting.md:33 +#: ./docs/master/broadcasting.md:33 msgid "[Authorizing Presence Channels](#authorizing-presence-channels)" -msgstr "[授權 Precense 頻道](#authorizing-presence-channels)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:33 +#: ./docs/9.x/broadcasting.md:33 +#: ./docs/10.x/broadcasting.md:35 +#: ./docs/11.x/broadcasting.md:34 +#: ./docs/master/broadcasting.md:34 msgid "[Joining Presence Channels](#joining-presence-channels)" -msgstr "[加入 Presence 頻道](#joining-presence-channels)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:34 +#: ./docs/9.x/broadcasting.md:34 msgid "[Broadcasting To Presence Channels](#broadcasting-to-presence-channels)" -msgstr "[廣播至 Presence 頻道](#broadcasting-to-presence-channels)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:35 +#: ./docs/9.x/broadcasting.md:35 +#: ./docs/10.x/broadcasting.md:37 +#: ./docs/11.x/broadcasting.md:36 +#: ./docs/master/broadcasting.md:36 msgid "[Model Broadcasting](#model-broadcasting)" -msgstr "[廣播 Model](#model-broadcasting)" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:36 +#: ./docs/11.x/broadcasting.md:35 +#: ./docs/master/broadcasting.md:35 +msgid "[Broadcasting to Presence Channels](#broadcasting-to-presence-channels)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:36 +#: ./docs/9.x/broadcasting.md:36 +#: ./docs/10.x/broadcasting.md:38 +#: ./docs/11.x/broadcasting.md:37 +#: ./docs/master/broadcasting.md:37 msgid "[Model Broadcasting Conventions](#model-broadcasting-conventions)" -msgstr "[廣播 Model 的慣例](#model-broadcasting-conventions)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:37 +#: ./docs/9.x/broadcasting.md:37 msgid "[Listening For Model Broadcasts](#listening-for-model-broadcasts)" -msgstr "[監聽 Model Broadcast](#listening-for-model-broadcasts)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:38 +#: ./docs/9.x/broadcasting.md:38 +#: ./docs/10.x/broadcasting.md:40 +#: ./docs/11.x/broadcasting.md:39 +#: ./docs/master/broadcasting.md:39 msgid "[Client Events](#client-events)" -msgstr "[用戶端事件](#client-events)" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:39 +#: ./docs/11.x/broadcasting.md:38 +#: ./docs/master/broadcasting.md:38 +msgid "[Listening for Model Broadcasts](#listening-for-model-broadcasts)" +msgstr "" -#: docs/10.x/broadcasting.md:block 2 (unordered list) +# P +#: ./docs/8.x/broadcasting.md:39 +#: ./docs/9.x/broadcasting.md:39 +#: ./docs/10.x/broadcasting.md:41 +#: ./docs/11.x/broadcasting.md:40 +#: ./docs/master/broadcasting.md:40 msgid "[Notifications](#notifications)" -msgstr "[通知](#notifications)" +msgstr "" -#: docs/10.x/broadcasting.md:block 4 (header) +# P +#: ./docs/8.x/broadcasting.md:41 +#: ./docs/9.x/broadcasting.md:41 +#: ./docs/10.x/broadcasting.md:43 +#: ./docs/11.x/broadcasting.md:42 +#: ./docs/master/broadcasting.md:42 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/broadcasting.md:42 +#: ./docs/9.x/broadcasting.md:42 +#: ./docs/10.x/broadcasting.md:44 +#: ./docs/11.x/broadcasting.md:43 +#: ./docs/master/broadcasting.md:43 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/broadcasting.md:block 5 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:44 +#: ./docs/9.x/broadcasting.md:44 +#: ./docs/10.x/broadcasting.md:46 +#: ./docs/11.x/broadcasting.md:45 +#: ./docs/master/broadcasting.md:45 msgid "In many modern web applications, WebSockets are used to implement realtime, live-updating user interfaces. When some data is updated on the server, a message is typically sent over a WebSocket connection to be handled by the client. WebSockets provide a more efficient alternative to continually polling your application's server for data changes that should be reflected in your UI." -msgstr "在許多現代 Web App 中,都使用了 WebSocket 來提供即時更新的 UI。當某個資料在伺服器上被更新,通常會通過 WebSocket 連線來將一個訊息傳送給用戶端做處理。比起不斷從伺服器上拉取資料並反應到 UI 上,WebSocket 提供是更有效率的方案。" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:46 +#: ./docs/9.x/broadcasting.md:46 +msgid "For example, imagine your application is able to export a user's data to a CSV file and email it to them. However, creating this CSV file takes several minutes so you choose to create and mail the CSV within a [queued job](/docs/{{version}}/queues). When the CSV has been created and mailed to the user, we can use event broadcasting to dispatch a `App\\Events\\UserDataExported` event that is received by our application's JavaScript. Once the event is received, we can display a message to the user that their CSV has been emailed to them without them ever needing to refresh the page." +msgstr "" -#: docs/10.x/broadcasting.md:block 6 (paragraph) +# P +#: ./docs/10.x/broadcasting.md:48 +#: ./docs/11.x/broadcasting.md:47 +#: ./docs/master/broadcasting.md:47 msgid "For example, imagine your application is able to export a user's data to a CSV file and email it to them. However, creating this CSV file takes several minutes so you choose to create and mail the CSV within a [queued job](/docs/{{version}}/queues). When the CSV has been created and mailed to the user, we can use event broadcasting to dispatch an `App\\Events\\UserDataExported` event that is received by our application's JavaScript. Once the event is received, we can display a message to the user that their CSV has been emailed to them without them ever needing to refresh the page." -msgstr "舉例來說,假設我們的 App 可以將使用者資料匯出為 CSV 檔並以電子郵件寄出。不過,建立 CSV 檔需要數分鐘的事件,因此我們選擇將建立與寄送 CSV 檔的程式放在[佇列任務](/docs/{{version}}/queues)中。當 CSV 當建立完畢並寄給使用者後,我們可以使用「事件廣播」來將 `App\\Events\\UserDataExported` 事件分派給應用程式的 JavaScript。收到事件後,使用者就能在不重新整理的情況下看到一個訊息,表示我們已將 CSV 檔寄送出去。" +msgstr "" -#: docs/10.x/broadcasting.md:block 7 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:48 +#: ./docs/9.x/broadcasting.md:48 +#: ./docs/10.x/broadcasting.md:50 +#: ./docs/11.x/broadcasting.md:49 +#: ./docs/master/broadcasting.md:49 msgid "To assist you in building these types of features, Laravel makes it easy to \"broadcast\" your server-side Laravel [events](/docs/{{version}}/events) over a WebSocket connection. Broadcasting your Laravel events allows you to share the same event names and data between your server-side Laravel application and your client-side JavaScript application." -msgstr "為了協助你製作這種類型的功能,Laravel 讓你能簡單地將伺服器端 Laravel [事件](/docs/{{version}}/events)通過 WebSocket 連線來「廣播」出去。通過廣播 Laravel 事件,就可以在伺服器端 Laravel 程式與用戶端 JavaScript 程式間共享相同的事件名稱與資料。" +msgstr "" -#: docs/10.x/broadcasting.md:block 8 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:50 +#: ./docs/9.x/broadcasting.md:50 +#: ./docs/10.x/broadcasting.md:52 +#: ./docs/11.x/broadcasting.md:51 +#: ./docs/master/broadcasting.md:51 msgid "The core concepts behind broadcasting are simple: clients connect to named channels on the frontend, while your Laravel application broadcasts events to these channels on the backend. These events can contain any additional data you wish to make available to the frontend." -msgstr "「廣播」背後的核心概念很簡單:用戶端會在前端連線到一個有名稱的頻道,而後端 Laravel 網站則會將事件廣播給這些頻道。這些事件可以包含任何你想讓前端存取的額外資料。" +msgstr "" -#: docs/10.x/broadcasting.md:block 10 (header) +# P +#: ./docs/8.x/broadcasting.md:52 +#: ./docs/9.x/broadcasting.md:52 +#: ./docs/10.x/broadcasting.md:54 +#: ./docs/11.x/broadcasting.md:53 +#: ./docs/master/broadcasting.md:53 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:53 +#: ./docs/9.x/broadcasting.md:53 +#: ./docs/10.x/broadcasting.md:55 +#: ./docs/11.x/broadcasting.md:54 +#: ./docs/master/broadcasting.md:54 msgid "Supported Drivers" -msgstr "支援的 Driver" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:55 +msgid "By default, Laravel includes two server-side broadcasting drivers for you to choose from: [Pusher Channels](https://pusher.com/channels) and [Ably](https://ably.io). However, community driven packages such as [laravel-websockets](https://beyondco.de/docs/laravel-websockets/getting-started/introduction) and [soketi](https://docs.soketi.app/) provide additional broadcasting drivers that do not require commercial broadcasting providers." +msgstr "" -#: docs/10.x/broadcasting.md:block 11 (paragraph) +# P +#: ./docs/9.x/broadcasting.md:55 msgid "By default, Laravel includes two server-side broadcasting drivers for you to choose from: [Pusher Channels](https://pusher.com/channels) and [Ably](https://ably.com). However, community driven packages such as [laravel-websockets](https://beyondco.de/docs/laravel-websockets/getting-started/introduction) and [soketi](https://docs.soketi.app/) provide additional broadcasting drivers that do not require commercial broadcasting providers." -msgstr "預設情況下,Laravel 包含了兩個伺服器端廣播 Driver 可供選擇:[Pusher Channels](https://pusher.com/channels) 與 [Ably](https://ably.com)。不過,也有如 [laravel-websockets](https://beyondco.de/docs/laravel-websockets/getting-started/introduction) 與 [soketi](https://docs.soketi.app/) 這樣由社群開發的套件提供不需要商業 Broadcast Provider 的額外 Broadcast Driver。" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:57 +#: ./docs/11.x/broadcasting.md:56 +#: ./docs/master/broadcasting.md:56 +msgid "By default, Laravel includes three server-side broadcasting drivers for you to choose from: [Laravel Reverb](https://reverb.laravel.com), [Pusher Channels](https://pusher.com/channels), and [Ably](https://ably.com)." +msgstr "" -#: docs/10.x/broadcasting.md:block 12 (quote) -msgid "**Note** Before diving into event broadcasting, make sure you have read Laravel's documentation on [events and listeners](/docs/{{version}}/events)." -msgstr "**Note** 在深入探討事件廣播前,請先確保你已閱讀有關 [事件與監聽程式](/docs/{{version}}/events)的 Laravel 說明文件。" +# P +#: ./docs/8.x/broadcasting.md:57 +#: ./docs/9.x/broadcasting.md:58 +#: ./docs/10.x/broadcasting.md:60 +#: ./docs/11.x/broadcasting.md:59 +#: ./docs/master/broadcasting.md:59 +msgid "Before diving into event broadcasting, make sure you have read Laravel's documentation on [events and listeners](/docs/{{version}}/events)." +msgstr "" -#: docs/10.x/broadcasting.md:block 14 (header) +# P +#: ./docs/8.x/broadcasting.md:59 +#: ./docs/9.x/broadcasting.md:60 +#: ./docs/10.x/broadcasting.md:62 +#: ./docs/11.x/broadcasting.md:61 +#: ./docs/master/broadcasting.md:61 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/broadcasting.md:60 +#: ./docs/9.x/broadcasting.md:61 +#: ./docs/10.x/broadcasting.md:63 +#: ./docs/11.x/broadcasting.md:62 +#: ./docs/master/broadcasting.md:62 msgid "Server Side Installation" -msgstr "伺服器端安裝" +msgstr "" -#: docs/10.x/broadcasting.md:block 15 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:62 +#: ./docs/9.x/broadcasting.md:63 +#: ./docs/10.x/broadcasting.md:65 +#: ./docs/11.x/broadcasting.md:64 +#: ./docs/master/broadcasting.md:64 msgid "To get started using Laravel's event broadcasting, we need to do some configuration within the Laravel application as well as install a few packages." -msgstr "若要開始使用 Laravel 的事件廣播,我們需要在 Laravel 專案中做一些設定以及安裝一些套件。" +msgstr "" -#: docs/10.x/broadcasting.md:block 16 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:64 +#: ./docs/9.x/broadcasting.md:65 +#: ./docs/10.x/broadcasting.md:67 +#: ./docs/11.x/broadcasting.md:66 +#: ./docs/master/broadcasting.md:66 msgid "Event broadcasting is accomplished by a server-side broadcasting driver that broadcasts your Laravel events so that Laravel Echo (a JavaScript library) can receive them within the browser client. Don't worry - we'll walk through each part of the installation process step-by-step." -msgstr "事件廣播是通過伺服器端的廣播 Driver 將 Laravel 事件廣播出去,讓 Laravel Echo (一個 JavaScript 套件) 可以在瀏覽器用戶端內接收這個事件。別擔心 —— 我們會一步一步地介紹安裝過程的每一部分。" +msgstr "" -#: docs/10.x/broadcasting.md:block 18 (header) +# P +#: ./docs/8.x/broadcasting.md:66 +#: ./docs/9.x/broadcasting.md:67 +#: ./docs/10.x/broadcasting.md:69 +#: ./docs/11.x/broadcasting.md:68 +#: ./docs/master/broadcasting.md:68 +#~ msgid "" +#~ msgstr "" + +# H3 +# H4 +#: ./docs/8.x/broadcasting.md:67 +#: ./docs/8.x/broadcasting.md:658 +#: ./docs/9.x/broadcasting.md:68 +#: ./docs/9.x/broadcasting.md:697 +#: ./docs/10.x/broadcasting.md:70 +#: ./docs/10.x/broadcasting.md:759 +#: ./docs/11.x/broadcasting.md:69 +#: ./docs/11.x/broadcasting.md:722 +#: ./docs/master/broadcasting.md:69 +#: ./docs/master/broadcasting.md:779 msgid "Configuration" -msgstr "設定" +msgstr "" -#: docs/10.x/broadcasting.md:block 19 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:69 +#: ./docs/9.x/broadcasting.md:70 +#: ./docs/10.x/broadcasting.md:72 msgid "All of your application's event broadcasting configuration is stored in the `config/broadcasting.php` configuration file. Laravel supports several broadcast drivers out of the box: [Pusher Channels](https://pusher.com/channels), [Redis](/docs/{{version}}/redis), and a `log` driver for local development and debugging. Additionally, a `null` driver is included which allows you to totally disable broadcasting during testing. A configuration example is included for each of these drivers in the `config/broadcasting.php` configuration file." -msgstr "專案中,所有關於事件廣播的設定都放在 `config/boradcasting.php` 設定檔中。Laravel 內建支援多個 Broadcast Driver:[Pusher Channels](https://pusher.com/channels)、[Redis](/docs/{{version}}/redis)、以及一個用於本機開發與偵錯的 `log` Driver。此外,也包含了一個可以在測試期間完全禁用廣播的 `null` Driver。`config/boradcasting.php` 設定中包含了各個 Driver 的設定範例。" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:71 +msgid "All of your application's event broadcasting configuration is stored in the `config/broadcasting.php` configuration file. Don't worry if this directory does not exist in your application; it will be created when you run the `install:broadcasting` Artisan command." +msgstr "" -#: docs/10.x/broadcasting.md:block 21 (header) +# P +#: ./docs/8.x/broadcasting.md:71 +#: ./docs/9.x/broadcasting.md:72 +#: ./docs/10.x/broadcasting.md:74 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/master/broadcasting.md:71 +msgid "All of your application's event broadcasting configuration is stored in the `config/broadcasting.php` configuration file. Laravel supports several broadcast drivers out of the box: [Laravel Reverb](/docs/{{version}}/reverb), [Pusher Channels](https://pusher.com/channels), [Ably](https://ably.com), and a `log` driver for local development and debugging. Additionally, a `null` driver is included which allows you to totally disable broadcasting during testing. A configuration example is included for each of these drivers in the `config/broadcasting.php` configuration file." +msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:72 +#: ./docs/9.x/broadcasting.md:73 +#: ./docs/10.x/broadcasting.md:75 msgid "Broadcast Service Provider" -msgstr "Broadcast Service Provider" +msgstr "" -#: docs/10.x/broadcasting.md:block 22 (paragraph) +# P +#: ./docs/11.x/broadcasting.md:73 +msgid "Laravel supports several broadcast drivers out of the box: [Laravel Reverb](/docs/{{version}}/reverb), [Pusher Channels](https://pusher.com/channels), [Ably](https://ably.com), and a `log` driver for local development and debugging. Additionally, a `null` driver is included which allows you to disable broadcasting during testing. A configuration example is included for each of these drivers in the `config/broadcasting.php` configuration file." +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:74 +#: ./docs/9.x/broadcasting.md:75 +#: ./docs/10.x/broadcasting.md:77 msgid "Before broadcasting any events, you will first need to register the `App\\Providers\\BroadcastServiceProvider`. In new Laravel applications, you only need to uncomment this provider in the `providers` array of your `config/app.php` configuration file. This `BroadcastServiceProvider` contains the code necessary to register the broadcast authorization routes and callbacks." -msgstr "在廣播任何事件以前,需要先註冊 `App\\Providers\\BroadcastServiceProvider`。在新安裝的 Laravel 專案中,只需要在 `config/app.php` 設定檔內的 `providers` 陣列中取消註解這個 Provider 即可。這個 `BroadcastServiceProvider` 包含了要註冊廣播授權路由以及回呼所需的程式碼。" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:75 +#: ./docs/master/broadcasting.md:73 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/broadcasting.md:block 24 (header) +# H4 +#: ./docs/11.x/broadcasting.md:76 +#: ./docs/master/broadcasting.md:74 +msgid "Installation" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:76 +#: ./docs/9.x/broadcasting.md:77 +#: ./docs/10.x/broadcasting.md:79 +#: ./docs/11.x/broadcasting.md:86 +#: ./docs/master/broadcasting.md:84 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:77 +#: ./docs/9.x/broadcasting.md:78 +#: ./docs/10.x/broadcasting.md:80 +#: ./docs/11.x/broadcasting.md:87 +#: ./docs/master/broadcasting.md:85 msgid "Queue Configuration" -msgstr "設定佇列" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:78 +#: ./docs/master/broadcasting.md:76 +msgid "By default, broadcasting is not enabled in new Laravel applications. You may enable broadcasting using the `install:broadcasting` Artisan command:" +msgstr "" -#: docs/10.x/broadcasting.md:block 25 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:79 +#: ./docs/9.x/broadcasting.md:80 +#: ./docs/10.x/broadcasting.md:82 msgid "You will also need to configure and run a [queue worker](/docs/{{version}}/queues). All event broadcasting is done via queued jobs so that the response time of your application is not seriously affected by events being broadcast." -msgstr "也需要註冊並執行一個[佇列背景工作角色](/docs/{{version}}/queues)。所有的事件廣播都是通過佇列任務來完成的,這樣一來在事件被廣播的過程所需的事件才不會對網站的回應時間有太大的影響。" +msgstr "" + +# CODE: shell +#: ./docs/11.x/broadcasting.md:80 +#: ./docs/master/broadcasting.md:78 +msgid "php artisan install:broadcasting" +msgstr "" -#: docs/10.x/broadcasting.md:block 27 (header) +# P +#: ./docs/8.x/broadcasting.md:81 +#: ./docs/9.x/broadcasting.md:82 +#: ./docs/10.x/broadcasting.md:101 +#: ./docs/11.x/broadcasting.md:108 +#: ./docs/master/broadcasting.md:123 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:82 +#: ./docs/8.x/broadcasting.md:142 +#: ./docs/9.x/broadcasting.md:83 +#: ./docs/9.x/broadcasting.md:155 +#: ./docs/10.x/broadcasting.md:102 +#: ./docs/10.x/broadcasting.md:209 +#: ./docs/11.x/broadcasting.md:109 +#: ./docs/11.x/broadcasting.md:206 +#: ./docs/master/broadcasting.md:124 +#: ./docs/master/broadcasting.md:221 +#: ./docs/master/broadcasting.md:260 msgid "Pusher Channels" -msgstr "Pusher Channels" +msgstr "" + +# P +#: ./docs/master/broadcasting.md:82 +msgid "The `install:broadcasting` command will create a `routes/channels.php` file where you may register your application's broadcast authorization routes and callbacks." +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:84 +#: ./docs/11.x/broadcasting.md:91 +#: ./docs/master/broadcasting.md:89 +#: ./docs/master/broadcasting.md:106 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:84 +msgid "The `install:broadcasting` command will create the `config/broadcasting.php` configuration file. In addition, the command will create the `routes/channels.php` file where you may register your application's broadcast authorization routes and callbacks." +msgstr "" -#: docs/10.x/broadcasting.md:block 28 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:84 +#: ./docs/9.x/broadcasting.md:85 +#: ./docs/10.x/broadcasting.md:104 +#: ./docs/11.x/broadcasting.md:111 +#: ./docs/master/broadcasting.md:126 msgid "If you plan to broadcast your events using [Pusher Channels](https://pusher.com/channels), you should install the Pusher Channels PHP SDK using the Composer package manager:" -msgstr "若有打算要使用 [Pusher Channels](https://pusher.com/channels),那麼應通過 Composer 套件管理員來安裝 Pusher Channels 的 PHP SDK:" +msgstr "" + +# H3 +#: ./docs/10.x/broadcasting.md:85 +#: ./docs/10.x/broadcasting.md:172 +#: ./docs/11.x/broadcasting.md:92 +#: ./docs/11.x/broadcasting.md:169 +#: ./docs/master/broadcasting.md:90 +#: ./docs/master/broadcasting.md:107 +#: ./docs/master/broadcasting.md:184 +msgid "Reverb" +msgstr "" -#: docs/10.x/broadcasting.md:block 29 (code) -msgid "composer require pusher/pusher-php-server\n" -msgstr "composer require pusher/pusher-php-server\n" +# CODE +# CODE: shell +#: ./docs/8.x/broadcasting.md:86 +#: ./docs/9.x/broadcasting.md:87 +#: ./docs/10.x/broadcasting.md:106 +#: ./docs/11.x/broadcasting.md:113 +#: ./docs/master/broadcasting.md:128 +msgid "composer require pusher/pusher-php-server" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:87 +msgid "You may install Reverb using the Composer package manager:" +msgstr "" -#: docs/10.x/broadcasting.md:block 30 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:88 +#: ./docs/9.x/broadcasting.md:91 +#: ./docs/10.x/broadcasting.md:110 msgid "Next, you should configure your Pusher Channels credentials in the `config/broadcasting.php` configuration file. An example Pusher Channels configuration is already included in this file, allowing you to quickly specify your key, secret, and application ID. Typically, these values should be set via the `PUSHER_APP_KEY`, `PUSHER_APP_SECRET`, and `PUSHER_APP_ID` [environment variables](/docs/{{version}}/configuration#environment-configuration):" -msgstr "接著,應在 `config/broadcasting.php` 設定檔中設定 Pusher Channels 的憑證。該檔案中已經有包含了一個範例的 Pusher Channels 設定,讓你可以快速指定你的 Key, Secret 以及 Application ID。通常來說,這些值應該要通過 `PUSHER_APP_KEY`, `PUSHER_APP_SECRET` 與 `PUSHER_APP_ID` [環境變數](/docs/{{version}}/configuration#environment-configuration) 來設定:" +msgstr "" -#: docs/10.x/broadcasting.md:block 31 (code) +# CODE: sh +#: ./docs/10.x/broadcasting.md:89 +#: ./docs/11.x/broadcasting.md:96 +msgid "composer require laravel/reverb" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:89 +#: ./docs/master/broadcasting.md:87 +msgid "Before broadcasting any events, you should first configure and run a [queue worker](/docs/{{version}}/queues). All event broadcasting is done via queued jobs so that the response time of your application is not seriously affected by events being broadcast." +msgstr "" + +# CODE +# CODE: ini +#: ./docs/8.x/broadcasting.md:90 +#: ./docs/9.x/broadcasting.md:93 +#: ./docs/10.x/broadcasting.md:112 msgid "PUSHER_APP_ID=your-pusher-app-id\n" "PUSHER_APP_KEY=your-pusher-key\n" "PUSHER_APP_SECRET=your-pusher-secret\n" -"PUSHER_APP_CLUSTER=mt1\n" -msgstr "PUSHER_APP_ID=your-pusher-app-id\n" -"PUSHER_APP_KEY=your-pusher-key\n" -"PUSHER_APP_SECRET=your-pusher-secret\n" -"PUSHER_APP_CLUSTER=mt1\n" +"PUSHER_APP_CLUSTER=mt1" +msgstr "" + +# P +#: ./docs/master/broadcasting.md:92 +msgid "When running the `install:broadcasting` command, you will be prompted to install [Laravel Reverb](/docs/{{version}}/reverb). Of course, you may also install Reverb manually using the Composer package manager. Since Reverb is currently in beta, you will need to explicitly install the beta release:" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:93 +#: ./docs/master/broadcasting.md:115 +msgid "Once the package is installed, you may run Reverb's installation command to publish the configuration, update your applications's broadcasting configuration, and add Reverb's required environment variables:" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:94 +msgid "When running the `install:broadcasting` command, you will be prompted to install [Laravel Reverb](/docs/{{version}}/reverb). Of course, you may also install Reverb manually using the Composer package manager." +msgstr "" + +# CODE: sh +#: ./docs/master/broadcasting.md:94 +#: ./docs/master/broadcasting.md:111 +msgid "composer require laravel/reverb:@beta" +msgstr "" + +# CODE: sh +#: ./docs/10.x/broadcasting.md:95 +#: ./docs/11.x/broadcasting.md:102 +#: ./docs/master/broadcasting.md:100 +#: ./docs/master/broadcasting.md:117 +msgid "php artisan reverb:install" +msgstr "" -#: docs/10.x/broadcasting.md:block 32 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:95 +#: ./docs/9.x/broadcasting.md:100 +#: ./docs/10.x/broadcasting.md:119 +#: ./docs/11.x/broadcasting.md:129 +#: ./docs/master/broadcasting.md:144 msgid "The `config/broadcasting.php` file's `pusher` configuration also allows you to specify additional `options` that are supported by Channels, such as the cluster." -msgstr "`config/broadcasting.php` 檔的 `pusher` 設定能讓你指定 Channels 所支援的額外選項 `options`,如簇集 (Cluster)。" +msgstr "" -#: docs/10.x/broadcasting.md:block 33 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:97 +#: ./docs/9.x/broadcasting.md:102 +#: ./docs/10.x/broadcasting.md:121 msgid "Next, you will need to change your broadcast driver to `pusher` in your `.env` file:" -msgstr "接著,需要在 `.env` 檔中更改你的 Broadcast Driver 為 `pusher`:" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:99 +#: ./docs/11.x/broadcasting.md:106 +#: ./docs/master/broadcasting.md:104 +#: ./docs/master/broadcasting.md:121 +msgid "You can find detailed Reverb installation and usage instructions in the [Reverb documentation](/docs/{{version}}/reverb)." +msgstr "" + +# CODE +# CODE: ini +#: ./docs/8.x/broadcasting.md:99 +#: ./docs/9.x/broadcasting.md:104 +#: ./docs/10.x/broadcasting.md:123 +msgid "BROADCAST_DRIVER=pusher" +msgstr "" -#: docs/10.x/broadcasting.md:block 34 (code) -msgid "BROADCAST_DRIVER=pusher\n" -msgstr "BROADCAST_DRIVER=pusher\n" +# P +#: ./docs/11.x/broadcasting.md:100 +#: ./docs/master/broadcasting.md:98 +msgid "Once the package is installed, you may run Reverb's installation command to publish the configuration, add Reverb's required environment variables, and enable event broadcasting in your application:" +msgstr "" -#: docs/10.x/broadcasting.md:block 35 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:101 +#: ./docs/8.x/broadcasting.md:123 +#: ./docs/9.x/broadcasting.md:108 +#: ./docs/9.x/broadcasting.md:136 +#: ./docs/10.x/broadcasting.md:127 +#: ./docs/10.x/broadcasting.md:158 +#: ./docs/11.x/broadcasting.md:137 +#: ./docs/11.x/broadcasting.md:163 +#: ./docs/master/broadcasting.md:152 +#: ./docs/master/broadcasting.md:178 msgid "Finally, you are ready to install and configure [Laravel Echo](#client-side-installation), which will receive the broadcast events on the client-side." -msgstr "最後,就可以安裝並設定 [Laravel Echo](#client-side-installable)。Laravel Echo 會在用戶端上接收廣播事件。" +msgstr "" -#: docs/10.x/broadcasting.md:block 37 (header) +# P +#: ./docs/8.x/broadcasting.md:103 +#: ./docs/9.x/broadcasting.md:110 +#: ./docs/10.x/broadcasting.md:129 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:104 +#: ./docs/9.x/broadcasting.md:111 +#: ./docs/10.x/broadcasting.md:130 msgid "Open Source Pusher Alternatives" -msgstr "開放原始碼的 Pusher 替代" +msgstr "" -#: docs/10.x/broadcasting.md:block 38 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:106 +#: ./docs/9.x/broadcasting.md:113 msgid "The [laravel-websockets](https://github.com/beyondcode/laravel-websockets) and [soketi](https://docs.soketi.app/) packages provide Pusher compatible WebSocket servers for Laravel. These packages allow you to leverage the full power of Laravel broadcasting without a commercial WebSocket provider. For more information on installing and using these packages, please consult our documentation on [open source alternatives](#open-source-alternatives)." -msgstr "[laravel-websockets](https://github.com/beyondcode/laravel-websockets) 與 [soketi](https://docs.soketi.app/) 套件提供了用於 Laravel 的 Pusher 相同 WebSocket 伺服器。使用這些套件就能在不依賴商業 WebSocket Provider 的情況下使用完整的 Laravel Broadcasting 功能。有關安裝這些套件的更多資訊,請參考我們的[開放原始碼替代](#open-source-alternatives)說明文件。" +msgstr "" -#: docs/10.x/broadcasting.md:block 40 (header) +# P +#: ./docs/8.x/broadcasting.md:108 +#: ./docs/9.x/broadcasting.md:115 +#: ./docs/10.x/broadcasting.md:134 +#: ./docs/11.x/broadcasting.md:139 +#: ./docs/master/broadcasting.md:154 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:109 +#: ./docs/8.x/broadcasting.md:189 +#: ./docs/9.x/broadcasting.md:116 +#: ./docs/9.x/broadcasting.md:209 +#: ./docs/10.x/broadcasting.md:135 +#: ./docs/10.x/broadcasting.md:263 +#: ./docs/11.x/broadcasting.md:140 +#: ./docs/11.x/broadcasting.md:281 +#: ./docs/master/broadcasting.md:155 +#: ./docs/master/broadcasting.md:335 msgid "Ably" -msgstr "Ably" +msgstr "" -#: docs/10.x/broadcasting.md:block 41 (quote) -msgid "**Note** The documentation below discusses how to use Ably in \"Pusher compatibility\" mode. However, the Ably team recommends and maintains a broadcaster and Echo client that is able to take advantage of the unique capabilities offered by Ably. For more information on using the Ably maintained drivers, please [consult Ably's Laravel broadcaster documentation](https://github.com/ably/laravel-broadcaster)." -msgstr "**Note** 下方的說明文件討論了如何在「Pusher 相容模式 (Pusher Compatibility)」下使用 Ably。不過,Ably 團隊推薦並維護了一個 Broadcaster 程式,以及一個可使用 Ably 特別功能的 Echo 用戶端。更多有關使用 Ably 維護的 Driver 的資訊,請[參考 Ably 的 Laravel Broadcaster 說明文件 (英語)](https://github.com/ably/laravel-broadcaster)。" +# P +#: ./docs/master/broadcasting.md:109 +msgid "You may install Reverb using the Composer package manager. Since Reverb is currently in beta, you will need to explicitly install the beta release:" +msgstr "" -#: docs/10.x/broadcasting.md:block 42 (paragraph) -msgid "If you plan to broadcast your events using [Ably](https://ably.com), you should install the Ably PHP SDK using the Composer package manager:" -msgstr "若有打算要使用 [Ably](https://ably.com),則請使用 Composer 套件管理員來安裝 Ably 的 PHP SDK:" +# P +#: ./docs/8.x/broadcasting.md:111 +msgid "If you plan to broadcast your events using [Ably](https://ably.io), you should install the Ably PHP SDK using the Composer package manager:" +msgstr "" -#: docs/10.x/broadcasting.md:block 43 (code) -msgid "composer require ably/ably-php\n" -msgstr "composer require ably/ably-php\n" +# CODE +# CODE: shell +#: ./docs/8.x/broadcasting.md:113 +#: ./docs/9.x/broadcasting.md:120 +#: ./docs/10.x/broadcasting.md:142 +#: ./docs/11.x/broadcasting.md:147 +#: ./docs/master/broadcasting.md:162 +msgid "composer require ably/ably-php" +msgstr "" -#: docs/10.x/broadcasting.md:block 44 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:115 +#: ./docs/9.x/broadcasting.md:124 +#: ./docs/10.x/broadcasting.md:146 +#: ./docs/11.x/broadcasting.md:151 +#: ./docs/master/broadcasting.md:166 msgid "Next, you should configure your Ably credentials in the `config/broadcasting.php` configuration file. An example Ably configuration is already included in this file, allowing you to quickly specify your key. Typically, this value should be set via the `ABLY_KEY` [environment variable](/docs/{{version}}/configuration#environment-configuration):" -msgstr "接著,應在 `config/broadcasting.php` 設定檔中設定 Pusher Channels 的憑證。該檔案中已經有包含了一個範例的 Ably 設定,讓你可以快速指定你的金鑰。通常來說,這個值應該要通過 `ABLY_KEY` [環境變數](/docs/{{version}}/configuration#environment-configuration) 來設定:" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:117 +#: ./docs/master/broadcasting.md:132 +msgid "Next, you should configure your Pusher Channels credentials in the `config/broadcasting.php` configuration file. An example Pusher Channels configuration is already included in this file, allowing you to quickly specify your key, secret, and application ID. Typically, you should configure your Pusher Channels credentials in your application's `.env` file:" +msgstr "" + +# CODE +# CODE: ini +#: ./docs/8.x/broadcasting.md:117 +#: ./docs/9.x/broadcasting.md:126 +#: ./docs/10.x/broadcasting.md:148 +#: ./docs/11.x/broadcasting.md:153 +#: ./docs/master/broadcasting.md:168 +msgid "ABLY_KEY=your-ably-key" +msgstr "" + +# P +#: ./docs/9.x/broadcasting.md:118 +#: ./docs/10.x/broadcasting.md:140 +#: ./docs/11.x/broadcasting.md:145 +#: ./docs/master/broadcasting.md:160 +msgid "If you plan to broadcast your events using [Ably](https://ably.com), you should install the Ably PHP SDK using the Composer package manager:" +msgstr "" -#: docs/10.x/broadcasting.md:block 45 (code) -msgid "ABLY_KEY=your-ably-key\n" -msgstr "ABLY_KEY=your-ably-key\n" +# CODE: ini +#: ./docs/11.x/broadcasting.md:119 +#: ./docs/master/broadcasting.md:134 +msgid "PUSHER_APP_ID=\"your-pusher-app-id\"\n" +"PUSHER_APP_KEY=\"your-pusher-key\"\n" +"PUSHER_APP_SECRET=\"your-pusher-secret\"\n" +"PUSHER_HOST=\n" +"PUSHER_PORT=443\n" +"PUSHER_SCHEME=\"https\"\n" +"PUSHER_APP_CLUSTER=\"mt1\"" +msgstr "" -#: docs/10.x/broadcasting.md:block 46 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:119 +#: ./docs/9.x/broadcasting.md:130 +#: ./docs/10.x/broadcasting.md:152 msgid "Next, you will need to change your broadcast driver to `ably` in your `.env` file:" -msgstr "接著,需要在 `.env` 檔中更改你的 Broadcast Driver 為 `ably`:" +msgstr "" -#: docs/10.x/broadcasting.md:block 47 (code) -msgid "BROADCAST_DRIVER=ably\n" -msgstr "BROADCAST_DRIVER=ably\n" +# CODE +# CODE: ini +#: ./docs/8.x/broadcasting.md:121 +#: ./docs/9.x/broadcasting.md:132 +#: ./docs/10.x/broadcasting.md:154 +msgid "BROADCAST_DRIVER=ably" +msgstr "" -#: docs/10.x/broadcasting.md:block 50 (header) +# P +#: ./docs/8.x/broadcasting.md:125 +#: ./docs/9.x/broadcasting.md:138 +#: ./docs/10.x/broadcasting.md:160 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:126 +#: ./docs/9.x/broadcasting.md:139 +#: ./docs/10.x/broadcasting.md:161 msgid "Open Source Alternatives" -msgstr "開放原始碼替代" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:128 +#: ./docs/9.x/broadcasting.md:141 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/broadcasting.md:block 52 (header) +# H4 +#: ./docs/8.x/broadcasting.md:129 +#: ./docs/9.x/broadcasting.md:142 msgid "PHP" -msgstr "PHP" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:131 +#: ./docs/master/broadcasting.md:146 +msgid "Then, set the `BROADCAST_CONNECTION` environment variable to `pusher` in your application's `.env` file:" +msgstr "" -#: docs/10.x/broadcasting.md:block 53 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:131 +#: ./docs/9.x/broadcasting.md:144 msgid "The [laravel-websockets](https://github.com/beyondcode/laravel-websockets) package is a pure PHP, Pusher compatible WebSocket package for Laravel. This package allows you to leverage the full power of Laravel broadcasting without a commercial WebSocket provider. For more information on installing and using this package, please consult its [official documentation](https://beyondco.de/docs/laravel-websockets)." -msgstr "[laravel-websockets](https://github.com/beyondcode/laravel-websockets) 套件是一個純 PHP、適用於 Laravel 的 Pusher 相容 WebSocket 套件。這個套件能讓你使用 Laravel 廣播的全部功能,而無需商業 WebSocket Provider。有關安裝與使用該套件的更多資訊,請參考其[官方說明文件](https://beyondco.de/docs/laravel-websockets)。" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:132 +msgid "[soketi](https://docs.soketi.app/) provides a Pusher compatible WebSocket server for Laravel, allowing you to leverage the full power of Laravel broadcasting without a commercial WebSocket provider. For more information on installing and using open source packages for broadcasting, please consult our documentation on [open source alternatives](#open-source-alternatives)." +msgstr "" -#: docs/10.x/broadcasting.md:block 55 (header) +# CODE: ini +#: ./docs/11.x/broadcasting.md:133 +#: ./docs/master/broadcasting.md:148 +msgid "BROADCAST_CONNECTION=pusher" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:133 +#: ./docs/9.x/broadcasting.md:146 +#: ./docs/10.x/broadcasting.md:163 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:134 +#: ./docs/9.x/broadcasting.md:147 +#: ./docs/10.x/broadcasting.md:164 msgid "Node" -msgstr "Node" +msgstr "" -#: docs/10.x/broadcasting.md:block 56 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:136 +#: ./docs/9.x/broadcasting.md:149 +#: ./docs/10.x/broadcasting.md:166 msgid "[Soketi](https://github.com/soketi/soketi) is a Node based, Pusher compatible WebSocket server for Laravel. Under the hood, Soketi utilizes µWebSockets.js for extreme scalability and speed. This package allows you to leverage the full power of Laravel broadcasting without a commercial WebSocket provider. For more information on installing and using this package, please consult its [official documentation](https://docs.soketi.app/)." -msgstr "[Soketi](https://github.com/soketi/soketi) 套件是一個基於 Node、適用於 Laravel 的 Pusher 相容 WebSocket 伺服器。從底層來看,Soketi 使用了 µWebSockets.js 來獲得最佳可擴充性與速度。Sketi 能讓你在不需仰賴商業 WebSocket Provider 的情況下使用 Laravel 廣播的全部功能。有關安裝與使用 Sketi 的更多資訊,請參考其[官方說明文件](https://docs.soketi.app)。" +msgstr "" -#: docs/10.x/broadcasting.md:block 58 (header) +# P +#: ./docs/10.x/broadcasting.md:138 +#: ./docs/10.x/broadcasting.md:266 +#: ./docs/11.x/broadcasting.md:143 +#: ./docs/11.x/broadcasting.md:284 +#: ./docs/master/broadcasting.md:158 +#: ./docs/master/broadcasting.md:338 +msgid "The documentation below discusses how to use Ably in \"Pusher compatibility\" mode. However, the Ably team recommends and maintains a broadcaster and Echo client that is able to take advantage of the unique capabilities offered by Ably. For more information on using the Ably maintained drivers, please [consult Ably's Laravel broadcaster documentation](https://github.com/ably/laravel-broadcaster)." +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:138 +#: ./docs/9.x/broadcasting.md:151 +#: ./docs/10.x/broadcasting.md:168 +#: ./docs/11.x/broadcasting.md:165 +#: ./docs/master/broadcasting.md:180 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/broadcasting.md:139 +#: ./docs/9.x/broadcasting.md:152 +#: ./docs/10.x/broadcasting.md:169 +#: ./docs/11.x/broadcasting.md:166 +#: ./docs/master/broadcasting.md:181 msgid "Client Side Installation" -msgstr "用戶端安裝" +msgstr "" -#: docs/10.x/broadcasting.md:block 61 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:141 +#: ./docs/9.x/broadcasting.md:154 +#: ./docs/10.x/broadcasting.md:208 +#: ./docs/11.x/broadcasting.md:205 +#: ./docs/master/broadcasting.md:220 +#: ./docs/master/broadcasting.md:259 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:144 +#: ./docs/9.x/broadcasting.md:157 +#: ./docs/10.x/broadcasting.md:211 msgid "[Laravel Echo](https://github.com/laravel/echo) is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by your server-side broadcasting driver. You may install Echo via the NPM package manager. In this example, we will also install the `pusher-js` package since we will be using the Pusher Channels broadcaster:" -msgstr "[Laravel Echo](https://github.com/laravel/echo) 是一個 JavaScript 套件,能讓你免於煩惱如何訂閱頻道與監聽來自伺服器端 Broadcasting Driver 的事件廣播。我們可以通過 NPM 套件管理員來安裝 Echo。在這個例子中,因為我們會使用 Pusher Channels Boradcaster,因此我們也會安裝 `pusher-js`:" +msgstr "" -#: docs/10.x/broadcasting.md:block 62 (code) -msgid "npm install --save-dev laravel-echo pusher-js\n" -msgstr "npm install --save-dev laravel-echo pusher-js\n" +# CODE: bash +# CODE: shell +#: ./docs/8.x/broadcasting.md:146 +#: ./docs/8.x/broadcasting.md:195 +#: ./docs/9.x/broadcasting.md:159 +#: ./docs/9.x/broadcasting.md:215 +#: ./docs/10.x/broadcasting.md:176 +#: ./docs/10.x/broadcasting.md:213 +#: ./docs/10.x/broadcasting.md:272 +#: ./docs/11.x/broadcasting.md:173 +#: ./docs/11.x/broadcasting.md:212 +#: ./docs/11.x/broadcasting.md:290 +#: ./docs/master/broadcasting.md:188 +#: ./docs/master/broadcasting.md:227 +#: ./docs/master/broadcasting.md:266 +#: ./docs/master/broadcasting.md:344 +msgid "npm install --save-dev laravel-echo pusher-js" +msgstr "" -#: docs/10.x/broadcasting.md:block 63 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:150 +#: ./docs/9.x/broadcasting.md:163 +#: ./docs/10.x/broadcasting.md:217 msgid "Once Echo is installed, you are ready to create a fresh Echo instance in your application's JavaScript. A great place to do this is at the bottom of the `resources/js/bootstrap.js` file that is included with the Laravel framework. By default, an example Echo configuration is already included in this file - you simply need to uncomment it:" -msgstr "安裝好 Echo 後,就可以在網站的 JavaScript 中建立一個新的 Echo 實體。要建立新 Echo 實體最好的地方就是在 Laravel 附帶的 `resources/js/bootstrap.js` 檔案最尾端。預設情況下,這個檔案內已經包含了一個範例的 Echo 設定,只需要將其取消註解即可:" +msgstr "" -#: docs/10.x/broadcasting.md:block 64 (code) -msgid "import Echo from 'laravel-echo';\n" -"import Pusher from 'pusher-js';\n\n" -"window.Pusher = Pusher;\n\n" +# CODE: js +#: ./docs/8.x/broadcasting.md:152 +msgid "import Echo from 'laravel-echo';\n\n" +"window.Pusher = require('pusher-js');\n\n" "window.Echo = new Echo({\n" " broadcaster: 'pusher',\n" -" key: import.meta.env.VITE_PUSHER_APP_KEY,\n" -" cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER,\n" +" key: process.env.MIX_PUSHER_APP_KEY,\n" +" cluster: process.env.MIX_PUSHER_APP_CLUSTER,\n" " forceTLS: true\n" -"});\n" -msgstr "import Echo from 'laravel-echo';\n" +"});" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:157 +#: ./docs/master/broadcasting.md:172 +msgid "Then, set the `BROADCAST_CONNECTION` environment variable to `ably` in your application's `.env` file:" +msgstr "" + +# CODE: ini +#: ./docs/11.x/broadcasting.md:159 +#: ./docs/master/broadcasting.md:174 +msgid "BROADCAST_CONNECTION=ably" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:165 +#: ./docs/8.x/broadcasting.md:220 +#: ./docs/9.x/broadcasting.md:179 +#: ./docs/9.x/broadcasting.md:241 +#: ./docs/10.x/broadcasting.md:233 +#: ./docs/10.x/broadcasting.md:298 +msgid "Once you have uncommented and adjusted the Echo configuration according to your needs, you may compile your application's assets:" +msgstr "" + +# CODE: js +#: ./docs/9.x/broadcasting.md:165 +#: ./docs/10.x/broadcasting.md:219 +msgid "import Echo from 'laravel-echo';\n" "import Pusher from 'pusher-js';\n\n" "window.Pusher = Pusher;\n\n" "window.Echo = new Echo({\n" @@ -368,40 +1154,144 @@ msgstr "import Echo from 'laravel-echo';\n" " key: import.meta.env.VITE_PUSHER_APP_KEY,\n" " cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER,\n" " forceTLS: true\n" -"});\n" - -#: docs/10.x/broadcasting.md:block 65 (paragraph) -msgid "Once you have uncommented and adjusted the Echo configuration according to your needs, you may compile your application's assets:" -msgstr "取消註解並依照需求調整好 Echo 設定後,就可以編譯專案素材:" +"});" +msgstr "" -#: docs/10.x/broadcasting.md:block 66 (code) -msgid "npm run dev\n" -msgstr "npm run dev\n" +# CODE +# CODE: shell +#: ./docs/8.x/broadcasting.md:167 +#: ./docs/8.x/broadcasting.md:222 +#: ./docs/9.x/broadcasting.md:181 +#: ./docs/9.x/broadcasting.md:243 +#: ./docs/10.x/broadcasting.md:300 +#: ./docs/11.x/broadcasting.md:318 +#: ./docs/master/broadcasting.md:372 +msgid "npm run dev" +msgstr "" -#: docs/10.x/broadcasting.md:block 67 (quote) -msgid "**Note** To learn more about compiling your application's JavaScript assets, please consult the documentation on [Vite](/docs/{{version}}/vite)." -msgstr "**Note** 要瞭解更多有關編譯應用程式 JavaScript 素材的資訊,請參考 [Vite](/docs/{{version}}/vite) 中的說明文件。" +# P +#: ./docs/8.x/broadcasting.md:169 +#: ./docs/8.x/broadcasting.md:224 +msgid "To learn more about compiling your application's JavaScript assets, please consult the documentation on [Laravel Mix](/docs/{{version}}/mix)." +msgstr "" -#: docs/10.x/broadcasting.md:block 69 (header) +# P +#: ./docs/10.x/broadcasting.md:171 +#: ./docs/11.x/broadcasting.md:168 +#: ./docs/master/broadcasting.md:183 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:171 +#: ./docs/9.x/broadcasting.md:188 +#: ./docs/10.x/broadcasting.md:242 +#: ./docs/11.x/broadcasting.md:260 +#: ./docs/master/broadcasting.md:314 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:172 +#: ./docs/9.x/broadcasting.md:189 msgid "Using An Existing Client Instance" -msgstr "使用現有的用戶端實體" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:174 +#: ./docs/11.x/broadcasting.md:171 +#: ./docs/master/broadcasting.md:186 +msgid "[Laravel Echo](https://github.com/laravel/echo) is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by your server-side broadcasting driver. You may install Echo via the NPM package manager. In this example, we will also install the `pusher-js` package since Reverb utilizes the Pusher protocol for WebSocket subscriptions, channels, and messages:" +msgstr "" -#: docs/10.x/broadcasting.md:block 70 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:174 +#: ./docs/9.x/broadcasting.md:191 +#: ./docs/10.x/broadcasting.md:245 +#: ./docs/11.x/broadcasting.md:263 +#: ./docs/master/broadcasting.md:317 msgid "If you already have a pre-configured Pusher Channels client instance that you would like Echo to utilize, you may pass it to Echo via the `client` configuration option:" -msgstr "若已經有預先設定好的 Pusher Channels 用戶端實體,並想讓 Echo 使用的話,可以將其傳入 Echo 的 `client` 設定選項:" +msgstr "" -#: docs/10.x/broadcasting.md:block 71 (code) -msgid "import Echo from 'laravel-echo';\n" -"import Pusher from 'pusher-js';\n\n" -"const options = {\n" +# CODE: js +#: ./docs/8.x/broadcasting.md:176 +msgid "import Echo from 'laravel-echo';\n\n" +"const client = require('pusher-js');\n\n" +"window.Echo = new Echo({\n" " broadcaster: 'pusher',\n" -" key: 'your-pusher-channels-key'\n" -"}\n\n" +" key: 'your-pusher-channels-key',\n" +" client: client\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:180 +#: ./docs/11.x/broadcasting.md:177 +#: ./docs/master/broadcasting.md:192 +msgid "Once Echo is installed, you are ready to create a fresh Echo instance in your application's JavaScript. A great place to do this is at the bottom of the `resources/js/bootstrap.js` file that is included with the Laravel framework. By default, an example Echo configuration is already included in this file - you simply need to uncomment it and update the `broadcaster` configuration option to `reverb`:" +msgstr "" + +# CODE: js +#: ./docs/10.x/broadcasting.md:182 +#: ./docs/11.x/broadcasting.md:179 +#: ./docs/master/broadcasting.md:194 +#: ./docs/master/broadcasting.md:233 +msgid "import Echo from 'laravel-echo';\n\n" +"import Pusher from 'pusher-js';\n" +"window.Pusher = Pusher;\n\n" "window.Echo = new Echo({\n" -" ...options,\n" -" client: new Pusher(options.key, options)\n" -"});\n" -msgstr "import Echo from 'laravel-echo';\n" +" broadcaster: 'reverb',\n" +" key: import.meta.env.VITE_REVERB_APP_KEY,\n" +" wsHost: import.meta.env.VITE_REVERB_HOST,\n" +" wsPort: import.meta.env.VITE_REVERB_PORT,\n" +" wssPort: import.meta.env.VITE_REVERB_PORT,\n" +" forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',\n" +" enabledTransports: ['ws', 'wss'],\n" +"});" +msgstr "" + +# P +#: ./docs/9.x/broadcasting.md:186 +#: ./docs/9.x/broadcasting.md:248 +#: ./docs/10.x/broadcasting.md:240 +#: ./docs/10.x/broadcasting.md:305 +#: ./docs/11.x/broadcasting.md:258 +#: ./docs/11.x/broadcasting.md:323 +#: ./docs/master/broadcasting.md:257 +#: ./docs/master/broadcasting.md:312 +#: ./docs/master/broadcasting.md:377 +msgid "To learn more about compiling your application's JavaScript assets, please consult the documentation on [Vite](/docs/{{version}}/vite)." +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:188 +#: ./docs/9.x/broadcasting.md:208 +#: ./docs/10.x/broadcasting.md:262 +#: ./docs/11.x/broadcasting.md:280 +#: ./docs/master/broadcasting.md:334 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:191 +#: ./docs/9.x/broadcasting.md:211 +#: ./docs/10.x/broadcasting.md:268 +msgid "[Laravel Echo](https://github.com/laravel/echo) is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by your server-side broadcasting driver. You may install Echo via the NPM package manager. In this example, we will also install the `pusher-js` package." +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:193 +#: ./docs/9.x/broadcasting.md:213 +#: ./docs/10.x/broadcasting.md:270 +msgid "You may wonder why we would install the `pusher-js` JavaScript library even though we are using Ably to broadcast our events. Thankfully, Ably includes a Pusher compatibility mode which lets us use the Pusher protocol when listening for events in our client-side application:" +msgstr "" + +# CODE: js +#: ./docs/9.x/broadcasting.md:193 +#: ./docs/10.x/broadcasting.md:247 +#: ./docs/11.x/broadcasting.md:265 +#: ./docs/master/broadcasting.md:319 +msgid "import Echo from 'laravel-echo';\n" "import Pusher from 'pusher-js';\n\n" "const options = {\n" " broadcaster: 'pusher',\n" @@ -410,101 +1300,297 @@ msgstr "import Echo from 'laravel-echo';\n" "window.Echo = new Echo({\n" " ...options,\n" " client: new Pusher(options.key, options)\n" -"});\n" - -#: docs/10.x/broadcasting.md:block 75 (paragraph) -msgid "[Laravel Echo](https://github.com/laravel/echo) is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by your server-side broadcasting driver. You may install Echo via the NPM package manager. In this example, we will also install the `pusher-js` package." -msgstr "[Laravel Echo](https://github.com/laravel/echo) 是一個 JavaScript 套件,能讓你免於煩惱如何訂閱頻道與監聽來自伺服器端 Broadcasting Driver 的事件廣播。我們可以通過 NPM 套件管理員來安裝 Echo。在這個例子中,我們也會安裝 `pusher-js`:" +"});" +msgstr "" -#: docs/10.x/broadcasting.md:block 76 (paragraph) -msgid "You may wonder why we would install the `pusher-js` JavaScript library even though we are using Ably to broadcast our events. Thankfully, Ably includes a Pusher compatibility mode which lets us use the Pusher protocol when listening for events in our client-side application:" -msgstr "你可能會很困惑,為什麼我們明明是要用 Ably 來廣播事件,卻安裝了 `pusher-js` JavaScript 函式庫。謝天謝地,Ably 有個 Pusher 相容模式,可以讓我們在用戶端程式內監聽事件的時候使用 Pusher 協定:" +# P +#: ./docs/10.x/broadcasting.md:199 +#: ./docs/11.x/broadcasting.md:196 +#: ./docs/master/broadcasting.md:211 +msgid "Next, you should compile your application's assets:" +msgstr "" -#: docs/10.x/broadcasting.md:block 78 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:199 +#: ./docs/9.x/broadcasting.md:219 +#: ./docs/10.x/broadcasting.md:276 +#: ./docs/11.x/broadcasting.md:294 +#: ./docs/master/broadcasting.md:348 msgid "**Before continuing, you should enable Pusher protocol support in your Ably application settings. You may enable this feature within the \"Protocol Adapter Settings\" portion of your Ably application's settings dashboard.**" -msgstr "**在繼續之前,應先在 Ably 應用程式設定中啟用 Pusher 通訊協定。可以在 Ably 應用程式設定面板中的「Protocol Adapter Settings」這個部分內啟用此功能。**" +msgstr "" + +# CODE: shell +#: ./docs/10.x/broadcasting.md:201 +#: ./docs/10.x/broadcasting.md:235 +#: ./docs/11.x/broadcasting.md:198 +#: ./docs/11.x/broadcasting.md:253 +#: ./docs/master/broadcasting.md:213 +#: ./docs/master/broadcasting.md:252 +#: ./docs/master/broadcasting.md:307 +msgid "npm run build" +msgstr "" -#: docs/10.x/broadcasting.md:block 79 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:201 +#: ./docs/9.x/broadcasting.md:221 +#: ./docs/10.x/broadcasting.md:278 msgid "Once Echo is installed, you are ready to create a fresh Echo instance in your application's JavaScript. A great place to do this is at the bottom of the `resources/js/bootstrap.js` file that is included with the Laravel framework. By default, an example Echo configuration is already included in this file; however, the default configuration in the `bootstrap.js` file is intended for Pusher. You may copy the configuration below to transition your configuration to Ably:" -msgstr "安裝好 Echo 後,就可以在網站的 JavaScript 中建立一個新的 Echo 實體。要建立新 Echo 實體最好的地方就是在 Laravel 附帶的 `resources/js/bootstrap.js` 檔案最尾端。預設情況下,這個檔案內已經包含了一個範例的 Echo 設定。不過,`bootstrap.js` 檔案中預設的範例是給 Pusher 用的。可以複製下列設定來將你的設定檔改成使用 Ably:" +msgstr "" -#: docs/10.x/broadcasting.md:block 80 (code) -msgid "import Echo from 'laravel-echo';\n" -"import Pusher from 'pusher-js';\n\n" -"window.Pusher = Pusher;\n\n" -"window.Echo = new Echo({\n" -" broadcaster: 'pusher',\n" -" key: import.meta.env.VITE_ABLY_PUBLIC_KEY,\n" -" wsHost: 'realtime-pusher.ably.io',\n" -" wsPort: 443,\n" -" disableStats: true,\n" -" encrypted: true,\n" -"});\n" -msgstr "import Echo from 'laravel-echo';\n" -"import Pusher from 'pusher-js';\n\n" -"window.Pusher = Pusher;\n\n" +# CODE: js +#: ./docs/8.x/broadcasting.md:203 +msgid "import Echo from 'laravel-echo';\n\n" +"window.Pusher = require('pusher-js');\n\n" "window.Echo = new Echo({\n" " broadcaster: 'pusher',\n" -" key: import.meta.env.VITE_ABLY_PUBLIC_KEY,\n" +" key: process.env.MIX_ABLY_PUBLIC_KEY,\n" " wsHost: 'realtime-pusher.ably.io',\n" " wsPort: 443,\n" " disableStats: true,\n" " encrypted: true,\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/broadcasting.md:block 81 (paragraph) -msgid "Note that our Ably Echo configuration references a `VITE_ABLY_PUBLIC_KEY` environment variable. This variable's value should be your Ably public key. Your public key is the portion of your Ably key that occurs before the `:` character." -msgstr "請注意,Ably Echo 設定中參考了 `VITE_ABLY_PUBLIC_KEY` 環境變數。這個環境變數應為 Ably 的公開金鑰。公開金鑰就是 Ably 金鑰中出現在 `:` 字元之前的部分。" +# P +#: ./docs/10.x/broadcasting.md:206 +#: ./docs/11.x/broadcasting.md:203 +#: ./docs/master/broadcasting.md:218 +msgid "The Laravel Echo `reverb` broadcaster requires laravel-echo v1.16.0+." +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:208 +#: ./docs/11.x/broadcasting.md:286 +#: ./docs/master/broadcasting.md:223 +#: ./docs/master/broadcasting.md:262 +#: ./docs/master/broadcasting.md:340 +msgid "[Laravel Echo](https://github.com/laravel/echo) is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by your server-side broadcasting driver. Echo also leverages the `pusher-js` NPM package to implement the Pusher protocol for WebSocket subscriptions, channels, and messages." +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:210 +#: ./docs/11.x/broadcasting.md:288 +#: ./docs/master/broadcasting.md:225 +#: ./docs/master/broadcasting.md:264 +#: ./docs/master/broadcasting.md:342 +msgid "The `install:broadcasting` Artisan command automatically installs the `laravel-echo` and `pusher-js` packages for you; however, you may also install these packages manually via NPM:" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:216 +#: ./docs/master/broadcasting.md:270 +msgid "Once Echo is installed, you are ready to create a fresh Echo instance in your application's JavaScript. The `install:broadcasting` command creates an Echo configuration file at `resources/js/echo.js`; however, the default configuration in this file is intended for Laravel Reverb. You may copy the configuration below to transition your configuration to Pusher:" +msgstr "" + +# CODE: js +#: ./docs/11.x/broadcasting.md:218 +#: ./docs/master/broadcasting.md:272 +msgid "import Echo from 'laravel-echo';\n\n" +"import Pusher from 'pusher-js';\n" +"window.Pusher = Pusher;\n\n" +"window.Echo = new Echo({\n" +" broadcaster: 'pusher',\n" +" key: import.meta.env.VITE_PUSHER_APP_KEY,\n" +" cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER,\n" +" forceTLS: true\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:218 +msgid "Note that our Ably Echo configuration references a `MIX_ABLY_PUBLIC_KEY` environment variable. This variable's value should be your Ably public key. Your public key is the portion of your Ably key that occurs before the `:` character." +msgstr "" + +# CODE: js +#: ./docs/9.x/broadcasting.md:223 +#: ./docs/10.x/broadcasting.md:280 +msgid "import Echo from 'laravel-echo';\n" +"import Pusher from 'pusher-js';\n\n" +"window.Pusher = Pusher;\n\n" +"window.Echo = new Echo({\n" +" broadcaster: 'pusher',\n" +" key: import.meta.env.VITE_ABLY_PUBLIC_KEY,\n" +" wsHost: 'realtime-pusher.ably.io',\n" +" wsPort: 443,\n" +" disableStats: true,\n" +" encrypted: true,\n" +"});" +msgstr "" -#: docs/10.x/broadcasting.md:block 86 (header) +# P +#: ./docs/8.x/broadcasting.md:226 +#: ./docs/9.x/broadcasting.md:250 +#: ./docs/10.x/broadcasting.md:307 +#: ./docs/11.x/broadcasting.md:325 +#: ./docs/master/broadcasting.md:379 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/broadcasting.md:227 +#: ./docs/9.x/broadcasting.md:251 +#: ./docs/10.x/broadcasting.md:308 +#: ./docs/11.x/broadcasting.md:326 +#: ./docs/master/broadcasting.md:380 msgid "Concept Overview" -msgstr "概念概覽" +msgstr "" -#: docs/10.x/broadcasting.md:block 87 (paragraph) -msgid "Laravel's event broadcasting allows you to broadcast your server-side Laravel events to your client-side JavaScript application using a driver-based approach to WebSockets. Currently, Laravel ships with [Pusher Channels](https://pusher.com/channels) and [Ably](https://ably.com) drivers. The events may be easily consumed on the client-side using the [Laravel Echo](#client-side-installation) JavaScript package." -msgstr "Laravel 的事件廣播功能能讓你以基於 Driver 的方法來將伺服器端的 Laravel 事件通過 WebSockets 廣播到用戶端 JavaScript 上。目前,Laravel 隨附了 [Pusher Channels](https://pusher.com/channels) 與 [Ably](https://ably.com) 兩個 Driver。可以在用戶端使用 [Laravel Echo](#client-side-installation) JavaScript 套件來輕鬆取得事件。" +# P +#: ./docs/8.x/broadcasting.md:229 +msgid "Laravel's event broadcasting allows you to broadcast your server-side Laravel events to your client-side JavaScript application using a driver-based approach to WebSockets. Currently, Laravel ships with [Pusher Channels](https://pusher.com/channels) and [Ably](https://ably.io) drivers. The events may be easily consumed on the client-side using the [Laravel Echo](#client-side-installation) JavaScript package." +msgstr "" -#: docs/10.x/broadcasting.md:block 88 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:231 +#: ./docs/9.x/broadcasting.md:255 +#: ./docs/10.x/broadcasting.md:312 +#: ./docs/11.x/broadcasting.md:330 +#: ./docs/master/broadcasting.md:384 msgid "Events are broadcast over \"channels\", which may be specified as public or private. Any visitor to your application may subscribe to a public channel without any authentication or authorization; however, in order to subscribe to a private channel, a user must be authenticated and authorized to listen on that channel." -msgstr "事件是通過「頻道 (Channel)」進行廣播的,頻道可以被設為公共或私有。任何網站的瀏覽者都可以在不登入或經過授權的情況下訂閱公開頻道。不過,如果要訂閱私有頻道,就必須要登入並經過授權才可以監聽該頻道。" +msgstr "" + +# P +#: ./docs/master/broadcasting.md:231 +msgid "Once `laravel-echo` and `pusher-js` are installed, you are ready to create a fresh Echo instance in your application's JavaScript. The `install:broadcasting` Artisan command creates a `resources/js/echo.js` file that handles this for you:" +msgstr "" -#: docs/10.x/broadcasting.md:block 89 (quote) -msgid "**Note** If you would like to explore open source alternatives to Pusher, check out the [open source alternatives](#open-source-alternatives)." -msgstr "**Note** 若想瞭解更多 Pusher 的開放原始碼替代品,請參考[開放原始碼替代](#open-source-alternatives)一節。" +# P +#: ./docs/11.x/broadcasting.md:232 +#: ./docs/master/broadcasting.md:286 +msgid "Next, you should define the appropriate values for the Pusher environment variables in your application's `.env` file. If these variables do not already exist in your `.env` file, you should add them:" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:233 +#: ./docs/9.x/broadcasting.md:258 +#: ./docs/10.x/broadcasting.md:315 +msgid "If you would like to explore open source alternatives to Pusher, check out the [open source alternatives](#open-source-alternatives)." +msgstr "" + +# CODE: ini +#: ./docs/11.x/broadcasting.md:234 +#: ./docs/master/broadcasting.md:288 +msgid "PUSHER_APP_ID=\"your-pusher-app-id\"\n" +"PUSHER_APP_KEY=\"your-pusher-key\"\n" +"PUSHER_APP_SECRET=\"your-pusher-secret\"\n" +"PUSHER_HOST=\n" +"PUSHER_PORT=443\n" +"PUSHER_SCHEME=\"https\"\n" +"PUSHER_APP_CLUSTER=\"mt1\"\n\n" +"VITE_APP_NAME=\"${APP_NAME}\"\n" +"VITE_PUSHER_APP_KEY=\"${PUSHER_APP_KEY}\"\n" +"VITE_PUSHER_HOST=\"${PUSHER_HOST}\"\n" +"VITE_PUSHER_PORT=\"${PUSHER_PORT}\"\n" +"VITE_PUSHER_SCHEME=\"${PUSHER_SCHEME}\"\n" +"VITE_PUSHER_APP_CLUSTER=\"${PUSHER_APP_CLUSTER}\"" +msgstr "" -#: docs/10.x/broadcasting.md:block 91 (header) +# P +#: ./docs/8.x/broadcasting.md:235 +#: ./docs/9.x/broadcasting.md:260 +#: ./docs/10.x/broadcasting.md:317 +#: ./docs/11.x/broadcasting.md:332 +#: ./docs/master/broadcasting.md:386 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:236 +#: ./docs/9.x/broadcasting.md:261 msgid "Using An Example Application" -msgstr "使用範例專案" +msgstr "" -#: docs/10.x/broadcasting.md:block 92 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:238 +#: ./docs/9.x/broadcasting.md:263 +#: ./docs/10.x/broadcasting.md:320 +#: ./docs/11.x/broadcasting.md:335 +#: ./docs/master/broadcasting.md:389 msgid "Before diving into each component of event broadcasting, let's take a high level overview using an e-commerce store as an example." -msgstr "在深入探討事件廣播的各個元件之前,我們先來用網路商店當作例子,以高階的角度來個概覽。" +msgstr "" + +# P +#: ./docs/9.x/broadcasting.md:239 +#: ./docs/10.x/broadcasting.md:296 +msgid "Note that our Ably Echo configuration references a `VITE_ABLY_PUBLIC_KEY` environment variable. This variable's value should be your Ably public key. Your public key is the portion of your Ably key that occurs before the `:` character." +msgstr "" -#: docs/10.x/broadcasting.md:block 93 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:240 +#: ./docs/9.x/broadcasting.md:265 msgid "In our application, let's assume we have a page that allows users to view the shipping status for their orders. Let's also assume that a `OrderShipmentStatusUpdated` event is fired when a shipping status update is processed by the application:" -msgstr "在我們的專案中,先來假設有個能讓使用者檢視訂單配送狀態的頁面。另外,也假設當網站處理到配送狀態更新的時候會觸發 `OrderShipmentStatusUpdated` 事件:" +msgstr "" -#: docs/10.x/broadcasting.md:block 94 (code) +# CODE +#: ./docs/8.x/broadcasting.md:242 +#: ./docs/8.x/broadcasting.md:633 +#: ./docs/9.x/broadcasting.md:267 +#: ./docs/9.x/broadcasting.md:669 +#: ./docs/10.x/broadcasting.md:324 +#: ./docs/10.x/broadcasting.md:731 +#: ./docs/11.x/broadcasting.md:339 +#: ./docs/11.x/broadcasting.md:694 +#: ./docs/master/broadcasting.md:393 +#: ./docs/master/broadcasting.md:751 msgid "use App\\Events\\OrderShipmentStatusUpdated;\n\n" -"OrderShipmentStatusUpdated::dispatch($order);\n" -msgstr "use App\\Events\\OrderShipmentStatusUpdated;\n\n" -"OrderShipmentStatusUpdated::dispatch($order);\n" +"OrderShipmentStatusUpdated::dispatch($order);" +msgstr "" -#: docs/10.x/broadcasting.md:block 96 (header) +# H4 +#: ./docs/10.x/broadcasting.md:243 +#: ./docs/11.x/broadcasting.md:261 +#: ./docs/master/broadcasting.md:315 +msgid "Using an Existing Client Instance" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:246 +#: ./docs/9.x/broadcasting.md:271 +#: ./docs/10.x/broadcasting.md:328 +#: ./docs/11.x/broadcasting.md:343 +#: ./docs/master/broadcasting.md:397 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:247 +#: ./docs/9.x/broadcasting.md:272 +#: ./docs/10.x/broadcasting.md:329 +#: ./docs/11.x/broadcasting.md:344 +#: ./docs/master/broadcasting.md:398 msgid "The `ShouldBroadcast` Interface" -msgstr "`ShouldBroadcast` 介面" +msgstr "" -#: docs/10.x/broadcasting.md:block 97 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:249 +#: ./docs/9.x/broadcasting.md:274 +#: ./docs/10.x/broadcasting.md:331 +#: ./docs/11.x/broadcasting.md:346 +#: ./docs/master/broadcasting.md:400 msgid "When a user is viewing one of their orders, we don't want them to have to refresh the page to view status updates. Instead, we want to broadcast the updates to the application as they are created. So, we need to mark the `OrderShipmentStatusUpdated` event with the `ShouldBroadcast` interface. This will instruct Laravel to broadcast the event when it is fired:" -msgstr "我們並不希望使用者在檢視某個訂單的時候還需要重新整理整個頁面才能看到狀態更新;我們希望在訂單更新建立的時候就能廣播給專案。因此,我們需要將 `OrderShipmentStatusUpdated` 事件標上 `ShouldBroadcast` 介面。通過加上該介面,就能告訴 Laravel 要在該事件被觸發時將其廣播出去:" +msgstr "" -#: docs/10.x/broadcasting.md:block 98 (code) +# P +#: ./docs/master/broadcasting.md:250 +msgid "Next, you only need to compile your application's assets:" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:251 +#: ./docs/master/broadcasting.md:305 +msgid "Once you have adjusted the Echo configuration according to your application's needs, you may compile your application's assets:" +msgstr "" + +# CODE +#: ./docs/8.x/broadcasting.md:251 +#: ./docs/9.x/broadcasting.md:276 msgid "order->id);\n" -"}\n" -msgstr "use Illuminate\\Broadcasting\\Channel;\n" -"use Illuminate\\Broadcasting\\PrivateChannel;\n\n" -"/**\n" -" * Get the channel the event should broadcast on.\n" -" */\n" -"public function broadcastOn(): Channel\n" -"{\n" -" return new PrivateChannel('orders.'.$this->order->id);\n" -"}\n" +# P +#: ./docs/9.x/broadcasting.md:253 +#: ./docs/10.x/broadcasting.md:310 +#: ./docs/11.x/broadcasting.md:328 +#: ./docs/master/broadcasting.md:382 +msgid "Laravel's event broadcasting allows you to broadcast your server-side Laravel events to your client-side JavaScript application using a driver-based approach to WebSockets. Currently, Laravel ships with [Pusher Channels](https://pusher.com/channels) and [Ably](https://ably.com) drivers. The events may be easily consumed on the client-side using the [Laravel Echo](#client-side-installation) JavaScript package." +msgstr "" -#: docs/10.x/broadcasting.md:block 101 (paragraph) -msgid "If you wish the event to broadcast on multiple channels, you may return an `array` instead:" -msgstr "若想要讓 Event 被 Broadcast 到多個 Channel,可以回傳一組 `array`:" +# P +#: ./docs/8.x/broadcasting.md:273 +#: ./docs/9.x/broadcasting.md:298 +#: ./docs/10.x/broadcasting.md:354 +#: ./docs/11.x/broadcasting.md:369 +#: ./docs/master/broadcasting.md:423 +msgid "The `ShouldBroadcast` interface requires our event to define a `broadcastOn` method. This method is responsible for returning the channels that the event should broadcast on. An empty stub of this method is already defined on generated event classes, so we only need to fill in its details. We only want the creator of the order to be able to view status updates, so we will broadcast the event on a private channel that is tied to the order:" +msgstr "" -#: docs/10.x/broadcasting.md:block 102 (code) -msgid "use Illuminate\\Broadcasting\\PrivateChannel;\n\n" -"/**\n" -" * Get the channels the event should broadcast on.\n" -" *\n" -" * @return array\n" -" */\n" -"public function broadcastOn(): array\n" -"{\n" -" return [\n" -" new PrivateChannel('orders.'.$this->order->id),\n" -" // ...\n" -" ];\n" -"}\n" -msgstr "use Illuminate\\Broadcasting\\PrivateChannel;\n\n" -"/**\n" +# CODE +#: ./docs/8.x/broadcasting.md:275 +#: ./docs/9.x/broadcasting.md:300 +msgid "/**\n" " * Get the channels the event should broadcast on.\n" " *\n" -" * @return array\n" +" * @return \\Illuminate\\Broadcasting\\PrivateChannel\n" " */\n" -"public function broadcastOn(): array\n" +"public function broadcastOn()\n" "{\n" -" return [\n" -" new PrivateChannel('orders.'.$this->order->id),\n" -" // ...\n" -" ];\n" -"}\n" +" return new PrivateChannel('orders.'.$this->order->id);\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 104 (header) +# P +#: ./docs/8.x/broadcasting.md:285 +#: ./docs/9.x/broadcasting.md:310 +#: ./docs/10.x/broadcasting.md:384 +#: ./docs/11.x/broadcasting.md:399 +#: ./docs/master/broadcasting.md:453 +#~ msgid "" +#~ msgstr "" + +# H4 +# H2 +#: ./docs/8.x/broadcasting.md:286 +#: ./docs/8.x/broadcasting.md:493 +#: ./docs/9.x/broadcasting.md:311 +#: ./docs/9.x/broadcasting.md:521 +#: ./docs/10.x/broadcasting.md:385 +#: ./docs/10.x/broadcasting.md:580 +#: ./docs/11.x/broadcasting.md:400 +#: ./docs/11.x/broadcasting.md:595 +#: ./docs/master/broadcasting.md:454 +#: ./docs/master/broadcasting.md:649 msgid "Authorizing Channels" -msgstr "授權頻道" +msgstr "" -#: docs/10.x/broadcasting.md:block 105 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:288 +#: ./docs/9.x/broadcasting.md:313 +#: ./docs/10.x/broadcasting.md:387 +#: ./docs/11.x/broadcasting.md:402 +#: ./docs/master/broadcasting.md:456 msgid "Remember, users must be authorized to listen on private channels. We may define our channel authorization rules in our application's `routes/channels.php` file. In this example, we need to verify that any user attempting to listen on the private `orders.1` channel is actually the creator of the order:" -msgstr "請記得,使用者必須要經過授權才能監聽私有頻道。我們可以在 `routes/channels.php` 檔中定義頻道權限規則。在此例子中,我們需要認證嘗試監聽私有頻道 `orders.1` 的使用者是否為該訂單實際的建立人:" +msgstr "" -#: docs/10.x/broadcasting.md:block 106 (code) -msgid "use App\\Models\\Order;\n" -"use App\\Models\\User;\n\n" -"Broadcast::channel('orders.{orderId}', function (User $user, int $orderId) {\n" -" return $user->id === Order::findOrNew($orderId)->user_id;\n" -"});\n" -msgstr "use App\\Models\\Order;\n" -"use App\\Models\\User;\n\n" -"Broadcast::channel('orders.{orderId}', function (User $user, int $orderId) {\n" +# CODE +#: ./docs/8.x/broadcasting.md:290 +#: ./docs/9.x/broadcasting.md:315 +msgid "use App\\Models\\Order;\n\n" +"Broadcast::channel('orders.{orderId}', function ($user, $orderId) {\n" " return $user->id === Order::findOrNew($orderId)->user_id;\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:296 +#: ./docs/master/broadcasting.md:350 +msgid "Once Echo is installed, you are ready to create a fresh Echo instance in your application's JavaScript. The `install:broadcasting` command creates an Echo configuration file at `resources/js/echo.js`; however, the default configuration in this file is intended for Laravel Reverb. You may copy the configuration below to transition your configuration to Ably:" +msgstr "" -#: docs/10.x/broadcasting.md:block 107 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:296 +#: ./docs/8.x/broadcasting.md:553 +#: ./docs/9.x/broadcasting.md:321 +#: ./docs/9.x/broadcasting.md:585 +#: ./docs/10.x/broadcasting.md:396 +#: ./docs/10.x/broadcasting.md:646 +#: ./docs/11.x/broadcasting.md:411 +#: ./docs/11.x/broadcasting.md:612 +#: ./docs/master/broadcasting.md:465 +#: ./docs/master/broadcasting.md:666 msgid "The `channel` method accepts two arguments: the name of the channel and a callback which returns `true` or `false` indicating whether the user is authorized to listen on the channel." -msgstr "`channel` 方法接收 2 個引數:頻道的名稱,以及會回傳 `true` 與 `false` 的回呼。這個回呼用來判斷使用者是否已授權監聽此頻道。" +msgstr "" + +# CODE: js +#: ./docs/11.x/broadcasting.md:298 +#: ./docs/master/broadcasting.md:352 +msgid "import Echo from 'laravel-echo';\n\n" +"import Pusher from 'pusher-js';\n" +"window.Pusher = Pusher;\n\n" +"window.Echo = new Echo({\n" +" broadcaster: 'pusher',\n" +" key: import.meta.env.VITE_ABLY_PUBLIC_KEY,\n" +" wsHost: 'realtime-pusher.ably.io',\n" +" wsPort: 443,\n" +" disableStats: true,\n" +" encrypted: true,\n" +"});" +msgstr "" -#: docs/10.x/broadcasting.md:block 108 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:298 +#: ./docs/8.x/broadcasting.md:555 +#: ./docs/9.x/broadcasting.md:323 +#: ./docs/9.x/broadcasting.md:587 +#: ./docs/10.x/broadcasting.md:398 +#: ./docs/10.x/broadcasting.md:648 +#: ./docs/11.x/broadcasting.md:413 +#: ./docs/11.x/broadcasting.md:614 +#: ./docs/master/broadcasting.md:467 +#: ./docs/master/broadcasting.md:668 msgid "All authorization callbacks receive the currently authenticated user as their first argument and any additional wildcard parameters as their subsequent arguments. In this example, we are using the `{orderId}` placeholder to indicate that the \"ID\" portion of the channel name is a wildcard." -msgstr "所有的授權回呼都會收到目前登入使用者作為其第一個引數,而接下來的引數則是其他額外的萬用字元參數。在這個例子中,我們使用了 `{orderId}` 預留位置來標示頻道名稱中的「ID」部分是萬用字元。" +msgstr "" -#: docs/10.x/broadcasting.md:block 110 (header) +# P +#: ./docs/8.x/broadcasting.md:300 +#: ./docs/9.x/broadcasting.md:325 +#: ./docs/10.x/broadcasting.md:400 +#: ./docs/11.x/broadcasting.md:415 +#: ./docs/master/broadcasting.md:469 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:301 +#: ./docs/9.x/broadcasting.md:326 msgid "Listening For Event Broadcasts" -msgstr "監聽事件廣播" +msgstr "" -#: docs/10.x/broadcasting.md:block 111 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:303 +#: ./docs/9.x/broadcasting.md:328 +#: ./docs/10.x/broadcasting.md:403 +#: ./docs/11.x/broadcasting.md:418 +#: ./docs/master/broadcasting.md:472 msgid "Next, all that remains is to listen for the event in our JavaScript application. We can do this using [Laravel Echo](#client-side-installation). First, we'll use the `private` method to subscribe to the private channel. Then, we may use the `listen` method to listen for the `OrderShipmentStatusUpdated` event. By default, all of the event's public properties will be included on the broadcast event:" -msgstr "接著,剩下的工作就是在 JavaScript 程式碼內監聽事件了。我們可以使用 [Laravel Echo](#client-side-installation)。首先,我們要先用 `private` 方法來監聽私有頻道。接著,可以監聽「`listen`」`OrderShipmentStatusUpdated` 事件。預設情況下,該事件的所有公共屬性都會被包含在廣播事件內:" +msgstr "" -#: docs/10.x/broadcasting.md:block 112 (code) +# CODE: js +#: ./docs/8.x/broadcasting.md:305 +#: ./docs/9.x/broadcasting.md:330 +#: ./docs/10.x/broadcasting.md:405 +#: ./docs/11.x/broadcasting.md:420 +#: ./docs/master/broadcasting.md:474 msgid "Echo.private(`orders.${orderId}`)\n" " .listen('OrderShipmentStatusUpdated', (e) => {\n" " console.log(e.order);\n" -" });\n" -msgstr "Echo.private(`orders.${orderId}`)\n" -" .listen('OrderShipmentStatusUpdated', (e) => {\n" -" console.log(e.order);\n" -" });\n" +" });" +msgstr "" -#: docs/10.x/broadcasting.md:block 114 (header) +# P +#: ./docs/8.x/broadcasting.md:312 +#: ./docs/9.x/broadcasting.md:337 +#: ./docs/10.x/broadcasting.md:412 +#: ./docs/11.x/broadcasting.md:427 +#: ./docs/master/broadcasting.md:481 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/broadcasting.md:313 +#: ./docs/9.x/broadcasting.md:338 +#: ./docs/10.x/broadcasting.md:413 +#: ./docs/11.x/broadcasting.md:428 +#: ./docs/master/broadcasting.md:482 msgid "Defining Broadcast Events" -msgstr "定義廣播事件" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:314 +#: ./docs/master/broadcasting.md:368 +msgid "You may have noticed our Ably Echo configuration references a `VITE_ABLY_PUBLIC_KEY` environment variable. This variable's value should be your Ably public key. Your public key is the portion of your Ably key that occurs before the `:` character." +msgstr "" -#: docs/10.x/broadcasting.md:block 115 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:315 +#: ./docs/9.x/broadcasting.md:340 +#: ./docs/10.x/broadcasting.md:415 +#: ./docs/11.x/broadcasting.md:430 +#: ./docs/master/broadcasting.md:484 msgid "To inform Laravel that a given event should be broadcast, you must implement the `Illuminate\\Contracts\\Broadcasting\\ShouldBroadcast` interface on the event class. This interface is already imported into all event classes generated by the framework so you may easily add it to any of your events." -msgstr "為了告訴 Laravel 應廣播某個給定的事件,我們必須要在事件類別上實作 `Illuminate\\Contracts\\Broadcasting\\ShouldBroadcast` 介面。在所有產生出來的事件類別上,框架已經幫你引入這個介面了,因此你可以輕鬆地將該介面加至任何事件上。" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:316 +#: ./docs/master/broadcasting.md:370 +msgid "Once you have adjusted the Echo configuration according to your needs, you may compile your application's assets:" +msgstr "" -#: docs/10.x/broadcasting.md:block 116 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:317 +#: ./docs/9.x/broadcasting.md:342 +#: ./docs/10.x/broadcasting.md:417 +#: ./docs/11.x/broadcasting.md:432 +#: ./docs/master/broadcasting.md:486 msgid "The `ShouldBroadcast` interface requires you to implement a single method: `broadcastOn`. The `broadcastOn` method should return a channel or array of channels that the event should broadcast on. The channels should be instances of `Channel`, `PrivateChannel`, or `PresenceChannel`. Instances of `Channel` represent public channels that any user may subscribe to, while `PrivateChannels` and `PresenceChannels` represent private channels that require [channel authorization](#authorizing-channels):" -msgstr "`ShouldBroadcast` 介面只要求實作單一方法:`broadcastOn`。`broadcastOn` 方法應回傳一個頻道,或是一個包含頻道的陣列。這些頻道是事件要進行廣播的頻道。頻道應為 `Channel`, `PrivateChannel` 或 `PresenceChannel` 的實體。`Channel` 的實體代表任何使用者都能監聽的公共頻道,而 `PrivateChannel` 與 `PresenceChannels` 代表需要進行[頻道授權](#authorizing-channels)的私有頻道:" +msgstr "" + +# H3 +#: ./docs/10.x/broadcasting.md:318 +#: ./docs/11.x/broadcasting.md:333 +#: ./docs/master/broadcasting.md:387 +msgid "Using an Example Application" +msgstr "" -#: docs/10.x/broadcasting.md:block 117 (code) +# CODE +#: ./docs/8.x/broadcasting.md:319 +#: ./docs/9.x/broadcasting.md:344 msgid "user = $user;\n" +" }\n\n" " /**\n" " * Get the channels the event should broadcast on.\n" " *\n" -" * @return array\n" +" * @return Channel|array\n" " */\n" -" public function broadcastOn(): array\n" +" public function broadcastOn()\n" " {\n" -" return [\n" -" new PrivateChannel('user.'.$this->user->id),\n" -" ];\n" +" return new PrivateChannel('user.'.$this->user->id);\n" " }\n" -"}\n" -msgstr "\n" +" * @var \\App\\Models\\Order\n" " */\n" -" public function broadcastOn(): array\n" -" {\n" -" return [\n" -" new PrivateChannel('user.'.$this->user->id),\n" -" ];\n" -" }\n" -"}\n" +" public $order;\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:356 +#: ./docs/11.x/broadcasting.md:371 +#: ./docs/master/broadcasting.md:425 +msgid "use Illuminate\\Broadcasting\\Channel;\n" +"use Illuminate\\Broadcasting\\PrivateChannel;\n\n" +"/**\n" +" * Get the channel the event should broadcast on.\n" +" */\n" +"public function broadcastOn(): Channel\n" +"{\n" +" return new PrivateChannel('orders.'.$this->order->id);\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 118 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:364 +#: ./docs/9.x/broadcasting.md:389 +#: ./docs/10.x/broadcasting.md:455 +#: ./docs/11.x/broadcasting.md:470 +#: ./docs/master/broadcasting.md:524 msgid "After implementing the `ShouldBroadcast` interface, you only need to [fire the event](/docs/{{version}}/events) as you normally would. Once the event has been fired, a [queued job](/docs/{{version}}/queues) will automatically broadcast the event using your specified broadcast driver." -msgstr "實作完 `ShouldBroadcast` 介面後,只需要像平常一樣[觸發事件](/docs/{{version}}/events)即可。事件被觸發後,[佇列任務](/docs/{{version}}/queues)會自動通過指定的 Broadcast Driver 來廣播事件。" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:366 +#: ./docs/9.x/broadcasting.md:391 +#: ./docs/10.x/broadcasting.md:457 +#: ./docs/11.x/broadcasting.md:472 +#: ./docs/master/broadcasting.md:526 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:367 +#: ./docs/11.x/broadcasting.md:382 +#: ./docs/master/broadcasting.md:436 +msgid "If you wish the event to broadcast on multiple channels, you may return an `array` instead:" +msgstr "" -#: docs/10.x/broadcasting.md:block 120 (header) +# H3 +#: ./docs/8.x/broadcasting.md:367 +#: ./docs/9.x/broadcasting.md:392 +#: ./docs/10.x/broadcasting.md:458 +#: ./docs/11.x/broadcasting.md:473 +#: ./docs/master/broadcasting.md:527 msgid "Broadcast Name" -msgstr "Broadcast 名稱" +msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:369 +#: ./docs/11.x/broadcasting.md:384 +#: ./docs/master/broadcasting.md:438 +msgid "use Illuminate\\Broadcasting\\PrivateChannel;\n\n" +"/**\n" +" * Get the channels the event should broadcast on.\n" +" *\n" +" * @return array\n" +" */\n" +"public function broadcastOn(): array\n" +"{\n" +" return [\n" +" new PrivateChannel('orders.'.$this->order->id),\n" +" // ...\n" +" ];\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 121 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:369 +#: ./docs/9.x/broadcasting.md:394 +#: ./docs/10.x/broadcasting.md:460 +#: ./docs/11.x/broadcasting.md:475 +#: ./docs/master/broadcasting.md:529 msgid "By default, Laravel will broadcast the event using the event's class name. However, you may customize the broadcast name by defining a `broadcastAs` method on the event:" -msgstr "預設情況下,Laravel 會使用事件的類別名來進行廣播。不過,也可以在事件上定義 `broadcastAs` 方法來自訂 Broadcast 名稱:" +msgstr "" -#: docs/10.x/broadcasting.md:block 122 (code) +# CODE +#: ./docs/8.x/broadcasting.md:371 +#: ./docs/9.x/broadcasting.md:396 msgid "/**\n" " * The event's broadcast name.\n" +" *\n" +" * @return string\n" " */\n" -"public function broadcastAs(): string\n" -"{\n" -" return 'server.created';\n" -"}\n" -msgstr "/**\n" -" * The event's broadcast name.\n" -" */\n" -"public function broadcastAs(): string\n" +"public function broadcastAs()\n" "{\n" " return 'server.created';\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 123 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:381 +#: ./docs/9.x/broadcasting.md:406 +#: ./docs/10.x/broadcasting.md:470 +#: ./docs/11.x/broadcasting.md:485 +#: ./docs/master/broadcasting.md:539 msgid "If you customize the broadcast name using the `broadcastAs` method, you should make sure to register your listener with a leading `.` character. This will instruct Echo to not prepend the application's namespace to the event:" -msgstr "若使用 `broadcastAs` 方法來自訂 Broadcast 名稱,則應確保註冊監聽程式時有加上前置 `.` 字元。加上該前置字元可用來告訴 Echo 不要在事件前方加上專案的命名空間:" +msgstr "" -#: docs/10.x/broadcasting.md:block 124 (code) +# CODE +#: ./docs/8.x/broadcasting.md:383 +#: ./docs/9.x/broadcasting.md:408 +#: ./docs/10.x/broadcasting.md:472 +#: ./docs/11.x/broadcasting.md:487 +#: ./docs/master/broadcasting.md:541 msgid ".listen('.server.created', function (e) {\n" " ....\n" -"});\n" -msgstr ".listen('.server.created', function (e) {\n" -" ....\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/broadcasting.md:block 126 (header) +# P +#: ./docs/8.x/broadcasting.md:387 +#: ./docs/9.x/broadcasting.md:412 +#: ./docs/10.x/broadcasting.md:476 +#: ./docs/11.x/broadcasting.md:491 +#: ./docs/master/broadcasting.md:545 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:388 +#: ./docs/9.x/broadcasting.md:413 +#: ./docs/10.x/broadcasting.md:477 +#: ./docs/11.x/broadcasting.md:492 +#: ./docs/master/broadcasting.md:546 msgid "Broadcast Data" -msgstr "Broadcast 資料" +msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:389 +#: ./docs/11.x/broadcasting.md:404 +#: ./docs/master/broadcasting.md:458 +msgid "use App\\Models\\Order;\n" +"use App\\Models\\User;\n\n" +"Broadcast::channel('orders.{orderId}', function (User $user, int $orderId) {\n" +" return $user->id === Order::findOrNew($orderId)->user_id;\n" +"});" +msgstr "" -#: docs/10.x/broadcasting.md:block 127 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:390 +#: ./docs/9.x/broadcasting.md:415 +#: ./docs/10.x/broadcasting.md:479 +#: ./docs/11.x/broadcasting.md:494 +#: ./docs/master/broadcasting.md:548 msgid "When an event is broadcast, all of its `public` properties are automatically serialized and broadcast as the event's payload, allowing you to access any of its public data from your JavaScript application. So, for example, if your event has a single public `$user` property that contains an Eloquent model, the event's broadcast payload would be:" -msgstr "廣播事件時,事件所有的 `public` 屬性都會被自動序列化,並作為事件的 Payload 進行廣播,讓你能在 JavaScript 程式碼中存取事件的所有公共資料。因此,舉例來說,假設我們的事件有一個 public `$user` 屬性,其中包含了 Eloquent Model,那麼事件的 Broadcast Payload 會是:" +msgstr "" -#: docs/10.x/broadcasting.md:block 128 (code) +# CODE +# CODE: json +#: ./docs/8.x/broadcasting.md:392 +#: ./docs/9.x/broadcasting.md:417 +#: ./docs/10.x/broadcasting.md:481 +#: ./docs/11.x/broadcasting.md:496 +#: ./docs/master/broadcasting.md:550 msgid "{\n" " \"user\": {\n" " \"id\": 1,\n" " \"name\": \"Patrick Stewart\"\n" " ...\n" " }\n" -"}\n" -msgstr "{\n" -" \"user\": {\n" -" \"id\": 1,\n" -" \"name\": \"Patrick Stewart\"\n" -" ...\n" -" }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 129 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:400 +#: ./docs/9.x/broadcasting.md:427 +#: ./docs/10.x/broadcasting.md:491 +#: ./docs/11.x/broadcasting.md:506 +#: ./docs/master/broadcasting.md:560 msgid "However, if you wish to have more fine-grained control over your broadcast payload, you may add a `broadcastWith` method to your event. This method should return the array of data that you wish to broadcast as the event payload:" -msgstr "不過,若想對 Broadcast Payload 進一步地控制,可以在事件內加上一個 `broadcastWith` 方法。這個方法應回傳一個陣列,包含要作為事件 Payload 使用的資料:" +msgstr "" + +# H4 +#: ./docs/10.x/broadcasting.md:401 +#: ./docs/11.x/broadcasting.md:416 +#: ./docs/master/broadcasting.md:470 +msgid "Listening for Event Broadcasts" +msgstr "" -#: docs/10.x/broadcasting.md:block 130 (code) +# CODE +#: ./docs/8.x/broadcasting.md:402 +#: ./docs/9.x/broadcasting.md:429 msgid "/**\n" " * Get the data to broadcast.\n" " *\n" -" * @return array\n" +" * @return array\n" " */\n" -"public function broadcastWith(): array\n" +"public function broadcastWith()\n" "{\n" " return ['id' => $this->user->id];\n" -"}\n" -msgstr "/**\n" -" * Get the data to broadcast.\n" -" *\n" -" * @return array\n" -" */\n" -"public function broadcastWith(): array\n" +"}" +msgstr "" + +# CODE +#: ./docs/master/broadcasting.md:402 +msgid " $this->user->id];\n" -"}\n" +" /**\n" +" * The order instance.\n" +" *\n" +" * @var \\App\\Order\n" +" */\n" +" public $order;\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 132 (header) +# P +#: ./docs/8.x/broadcasting.md:412 +#: ./docs/9.x/broadcasting.md:439 +#: ./docs/10.x/broadcasting.md:503 +#: ./docs/11.x/broadcasting.md:518 +#: ./docs/master/broadcasting.md:572 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:413 +#: ./docs/9.x/broadcasting.md:440 +#: ./docs/10.x/broadcasting.md:504 +#: ./docs/11.x/broadcasting.md:519 +#: ./docs/master/broadcasting.md:573 msgid "Broadcast Queue" -msgstr "Broadcast 佇列" +msgstr "" -#: docs/10.x/broadcasting.md:block 133 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:415 +#: ./docs/9.x/broadcasting.md:442 +#: ./docs/10.x/broadcasting.md:506 +#: ./docs/11.x/broadcasting.md:521 +#: ./docs/master/broadcasting.md:575 msgid "By default, each broadcast event is placed on the default queue for the default queue connection specified in your `queue.php` configuration file. You may customize the queue connection and name used by the broadcaster by defining `connection` and `queue` properties on your event class:" -msgstr "預設情況下,所有的廣播事件都會使用 `queue.php` 設定檔中的預設佇列連連。可以通過在事件類別內定義 `queue` 屬性來自訂 Broadcaster 要使用的佇列連線名稱:" +msgstr "" -#: docs/10.x/broadcasting.md:block 134 (code) +# CODE +#: ./docs/8.x/broadcasting.md:417 +#: ./docs/9.x/broadcasting.md:444 +#: ./docs/10.x/broadcasting.md:508 +#: ./docs/11.x/broadcasting.md:523 +#: ./docs/master/broadcasting.md:577 msgid "/**\n" " * The name of the queue connection to use when broadcasting the event.\n" " *\n" @@ -818,171 +2150,335 @@ msgid "/**\n" " *\n" " * @var string\n" " */\n" -"public $queue = 'default';\n" -msgstr "/**\n" -" * The name of the queue connection to use when broadcasting the event.\n" -" *\n" -" * @var string\n" -" */\n" -"public $connection = 'redis';\n\n" -"/**\n" -" * The name of the queue on which to place the broadcasting job.\n" -" *\n" -" * @var string\n" -" */\n" -"public $queue = 'default';\n" +"public $queue = 'default';" +msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:419 +#: ./docs/11.x/broadcasting.md:434 +#: ./docs/master/broadcasting.md:488 +msgid "\n" +" */\n" +" public function broadcastOn(): array\n" +" {\n" +" return [\n" +" new PrivateChannel('user.'.$this->user->id),\n" +" ];\n" +" }\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 135 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:431 +#: ./docs/9.x/broadcasting.md:458 +#: ./docs/10.x/broadcasting.md:522 +#: ./docs/11.x/broadcasting.md:537 +#: ./docs/master/broadcasting.md:591 msgid "Alternatively, you may customize the queue name by defining a `broadcastQueue` method on your event:" -msgstr "或者,你也可以通過在事件中定義 `broadcastQueue` 方法來自訂佇列名稱:" +msgstr "" -#: docs/10.x/broadcasting.md:block 136 (code) +# CODE +#: ./docs/8.x/broadcasting.md:433 +#: ./docs/9.x/broadcasting.md:460 msgid "/**\n" " * The name of the queue on which to place the broadcasting job.\n" +" *\n" +" * @return string\n" " */\n" -"public function broadcastQueue(): string\n" -"{\n" -" return 'default';\n" -"}\n" -msgstr "/**\n" -" * The name of the queue on which to place the broadcasting job.\n" -" */\n" -"public function broadcastQueue(): string\n" +"public function broadcastQueue()\n" "{\n" " return 'default';\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 137 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:443 +#: ./docs/9.x/broadcasting.md:470 +#: ./docs/10.x/broadcasting.md:532 +#: ./docs/11.x/broadcasting.md:547 +#: ./docs/master/broadcasting.md:601 msgid "If you would like to broadcast your event using the `sync` queue instead of the default queue driver, you can implement the `ShouldBroadcastNow` interface instead of `ShouldBroadcast`:" -msgstr "若像使用 `sync` 佇列來代替預設的佇列 Driver,可以使用 `ShouldBroadcastNow` 來代替 `ShouldBroadcast` 進行實作:" +msgstr "" -#: docs/10.x/broadcasting.md:block 138 (code) +# CODE +#: ./docs/8.x/broadcasting.md:445 +#: ./docs/9.x/broadcasting.md:472 msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:455 +#: ./docs/9.x/broadcasting.md:482 +#: ./docs/10.x/broadcasting.md:544 +#: ./docs/11.x/broadcasting.md:559 +#: ./docs/master/broadcasting.md:613 msgid "Broadcast Conditions" -msgstr "Broadcast 條件" +msgstr "" -#: docs/10.x/broadcasting.md:block 141 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:457 +#: ./docs/9.x/broadcasting.md:484 +#: ./docs/10.x/broadcasting.md:546 +#: ./docs/11.x/broadcasting.md:561 +#: ./docs/master/broadcasting.md:615 msgid "Sometimes you want to broadcast your event only if a given condition is true. You may define these conditions by adding a `broadcastWhen` method to your event class:" -msgstr "有時候我們可能只想在滿足給定條件的時候才廣播事件。可以通過在事件類別上新增 `broadcastWhen` 方法來在其中定義這些條件:" +msgstr "" -#: docs/10.x/broadcasting.md:block 142 (code) +# CODE +#: ./docs/8.x/broadcasting.md:459 +#: ./docs/9.x/broadcasting.md:486 msgid "/**\n" " * Determine if this event should broadcast.\n" +" *\n" +" * @return bool\n" " */\n" -"public function broadcastWhen(): bool\n" +"public function broadcastWhen()\n" "{\n" " return $this->order->value > 100;\n" -"}\n" -msgstr "/**\n" -" * Determine if this event should broadcast.\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:462 +#: ./docs/11.x/broadcasting.md:477 +#: ./docs/master/broadcasting.md:531 +msgid "/**\n" +" * The event's broadcast name.\n" " */\n" -"public function broadcastWhen(): bool\n" +"public function broadcastAs(): string\n" "{\n" -" return $this->order->value > 100;\n" -"}\n" +" return 'server.created';\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 144 (header) +# P +#: ./docs/8.x/broadcasting.md:469 +#: ./docs/9.x/broadcasting.md:496 +#: ./docs/10.x/broadcasting.md:556 +#: ./docs/11.x/broadcasting.md:571 +#: ./docs/master/broadcasting.md:625 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:470 +#: ./docs/9.x/broadcasting.md:497 msgid "Broadcasting & Database Transactions" -msgstr "Broadcast 與資料庫 Transaction" +msgstr "" -#: docs/10.x/broadcasting.md:block 145 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:472 +#: ./docs/9.x/broadcasting.md:499 +#: ./docs/10.x/broadcasting.md:559 +#: ./docs/11.x/broadcasting.md:574 +#: ./docs/master/broadcasting.md:628 msgid "When broadcast events are dispatched within database transactions, they may be processed by the queue before the database transaction has committed. When this happens, any updates you have made to models or database records during the database transaction may not yet be reflected in the database. In addition, any models or database records created within the transaction may not exist in the database. If your event depends on these models, unexpected errors can occur when the job that broadcasts the event is processed." -msgstr "當廣播事件是在資料庫 Transaction 內分派的時候,這個事件可能會在資料庫 Transaction 被 Commit 前被佇列進行處理了。發生這種情況時,在資料庫 Transaction 期間對 Model 或資料庫記錄所做出的更新可能都還未反應到資料庫內。另外,所有在 Transaction 期間新增的 Model 或資料庫記錄也可能還未出現在資料庫內。若事件有依賴這些 Model 的話,在處理廣播事件的任務時可能會出現未預期的錯誤。" +msgstr "" -#: docs/10.x/broadcasting.md:block 146 (paragraph) -msgid "If your queue connection's `after_commit` configuration option is set to `false`, you may still indicate that a particular broadcast event should be dispatched after all open database transactions have been committed by implementing the `ShouldDispatchAfterCommit` interface on the event class:" -msgstr "即使佇列連線的 `after_commit` 設定選項被設為 `false`,還是可以通過在 Event 類別上實作 `ShouldDispatchAfterCommit` 介面來讓 Laravel 知道要在所有開啟的資料庫 Transaction 被 Commit 後廣播該 Event:" +# P +#: ./docs/8.x/broadcasting.md:474 +#: ./docs/9.x/broadcasting.md:501 +msgid "If your queue connection's `after_commit` configuration option is set to `false`, you may still indicate that a particular broadcast event should be dispatched after all open database transactions have been committed by defining an `$afterCommit` property on the event class:" +msgstr "" -#: docs/10.x/broadcasting.md:block 147 (code) +# CODE +#: ./docs/8.x/broadcasting.md:476 +#: ./docs/9.x/broadcasting.md:503 msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:493 +#: ./docs/11.x/broadcasting.md:508 +#: ./docs/master/broadcasting.md:562 +msgid "/**\n" +" * Get the data to broadcast.\n" +" *\n" +" * @return array\n" +" */\n" +"public function broadcastWith(): array\n" +"{\n" +" return ['id' => $this->user->id];\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 151 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:495 +#: ./docs/9.x/broadcasting.md:523 +#: ./docs/10.x/broadcasting.md:582 msgid "Private channels require you to authorize that the currently authenticated user can actually listen on the channel. This is accomplished by making an HTTP request to your Laravel application with the channel name and allowing your application to determine if the user can listen on that channel. When using [Laravel Echo](#client-side-installation), the HTTP request to authorize subscriptions to private channels will be made automatically; however, you do need to define the proper routes to respond to these requests." -msgstr "使用私有頻道,則需要將目前已登入的使用者授權為可監聽該頻道。要授權使用者,需要向 Laravel 端傳送一個包含頻道名稱的 HTTP 請求來讓網站判斷使用者能否監聽該頻道。使用 [Laravel Echo](#client-side-installation) 時,會自動建立用於授權訂閱私有頻道的 HTTP 請求。不過,我們還是需要定義適當的路由來回應這些請求。" +msgstr "" -#: docs/10.x/broadcasting.md:block 153 (header) +# P +#: ./docs/8.x/broadcasting.md:497 +#: ./docs/9.x/broadcasting.md:525 +#: ./docs/10.x/broadcasting.md:584 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:498 +#: ./docs/9.x/broadcasting.md:526 +#: ./docs/10.x/broadcasting.md:585 msgid "Defining Authorization Routes" -msgstr "定義授權路由" +msgstr "" -#: docs/10.x/broadcasting.md:block 154 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:500 +#: ./docs/9.x/broadcasting.md:528 +#: ./docs/10.x/broadcasting.md:587 msgid "Thankfully, Laravel makes it easy to define the routes to respond to channel authorization requests. In the `App\\Providers\\BroadcastServiceProvider` included with your Laravel application, you will see a call to the `Broadcast::routes` method. This method will register the `/broadcasting/auth` route to handle authorization requests:" -msgstr "好佳在,在 Laravel 中定義回應頻道授權請求的路由非常容易。在 Laravel 中隨附的 `App\\Providers\\BroadcastServiceProvider` 內,可以看到一個 `Broadcast::routes` 方法的呼叫。這個方法會註冊 `/broadcasting/auth` 路由來處理授權請求:" +msgstr "" -#: docs/10.x/broadcasting.md:block 155 (code) -msgid "Broadcast::routes();\n" -msgstr "Broadcast::routes();\n" +# CODE +#: ./docs/8.x/broadcasting.md:502 +#: ./docs/9.x/broadcasting.md:530 +#: ./docs/10.x/broadcasting.md:589 +msgid "Broadcast::routes();" +msgstr "" -#: docs/10.x/broadcasting.md:block 156 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:504 +#: ./docs/9.x/broadcasting.md:532 +#: ./docs/10.x/broadcasting.md:591 msgid "The `Broadcast::routes` method will automatically place its routes within the `web` middleware group; however, you may pass an array of route attributes to the method if you would like to customize the assigned attributes:" -msgstr "`Broadcast::routes` 方法會自動將其中的路由放置於 `web` Middleware 群組內。不過,若想自訂指派的屬性,也可以傳入包含路由屬性的陣列:" +msgstr "" + +# CODE +#: ./docs/8.x/broadcasting.md:506 +#: ./docs/9.x/broadcasting.md:534 +#: ./docs/10.x/broadcasting.md:593 +msgid "Broadcast::routes($attributes);" +msgstr "" -#: docs/10.x/broadcasting.md:block 157 (code) -msgid "Broadcast::routes($attributes);\n" -msgstr "Broadcast::routes($attributes);\n" +# P +#: ./docs/8.x/broadcasting.md:508 +#: ./docs/9.x/broadcasting.md:536 +#: ./docs/10.x/broadcasting.md:595 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/broadcasting.md:block 159 (header) +# H4 +#: ./docs/8.x/broadcasting.md:509 +#: ./docs/9.x/broadcasting.md:537 msgid "Customizing The Authorization Endpoint" -msgstr "自訂授權 Endpoint" +msgstr "" -#: docs/10.x/broadcasting.md:block 160 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:511 +#: ./docs/9.x/broadcasting.md:539 +#: ./docs/10.x/broadcasting.md:598 msgid "By default, Echo will use the `/broadcasting/auth` endpoint to authorize channel access. However, you may specify your own authorization endpoint by passing the `authEndpoint` configuration option to your Echo instance:" -msgstr "預設情況下,Echo 會使用 `/broadcasting/auth` Endpoint 來授權頻道存取。不過,也可以通過將 `authEndpoint` 設定選項傳給 Echo 實體來指定你自己的授權 Endpoint:" +msgstr "" -#: docs/10.x/broadcasting.md:block 161 (code) +# CODE +# CODE: js +#: ./docs/8.x/broadcasting.md:513 +#: ./docs/9.x/broadcasting.md:541 +#: ./docs/10.x/broadcasting.md:600 msgid "window.Echo = new Echo({\n" " broadcaster: 'pusher',\n" " // ...\n" " authEndpoint: '/custom/endpoint/auth'\n" -"});\n" -msgstr "window.Echo = new Echo({\n" -" broadcaster: 'pusher',\n" -" // ...\n" -" authEndpoint: '/custom/endpoint/auth'\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:519 +#: ./docs/9.x/broadcasting.md:549 +#: ./docs/10.x/broadcasting.md:608 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/broadcasting.md:block 163 (header) +# H4 +#: ./docs/8.x/broadcasting.md:520 +#: ./docs/9.x/broadcasting.md:550 msgid "Customizing The Authorization Request" -msgstr "自訂授權 Request" +msgstr "" -#: docs/10.x/broadcasting.md:block 164 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:522 +#: ./docs/9.x/broadcasting.md:552 +#: ./docs/10.x/broadcasting.md:611 msgid "You can customize how Laravel Echo performs authorization requests by providing a custom authorizer when initializing Echo:" -msgstr "我們可以自訂 Laravel Echo 要如何執行授權請求。只需要在初始化 Echo 時提供一個自訂授權程式即可:" +msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:524 +#: ./docs/11.x/broadcasting.md:539 +#: ./docs/master/broadcasting.md:593 +msgid "/**\n" +" * The name of the queue on which to place the broadcasting job.\n" +" */\n" +"public function broadcastQueue(): string\n" +"{\n" +" return 'default';\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 165 (code) +# CODE +#: ./docs/8.x/broadcasting.md:524 msgid "window.Echo = new Echo({\n" " // ...\n" " authorizer: (channel, options) => {\n" @@ -993,16 +2489,79 @@ msgid "window.Echo = new Echo({\n" " channel_name: channel.name\n" " })\n" " .then(response => {\n" -" callback(null, response.data);\n" +" callback(false, response.data);\n" " })\n" " .catch(error => {\n" -" callback(error);\n" +" callback(true, error);\n" " });\n" " }\n" " };\n" " },\n" -"})\n" -msgstr "window.Echo = new Echo({\n" +"})" +msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:534 +#: ./docs/11.x/broadcasting.md:549 +#: ./docs/master/broadcasting.md:603 +msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:545 +#: ./docs/9.x/broadcasting.md:577 +#: ./docs/10.x/broadcasting.md:636 +#: ./docs/11.x/broadcasting.md:602 +#: ./docs/master/broadcasting.md:656 +msgid "Defining Authorization Callbacks" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:547 +#: ./docs/9.x/broadcasting.md:579 +#: ./docs/10.x/broadcasting.md:638 +msgid "Next, we need to define the logic that will actually determine if the currently authenticated user can listen to a given channel. This is done in the `routes/channels.php` file that is included with your application. In this file, you may use the `Broadcast::channel` method to register channel authorization callbacks:" +msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:548 +#: ./docs/11.x/broadcasting.md:563 +#: ./docs/master/broadcasting.md:617 +msgid "/**\n" +" * Determine if this event should broadcast.\n" +" */\n" +"public function broadcastWhen(): bool\n" +"{\n" +" return $this->order->value > 100;\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/broadcasting.md:549 +#: ./docs/9.x/broadcasting.md:581 +msgid "Broadcast::channel('orders.{orderId}', function ($user, $orderId) {\n" +" return $user->id === Order::findOrNew($orderId)->user_id;\n" +"});" +msgstr "" + +# CODE: js +#: ./docs/9.x/broadcasting.md:554 +#: ./docs/10.x/broadcasting.md:613 +msgid "window.Echo = new Echo({\n" " // ...\n" " authorizer: (channel, options) => {\n" " return {\n" @@ -1020,101 +2579,189 @@ msgstr "window.Echo = new Echo({\n" " }\n" " };\n" " },\n" -"})\n" - -#: docs/10.x/broadcasting.md:block 167 (header) -msgid "Defining Authorization Callbacks" -msgstr "定義授權回呼" - -#: docs/10.x/broadcasting.md:block 168 (paragraph) -msgid "Next, we need to define the logic that will actually determine if the currently authenticated user can listen to a given channel. This is done in the `routes/channels.php` file that is included with your application. In this file, you may use the `Broadcast::channel` method to register channel authorization callbacks:" -msgstr "接著,我們需要定義實際上用來判斷目前登入使用者是否能監聽給定頻道的邏輯。這個定義放在專案內`routes/channels.php` 檔案中。在這個檔案中,可以使用 `Broadcast::channel` 方法來註冊頻道授權回呼:" - -#: docs/10.x/broadcasting.md:block 169 (code) -msgid "use App\\Models\\User;\n\n" -"Broadcast::channel('orders.{orderId}', function (User $user, int $orderId) {\n" -" return $user->id === Order::findOrNew($orderId)->user_id;\n" -"});\n" -msgstr "use App\\Models\\User;\n\n" -"Broadcast::channel('orders.{orderId}', function (User $user, int $orderId) {\n" -" return $user->id === Order::findOrNew($orderId)->user_id;\n" -"});\n" - -#: docs/10.x/broadcasting.md:block 172 (paragraph) -msgid "You may view a list of your application's broadcast authorization callbacks using the `channel:list` Artisan command:" -msgstr "可以使用 `channel:list` Artisan 指令來檢視專案中所有 Broadcast 身分驗證回呼的列表:" +"})" +msgstr "" -#: docs/10.x/broadcasting.md:block 173 (code) -msgid "php artisan channel:list\n" -msgstr "php artisan channel:list\n" +# H4 +#: ./docs/10.x/broadcasting.md:557 +#: ./docs/11.x/broadcasting.md:572 +#: ./docs/master/broadcasting.md:626 +msgid "Broadcasting and Database Transactions" +msgstr "" -#: docs/10.x/broadcasting.md:block 175 (header) +# P +#: ./docs/8.x/broadcasting.md:557 +#: ./docs/9.x/broadcasting.md:589 +#: ./docs/10.x/broadcasting.md:656 +#: ./docs/11.x/broadcasting.md:622 +#: ./docs/master/broadcasting.md:676 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:558 +#: ./docs/9.x/broadcasting.md:590 +#: ./docs/10.x/broadcasting.md:657 +#: ./docs/11.x/broadcasting.md:623 +#: ./docs/master/broadcasting.md:677 msgid "Authorization Callback Model Binding" -msgstr "授權回呼的 Model " +msgstr "" -#: docs/10.x/broadcasting.md:block 176 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:560 +#: ./docs/9.x/broadcasting.md:592 +#: ./docs/10.x/broadcasting.md:659 +#: ./docs/11.x/broadcasting.md:625 +#: ./docs/master/broadcasting.md:679 msgid "Just like HTTP routes, channel routes may also take advantage of implicit and explicit [route model binding](/docs/{{version}}/routing#route-model-binding). For example, instead of receiving a string or numeric order ID, you may request an actual `Order` model instance:" -msgstr "就像 HTTP 路由一樣,頻道路由也能使用顯式或隱式[路由 Model ](/docs/{{version}}/routing#route-model-binding)的功能。舉例來說,可以不接收字串或數字的 Order ID,而要求實際的 `Order` Model 實體:" +msgstr "" -#: docs/10.x/broadcasting.md:block 177 (code) -msgid "use App\\Models\\Order;\n" -"use App\\Models\\User;\n\n" -"Broadcast::channel('orders.{order}', function (User $user, Order $order) {\n" -" return $user->id === $order->user_id;\n" -"});\n" -msgstr "use App\\Models\\Order;\n" -"use App\\Models\\User;\n\n" -"Broadcast::channel('orders.{order}', function (User $user, Order $order) {\n" +# P +#: ./docs/10.x/broadcasting.md:561 +#: ./docs/11.x/broadcasting.md:576 +#: ./docs/master/broadcasting.md:630 +msgid "If your queue connection's `after_commit` configuration option is set to `false`, you may still indicate that a particular broadcast event should be dispatched after all open database transactions have been committed by implementing the `ShouldDispatchAfterCommit` interface on the event class:" +msgstr "" + +# CODE +#: ./docs/8.x/broadcasting.md:562 +#: ./docs/9.x/broadcasting.md:594 +msgid "use App\\Models\\Order;\n\n" +"Broadcast::channel('orders.{order}', function ($user, Order $order) {\n" " return $user->id === $order->user_id;\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/broadcasting.md:block 178 (quote) -msgid "**Warning** Unlike HTTP route model binding, channel model binding does not support automatic [implicit model binding scoping](/docs/{{version}}/routing#implicit-model-binding-scoping). However, this is rarely a problem because most channels can be scoped based on a single model's unique, primary key." -msgstr "**Warning** 與 HTTP 路由 Model 綁定不同,頻道的 Model 綁定不支援自動[為隱式 Model 綁定加上作用域]。不過,通常來說這不會造成問題,因為大部分的頻道都可以被放置與單一 Model 的獨立主鍵作用域內。" +# CODE +#: ./docs/10.x/broadcasting.md:563 +#: ./docs/11.x/broadcasting.md:578 +#: ./docs/master/broadcasting.md:632 +msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:571 +#: ./docs/9.x/broadcasting.md:604 +#: ./docs/10.x/broadcasting.md:672 +#: ./docs/11.x/broadcasting.md:638 +#: ./docs/master/broadcasting.md:692 msgid "Authorization Callback Authentication" -msgstr "授權回呼認證" +msgstr "" -#: docs/10.x/broadcasting.md:block 181 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:573 +#: ./docs/9.x/broadcasting.md:606 +#: ./docs/10.x/broadcasting.md:674 +#: ./docs/11.x/broadcasting.md:640 +#: ./docs/master/broadcasting.md:694 msgid "Private and presence broadcast channels authenticate the current user via your application's default authentication guard. If the user is not authenticated, channel authorization is automatically denied and the authorization callback is never executed. However, you may assign multiple, custom guards that should authenticate the incoming request if necessary:" -msgstr "私有與 Presence 廣播頻道會通過專案預設的認證 Guard 來認證目前的使用者。若使用者未登入,則頻道認證會自動拒絕,且授權回呼永遠不會被執行。不過,若有需要,也可以指定多個自訂 Guard 來認證連入請求:" +msgstr "" -#: docs/10.x/broadcasting.md:block 182 (code) +# CODE +#: ./docs/8.x/broadcasting.md:575 +#: ./docs/9.x/broadcasting.md:608 +#: ./docs/10.x/broadcasting.md:676 +#: ./docs/11.x/broadcasting.md:642 +#: ./docs/master/broadcasting.md:696 msgid "Broadcast::channel('channel', function () {\n" " // ...\n" -"}, ['guards' => ['web', 'admin']]);\n" -msgstr "Broadcast::channel('channel', function () {\n" -" // ...\n" -"}, ['guards' => ['web', 'admin']]);\n" +"}, ['guards' => ['web', 'admin']]);" +msgstr "" -#: docs/10.x/broadcasting.md:block 184 (header) +# P +#: ./docs/8.x/broadcasting.md:579 +#: ./docs/9.x/broadcasting.md:612 +#: ./docs/10.x/broadcasting.md:680 +#: ./docs/11.x/broadcasting.md:646 +#: ./docs/master/broadcasting.md:700 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:580 +#: ./docs/9.x/broadcasting.md:613 +#: ./docs/10.x/broadcasting.md:681 +#: ./docs/11.x/broadcasting.md:647 +#: ./docs/master/broadcasting.md:701 msgid "Defining Channel Classes" -msgstr "定義 Channel 類別" +msgstr "" -#: docs/10.x/broadcasting.md:block 185 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:582 +#: ./docs/9.x/broadcasting.md:615 +#: ./docs/10.x/broadcasting.md:683 +#: ./docs/11.x/broadcasting.md:649 +#: ./docs/master/broadcasting.md:703 msgid "If your application is consuming many different channels, your `routes/channels.php` file could become bulky. So, instead of using closures to authorize channels, you may use channel classes. To generate a channel class, use the `make:channel` Artisan command. This command will place a new channel class in the `App/Broadcasting` directory." -msgstr "若你的專案會使用到許多不同的頻道,則 `routes/channels.php` 可能會變得很肥大。因此,比起使用閉包來授權頻道,我們可以改用頻道類別。要建立頻道類別,請使用 `make:channel` Artisan 指令。這個指令會在 `app/Broadcasting` 目錄內放置一個新的頻道類別。" +msgstr "" -#: docs/10.x/broadcasting.md:block 186 (code) -msgid "php artisan make:channel OrderChannel\n" -msgstr "php artisan make:channel OrderChannel\n" +# CODE +# CODE: shell +#: ./docs/8.x/broadcasting.md:584 +#: ./docs/9.x/broadcasting.md:617 +#: ./docs/10.x/broadcasting.md:685 +#: ./docs/11.x/broadcasting.md:651 +#: ./docs/master/broadcasting.md:705 +msgid "php artisan make:channel OrderChannel" +msgstr "" -#: docs/10.x/broadcasting.md:block 187 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:586 +#: ./docs/9.x/broadcasting.md:621 +#: ./docs/10.x/broadcasting.md:689 +#: ./docs/11.x/broadcasting.md:655 +#: ./docs/master/broadcasting.md:709 msgid "Next, register your channel in your `routes/channels.php` file:" -msgstr "接著,在 `routes/channels.php` 檔案內註冊頻道:" +msgstr "" -#: docs/10.x/broadcasting.md:block 188 (code) +# CODE +#: ./docs/8.x/broadcasting.md:588 +#: ./docs/9.x/broadcasting.md:623 +#: ./docs/10.x/broadcasting.md:691 +#: ./docs/11.x/broadcasting.md:657 +#: ./docs/master/broadcasting.md:711 msgid "use App\\Broadcasting\\OrderChannel;\n\n" -"Broadcast::channel('orders.{order}', OrderChannel::class);\n" -msgstr "use App\\Broadcasting\\OrderChannel;\n\n" -"Broadcast::channel('orders.{order}', OrderChannel::class);\n" +"Broadcast::channel('orders.{order}', OrderChannel::class);" +msgstr "" -#: docs/10.x/broadcasting.md:block 189 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:592 +#: ./docs/9.x/broadcasting.md:627 +#: ./docs/10.x/broadcasting.md:695 +#: ./docs/11.x/broadcasting.md:661 +#: ./docs/master/broadcasting.md:715 msgid "Finally, you may place the authorization logic for your channel in the channel class' `join` method. This `join` method will house the same logic you would have typically placed in your channel authorization closure. You may also take advantage of channel model binding:" -msgstr "最後,可以將頻道的授權邏輯放在頻道類別的 `join` 方法內。這個 `join` 方法用來放置與平常放在頻道授權閉包相同的邏輯。也可以使用頻道 Model 綁定:" +msgstr "" -#: docs/10.x/broadcasting.md:block 190 (code) +# CODE +#: ./docs/8.x/broadcasting.md:594 +#: ./docs/9.x/broadcasting.md:629 msgid "id === $order->user_id;\n" -" }\n" -"}\n" -msgstr "id === $order->user_id;\n" " }\n" -"}\n" +"}" +msgstr "" + +# H4 +#: ./docs/10.x/broadcasting.md:596 +msgid "Customizing the Authorization Endpoint" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:597 +#: ./docs/master/broadcasting.md:651 +msgid "Private channels require you to authorize that the currently authenticated user can actually listen on the channel. This is accomplished by making an HTTP request to your Laravel application with the channel name and allowing your application to determine if the user can listen on that channel. When using [Laravel Echo](#client-side-installation), the HTTP request to authorize subscriptions to private channels will be made automatically." +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:599 +#: ./docs/master/broadcasting.md:653 +msgid "When broadcasting is enabled, Laravel automatically registers the `/broadcasting/auth` route to handle authorization requests. The `/broadcasting/auth` route is automatically placed within the `web` middleware group." +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:604 +#: ./docs/master/broadcasting.md:658 +msgid "Next, we need to define the logic that will actually determine if the currently authenticated user can listen to a given channel. This is done in the `routes/channels.php` file that was created by the `install:broadcasting` Artisan command. In this file, you may use the `Broadcast::channel` method to register channel authorization callbacks:" +msgstr "" + +# H4 +#: ./docs/10.x/broadcasting.md:609 +msgid "Customizing the Authorization Request" +msgstr "" -#: docs/10.x/broadcasting.md:block 191 (quote) -msgid "**Note** Like many other classes in Laravel, channel classes will automatically be resolved by the [service container](/docs/{{version}}/container). So, you may type-hint any dependencies required by your channel in its constructor." -msgstr "**Note** 與 Laravel 內其他類別一樣,頻道類別也會自動由 [Service Container](/docs/{{version}}/container) 解析。因此,我們可以在頻道的建構函式上對任何所需要的依賴進行型別提示。" +# P +#: ./docs/8.x/broadcasting.md:626 +#: ./docs/9.x/broadcasting.md:662 +#: ./docs/10.x/broadcasting.md:724 +#: ./docs/11.x/broadcasting.md:687 +#: ./docs/master/broadcasting.md:744 +msgid "Like many other classes in Laravel, channel classes will automatically be resolved by the [service container](/docs/{{version}}/container). So, you may type-hint any dependencies required by your channel in its constructor." +msgstr "" -#: docs/10.x/broadcasting.md:block 193 (header) +# P +#: ./docs/8.x/broadcasting.md:628 +#: ./docs/9.x/broadcasting.md:664 +#: ./docs/10.x/broadcasting.md:726 +#: ./docs/11.x/broadcasting.md:689 +#: ./docs/master/broadcasting.md:746 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/broadcasting.md:629 +#: ./docs/9.x/broadcasting.md:665 +#: ./docs/10.x/broadcasting.md:727 +#: ./docs/11.x/broadcasting.md:690 +#: ./docs/master/broadcasting.md:747 msgid "Broadcasting Events" -msgstr "廣播事件" +msgstr "" -#: docs/10.x/broadcasting.md:block 194 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:631 +#: ./docs/9.x/broadcasting.md:667 +#: ./docs/10.x/broadcasting.md:729 +#: ./docs/11.x/broadcasting.md:692 +#: ./docs/master/broadcasting.md:749 msgid "Once you have defined an event and marked it with the `ShouldBroadcast` interface, you only need to fire the event using the event's dispatch method. The event dispatcher will notice that the event is marked with the `ShouldBroadcast` interface and will queue the event for broadcasting:" -msgstr "定義好事件並將其以 `ShouldBroadcast` 介面進行標示後,我們只需要使用 dispatch 方法來觸發事件即可。事件觸發程式會注意到這個事件有被標註為 `ShouldBroadcast` 介面,並將事件放入佇列以進行廣播:" +msgstr "" -#: docs/10.x/broadcasting.md:block 197 (header) +# P +#: ./docs/8.x/broadcasting.md:637 +#: ./docs/9.x/broadcasting.md:673 +#: ./docs/10.x/broadcasting.md:735 +#: ./docs/11.x/broadcasting.md:698 +#: ./docs/master/broadcasting.md:755 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:638 +#: ./docs/9.x/broadcasting.md:674 msgid "Only To Others" -msgstr "僅限其他" +msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:640 +#: ./docs/11.x/broadcasting.md:606 +#: ./docs/master/broadcasting.md:660 +msgid "use App\\Models\\User;\n\n" +"Broadcast::channel('orders.{orderId}', function (User $user, int $orderId) {\n" +" return $user->id === Order::findOrNew($orderId)->user_id;\n" +"});" +msgstr "" -#: docs/10.x/broadcasting.md:block 198 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:640 +#: ./docs/9.x/broadcasting.md:676 +#: ./docs/10.x/broadcasting.md:738 +#: ./docs/11.x/broadcasting.md:701 +#: ./docs/master/broadcasting.md:758 msgid "When building an application that utilizes event broadcasting, you may occasionally need to broadcast an event to all subscribers to a given channel except for the current user. You may accomplish this using the `broadcast` helper and the `toOthers` method:" -msgstr "在建立一個有使用到事件廣播的專案時,我們可能會需要將某個事件廣播給除了目前使用者以外的所有頻道訂閱者。可以通過 `broadcast` 輔助函式以及 `toOthers` 方法來完成:" +msgstr "" -#: docs/10.x/broadcasting.md:block 199 (code) +# CODE +#: ./docs/8.x/broadcasting.md:642 +#: ./docs/9.x/broadcasting.md:678 +#: ./docs/10.x/broadcasting.md:740 +#: ./docs/11.x/broadcasting.md:703 +#: ./docs/master/broadcasting.md:760 msgid "use App\\Events\\OrderShipmentStatusUpdated;\n\n" -"broadcast(new OrderShipmentStatusUpdated($update))->toOthers();\n" -msgstr "use App\\Events\\OrderShipmentStatusUpdated;\n\n" -"broadcast(new OrderShipmentStatusUpdated($update))->toOthers();\n" +"broadcast(new OrderShipmentStatusUpdated($update))->toOthers();" +msgstr "" -#: docs/10.x/broadcasting.md:block 200 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:646 +#: ./docs/9.x/broadcasting.md:682 +#: ./docs/10.x/broadcasting.md:744 +#: ./docs/11.x/broadcasting.md:707 +#: ./docs/master/broadcasting.md:764 msgid "To better understand when you may want to use the `toOthers` method, let's imagine a task list application where a user may create a new task by entering a task name. To create a task, your application might make a request to a `/task` URL which broadcasts the task's creation and returns a JSON representation of the new task. When your JavaScript application receives the response from the end-point, it might directly insert the new task into its task list like so:" -msgstr "為了幫助你更容易理解什麼時候會需要用到 `toOthers` 方法,我們來假設有個任務清單 App。在這個 App 中,使用者可以輸入任務名稱來新增任務。為了建立任務,這個 App 可能會向 `/task` URL 發起一個請求,該請求會將任務的建立廣播出去,並回傳代表新任務的 JSON。當 JavaScript 端從這個 End-point 收到回覆後,就可以直接將新任務插入到任務清單內。像這樣:" +msgstr "" -#: docs/10.x/broadcasting.md:block 201 (code) +# CODE +# CODE: js +#: ./docs/8.x/broadcasting.md:648 +#: ./docs/9.x/broadcasting.md:684 +#: ./docs/10.x/broadcasting.md:746 +#: ./docs/11.x/broadcasting.md:709 +#: ./docs/master/broadcasting.md:766 msgid "axios.post('/task', task)\n" " .then((response) => {\n" " this.tasks.push(response.data);\n" -" });\n" -msgstr "axios.post('/task', task)\n" -" .then((response) => {\n" -" this.tasks.push(response.data);\n" -" });\n" +" });" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:650 +#: ./docs/11.x/broadcasting.md:616 +#: ./docs/master/broadcasting.md:670 +msgid "You may view a list of your application's broadcast authorization callbacks using the `channel:list` Artisan command:" +msgstr "" + +# CODE: shell +#: ./docs/10.x/broadcasting.md:652 +#: ./docs/11.x/broadcasting.md:618 +#: ./docs/master/broadcasting.md:672 +msgid "php artisan channel:list" +msgstr "" -#: docs/10.x/broadcasting.md:block 202 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:653 +#: ./docs/9.x/broadcasting.md:691 +#: ./docs/10.x/broadcasting.md:753 +#: ./docs/11.x/broadcasting.md:716 +#: ./docs/master/broadcasting.md:773 msgid "However, remember that we also broadcast the task's creation. If your JavaScript application is also listening for this event in order to add tasks to the task list, you will have duplicate tasks in your list: one from the end-point and one from the broadcast. You may solve this by using the `toOthers` method to instruct the broadcaster to not broadcast the event to the current user." -msgstr "不過,提醒一下,我們也會將任務的建立廣播出去。如果 JavaScript 端也會監聽這個事件來將任務新增到任務清單上,那麼列表上就會有重複的任務:一個是從 End-point 回傳回來的,另一個則是從監聽事件來的。我們可以通過使用 `toOthers` 方法來告訴廣播程式不要將該事件廣播給目前的使用者。" +msgstr "" -#: docs/10.x/broadcasting.md:block 203 (quote) -msgid "**Warning** Your event must use the `Illuminate\\Broadcasting\\InteractsWithSockets` trait in order to call the `toOthers` method." -msgstr "**Warning** 若要呼叫 `toOthers` 方法,該事件必須要 use `Illuminate\\Broadcasting\\InteractsWithSockets` Trait。" +# P +#: ./docs/8.x/broadcasting.md:655 +#: ./docs/9.x/broadcasting.md:694 +#: ./docs/10.x/broadcasting.md:756 +#: ./docs/11.x/broadcasting.md:719 +#: ./docs/master/broadcasting.md:776 +msgid "Your event must use the `Illuminate\\Broadcasting\\InteractsWithSockets` trait in order to call the `toOthers` method." +msgstr "" -#: docs/10.x/broadcasting.md:block 206 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:657 +#: ./docs/9.x/broadcasting.md:696 +#: ./docs/10.x/broadcasting.md:758 +#: ./docs/11.x/broadcasting.md:721 +#: ./docs/master/broadcasting.md:778 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:660 +#: ./docs/9.x/broadcasting.md:699 msgid "When you initialize a Laravel Echo instance, a socket ID is assigned to the connection. If you are using a global [Axios](https://github.com/mzabriskie/axios) instance to make HTTP requests from your JavaScript application, the socket ID will automatically be attached to every outgoing request as a `X-Socket-ID` header. Then, when you call the `toOthers` method, Laravel will extract the socket ID from the header and instruct the broadcaster to not broadcast to any connections with that socket ID." -msgstr "初始化 Laravel Echo 實體時,會指派一個 Socket ID 給這個連線。若是使用全域的 [Axios](https://github.com/mzabriskie/axios) 實體來在 JavaScript 端建立 HTTP 連線,則 Socket ID 會以 `X-Socket-ID` 標頭被自動附加到每個外連請求上。接著,當呼叫 `toOthers` 方法時,Laravel 會從標頭內拆出這個 Socket ID,並告知廣播程式不要廣播給有該 Socket ID 的連線。" +msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:661 +#: ./docs/11.x/broadcasting.md:627 +#: ./docs/master/broadcasting.md:681 +msgid "use App\\Models\\Order;\n" +"use App\\Models\\User;\n\n" +"Broadcast::channel('orders.{order}', function (User $user, Order $order) {\n" +" return $user->id === $order->user_id;\n" +"});" +msgstr "" -#: docs/10.x/broadcasting.md:block 207 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:662 +#: ./docs/9.x/broadcasting.md:701 +#: ./docs/10.x/broadcasting.md:763 +#: ./docs/11.x/broadcasting.md:726 +#: ./docs/master/broadcasting.md:783 msgid "If you are not using a global Axios instance, you will need to manually configure your JavaScript application to send the `X-Socket-ID` header with all outgoing requests. You may retrieve the socket ID using the `Echo.socketId` method:" -msgstr "若你未使用全域 Axios 實體,則需要手動設定 JavaScript 端來在所有外連請求上傳送 `X-Socket-ID` 標頭。可以通過 `Echo.socketId` 方法來取得 Socket ID:" +msgstr "" + +# CODE +#: ./docs/11.x/broadcasting.md:663 +msgid "id === $order->user_id;\n" +" }\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 208 (code) -msgid "var socketId = Echo.socketId();\n" -msgstr "var socketId = Echo.socketId();\n" +# CODE +# CODE: js +#: ./docs/8.x/broadcasting.md:664 +#: ./docs/9.x/broadcasting.md:703 +#: ./docs/10.x/broadcasting.md:765 +#: ./docs/11.x/broadcasting.md:728 +#: ./docs/master/broadcasting.md:785 +msgid "var socketId = Echo.socketId();" +msgstr "" -#: docs/10.x/broadcasting.md:block 210 (header) +# P +#: ./docs/8.x/broadcasting.md:666 +#: ./docs/9.x/broadcasting.md:707 +#: ./docs/10.x/broadcasting.md:769 +#: ./docs/11.x/broadcasting.md:732 +#: ./docs/master/broadcasting.md:789 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:667 +#: ./docs/9.x/broadcasting.md:708 msgid "Customizing The Connection" -msgstr "自訂連線" +msgstr "" -#: docs/10.x/broadcasting.md:block 211 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:669 +#: ./docs/9.x/broadcasting.md:710 +#: ./docs/10.x/broadcasting.md:772 +#: ./docs/11.x/broadcasting.md:735 +#: ./docs/master/broadcasting.md:792 msgid "If your application interacts with multiple broadcast connections and you want to broadcast an event using a broadcaster other than your default, you may specify which connection to push an event to using the `via` method:" -msgstr "若你的專案與許多不同的廣播連線互動時,如果我們想使用預設廣播程式以外的特定廣播程式來廣播事件,則可以使用 `via` 方法來指定要將事件推送給哪個連線:" +msgstr "" -#: docs/10.x/broadcasting.md:block 212 (code) +# CODE +#: ./docs/8.x/broadcasting.md:671 +#: ./docs/9.x/broadcasting.md:712 +#: ./docs/10.x/broadcasting.md:774 +#: ./docs/11.x/broadcasting.md:737 +#: ./docs/master/broadcasting.md:794 msgid "use App\\Events\\OrderShipmentStatusUpdated;\n\n" -"broadcast(new OrderShipmentStatusUpdated($update))->via('pusher');\n" -msgstr "use App\\Events\\OrderShipmentStatusUpdated;\n\n" -"broadcast(new OrderShipmentStatusUpdated($update))->via('pusher');\n" +"broadcast(new OrderShipmentStatusUpdated($update))->via('pusher');" +msgstr "" -#: docs/10.x/broadcasting.md:block 213 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:675 +#: ./docs/9.x/broadcasting.md:716 +#: ./docs/10.x/broadcasting.md:778 +#: ./docs/11.x/broadcasting.md:741 +#: ./docs/master/broadcasting.md:798 msgid "Alternatively, you may specify the event's broadcast connection by calling the `broadcastVia` method within the event's constructor. However, before doing so, you should ensure that the event class uses the `InteractsWithBroadcasting` trait:" -msgstr "或者,也可以通過在事件的建構函式 (Constructor) 內呼叫 `broadcastVia` 方法來指定事件的廣播連線。不過,這麼做的時候,請先確保這個事件類別有使用 `InteractsWithBroadcasting` Trait:" +msgstr "" -#: docs/10.x/broadcasting.md:block 214 (code) +# CODE +#: ./docs/8.x/broadcasting.md:677 +#: ./docs/9.x/broadcasting.md:718 msgid "broadcastVia('pusher');\n" " }\n" -"}\n" -msgstr "broadcastVia('pusher');\n" +" // ...\n" +" }\n\n" +" /**\n" +" * Authenticate the user's access to the channel.\n" +" */\n" +" public function join(User $user, Order $order): array|bool\n" +" {\n" +" return $user->id === $order->user_id;\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 216 (header) +# P +#: ./docs/8.x/broadcasting.md:704 +#: ./docs/9.x/broadcasting.md:745 +#: ./docs/10.x/broadcasting.md:805 +#: ./docs/11.x/broadcasting.md:827 +#: ./docs/master/broadcasting.md:825 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/broadcasting.md:705 +#: ./docs/9.x/broadcasting.md:746 +#: ./docs/10.x/broadcasting.md:806 +#: ./docs/11.x/broadcasting.md:828 +#: ./docs/master/broadcasting.md:826 msgid "Receiving Broadcasts" -msgstr "接收廣播" +msgstr "" -#: docs/10.x/broadcasting.md:block 218 (header) +# P +#: ./docs/8.x/broadcasting.md:707 +#: ./docs/9.x/broadcasting.md:748 +#: ./docs/10.x/broadcasting.md:808 +#: ./docs/11.x/broadcasting.md:830 +#: ./docs/master/broadcasting.md:828 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:708 +#: ./docs/9.x/broadcasting.md:749 msgid "Listening For Events" -msgstr "監聽事件" +msgstr "" -#: docs/10.x/broadcasting.md:block 219 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:710 +#: ./docs/9.x/broadcasting.md:751 +#: ./docs/10.x/broadcasting.md:811 +#: ./docs/11.x/broadcasting.md:833 +#: ./docs/master/broadcasting.md:831 msgid "Once you have [installed and instantiated Laravel Echo](#client-side-installation), you are ready to start listening for events that are broadcast from your Laravel application. First, use the `channel` method to retrieve an instance of a channel, then call the `listen` method to listen for a specified event:" -msgstr "[安裝並設定好 Laravel Echo](#client-side-installation) 後,就可以開始監聽來自 Laravel 端廣播的事件了。首先,使用 `channel` 方法來取得頻道的實體,然後呼叫 `listen` 方法來監聽某個特定的事件:" +msgstr "" -#: docs/10.x/broadcasting.md:block 220 (code) +# CODE: js +#: ./docs/8.x/broadcasting.md:712 +#: ./docs/9.x/broadcasting.md:753 +#: ./docs/10.x/broadcasting.md:813 +#: ./docs/11.x/broadcasting.md:835 +#: ./docs/master/broadcasting.md:833 msgid "Echo.channel(`orders.${this.order.id}`)\n" " .listen('OrderShipmentStatusUpdated', (e) => {\n" " console.log(e.order.name);\n" -" });\n" -msgstr "Echo.channel(`orders.${this.order.id}`)\n" -" .listen('OrderShipmentStatusUpdated', (e) => {\n" -" console.log(e.order.name);\n" -" });\n" +" });" +msgstr "" -#: docs/10.x/broadcasting.md:block 221 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:719 +#: ./docs/9.x/broadcasting.md:760 +#: ./docs/10.x/broadcasting.md:820 +#: ./docs/11.x/broadcasting.md:842 +#: ./docs/master/broadcasting.md:840 msgid "If you would like to listen for events on a private channel, use the `private` method instead. You may continue to chain calls to the `listen` method to listen for multiple events on a single channel:" -msgstr "若想監聽私有頻道,可使用 `private` 方法來代替。可以繼續在 `listen` 方法後方串上其他的呼叫來在單一頻道上監聽多個事件:" +msgstr "" -#: docs/10.x/broadcasting.md:block 222 (code) +# CODE: js +#: ./docs/8.x/broadcasting.md:721 msgid "Echo.private(`orders.${this.order.id}`)\n" -" .listen(/* ... */)\n" -" .listen(/* ... */)\n" -" .listen(/* ... */);\n" -msgstr "Echo.private(`orders.${this.order.id}`)\n" -" .listen(/* ... */)\n" -" .listen(/* ... */)\n" -" .listen(/* ... */);\n" +" .listen(...)\n" +" .listen(...)\n" +" .listen(...);" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:724 +msgid "When you initialize a Laravel Echo instance, a socket ID is assigned to the connection. If you are using a global [Axios](https://github.com/axios/axios) instance to make HTTP requests from your JavaScript application, the socket ID will automatically be attached to every outgoing request as an `X-Socket-ID` header. Then, when you call the `toOthers` method, Laravel will extract the socket ID from the header and instruct the broadcaster to not broadcast to any connections with that socket ID." +msgstr "" -#: docs/10.x/broadcasting.md:block 224 (header) +# P +#: ./docs/8.x/broadcasting.md:728 +#: ./docs/9.x/broadcasting.md:769 +#: ./docs/10.x/broadcasting.md:829 +#: ./docs/11.x/broadcasting.md:851 +#: ./docs/master/broadcasting.md:849 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:729 +#: ./docs/9.x/broadcasting.md:770 msgid "Stop Listening For Events" -msgstr "停止監聽事件" +msgstr "" -#: docs/10.x/broadcasting.md:block 225 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:731 +#: ./docs/9.x/broadcasting.md:772 +#: ./docs/10.x/broadcasting.md:832 +#: ./docs/11.x/broadcasting.md:854 +#: ./docs/master/broadcasting.md:852 msgid "If you would like to stop listening to a given event without [leaving the channel](#leaving-a-channel), you may use the `stopListening` method:" -msgstr "若想在不[離開頻道](#leaving-a-channel)的情況下停止監聽給定的事件,可以使用 `stopListening` 方法:" +msgstr "" -#: docs/10.x/broadcasting.md:block 226 (code) +# CODE: js +#: ./docs/8.x/broadcasting.md:733 +#: ./docs/9.x/broadcasting.md:774 +#: ./docs/10.x/broadcasting.md:834 +#: ./docs/11.x/broadcasting.md:856 +#: ./docs/master/broadcasting.md:854 msgid "Echo.private(`orders.${this.order.id}`)\n" -" .stopListening('OrderShipmentStatusUpdated')\n" -msgstr "Echo.private(`orders.${this.order.id}`)\n" -" .stopListening('OrderShipmentStatusUpdated')\n" +" .stopListening('OrderShipmentStatusUpdated')" +msgstr "" -#: docs/10.x/broadcasting.md:block 228 (header) +# H3 +#: ./docs/10.x/broadcasting.md:736 +#: ./docs/11.x/broadcasting.md:699 +#: ./docs/master/broadcasting.md:756 +msgid "Only to Others" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:738 +#: ./docs/9.x/broadcasting.md:779 +#: ./docs/10.x/broadcasting.md:839 +#: ./docs/11.x/broadcasting.md:861 +#: ./docs/master/broadcasting.md:859 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:739 +#: ./docs/9.x/broadcasting.md:780 msgid "Leaving A Channel" -msgstr "離開頻道" +msgstr "" -#: docs/10.x/broadcasting.md:block 229 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:741 +#: ./docs/9.x/broadcasting.md:782 +#: ./docs/10.x/broadcasting.md:842 +#: ./docs/11.x/broadcasting.md:864 +#: ./docs/master/broadcasting.md:862 msgid "To leave a channel, you may call the `leaveChannel` method on your Echo instance:" -msgstr "若要離開頻道,可以在 Echo 實體上呼叫 `leaveChannel` 方法:" +msgstr "" -#: docs/10.x/broadcasting.md:block 230 (code) -msgid "Echo.leaveChannel(`orders.${this.order.id}`);\n" -msgstr "Echo.leaveChannel(`orders.${this.order.id}`);\n" +# CODE: js +#: ./docs/8.x/broadcasting.md:743 +#: ./docs/9.x/broadcasting.md:784 +#: ./docs/10.x/broadcasting.md:844 +#: ./docs/11.x/broadcasting.md:866 +#: ./docs/master/broadcasting.md:864 +msgid "Echo.leaveChannel(`orders.${this.order.id}`);" +msgstr "" -#: docs/10.x/broadcasting.md:block 231 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:747 +#: ./docs/9.x/broadcasting.md:788 +#: ./docs/10.x/broadcasting.md:848 +#: ./docs/11.x/broadcasting.md:870 +#: ./docs/master/broadcasting.md:868 msgid "If you would like to leave a channel and also its associated private and presence channels, you may call the `leave` method:" -msgstr "若要離開頻道以及其關聯的私有與 Presence 頻道,可以呼叫 `leave` 方法:" +msgstr "" -#: docs/10.x/broadcasting.md:block 232 (code) -msgid "Echo.leave(`orders.${this.order.id}`);\n" -msgstr "Echo.leave(`orders.${this.order.id}`);\n" +# CODE: js +#: ./docs/8.x/broadcasting.md:749 +#: ./docs/9.x/broadcasting.md:790 +#: ./docs/10.x/broadcasting.md:850 +#: ./docs/11.x/broadcasting.md:872 +#: ./docs/master/broadcasting.md:870 +msgid "Echo.leave(`orders.${this.order.id}`);" +msgstr "" -#: docs/10.x/broadcasting.md:block 234 (header) +# P +#: ./docs/8.x/broadcasting.md:752 +#: ./docs/9.x/broadcasting.md:793 +#: ./docs/10.x/broadcasting.md:853 +#: ./docs/11.x/broadcasting.md:875 +#: ./docs/master/broadcasting.md:873 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:753 +#: ./docs/9.x/broadcasting.md:794 +#: ./docs/10.x/broadcasting.md:854 +#: ./docs/11.x/broadcasting.md:876 +#: ./docs/master/broadcasting.md:874 msgid "Namespaces" -msgstr "命名空間 (Namespace)" +msgstr "" -#: docs/10.x/broadcasting.md:block 235 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:755 +#: ./docs/9.x/broadcasting.md:796 +#: ./docs/10.x/broadcasting.md:856 +#: ./docs/11.x/broadcasting.md:878 +#: ./docs/master/broadcasting.md:876 msgid "You may have noticed in the examples above that we did not specify the full `App\\Events` namespace for the event classes. This is because Echo will automatically assume the events are located in the `App\\Events` namespace. However, you may configure the root namespace when you instantiate Echo by passing a `namespace` configuration option:" -msgstr "你可能已經注意到,我們並沒有為事件類別指定完整的 `App\\Events` 命名空間。這是因為,Echo 會自動假設事件都放在 `App\\Events` 命名空間下。不過,我們可以在初始化 Echo 時傳入 `namespace` 設定選項來設定要使用的根命名空間:" +msgstr "" -#: docs/10.x/broadcasting.md:block 236 (code) +# CODE: js +#: ./docs/8.x/broadcasting.md:757 +#: ./docs/9.x/broadcasting.md:798 +#: ./docs/10.x/broadcasting.md:858 +#: ./docs/11.x/broadcasting.md:880 +#: ./docs/master/broadcasting.md:878 msgid "window.Echo = new Echo({\n" " broadcaster: 'pusher',\n" " // ...\n" " namespace: 'App.Other.Namespace'\n" -"});\n" -msgstr "window.Echo = new Echo({\n" -" broadcaster: 'pusher',\n" -" // ...\n" -" namespace: 'App.Other.Namespace'\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:761 +#: ./docs/master/broadcasting.md:781 +msgid "When you initialize a Laravel Echo instance, a socket ID is assigned to the connection. If you are using a global [Axios](https://github.com/mzabriskie/axios) instance to make HTTP requests from your JavaScript application, the socket ID will automatically be attached to every outgoing request as an `X-Socket-ID` header. Then, when you call the `toOthers` method, Laravel will extract the socket ID from the header and instruct the broadcaster to not broadcast to any connections with that socket ID." +msgstr "" + +# CODE: js +#: ./docs/9.x/broadcasting.md:762 +#: ./docs/10.x/broadcasting.md:822 +#: ./docs/11.x/broadcasting.md:844 +#: ./docs/master/broadcasting.md:842 +msgid "Echo.private(`orders.${this.order.id}`)\n" +" .listen(/* ... */)\n" +" .listen(/* ... */)\n" +" .listen(/* ... */);" +msgstr "" -#: docs/10.x/broadcasting.md:block 237 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:765 +#: ./docs/9.x/broadcasting.md:806 +#: ./docs/10.x/broadcasting.md:866 +#: ./docs/11.x/broadcasting.md:888 +#: ./docs/master/broadcasting.md:886 msgid "Alternatively, you may prefix event classes with a `.` when subscribing to them using Echo. This will allow you to always specify the fully-qualified class name:" -msgstr "除了在初始化時設定以外,也可以在使用 Echo 訂閱事件時在事件類別的名稱前加上一個前置 `.`。這樣一來,就可以隨時使用完整的類別名稱:" +msgstr "" -#: docs/10.x/broadcasting.md:block 238 (code) +# CODE: js +#: ./docs/8.x/broadcasting.md:767 +#: ./docs/9.x/broadcasting.md:808 msgid "Echo.channel('orders')\n" " .listen('.Namespace\\\\Event\\\\Class', (e) => {\n" -" // ...\n" -" });\n" -msgstr "Echo.channel('orders')\n" -" .listen('.Namespace\\\\Event\\\\Class', (e) => {\n" -" // ...\n" -" });\n" +" //\n" +" });" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:768 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/11.x/broadcasting.md:769 +msgid "Anonymous Events" +msgstr "" + +# H3 +#: ./docs/10.x/broadcasting.md:770 +#: ./docs/11.x/broadcasting.md:733 +#: ./docs/master/broadcasting.md:790 +msgid "Customizing the Connection" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:771 +msgid "Sometimes, you may want to broadcast a simple event to your application's frontend without creating a dedicated event class. To accommodate this, the `Broadcast` facade allows you to broadcast \"anonymous events\":" +msgstr "" + +# CODE: php +#: ./docs/11.x/broadcasting.md:773 +msgid "Broadcast::on('orders.'.$order->id)->send();" +msgstr "" -#: docs/10.x/broadcasting.md:block 240 (header) +# P +#: ./docs/8.x/broadcasting.md:774 +#: ./docs/9.x/broadcasting.md:815 +#: ./docs/10.x/broadcasting.md:875 +#: ./docs/11.x/broadcasting.md:897 +#: ./docs/master/broadcasting.md:895 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/broadcasting.md:775 +#: ./docs/9.x/broadcasting.md:816 +#: ./docs/10.x/broadcasting.md:876 +#: ./docs/11.x/broadcasting.md:898 +#: ./docs/master/broadcasting.md:896 msgid "Presence Channels" -msgstr "Presence 頻道" +msgstr "" -#: docs/10.x/broadcasting.md:block 241 (paragraph) +# P +#: ./docs/11.x/broadcasting.md:777 +msgid "The example above will broadcast the following event:" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:777 +#: ./docs/9.x/broadcasting.md:818 +#: ./docs/10.x/broadcasting.md:878 +#: ./docs/11.x/broadcasting.md:900 +#: ./docs/master/broadcasting.md:898 msgid "Presence channels build on the security of private channels while exposing the additional feature of awareness of who is subscribed to the channel. This makes it easy to build powerful, collaborative application features such as notifying users when another user is viewing the same page or listing the inhabitants of a chat room." -msgstr "Presence 頻道擁有私有頻道的安全性,且會提供該頻道的訂閱者等額外資訊。這樣一來便能輕鬆地建立強大的協作 App 功能,如提示目前使用者由其他人正在檢視相同頁面,或是列出聊天室中的使用者狀態。" +msgstr "" + +# CODE: json +#: ./docs/11.x/broadcasting.md:779 +msgid "{\n" +" \"event\": \"AnonymousEvent\",\n" +" \"data\": \"[]\",\n" +" \"channel\": \"orders.1\"\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:779 +#: ./docs/9.x/broadcasting.md:820 +#: ./docs/10.x/broadcasting.md:880 +#: ./docs/11.x/broadcasting.md:902 +#: ./docs/master/broadcasting.md:900 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:780 +#: ./docs/11.x/broadcasting.md:743 +#: ./docs/master/broadcasting.md:800 +msgid "broadcastVia('pusher');\n" +" }\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 243 (header) +# H3 +#: ./docs/8.x/broadcasting.md:780 +#: ./docs/9.x/broadcasting.md:821 +#: ./docs/10.x/broadcasting.md:881 +#: ./docs/11.x/broadcasting.md:903 +#: ./docs/master/broadcasting.md:901 msgid "Authorizing Presence Channels" -msgstr "授權 Presence 頻道" +msgstr "" -#: docs/10.x/broadcasting.md:block 244 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:782 +#: ./docs/9.x/broadcasting.md:823 +#: ./docs/10.x/broadcasting.md:883 +#: ./docs/11.x/broadcasting.md:905 +#: ./docs/master/broadcasting.md:903 msgid "All presence channels are also private channels; therefore, users must be [authorized to access them](#authorizing-channels). However, when defining authorization callbacks for presence channels, you will not return `true` if the user is authorized to join the channel. Instead, you should return an array of data about the user." -msgstr "所有的 Presence 頻道也同時是私有頻道。因此,使用者必須要[經過授權以存取頻道](#authorizing-channels)。不過,在為 Presence 頻道定義授權回呼時,若要授權使用者加入頻道,則不應回傳 `true`,而應回傳包含有關其他使用者資訊的陣列。" +msgstr "" -#: docs/10.x/broadcasting.md:block 245 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:784 +#: ./docs/9.x/broadcasting.md:825 +#: ./docs/10.x/broadcasting.md:885 +#: ./docs/11.x/broadcasting.md:907 +#: ./docs/master/broadcasting.md:905 msgid "The data returned by the authorization callback will be made available to the presence channel event listeners in your JavaScript application. If the user is not authorized to join the presence channel, you should return `false` or `null`:" -msgstr "由授權回呼回傳的資料可以在 JavaScript 端中的 Presence 頻道事件監聽程式中使用。若使用者未被授權加入 Presence 頻道,則應回傳 `false` 或 `null`:" +msgstr "" -#: docs/10.x/broadcasting.md:block 246 (code) -msgid "use App\\Models\\User;\n\n" -"Broadcast::channel('chat.{roomId}', function (User $user, int $roomId) {\n" -" if ($user->canJoinRoom($roomId)) {\n" -" return ['id' => $user->id, 'name' => $user->name];\n" -" }\n" -"});\n" -msgstr "use App\\Models\\User;\n\n" -"Broadcast::channel('chat.{roomId}', function (User $user, int $roomId) {\n" +# CODE +#: ./docs/8.x/broadcasting.md:786 +#: ./docs/9.x/broadcasting.md:827 +msgid "Broadcast::channel('chat.{roomId}', function ($user, $roomId) {\n" " if ($user->canJoinRoom($roomId)) {\n" " return ['id' => $user->id, 'name' => $user->name];\n" " }\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:787 +msgid "Using the `as` and `with` methods, you may customize the event's name and data:" +msgstr "" -#: docs/10.x/broadcasting.md:block 248 (header) +# CODE: php +#: ./docs/11.x/broadcasting.md:789 +msgid "Broadcast::on('orders.'.$order->id)\n" +" ->as('OrderPlaced')\n" +" ->with($order)\n" +" ->send();" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:792 +#: ./docs/9.x/broadcasting.md:833 +#: ./docs/10.x/broadcasting.md:895 +#: ./docs/11.x/broadcasting.md:917 +#: ./docs/master/broadcasting.md:915 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:793 +#: ./docs/9.x/broadcasting.md:834 +#: ./docs/10.x/broadcasting.md:896 +#: ./docs/11.x/broadcasting.md:918 +#: ./docs/master/broadcasting.md:916 msgid "Joining Presence Channels" -msgstr "加入 Presence 頻道" +msgstr "" -#: docs/10.x/broadcasting.md:block 249 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:795 +#: ./docs/9.x/broadcasting.md:836 +#: ./docs/10.x/broadcasting.md:898 +#: ./docs/11.x/broadcasting.md:920 +#: ./docs/master/broadcasting.md:918 msgid "To join a presence channel, you may use Echo's `join` method. The `join` method will return a `PresenceChannel` implementation which, along with exposing the `listen` method, allows you to subscribe to the `here`, `joining`, and `leaving` events." -msgstr "若要加入 Presence 頻道,可以使用 Echo 的 `join` 方法。`join` 方法會與所暴露的 `listen` 方法一起回傳一個 `PresenceChannel` 的實作,這樣一來你就能訂閱 `here`, `joining` 以及 `leaving` 事件。" +msgstr "" -#: docs/10.x/broadcasting.md:block 250 (code) +# P +#: ./docs/11.x/broadcasting.md:796 +msgid "The example above will broadcast an event like the following:" +msgstr "" + +# CODE +# CODE: js +#: ./docs/8.x/broadcasting.md:797 +#: ./docs/9.x/broadcasting.md:838 msgid "Echo.join(`chat.${roomId}`)\n" " .here((users) => {\n" -" // ...\n" -" })\n" -" .joining((user) => {\n" -" console.log(user.name);\n" -" })\n" -" .leaving((user) => {\n" -" console.log(user.name);\n" -" })\n" -" .error((error) => {\n" -" console.error(error);\n" -" });\n" -msgstr "Echo.join(`chat.${roomId}`)\n" -" .here((users) => {\n" -" // ...\n" +" //\n" " })\n" " .joining((user) => {\n" " console.log(user.name);\n" @@ -1450,1225 +3560,647 @@ msgstr "Echo.join(`chat.${roomId}`)\n" " })\n" " .error((error) => {\n" " console.error(error);\n" -" });\n" +" });" +msgstr "" -#: docs/10.x/broadcasting.md:block 251 (paragraph) -msgid "The `here` callback will be executed immediately once the channel is joined successfully, and will receive an array containing the user information for all of the other users currently subscribed to the channel. The `joining` method will be executed when a new user joins a channel, while the `leaving` method will be executed when a user leaves the channel. The `error` method will be executed when the authentication endpoint returns a HTTP status code other than 200 or if there is a problem parsing the returned JSON." -msgstr "`here` 回呼會在成功加入頻道後被立即執行,並會收到包含所有其他目前訂閱該頻道的使用者資訊。`joining` 方法會在有新使用者加入頻道時被執行,而 `leaving` 則會在有使用者離開時被執行。`error` 方法會在認證 Endpoint 回傳除了 200 以外的 HTTP 狀態時、或是解析回傳的 JSON 時有問題時被執行。" +# CODE: json +#: ./docs/11.x/broadcasting.md:798 +msgid "{\n" +" \"event\": \"OrderPlaced\",\n" +" \"data\": \"{ id: 1, total: 100 }\",\n" +" \"channel\": \"orders.1\"\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 253 (header) -msgid "Broadcasting To Presence Channels" -msgstr "廣播至 Presence 頻道" +# P +#: ./docs/11.x/broadcasting.md:806 +msgid "If you would like to broadcast the anonymous event on a private or presence channel, you may utilize the `private` and `presence` methods:" +msgstr "" -#: docs/10.x/broadcasting.md:block 254 (paragraph) -msgid "Presence channels may receive events just like public or private channels. Using the example of a chatroom, we may want to broadcast `NewMessage` events to the room's presence channel. To do so, we'll return an instance of `PresenceChannel` from the event's `broadcastOn` method:" -msgstr "Presence 頻道可以像公用或私有頻道一樣接收事件。以聊天室為例,我們可能像廣播 `NewMessage` 事件至聊天室的 Presence 頻道。為此,我們可以在事件的 `broadcastOn` 方法內回傳一個 `PresenceChannel` 的實體:" +# CODE: php +#: ./docs/11.x/broadcasting.md:808 +msgid "Broadcast::private('orders.'.$order->id)->send();\n" +"Broadcast::presence('channels.'.$channel->id)->send();" +msgstr "" -#: docs/10.x/broadcasting.md:block 255 (code) -msgid "/**\n" -" * Get the channels the event should broadcast on.\n" -" *\n" -" * @return array\n" -" */\n" -"public function broadcastOn(): array\n" -"{\n" -" return [\n" -" new PresenceChannel('chat.'.$this->message->room_id),\n" -" ];\n" -"}\n" -msgstr "/**\n" +# H3 +#: ./docs/10.x/broadcasting.md:809 +#: ./docs/11.x/broadcasting.md:831 +#: ./docs/master/broadcasting.md:829 +msgid "Listening for Events" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:811 +#: ./docs/9.x/broadcasting.md:854 +msgid "The `here` callback will be executed immediately once the channel is joined successfully, and will receive an array containing the user information for all of the other users currently subscribed to the channel. The `joining` method will be executed when a new user joins a channel, while the `leaving` method will be executed when a user leaves the channel. The `error` method will be executed when the authentication endpoint returns a HTTP status code other than 200 or if there is a problem parsing the returned JSON." +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:813 +msgid "Broadcasting an anonymous event using the `send` method dispatches the event to your application's [queue](/docs/{{version}}/queues) for processing. However, if you would like to broadcast the event immediately, you may use the `sendNow` method:" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:813 +#: ./docs/9.x/broadcasting.md:856 +#: ./docs/10.x/broadcasting.md:918 +#: ./docs/11.x/broadcasting.md:940 +#: ./docs/master/broadcasting.md:938 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:814 +#: ./docs/9.x/broadcasting.md:857 +msgid "Broadcasting To Presence Channels" +msgstr "" + +# CODE: php +#: ./docs/11.x/broadcasting.md:815 +msgid "Broadcast::on('orders.'.$order->id)->sendNow();" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:816 +#: ./docs/9.x/broadcasting.md:859 +#: ./docs/10.x/broadcasting.md:921 +#: ./docs/11.x/broadcasting.md:943 +#: ./docs/master/broadcasting.md:941 +msgid "Presence channels may receive events just like public or private channels. Using the example of a chatroom, we may want to broadcast `NewMessage` events to the room's presence channel. To do so, we'll return an instance of `PresenceChannel` from the event's `broadcastOn` method:" +msgstr "" + +# CODE +#: ./docs/8.x/broadcasting.md:818 +#: ./docs/9.x/broadcasting.md:861 +msgid "/**\n" " * Get the channels the event should broadcast on.\n" " *\n" -" * @return array\n" +" * @return Channel|array\n" " */\n" -"public function broadcastOn(): array\n" +"public function broadcastOn()\n" "{\n" -" return [\n" -" new PresenceChannel('chat.'.$this->message->room_id),\n" -" ];\n" -"}\n" +" return new PresenceChannel('room.'.$this->message->room_id);\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:819 +msgid "To broadcast the event to all channel subscribers except the currently authenticated user, you can invoke the `toOthers` method:" +msgstr "" -#: docs/10.x/broadcasting.md:block 256 (paragraph) +# CODE: php +#: ./docs/11.x/broadcasting.md:821 +msgid "Broadcast::on('orders.'.$order->id)\n" +" ->toOthers()\n" +" ->send();" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:828 +#: ./docs/9.x/broadcasting.md:871 +#: ./docs/10.x/broadcasting.md:935 +#: ./docs/11.x/broadcasting.md:957 +#: ./docs/master/broadcasting.md:955 msgid "As with other events, you may use the `broadcast` helper and the `toOthers` method to exclude the current user from receiving the broadcast:" -msgstr "與其他事件一樣,可以使用 `broadcast` 輔助函式與 `toOthers` 方法來排除目前使用者接收該 Broadcast:" +msgstr "" + +# H4 +#: ./docs/10.x/broadcasting.md:830 +#: ./docs/11.x/broadcasting.md:852 +#: ./docs/master/broadcasting.md:850 +msgid "Stop Listening for Events" +msgstr "" -#: docs/10.x/broadcasting.md:block 257 (code) +# CODE +#: ./docs/8.x/broadcasting.md:830 +#: ./docs/9.x/broadcasting.md:873 +#: ./docs/10.x/broadcasting.md:937 +#: ./docs/11.x/broadcasting.md:959 +#: ./docs/master/broadcasting.md:957 msgid "broadcast(new NewMessage($message));\n\n" -"broadcast(new NewMessage($message))->toOthers();\n" -msgstr "broadcast(new NewMessage($message));\n\n" -"broadcast(new NewMessage($message))->toOthers();\n" +"broadcast(new NewMessage($message))->toOthers();" +msgstr "" -#: docs/10.x/broadcasting.md:block 258 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:834 +#: ./docs/9.x/broadcasting.md:877 +#: ./docs/10.x/broadcasting.md:941 +#: ./docs/11.x/broadcasting.md:963 +#: ./docs/master/broadcasting.md:961 msgid "As typical of other types of events, you may listen for events sent to presence channels using Echo's `listen` method:" -msgstr "與其他一般的事件一樣,也可以使用 Echo 的 `listen` 方法來監聽傳送到 Presence 頻道的事件:" +msgstr "" -#: docs/10.x/broadcasting.md:block 259 (code) +# CODE +#: ./docs/8.x/broadcasting.md:836 msgid "Echo.join(`chat.${roomId}`)\n" -" .here(/* ... */)\n" -" .joining(/* ... */)\n" -" .leaving(/* ... */)\n" -" .listen('NewMessage', (e) => {\n" -" // ...\n" -" });\n" -msgstr "Echo.join(`chat.${roomId}`)\n" -" .here(/* ... */)\n" -" .joining(/* ... */)\n" -" .leaving(/* ... */)\n" +" .here(...)\n" +" .joining(...)\n" +" .leaving(...)\n" " .listen('NewMessage', (e) => {\n" -" // ...\n" -" });\n" +" //\n" +" });" +msgstr "" + +# H3 +#: ./docs/10.x/broadcasting.md:840 +#: ./docs/11.x/broadcasting.md:862 +#: ./docs/master/broadcasting.md:860 +msgid "Leaving a Channel" +msgstr "" -#: docs/10.x/broadcasting.md:block 261 (header) +# P +#: ./docs/8.x/broadcasting.md:844 +#: ./docs/9.x/broadcasting.md:889 +#: ./docs/10.x/broadcasting.md:953 +#: ./docs/11.x/broadcasting.md:975 +#: ./docs/master/broadcasting.md:973 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/broadcasting.md:845 +#: ./docs/9.x/broadcasting.md:890 +#: ./docs/10.x/broadcasting.md:954 +#: ./docs/11.x/broadcasting.md:976 +#: ./docs/master/broadcasting.md:974 msgid "Model Broadcasting" -msgstr "Model 廣播" +msgstr "" -#: docs/10.x/broadcasting.md:block 262 (quote) -msgid "**Warning** Before reading the following documentation about model broadcasting, we recommend you become familiar with the general concepts of Laravel's model broadcasting services as well as how to manually create and listen to broadcast events." -msgstr "**Warning** 在進一步閱讀有關 Model 廣播的說明文件前,我們建議讀者先瞭解有關 Laravel 的 Model 廣播服務以及如何手動建立並監聽廣播時間的一般概念。" +# P +#: ./docs/8.x/broadcasting.md:847 +#: ./docs/9.x/broadcasting.md:893 +#: ./docs/10.x/broadcasting.md:957 +#: ./docs/11.x/broadcasting.md:979 +#: ./docs/master/broadcasting.md:977 +msgid "Before reading the following documentation about model broadcasting, we recommend you become familiar with the general concepts of Laravel's model broadcasting services as well as how to manually create and listen to broadcast events." +msgstr "" -#: docs/10.x/broadcasting.md:block 263 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:849 +#: ./docs/9.x/broadcasting.md:895 +#: ./docs/10.x/broadcasting.md:959 +#: ./docs/11.x/broadcasting.md:981 +#: ./docs/master/broadcasting.md:979 msgid "It is common to broadcast events when your application's [Eloquent models](/docs/{{version}}/eloquent) are created, updated, or deleted. Of course, this can easily be accomplished by manually [defining custom events for Eloquent model state changes](/docs/{{version}}/eloquent#events) and marking those events with the `ShouldBroadcast` interface." -msgstr "在專案的 [Eloquent Model](/docs/{{version}}/eloquent) 被建立、更新、或刪除時,我們常常會廣播事件。當然,我們可以手動[為 Eloquent Model 的狀態更改定義自訂事件](/docs/{{version}}/eloquent#events)並將這些事件標記為 `ShouldBroadcast` 來輕鬆達成:" +msgstr "" -#: docs/10.x/broadcasting.md:block 264 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:851 +#: ./docs/9.x/broadcasting.md:897 +#: ./docs/10.x/broadcasting.md:961 +#: ./docs/11.x/broadcasting.md:983 +#: ./docs/master/broadcasting.md:981 msgid "However, if you are not using these events for any other purposes in your application, it can be cumbersome to create event classes for the sole purpose of broadcasting them. To remedy this, Laravel allows you to indicate that an Eloquent model should automatically broadcast its state changes." -msgstr "不過,我們讓事件在專案中負責其他功能,那麼如果只建立一個用來廣播的事件就很麻煩。為了解決這個問題,再 Laravel 中,我們可以讓 Eloquent Model 自動將其狀態更改廣播出去:" +msgstr "" -#: docs/10.x/broadcasting.md:block 265 (paragraph) -msgid "To get started, your Eloquent model should use the `Illuminate\\Database\\Eloquent\\BroadcastsEvents` trait. In addition, the model should define a `broadcastOn` method, which will return an array of channels that the model's events should broadcast on:" -msgstr "要開始設定自動廣播,應在 Eloquent Model 上使用 `Illuminate\\Database\\Eloquent\\BroadcastsEvents` Trait。此外,該 Model 應定義一個 `broadcastOn` 方法,並在其中回傳一組包含頻道名稱的陣列,以供 Model 事件廣播:" +# P +#: ./docs/8.x/broadcasting.md:853 +msgid "To get started, your Eloquent model should use the `Illuminate\\Database\\Eloquent\\BroadcastsEvents` trait. In addition, the model should define a `broadcastsOn` method, which will return an array of channels that the model's events should broadcast on:" +msgstr "" -#: docs/10.x/broadcasting.md:block 266 (code) +# CODE: php +#: ./docs/8.x/broadcasting.md:855 +#: ./docs/9.x/broadcasting.md:901 msgid "belongsTo(User::class);\n" " }\n\n" " /**\n" " * Get the channels that model events should broadcast on.\n" " *\n" -" * @return array\n" +" * @param string $event\n" +" * @return \\Illuminate\\Broadcasting\\Channel|array\n" " */\n" -" public function broadcastOn(string $event): array\n" +" public function broadcastOn($event)\n" " {\n" " return [$this, $this->user];\n" " }\n" -"}\n" -msgstr "belongsTo(User::class);\n" -" }\n\n" -" /**\n" -" * Get the channels that model events should broadcast on.\n" -" *\n" -" * @return array\n" -" */\n" -" public function broadcastOn(string $event): array\n" -" {\n" -" return [$this, $this->user];\n" +"}" +msgstr "" + +# CODE: js +#: ./docs/10.x/broadcasting.md:868 +#: ./docs/11.x/broadcasting.md:890 +#: ./docs/master/broadcasting.md:888 +msgid "Echo.channel('orders')\n" +" .listen('.Namespace\\\\Event\\\\Class', (e) => {\n" +" // ...\n" +" });" +msgstr "" + +# CODE: js +#: ./docs/9.x/broadcasting.md:879 +msgid "Echo.join(`chat.${roomId}`)\n" +" .here(/* ... */)\n" +" .joining(/* ... */)\n" +" .leaving(/* ... */)\n" +" .listen('NewMessage', (e) => {\n" +" //\n" +" });" +msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:887 +#: ./docs/11.x/broadcasting.md:909 +#: ./docs/master/broadcasting.md:907 +msgid "use App\\Models\\User;\n\n" +"Broadcast::channel('chat.{roomId}', function (User $user, int $roomId) {\n" +" if ($user->canJoinRoom($roomId)) {\n" +" return ['id' => $user->id, 'name' => $user->name];\n" " }\n" -"}\n" +"});" +msgstr "" -#: docs/10.x/broadcasting.md:block 267 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:890 +#: ./docs/9.x/broadcasting.md:936 +#: ./docs/10.x/broadcasting.md:1001 +#: ./docs/11.x/broadcasting.md:1023 +#: ./docs/master/broadcasting.md:1021 msgid "Once your model includes this trait and defines its broadcast channels, it will begin automatically broadcasting events when a model instance is created, updated, deleted, trashed, or restored." -msgstr "再 Model 中包含該 Trait 並定義好廣播頻道後,當 Model 實體被建立、更新、刪除、軟刪除、或是取消軟刪除後自動廣播事件。" +msgstr "" -#: docs/10.x/broadcasting.md:block 268 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:892 +#: ./docs/9.x/broadcasting.md:938 +#: ./docs/10.x/broadcasting.md:1003 +#: ./docs/11.x/broadcasting.md:1025 +#: ./docs/master/broadcasting.md:1023 msgid "In addition, you may have noticed that the `broadcastOn` method receives a string `$event` argument. This argument contains the type of event that has occurred on the model and will have a value of `created`, `updated`, `deleted`, `trashed`, or `restored`. By inspecting the value of this variable, you may determine which channels (if any) the model should broadcast to for a particular event:" -msgstr "此外,讀者可能已經發現,`broadcastOn` 方法接收了一個字串的 `$event` 引述。這個引述包含了 Model 上所發生的事件,其值為 `created`, `updated`, `deleted`, `trashed`, 或 `restored`。只要檢查這個變數的值,就可以用來判斷對於特定事件要廣播道哪個頻道(若有的話):" +msgstr "" -#: docs/10.x/broadcasting.md:block 269 (code) +# CODE: php +#: ./docs/8.x/broadcasting.md:894 +#: ./docs/9.x/broadcasting.md:940 msgid "/**\n" " * Get the channels that model events should broadcast on.\n" " *\n" -" * @return array>\n" -" */\n" -"public function broadcastOn(string $event): array\n" -"{\n" -" return match ($event) {\n" -" 'deleted' => [],\n" -" default => [$this, $this->user],\n" -" };\n" -"}\n" -msgstr "/**\n" -" * Get the channels that model events should broadcast on.\n" -" *\n" -" * @return array>\n" +" * @param string $event\n" +" * @return \\Illuminate\\Broadcasting\\Channel|array\n" " */\n" -"public function broadcastOn(string $event): array\n" +"public function broadcastOn($event)\n" "{\n" " return match ($event) {\n" " 'deleted' => [],\n" " default => [$this, $this->user],\n" " };\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/broadcasting.md:899 +#: ./docs/10.x/broadcasting.md:963 +#: ./docs/11.x/broadcasting.md:985 +#: ./docs/master/broadcasting.md:983 +msgid "To get started, your Eloquent model should use the `Illuminate\\Database\\Eloquent\\BroadcastsEvents` trait. In addition, the model should define a `broadcastOn` method, which will return an array of channels that the model's events should broadcast on:" +msgstr "" + +# CODE: js +#: ./docs/10.x/broadcasting.md:900 +#: ./docs/11.x/broadcasting.md:922 +#: ./docs/master/broadcasting.md:920 +msgid "Echo.join(`chat.${roomId}`)\n" +" .here((users) => {\n" +" // ...\n" +" })\n" +" .joining((user) => {\n" +" console.log(user.name);\n" +" })\n" +" .leaving((user) => {\n" +" console.log(user.name);\n" +" })\n" +" .error((error) => {\n" +" console.error(error);\n" +" });" +msgstr "" -#: docs/10.x/broadcasting.md:block 271 (header) +# P +#: ./docs/8.x/broadcasting.md:910 +#: ./docs/9.x/broadcasting.md:956 +#: ./docs/10.x/broadcasting.md:1020 +#: ./docs/11.x/broadcasting.md:1042 +#: ./docs/master/broadcasting.md:1040 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:911 +#: ./docs/9.x/broadcasting.md:957 +#: ./docs/10.x/broadcasting.md:1021 +#: ./docs/11.x/broadcasting.md:1043 +#: ./docs/master/broadcasting.md:1041 msgid "Customizing Model Broadcasting Event Creation" -msgstr "自訂 Model 廣播的事件建立" +msgstr "" -#: docs/10.x/broadcasting.md:block 272 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:913 +#: ./docs/9.x/broadcasting.md:959 +#: ./docs/10.x/broadcasting.md:1023 +#: ./docs/11.x/broadcasting.md:1045 +#: ./docs/master/broadcasting.md:1043 msgid "Occasionally, you may wish to customize how Laravel creates the underlying model broadcasting event. You may accomplish this by defining a `newBroadcastableEvent` method on your Eloquent model. This method should return an `Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred` instance:" -msgstr "有時候,我們可能會想自訂 Laravel 要如何建立 Model 廣播時使用的事件。為此,我們可以通過在 Eloquent Model 上定義一個 `newBroadcastableEvent` 來達成。該方法應回傳 `Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred` 實體:" +msgstr "" -#: docs/10.x/broadcasting.md:block 273 (code) -msgid "use Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred;\n\n" +# CODE: php +#: ./docs/8.x/broadcasting.md:915 +msgid "use Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred\n\n" "/**\n" " * Create a new broadcastable model event for the model.\n" +" *\n" +" * @param string $event\n" +" * @return \\Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred\n" " */\n" -"protected function newBroadcastableEvent(string $event): BroadcastableModelEventOccurred\n" +"protected function newBroadcastableEvent($event)\n" "{\n" " return (new BroadcastableModelEventOccurred(\n" " $this, $event\n" " ))->dontBroadcastToCurrentUser();\n" -"}\n" -msgstr "use Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred;\n\n" -"/**\n" -" * Create a new broadcastable model event for the model.\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:916 +#: ./docs/11.x/broadcasting.md:938 +#: ./docs/master/broadcasting.md:936 +msgid "The `here` callback will be executed immediately once the channel is joined successfully, and will receive an array containing the user information for all of the other users currently subscribed to the channel. The `joining` method will be executed when a new user joins a channel, while the `leaving` method will be executed when a user leaves the channel. The `error` method will be executed when the authentication endpoint returns an HTTP status code other than 200 or if there is a problem parsing the returned JSON." +msgstr "" + +# H3 +#: ./docs/10.x/broadcasting.md:919 +#: ./docs/11.x/broadcasting.md:941 +#: ./docs/master/broadcasting.md:939 +msgid "Broadcasting to Presence Channels" +msgstr "" + +# CODE +#: ./docs/10.x/broadcasting.md:923 +#: ./docs/11.x/broadcasting.md:945 +#: ./docs/master/broadcasting.md:943 +msgid "/**\n" +" * Get the channels the event should broadcast on.\n" +" *\n" +" * @return array\n" " */\n" -"protected function newBroadcastableEvent(string $event): BroadcastableModelEventOccurred\n" +"public function broadcastOn(): array\n" "{\n" -" return (new BroadcastableModelEventOccurred(\n" -" $this, $event\n" -" ))->dontBroadcastToCurrentUser();\n" -"}\n" +" return [\n" +" new PresenceChannel('chat.'.$this->message->room_id),\n" +" ];\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 275 (header) +# P +#: ./docs/8.x/broadcasting.md:932 +#: ./docs/9.x/broadcasting.md:978 +#: ./docs/10.x/broadcasting.md:1039 +#: ./docs/11.x/broadcasting.md:1061 +#: ./docs/master/broadcasting.md:1059 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:933 +#: ./docs/9.x/broadcasting.md:979 +#: ./docs/10.x/broadcasting.md:1040 +#: ./docs/11.x/broadcasting.md:1062 +#: ./docs/master/broadcasting.md:1060 msgid "Model Broadcasting Conventions" -msgstr "Model 廣播慣例" +msgstr "" -#: docs/10.x/broadcasting.md:block 277 (header) +# P +#: ./docs/8.x/broadcasting.md:935 +#: ./docs/9.x/broadcasting.md:981 +#: ./docs/10.x/broadcasting.md:1042 +#: ./docs/11.x/broadcasting.md:1064 +#: ./docs/master/broadcasting.md:1062 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:936 +#: ./docs/9.x/broadcasting.md:982 +#: ./docs/10.x/broadcasting.md:1043 +#: ./docs/11.x/broadcasting.md:1065 +#: ./docs/master/broadcasting.md:1063 msgid "Channel Conventions" -msgstr "頻道慣例" +msgstr "" -#: docs/10.x/broadcasting.md:block 278 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:938 +#: ./docs/9.x/broadcasting.md:984 +#: ./docs/10.x/broadcasting.md:1045 +#: ./docs/11.x/broadcasting.md:1067 +#: ./docs/master/broadcasting.md:1065 msgid "As you may have noticed, the `broadcastOn` method in the model example above did not return `Channel` instances. Instead, Eloquent models were returned directly. If an Eloquent model instance is returned by your model's `broadcastOn` method (or is contained in an array returned by the method), Laravel will automatically instantiate a private channel instance for the model using the model's class name and primary key identifier as the channel name." -msgstr "讀者可能已經發現,在上方的 Model 範例中,`broadcastOn` 方法並沒有回傳 `Channel` 實體,而是直接回傳 Eloquent Model。若 Model 的 `broadcastOn` 方法回傳的是 Model 實體 (或是包含 Model 實體的陣列),則 Laravel 會使用該 Model 的類別名稱與主索引鍵識別元作為頻道名稱,自動為該 Model 初始化一個私人頻道。" +msgstr "" -#: docs/10.x/broadcasting.md:block 279 (paragraph) +# P +#: ./docs/8.x/broadcasting.md:940 +#: ./docs/9.x/broadcasting.md:986 msgid "So, an `App\\Models\\User` model with an `id` of `1` would be converted into a `Illuminate\\Broadcasting\\PrivateChannel` instance with a name of `App.Models.User.1`. Of course, in addition to returning Eloquent model instances from your model's `broadcastOn` method, you may return complete `Channel` instances in order to have full control over the model's channel names:" -msgstr "因此,`id` 為 `1` 的 `App\\Models\\User` Model 會被轉換為一個名稱是 `App.Models.User.1` 的 `Illuminate\\Broadcasting\\PrivateChannel` 實體。當然,除了從 Model 的 `broadcastOn` 方法內回傳 Eloquent Model 實體外,也可以回傳一個完整的 `Channel` 實體來取得對 Model 的頻道名稱的完整控制權:" +msgstr "" -#: docs/10.x/broadcasting.md:block 280 (code) +# CODE: php +#: ./docs/8.x/broadcasting.md:942 +#: ./docs/9.x/broadcasting.md:988 msgid "use Illuminate\\Broadcasting\\PrivateChannel;\n\n" "/**\n" " * Get the channels that model events should broadcast on.\n" " *\n" -" * @return array\n" -" */\n" -"public function broadcastOn(string $event): array\n" -"{\n" -" return [\n" -" new PrivateChannel('user.'.$this->id)\n" -" ];\n" -"}\n" -msgstr "use Illuminate\\Broadcasting\\PrivateChannel;\n\n" -"/**\n" -" * Get the channels that model events should broadcast on.\n" -" *\n" -" * @return array\n" +" * @param string $event\n" +" * @return \\Illuminate\\Broadcasting\\Channel|array\n" " */\n" -"public function broadcastOn(string $event): array\n" +"public function broadcastOn($event)\n" "{\n" -" return [\n" -" new PrivateChannel('user.'.$this->id)\n" -" ];\n" -"}\n" - -#: docs/10.x/broadcasting.md:block 281 (paragraph) -msgid "If you plan to explicitly return a channel instance from your model's `broadcastOn` method, you may pass an Eloquent model instance to the channel's constructor. When doing so, Laravel will use the model channel conventions discussed above to convert the Eloquent model into a channel name string:" -msgstr "若有打算要從 Model 的 `broadcastOn` 方法內明顯回傳頻道實體,則可以將 Eloquent Model 實體傳入該頻道的建構函式。這樣一來,Laravel 就可以通過剛才提到的 Model 頻道慣例來將 Eloquent Model 轉換為頻道名稱字串:" - -#: docs/10.x/broadcasting.md:block 282 (code) -msgid "return [new Channel($this->user)];\n" -msgstr "return [new Channel($this->user)];\n" - -#: docs/10.x/broadcasting.md:block 283 (paragraph) -msgid "If you need to determine the channel name of a model, you may call the `broadcastChannel` method on any model instance. For example, this method returns the string `App.Models.User.1` for an `App\\Models\\User` model with an `id` of `1`:" -msgstr "若想判斷某個 Model 的頻道名稱,可以在任何 Model 實體上呼叫 `broadcastChannel` 方法。舉例來說,對於一個 `id` 為 `1` 的 `App\\Models\\User` Model,該方法會回傳一個字串 `App.Models.User.1`:" - -#: docs/10.x/broadcasting.md:block 284 (code) -msgid "$user->broadcastChannel()\n" -msgstr "$user->broadcastChannel()\n" - -#: docs/10.x/broadcasting.md:block 286 (header) -msgid "Event Conventions" -msgstr "事件慣例" - -#: docs/10.x/broadcasting.md:block 287 (paragraph) -msgid "Since model broadcast events are not associated with an \"actual\" event within your application's `App\\Events` directory, they are assigned a name and a payload based on conventions. Laravel's convention is to broadcast the event using the class name of the model (not including the namespace) and the name of the model event that triggered the broadcast." -msgstr "由於 Model 廣播事件並不與專案的 `App\\Events` 目錄內的「真實」事件有關,這些事件只會依據慣例來指派名稱與 Payload (裝載)。Laravel 的慣例就是使用 Model 的類別名稱 (不含 Namespace) 與觸發廣播的 Model 事件來廣播。" - -#: docs/10.x/broadcasting.md:block 288 (paragraph) -msgid "So, for example, an update to the `App\\Models\\Post` model would broadcast an event to your client-side application as `PostUpdated` with the following payload:" -msgstr "因此,對 `App\\Models\\Post` Model 進行更新,會將 `PostUpdated` 事件與下列 Payload 廣播到用戶端:" +" return [new PrivateChannel('user.'.$this->id)];\n" +"}" +msgstr "" -#: docs/10.x/broadcasting.md:block 289 (code) -msgid "{\n" -" \"model\": {\n" -" \"id\": 1,\n" -" \"title\": \"My first post\"\n" -" ...\n" -" },\n" -" ...\n" -" \"socket\": \"someSocketId\",\n" -"}\n" -msgstr "{\n" -" \"model\": {\n" -" \"id\": 1,\n" -" \"title\": \"My first post\"\n" -" ...\n" -" },\n" -" ...\n" -" \"socket\": \"someSocketId\",\n" -"}\n" +# CODE: js +#: ./docs/10.x/broadcasting.md:943 +#: ./docs/11.x/broadcasting.md:965 +#: ./docs/master/broadcasting.md:963 +msgid "Echo.join(`chat.${roomId}`)\n" +" .here(/* ... */)\n" +" .joining(/* ... */)\n" +" .leaving(/* ... */)\n" +" .listen('NewMessage', (e) => {\n" +" // ...\n" +" });" +msgstr "" -#: docs/10.x/broadcasting.md:block 290 (paragraph) -msgid "The deletion of the `App\\Models\\User` model would broadcast an event named `UserDeleted`." -msgstr "刪除 `App\\Models\\Post` Model 時廣播的事件名稱會是 `UserDeleted`。" +# P +#: ./docs/8.x/broadcasting.md:957 +#: ./docs/9.x/broadcasting.md:1003 +#: ./docs/10.x/broadcasting.md:1065 +#: ./docs/11.x/broadcasting.md:1087 +#: ./docs/master/broadcasting.md:1085 +msgid "If you plan to explicitly return a channel instance from your model's `broadcastOn` method, you may pass an Eloquent model instance to the channel's constructor. When doing so, Laravel will use the model channel conventions discussed above to convert the Eloquent model into a channel name string:" +msgstr "" -#: docs/10.x/broadcasting.md:block 291 (paragraph) -msgid "If you would like, you may define a custom broadcast name and payload by adding a `broadcastAs` and `broadcastWith` method to your model. These methods receive the name of the model event / operation that is occurring, allowing you to customize the event's name and payload for each model operation. If `null` is returned from the `broadcastAs` method, Laravel will use the model broadcasting event name conventions discussed above when broadcasting the event:" -msgstr "若有需要,也可以通過在 Model 中新增一個 `broadcastAs` 與 `broadcastWith` 方法來自訂廣播的名稱與 Payload。這些方法會收到目前發生的 Model 事件或動作,好讓我們能為不同的 Model 動作自訂事件名稱與 Payload。若在 `broadcastAs` 方法中回傳 `null`,則 Laravel 會使用上方討論過的 Model 廣播事件名稱的慣例來廣播這個事件:" +# CODE: php +#: ./docs/8.x/broadcasting.md:959 +#: ./docs/9.x/broadcasting.md:1005 +#: ./docs/10.x/broadcasting.md:1067 +#: ./docs/11.x/broadcasting.md:1089 +#: ./docs/master/broadcasting.md:1087 +msgid "return [new Channel($this->user)];" +msgstr "" -#: docs/10.x/broadcasting.md:block 292 (code) -msgid "/**\n" -" * The model event's broadcast name.\n" +# CODE: php +#: ./docs/9.x/broadcasting.md:961 +msgid "use Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred;\n\n" +"/**\n" +" * Create a new broadcastable model event for the model.\n" +" *\n" +" * @param string $event\n" +" * @return \\Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred\n" " */\n" -"public function broadcastAs(string $event): string|null\n" +"protected function newBroadcastableEvent($event)\n" "{\n" -" return match ($event) {\n" -" 'created' => 'post.created',\n" -" default => null,\n" -" };\n" -"}\n\n" -"/**\n" -" * Get the data to broadcast for the model.\n" -" *\n" -" * @return array\n" -" */\n" -"public function broadcastWith(string $event): array\n" -"{\n" -" return match ($event) {\n" -" 'created' => ['title' => $this->title],\n" -" default => ['model' => $this],\n" -" };\n" -"}\n" -msgstr "/**\n" -" * The model event's broadcast name.\n" -" */\n" -"public function broadcastAs(string $event): string|null\n" -"{\n" -" return match ($event) {\n" -" 'created' => 'post.created',\n" -" default => null,\n" -" };\n" -"}\n\n" -"/**\n" -" * Get the data to broadcast for the model.\n" -" *\n" -" * @return array\n" -" */\n" -"public function broadcastWith(string $event): array\n" -"{\n" -" return match ($event) {\n" -" 'created' => ['title' => $this->title],\n" -" default => ['model' => $this],\n" -" };\n" -"}\n" - -#: docs/10.x/broadcasting.md:block 294 (header) -msgid "Listening For Model Broadcasts" -msgstr "監聽 Model 廣播" - -#: docs/10.x/broadcasting.md:block 295 (paragraph) -msgid "Once you have added the `BroadcastsEvents` trait to your model and defined your model's `broadcastOn` method, you are ready to start listening for broadcasted model events within your client-side application. Before getting started, you may wish to consult the complete documentation on [listening for events](#listening-for-events)." -msgstr "在 Model 中新增好 `BroadcastsEvents` Trait 並定義好 Model 的 `broadcastOn` 方法後,就可以開始在用戶端中監聽廣播出來的 Model 事件了。在開始前,建議你先閱讀有關[監聽事件](#listening-for-events)的完整說明文件。" - -#: docs/10.x/broadcasting.md:block 296 (paragraph) -msgid "First, use the `private` method to retrieve an instance of a channel, then call the `listen` method to listen for a specified event. Typically, the channel name given to the `private` method should correspond to Laravel's [model broadcasting conventions](#model-broadcasting-conventions)." -msgstr "首先,使用 `private` 方法來取得 Channel 實體,然後呼叫 `listen` 方法來監聽特定的事件。一般來說,傳給 `private` 方法的頻道名稱應與 Laravel 的 [Model 廣播慣例](#model-broadcasting-conventions)相對應。" - -#: docs/10.x/broadcasting.md:block 297 (paragraph) -msgid "Once you have obtained a channel instance, you may use the `listen` method to listen for a particular event. Since model broadcast events are not associated with an \"actual\" event within your application's `App\\Events` directory, the [event name](#model-broadcasting-event-conventions) must be prefixed with a `.` to indicate it does not belong to a particular namespace. Each model broadcast event has a `model` property which contains all of the broadcastable properties of the model:" -msgstr "取得 Channel 實體後,就可以使用 `listen` 方法來監聽特定的事件。由於 Model 廣播事件並不與專案中 `App\\Events` 目錄下的「真實事件」互相關聯,因此,[事件名稱](#model-broadcasting-event-conventions)前應加上一個 `.` 字元,以標識其不屬於特定的命名空間。每個 Model 廣播事件都有一個 `model` 屬性,其中包含了 Model 中所有可廣播的屬性:" - -#: docs/10.x/broadcasting.md:block 298 (code) -msgid "Echo.private(`App.Models.User.${this.user.id}`)\n" -" .listen('.PostUpdated', (e) => {\n" -" console.log(e.model);\n" -" });\n" -msgstr "Echo.private(`App.Models.User.${this.user.id}`)\n" -" .listen('.PostUpdated', (e) => {\n" -" console.log(e.model);\n" -" });\n" - -#: docs/10.x/broadcasting.md:block 300 (header) -msgid "Client Events" -msgstr "用戶端事件" - -#: docs/10.x/broadcasting.md:block 301 (quote) -msgid "**Note** When using [Pusher Channels](https://pusher.com/channels), you must enable the \"Client Events\" option in the \"App Settings\" section of your [application dashboard](https://dashboard.pusher.com/) in order to send client events." -msgstr "**Note** 在使用 [Pusher Channels](https://pusher.com/channels) 時,可以在 [Application Dashboard](https://dashboard.pusher.com/) 內啟用「App Settings」中的「Client Event」,以傳送用戶端事件。" - -#: docs/10.x/broadcasting.md:block 302 (paragraph) -msgid "Sometimes you may wish to broadcast an event to other connected clients without hitting your Laravel application at all. This can be particularly useful for things like \"typing\" notifications, where you want to alert users of your application that another user is typing a message on a given screen." -msgstr "有時候我們可能會想將事件直接廣播給其他連線的用戶端,而不經由 Laravel 端。特別像是如顯示「正在輸入」等通知時,我們只是想告訴使用者網站內的其他使用者正在特定畫面上輸入。" - -#: docs/10.x/broadcasting.md:block 303 (paragraph) -msgid "To broadcast client events, you may use Echo's `whisper` method:" -msgstr "若要廣播用戶端事件,可以使用 Echo 的 `whisper` 方法:" - -#: docs/10.x/broadcasting.md:block 304 (code) -msgid "Echo.private(`chat.${roomId}`)\n" -" .whisper('typing', {\n" -" name: this.user.name\n" -" });\n" -msgstr "Echo.private(`chat.${roomId}`)\n" -" .whisper('typing', {\n" -" name: this.user.name\n" -" });\n" - -#: docs/10.x/broadcasting.md:block 305 (paragraph) -msgid "To listen for client events, you may use the `listenForWhisper` method:" -msgstr "若要監聽用戶端事件,可以使用 `listenForWhisper` 方法:" - -#: docs/10.x/broadcasting.md:block 306 (code) -msgid "Echo.private(`chat.${roomId}`)\n" -" .listenForWhisper('typing', (e) => {\n" -" console.log(e.name);\n" -" });\n" -msgstr "Echo.private(`chat.${roomId}`)\n" -" .listenForWhisper('typing', (e) => {\n" -" console.log(e.name);\n" -" });\n" - -#: docs/10.x/broadcasting.md:block 308 (header) -msgid "Notifications" -msgstr "通知" - -#: docs/10.x/broadcasting.md:block 309 (paragraph) -msgid "By pairing event broadcasting with [notifications](/docs/{{version}}/notifications), your JavaScript application may receive new notifications as they occur without needing to refresh the page. Before getting started, be sure to read over the documentation on using [the broadcast notification channel](/docs/{{version}}/notifications#broadcast-notifications)." -msgstr "只要將事件廣播與 [通知](/docs/{{version}}/notifications) 一起使用,JavaScript 端就可以在不重新整理的情況下接收新通知。在開始前,請先閱讀有關[廣播通知頻道](/docs/{{version}}/notifications#broadcast-notifications)的說明文件。" - -#: docs/10.x/broadcasting.md:block 310 (paragraph) -msgid "Once you have configured a notification to use the broadcast channel, you may listen for the broadcast events using Echo's `notification` method. Remember, the channel name should match the class name of the entity receiving the notifications:" -msgstr "設定讓通知使用廣播頻道後,就可以使用 Echo 的 `notification` 方法來接收廣播。請記住,頻道的名稱應與接收通知的使用者類別名稱相符:" - -#: docs/10.x/broadcasting.md:block 311 (code) -msgid "Echo.private(`App.Models.User.${userId}`)\n" -" .notification((notification) => {\n" -" console.log(notification.type);\n" -" });\n" -msgstr "Echo.private(`App.Models.User.${userId}`)\n" -" .notification((notification) => {\n" -" console.log(notification.type);\n" -" });\n" - -#: docs/10.x/broadcasting.md:block 312 (paragraph) -msgid "In this example, all notifications sent to `App\\Models\\User` instances via the `broadcast` channel would be received by the callback. A channel authorization callback for the `App.Models.User.{id}` channel is included in the default `BroadcastServiceProvider` that ships with the Laravel framework." -msgstr "在此範例中,所有通過 `broadcast` 頻道傳送給 `App\\Models\\User` 實體的通知都會被該回呼收到。用於 `App.Models.User.{id}` 的頻道授權回呼包含在 Laravel 框架附帶的 `BroadcastServiceProvider` 內。" - -#: docs/8.x/broadcasting.md:block 6 (paragraph) -msgid "For example, imagine your application is able to export a user's data to a CSV file and email it to them. However, creating this CSV file takes several minutes so you choose to create and mail the CSV within a [queued job](/docs/{{version}}/queues). When the CSV has been created and mailed to the user, we can use event broadcasting to dispatch a `App\\Events\\UserDataExported` event that is received by our application's JavaScript. Once the event is received, we can display a message to the user that their CSV has been emailed to them without them ever needing to refresh the page." -msgstr "舉例來說,假設我們的 App 可以將使用者資料匯出為 CSV 檔並以電子郵件寄出。不過,建立 CSV 檔需要數分鐘的事件,因此我們選擇將建立與寄送 CSV 檔的程式放在[佇列任務](/docs/{{version}}/queues)中。當 CSV 當建立完畢並寄給使用者後,我們可以使用「事件廣播」來將 `App\\Events\\UserDataExported` 事件分派給應用程式的 JavaScript。收到事件後,使用者就能在不重新整理的情況下看到一個訊息,表示我們已將 CSV 檔寄送出去。" - -#: docs/8.x/broadcasting.md:block 11 (paragraph) -msgid "By default, Laravel includes two server-side broadcasting drivers for you to choose from: [Pusher Channels](https://pusher.com/channels) and [Ably](https://ably.io). However, community driven packages such as [laravel-websockets](https://beyondco.de/docs/laravel-websockets/getting-started/introduction) and [soketi](https://docs.soketi.app/) provide additional broadcasting drivers that do not require commercial broadcasting providers." -msgstr "預設情況下,Laravel 包含了兩個伺服器端廣播 Driver 可供選擇:[Pusher Channels](https://pusher.com/channels) 與 [Ably](https://ably.io)。不過,也有如 [laravel-websockets](https://beyondco.de/docs/laravel-websockets/getting-started/introduction) 與 [soketi](https://docs.soketi.app/) 這樣由社群開發的套件提供不需要商業 Broadcast Provider 的額外 Broadcast Driver。" - -#: docs/8.x/broadcasting.md:block 12 (quote) -msgid "{tip} Before diving into event broadcasting, make sure you have read Laravel's documentation on [events and listeners](/docs/{{version}}/events)." -msgstr "{tip} 在深入探討事件廣播前,請先確保你已閱讀有關 [事件與監聽程式](/docs/{{version}}/events)的 Laravel 說明文件。" - -#: docs/8.x/broadcasting.md:block 41 (paragraph) -msgid "If you plan to broadcast your events using [Ably](https://ably.io), you should install the Ably PHP SDK using the Composer package manager:" -msgstr "若有打算要使用 [Ably](https://ably.io),那麼應通過 Composer 套件管理員來安裝 Ably 的 PHP SDK:" - -#: docs/8.x/broadcasting.md:block 63 (code) -msgid "import Echo from 'laravel-echo';\n\n" -"window.Pusher = require('pusher-js');\n\n" -"window.Echo = new Echo({\n" -" broadcaster: 'pusher',\n" -" key: process.env.MIX_PUSHER_APP_KEY,\n" -" cluster: process.env.MIX_PUSHER_APP_CLUSTER,\n" -" forceTLS: true\n" -"});\n" -msgstr "import Echo from 'laravel-echo';\n\n" -"window.Pusher = require('pusher-js');\n\n" -"window.Echo = new Echo({\n" -" broadcaster: 'pusher',\n" -" key: process.env.MIX_PUSHER_APP_KEY,\n" -" cluster: process.env.MIX_PUSHER_APP_CLUSTER,\n" -" forceTLS: true\n" -"});\n" - -#: docs/8.x/broadcasting.md:block 66 (quote) -msgid "{tip} To learn more about compiling your application's JavaScript assets, please consult the documentation on [Laravel Mix](/docs/{{version}}/mix)." -msgstr "{tip} 要瞭解更多有關編譯應用程式 JavaScript 素材的資訊,請參考 [Laravel Mix](/docs/{{version}}/mix) 中的說明文件。" - -#: docs/8.x/broadcasting.md:block 70 (code) -msgid "import Echo from 'laravel-echo';\n\n" -"const client = require('pusher-js');\n\n" -"window.Echo = new Echo({\n" -" broadcaster: 'pusher',\n" -" key: 'your-pusher-channels-key',\n" -" client: client\n" -"});\n" -msgstr "import Echo from 'laravel-echo';\n\n" -"const client = require('pusher-js');\n\n" -"window.Echo = new Echo({\n" -" broadcaster: 'pusher',\n" -" key: 'your-pusher-channels-key',\n" -" client: client\n" -"});\n" - -#: docs/8.x/broadcasting.md:block 78 (code) -msgid "import Echo from 'laravel-echo';\n\n" -"window.Pusher = require('pusher-js');\n\n" -"window.Echo = new Echo({\n" -" broadcaster: 'pusher',\n" -" key: process.env.MIX_ABLY_PUBLIC_KEY,\n" -" wsHost: 'realtime-pusher.ably.io',\n" -" wsPort: 443,\n" -" disableStats: true,\n" -" encrypted: true,\n" -"});\n" -msgstr "import Echo from 'laravel-echo';\n\n" -"window.Pusher = require('pusher-js');\n\n" -"window.Echo = new Echo({\n" -" broadcaster: 'pusher',\n" -" key: process.env.MIX_ABLY_PUBLIC_KEY,\n" -" wsHost: 'realtime-pusher.ably.io',\n" -" wsPort: 443,\n" -" disableStats: true,\n" -" encrypted: true,\n" -"});\n" - -#: docs/8.x/broadcasting.md:block 79 (paragraph) -msgid "Note that our Ably Echo configuration references a `MIX_ABLY_PUBLIC_KEY` environment variable. This variable's value should be your Ably public key. Your public key is the portion of your Ably key that occurs before the `:` character." -msgstr "請注意,Ably Echo 設定中參考了 `MIX_ABLY_PUBLIC_KEY` 環境變數。這個環境變數應為 Ably 的公開金鑰。公開金鑰就是 Ably 金鑰中出現在 `:` 字元之前的部分。" - -#: docs/8.x/broadcasting.md:block 85 (paragraph) -msgid "Laravel's event broadcasting allows you to broadcast your server-side Laravel events to your client-side JavaScript application using a driver-based approach to WebSockets. Currently, Laravel ships with [Pusher Channels](https://pusher.com/channels) and [Ably](https://ably.io) drivers. The events may be easily consumed on the client-side using the [Laravel Echo](#client-side-installation) JavaScript package." -msgstr "Laravel 的事件廣播功能能讓你以基於 Driver 的方法來將伺服器端的 Laravel 事件通過 WebSockets 廣播到用戶端 JavaScript 上。目前,Laravel 隨附了 [Pusher Channels](https://pusher.com/channels) 與 [Ably](https://ably.io) 兩個 Driver。可以在用戶端使用 [Laravel Echo](#client-side-installation) JavaScript 套件來輕鬆取得事件。" - -#: docs/8.x/broadcasting.md:block 87 (quote) -msgid "{tip} If you would like to explore open source alternatives to Pusher, check out the [open source alternatives](#open-source-alternatives)." -msgstr "{tip} 若想瞭解更多 Pusher 的開放原始碼替代品,請參考[開放原始碼替代](#open-source-alternatives)一節。" - -#: docs/8.x/broadcasting.md:block 96 (code) -msgid "order->id);\n" -"}\n" -msgstr "/**\n" -" * Get the channels the event should broadcast on.\n" -" *\n" -" * @return \\Illuminate\\Broadcasting\\PrivateChannel\n" -" */\n" -"public function broadcastOn()\n" -"{\n" -" return new PrivateChannel('orders.'.$this->order->id);\n" -"}\n" - -#: docs/8.x/broadcasting.md:block 102 (code) -msgid "use App\\Models\\Order;\n\n" -"Broadcast::channel('orders.{orderId}', function ($user, $orderId) {\n" -" return $user->id === Order::findOrNew($orderId)->user_id;\n" -"});\n" -msgstr "use App\\Models\\Order;\n\n" -"Broadcast::channel('orders.{orderId}', function ($user, $orderId) {\n" -" return $user->id === Order::findOrNew($orderId)->user_id;\n" -"});\n" - -#: docs/8.x/broadcasting.md:block 113 (code) -msgid "user = $user;\n" -" }\n\n" -" /**\n" -" * Get the channels the event should broadcast on.\n" -" *\n" -" * @return Channel|array\n" -" */\n" -" public function broadcastOn()\n" -" {\n" -" return new PrivateChannel('user.'.$this->user->id);\n" -" }\n" -"}\n" -msgstr "user = $user;\n" -" }\n\n" -" /**\n" -" * Get the channels the event should broadcast on.\n" -" *\n" -" * @return Channel|array\n" -" */\n" -" public function broadcastOn()\n" -" {\n" -" return new PrivateChannel('user.'.$this->user->id);\n" -" }\n" -"}\n" - -#: docs/8.x/broadcasting.md:block 118 (code) -msgid "/**\n" -" * The event's broadcast name.\n" -" *\n" -" * @return string\n" -" */\n" -"public function broadcastAs()\n" -"{\n" -" return 'server.created';\n" -"}\n" -msgstr "/**\n" -" * The event's broadcast name.\n" -" *\n" -" * @return string\n" -" */\n" -"public function broadcastAs()\n" -"{\n" -" return 'server.created';\n" -"}\n" - -#: docs/8.x/broadcasting.md:block 126 (code) -msgid "/**\n" -" * Get the data to broadcast.\n" -" *\n" -" * @return array\n" -" */\n" -"public function broadcastWith()\n" -"{\n" -" return ['id' => $this->user->id];\n" -"}\n" -msgstr "/**\n" -" * Get the data to broadcast.\n" -" *\n" -" * @return array\n" -" */\n" -"public function broadcastWith()\n" -"{\n" -" return ['id' => $this->user->id];\n" -"}\n" - -#: docs/8.x/broadcasting.md:block 132 (code) -msgid "/**\n" -" * The name of the queue on which to place the broadcasting job.\n" -" *\n" -" * @return string\n" -" */\n" -"public function broadcastQueue()\n" -"{\n" -" return 'default';\n" -"}\n" -msgstr "/**\n" -" * The name of the queue on which to place the broadcasting job.\n" -" *\n" -" * @return string\n" -" */\n" -"public function broadcastQueue()\n" -"{\n" -" return 'default';\n" -"}\n" - -#: docs/8.x/broadcasting.md:block 134 (code) -msgid "order->value > 100;\n" -"}\n" -msgstr "/**\n" -" * Determine if this event should broadcast.\n" -" *\n" -" * @return bool\n" -" */\n" -"public function broadcastWhen()\n" -"{\n" -" return $this->order->value > 100;\n" -"}\n" - -#: docs/8.x/broadcasting.md:block 142 (paragraph) -msgid "If your queue connection's `after_commit` configuration option is set to `false`, you may still indicate that a particular broadcast event should be dispatched after all open database transactions have been committed by defining an `$afterCommit` property on the event class:" -msgstr "若佇列連線的 `after_commit` 設定選項是 `false`,那麼就可以通過在事件類別上定義 `$afterCommit` 屬性來標示出特定的廣播事件應在資料庫 Transaction 被 Commit 後才可進行分派:" - -#: docs/8.x/broadcasting.md:block 143 (code) -msgid " {\n" -" return {\n" -" authorize: (socketId, callback) => {\n" -" axios.post('/api/broadcasting/auth', {\n" -" socket_id: socketId,\n" -" channel_name: channel.name\n" -" })\n" -" .then(response => {\n" -" callback(false, response.data);\n" -" })\n" -" .catch(error => {\n" -" callback(true, error);\n" -" });\n" -" }\n" -" };\n" -" },\n" -"})\n" -msgstr "window.Echo = new Echo({\n" -" // ...\n" -" authorizer: (channel, options) => {\n" -" return {\n" -" authorize: (socketId, callback) => {\n" -" axios.post('/api/broadcasting/auth', {\n" -" socket_id: socketId,\n" -" channel_name: channel.name\n" -" })\n" -" .then(response => {\n" -" callback(false, response.data);\n" -" })\n" -" .catch(error => {\n" -" callback(true, error);\n" -" });\n" -" }\n" -" };\n" -" },\n" -"})\n" - -#: docs/8.x/broadcasting.md:block 165 (code) -msgid "Broadcast::channel('orders.{orderId}', function ($user, $orderId) {\n" -" return $user->id === Order::findOrNew($orderId)->user_id;\n" -"});\n" -msgstr "Broadcast::channel('orders.{orderId}', function ($user, $orderId) {\n" -" return $user->id === Order::findOrNew($orderId)->user_id;\n" -"});\n" - -#: docs/8.x/broadcasting.md:block 171 (code) -msgid "use App\\Models\\Order;\n\n" -"Broadcast::channel('orders.{order}', function ($user, Order $order) {\n" -" return $user->id === $order->user_id;\n" -"});\n" -msgstr "use App\\Models\\Order;\n\n" -"Broadcast::channel('orders.{order}', function ($user, Order $order) {\n" -" return $user->id === $order->user_id;\n" -"});\n" - -#: docs/8.x/broadcasting.md:block 172 (quote) -msgid "{note} Unlike HTTP route model binding, channel model binding does not support automatic [implicit model binding scoping](/docs/{{version}}/routing#implicit-model-binding-scoping). However, this is rarely a problem because most channels can be scoped based on a single model's unique, primary key." -msgstr "{note} 與 HTTP 路由 Model 綁定不同,頻道的 Model 綁定不支援自動[為隱式 Model 綁定加上作用域]。不過,通常來說這不會造成問題,因為大部分的頻道都可以被放置與單一 Model 的獨立主鍵作用域內。" - -#: docs/8.x/broadcasting.md:block 184 (code) -msgid "id === $order->user_id;\n" -" }\n" -"}\n" -msgstr "id === $order->user_id;\n" -" }\n" -"}\n" - -#: docs/8.x/broadcasting.md:block 185 (quote) -msgid "{tip} Like many other classes in Laravel, channel classes will automatically be resolved by the [service container](/docs/{{version}}/container). So, you may type-hint any dependencies required by your channel in its constructor." -msgstr "{tip} 與 Laravel 內其他類別一樣,頻道類別也會自動由 [Service Container](/docs/{{version}}/container) 解析。因此,我們可以在頻道的建構函式上對任何所需要的依賴進行型別提示。" - -#: docs/8.x/broadcasting.md:block 197 (quote) -msgid "{note} Your event must use the `Illuminate\\Broadcasting\\InteractsWithSockets` trait in order to call the `toOthers` method." -msgstr "{note} 若要呼叫 `toOthers` 方法,該事件必須要 use `Illuminate\\Broadcasting\\InteractsWithSockets` Trait。" - -#: docs/8.x/broadcasting.md:block 208 (code) -msgid "broadcastVia('pusher');\n" -" }\n" -"}\n" -msgstr "broadcastVia('pusher');\n" -" }\n" -"}\n" - -#: docs/8.x/broadcasting.md:block 216 (code) -msgid "Echo.private(`orders.${this.order.id}`)\n" -" .listen(...)\n" -" .listen(...)\n" -" .listen(...);\n" -msgstr "Echo.private(`orders.${this.order.id}`)\n" -" .listen(...)\n" -" .listen(...)\n" -" .listen(...);\n" - -#: docs/8.x/broadcasting.md:block 232 (code) -msgid "Echo.channel('orders')\n" -" .listen('.Namespace\\\\Event\\\\Class', (e) => {\n" -" //\n" -" });\n" -msgstr "Echo.channel('orders')\n" -" .listen('.Namespace\\\\Event\\\\Class', (e) => {\n" -" //\n" -" });\n" - -#: docs/8.x/broadcasting.md:block 240 (code) -msgid "Broadcast::channel('chat.{roomId}', function ($user, $roomId) {\n" -" if ($user->canJoinRoom($roomId)) {\n" -" return ['id' => $user->id, 'name' => $user->name];\n" -" }\n" -"});\n" -msgstr "Broadcast::channel('chat.{roomId}', function ($user, $roomId) {\n" -" if ($user->canJoinRoom($roomId)) {\n" -" return ['id' => $user->id, 'name' => $user->name];\n" -" }\n" -"});\n" - -#: docs/8.x/broadcasting.md:block 244 (code) -msgid "Echo.join(`chat.${roomId}`)\n" -" .here((users) => {\n" -" //\n" -" })\n" -" .joining((user) => {\n" -" console.log(user.name);\n" -" })\n" -" .leaving((user) => {\n" -" console.log(user.name);\n" -" })\n" -" .error((error) => {\n" -" console.error(error);\n" -" });\n" -msgstr "Echo.join(`chat.${roomId}`)\n" -" .here((users) => {\n" -" //\n" -" })\n" -" .joining((user) => {\n" -" console.log(user.name);\n" -" })\n" -" .leaving((user) => {\n" -" console.log(user.name);\n" -" })\n" -" .error((error) => {\n" -" console.error(error);\n" -" });\n" - -#: docs/8.x/broadcasting.md:block 249 (code) -msgid "/**\n" -" * Get the channels the event should broadcast on.\n" -" *\n" -" * @return Channel|array\n" -" */\n" -"public function broadcastOn()\n" -"{\n" -" return new PresenceChannel('room.'.$this->message->room_id);\n" -"}\n" -msgstr "/**\n" -" * Get the channels the event should broadcast on.\n" -" *\n" -" * @return Channel|array\n" -" */\n" -"public function broadcastOn()\n" -"{\n" -" return new PresenceChannel('room.'.$this->message->room_id);\n" -"}\n" - -#: docs/8.x/broadcasting.md:block 253 (code) -msgid "Echo.join(`chat.${roomId}`)\n" -" .here(...)\n" -" .joining(...)\n" -" .leaving(...)\n" -" .listen('NewMessage', (e) => {\n" -" //\n" -" });\n" -msgstr "Echo.join(`chat.${roomId}`)\n" -" .here(...)\n" -" .joining(...)\n" -" .leaving(...)\n" -" .listen('NewMessage', (e) => {\n" -" //\n" -" });\n" - -#: docs/8.x/broadcasting.md:block 256 (quote) -msgid "{note} Before reading the following documentation about model broadcasting, we recommend you become familiar with the general concepts of Laravel's model broadcasting services as well as how to manually create and listen to broadcast events." -msgstr "{note} 在進一步閱讀有關 Model 廣播的說明文件前,我們建議讀者先瞭解有關 Laravel 的 Model 廣播服務以及如何手動建立並監聽廣播時間的一般概念。" - -#: docs/8.x/broadcasting.md:block 259 (paragraph) -msgid "To get started, your Eloquent model should use the `Illuminate\\Database\\Eloquent\\BroadcastsEvents` trait. In addition, the model should define a `broadcastsOn` method, which will return an array of channels that the model's events should broadcast on:" -msgstr "要開始設定自動廣播,應在 Eloquent Model 上使用 `Illuminate\\Database\\Eloquent\\BroadcastsEvents` Trait。此外,該 Model 應定義一個 `broadcastsOn` 方法,並在其中回傳一組包含頻道名稱的陣列,以供 Model 事件廣播:" +" return (new BroadcastableModelEventOccurred(\n" +" $this, $event\n" +" ))->dontBroadcastToCurrentUser();\n" +"}" +msgstr "" -#: docs/8.x/broadcasting.md:block 260 (code) -msgid "belongsTo(User::class);\n" -" }\n\n" -" /**\n" -" * Get the channels that model events should broadcast on.\n" -" *\n" -" * @param string $event\n" -" * @return \\Illuminate\\Broadcasting\\Channel|array\n" -" */\n" -" public function broadcastOn($event)\n" -" {\n" -" return [$this, $this->user];\n" -" }\n" -"}\n" -msgstr "belongsTo(User::class);\n" " }\n\n" " /**\n" " * Get the channels that model events should broadcast on.\n" " *\n" -" * @param string $event\n" -" * @return \\Illuminate\\Broadcasting\\Channel|array\n" +" * @return array\n" " */\n" -" public function broadcastOn($event)\n" +" public function broadcastOn(string $event): array\n" " {\n" " return [$this, $this->user];\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/8.x/broadcasting.md:block 263 (code) -msgid "/**\n" -" * Get the channels that model events should broadcast on.\n" -" *\n" -" * @param string $event\n" -" * @return \\Illuminate\\Broadcasting\\Channel|array\n" -" */\n" -"public function broadcastOn($event)\n" -"{\n" -" return match ($event) {\n" -" 'deleted' => [],\n" -" default => [$this, $this->user],\n" -" };\n" -"}\n" -msgstr "/**\n" -" * Get the channels that model events should broadcast on.\n" -" *\n" -" * @param string $event\n" -" * @return \\Illuminate\\Broadcasting\\Channel|array\n" -" */\n" -"public function broadcastOn($event)\n" -"{\n" -" return match ($event) {\n" -" 'deleted' => [],\n" -" default => [$this, $this->user],\n" -" };\n" -"}\n" +# CODE: php +#: ./docs/8.x/broadcasting.md:965 +#: ./docs/9.x/broadcasting.md:1011 +#: ./docs/10.x/broadcasting.md:1073 +#: ./docs/11.x/broadcasting.md:1095 +#: ./docs/master/broadcasting.md:1093 +msgid "$user->broadcastChannel()" +msgstr "" -#: docs/8.x/broadcasting.md:block 267 (code) -msgid "use Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred\n\n" -"/**\n" -" * Create a new broadcastable model event for the model.\n" -" *\n" -" * @param string $event\n" -" * @return \\Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred\n" -" */\n" -"protected function newBroadcastableEvent($event)\n" -"{\n" -" return (new BroadcastableModelEventOccurred(\n" -" $this, $event\n" -" ))->dontBroadcastToCurrentUser();\n" -"}\n" -msgstr "use Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred\n\n" -"/**\n" -" * Create a new broadcastable model event for the model.\n" -" *\n" -" * @param string $event\n" -" * @return \\Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred\n" -" */\n" -"protected function newBroadcastableEvent($event)\n" -"{\n" -" return (new BroadcastableModelEventOccurred(\n" -" $this, $event\n" -" ))->dontBroadcastToCurrentUser();\n" -"}\n" +# P +#: ./docs/8.x/broadcasting.md:969 +#: ./docs/9.x/broadcasting.md:1015 +#: ./docs/10.x/broadcasting.md:1077 +#: ./docs/11.x/broadcasting.md:1099 +#: ./docs/master/broadcasting.md:1097 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/broadcasting.md:970 +#: ./docs/9.x/broadcasting.md:1016 +#: ./docs/10.x/broadcasting.md:1078 +#: ./docs/11.x/broadcasting.md:1100 +#: ./docs/master/broadcasting.md:1098 +msgid "Event Conventions" +msgstr "" -#: docs/8.x/broadcasting.md:block 274 (code) -msgid "use Illuminate\\Broadcasting\\PrivateChannel;\n\n" -"/**\n" -" * Get the channels that model events should broadcast on.\n" -" *\n" -" * @param string $event\n" -" * @return \\Illuminate\\Broadcasting\\Channel|array\n" -" */\n" -"public function broadcastOn($event)\n" -"{\n" -" return [new PrivateChannel('user.'.$this->id)];\n" -"}\n" -msgstr "use Illuminate\\Broadcasting\\PrivateChannel;\n\n" -"/**\n" -" * Get the channels that model events should broadcast on.\n" -" *\n" -" * @param string $event\n" -" * @return \\Illuminate\\Broadcasting\\Channel|array\n" -" */\n" -"public function broadcastOn($event)\n" -"{\n" -" return [new PrivateChannel('user.'.$this->id)];\n" -"}\n" +# P +#: ./docs/8.x/broadcasting.md:972 +#: ./docs/9.x/broadcasting.md:1018 +#: ./docs/10.x/broadcasting.md:1080 +#: ./docs/11.x/broadcasting.md:1102 +#: ./docs/master/broadcasting.md:1100 +msgid "Since model broadcast events are not associated with an \"actual\" event within your application's `App\\Events` directory, they are assigned a name and a payload based on conventions. Laravel's convention is to broadcast the event using the class name of the model (not including the namespace) and the name of the model event that triggered the broadcast." +msgstr "" -#: docs/8.x/broadcasting.md:block 277 (paragraph) -msgid "If you need to determine the channel name of a model, you may call the `broadcastChannel` method on any model instance. For example, this method returns the string `App.Models.User.1` for a `App\\Models\\User` model with an `id` of `1`:" -msgstr "若想判斷某個 Model 的頻道名稱,可以在任何 Model 實體上呼叫 `broadcastChannel` 方法。舉例來說,對於一個 `id` 為 `1` 的 `App\\Models\\User` Model,該方法會回傳一個字串 `App.Models.User.1`:" +# P +#: ./docs/8.x/broadcasting.md:974 +#: ./docs/9.x/broadcasting.md:1020 +#: ./docs/10.x/broadcasting.md:1082 +#: ./docs/11.x/broadcasting.md:1104 +#: ./docs/master/broadcasting.md:1102 +msgid "So, for example, an update to the `App\\Models\\Post` model would broadcast an event to your client-side application as `PostUpdated` with the following payload:" +msgstr "" + +# CODE +# CODE: json +#: ./docs/8.x/broadcasting.md:976 +#: ./docs/9.x/broadcasting.md:1022 +#: ./docs/10.x/broadcasting.md:1084 +#: ./docs/11.x/broadcasting.md:1106 +#: ./docs/master/broadcasting.md:1104 +msgid "{\n" +" \"model\": {\n" +" \"id\": 1,\n" +" \"title\": \"My first post\"\n" +" ...\n" +" },\n" +" ...\n" +" \"socket\": \"someSocketId\",\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:986 +#: ./docs/9.x/broadcasting.md:1034 +#: ./docs/10.x/broadcasting.md:1096 +#: ./docs/11.x/broadcasting.md:1118 +#: ./docs/master/broadcasting.md:1116 +msgid "The deletion of the `App\\Models\\User` model would broadcast an event named `UserDeleted`." +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:988 +#: ./docs/9.x/broadcasting.md:1036 +#: ./docs/10.x/broadcasting.md:1098 +#: ./docs/11.x/broadcasting.md:1120 +#: ./docs/master/broadcasting.md:1118 +msgid "If you would like, you may define a custom broadcast name and payload by adding a `broadcastAs` and `broadcastWith` method to your model. These methods receive the name of the model event / operation that is occurring, allowing you to customize the event's name and payload for each model operation. If `null` is returned from the `broadcastAs` method, Laravel will use the model broadcasting event name conventions discussed above when broadcasting the event:" +msgstr "" -#: docs/8.x/broadcasting.md:block 286 (code) +# CODE: php +#: ./docs/8.x/broadcasting.md:990 +#: ./docs/9.x/broadcasting.md:1038 msgid "/**\n" " * The model event's broadcast name.\n" " *\n" @@ -2694,107 +4226,303 @@ msgid "/**\n" " 'created' => ['title' => $this->title],\n" " default => ['model' => $this],\n" " };\n" -"}\n" -msgstr "/**\n" -" * The model event's broadcast name.\n" -" *\n" -" * @param string $event\n" -" * @return string|null\n" -" */\n" -"public function broadcastAs($event)\n" -"{\n" -" return match ($event) {\n" -" 'created' => 'post.created',\n" -" default => null,\n" -" };\n" -"}\n\n" -"/**\n" -" * Get the data to broadcast for the model.\n" +"}" +msgstr "" + +# CODE: php +#: ./docs/10.x/broadcasting.md:1005 +#: ./docs/11.x/broadcasting.md:1027 +#: ./docs/master/broadcasting.md:1025 +msgid "/**\n" +" * Get the channels that model events should broadcast on.\n" " *\n" -" * @param string $event\n" -" * @return array\n" +" * @return array>\n" " */\n" -"public function broadcastWith($event)\n" +"public function broadcastOn(string $event): array\n" "{\n" " return match ($event) {\n" -" 'created' => ['title' => $this->title],\n" -" default => ['model' => $this],\n" +" 'deleted' => [],\n" +" default => [$this, $this->user],\n" " };\n" -"}\n" +"}" +msgstr "" -#: docs/8.x/broadcasting.md:block 295 (quote) -msgid "{tip} When using [Pusher Channels](https://pusher.com/channels), you must enable the \"Client Events\" option in the \"App Settings\" section of your [application dashboard](https://dashboard.pusher.com/) in order to send client events." -msgstr "{tip} 在使用 [Pusher Channels](https://pusher.com/channels) 時,可以在 [Application Dashboard](https://dashboard.pusher.com/) 內啟用「App Settings」中的「Client Event」,以傳送用戶端事件。" +# P +#: ./docs/8.x/broadcasting.md:1020 +#: ./docs/9.x/broadcasting.md:1068 +#: ./docs/10.x/broadcasting.md:1126 +#: ./docs/11.x/broadcasting.md:1148 +#: ./docs/master/broadcasting.md:1146 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/broadcasting.md:1021 +#: ./docs/9.x/broadcasting.md:1069 +msgid "Listening For Model Broadcasts" +msgstr "" -#: docs/9.x/broadcasting.md:block 253 (code) -msgid "Echo.join(`chat.${roomId}`)\n" -" .here(/* ... */)\n" -" .joining(/* ... */)\n" -" .leaving(/* ... */)\n" -" .listen('NewMessage', (e) => {\n" -" //\n" -" });\n" -msgstr "Echo.join(`chat.${roomId}`)\n" -" .here(/* ... */)\n" -" .joining(/* ... */)\n" -" .leaving(/* ... */)\n" -" .listen('NewMessage', (e) => {\n" -" //\n" -" });\n" +# P +#: ./docs/8.x/broadcasting.md:1023 +#: ./docs/9.x/broadcasting.md:1071 +#: ./docs/10.x/broadcasting.md:1129 +#: ./docs/11.x/broadcasting.md:1151 +#: ./docs/master/broadcasting.md:1149 +msgid "Once you have added the `BroadcastsEvents` trait to your model and defined your model's `broadcastOn` method, you are ready to start listening for broadcasted model events within your client-side application. Before getting started, you may wish to consult the complete documentation on [listening for events](#listening-for-events)." +msgstr "" -#: docs/9.x/broadcasting.md:block 267 (code) +# CODE: php +#: ./docs/10.x/broadcasting.md:1025 +#: ./docs/11.x/broadcasting.md:1047 +#: ./docs/master/broadcasting.md:1045 msgid "use Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred;\n\n" "/**\n" " * Create a new broadcastable model event for the model.\n" -" *\n" -" * @param string $event\n" -" * @return \\Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred\n" " */\n" -"protected function newBroadcastableEvent($event)\n" +"protected function newBroadcastableEvent(string $event): BroadcastableModelEventOccurred\n" "{\n" " return (new BroadcastableModelEventOccurred(\n" " $this, $event\n" " ))->dontBroadcastToCurrentUser();\n" -"}\n" -msgstr "use Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred;\n\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:1025 +#: ./docs/9.x/broadcasting.md:1073 +#: ./docs/10.x/broadcasting.md:1131 +#: ./docs/11.x/broadcasting.md:1153 +#: ./docs/master/broadcasting.md:1151 +msgid "First, use the `private` method to retrieve an instance of a channel, then call the `listen` method to listen for a specified event. Typically, the channel name given to the `private` method should correspond to Laravel's [model broadcasting conventions](#model-broadcasting-conventions)." +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:1027 +#: ./docs/9.x/broadcasting.md:1075 +#: ./docs/10.x/broadcasting.md:1133 +#: ./docs/11.x/broadcasting.md:1155 +#: ./docs/master/broadcasting.md:1153 +msgid "Once you have obtained a channel instance, you may use the `listen` method to listen for a particular event. Since model broadcast events are not associated with an \"actual\" event within your application's `App\\Events` directory, the [event name](#model-broadcasting-event-conventions) must be prefixed with a `.` to indicate it does not belong to a particular namespace. Each model broadcast event has a `model` property which contains all of the broadcastable properties of the model:" +msgstr "" + +# CODE: js +#: ./docs/8.x/broadcasting.md:1029 +#: ./docs/9.x/broadcasting.md:1077 +#: ./docs/10.x/broadcasting.md:1135 +#: ./docs/11.x/broadcasting.md:1157 +#: ./docs/master/broadcasting.md:1155 +msgid "Echo.private(`App.Models.User.${this.user.id}`)\n" +" .listen('.PostUpdated', (e) => {\n" +" console.log(e.model);\n" +" });" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:1036 +#: ./docs/9.x/broadcasting.md:1084 +#: ./docs/10.x/broadcasting.md:1142 +#: ./docs/11.x/broadcasting.md:1164 +#: ./docs/master/broadcasting.md:1162 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/broadcasting.md:1037 +#: ./docs/9.x/broadcasting.md:1085 +#: ./docs/10.x/broadcasting.md:1143 +#: ./docs/11.x/broadcasting.md:1165 +#: ./docs/master/broadcasting.md:1163 +msgid "Client Events" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:1039 +#: ./docs/9.x/broadcasting.md:1088 +#: ./docs/10.x/broadcasting.md:1146 +#: ./docs/11.x/broadcasting.md:1168 +#: ./docs/master/broadcasting.md:1166 +msgid "When using [Pusher Channels](https://pusher.com/channels), you must enable the \"Client Events\" option in the \"App Settings\" section of your [application dashboard](https://dashboard.pusher.com/) in order to send client events." +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:1041 +#: ./docs/9.x/broadcasting.md:1090 +#: ./docs/10.x/broadcasting.md:1148 +#: ./docs/11.x/broadcasting.md:1170 +#: ./docs/master/broadcasting.md:1168 +msgid "Sometimes you may wish to broadcast an event to other connected clients without hitting your Laravel application at all. This can be particularly useful for things like \"typing\" notifications, where you want to alert users of your application that another user is typing a message on a given screen." +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:1043 +#: ./docs/9.x/broadcasting.md:1092 +#: ./docs/10.x/broadcasting.md:1150 +#: ./docs/11.x/broadcasting.md:1172 +#: ./docs/master/broadcasting.md:1170 +msgid "To broadcast client events, you may use Echo's `whisper` method:" +msgstr "" + +# CODE +# CODE: js +#: ./docs/8.x/broadcasting.md:1045 +#: ./docs/9.x/broadcasting.md:1094 +#: ./docs/10.x/broadcasting.md:1152 +#: ./docs/11.x/broadcasting.md:1174 +#: ./docs/master/broadcasting.md:1172 +msgid "Echo.private(`chat.${roomId}`)\n" +" .whisper('typing', {\n" +" name: this.user.name\n" +" });" +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:1047 +#: ./docs/11.x/broadcasting.md:1069 +#: ./docs/master/broadcasting.md:1067 +msgid "So, an `App\\Models\\User` model with an `id` of `1` would be converted into an `Illuminate\\Broadcasting\\PrivateChannel` instance with a name of `App.Models.User.1`. Of course, in addition to returning Eloquent model instances from your model's `broadcastOn` method, you may return complete `Channel` instances in order to have full control over the model's channel names:" +msgstr "" + +# CODE: php +#: ./docs/10.x/broadcasting.md:1049 +#: ./docs/11.x/broadcasting.md:1071 +#: ./docs/master/broadcasting.md:1069 +msgid "use Illuminate\\Broadcasting\\PrivateChannel;\n\n" "/**\n" -" * Create a new broadcastable model event for the model.\n" +" * Get the channels that model events should broadcast on.\n" " *\n" -" * @param string $event\n" -" * @return \\Illuminate\\Database\\Eloquent\\BroadcastableModelEventOccurred\n" +" * @return array\n" " */\n" -"protected function newBroadcastableEvent($event)\n" +"public function broadcastOn(string $event): array\n" "{\n" -" return (new BroadcastableModelEventOccurred(\n" -" $this, $event\n" -" ))->dontBroadcastToCurrentUser();\n" -"}\n" +" return [\n" +" new PrivateChannel('user.'.$this->id)\n" +" ];\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:1050 +#: ./docs/9.x/broadcasting.md:1101 +#: ./docs/10.x/broadcasting.md:1159 +#: ./docs/11.x/broadcasting.md:1181 +#: ./docs/master/broadcasting.md:1179 +msgid "To listen for client events, you may use the `listenForWhisper` method:" +msgstr "" + +# CODE +# CODE: js +#: ./docs/8.x/broadcasting.md:1052 +#: ./docs/9.x/broadcasting.md:1103 +#: ./docs/10.x/broadcasting.md:1161 +#: ./docs/11.x/broadcasting.md:1183 +#: ./docs/master/broadcasting.md:1181 +msgid "Echo.private(`chat.${roomId}`)\n" +" .listenForWhisper('typing', (e) => {\n" +" console.log(e.name);\n" +" });" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:1057 +#: ./docs/9.x/broadcasting.md:1110 +#: ./docs/10.x/broadcasting.md:1168 +#: ./docs/11.x/broadcasting.md:1190 +#: ./docs/master/broadcasting.md:1188 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/broadcasting.md:1058 +#: ./docs/9.x/broadcasting.md:1111 +#: ./docs/10.x/broadcasting.md:1169 +#: ./docs/11.x/broadcasting.md:1191 +#: ./docs/master/broadcasting.md:1189 +msgid "Notifications" +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:1060 +#: ./docs/9.x/broadcasting.md:1113 +#: ./docs/10.x/broadcasting.md:1171 +#: ./docs/11.x/broadcasting.md:1193 +#: ./docs/master/broadcasting.md:1191 +msgid "By pairing event broadcasting with [notifications](/docs/{{version}}/notifications), your JavaScript application may receive new notifications as they occur without needing to refresh the page. Before getting started, be sure to read over the documentation on using [the broadcast notification channel](/docs/{{version}}/notifications#broadcast-notifications)." +msgstr "" + +# P +#: ./docs/8.x/broadcasting.md:1062 +#: ./docs/9.x/broadcasting.md:1115 +#: ./docs/10.x/broadcasting.md:1173 +#: ./docs/11.x/broadcasting.md:1195 +#: ./docs/master/broadcasting.md:1193 +msgid "Once you have configured a notification to use the broadcast channel, you may listen for the broadcast events using Echo's `notification` method. Remember, the channel name should match the class name of the entity receiving the notifications:" +msgstr "" + +# CODE +# CODE: js +#: ./docs/8.x/broadcasting.md:1064 +#: ./docs/9.x/broadcasting.md:1117 +#: ./docs/10.x/broadcasting.md:1175 +#: ./docs/11.x/broadcasting.md:1197 +#: ./docs/master/broadcasting.md:1195 +msgid "Echo.private(`App.Models.User.${userId}`)\n" +" .notification((notification) => {\n" +" console.log(notification.type);\n" +" });" +msgstr "" -#: docs/master/broadcasting.md:block 41 (quote) -msgid "**Note** The documentation below discusses how to use Ably in \"Pusher compatibility\" mode. However, the Ably team maintains a broadcaster and Echo client that is able to take advantage of the unique capabilities offered by Ably. For more information on using the Ably maintained drivers, please [consult Ably's Laravel broadcaster documentation](https://github.com/ably/laravel-broadcaster)." -msgstr "**Note** 下方的說明文件討論了如何在「Pusher 相容模式 (Pusher Compatibility)」下使用 Ably。不過,Ably 團隊還維護了一個 Broadcaster 程式與可使用 Ably 特別功能的 Echo 用戶端。更多有關使用 Ably 維護的 Driver 的資訊,請[參考 Ably 的 Laravel Broadcaster 說明文件 (英語)](https://github.com/ably/laravel-broadcaster)。" +# P +#: ./docs/8.x/broadcasting.md:1069 +#: ./docs/9.x/broadcasting.md:1124 +#: ./docs/10.x/broadcasting.md:1182 +msgid "In this example, all notifications sent to `App\\Models\\User` instances via the `broadcast` channel would be received by the callback. A channel authorization callback for the `App.Models.User.{id}` channel is included in the default `BroadcastServiceProvider` that ships with the Laravel framework." +msgstr "" + +# P +#: ./docs/10.x/broadcasting.md:1071 +#: ./docs/11.x/broadcasting.md:1093 +#: ./docs/master/broadcasting.md:1091 +msgid "If you need to determine the channel name of a model, you may call the `broadcastChannel` method on any model instance. For example, this method returns the string `App.Models.User.1` for an `App\\Models\\User` model with an `id` of `1`:" +msgstr "" -#: docs/master/broadcasting.md:block 253 (code) +# CODE: php +#: ./docs/10.x/broadcasting.md:1100 +#: ./docs/11.x/broadcasting.md:1122 +#: ./docs/master/broadcasting.md:1120 msgid "/**\n" -" * Get the channels the event should broadcast on.\n" -" *\n" -" * @return array\n" +" * The model event's broadcast name.\n" " */\n" -"public function broadcastOn(): array\n" +"public function broadcastAs(string $event): string|null\n" "{\n" -" return [\n" -" new PresenceChannel('room.'.$this->message->room_id),\n" -" ];\n" -"}\n" -msgstr "/**\n" -" * Get the channels the event should broadcast on.\n" +" return match ($event) {\n" +" 'created' => 'post.created',\n" +" default => null,\n" +" };\n" +"}\n\n" +"/**\n" +" * Get the data to broadcast for the model.\n" " *\n" -" * @return array\n" +" * @return array\n" " */\n" -"public function broadcastOn(): array\n" +"public function broadcastWith(string $event): array\n" "{\n" -" return [\n" -" new PresenceChannel('room.'.$this->message->room_id),\n" -" ];\n" -"}\n" +" return match ($event) {\n" +" 'created' => ['title' => $this->title],\n" +" default => ['model' => $this],\n" +" };\n" +"}" +msgstr "" + +# H3 +#: ./docs/10.x/broadcasting.md:1127 +#: ./docs/11.x/broadcasting.md:1149 +#: ./docs/master/broadcasting.md:1147 +msgid "Listening for Model Broadcasts" +msgstr "" + +# P +#: ./docs/11.x/broadcasting.md:1204 +#: ./docs/master/broadcasting.md:1202 +msgid "In this example, all notifications sent to `App\\Models\\User` instances via the `broadcast` channel would be received by the callback. A channel authorization callback for the `App.Models.User.{id}` channel is included in your application's `routes/channels.php` file." +msgstr "" diff --git a/po/zh_TW/cache.po b/po/zh_TW/cache.po index ff29f0364..d2f8e4476 100644 --- a/po/zh_TW/cache.po +++ b/po/zh_TW/cache.po @@ -10,141 +10,464 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" +"PO-Revision-Date: 2024-11-30 08:38\n" -#: docs/10.x/cache.md:block 1 (header) +# TD +#: ./docs/11.x/cache.md +#: ./docs/master/cache.md +msgid "Event Name" +msgstr "" + +# TD +#: ./docs/11.x/cache.md +#: ./docs/master/cache.md +msgid "`Illuminate\\Cache\\Events\\CacheHit`" +msgstr "" + +# TD +#: ./docs/11.x/cache.md +#: ./docs/master/cache.md +msgid "`Illuminate\\Cache\\Events\\CacheMissed`" +msgstr "" + +# TD +#: ./docs/11.x/cache.md +#: ./docs/master/cache.md +msgid "`Illuminate\\Cache\\Events\\KeyForgotten`" +msgstr "" + +# TD +#: ./docs/11.x/cache.md +#: ./docs/master/cache.md +msgid "`Illuminate\\Cache\\Events\\KeyWritten`" +msgstr "" + +# H1 +#: ./docs/8.x/cache.md:1 +#: ./docs/9.x/cache.md:1 +#: ./docs/10.x/cache.md:1 +#: ./docs/11.x/cache.md:1 +#: ./docs/master/cache.md:1 msgid "Cache" -msgstr "快取" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:3 +#: ./docs/9.x/cache.md:3 +#: ./docs/10.x/cache.md:3 +#: ./docs/11.x/cache.md:3 +#: ./docs/master/cache.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:4 +#: ./docs/9.x/cache.md:4 +#: ./docs/10.x/cache.md:4 +#: ./docs/11.x/cache.md:4 +#: ./docs/master/cache.md:4 msgid "[Configuration](#configuration)" -msgstr "[設定](#configuration)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:5 +#: ./docs/9.x/cache.md:5 +#: ./docs/10.x/cache.md:5 +#: ./docs/11.x/cache.md:5 +#: ./docs/master/cache.md:5 msgid "[Driver Prerequisites](#driver-prerequisites)" -msgstr "[Driver 前置需求](#driver-prerequisites)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:6 +#: ./docs/9.x/cache.md:6 +#: ./docs/10.x/cache.md:6 +#: ./docs/11.x/cache.md:6 +#: ./docs/master/cache.md:6 msgid "[Cache Usage](#cache-usage)" -msgstr "[使用 Cache](#cache-usage)" +msgstr "" + +# P +#: ./docs/10.x/cache.md:7 +#: ./docs/11.x/cache.md:7 +#: ./docs/master/cache.md:7 +msgid "[Obtaining a Cache Instance](#obtaining-a-cache-instance)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:7 +#: ./docs/9.x/cache.md:7 msgid "[Obtaining A Cache Instance](#obtaining-a-cache-instance)" -msgstr "[取得 Cache 實體](#obtaining-a-cache-instance)" +msgstr "" + +# P +#: ./docs/10.x/cache.md:8 +#: ./docs/11.x/cache.md:8 +#: ./docs/master/cache.md:8 +msgid "[Retrieving Items From the Cache](#retrieving-items-from-the-cache)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:8 +#: ./docs/9.x/cache.md:8 msgid "[Retrieving Items From The Cache](#retrieving-items-from-the-cache)" -msgstr "[從 Cache 中取得項目](#retrieving-items-from-the-cache)" +msgstr "" + +# P +#: ./docs/10.x/cache.md:9 +#: ./docs/11.x/cache.md:9 +#: ./docs/master/cache.md:9 +msgid "[Storing Items in the Cache](#storing-items-in-the-cache)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:9 +#: ./docs/9.x/cache.md:9 msgid "[Storing Items In The Cache](#storing-items-in-the-cache)" -msgstr "[在 Cache 內儲存項目](#storing-items-in-the-cache)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/10.x/cache.md:10 +#: ./docs/11.x/cache.md:10 +#: ./docs/master/cache.md:10 +msgid "[Removing Items From the Cache](#removing-items-from-the-cache)" +msgstr "" + +# P +#: ./docs/8.x/cache.md:10 +#: ./docs/9.x/cache.md:10 msgid "[Removing Items From The Cache](#removing-items-from-the-cache)" -msgstr "[從 Cache 內移除項目](#removing-items-from-the-cache)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:11 +#: ./docs/9.x/cache.md:11 +#: ./docs/10.x/cache.md:11 +#: ./docs/11.x/cache.md:11 +#: ./docs/master/cache.md:11 msgid "[The Cache Helper](#the-cache-helper)" -msgstr "[Cache 輔助函式](#the-cache-helper)" +msgstr "" + +# P +#: ./docs/8.x/cache.md:12 +#: ./docs/9.x/cache.md:12 +msgid "[Cache Tags](#cache-tags)" +msgstr "" + +# P +#: ./docs/8.x/cache.md:13 +#: ./docs/9.x/cache.md:13 +msgid "[Storing Tagged Cache Items](#storing-tagged-cache-items)" +msgstr "" + +# P +#: ./docs/8.x/cache.md:14 +#: ./docs/9.x/cache.md:14 +msgid "[Accessing Tagged Cache Items](#accessing-tagged-cache-items)" +msgstr "" + +# P +#: ./docs/8.x/cache.md:15 +#: ./docs/9.x/cache.md:15 +msgid "[Removing Tagged Cache Items](#removing-tagged-cache-items)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:16 +#: ./docs/9.x/cache.md:16 +#: ./docs/10.x/cache.md:12 +#: ./docs/11.x/cache.md:12 +#: ./docs/master/cache.md:12 msgid "[Atomic Locks](#atomic-locks)" -msgstr "[Atomic Lock](#atomic-locks)" +msgstr "" + +# P +#: ./docs/10.x/cache.md:17 +#: ./docs/11.x/cache.md:16 +#: ./docs/master/cache.md:16 +msgid "[Writing the Driver](#writing-the-driver)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:17 +#: ./docs/9.x/cache.md:17 +#: ./docs/10.x/cache.md:13 msgid "[Driver Prerequisites](#lock-driver-prerequisites)" -msgstr "[Driver 前置需求](#lock-driver-prerequisites)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/10.x/cache.md:18 +#: ./docs/11.x/cache.md:17 +#: ./docs/master/cache.md:17 +msgid "[Registering the Driver](#registering-the-driver)" +msgstr "" + +# P +#: ./docs/8.x/cache.md:18 +#: ./docs/9.x/cache.md:18 +#: ./docs/10.x/cache.md:14 +#: ./docs/11.x/cache.md:13 +#: ./docs/master/cache.md:13 msgid "[Managing Locks](#managing-locks)" -msgstr "[管理 Lock](#managing-locks)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:19 +#: ./docs/9.x/cache.md:19 +#: ./docs/10.x/cache.md:15 +#: ./docs/11.x/cache.md:14 +#: ./docs/master/cache.md:14 msgid "[Managing Locks Across Processes](#managing-locks-across-processes)" -msgstr "[在不同處理程序間管理 Lock](#managing-locks-across-processes)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:20 +#: ./docs/9.x/cache.md:20 +#: ./docs/10.x/cache.md:16 +#: ./docs/11.x/cache.md:15 +#: ./docs/master/cache.md:15 msgid "[Adding Custom Cache Drivers](#adding-custom-cache-drivers)" -msgstr "[新增自訂的 Cache Driver](#adding-custom-cache-drivers)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:21 +#: ./docs/9.x/cache.md:21 msgid "[Writing The Driver](#writing-the-driver)" -msgstr "[撰寫 Driver](#writing-the-driver)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:22 +#: ./docs/9.x/cache.md:22 msgid "[Registering The Driver](#registering-the-driver)" -msgstr "[註冊 Driver](#registering-the-driver)" +msgstr "" -#: docs/10.x/cache.md:block 2 (unordered list) +# P +#: ./docs/8.x/cache.md:23 +#: ./docs/9.x/cache.md:23 +#: ./docs/10.x/cache.md:19 +#: ./docs/11.x/cache.md:18 +#: ./docs/master/cache.md:18 msgid "[Events](#events)" -msgstr "[事件](#events)" +msgstr "" -#: docs/10.x/cache.md:block 4 (header) +# P +#: ./docs/8.x/cache.md:25 +#: ./docs/9.x/cache.md:25 +#: ./docs/10.x/cache.md:21 +#: ./docs/11.x/cache.md:20 +#: ./docs/master/cache.md:20 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cache.md:26 +#: ./docs/9.x/cache.md:26 +#: ./docs/10.x/cache.md:22 +#: ./docs/11.x/cache.md:21 +#: ./docs/master/cache.md:21 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/cache.md:block 5 (paragraph) +# P +#: ./docs/8.x/cache.md:28 +#: ./docs/9.x/cache.md:28 +#: ./docs/10.x/cache.md:24 +#: ./docs/11.x/cache.md:23 +#: ./docs/master/cache.md:23 msgid "Some of the data retrieval or processing tasks performed by your application could be CPU intensive or take several seconds to complete. When this is the case, it is common to cache the retrieved data for a time so it can be retrieved quickly on subsequent requests for the same data. The cached data is usually stored in a very fast data store such as [Memcached](https://memcached.org) or [Redis](https://redis.io)." -msgstr "有些取得資料或處理任務的過程可能很消耗 CPU、或是需要數秒鐘來完成。這種時候,我們通常會將取得的資料快取住一段時間,這樣一來在接下來的請求上就能快速存取相同的資料。快取的資料通常會初存在一些非常快速的資料儲存上,如 [Memcached](https://memcached.org) 或 [Redis](https://redis.io)。" +msgstr "" + +# P +#: ./docs/11.x/cache.md:30 +#: ./docs/master/cache.md:30 +msgid "Your application's cache configuration file is located at `config/cache.php`. In this file, you may specify which cache store you would like to be used by default throughout your application. Laravel supports popular caching backends like [Memcached](https://memcached.org), [Redis](https://redis.io), [DynamoDB](https://aws.amazon.com/dynamodb), and relational databases out of the box. In addition, a file based cache driver is available, while `array` and \"null\" cache drivers provide convenient cache backends for your automated tests." +msgstr "" -#: docs/10.x/cache.md:block 6 (paragraph) +# P +#: ./docs/8.x/cache.md:30 +#: ./docs/9.x/cache.md:30 +#: ./docs/10.x/cache.md:26 +#: ./docs/11.x/cache.md:25 +#: ./docs/master/cache.md:25 msgid "Thankfully, Laravel provides an expressive, unified API for various cache backends, allowing you to take advantage of their blazing fast data retrieval and speed up your web application." -msgstr "所幸,Laravel 為多種快取後端提供了一個表達性、統一的 API,可以享受快取提供的快速資料存取,並加速你的網站。" +msgstr "" + +# P +#: ./docs/11.x/cache.md:32 +#: ./docs/master/cache.md:32 +msgid "The cache configuration file also contains a variety of other options that you may review. By default, Laravel is configured to use the `database` cache driver, which stores the serialized, cached objects in your application's database." +msgstr "" -#: docs/10.x/cache.md:block 8 (header) +# P +#: ./docs/8.x/cache.md:32 +#: ./docs/9.x/cache.md:32 +#: ./docs/10.x/cache.md:28 +#: ./docs/11.x/cache.md:27 +#: ./docs/master/cache.md:27 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cache.md:33 +#: ./docs/9.x/cache.md:33 +#: ./docs/10.x/cache.md:29 +#: ./docs/11.x/cache.md:28 +#: ./docs/master/cache.md:28 msgid "Configuration" -msgstr "設定" +msgstr "" -#: docs/10.x/cache.md:block 9 (paragraph) +# P +#: ./docs/8.x/cache.md:35 +#: ./docs/9.x/cache.md:35 +#: ./docs/10.x/cache.md:31 msgid "Your application's cache configuration file is located at `config/cache.php`. In this file, you may specify which cache driver you would like to be used by default throughout your application. Laravel supports popular caching backends like [Memcached](https://memcached.org), [Redis](https://redis.io), [DynamoDB](https://aws.amazon.com/dynamodb), and relational databases out of the box. In addition, a file based cache driver is available, while `array` and \"null\" cache drivers provide convenient cache backends for your automated tests." -msgstr "快取設定檔位於 `config/cache.php`。在這個檔案中,可以指定專案中預設要使用哪個快取 Driver。Laravel 內建支援像是 [Memcached](https://memcached.org), [Redis](https://redis.io), [DynamoDB](https://aws.amazon.com/dynamodb) 以及關聯式資料庫等多種熱門的快取後端。此外,也可以使用基於檔案的快取 Driver,而 `array` 與「null」Driver 則為自動化測試提供方便的快取後端。" +msgstr "" -#: docs/10.x/cache.md:block 10 (paragraph) +# P +#: ./docs/8.x/cache.md:37 +#: ./docs/9.x/cache.md:37 +#: ./docs/10.x/cache.md:33 msgid "The cache configuration file also contains various other options, which are documented within the file, so make sure to read over these options. By default, Laravel is configured to use the `file` cache driver, which stores the serialized, cached objects on the server's filesystem. For larger applications, it is recommended that you use a more robust driver such as Memcached or Redis. You may even configure multiple cache configurations for the same driver." -msgstr "快取設定檔也包含了其他數種選項,並在該設定檔中包含了說明文件。請確保有先閱讀這些選項。預設情況下,Laravel 設定使用 `file` 快取 Driver,在伺服器的檔案系統上儲存經過序列化的快取物件。對於大型的專案,建議使用如 Memcached 或 Redis 等更專門的快取 Driver。甚至也可以為相同的 Driver 設定多個快取設定。" +msgstr "" -#: docs/10.x/cache.md:block 12 (header) -msgid "Driver Prerequisites" -msgstr "Driver 需求" +# P +#: ./docs/8.x/cache.md:39 +#: ./docs/9.x/cache.md:39 +#: ./docs/10.x/cache.md:35 +#: ./docs/11.x/cache.md:34 +#: ./docs/master/cache.md:34 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/11.x/cache.md:40 +#: ./docs/master/cache.md:40 +msgid "When using the `database` cache driver, you will need a database table to contain the cache data. Typically, this is included in Laravel's default `0001_01_01_000001_create_cache_table.php` [database migration](/docs/{{version}}/migrations); however, if your application does not contain this migration, you may use the `make:cache-table` Artisan command to create it:" +msgstr "" -#: docs/10.x/cache.md:block 14 (header) -msgid "Database" -msgstr "資料庫" +# H3 +#: ./docs/8.x/cache.md:40 +#: ./docs/8.x/cache.md:301 +#: ./docs/9.x/cache.md:40 +#: ./docs/9.x/cache.md:307 +#: ./docs/10.x/cache.md:36 +#: ./docs/10.x/cache.md:272 +#: ./docs/11.x/cache.md:35 +#: ./docs/master/cache.md:35 +msgid "Driver Prerequisites" +msgstr "" -#: docs/10.x/cache.md:block 15 (paragraph) -msgid "When using the `database` cache driver, you will need to set up a table to contain the cache items. You'll find an example `Schema` declaration for the table below:" -msgstr "在使用 `database` 快取 Driver 時,需要先設定包含快取項目的資料表。該資料表的 `Schema` 宣告範例如下:" +# CODE: shell +#: ./docs/11.x/cache.md:42 +#: ./docs/master/cache.md:42 +msgid "php artisan make:cache-table\n\n" +"php artisan migrate" +msgstr "" -#: docs/10.x/cache.md:block 16 (code) +# P +#: ./docs/8.x/cache.md:42 +#: ./docs/9.x/cache.md:42 +#: ./docs/10.x/cache.md:38 +#: ./docs/11.x/cache.md:37 +#: ./docs/master/cache.md:37 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/cache.md:43 msgid "Schema::create('cache', function (Blueprint $table) {\n" " $table->string('key')->unique();\n" " $table->text('value');\n" " $table->integer('expiration');\n" -"});\n" -msgstr "Schema::create('cache', function (Blueprint $table) {\n" +"});" +msgstr "" + +# H4 +#: ./docs/8.x/cache.md:43 +#: ./docs/8.x/cache.md:304 +#: ./docs/9.x/cache.md:43 +#: ./docs/9.x/cache.md:310 +#: ./docs/10.x/cache.md:39 +#: ./docs/10.x/cache.md:275 +#: ./docs/11.x/cache.md:38 +#: ./docs/master/cache.md:38 +msgid "Database" +msgstr "" + +# P +#: ./docs/8.x/cache.md:45 +msgid "When using the `database` cache driver, you will need to setup a table to contain the cache items. You'll find an example `Schema` declaration for the table below:" +msgstr "" + +# P +#: ./docs/9.x/cache.md:45 +#: ./docs/10.x/cache.md:41 +msgid "When using the `database` cache driver, you will need to set up a table to contain the cache items. You'll find an example `Schema` declaration for the table below:" +msgstr "" + +# CODE +#: ./docs/8.x/cache.md:47 +#: ./docs/9.x/cache.md:47 +msgid "Schema::create('cache', function ($table) {\n" " $table->string('key')->unique();\n" " $table->text('value');\n" " $table->integer('expiration');\n" -"});\n" +"});" +msgstr "" + +# CODE +#: ./docs/11.x/cache.md:53 +#: ./docs/master/cache.md:53 +msgid "'memcached' => [\n" +" // ...\n\n" +" 'servers' => [\n" +" [\n" +" 'host' => env('MEMCACHED_HOST', '127.0.0.1'),\n" +" 'port' => env('MEMCACHED_PORT', 11211),\n" +" 'weight' => 100,\n" +" ],\n" +" ],\n" +"]," +msgstr "" -#: docs/10.x/cache.md:block 17 (quote) -msgid "**Note** You may also use the `php artisan cache:table` Artisan command to generate a migration with the proper schema." -msgstr "**Note** 可以使用 `php artisan cache:table` Artisan 指令來產生包含正確 Schema 的 Migration。" +# P +#: ./docs/8.x/cache.md:53 +#: ./docs/9.x/cache.md:54 +#: ./docs/10.x/cache.md:50 +msgid "You may also use the `php artisan cache:table` Artisan command to generate a migration with the proper schema." +msgstr "" -#: docs/10.x/cache.md:block 19 (header) +# P +#: ./docs/8.x/cache.md:55 +#: ./docs/9.x/cache.md:56 +#: ./docs/10.x/cache.md:52 +#: ./docs/11.x/cache.md:48 +#: ./docs/master/cache.md:48 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cache.md:56 +#: ./docs/9.x/cache.md:57 +#: ./docs/10.x/cache.md:53 +#: ./docs/11.x/cache.md:49 +#: ./docs/master/cache.md:49 msgid "Memcached" -msgstr "Memcached" +msgstr "" -#: docs/10.x/cache.md:block 20 (paragraph) +# P +#: ./docs/8.x/cache.md:58 +#: ./docs/9.x/cache.md:59 +#: ./docs/10.x/cache.md:55 +#: ./docs/11.x/cache.md:51 +#: ./docs/master/cache.md:51 msgid "Using the Memcached driver requires the [Memcached PECL package](https://pecl.php.net/package/memcached) to be installed. You may list all of your Memcached servers in the `config/cache.php` configuration file. This file already contains a `memcached.servers` entry to get you started:" -msgstr "要使用 Memcached Driver 需要安裝 [Memcached PECL 套件](https://pecl.php.net/package/memcached)。可以在 `config/cache.php` 設定檔中列出所有的 Memcached 伺服器。這個檔案已預先包含了 `memcached.servers` 欄位來讓你開始使用:" +msgstr "" -#: docs/10.x/cache.md:block 21 (code) +# CODE +#: ./docs/8.x/cache.md:60 +#: ./docs/9.x/cache.md:61 +#: ./docs/10.x/cache.md:57 msgid "'memcached' => [\n" " 'servers' => [\n" " [\n" @@ -153,74 +476,185 @@ msgid "'memcached' => [\n" " 'weight' => 100,\n" " ],\n" " ],\n" -"],\n" -msgstr "'memcached' => [\n" +"]," +msgstr "" + +# CODE +#: ./docs/11.x/cache.md:67 +#: ./docs/master/cache.md:67 +msgid "'memcached' => [\n" +" // ...\n\n" " 'servers' => [\n" " [\n" -" 'host' => env('MEMCACHED_HOST', '127.0.0.1'),\n" -" 'port' => env('MEMCACHED_PORT', 11211),\n" -" 'weight' => 100,\n" +" 'host' => '/var/run/memcached/memcached.sock',\n" +" 'port' => 0,\n" +" 'weight' => 100\n" " ],\n" " ],\n" -"],\n" +"]," +msgstr "" -#: docs/10.x/cache.md:block 22 (paragraph) +# P +#: ./docs/8.x/cache.md:70 +#: ./docs/9.x/cache.md:71 +#: ./docs/10.x/cache.md:67 +#: ./docs/11.x/cache.md:65 +#: ./docs/master/cache.md:65 msgid "If needed, you may set the `host` option to a UNIX socket path. If you do this, the `port` option should be set to `0`:" -msgstr "若有需要,可以將 `host` 選項設為 UNIX Socket 路徑。若設定為 UNIX Socket,則 `port` 選項應設為 `0`:" +msgstr "" -#: docs/10.x/cache.md:block 23 (code) +# CODE +#: ./docs/8.x/cache.md:72 +#: ./docs/9.x/cache.md:73 +#: ./docs/10.x/cache.md:69 msgid "'memcached' => [\n" " [\n" " 'host' => '/var/run/memcached/memcached.sock',\n" " 'port' => 0,\n" " 'weight' => 100\n" " ],\n" -"],\n" -msgstr "'memcached' => [\n" -" [\n" -" 'host' => '/var/run/memcached/memcached.sock',\n" -" 'port' => 0,\n" -" 'weight' => 100\n" -" ],\n" -"],\n" +"]," +msgstr "" -#: docs/10.x/cache.md:block 25 (header) +# P +#: ./docs/8.x/cache.md:80 +#: ./docs/9.x/cache.md:81 +#: ./docs/10.x/cache.md:77 +#: ./docs/11.x/cache.md:79 +#: ./docs/master/cache.md:79 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cache.md:81 +#: ./docs/9.x/cache.md:82 +#: ./docs/10.x/cache.md:78 +#: ./docs/11.x/cache.md:80 +#: ./docs/master/cache.md:80 msgid "Redis" -msgstr "Redis" +msgstr "" + +# P +#: ./docs/11.x/cache.md:82 +#: ./docs/master/cache.md:82 +msgid "Before using a Redis cache with Laravel, you will need to either install the PhpRedis PHP extension via PECL or install the `predis/predis` package (~2.0) via Composer. [Laravel Sail](/docs/{{version}}/sail) already includes this extension. In addition, official Laravel deployment platforms such as [Laravel Forge](https://forge.laravel.com) and [Laravel Vapor](https://vapor.laravel.com) have the PhpRedis extension installed by default." +msgstr "" -#: docs/10.x/cache.md:block 26 (paragraph) +# P +#: ./docs/8.x/cache.md:83 +#: ./docs/9.x/cache.md:84 +#: ./docs/10.x/cache.md:80 msgid "Before using a Redis cache with Laravel, you will need to either install the PhpRedis PHP extension via PECL or install the `predis/predis` package (~1.0) via Composer. [Laravel Sail](/docs/{{version}}/sail) already includes this extension. In addition, official Laravel deployment platforms such as [Laravel Forge](https://forge.laravel.com) and [Laravel Vapor](https://vapor.laravel.com) have the PhpRedis extension installed by default." -msgstr "在 Laravel 內使用 Redis 快取前,必須先通過 PECL 安裝 PhpRedis PHP 擴充套件,或是通過 Composer 安裝 `predis/predis` 套件 (~1.0)。[Laravel Sail](/docs/{{version}}/sail) 已內建了該擴充套件。此外,官方的 Laravel 部署平台,如 [Laravel Forge](https://forge.laravel.com) 與 [Laravel Vapor](https://vapor.laravel.com),都已預設安裝了 PhpRedis 擴充套件。" +msgstr "" -#: docs/10.x/cache.md:block 27 (paragraph) +# P +#: ./docs/8.x/cache.md:85 +#: ./docs/9.x/cache.md:86 +#: ./docs/10.x/cache.md:82 +#: ./docs/11.x/cache.md:84 +#: ./docs/master/cache.md:84 msgid "For more information on configuring Redis, consult its [Laravel documentation page](/docs/{{version}}/redis#configuration)." -msgstr "更多有關設定 Redis 的資訊,請參考 [Laravel 說明文件頁面](/docs/{{version}}/redis#configuration)。" +msgstr "" -#: docs/10.x/cache.md:block 29 (header) +# P +#: ./docs/8.x/cache.md:87 +#: ./docs/9.x/cache.md:88 +#: ./docs/10.x/cache.md:84 +#: ./docs/11.x/cache.md:86 +#: ./docs/master/cache.md:86 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cache.md:88 +#: ./docs/9.x/cache.md:89 +#: ./docs/10.x/cache.md:85 +#: ./docs/11.x/cache.md:87 +#: ./docs/master/cache.md:87 msgid "DynamoDB" -msgstr "DynamoDB" +msgstr "" + +# P +#: ./docs/11.x/cache.md:89 +#: ./docs/master/cache.md:89 +msgid "Before using the [DynamoDB](https://aws.amazon.com/dynamodb) cache driver, you must create a DynamoDB table to store all of the cached data. Typically, this table should be named `cache`. However, you should name the table based on the value of the `stores.dynamodb.table` configuration value within the `cache` configuration file. The table name may also be set via the `DYNAMODB_CACHE_TABLE` environment variable." +msgstr "" -#: docs/10.x/cache.md:block 30 (paragraph) +# P +#: ./docs/8.x/cache.md:90 +#: ./docs/9.x/cache.md:91 +#: ./docs/10.x/cache.md:87 msgid "Before using the [DynamoDB](https://aws.amazon.com/dynamodb) cache driver, you must create a DynamoDB table to store all of the cached data. Typically, this table should be named `cache`. However, you should name the table based on the value of the `stores.dynamodb.table` configuration value within your application's `cache` configuration file." -msgstr "在開始使用 [DynamoDB](https://aws.amazon.com/dynamodb) 快取 Driver 前,必須先建立 DynamoDB 資料表以儲存所有的快取資料。通常來說,這個資料表應命名為 `cache`。不過,應依照專案的 `cache` 設定檔中的 `stores.dynamodb.table` 設定值來設定這個資料表的名稱。" +msgstr "" -#: docs/10.x/cache.md:block 31 (paragraph) +# P +#: ./docs/8.x/cache.md:92 +#: ./docs/9.x/cache.md:93 +#: ./docs/10.x/cache.md:89 +#: ./docs/11.x/cache.md:91 +#: ./docs/master/cache.md:91 msgid "This table should also have a string partition key with a name that corresponds to the value of the `stores.dynamodb.attributes.key` configuration item within your application's `cache` configuration file. By default, the partition key should be named `key`." -msgstr "該資料表也應擁有一個字串 Partition Key,其名稱應對應專案的 `cache` 設定檔的 `stores.dynamodb.attributes.key` 設定值。預設情況下,該 Partition Key 應命名為 `key`。" +msgstr "" + +# P +#: ./docs/11.x/cache.md:93 +msgid "Typically, DynamoDB will not proactively remove expired items from a table. Therefore, you should [enable Time to Live (TTL)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/TTL.html) on the table. When configuring the table's TTL settings, you should set the TTL attribute name to `expires_at`." +msgstr "" + +# P +#: ./docs/8.x/cache.md:94 +#: ./docs/9.x/cache.md:95 +#: ./docs/10.x/cache.md:91 +#: ./docs/11.x/cache.md:121 +#: ./docs/master/cache.md:93 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/cache.md:95 +#: ./docs/11.x/cache.md:125 +#: ./docs/master/cache.md:97 +msgid "Obtaining a Cache Instance" +msgstr "" + +# P +#: ./docs/11.x/cache.md:95 +msgid "Next, install the AWS SDK so that your Laravel application can communicate with DynamoDB:" +msgstr "" -#: docs/10.x/cache.md:block 33 (header) +# H2 +#: ./docs/8.x/cache.md:95 +#: ./docs/9.x/cache.md:96 +#: ./docs/10.x/cache.md:92 +#: ./docs/11.x/cache.md:122 +#: ./docs/master/cache.md:94 msgid "Cache Usage" -msgstr "使用快取" +msgstr "" -#: docs/10.x/cache.md:block 35 (header) -msgid "Obtaining A Cache Instance" -msgstr "取得 Cache 實體" +# CODE: shell +#: ./docs/11.x/cache.md:97 +msgid "composer require aws/aws-sdk-php" +msgstr "" -#: docs/10.x/cache.md:block 36 (paragraph) -msgid "To obtain a cache store instance, you may use the `Cache` facade, which is what we will use throughout this documentation. The `Cache` facade provides convenient, terse access to the underlying implementations of the Laravel cache contracts:" -msgstr "若要取得快取儲存的實體,可以使用 `Cache` Facade。我們在這篇說明文件中都會使用該 Facade。`Cache` Facade 提供了一個方便簡潔的方式來存取 Laravel 快取 Contract 底層的實作:" +# P +#: ./docs/8.x/cache.md:97 +#: ./docs/9.x/cache.md:98 +#: ./docs/10.x/cache.md:94 +#: ./docs/11.x/cache.md:124 +#: ./docs/master/cache.md:96 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cache.md:98 +#: ./docs/9.x/cache.md:99 +msgid "Obtaining A Cache Instance" +msgstr "" -#: docs/10.x/cache.md:block 37 (code) +# CODE +#: ./docs/10.x/cache.md:99 +#: ./docs/11.x/cache.md:129 +#: ./docs/master/cache.md:101 msgid " [\n" +" 'driver' => 'dynamodb',\n" +" 'key' => env('AWS_ACCESS_KEY_ID'),\n" +" 'secret' => env('AWS_SECRET_ACCESS_KEY'),\n" +" 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),\n" +" 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),\n" +" 'endpoint' => env('DYNAMODB_ENDPOINT'),\n" +"]," +msgstr "" + +# P +#: ./docs/11.x/cache.md:114 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/11.x/cache.md:115 +msgid "MongoDB" +msgstr "" + +# P +#: ./docs/11.x/cache.md:117 +msgid "If you are using MongoDB, a `mongodb` cache driver is provided by the official `mongodb/laravel-mongodb` package and can be configured using a `mongodb` database connection. MongoDB supports TTL indexes, which can be used to automatically clear expired cache items." +msgstr "" + +# P +#: ./docs/11.x/cache.md:119 +msgid "For more information on configuring MongoDB, please refer to the MongoDB [Cache and Locks documentation](https://www.mongodb.com/docs/drivers/php/laravel-mongodb/current/cache/)." +msgstr "" -#: docs/10.x/cache.md:block 39 (header) +# P +#: ./docs/8.x/cache.md:123 +#: ./docs/9.x/cache.md:124 +#: ./docs/10.x/cache.md:120 +#: ./docs/11.x/cache.md:150 +#: ./docs/master/cache.md:122 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cache.md:124 +#: ./docs/9.x/cache.md:125 +#: ./docs/10.x/cache.md:121 +#: ./docs/11.x/cache.md:151 +#: ./docs/master/cache.md:123 msgid "Accessing Multiple Cache Stores" -msgstr "存取多個快取儲存" +msgstr "" -#: docs/10.x/cache.md:block 40 (paragraph) +# P +#: ./docs/8.x/cache.md:126 +#: ./docs/9.x/cache.md:127 +#: ./docs/10.x/cache.md:123 +#: ./docs/11.x/cache.md:153 +#: ./docs/master/cache.md:125 msgid "Using the `Cache` facade, you may access various cache stores via the `store` method. The key passed to the `store` method should correspond to one of the stores listed in the `stores` configuration array in your `cache` configuration file:" -msgstr "使用 `Cache` Facade,即可通過 `store` 方法來存取多個快取儲存。傳入給 `store` 方法的索引鍵應對應於列在 `cache` 設定檔中 `stores` 設定的索引鍵名稱:" +msgstr "" -#: docs/10.x/cache.md:block 41 (code) +# CODE +#: ./docs/8.x/cache.md:128 +#: ./docs/9.x/cache.md:129 +#: ./docs/10.x/cache.md:125 +#: ./docs/11.x/cache.md:155 +#: ./docs/master/cache.md:127 msgid "$value = Cache::store('file')->get('foo');\n\n" -"Cache::store('redis')->put('bar', 'baz', 600); // 10 Minutes\n" -msgstr "$value = Cache::store('file')->get('foo');\n\n" -"Cache::store('redis')->put('bar', 'baz', 600); // 10 Minutes\n" +"Cache::store('redis')->put('bar', 'baz', 600); // 10 Minutes" +msgstr "" -#: docs/10.x/cache.md:block 43 (header) +# H3 +#: ./docs/10.x/cache.md:130 +#: ./docs/11.x/cache.md:160 +#: ./docs/master/cache.md:132 +msgid "Retrieving Items From the Cache" +msgstr "" + +# P +#: ./docs/8.x/cache.md:132 +#: ./docs/9.x/cache.md:133 +#: ./docs/10.x/cache.md:129 +#: ./docs/11.x/cache.md:159 +#: ./docs/master/cache.md:131 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cache.md:133 +#: ./docs/9.x/cache.md:134 msgid "Retrieving Items From The Cache" -msgstr "自快取內取得項目" +msgstr "" -#: docs/10.x/cache.md:block 44 (paragraph) +# P +#: ./docs/8.x/cache.md:135 +#: ./docs/9.x/cache.md:136 +#: ./docs/10.x/cache.md:132 +#: ./docs/11.x/cache.md:162 +#: ./docs/master/cache.md:134 msgid "The `Cache` facade's `get` method is used to retrieve items from the cache. If the item does not exist in the cache, `null` will be returned. If you wish, you may pass a second argument to the `get` method specifying the default value you wish to be returned if the item doesn't exist:" -msgstr "`Cache` Facade 的 `get` 方法是用來從快取內取得資料的。若該項目不存在於快取內,則會回傳 `null`。若有需要,可以傳入第二個引數給 `get` 來指定項目不存在時要回傳什麼預設值:" +msgstr "" -#: docs/10.x/cache.md:block 45 (code) +# CODE +#: ./docs/8.x/cache.md:137 +#: ./docs/9.x/cache.md:138 +#: ./docs/10.x/cache.md:134 +#: ./docs/11.x/cache.md:164 +#: ./docs/master/cache.md:136 msgid "$value = Cache::get('key');\n\n" -"$value = Cache::get('key', 'default');\n" -msgstr "$value = Cache::get('key');\n\n" -"$value = Cache::get('key', 'default');\n" +"$value = Cache::get('key', 'default');" +msgstr "" -#: docs/10.x/cache.md:block 46 (paragraph) +# P +#: ./docs/8.x/cache.md:141 +#: ./docs/9.x/cache.md:142 +#: ./docs/10.x/cache.md:138 +#: ./docs/11.x/cache.md:168 +#: ./docs/master/cache.md:140 msgid "You may even pass a closure as the default value. The result of the closure will be returned if the specified item does not exist in the cache. Passing a closure allows you to defer the retrieval of default values from a database or other external service:" -msgstr "也可以傳入一個閉包來作為預設值。若指定項目不存在於快取內,則該閉包的結果會被回傳。傳入閉包可讓你暫緩從資料庫或其他外部服務取得預設值的過程:" +msgstr "" -#: docs/10.x/cache.md:block 47 (code) +# CODE +#: ./docs/8.x/cache.md:143 +msgid "$value = Cache::get('key', function () {\n" +" return DB::table(...)->get();\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/cache.md:144 +#: ./docs/11.x/cache.md:174 +#: ./docs/master/cache.md:146 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/9.x/cache.md:144 +#: ./docs/10.x/cache.md:140 +#: ./docs/11.x/cache.md:170 +#: ./docs/master/cache.md:142 msgid "$value = Cache::get('key', function () {\n" " return DB::table(/* ... */)->get();\n" -"});\n" -msgstr "$value = Cache::get('key', function () {\n" -" return DB::table(/* ... */)->get();\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/cache.md:block 49 (header) +# H4 +#: ./docs/10.x/cache.md:145 +#: ./docs/11.x/cache.md:175 +#: ./docs/master/cache.md:147 +msgid "Determining Item Existence" +msgstr "" + +# P +#: ./docs/8.x/cache.md:147 +#: ./docs/9.x/cache.md:148 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cache.md:148 +#: ./docs/9.x/cache.md:149 msgid "Checking For Item Existence" -msgstr "檢查項目是否存在" +msgstr "" -#: docs/10.x/cache.md:block 50 (paragraph) +# CODE +#: ./docs/10.x/cache.md:149 +#: ./docs/11.x/cache.md:179 +#: ./docs/master/cache.md:151 +msgid "if (Cache::has('key')) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cache.md:150 +#: ./docs/9.x/cache.md:151 +#: ./docs/10.x/cache.md:147 +#: ./docs/11.x/cache.md:177 +#: ./docs/master/cache.md:149 msgid "The `has` method may be used to determine if an item exists in the cache. This method will also return `false` if the item exists but its value is `null`:" -msgstr "`has` 方法可以用來判斷某個項目是否存在於快取內。該方法也會在項目存在,但其值為 `null` 時回傳 `false`:" +msgstr "" -#: docs/10.x/cache.md:block 51 (code) +# CODE +#: ./docs/8.x/cache.md:152 +#: ./docs/9.x/cache.md:153 msgid "if (Cache::has('key')) {\n" -" // ...\n" -"}\n" -msgstr "if (Cache::has('key')) {\n" -" // ...\n" -"}\n" +" //\n" +"}" +msgstr "" -#: docs/10.x/cache.md:block 53 (header) +# P +#: ./docs/8.x/cache.md:156 +#: ./docs/9.x/cache.md:157 +#: ./docs/10.x/cache.md:153 +#: ./docs/11.x/cache.md:183 +#: ./docs/master/cache.md:155 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cache.md:157 +#: ./docs/9.x/cache.md:158 +#: ./docs/10.x/cache.md:154 +#: ./docs/11.x/cache.md:184 +#: ./docs/master/cache.md:156 msgid "Incrementing / Decrementing Values" -msgstr "遞增或遞減值" - -#: docs/10.x/cache.md:block 54 (paragraph) -msgid "The `increment` and `decrement` methods may be used to adjust the value of integer items in the cache. Both of these methods accept an optional second argument indicating the amount by which to increment or decrement the item's value:" -msgstr "`increment`(遞增)與 `decrement`(遞減)方法可以用來調整快取中的整數項目值。這兩個方法都接收一個可選的第二個引數來判斷項目值所要遞增或遞減的值:" +msgstr "" -#: docs/10.x/cache.md:block 55 (code) +# CODE +#: ./docs/10.x/cache.md:158 +#: ./docs/11.x/cache.md:188 +#: ./docs/master/cache.md:160 msgid "// Initialize the value if it does not exist...\n" "Cache::add('key', 0, now()->addHours(4));\n\n" "// Increment or decrement the value...\n" "Cache::increment('key');\n" "Cache::increment('key', $amount);\n" "Cache::decrement('key');\n" -"Cache::decrement('key', $amount);\n" -msgstr "// 若該值不存在,則進行初始化...\n" -"Cache::add('key', 0, now()->addHours(4));\n\n" -"// 遞增或遞減值...\n" -"Cache::increment('key');\n" +"Cache::decrement('key', $amount);" +msgstr "" + +# P +#: ./docs/8.x/cache.md:159 +#: ./docs/9.x/cache.md:160 +#: ./docs/10.x/cache.md:156 +#: ./docs/11.x/cache.md:186 +#: ./docs/master/cache.md:158 +msgid "The `increment` and `decrement` methods may be used to adjust the value of integer items in the cache. Both of these methods accept an optional second argument indicating the amount by which to increment or decrement the item's value:" +msgstr "" + +# CODE +#: ./docs/8.x/cache.md:161 +#: ./docs/9.x/cache.md:162 +msgid "Cache::increment('key');\n" "Cache::increment('key', $amount);\n" "Cache::decrement('key');\n" -"Cache::decrement('key', $amount);\n" +"Cache::decrement('key', $amount);" +msgstr "" -#: docs/10.x/cache.md:block 57 (header) +# P +#: ./docs/8.x/cache.md:166 +#: ./docs/9.x/cache.md:167 +#: ./docs/10.x/cache.md:167 +#: ./docs/11.x/cache.md:197 +#: ./docs/master/cache.md:169 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cache.md:167 +#: ./docs/9.x/cache.md:168 msgid "Retrieve & Store" -msgstr "取得與儲存" +msgstr "" + +# H4 +#: ./docs/10.x/cache.md:168 +#: ./docs/11.x/cache.md:198 +#: ./docs/master/cache.md:170 +msgid "Retrieve and Store" +msgstr "" -#: docs/10.x/cache.md:block 58 (paragraph) +# P +#: ./docs/8.x/cache.md:169 +#: ./docs/9.x/cache.md:170 +#: ./docs/10.x/cache.md:170 +#: ./docs/11.x/cache.md:200 +#: ./docs/master/cache.md:172 msgid "Sometimes you may wish to retrieve an item from the cache, but also store a default value if the requested item doesn't exist. For example, you may wish to retrieve all users from the cache or, if they don't exist, retrieve them from the database and add them to the cache. You may do this using the `Cache::remember` method:" -msgstr "有時候,我們可能會想要從快取內取得項目,但也想在項目不存在的時候設定預設值。舉例來說,我們可能想從快取內取得所有的使用者,但若快取不存在,則從資料庫內取得所有使用者,並存入快取。可以使用 `Cache::remember` 方法:" +msgstr "" -#: docs/10.x/cache.md:block 59 (code) +# CODE +#: ./docs/8.x/cache.md:171 +#: ./docs/9.x/cache.md:172 +#: ./docs/10.x/cache.md:172 +#: ./docs/11.x/cache.md:202 +#: ./docs/master/cache.md:174 msgid "$value = Cache::remember('users', $seconds, function () {\n" " return DB::table('users')->get();\n" -"});\n" -msgstr "$value = Cache::remember('users', $seconds, function () {\n" -" return DB::table('users')->get();\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/cache.md:block 60 (paragraph) +# P +#: ./docs/8.x/cache.md:175 +#: ./docs/9.x/cache.md:176 +#: ./docs/10.x/cache.md:176 +#: ./docs/11.x/cache.md:206 +#: ./docs/master/cache.md:178 msgid "If the item does not exist in the cache, the closure passed to the `remember` method will be executed and its result will be placed in the cache." -msgstr "若該項目不存在於快取內,則傳入 `remember` 的閉包會被執行,並將其結果放入快取內。" +msgstr "" -#: docs/10.x/cache.md:block 61 (paragraph) +# P +#: ./docs/8.x/cache.md:177 +#: ./docs/9.x/cache.md:178 +#: ./docs/10.x/cache.md:178 +#: ./docs/11.x/cache.md:208 +#: ./docs/master/cache.md:180 msgid "You may use the `rememberForever` method to retrieve an item from the cache or store it forever if it does not exist:" -msgstr "可以使用 `rememberForever` 方法來從快取內取得項目,並在項目不存在時將其永久保存在快取內:" +msgstr "" -#: docs/10.x/cache.md:block 62 (code) +# CODE +#: ./docs/8.x/cache.md:179 +#: ./docs/9.x/cache.md:180 +#: ./docs/10.x/cache.md:180 +#: ./docs/11.x/cache.md:210 +#: ./docs/master/cache.md:182 msgid "$value = Cache::rememberForever('users', function () {\n" " return DB::table('users')->get();\n" -"});\n" -msgstr "$value = Cache::rememberForever('users', function () {\n" -" return DB::table('users')->get();\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/cache.md:block 64 (header) +# P +#: ./docs/8.x/cache.md:183 +#: ./docs/9.x/cache.md:184 +#: ./docs/10.x/cache.md:184 +#: ./docs/11.x/cache.md:227 +#: ./docs/master/cache.md:186 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cache.md:184 +#: ./docs/9.x/cache.md:185 msgid "Retrieve & Delete" -msgstr "取得或刪除" +msgstr "" -#: docs/10.x/cache.md:block 65 (paragraph) +# H4 +#: ./docs/10.x/cache.md:185 +#: ./docs/11.x/cache.md:228 +#: ./docs/master/cache.md:187 +msgid "Retrieve and Delete" +msgstr "" + +# P +#: ./docs/8.x/cache.md:186 +#: ./docs/9.x/cache.md:187 +#: ./docs/10.x/cache.md:187 +#: ./docs/11.x/cache.md:230 +#: ./docs/master/cache.md:189 msgid "If you need to retrieve an item from the cache and then delete the item, you may use the `pull` method. Like the `get` method, `null` will be returned if the item does not exist in the cache:" -msgstr "若有需要從快取內取得並同時刪除項目,則可以使用 `pull` 方法。與 `get` 方法類似,當項目不存在於快取內時,會回傳 `null`:" +msgstr "" -#: docs/10.x/cache.md:block 66 (code) -msgid "$value = Cache::pull('key');\n" -msgstr "$value = Cache::pull('key');\n" +# CODE +#: ./docs/8.x/cache.md:188 +#: ./docs/9.x/cache.md:189 +#: ./docs/10.x/cache.md:189 +#: ./docs/master/cache.md:191 +msgid "$value = Cache::pull('key');" +msgstr "" -#: docs/10.x/cache.md:block 68 (header) +# P +#: ./docs/8.x/cache.md:190 +#: ./docs/9.x/cache.md:191 +#: ./docs/10.x/cache.md:191 +#: ./docs/11.x/cache.md:236 +#: ./docs/master/cache.md:193 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cache.md:191 +#: ./docs/9.x/cache.md:192 msgid "Storing Items In The Cache" -msgstr "將項目存入快取" +msgstr "" + +# H3 +#: ./docs/10.x/cache.md:192 +#: ./docs/11.x/cache.md:237 +#: ./docs/master/cache.md:194 +msgid "Storing Items in the Cache" +msgstr "" -#: docs/10.x/cache.md:block 69 (paragraph) +# P +#: ./docs/8.x/cache.md:193 +#: ./docs/9.x/cache.md:194 +#: ./docs/10.x/cache.md:194 +#: ./docs/11.x/cache.md:239 +#: ./docs/master/cache.md:196 msgid "You may use the `put` method on the `Cache` facade to store items in the cache:" -msgstr "可以使用 `Cache` Facade 上的 `put` 方法來將項目存入快取:" +msgstr "" -#: docs/10.x/cache.md:block 70 (code) -msgid "Cache::put('key', 'value', $seconds = 10);\n" -msgstr "Cache::put('key', 'value', $seconds = 10);\n" +# CODE +#: ./docs/8.x/cache.md:195 +#: ./docs/9.x/cache.md:196 +#: ./docs/10.x/cache.md:196 +#: ./docs/11.x/cache.md:241 +#: ./docs/master/cache.md:198 +msgid "Cache::put('key', 'value', $seconds = 10);" +msgstr "" -#: docs/10.x/cache.md:block 71 (paragraph) +# P +#: ./docs/8.x/cache.md:197 +#: ./docs/9.x/cache.md:198 +#: ./docs/10.x/cache.md:198 +#: ./docs/11.x/cache.md:243 +#: ./docs/master/cache.md:200 msgid "If the storage time is not passed to the `put` method, the item will be stored indefinitely:" -msgstr "若未傳入儲存時間給 `put` 方法,則該項目將被永久儲存:" +msgstr "" -#: docs/10.x/cache.md:block 72 (code) -msgid "Cache::put('key', 'value');\n" -msgstr "Cache::put('key', 'value');\n" +# CODE +#: ./docs/8.x/cache.md:199 +#: ./docs/9.x/cache.md:200 +#: ./docs/10.x/cache.md:200 +#: ./docs/11.x/cache.md:245 +#: ./docs/master/cache.md:202 +msgid "Cache::put('key', 'value');" +msgstr "" -#: docs/10.x/cache.md:block 73 (paragraph) +# P +#: ./docs/8.x/cache.md:201 +#: ./docs/9.x/cache.md:202 +#: ./docs/10.x/cache.md:202 +#: ./docs/11.x/cache.md:247 +#: ./docs/master/cache.md:204 msgid "Instead of passing the number of seconds as an integer, you may also pass a `DateTime` instance representing the desired expiration time of the cached item:" -msgstr "除了將秒數作為整數傳入,也可以傳入一個 `DateTime` 實體來代表指定的快取項目過期時間:" +msgstr "" -#: docs/10.x/cache.md:block 74 (code) -msgid "Cache::put('key', 'value', now()->addMinutes(10));\n" -msgstr "Cache::put('key', 'value', now()->addMinutes(10));\n" +# CODE +#: ./docs/8.x/cache.md:203 +#: ./docs/9.x/cache.md:204 +#: ./docs/10.x/cache.md:204 +#: ./docs/11.x/cache.md:249 +#: ./docs/master/cache.md:206 +msgid "Cache::put('key', 'value', now()->addMinutes(10));" +msgstr "" -#: docs/10.x/cache.md:block 76 (header) +# P +#: ./docs/8.x/cache.md:205 +#: ./docs/9.x/cache.md:206 +#: ./docs/10.x/cache.md:206 +#: ./docs/11.x/cache.md:251 +#: ./docs/master/cache.md:208 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cache.md:206 +#: ./docs/9.x/cache.md:207 msgid "Store If Not Present" -msgstr "當不存在時儲存" +msgstr "" + +# H4 +#: ./docs/10.x/cache.md:207 +#: ./docs/11.x/cache.md:252 +#: ./docs/master/cache.md:209 +msgid "Store if Not Present" +msgstr "" -#: docs/10.x/cache.md:block 77 (paragraph) +# P +#: ./docs/8.x/cache.md:208 +#: ./docs/9.x/cache.md:209 +#: ./docs/10.x/cache.md:209 +#: ./docs/11.x/cache.md:254 +#: ./docs/master/cache.md:211 msgid "The `add` method will only add the item to the cache if it does not already exist in the cache store. The method will return `true` if the item is actually added to the cache. Otherwise, the method will return `false`. The `add` method is an atomic operation:" -msgstr "`add` 方法會只在項目不存在於快取儲存內時將項目加進快取內。該方法會在項目有真正被加進快取後回傳 `true`。否則,該方法會回傳 `false`。`add` 方法是一個不可部分完成的操作(Atomic):" +msgstr "" -#: docs/10.x/cache.md:block 78 (code) -msgid "Cache::add('key', 'value', $seconds);\n" -msgstr "Cache::add('key', 'value', $seconds);\n" +# CODE +#: ./docs/8.x/cache.md:210 +#: ./docs/9.x/cache.md:211 +#: ./docs/10.x/cache.md:211 +#: ./docs/11.x/cache.md:256 +#: ./docs/master/cache.md:213 +msgid "Cache::add('key', 'value', $seconds);" +msgstr "" -#: docs/10.x/cache.md:block 80 (header) +# P +#: ./docs/8.x/cache.md:212 +#: ./docs/9.x/cache.md:213 +#: ./docs/10.x/cache.md:213 +#: ./docs/11.x/cache.md:258 +#: ./docs/master/cache.md:215 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cache.md:213 +#: ./docs/9.x/cache.md:214 +#: ./docs/10.x/cache.md:214 +#: ./docs/11.x/cache.md:259 +#: ./docs/master/cache.md:216 msgid "Storing Items Forever" -msgstr "永久儲存項目" +msgstr "" + +# P +#: ./docs/11.x/cache.md:214 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/cache.md:block 81 (paragraph) +# H4 +#: ./docs/11.x/cache.md:215 +msgid "Stale While Revalidate" +msgstr "" + +# P +#: ./docs/8.x/cache.md:215 +#: ./docs/9.x/cache.md:216 +#: ./docs/10.x/cache.md:216 +#: ./docs/11.x/cache.md:261 +#: ./docs/master/cache.md:218 msgid "The `forever` method may be used to store an item in the cache permanently. Since these items will not expire, they must be manually removed from the cache using the `forget` method:" -msgstr "`forever` 方法可用來將項目永久儲存於快取。由於這些項目永遠不會過期,因此這些項目必須手動使用 `forget` 方法來移除:" +msgstr "" + +# P +#: ./docs/11.x/cache.md:217 +msgid "When using the `Cache::remember` method, some users may experience slow response times if the cached value has expired. For certain types of data, it can be useful to allow partially stale data to be served while the cached value is recalculated in the background, preventing some users from experiencing slow response times while cached values are calculated. This is often referred to as the \"stale-while-revalidate\" pattern, and the `Cache::flexible` method provides an implementation of this pattern." +msgstr "" + +# CODE +#: ./docs/8.x/cache.md:217 +#: ./docs/9.x/cache.md:218 +#: ./docs/10.x/cache.md:218 +#: ./docs/11.x/cache.md:263 +#: ./docs/master/cache.md:220 +msgid "Cache::forever('key', 'value');" +msgstr "" + +# P +#: ./docs/11.x/cache.md:219 +msgid "The flexible method accepts an array that specifies how long the cached value is considered “fresh” and when it becomes “stale.” The first value in the array represents the number of seconds the cache is considered fresh, while the second value defines how long it can be served as stale data before recalculation is necessary." +msgstr "" -#: docs/10.x/cache.md:block 82 (code) -msgid "Cache::forever('key', 'value');\n" -msgstr "Cache::forever('key', 'value');\n" +# P +#: ./docs/8.x/cache.md:219 +#: ./docs/9.x/cache.md:221 +#: ./docs/10.x/cache.md:221 +#: ./docs/11.x/cache.md:266 +#: ./docs/master/cache.md:223 +msgid "If you are using the Memcached driver, items that are stored \"forever\" may be removed when the cache reaches its size limit." +msgstr "" -#: docs/10.x/cache.md:block 83 (quote) -msgid "**Note** If you are using the Memcached driver, items that are stored \"forever\" may be removed when the cache reaches its size limit." -msgstr "**Note** 若使用 Memcached Driver,使用「forever」儲存的項目可能會在快取達到大小限制時被移除。" +# P +#: ./docs/11.x/cache.md:221 +msgid "If a request is made within the fresh period (before the first value), the cache is returned immediately without recalculation. If a request is made during the stale period (between the two values), the stale value is served to the user, and a [deferred function](/docs/{{version}}/helpers#deferred-functions) is registered to refresh the cached value after the response is sent to the user. If a request is made after the second value, the cache is considered expired, and the value is recalculated immediately, which may result in a slower response for the user:" +msgstr "" -#: docs/10.x/cache.md:block 85 (header) +# P +#: ./docs/8.x/cache.md:221 +#: ./docs/9.x/cache.md:223 +#: ./docs/10.x/cache.md:223 +#: ./docs/11.x/cache.md:268 +#: ./docs/master/cache.md:225 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cache.md:222 +#: ./docs/9.x/cache.md:224 msgid "Removing Items From The Cache" -msgstr "從快取內取得項目" +msgstr "" -#: docs/10.x/cache.md:block 86 (paragraph) +# CODE +#: ./docs/11.x/cache.md:223 +msgid "$value = Cache::flexible('users', [5, 10], function () {\n" +" return DB::table('users')->get();\n" +"});" +msgstr "" + +# H3 +#: ./docs/10.x/cache.md:224 +#: ./docs/11.x/cache.md:269 +#: ./docs/master/cache.md:226 +msgid "Removing Items From the Cache" +msgstr "" + +# P +#: ./docs/8.x/cache.md:224 +#: ./docs/9.x/cache.md:226 +#: ./docs/10.x/cache.md:226 +#: ./docs/11.x/cache.md:271 +#: ./docs/master/cache.md:228 msgid "You may remove items from the cache using the `forget` method:" -msgstr "可以使用 `forget` 方法來自快取內移除項目:" +msgstr "" -#: docs/10.x/cache.md:block 87 (code) -msgid "Cache::forget('key');\n" -msgstr "Cache::forget('key');\n" +# CODE +#: ./docs/8.x/cache.md:226 +#: ./docs/9.x/cache.md:228 +#: ./docs/10.x/cache.md:228 +#: ./docs/11.x/cache.md:273 +#: ./docs/master/cache.md:230 +msgid "Cache::forget('key');" +msgstr "" -#: docs/10.x/cache.md:block 88 (paragraph) +# P +#: ./docs/8.x/cache.md:228 +#: ./docs/9.x/cache.md:230 +#: ./docs/10.x/cache.md:230 +#: ./docs/11.x/cache.md:275 +#: ./docs/master/cache.md:232 msgid "You may also remove items by providing a zero or negative number of expiration seconds:" -msgstr "也可以提供 0 或負數的過期時間來移除項目:" +msgstr "" -#: docs/10.x/cache.md:block 89 (code) +# CODE +#: ./docs/8.x/cache.md:230 +#: ./docs/9.x/cache.md:232 +#: ./docs/10.x/cache.md:232 +#: ./docs/11.x/cache.md:277 +#: ./docs/master/cache.md:234 msgid "Cache::put('key', 'value', 0);\n\n" -"Cache::put('key', 'value', -5);\n" -msgstr "Cache::put('key', 'value', 0);\n\n" -"Cache::put('key', 'value', -5);\n" +"Cache::put('key', 'value', -5);" +msgstr "" + +# CODE +#: ./docs/11.x/cache.md:232 +msgid "$value = Cache::pull('key');\n\n" +"$value = Cache::pull('key', 'default');" +msgstr "" -#: docs/10.x/cache.md:block 90 (paragraph) +# P +#: ./docs/8.x/cache.md:234 +#: ./docs/9.x/cache.md:236 +#: ./docs/10.x/cache.md:236 +#: ./docs/11.x/cache.md:281 +#: ./docs/master/cache.md:238 msgid "You may clear the entire cache using the `flush` method:" -msgstr "可以使用 `flush` 方法來移除整個快取:" +msgstr "" -#: docs/10.x/cache.md:block 91 (code) -msgid "Cache::flush();\n" -msgstr "Cache::flush();\n" +# CODE +#: ./docs/8.x/cache.md:236 +#: ./docs/9.x/cache.md:238 +#: ./docs/10.x/cache.md:238 +#: ./docs/11.x/cache.md:283 +#: ./docs/master/cache.md:240 +msgid "Cache::flush();" +msgstr "" -#: docs/10.x/cache.md:block 92 (quote) -msgid "**Warning** Flushing the cache does not respect your configured cache \"prefix\" and will remove all entries from the cache. Consider this carefully when clearing a cache which is shared by other applications." -msgstr "**Warning** 使用 Flush 移除快取並不理會所設定的快取「^[Prefix](前置詞)」,會將快取內所有的項目都移除。當快取有與其他應用程式共用時,在清除快取前請三思。" +# P +#: ./docs/8.x/cache.md:238 +#: ./docs/9.x/cache.md:241 +#: ./docs/10.x/cache.md:241 +#: ./docs/11.x/cache.md:286 +#: ./docs/master/cache.md:243 +msgid "Flushing the cache does not respect your configured cache \"prefix\" and will remove all entries from the cache. Consider this carefully when clearing a cache which is shared by other applications." +msgstr "" -#: docs/10.x/cache.md:block 94 (header) +# P +#: ./docs/8.x/cache.md:240 +#: ./docs/9.x/cache.md:243 +#: ./docs/10.x/cache.md:243 +#: ./docs/11.x/cache.md:288 +#: ./docs/master/cache.md:245 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cache.md:241 +#: ./docs/9.x/cache.md:244 +#: ./docs/10.x/cache.md:244 +#: ./docs/11.x/cache.md:289 +#: ./docs/master/cache.md:246 msgid "The Cache Helper" -msgstr "Cache 輔助函式" +msgstr "" -#: docs/10.x/cache.md:block 95 (paragraph) +# P +#: ./docs/8.x/cache.md:243 +#: ./docs/9.x/cache.md:246 +#: ./docs/10.x/cache.md:246 +#: ./docs/11.x/cache.md:291 +#: ./docs/master/cache.md:248 msgid "In addition to using the `Cache` facade, you may also use the global `cache` function to retrieve and store data via the cache. When the `cache` function is called with a single, string argument, it will return the value of the given key:" -msgstr "除了使用 `Cache` Facade,也可以使用全域的 `cache` 函式來自快取內取得與儲存資料。當使用單一的字串引數呼叫 `cache` 方法時,會回傳給定索引鍵的值:" +msgstr "" -#: docs/10.x/cache.md:block 96 (code) -msgid "$value = cache('key');\n" -msgstr "$value = cache('key');\n" +# CODE +#: ./docs/8.x/cache.md:245 +#: ./docs/9.x/cache.md:248 +#: ./docs/10.x/cache.md:248 +#: ./docs/11.x/cache.md:293 +#: ./docs/master/cache.md:250 +msgid "$value = cache('key');" +msgstr "" -#: docs/10.x/cache.md:block 97 (paragraph) +# P +#: ./docs/8.x/cache.md:247 +#: ./docs/9.x/cache.md:250 +#: ./docs/10.x/cache.md:250 +#: ./docs/11.x/cache.md:295 +#: ./docs/master/cache.md:252 msgid "If you provide an array of key / value pairs and an expiration time to the function, it will store values in the cache for the specified duration:" -msgstr "若傳入一組索引鍵/值配對的陣列以及一個過期時間給該函式,則會將數值初存在快取內一段給定的期間:" +msgstr "" -#: docs/10.x/cache.md:block 98 (code) +# CODE +#: ./docs/8.x/cache.md:249 +#: ./docs/9.x/cache.md:252 +#: ./docs/10.x/cache.md:252 +#: ./docs/11.x/cache.md:297 +#: ./docs/master/cache.md:254 msgid "cache(['key' => 'value'], $seconds);\n\n" -"cache(['key' => 'value'], now()->addMinutes(10));\n" -msgstr "cache(['key' => 'value'], $seconds);\n\n" -"cache(['key' => 'value'], now()->addMinutes(10));\n" +"cache(['key' => 'value'], now()->addMinutes(10));" +msgstr "" -#: docs/10.x/cache.md:block 99 (paragraph) +# P +#: ./docs/8.x/cache.md:253 +#: ./docs/9.x/cache.md:256 +#: ./docs/10.x/cache.md:256 +#: ./docs/11.x/cache.md:301 +#: ./docs/master/cache.md:258 msgid "When the `cache` function is called without any arguments, it returns an instance of the `Illuminate\\Contracts\\Cache\\Factory` implementation, allowing you to call other caching methods:" -msgstr "當 `cache` 方法被呼叫,但未傳入任何引數時,會回傳 `Illuminate\\Contracts\\Cache\\Factory` 實作的實體,可以讓你呼叫其他快取方法:" +msgstr "" -#: docs/10.x/cache.md:block 100 (code) +# CODE +#: ./docs/8.x/cache.md:255 +#: ./docs/9.x/cache.md:258 +#: ./docs/10.x/cache.md:258 +#: ./docs/11.x/cache.md:303 +#: ./docs/master/cache.md:260 msgid "cache()->remember('users', $seconds, function () {\n" " return DB::table('users')->get();\n" -"});\n" -msgstr "cache()->remember('users', $seconds, function () {\n" -" return DB::table('users')->get();\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/cache.md:block 101 (quote) -msgid "**Note** When testing call to the global `cache` function, you may use the `Cache::shouldReceive` method just as if you were [testing the facade](/docs/{{version}}/mocking#mocking-facades)." -msgstr "**Note** 在測試呼叫全域的 `cache` 函式時,可以像在[測試 Facade](/docs/{{version}}/mocking#mocking-facades)一樣,使用 `Cache::shouldReceive` 方法。" +# P +#: ./docs/8.x/cache.md:259 +#: ./docs/9.x/cache.md:263 +#: ./docs/10.x/cache.md:263 +#: ./docs/11.x/cache.md:308 +#: ./docs/master/cache.md:265 +msgid "When testing call to the global `cache` function, you may use the `Cache::shouldReceive` method just as if you were [testing the facade](/docs/{{version}}/mocking#mocking-facades)." +msgstr "" -#: docs/10.x/cache.md:block 103 (header) -msgid "Atomic Locks" -msgstr "Atomic Lock (不可部分完成的鎖定)" +# P +#: ./docs/8.x/cache.md:261 +#: ./docs/9.x/cache.md:265 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/cache.md:block 104 (quote) -msgid "**Warning** To utilize this feature, your application must be using the `memcached`, `redis`, `dynamodb`, `database`, `file`, or `array` cache driver as your application's default cache driver. In addition, all servers must be communicating with the same central cache server." -msgstr "**Warning** 若要使用此功能,則應用程式必須要使用 `memcached`, `redis`, `dynamodb`, `database`, `file` 或 `array` 作為應用程式的預設快取 Driver。另外,所有的伺服器也都必須要連線至相同的中央快取伺服器。" +# H2 +#: ./docs/8.x/cache.md:262 +#: ./docs/9.x/cache.md:266 +msgid "Cache Tags" +msgstr "" -#: docs/10.x/cache.md:block 109 (paragraph) -msgid "When using the `database` cache driver, you will need to setup a table to contain your application's cache locks. You'll find an example `Schema` declaration for the table below:" -msgstr "在使用 `database` 快取 Driver 時,需要設定包含專案快取 Lock 的資料表。下列為範例的資料表 `Schema` 宣告:" +# P +#: ./docs/8.x/cache.md:264 +#: ./docs/9.x/cache.md:269 +msgid "Cache tags are not supported when using the `file`, `dynamodb`, or `database` cache drivers. Furthermore, when using multiple tags with caches that are stored \"forever\", performance will be best with a driver such as `memcached`, which automatically purges stale records." +msgstr "" + +# P +#: ./docs/8.x/cache.md:266 +#: ./docs/9.x/cache.md:271 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cache.md:267 +#: ./docs/9.x/cache.md:272 +msgid "Storing Tagged Cache Items" +msgstr "" -#: docs/10.x/cache.md:block 110 (code) +# P +#: ./docs/8.x/cache.md:269 +#: ./docs/9.x/cache.md:274 +msgid "Cache tags allow you to tag related items in the cache and then flush all cached values that have been assigned a given tag. You may access a tagged cache by passing in an ordered array of tag names. For example, let's access a tagged cache and `put` a value into the cache:" +msgstr "" + +# CODE +#: ./docs/8.x/cache.md:271 +#: ./docs/9.x/cache.md:276 +msgid "Cache::tags(['people', 'artists'])->put('John', $john, $seconds);\n\n" +"Cache::tags(['people', 'authors'])->put('Anne', $anne, $seconds);" +msgstr "" + +# P +#: ./docs/8.x/cache.md:275 +#: ./docs/9.x/cache.md:280 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cache.md:276 +#: ./docs/9.x/cache.md:281 +msgid "Accessing Tagged Cache Items" +msgstr "" + +# P +#: ./docs/8.x/cache.md:278 +msgid "To retrieve a tagged cache item, pass the same ordered list of tags to the `tags` method and then call the `get` method with the key you wish to retrieve:" +msgstr "" + +# CODE +#: ./docs/10.x/cache.md:279 msgid "Schema::create('cache_locks', function (Blueprint $table) {\n" " $table->string('key')->primary();\n" " $table->string('owner');\n" " $table->integer('expiration');\n" -"});\n" -msgstr "Schema::create('cache_locks', function (Blueprint $table) {\n" +"});" +msgstr "" + +# CODE +#: ./docs/8.x/cache.md:280 +#: ./docs/9.x/cache.md:285 +msgid "$john = Cache::tags(['people', 'artists'])->get('John');\n\n" +"$anne = Cache::tags(['people', 'authors'])->get('Anne');" +msgstr "" + +# P +#: ./docs/9.x/cache.md:283 +msgid "Items stored via tags may not be accessed without also providing the tags that were used to store the value. To retrieve a tagged cache item, pass the same ordered list of tags to the `tags` method and then call the `get` method with the key you wish to retrieve:" +msgstr "" + +# P +#: ./docs/8.x/cache.md:284 +#: ./docs/9.x/cache.md:289 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cache.md:285 +#: ./docs/9.x/cache.md:290 +msgid "Removing Tagged Cache Items" +msgstr "" + +# P +#: ./docs/10.x/cache.md:286 +msgid "If you used the `cache:table` Artisan command to create the database driver's cache table, the migration created by that command already includes a definition for the `cache_locks` table." +msgstr "" + +# P +#: ./docs/8.x/cache.md:287 +#: ./docs/9.x/cache.md:292 +msgid "You may flush all items that are assigned a tag or list of tags. For example, this statement would remove all caches tagged with either `people`, `authors`, or both. So, both `Anne` and `John` would be removed from the cache:" +msgstr "" + +# CODE +#: ./docs/8.x/cache.md:289 +#: ./docs/9.x/cache.md:294 +msgid "Cache::tags(['people', 'authors'])->flush();" +msgstr "" + +# P +#: ./docs/8.x/cache.md:291 +#: ./docs/9.x/cache.md:296 +msgid "In contrast, this statement would remove only cached values tagged with `authors`, so `Anne` would be removed, but not `John`:" +msgstr "" + +# CODE +#: ./docs/8.x/cache.md:293 +#: ./docs/9.x/cache.md:298 +msgid "Cache::tags('authors')->flush();" +msgstr "" + +# P +#: ./docs/8.x/cache.md:295 +#: ./docs/9.x/cache.md:300 +#: ./docs/10.x/cache.md:265 +#: ./docs/11.x/cache.md:310 +#: ./docs/master/cache.md:267 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cache.md:296 +#: ./docs/9.x/cache.md:301 +#: ./docs/10.x/cache.md:266 +#: ./docs/11.x/cache.md:311 +#: ./docs/master/cache.md:268 +msgid "Atomic Locks" +msgstr "" + +# P +#: ./docs/8.x/cache.md:298 +#: ./docs/9.x/cache.md:304 +#: ./docs/10.x/cache.md:269 +#: ./docs/11.x/cache.md:314 +#: ./docs/master/cache.md:271 +msgid "To utilize this feature, your application must be using the `memcached`, `redis`, `dynamodb`, `database`, `file`, or `array` cache driver as your application's default cache driver. In addition, all servers must be communicating with the same central cache server." +msgstr "" + +# P +#: ./docs/8.x/cache.md:300 +#: ./docs/9.x/cache.md:306 +#: ./docs/10.x/cache.md:271 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/cache.md:303 +#: ./docs/9.x/cache.md:309 +#: ./docs/10.x/cache.md:274 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/cache.md:306 +#: ./docs/9.x/cache.md:312 +#: ./docs/10.x/cache.md:277 +msgid "When using the `database` cache driver, you will need to setup a table to contain your application's cache locks. You'll find an example `Schema` declaration for the table below:" +msgstr "" + +# CODE +#: ./docs/8.x/cache.md:308 +#: ./docs/9.x/cache.md:314 +msgid "Schema::create('cache_locks', function ($table) {\n" " $table->string('key')->primary();\n" " $table->string('owner');\n" " $table->integer('expiration');\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/cache.md:block 111 (quote) -msgid "**Note** If you used the `cache:table` Artisan command to create the database driver's cache table, the migration created by that command already includes a definition for the `cache_locks` table." -msgstr "**Note** 使用 `cache:table` Artisan 指令來建立資料庫 Driver 的快取資料表時,該指令所建立的 Migration 中已包含了 `cache_locks` 資料表的定義。" +# CODE +#: ./docs/10.x/cache.md:311 +#: ./docs/master/cache.md:296 +msgid "use Illuminate\\Contracts\\Cache\\LockTimeoutException;\n\n" +"$lock = Cache::lock('foo', 10);\n\n" +"try {\n" +" $lock->block(5);\n\n" +" // Lock acquired after waiting a maximum of 5 seconds...\n" +"} catch (LockTimeoutException $e) {\n" +" // Unable to acquire lock...\n" +"} finally {\n" +" $lock?->release();\n" +"}" +msgstr "" -#: docs/10.x/cache.md:block 113 (header) +# P +#: ./docs/8.x/cache.md:314 +#: ./docs/9.x/cache.md:320 +#: ./docs/10.x/cache.md:288 +#: ./docs/11.x/cache.md:316 +#: ./docs/master/cache.md:273 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cache.md:315 +#: ./docs/9.x/cache.md:321 +#: ./docs/10.x/cache.md:289 +#: ./docs/11.x/cache.md:317 +#: ./docs/master/cache.md:274 msgid "Managing Locks" -msgstr "管理 Lock" +msgstr "" -#: docs/10.x/cache.md:block 114 (paragraph) +# P +#: ./docs/8.x/cache.md:317 +#: ./docs/9.x/cache.md:323 +#: ./docs/10.x/cache.md:291 +#: ./docs/11.x/cache.md:319 +#: ./docs/master/cache.md:276 msgid "Atomic locks allow for the manipulation of distributed locks without worrying about race conditions. For example, [Laravel Forge](https://forge.laravel.com) uses atomic locks to ensure that only one remote task is being executed on a server at a time. You may create and manage locks using the `Cache::lock` method:" -msgstr "使用 Atomic Lock (不可部分完成鎖定),在操作與分配 Lock 時即可不需理會競爭條件 (Race Condition)。舉例來說,[Laravel Forge](https://forge.laravel.com) 使用 Atomic Lock 來確保在一台伺服器上一次只有一個遠端任務在執行。可以通過 `Cache::lock` 方法來建立與管理 Lock:" +msgstr "" -#: docs/10.x/cache.md:block 115 (code) +# CODE +#: ./docs/8.x/cache.md:319 +#: ./docs/9.x/cache.md:325 +#: ./docs/10.x/cache.md:293 +#: ./docs/11.x/cache.md:321 +#: ./docs/master/cache.md:278 msgid "use Illuminate\\Support\\Facades\\Cache;\n\n" "$lock = Cache::lock('foo', 10);\n\n" "if ($lock->get()) {\n" " // Lock acquired for 10 seconds...\n\n" " $lock->release();\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\Cache;\n\n" -"$lock = Cache::lock('foo', 10);\n\n" -"if ($lock->get()) {\n" -" // Lock acquired for 10 seconds...\n\n" -" $lock->release();\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/cache.md:block 116 (paragraph) +# P +#: ./docs/8.x/cache.md:329 +#: ./docs/9.x/cache.md:335 +#: ./docs/10.x/cache.md:303 +#: ./docs/11.x/cache.md:331 +#: ./docs/master/cache.md:288 msgid "The `get` method also accepts a closure. After the closure is executed, Laravel will automatically release the lock:" -msgstr "`get` 方法也接收一個閉包。在該閉包執行後,Laravel 會自動釋放 Lock:" +msgstr "" -#: docs/10.x/cache.md:block 117 (code) -msgid "Cache::lock('foo', 10)->get(function () {\n" -" // Lock acquired for 10 seconds and automatically released...\n" -"});\n" -msgstr "Cache::lock('foo', 10)->get(function () {\n" -" // 取得 10 秒的 Lock,然後自動釋放...\n" -"});\n" +# CODE +#: ./docs/8.x/cache.md:331 +msgid "Cache::lock('foo')->get(function () {\n" +" // Lock acquired indefinitely and automatically released...\n" +"});" +msgstr "" -#: docs/10.x/cache.md:block 118 (paragraph) +# P +#: ./docs/8.x/cache.md:335 +#: ./docs/9.x/cache.md:341 +#: ./docs/10.x/cache.md:309 +#: ./docs/master/cache.md:294 msgid "If the lock is not available at the moment you request it, you may instruct Laravel to wait for a specified number of seconds. If the lock can not be acquired within the specified time limit, an `Illuminate\\Contracts\\Cache\\LockTimeoutException` will be thrown:" -msgstr "若在要求時無法取得 Lock,則可以告訴 Laravel 要等待多少秒的事件。若在指定的時間限制後仍無法取得 Lock,則會擲回 `Illuminate\\Contracts\\Cache\\LockTimeoutException`:" +msgstr "" -#: docs/10.x/cache.md:block 119 (code) +# P +#: ./docs/11.x/cache.md:337 +msgid "If the lock is not available at the moment you request it, you may instruct Laravel to wait for a specified number of seconds. If the lock cannot be acquired within the specified time limit, an `Illuminate\\Contracts\\Cache\\LockTimeoutException` will be thrown:" +msgstr "" + +# CODE +#: ./docs/8.x/cache.md:337 +#: ./docs/9.x/cache.md:343 msgid "use Illuminate\\Contracts\\Cache\\LockTimeoutException;\n\n" "$lock = Cache::lock('foo', 10);\n\n" "try {\n" @@ -581,84 +1700,203 @@ msgid "use Illuminate\\Contracts\\Cache\\LockTimeoutException;\n\n" "} catch (LockTimeoutException $e) {\n" " // Unable to acquire lock...\n" "} finally {\n" -" $lock?->release();\n" -"}\n" -msgstr "use Illuminate\\Contracts\\Cache\\LockTimeoutException;\n\n" +" optional($lock)->release();\n" +"}" +msgstr "" + +# CODE +#: ./docs/9.x/cache.md:337 +#: ./docs/10.x/cache.md:305 +#: ./docs/11.x/cache.md:333 +#: ./docs/master/cache.md:290 +msgid "Cache::lock('foo', 10)->get(function () {\n" +" // Lock acquired for 10 seconds and automatically released...\n" +"});" +msgstr "" + +# CODE +#: ./docs/11.x/cache.md:339 +msgid "use Illuminate\\Contracts\\Cache\\LockTimeoutException;\n\n" "$lock = Cache::lock('foo', 10);\n\n" "try {\n" " $lock->block(5);\n\n" -" // 等待最多 5 秒取得 Lock...\n" +" // Lock acquired after waiting a maximum of 5 seconds...\n" "} catch (LockTimeoutException $e) {\n" -" // 無法取得 Lock...\n" +" // Unable to acquire lock...\n" "} finally {\n" -" $lock?->release();\n" -"}\n" +" $lock->release();\n" +"}" +msgstr "" -#: docs/10.x/cache.md:block 120 (paragraph) +# P +#: ./docs/8.x/cache.md:351 +#: ./docs/9.x/cache.md:357 +#: ./docs/10.x/cache.md:325 +#: ./docs/11.x/cache.md:353 +#: ./docs/master/cache.md:310 msgid "The example above may be simplified by passing a closure to the `block` method. When a closure is passed to this method, Laravel will attempt to acquire the lock for the specified number of seconds and will automatically release the lock once the closure has been executed:" -msgstr "上述範例可以通過將閉包傳入 `block` 方法來簡化。當傳入閉包給該方法後,Laravel 會嘗試在指定秒數內取得 Lock,並在閉包執行後自動釋放 Lock:" +msgstr "" -#: docs/10.x/cache.md:block 121 (code) +# CODE +#: ./docs/8.x/cache.md:353 +#: ./docs/9.x/cache.md:359 +#: ./docs/10.x/cache.md:327 +#: ./docs/11.x/cache.md:355 +#: ./docs/master/cache.md:312 msgid "Cache::lock('foo', 10)->block(5, function () {\n" " // Lock acquired after waiting a maximum of 5 seconds...\n" -"});\n" -msgstr "Cache::lock('foo', 10)->block(5, function () {\n" -" // 等待最多 5 秒取得 Lock…\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/cache.md:357 +#: ./docs/9.x/cache.md:363 +#: ./docs/10.x/cache.md:331 +#: ./docs/11.x/cache.md:359 +#: ./docs/master/cache.md:316 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/cache.md:358 +#: ./docs/11.x/cache.md:386 +#: ./docs/master/cache.md:343 +msgid "Writing the Driver" +msgstr "" -#: docs/10.x/cache.md:block 123 (header) +# H3 +#: ./docs/8.x/cache.md:358 +#: ./docs/9.x/cache.md:364 +#: ./docs/10.x/cache.md:332 +#: ./docs/11.x/cache.md:360 +#: ./docs/master/cache.md:317 msgid "Managing Locks Across Processes" -msgstr "在多個處理程序間管理 Lock" +msgstr "" -#: docs/10.x/cache.md:block 124 (paragraph) +# P +#: ./docs/8.x/cache.md:360 +#: ./docs/9.x/cache.md:366 +#: ./docs/10.x/cache.md:334 +#: ./docs/11.x/cache.md:362 +#: ./docs/master/cache.md:319 msgid "Sometimes, you may wish to acquire a lock in one process and release it in another process. For example, you may acquire a lock during a web request and wish to release the lock at the end of a queued job that is triggered by that request. In this scenario, you should pass the lock's scoped \"owner token\" to the queued job so that the job can re-instantiate the lock using the given token." -msgstr "有的時候我們可能想要在一個處理程序內要求 Lock,並在另一個處理程序中釋放。舉例來說,我們可能會在某個網頁請求的期間內要求 Lock,並在由該請求觸發的佇列任務完成後才釋放該 Lock。在此情境中,應將該 Lock 的區域性「擁有者權杖」傳給佇列任務,以讓佇列任務可以使用給定的權杖來重新取得 Lock。" +msgstr "" -#: docs/10.x/cache.md:block 125 (paragraph) +# P +#: ./docs/8.x/cache.md:362 +#: ./docs/9.x/cache.md:368 +#: ./docs/10.x/cache.md:336 +#: ./docs/11.x/cache.md:364 +#: ./docs/master/cache.md:321 msgid "In the example below, we will dispatch a queued job if a lock is successfully acquired. In addition, we will pass the lock's owner token to the queued job via the lock's `owner` method:" -msgstr "在下方的範例中,我們會在成功取得 Lock 後分派佇列任務。另外,我們也會通過 Lock 的 `owner` 方法來將 Lock 的擁有者權杖傳給佇列任務。" +msgstr "" -#: docs/10.x/cache.md:block 126 (code) +# CODE +#: ./docs/8.x/cache.md:364 +#: ./docs/9.x/cache.md:370 +#: ./docs/10.x/cache.md:338 +#: ./docs/11.x/cache.md:366 +#: ./docs/master/cache.md:323 msgid "$podcast = Podcast::find($id);\n\n" "$lock = Cache::lock('processing', 120);\n\n" "if ($lock->get()) {\n" " ProcessPodcast::dispatch($podcast, $lock->owner());\n" -"}\n" -msgstr "$podcast = Podcast::find($id);\n\n" -"$lock = Cache::lock('processing', 120);\n\n" -"if ($lock->get()) {\n" -" ProcessPodcast::dispatch($podcast, $lock->owner());\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/cache.md:block 127 (paragraph) +# P +#: ./docs/8.x/cache.md:372 +#: ./docs/9.x/cache.md:378 +#: ./docs/10.x/cache.md:346 +#: ./docs/11.x/cache.md:374 +#: ./docs/master/cache.md:331 msgid "Within our application's `ProcessPodcast` job, we can restore and release the lock using the owner token:" -msgstr "在專案的 `ProcessPodcast` 任務中,我們可以通過擁有者權杖來恢復與釋放 Lock:" +msgstr "" -#: docs/10.x/cache.md:block 128 (code) -msgid "Cache::restoreLock('processing', $this->owner)->release();\n" -msgstr "Cache::restoreLock('processing', $this->owner)->release();\n" +# CODE +#: ./docs/8.x/cache.md:374 +#: ./docs/9.x/cache.md:380 +#: ./docs/10.x/cache.md:348 +#: ./docs/11.x/cache.md:376 +#: ./docs/master/cache.md:333 +msgid "Cache::restoreLock('processing', $this->owner)->release();" +msgstr "" -#: docs/10.x/cache.md:block 129 (paragraph) +# P +#: ./docs/8.x/cache.md:376 +#: ./docs/9.x/cache.md:382 +#: ./docs/10.x/cache.md:350 +#: ./docs/11.x/cache.md:378 +#: ./docs/master/cache.md:335 msgid "If you would like to release a lock without respecting its current owner, you may use the `forceRelease` method:" -msgstr "若想在不理會目前擁有者的情況下釋放 Lock,可以使用 `forceRelease` 方法:" +msgstr "" -#: docs/10.x/cache.md:block 130 (code) -msgid "Cache::lock('processing')->forceRelease();\n" -msgstr "Cache::lock('processing')->forceRelease();\n" +# CODE +#: ./docs/8.x/cache.md:378 +#: ./docs/9.x/cache.md:384 +#: ./docs/10.x/cache.md:352 +#: ./docs/11.x/cache.md:380 +#: ./docs/master/cache.md:337 +msgid "Cache::lock('processing')->forceRelease();" +msgstr "" -#: docs/10.x/cache.md:block 132 (header) +# P +#: ./docs/8.x/cache.md:380 +#: ./docs/9.x/cache.md:386 +#: ./docs/10.x/cache.md:354 +#: ./docs/11.x/cache.md:382 +#: ./docs/master/cache.md:339 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cache.md:381 +#: ./docs/9.x/cache.md:387 +#: ./docs/10.x/cache.md:355 +#: ./docs/11.x/cache.md:383 +#: ./docs/master/cache.md:340 msgid "Adding Custom Cache Drivers" -msgstr "新增自訂快取 Driver" +msgstr "" -#: docs/10.x/cache.md:block 134 (header) +# P +#: ./docs/8.x/cache.md:383 +#: ./docs/9.x/cache.md:389 +#: ./docs/10.x/cache.md:357 +#: ./docs/11.x/cache.md:385 +#: ./docs/master/cache.md:342 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/cache.md:384 +#: ./docs/11.x/cache.md:412 +#: ./docs/master/cache.md:369 +msgid "Cache::extend('mongo', function (Application $app) {\n" +" return Cache::repository(new MongoStore);\n" +"});" +msgstr "" + +# H3 +#: ./docs/8.x/cache.md:384 +#: ./docs/9.x/cache.md:390 msgid "Writing The Driver" -msgstr "撰寫 Driver" +msgstr "" -#: docs/10.x/cache.md:block 135 (paragraph) +# P +#: ./docs/8.x/cache.md:386 +#: ./docs/9.x/cache.md:392 +#: ./docs/10.x/cache.md:360 +#: ./docs/11.x/cache.md:388 +#: ./docs/master/cache.md:345 msgid "To create our custom cache driver, we first need to implement the `Illuminate\\Contracts\\Cache\\Store` [contract](/docs/{{version}}/contracts). So, a MongoDB cache implementation might look something like this:" -msgstr "若要建立自訂快取 Driver,首先必須實作 `Illuminate\\Contracts\\Cache\\Store` [Contract](/docs/{{version}}/contracts)。因此,一個 MongoDB 的快取實作看起來會長這樣:" +msgstr "" -#: docs/10.x/cache.md:block 136 (code) +# CODE +#: ./docs/8.x/cache.md:388 +#: ./docs/9.x/cache.md:394 +#: ./docs/10.x/cache.md:362 +#: ./docs/11.x/cache.md:390 +#: ./docs/master/cache.md:347 msgid "app->booting(function () {\n" -" Cache::extend('mongo', function (Application $app) {\n" -" return Cache::repository(new MongoStore);\n" -" });\n" -" });\n" -" }\n\n" -" /**\n" -" * Bootstrap any application services.\n" -" */\n" -" public function boot(): void\n" -" {\n" -" // ...\n" -" }\n" -"}\n" - -#: docs/10.x/cache.md:block 144 (paragraph) -msgid "The first argument passed to the `extend` method is the name of the driver. This will correspond to your `driver` option in the `config/cache.php` configuration file. The second argument is a closure that should return an `Illuminate\\Cache\\Repository` instance. The closure will be passed an `$app` instance, which is an instance of the [service container](/docs/{{version}}/container)." -msgstr "傳入 `extend` 方法的第一個引數為 Driver 的名稱。這個名稱應對應到 `config/cache.php` 設定檔中的 `driver` 選項。第二個引數則是一個應回傳 `Illuminate\\Cache\\Repository` 實體的閉包。該閉包會被傳入一個 `$app` 實體,即為 [Service Container](/docs/{{version}}/container) 的實體。" - -#: docs/10.x/cache.md:block 145 (paragraph) -msgid "Once your extension is registered, update your `config/cache.php` configuration file's `driver` option to the name of your extension." -msgstr "註冊好擴充程式後,就可以將 `config/cache.php` 設定檔中的 `driver` 選項更新為擴充程式的名稱。" - -#: docs/10.x/cache.md:block 147 (header) -msgid "Events" -msgstr "事件" - -#: docs/10.x/cache.md:block 148 (paragraph) -msgid "To execute code on every cache operation, you may listen for the [events](/docs/{{version}}/events) fired by the cache. Typically, you should place these event listeners within your application's `App\\Providers\\EventServiceProvider` class:" -msgstr "若要在每個快取操作時執行程式碼,可以監聽快取所觸發的[事件](/docs/{{version}}/events)。一般來說,這些事件監聽程式應放置於專案的 `App\\Providers\\EventServiceProvider` 類別:" - -#: docs/10.x/cache.md:block 149 (code) -msgid "use App\\Listeners\\LogCacheHit;\n" -"use App\\Listeners\\LogCacheMissed;\n" -"use App\\Listeners\\LogKeyForgotten;\n" -"use App\\Listeners\\LogKeyWritten;\n" -"use Illuminate\\Cache\\Events\\CacheHit;\n" -"use Illuminate\\Cache\\Events\\CacheMissed;\n" -"use Illuminate\\Cache\\Events\\KeyForgotten;\n" -"use Illuminate\\Cache\\Events\\KeyWritten;\n\n" -"/**\n" -" * The event listener mappings for the application.\n" -" *\n" -" * @var array\n" -" */\n" -"protected $listen = [\n" -" CacheHit::class => [\n" -" LogCacheHit::class,\n" -" ],\n\n" -" CacheMissed::class => [\n" -" LogCacheMissed::class,\n" -" ],\n\n" -" KeyForgotten::class => [\n" -" LogKeyForgotten::class,\n" -" ],\n\n" -" KeyWritten::class => [\n" -" LogKeyWritten::class,\n" -" ],\n" -"];\n" -msgstr "use App\\Listeners\\LogCacheHit;\n" -"use App\\Listeners\\LogCacheMissed;\n" -"use App\\Listeners\\LogKeyForgotten;\n" -"use App\\Listeners\\LogKeyWritten;\n" -"use Illuminate\\Cache\\Events\\CacheHit;\n" -"use Illuminate\\Cache\\Events\\CacheMissed;\n" -"use Illuminate\\Cache\\Events\\KeyForgotten;\n" -"use Illuminate\\Cache\\Events\\KeyWritten;\n\n" -"/**\n" -" * The event listener mappings for the application.\n" -" *\n" -" * @var array\n" -" */\n" -"protected $listen = [\n" -" CacheHit::class => [\n" -" LogCacheHit::class,\n" -" ],\n\n" -" CacheMissed::class => [\n" -" LogCacheMissed::class,\n" -" ],\n\n" -" KeyForgotten::class => [\n" -" LogKeyForgotten::class,\n" -" ],\n\n" -" KeyWritten::class => [\n" -" LogKeyWritten::class,\n" -" ],\n" -"];\n" - -#: docs/8.x/cache.md:block 2 (unordered list) -msgid "[Cache Tags](#cache-tags)" -msgstr "[Cache 標籤](#cache-tags)" - -#: docs/8.x/cache.md:block 2 (unordered list) -msgid "[Storing Tagged Cache Items](#storing-tagged-cache-items)" -msgstr "[保存有標籤的 Cache 項目](#storing-tagged-cache-items)" - -#: docs/8.x/cache.md:block 2 (unordered list) -msgid "[Accessing Tagged Cache Items](#accessing-tagged-cache-items)" -msgstr "[存取有標籤的 Cache 項目](#accessing-tagged-cache-items)" - -#: docs/8.x/cache.md:block 2 (unordered list) -msgid "[Removing Tagged Cache Items](#removing-tagged-cache-items)" -msgstr "[移除有標籤的 Cache 項目](#removing-tagged-cache-items)" - -#: docs/8.x/cache.md:block 15 (paragraph) -msgid "When using the `database` cache driver, you will need to setup a table to contain the cache items. You'll find an example `Schema` declaration for the table below:" -msgstr "在使用 `database` 快取 Driver 時,需要先設定包含快取項目的資料表。該資料表的 `Schema` 宣告範例如下:" - -#: docs/8.x/cache.md:block 16 (code) -msgid "Schema::create('cache', function ($table) {\n" -" $table->string('key')->unique();\n" -" $table->text('value');\n" -" $table->integer('expiration');\n" -"});\n" -msgstr "Schema::create('cache', function ($table) {\n" -" $table->string('key')->unique();\n" -" $table->text('value');\n" -" $table->integer('expiration');\n" -"});\n" - -#: docs/8.x/cache.md:block 17 (quote) -msgid "{tip} You may also use the `php artisan cache:table` Artisan command to generate a migration with the proper schema." -msgstr "{tip} 可以使用 `php artisan cache:table` Artisan 指令來產生包含正確 Schema 的 Migration。" - -#: docs/8.x/cache.md:block 37 (code) -msgid "get();\n" -"});\n" -msgstr "$value = Cache::get('key', function () {\n" -" return DB::table(...)->get();\n" -"});\n" - -#: docs/8.x/cache.md:block 51 (code) -msgid "if (Cache::has('key')) {\n" -" //\n" -"}\n" -msgstr "if (Cache::has('key')) {\n" -" //\n" -"}\n" - -#: docs/8.x/cache.md:block 55 (code) -msgid "Cache::increment('key');\n" -"Cache::increment('key', $amount);\n" -"Cache::decrement('key');\n" -"Cache::decrement('key', $amount);\n" -msgstr "Cache::increment('key');\n" -"Cache::increment('key', $amount);\n" -"Cache::decrement('key');\n" -"Cache::decrement('key', $amount);\n" - -#: docs/8.x/cache.md:block 83 (quote) -msgid "{tip} If you are using the Memcached driver, items that are stored \"forever\" may be removed when the cache reaches its size limit." -msgstr "{tip} 若使用 Memcached Driver,使用「forever」儲存的項目可能會在快取達到大小限制時被移除。" - -#: docs/8.x/cache.md:block 92 (quote) -msgid "{note} Flushing the cache does not respect your configured cache \"prefix\" and will remove all entries from the cache. Consider this carefully when clearing a cache which is shared by other applications." -msgstr "{note} 使用 Flush 移除快取並不理會所設定的快取「前綴」,會將快取內所有的項目都移除。當快取有與其他應用程式共用時,在清除快取前請三思。" - -#: docs/8.x/cache.md:block 101 (quote) -msgid "{tip} When testing call to the global `cache` function, you may use the `Cache::shouldReceive` method just as if you were [testing the facade](/docs/{{version}}/mocking#mocking-facades)." -msgstr "{tip} 在測試呼叫全域的 `cache` 函式時,可以像在[測試 Facade](/docs/{{version}}/mocking#mocking-facades)一樣,使用 `Cache::shouldReceive` 方法。" - -#: docs/8.x/cache.md:block 103 (header) -msgid "Cache Tags" -msgstr "快取標籤" - -#: docs/8.x/cache.md:block 104 (quote) -msgid "{note} Cache tags are not supported when using the `file`, `dynamodb`, or `database` cache drivers. Furthermore, when using multiple tags with caches that are stored \"forever\", performance will be best with a driver such as `memcached`, which automatically purges stale records." -msgstr "{note} 使用 `file`, `dynamodb` 或 `database` 快取 Driver 時,不支援使用快取標籤。此外,在以「forever」儲存的快取上使用多重標籤時,搭配 `memcached` Driver 能取得最佳效能,這些 Driver 通常會自動移除舊的記錄。" - -#: docs/8.x/cache.md:block 106 (header) -msgid "Storing Tagged Cache Items" -msgstr "儲存標籤的快取項目" - -#: docs/8.x/cache.md:block 107 (paragraph) -msgid "Cache tags allow you to tag related items in the cache and then flush all cached values that have been assigned a given tag. You may access a tagged cache by passing in an ordered array of tag names. For example, let's access a tagged cache and `put` a value into the cache:" -msgstr "快取標籤能讓你將快取內相關的項目標記在一起,並能將所有被指派到相同標籤的快取值一起被清除。可以通過傳入包含標籤名稱的有序陣列來存取標籤快取。舉例來說,我們來存取一個被標籤的快取,並將一個值 `put` 進快取內:" - -#: docs/8.x/cache.md:block 108 (code) -msgid "Cache::tags(['people', 'artists'])->put('John', $john, $seconds);\n\n" -"Cache::tags(['people', 'authors'])->put('Anne', $anne, $seconds);\n" -msgstr "Cache::tags(['people', 'artists'])->put('John', $john, $seconds);\n\n" -"Cache::tags(['people', 'authors'])->put('Anne', $anne, $seconds);\n" - -#: docs/8.x/cache.md:block 110 (header) -msgid "Accessing Tagged Cache Items" -msgstr "存取標籤的快取項目" - -#: docs/8.x/cache.md:block 111 (paragraph) -msgid "To retrieve a tagged cache item, pass the same ordered list of tags to the `tags` method and then call the `get` method with the key you wish to retrieve:" -msgstr "若要取得標籤的快取項目,可傳入相同的包含標籤的有序列表至 `tags` 方法內,並接著以欲存取的索引鍵來呼叫 `get` 方法:" - -#: docs/8.x/cache.md:block 112 (code) -msgid "$john = Cache::tags(['people', 'artists'])->get('John');\n\n" -"$anne = Cache::tags(['people', 'authors'])->get('Anne');\n" -msgstr "$john = Cache::tags(['people', 'artists'])->get('John');\n\n" -"$anne = Cache::tags(['people', 'authors'])->get('Anne');\n" - -#: docs/8.x/cache.md:block 114 (header) -msgid "Removing Tagged Cache Items" -msgstr "移除標籤的快取項目" - -#: docs/8.x/cache.md:block 115 (paragraph) -msgid "You may flush all items that are assigned a tag or list of tags. For example, this statement would remove all caches tagged with either `people`, `authors`, or both. So, both `Anne` and `John` would be removed from the cache:" -msgstr "可以移除有被設定一個或多個標籤的項目。舉例來說,這個陳述式可以移除所有被設為 `people`、`authors`、或是同時有這兩個標籤的快取。因此,`Anne` 與 `John` 都會被從快取內移除:" - -#: docs/8.x/cache.md:block 116 (code) -msgid "Cache::tags(['people', 'authors'])->flush();\n" -msgstr "Cache::tags(['people', 'authors'])->flush();\n" - -#: docs/8.x/cache.md:block 117 (paragraph) -msgid "In contrast, this statement would remove only cached values tagged with `authors`, so `Anne` would be removed, but not `John`:" -msgstr "與之相比,下列這個陳述式只會移除被標記為 `authors` 的快取值,因此 `Anne` 會被移除,而 `John` 則不會:" - -#: docs/8.x/cache.md:block 118 (code) -msgid "Cache::tags('authors')->flush();\n" -msgstr "Cache::tags('authors')->flush();\n" - -#: docs/8.x/cache.md:block 121 (quote) -msgid "{note} To utilize this feature, your application must be using the `memcached`, `redis`, `dynamodb`, `database`, `file`, or `array` cache driver as your application's default cache driver. In addition, all servers must be communicating with the same central cache server." -msgstr "{note} 若要使用此功能,則應用程式必須要使用 `memcached`, `redis`, `dynamodb`, `database`, `file` 或 `array` 作為應用程式的預設快取 Driver。另外,所有的伺服器也都必須要連線至相同的中央快取伺服器。" - -#: docs/8.x/cache.md:block 127 (code) -msgid "Schema::create('cache_locks', function ($table) {\n" -" $table->string('key')->primary();\n" -" $table->string('owner');\n" -" $table->integer('expiration');\n" -"});\n" -msgstr "Schema::create('cache_locks', function ($table) {\n" -" $table->string('key')->primary();\n" -" $table->string('owner');\n" -" $table->integer('expiration');\n" -"});\n" - -#: docs/8.x/cache.md:block 133 (code) -msgid "Cache::lock('foo')->get(function () {\n" -" // Lock acquired indefinitely and automatically released...\n" -"});\n" -msgstr "Cache::lock('foo')->get(function () {\n" -" // 立刻要求 Lock 並自動釋放……\n" -"});\n" +"}" +msgstr "" -#: docs/8.x/cache.md:block 135 (code) -msgid "use Illuminate\\Contracts\\Cache\\LockTimeoutException;\n\n" -"$lock = Cache::lock('foo', 10);\n\n" -"try {\n" -" $lock->block(5);\n\n" -" // Lock acquired after waiting a maximum of 5 seconds...\n" -"} catch (LockTimeoutException $e) {\n" -" // Unable to acquire lock...\n" -"} finally {\n" -" optional($lock)->release();\n" -"}\n" -msgstr "use Illuminate\\Contracts\\Cache\\LockTimeoutException;\n\n" -"$lock = Cache::lock('foo', 10);\n\n" -"try {\n" -" $lock->block(5);\n\n" -" // 等待最多 5 秒取得 Lock...\n" -"} catch (LockTimeoutException $e) {\n" -" // 無法取得 Lock...\n" -"} finally {\n" -" optional($lock)->release();\n" -"}\n" +# P +#: ./docs/8.x/cache.md:408 +#: ./docs/9.x/cache.md:414 +#: ./docs/10.x/cache.md:382 +#: ./docs/11.x/cache.md:410 +#: ./docs/master/cache.md:367 +msgid "We just need to implement each of these methods using a MongoDB connection. For an example of how to implement each of these methods, take a look at the `Illuminate\\Cache\\MemcachedStore` in the [Laravel framework source code](https://github.com/laravel/framework). Once our implementation is complete, we can finish our custom driver registration by calling the `Cache` facade's `extend` method:" +msgstr "" -#: docs/8.x/cache.md:block 154 (code) +# CODE +#: ./docs/8.x/cache.md:410 +#: ./docs/9.x/cache.md:416 msgid "Cache::extend('mongo', function ($app) {\n" " return Cache::repository(new MongoStore);\n" -"});\n" -msgstr "Cache::extend('mongo', function ($app) {\n" -" return Cache::repository(new MongoStore);\n" -"});\n" +"});" +msgstr "" -#: docs/8.x/cache.md:block 155 (quote) -msgid "{tip} If you're wondering where to put your custom cache driver code, you could create an `Extensions` namespace within your `app` directory. However, keep in mind that Laravel does not have a rigid application structure and you are free to organize your application according to your preferences." -msgstr "{tip} 若不知道該將自定快取 Driver 的程式碼放在哪裡,可在 `app` 目錄內建立一個 `Extensions` 命名空間。不過,請記得,Laravel 並沒有硬性規定應用程式的架構,你可以隨意依照你的喜好來阻止程式碼。" +# P +#: ./docs/8.x/cache.md:414 +#: ./docs/9.x/cache.md:421 +#: ./docs/10.x/cache.md:389 +#: ./docs/11.x/cache.md:417 +#: ./docs/master/cache.md:374 +msgid "If you're wondering where to put your custom cache driver code, you could create an `Extensions` namespace within your `app` directory. However, keep in mind that Laravel does not have a rigid application structure and you are free to organize your application according to your preferences." +msgstr "" -#: docs/8.x/cache.md:block 159 (code) +# P +#: ./docs/8.x/cache.md:416 +#: ./docs/9.x/cache.md:423 +#: ./docs/10.x/cache.md:391 +#: ./docs/11.x/cache.md:419 +#: ./docs/master/cache.md:376 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cache.md:417 +#: ./docs/9.x/cache.md:424 +msgid "Registering The Driver" +msgstr "" + +# P +#: ./docs/8.x/cache.md:419 +#: ./docs/9.x/cache.md:426 +#: ./docs/10.x/cache.md:394 +#: ./docs/11.x/cache.md:422 +#: ./docs/master/cache.md:379 +msgid "To register the custom cache driver with Laravel, we will use the `extend` method on the `Cache` facade. Since other service providers may attempt to read cached values within their `boot` method, we will register our custom driver within a `booting` callback. By using the `booting` callback, we can ensure that the custom driver is registered just before the `boot` method is called on our application's service providers but after the `register` method is called on all of the service providers. We will register our `booting` callback within the `register` method of our application's `App\\Providers\\AppServiceProvider` class:" +msgstr "" + +# CODE +#: ./docs/8.x/cache.md:421 +#: ./docs/9.x/cache.md:428 msgid "app->booting(function () {\n" -" Cache::extend('mongo', function ($app) {\n" -" return Cache::repository(new MongoStore);\n" -" });\n" -" });\n" -" }\n\n" -" /**\n" -" * Bootstrap any application services.\n" -" *\n" -" * @return void\n" -" */\n" -" public function boot()\n" -" {\n" -" //\n" -" }\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cache.md:456 +#: ./docs/9.x/cache.md:463 +#: ./docs/10.x/cache.md:428 +#: ./docs/11.x/cache.md:456 +#: ./docs/master/cache.md:413 +msgid "The first argument passed to the `extend` method is the name of the driver. This will correspond to your `driver` option in the `config/cache.php` configuration file. The second argument is a closure that should return an `Illuminate\\Cache\\Repository` instance. The closure will be passed an `$app` instance, which is an instance of the [service container](/docs/{{version}}/container)." +msgstr "" + +# P +#: ./docs/11.x/cache.md:458 +#: ./docs/master/cache.md:415 +msgid "Once your extension is registered, update the `CACHE_STORE` environment variable or `default` option within your application's `config/cache.php` configuration file to the name of your extension." +msgstr "" + +# P +#: ./docs/8.x/cache.md:458 +#: ./docs/9.x/cache.md:465 +#: ./docs/10.x/cache.md:430 +msgid "Once your extension is registered, update your `config/cache.php` configuration file's `driver` option to the name of your extension." +msgstr "" + +# P +#: ./docs/8.x/cache.md:460 +#: ./docs/9.x/cache.md:467 +#: ./docs/10.x/cache.md:432 +#: ./docs/11.x/cache.md:460 +#: ./docs/master/cache.md:417 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cache.md:461 +#: ./docs/9.x/cache.md:468 +#: ./docs/10.x/cache.md:433 +#: ./docs/11.x/cache.md:461 +#: ./docs/master/cache.md:418 +msgid "Events" +msgstr "" + +# P +#: ./docs/11.x/cache.md:463 +#: ./docs/master/cache.md:420 +msgid "To execute code on every cache operation, you may listen for various [events](/docs/{{version}}/events) dispatched by the cache:" +msgstr "" + +# P +#: ./docs/8.x/cache.md:463 +#: ./docs/9.x/cache.md:470 +#: ./docs/10.x/cache.md:435 +msgid "To execute code on every cache operation, you may listen for the [events](/docs/{{version}}/events) fired by the cache. Typically, you should place these event listeners within your application's `App\\Providers\\EventServiceProvider` class:" +msgstr "" -#: docs/8.x/cache.md:block 165 (code) +# CODE +#: ./docs/8.x/cache.md:465 msgid "/**\n" " * The event listener mappings for the application.\n" " *\n" @@ -1147,108 +2113,52 @@ msgid "/**\n" " 'Illuminate\\Cache\\Events\\KeyWritten' => [\n" " 'App\\Listeners\\LogKeyWritten',\n" " ],\n" -"];\n" -msgstr "/**\n" +"];" +msgstr "" + +# CODE +#: ./docs/9.x/cache.md:472 +#: ./docs/10.x/cache.md:437 +msgid "use App\\Listeners\\LogCacheHit;\n" +"use App\\Listeners\\LogCacheMissed;\n" +"use App\\Listeners\\LogKeyForgotten;\n" +"use App\\Listeners\\LogKeyWritten;\n" +"use Illuminate\\Cache\\Events\\CacheHit;\n" +"use Illuminate\\Cache\\Events\\CacheMissed;\n" +"use Illuminate\\Cache\\Events\\KeyForgotten;\n" +"use Illuminate\\Cache\\Events\\KeyWritten;\n\n" +"/**\n" " * The event listener mappings for the application.\n" " *\n" " * @var array\n" " */\n" "protected $listen = [\n" -" 'Illuminate\\Cache\\Events\\CacheHit' => [\n" -" 'App\\Listeners\\LogCacheHit',\n" +" CacheHit::class => [\n" +" LogCacheHit::class,\n" " ],\n\n" -" 'Illuminate\\Cache\\Events\\CacheMissed' => [\n" -" 'App\\Listeners\\LogCacheMissed',\n" +" CacheMissed::class => [\n" +" LogCacheMissed::class,\n" " ],\n\n" -" 'Illuminate\\Cache\\Events\\KeyForgotten' => [\n" -" 'App\\Listeners\\LogKeyForgotten',\n" +" KeyForgotten::class => [\n" +" LogKeyForgotten::class,\n" " ],\n\n" -" 'Illuminate\\Cache\\Events\\KeyWritten' => [\n" -" 'App\\Listeners\\LogKeyWritten',\n" +" KeyWritten::class => [\n" +" LogKeyWritten::class,\n" " ],\n" -"];\n" - -#: docs/9.x/cache.md:block 104 (quote) -msgid "**Warning** Cache tags are not supported when using the `file`, `dynamodb`, or `database` cache drivers. Furthermore, when using multiple tags with caches that are stored \"forever\", performance will be best with a driver such as `memcached`, which automatically purges stale records." -msgstr "**Warning** 使用 `file`, `dynamodb` 或 `database` 快取 Driver 時,不支援使用快取標籤。此外,在以「forever」儲存的快取上使用多重標籤時,搭配 `memcached` Driver 能取得最佳效能,這些 Driver 通常會自動移除舊的記錄。" - -#: docs/9.x/cache.md:block 111 (paragraph) -msgid "Items stored via tags may not be accessed without also providing the tags that were used to store the value. To retrieve a tagged cache item, pass the same ordered list of tags to the `tags` method and then call the `get` method with the key you wish to retrieve:" -msgstr "若沒有提供與保存項目時所指定的相同 Tag,就無法存取這些項目。若要取得待 Tag 的快取項目,請將相同的 Tag 以相同的順序傳入給 `tags` 方法,然後再以指定的索引鍵來呼叫 `get` 方法:" - -#: docs/master/cache.md:block 2 (unordered list) -msgid "[Pruning Stale Cache Tags](#pruning-stale-cache-tags)" -msgstr "[修建過時的快取 Tag](#pruning-stale-cache-tags)" - -#: docs/master/cache.md:block 120 (header) -msgid "Pruning Stale Cache Tags" -msgstr "修建過時的快取 Tag" - -#: docs/master/cache.md:block 121 (quote) -msgid "**Warning** Pruning stale cache tags is only necessary when using Redis as your application's cache driver." -msgstr "**Warning** 只有當專案使用 Redis 作為快取 Driver 時,才需要修建過時的快取 Tag。" - -#: docs/master/cache.md:block 122 (paragraph) -msgid "In order to properly prune stale cache tag entries when using the Redis cache driver, Laravel's `cache:prune-stale-tags` Artisan command should be [scheduled](/docs/{{version}}/scheduling) in your application's `App\\Console\\Kernel` class:" -msgstr "在使用 Redis 快取 Driver 時,若要正確地修建過時的快取 Tag,請在專案的 `App\\Console\\Kernel` 類別內[排程](/docs/{{version}}/scheduling)呼叫 Laravel 的 `cache:prune-stale-tags` Artisan 指令:" +"];" +msgstr "" -#: docs/master/cache.md:block 123 (code) -msgid "$schedule->command('cache:prune-stale-tags')->hourly();\n" -msgstr "$schedule->command('cache:prune-stale-tags')->hourly();\n" +# P +#: ./docs/11.x/cache.md:476 +msgid "To increase performance, you may disable cache events by setting the `events` configuration option to `false` for a given cache store in your application's `config/cache.php` configuration file:" +msgstr "" -#: docs/master/cache.md:block 164 (code) -msgid "app->booting(function () {\n" -" Cache::extend('mongo', function (Application $app) {\n" -" return Cache::repository(new MongoStore);\n" -" });\n" -" });\n" -" }\n\n" -" /**\n" -" * Bootstrap any application services.\n" -" */\n" -" public function boot(): void\n" -" {\n" -" // ...\n" -" }\n" -"}\n" -msgstr "app->booting(function () {\n" -" Cache::extend('mongo', function (Application $app) {\n" -" return Cache::repository(new MongoStore);\n" -" });\n" -" });\n" -" }\n\n" -" /**\n" -" * Bootstrap any application services.\n" -" */\n" -" public function boot(): void\n" -" {\n" -" // ...\n" -" }\n" -"}\n" +# CODE: php +#: ./docs/11.x/cache.md:478 +msgid "'database' => [\n" +" 'driver' => 'database',\n" +" // ...\n" +" 'events' => false,\n" +"]," +msgstr "" diff --git a/po/zh_TW/cashier-paddle.po b/po/zh_TW/cashier-paddle.po index 93e2517cd..48c62d892 100644 --- a/po/zh_TW/cashier-paddle.po +++ b/po/zh_TW/cashier-paddle.po @@ -10,416 +10,1155 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" - -#: docs/10.x/cashier-paddle.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H1 +#: ./docs/8.x/cashier-paddle.md:1 +#: ./docs/9.x/cashier-paddle.md:1 +#: ./docs/10.x/cashier-paddle.md:1 +#: ./docs/11.x/cashier-paddle.md:1 +#: ./docs/master/cashier-paddle.md:1 msgid "Laravel Cashier (Paddle)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:3 +#: ./docs/9.x/cashier-paddle.md:3 +#: ./docs/10.x/cashier-paddle.md:3 +#: ./docs/11.x/cashier-paddle.md:3 +#: ./docs/master/cashier-paddle.md:3 msgid "[Introduction](#introduction)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:4 +#: ./docs/9.x/cashier-paddle.md:4 +#: ./docs/10.x/cashier-paddle.md:4 +#: ./docs/11.x/cashier-paddle.md:4 +#: ./docs/master/cashier-paddle.md:4 msgid "[Upgrading Cashier](#upgrading-cashier)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:5 +#: ./docs/9.x/cashier-paddle.md:5 +#: ./docs/10.x/cashier-paddle.md:5 +#: ./docs/11.x/cashier-paddle.md:5 +#: ./docs/master/cashier-paddle.md:5 msgid "[Installation](#installation)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:6 +#: ./docs/9.x/cashier-paddle.md:6 +#: ./docs/10.x/cashier-paddle.md:6 +#: ./docs/11.x/cashier-paddle.md:6 +#: ./docs/master/cashier-paddle.md:6 msgid "[Paddle Sandbox](#paddle-sandbox)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:7 +#: ./docs/9.x/cashier-paddle.md:7 msgid "[Database Migrations](#database-migrations)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:8 +#: ./docs/9.x/cashier-paddle.md:8 +#: ./docs/10.x/cashier-paddle.md:7 +#: ./docs/11.x/cashier-paddle.md:7 +#: ./docs/master/cashier-paddle.md:7 msgid "[Configuration](#configuration)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:9 +#: ./docs/9.x/cashier-paddle.md:9 +#: ./docs/10.x/cashier-paddle.md:8 +#: ./docs/11.x/cashier-paddle.md:8 +#: ./docs/master/cashier-paddle.md:8 msgid "[Billable Model](#billable-model)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:10 +#: ./docs/9.x/cashier-paddle.md:10 +#: ./docs/10.x/cashier-paddle.md:9 +#: ./docs/11.x/cashier-paddle.md:9 +#: ./docs/master/cashier-paddle.md:9 msgid "[API Keys](#api-keys)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:11 +#: ./docs/9.x/cashier-paddle.md:11 +#: ./docs/10.x/cashier-paddle.md:10 +#: ./docs/11.x/cashier-paddle.md:10 +#: ./docs/master/cashier-paddle.md:10 msgid "[Paddle JS](#paddle-js)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:12 +#: ./docs/9.x/cashier-paddle.md:12 +#: ./docs/10.x/cashier-paddle.md:11 +#: ./docs/11.x/cashier-paddle.md:11 +#: ./docs/master/cashier-paddle.md:11 msgid "[Currency Configuration](#currency-configuration)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:13 +#: ./docs/11.x/cashier-paddle.md:13 +#: ./docs/master/cashier-paddle.md:13 +msgid "[Quickstart](#quickstart)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:13 +#: ./docs/9.x/cashier-paddle.md:13 +#: ./docs/10.x/cashier-paddle.md:12 +#: ./docs/11.x/cashier-paddle.md:12 +#: ./docs/master/cashier-paddle.md:12 msgid "[Overriding Default Models](#overriding-default-models)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:14 +#: ./docs/11.x/cashier-paddle.md:14 +#: ./docs/master/cashier-paddle.md:14 +msgid "[Selling Products](#quickstart-selling-products)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:14 +#: ./docs/9.x/cashier-paddle.md:14 msgid "[Core Concepts](#core-concepts)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:15 +#: ./docs/11.x/cashier-paddle.md:15 +#: ./docs/master/cashier-paddle.md:15 +msgid "[Selling Subscriptions](#quickstart-selling-subscriptions)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:15 +#: ./docs/9.x/cashier-paddle.md:15 msgid "[Pay Links](#pay-links)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:16 +#: ./docs/11.x/cashier-paddle.md:16 +#: ./docs/master/cashier-paddle.md:16 +msgid "[Checkout Sessions](#checkout-sessions)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:16 +#: ./docs/9.x/cashier-paddle.md:16 +#: ./docs/10.x/cashier-paddle.md:18 +#: ./docs/11.x/cashier-paddle.md:18 +#: ./docs/master/cashier-paddle.md:18 msgid "[Inline Checkout](#inline-checkout)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:17 +#: ./docs/11.x/cashier-paddle.md:17 +#: ./docs/master/cashier-paddle.md:17 +msgid "[Overlay Checkout](#overlay-checkout)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:17 +#: ./docs/9.x/cashier-paddle.md:17 msgid "[User Identification](#user-identification)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:18 +#: ./docs/9.x/cashier-paddle.md:18 msgid "[Prices](#prices)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:19 +#: ./docs/11.x/cashier-paddle.md:19 +#: ./docs/master/cashier-paddle.md:19 +msgid "[Guest Checkouts](#guest-checkouts)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:19 +#: ./docs/9.x/cashier-paddle.md:19 +#: ./docs/10.x/cashier-paddle.md:23 +#: ./docs/11.x/cashier-paddle.md:23 +#: ./docs/master/cashier-paddle.md:23 msgid "[Customers](#customers)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:20 +#: ./docs/11.x/cashier-paddle.md:20 +#: ./docs/master/cashier-paddle.md:20 +msgid "[Price Previews](#price-previews)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:20 +#: ./docs/9.x/cashier-paddle.md:20 +#: ./docs/10.x/cashier-paddle.md:24 +#: ./docs/11.x/cashier-paddle.md:24 +#: ./docs/master/cashier-paddle.md:24 msgid "[Customer Defaults](#customer-defaults)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:21 +#: ./docs/11.x/cashier-paddle.md:21 +#: ./docs/master/cashier-paddle.md:21 +msgid "[Customer Price Previews](#customer-price-previews)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:21 +#: ./docs/9.x/cashier-paddle.md:21 +#: ./docs/10.x/cashier-paddle.md:27 +#: ./docs/11.x/cashier-paddle.md:27 +#: ./docs/master/cashier-paddle.md:27 msgid "[Subscriptions](#subscriptions)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:22 +#: ./docs/11.x/cashier-paddle.md:22 +#: ./docs/master/cashier-paddle.md:22 +msgid "[Discounts](#price-discounts)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:22 +#: ./docs/9.x/cashier-paddle.md:22 +#: ./docs/10.x/cashier-paddle.md:28 +#: ./docs/11.x/cashier-paddle.md:28 +#: ./docs/master/cashier-paddle.md:28 msgid "[Creating Subscriptions](#creating-subscriptions)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:23 +#: ./docs/9.x/cashier-paddle.md:23 +#: ./docs/10.x/cashier-paddle.md:29 +#: ./docs/11.x/cashier-paddle.md:29 +#: ./docs/master/cashier-paddle.md:29 msgid "[Checking Subscription Status](#checking-subscription-status)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:24 +#: ./docs/9.x/cashier-paddle.md:24 +#: ./docs/10.x/cashier-paddle.md:30 +#: ./docs/11.x/cashier-paddle.md:30 +#: ./docs/master/cashier-paddle.md:30 msgid "[Subscription Single Charges](#subscription-single-charges)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:25 +#: ./docs/11.x/cashier-paddle.md:25 +#: ./docs/master/cashier-paddle.md:25 +msgid "[Retrieving Customers](#retrieving-customers)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:25 +#: ./docs/9.x/cashier-paddle.md:25 +#: ./docs/10.x/cashier-paddle.md:31 +#: ./docs/11.x/cashier-paddle.md:31 +#: ./docs/master/cashier-paddle.md:31 msgid "[Updating Payment Information](#updating-payment-information)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:26 +#: ./docs/11.x/cashier-paddle.md:26 +#: ./docs/master/cashier-paddle.md:26 +msgid "[Creating Customers](#creating-customers)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:26 +#: ./docs/9.x/cashier-paddle.md:26 +#: ./docs/10.x/cashier-paddle.md:32 +#: ./docs/11.x/cashier-paddle.md:32 +#: ./docs/master/cashier-paddle.md:32 msgid "[Changing Plans](#changing-plans)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:27 +#: ./docs/9.x/cashier-paddle.md:27 +#: ./docs/10.x/cashier-paddle.md:33 +#: ./docs/11.x/cashier-paddle.md:33 +#: ./docs/master/cashier-paddle.md:33 msgid "[Subscription Quantity](#subscription-quantity)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:28 +#: ./docs/9.x/cashier-paddle.md:28 msgid "[Subscription Modifiers](#subscription-modifiers)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) -msgid "[Multiple Subscriptions](#multiple-subscriptions)" +# P +#: ./docs/8.x/cashier-paddle.md:29 +#: ./docs/9.x/cashier-paddle.md:30 +#: ./docs/10.x/cashier-paddle.md:36 +#: ./docs/11.x/cashier-paddle.md:36 +#: ./docs/master/cashier-paddle.md:36 +msgid "[Pausing Subscriptions](#pausing-subscriptions)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) -msgid "[Pausing Subscriptions](#pausing-subscriptions)" +# P +#: ./docs/9.x/cashier-paddle.md:29 +#: ./docs/10.x/cashier-paddle.md:35 +#: ./docs/11.x/cashier-paddle.md:35 +#: ./docs/master/cashier-paddle.md:35 +msgid "[Multiple Subscriptions](#multiple-subscriptions)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:30 +#: ./docs/9.x/cashier-paddle.md:31 msgid "[Cancelling Subscriptions](#cancelling-subscriptions)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:31 +#: ./docs/9.x/cashier-paddle.md:32 +#: ./docs/10.x/cashier-paddle.md:38 +#: ./docs/11.x/cashier-paddle.md:38 +#: ./docs/master/cashier-paddle.md:38 msgid "[Subscription Trials](#subscription-trials)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:32 +#: ./docs/9.x/cashier-paddle.md:33 +#: ./docs/10.x/cashier-paddle.md:39 +#: ./docs/11.x/cashier-paddle.md:39 +#: ./docs/master/cashier-paddle.md:39 msgid "[With Payment Method Up Front](#with-payment-method-up-front)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:33 +#: ./docs/9.x/cashier-paddle.md:34 +#: ./docs/10.x/cashier-paddle.md:40 +#: ./docs/11.x/cashier-paddle.md:40 +#: ./docs/master/cashier-paddle.md:40 msgid "[Without Payment Method Up Front](#without-payment-method-up-front)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:34 +#: ./docs/11.x/cashier-paddle.md:34 +#: ./docs/master/cashier-paddle.md:34 +msgid "[Subscriptions With Multiple Products](#subscriptions-with-multiple-products)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:34 +#: ./docs/9.x/cashier-paddle.md:35 +#: ./docs/10.x/cashier-paddle.md:42 +#: ./docs/11.x/cashier-paddle.md:42 +#: ./docs/master/cashier-paddle.md:42 msgid "[Handling Paddle Webhooks](#handling-paddle-webhooks)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:35 +#: ./docs/9.x/cashier-paddle.md:36 +#: ./docs/10.x/cashier-paddle.md:43 +#: ./docs/11.x/cashier-paddle.md:43 +#: ./docs/master/cashier-paddle.md:43 msgid "[Defining Webhook Event Handlers](#defining-webhook-event-handlers)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:36 +#: ./docs/9.x/cashier-paddle.md:37 +#: ./docs/10.x/cashier-paddle.md:44 +#: ./docs/11.x/cashier-paddle.md:44 +#: ./docs/master/cashier-paddle.md:44 msgid "[Verifying Webhook Signatures](#verifying-webhook-signatures)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:37 +#: ./docs/11.x/cashier-paddle.md:37 +#: ./docs/master/cashier-paddle.md:37 +msgid "[Canceling Subscriptions](#canceling-subscriptions)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:37 +#: ./docs/9.x/cashier-paddle.md:38 +#: ./docs/10.x/cashier-paddle.md:45 +#: ./docs/11.x/cashier-paddle.md:45 +#: ./docs/master/cashier-paddle.md:45 msgid "[Single Charges](#single-charges)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:38 +#: ./docs/9.x/cashier-paddle.md:39 msgid "[Simple Charge](#simple-charge)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:39 +#: ./docs/9.x/cashier-paddle.md:40 msgid "[Charging Products](#charging-products)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:40 +#: ./docs/9.x/cashier-paddle.md:41 msgid "[Refunding Orders](#refunding-orders)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/10.x/cashier-paddle.md:41 +#: ./docs/11.x/cashier-paddle.md:41 +#: ./docs/master/cashier-paddle.md:41 +msgid "[Extend or Activate a Trial](#extend-or-activate-a-trial)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:41 +#: ./docs/9.x/cashier-paddle.md:42 msgid "[Receipts](#receipts)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:42 +#: ./docs/9.x/cashier-paddle.md:43 msgid "[Past & Upcoming Payments](#past-and-upcoming-payments)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:43 +#: ./docs/9.x/cashier-paddle.md:44 msgid "[Handling Failed Payments](#handling-failed-payments)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 2 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:44 +#: ./docs/9.x/cashier-paddle.md:45 +#: ./docs/10.x/cashier-paddle.md:51 +#: ./docs/11.x/cashier-paddle.md:51 +#: ./docs/master/cashier-paddle.md:51 msgid "[Testing](#testing)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 4 (header) +# P +#: ./docs/10.x/cashier-paddle.md:46 +#: ./docs/11.x/cashier-paddle.md:46 +#: ./docs/master/cashier-paddle.md:46 +msgid "[Charging for Products](#charging-for-products)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:46 +#: ./docs/9.x/cashier-paddle.md:47 +#: ./docs/10.x/cashier-paddle.md:53 +#: ./docs/11.x/cashier-paddle.md:53 +#: ./docs/master/cashier-paddle.md:53 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:47 +#: ./docs/11.x/cashier-paddle.md:47 +#: ./docs/master/cashier-paddle.md:47 +msgid "[Refunding Transactions](#refunding-transactions)" +msgstr "" + +# H2 +#: ./docs/8.x/cashier-paddle.md:47 +#: ./docs/9.x/cashier-paddle.md:48 +#: ./docs/10.x/cashier-paddle.md:54 +#: ./docs/11.x/cashier-paddle.md:54 +#: ./docs/master/cashier-paddle.md:54 msgid "Introduction" msgstr "" -#: docs/10.x/cashier-paddle.md:block 5 (quote) -msgid "**Warning** At this time, Cashier Paddle only supports Paddle Classic, which is not available to new Paddle customers unless you contact Paddle support." +# P +#: ./docs/10.x/cashier-paddle.md:48 +#: ./docs/11.x/cashier-paddle.md:48 +#: ./docs/master/cashier-paddle.md:48 +msgid "[Crediting Transactions](#crediting-transactions)" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:49 +#: ./docs/11.x/cashier-paddle.md:49 +#: ./docs/master/cashier-paddle.md:49 +msgid "[Transactions](#transactions)" msgstr "" -#: docs/10.x/cashier-paddle.md:block 6 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:49 +#: ./docs/9.x/cashier-paddle.md:50 msgid "[Laravel Cashier Paddle](https://github.com/laravel/cashier-paddle) provides an expressive, fluent interface to [Paddle's](https://paddle.com) subscription billing services. It handles almost all of the boilerplate subscription billing code you are dreading. In addition to basic subscription management, Cashier can handle: coupons, swapping subscription, subscription \"quantities\", cancellation grace periods, and more." msgstr "" -#: docs/10.x/cashier-paddle.md:block 7 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:50 +#: ./docs/11.x/cashier-paddle.md:50 +#: ./docs/master/cashier-paddle.md:50 +msgid "[Past and Upcoming Payments](#past-and-upcoming-payments)" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:51 +msgid "While working with Cashier we recommend you also review Paddle's [user guides](https://developer.paddle.com/guides) and [API documentation](https://developer.paddle.com/api-reference/intro)." +msgstr "" + +# P +#: ./docs/9.x/cashier-paddle.md:52 msgid "While working with Cashier we recommend you also review Paddle's [user guides](https://developer.paddle.com/guides) and [API documentation](https://developer.paddle.com/api-reference)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 9 (header) +# P +#: ./docs/8.x/cashier-paddle.md:53 +#: ./docs/9.x/cashier-paddle.md:54 +#: ./docs/10.x/cashier-paddle.md:63 +#: ./docs/11.x/cashier-paddle.md:63 +#: ./docs/master/cashier-paddle.md:63 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cashier-paddle.md:54 +#: ./docs/9.x/cashier-paddle.md:55 +#: ./docs/10.x/cashier-paddle.md:64 +#: ./docs/11.x/cashier-paddle.md:64 +#: ./docs/master/cashier-paddle.md:64 msgid "Upgrading Cashier" msgstr "" -#: docs/10.x/cashier-paddle.md:block 10 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:56 +#: ./docs/9.x/cashier-paddle.md:57 +#: ./docs/10.x/cashier-paddle.md:66 +#: ./docs/11.x/cashier-paddle.md:66 +#: ./docs/master/cashier-paddle.md:66 msgid "When upgrading to a new version of Cashier, it's important that you carefully review [the upgrade guide](https://github.com/laravel/cashier-paddle/blob/master/UPGRADE.md)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 12 (header) -msgid "Installation" +# P +#: ./docs/10.x/cashier-paddle.md:57 +#: ./docs/11.x/cashier-paddle.md:57 +#: ./docs/master/cashier-paddle.md:57 +msgid "This documentation is for Cashier Paddle 2.x's integration with Paddle Billing. If you're still using Paddle Classic, you should use [Cashier Paddle 1.x](https://github.com/laravel/cashier-paddle/tree/1.x)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 13 (paragraph) -msgid "First, install the Cashier package for Paddle using the Composer package manager:" +# P +#: ./docs/8.x/cashier-paddle.md:58 +#: ./docs/9.x/cashier-paddle.md:59 +#: ./docs/10.x/cashier-paddle.md:68 +#: ./docs/11.x/cashier-paddle.md:68 +#: ./docs/master/cashier-paddle.md:68 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:59 +#: ./docs/11.x/cashier-paddle.md:59 +#: ./docs/master/cashier-paddle.md:59 +msgid "[Laravel Cashier Paddle](https://github.com/laravel/cashier-paddle) provides an expressive, fluent interface to [Paddle's](https://paddle.com) subscription billing services. It handles almost all of the boilerplate subscription billing code you are dreading. In addition to basic subscription management, Cashier can handle: swapping subscriptions, subscription \"quantities\", subscription pausing, cancelation grace periods, and more." msgstr "" -#: docs/10.x/cashier-paddle.md:block 14 (code) -msgid "composer require laravel/cashier-paddle\n" +# H2 +#: ./docs/8.x/cashier-paddle.md:59 +#: ./docs/9.x/cashier-paddle.md:60 +#: ./docs/10.x/cashier-paddle.md:69 +#: ./docs/11.x/cashier-paddle.md:69 +#: ./docs/master/cashier-paddle.md:69 +msgid "Installation" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:61 +#: ./docs/11.x/cashier-paddle.md:61 +#: ./docs/master/cashier-paddle.md:61 +msgid "Before digging into Cashier Paddle, we recommend you also review Paddle's [concept guides](https://developer.paddle.com/concepts/overview) and [API documentation](https://developer.paddle.com/api-reference/overview)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 15 (quote) -msgid "**Warning** To ensure Cashier properly handles all Paddle events, remember to [set up Cashier's webhook handling](#handling-paddle-webhooks)." +# P +#: ./docs/8.x/cashier-paddle.md:61 +#: ./docs/9.x/cashier-paddle.md:62 +#: ./docs/10.x/cashier-paddle.md:71 +#: ./docs/11.x/cashier-paddle.md:71 +#: ./docs/master/cashier-paddle.md:71 +msgid "First, install the Cashier package for Paddle using the Composer package manager:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 17 (header) +# CODE +# CODE: shell +#: ./docs/8.x/cashier-paddle.md:63 +#: ./docs/9.x/cashier-paddle.md:64 +#: ./docs/10.x/cashier-paddle.md:73 +#: ./docs/11.x/cashier-paddle.md:73 +#: ./docs/master/cashier-paddle.md:73 +msgid "composer require laravel/cashier-paddle" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:65 +#: ./docs/9.x/cashier-paddle.md:69 +#: ./docs/10.x/cashier-paddle.md:90 +#: ./docs/11.x/cashier-paddle.md:90 +#: ./docs/master/cashier-paddle.md:90 +msgid "To ensure Cashier properly handles all Paddle events, remember to [set up Cashier's webhook handling](#handling-paddle-webhooks)." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:67 +#: ./docs/9.x/cashier-paddle.md:71 +#: ./docs/10.x/cashier-paddle.md:92 +#: ./docs/11.x/cashier-paddle.md:92 +#: ./docs/master/cashier-paddle.md:92 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:68 +#: ./docs/9.x/cashier-paddle.md:72 +#: ./docs/10.x/cashier-paddle.md:93 +#: ./docs/11.x/cashier-paddle.md:93 +#: ./docs/master/cashier-paddle.md:93 msgid "Paddle Sandbox" msgstr "" -#: docs/10.x/cashier-paddle.md:block 18 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:70 +#: ./docs/9.x/cashier-paddle.md:74 msgid "During local and staging development, you should [register a Paddle Sandbox account](https://developer.paddle.com/getting-started/sandbox). This account will give you a sandboxed environment to test and develop your applications without making actual payments. You may use Paddle's [test card numbers](https://developer.paddle.com/getting-started/sandbox#test-cards) to simulate various payment scenarios." msgstr "" -#: docs/10.x/cashier-paddle.md:block 19 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:72 +#: ./docs/9.x/cashier-paddle.md:76 +#: ./docs/10.x/cashier-paddle.md:97 +#: ./docs/11.x/cashier-paddle.md:97 +#: ./docs/master/cashier-paddle.md:97 msgid "When using the Paddle Sandbox environment, you should set the `PADDLE_SANDBOX` environment variable to `true` within your application's `.env` file:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 20 (code) -msgid "PADDLE_SANDBOX=true\n" +# P +# CODE: ini +#: ./docs/8.x/cashier-paddle.md:74 +#: ./docs/9.x/cashier-paddle.md:78 +#: ./docs/10.x/cashier-paddle.md:99 +#: ./docs/11.x/cashier-paddle.md:99 +#: ./docs/master/cashier-paddle.md:99 +msgid "PADDLE_SANDBOX=true" msgstr "" -#: docs/10.x/cashier-paddle.md:block 21 (paragraph) -msgid "After you have finished developing your application you may [apply for a Paddle vendor account](https://paddle.com). Before your application is placed into production, Paddle will need to approve your application's domain." +# P +#: ./docs/8.x/cashier-paddle.md:76 +msgid "After you have finished developing your application you may [apply for a Paddle vendor account](https://paddle.com)." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:77 +#: ./docs/11.x/cashier-paddle.md:77 +#: ./docs/master/cashier-paddle.md:77 +msgid "Next, you should publish the Cashier migration files using the `vendor:publish` Artisan command:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 23 (header) +# P +#: ./docs/8.x/cashier-paddle.md:78 +#: ./docs/9.x/cashier-paddle.md:84 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:79 +#: ./docs/9.x/cashier-paddle.md:85 msgid "Database Migrations" msgstr "" -#: docs/10.x/cashier-paddle.md:block 24 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:81 +#: ./docs/9.x/cashier-paddle.md:87 msgid "The Cashier service provider registers its own database migration directory, so remember to migrate your database after installing the package. The Cashier migrations will create a new `customers` table. In addition, a new `subscriptions` table will be created to store all of your customer's subscriptions. Finally, a new `receipts` table will be created to store all of your application's receipt information:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 25 (code) -msgid "php artisan migrate\n" +# P +#: ./docs/9.x/cashier-paddle.md:82 +#: ./docs/10.x/cashier-paddle.md:103 +#: ./docs/11.x/cashier-paddle.md:103 +#: ./docs/master/cashier-paddle.md:103 +msgid "After you have finished developing your application you may [apply for a Paddle vendor account](https://paddle.com). Before your application is placed into production, Paddle will need to approve your application's domain." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:83 +#: ./docs/11.x/cashier-paddle.md:83 +#: ./docs/master/cashier-paddle.md:83 +msgid "Then, you should run your application's database migrations. The Cashier migrations will create a new `customers` table. In addition, new `subscriptions` and `subscription_items` tables will be created to store all of your customer's subscriptions. Lastly, a new `transactions` table will be created to store all of the Paddle transactions associated with your customers:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/cashier-paddle.md:83 +#: ./docs/9.x/cashier-paddle.md:89 +#: ./docs/10.x/cashier-paddle.md:85 +#: ./docs/11.x/cashier-paddle.md:85 +#: ./docs/master/cashier-paddle.md:85 +msgid "php artisan migrate" msgstr "" -#: docs/10.x/cashier-paddle.md:block 26 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:85 +#: ./docs/9.x/cashier-paddle.md:93 msgid "If you need to overwrite the migrations that are included with Cashier, you can publish them using the `vendor:publish` Artisan command:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 27 (code) -msgid "php artisan vendor:publish --tag=\"cashier-migrations\"\n" +# CODE +# CODE: shell +#: ./docs/8.x/cashier-paddle.md:87 +#: ./docs/9.x/cashier-paddle.md:95 +#: ./docs/10.x/cashier-paddle.md:79 +#: ./docs/11.x/cashier-paddle.md:79 +#: ./docs/master/cashier-paddle.md:79 +msgid "php artisan vendor:publish --tag=\"cashier-migrations\"" msgstr "" -#: docs/10.x/cashier-paddle.md:block 28 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:89 +#: ./docs/9.x/cashier-paddle.md:99 msgid "If you would like to prevent Cashier's migrations from running entirely, you may use the `ignoreMigrations` provided by Cashier. Typically, this method should be called in the `register` method of your `AppServiceProvider`:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 29 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:91 +#: ./docs/9.x/cashier-paddle.md:101 msgid "use Laravel\\Paddle\\Cashier;\n\n" "/**\n" " * Register any application services.\n" +" *\n" +" * @return void\n" " */\n" -"public function register(): void\n" +"public function register()\n" "{\n" " Cashier::ignoreMigrations();\n" -"}\n" -msgstr "" - -#: docs/10.x/cashier-paddle.md:block 31 (header) +"}" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:95 +#: ./docs/11.x/cashier-paddle.md:95 +#: ./docs/master/cashier-paddle.md:95 +msgid "During local and staging development, you should [register a Paddle Sandbox account](https://sandbox-login.paddle.com/signup). This account will give you a sandboxed environment to test and develop your applications without making actual payments. You may use Paddle's [test card numbers](https://developer.paddle.com/concepts/payment-methods/credit-debit-card) to simulate various payment scenarios." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:103 +#: ./docs/9.x/cashier-paddle.md:113 +#: ./docs/10.x/cashier-paddle.md:105 +#: ./docs/11.x/cashier-paddle.md:105 +#: ./docs/master/cashier-paddle.md:105 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cashier-paddle.md:104 +#: ./docs/9.x/cashier-paddle.md:114 +#: ./docs/10.x/cashier-paddle.md:106 +#: ./docs/11.x/cashier-paddle.md:106 +#: ./docs/master/cashier-paddle.md:106 msgid "Configuration" msgstr "" -#: docs/10.x/cashier-paddle.md:block 33 (header) +# P +#: ./docs/8.x/cashier-paddle.md:106 +#: ./docs/9.x/cashier-paddle.md:116 +#: ./docs/10.x/cashier-paddle.md:108 +#: ./docs/11.x/cashier-paddle.md:108 +#: ./docs/master/cashier-paddle.md:108 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:107 +#: ./docs/9.x/cashier-paddle.md:117 +#: ./docs/10.x/cashier-paddle.md:109 +#: ./docs/11.x/cashier-paddle.md:109 +#: ./docs/master/cashier-paddle.md:109 msgid "Billable Model" msgstr "" -#: docs/10.x/cashier-paddle.md:block 34 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:109 +#: ./docs/9.x/cashier-paddle.md:119 msgid "Before using Cashier, you must add the `Billable` trait to your user model definition. This trait provides various methods to allow you to perform common billing tasks, such as creating subscriptions, applying coupons and updating payment method information:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 35 (code) +# P +#: ./docs/10.x/cashier-paddle.md:111 +#: ./docs/11.x/cashier-paddle.md:111 +#: ./docs/master/cashier-paddle.md:111 +msgid "Before using Cashier, you must add the `Billable` trait to your user model definition. This trait provides various methods to allow you to perform common billing tasks, such as creating subscriptions and updating payment method information:" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:111 +#: ./docs/9.x/cashier-paddle.md:121 +#: ./docs/10.x/cashier-paddle.md:113 +#: ./docs/11.x/cashier-paddle.md:113 +#: ./docs/master/cashier-paddle.md:113 msgid "use Laravel\\Paddle\\Billable;\n\n" "class User extends Authenticatable\n" "{\n" " use Billable;\n" -"}\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 36 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:118 +#: ./docs/9.x/cashier-paddle.md:128 +#: ./docs/10.x/cashier-paddle.md:120 +#: ./docs/11.x/cashier-paddle.md:120 +#: ./docs/master/cashier-paddle.md:120 msgid "If you have billable entities that are not users, you may also add the trait to those classes:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 37 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:120 +#: ./docs/9.x/cashier-paddle.md:130 +#: ./docs/10.x/cashier-paddle.md:122 +#: ./docs/11.x/cashier-paddle.md:122 +#: ./docs/master/cashier-paddle.md:122 msgid "use Illuminate\\Database\\Eloquent\\Model;\n" "use Laravel\\Paddle\\Billable;\n\n" "class Team extends Model\n" "{\n" " use Billable;\n" -"}\n" -msgstr "" - -#: docs/10.x/cashier-paddle.md:block 39 (header) +"}" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:128 +#: ./docs/9.x/cashier-paddle.md:138 +#: ./docs/10.x/cashier-paddle.md:130 +#: ./docs/11.x/cashier-paddle.md:130 +#: ./docs/master/cashier-paddle.md:130 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:129 +#: ./docs/9.x/cashier-paddle.md:139 +#: ./docs/10.x/cashier-paddle.md:131 +#: ./docs/11.x/cashier-paddle.md:131 +#: ./docs/master/cashier-paddle.md:131 msgid "API Keys" msgstr "" -#: docs/10.x/cashier-paddle.md:block 40 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:131 +#: ./docs/9.x/cashier-paddle.md:141 +#: ./docs/10.x/cashier-paddle.md:133 +#: ./docs/11.x/cashier-paddle.md:133 +#: ./docs/master/cashier-paddle.md:133 msgid "Next, you should configure your Paddle keys in your application's `.env` file. You can retrieve your Paddle API keys from the Paddle control panel:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 41 (code) +# CODE +# CODE: ini +#: ./docs/8.x/cashier-paddle.md:133 +#: ./docs/9.x/cashier-paddle.md:143 msgid "PADDLE_VENDOR_ID=your-paddle-vendor-id\n" "PADDLE_VENDOR_AUTH_CODE=your-paddle-vendor-auth-code\n" "PADDLE_PUBLIC_KEY=\"your-paddle-public-key\"\n" -"PADDLE_SANDBOX=true\n" -msgstr "" - -#: docs/10.x/cashier-paddle.md:block 42 (paragraph) +"PADDLE_SANDBOX=true" +msgstr "" + +# CODE: ini +#: ./docs/10.x/cashier-paddle.md:135 +#: ./docs/11.x/cashier-paddle.md:135 +#: ./docs/master/cashier-paddle.md:135 +msgid "PADDLE_CLIENT_SIDE_TOKEN=your-paddle-client-side-token\n" +"PADDLE_API_KEY=your-paddle-api-key\n" +"PADDLE_RETAIN_KEY=your-paddle-retain-key\n" +"PADDLE_WEBHOOK_SECRET=\"your-paddle-webhook-secret\"\n" +"PADDLE_SANDBOX=true" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:138 +#: ./docs/9.x/cashier-paddle.md:150 +#: ./docs/10.x/cashier-paddle.md:143 +#: ./docs/11.x/cashier-paddle.md:143 +#: ./docs/master/cashier-paddle.md:143 msgid "The `PADDLE_SANDBOX` environment variable should be set to `true` when you are using [Paddle's Sandbox environment](#paddle-sandbox). The `PADDLE_SANDBOX` variable should be set to `false` if you are deploying your application to production and are using Paddle's live vendor environment." msgstr "" -#: docs/10.x/cashier-paddle.md:block 44 (header) +# P +#: ./docs/8.x/cashier-paddle.md:140 +#: ./docs/9.x/cashier-paddle.md:152 +#: ./docs/10.x/cashier-paddle.md:147 +#: ./docs/11.x/cashier-paddle.md:147 +#: ./docs/master/cashier-paddle.md:147 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:141 +#: ./docs/9.x/cashier-paddle.md:153 +#: ./docs/10.x/cashier-paddle.md:148 +#: ./docs/11.x/cashier-paddle.md:148 +#: ./docs/master/cashier-paddle.md:148 msgid "Paddle JS" msgstr "" -#: docs/10.x/cashier-paddle.md:block 45 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:143 +#: ./docs/9.x/cashier-paddle.md:155 +#: ./docs/10.x/cashier-paddle.md:150 +#: ./docs/11.x/cashier-paddle.md:150 +#: ./docs/master/cashier-paddle.md:150 msgid "Paddle relies on its own JavaScript library to initiate the Paddle checkout widget. You can load the JavaScript library by placing the `@paddleJS` Blade directive right before your application layout's closing `` tag:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 46 (code) +# P +#: ./docs/10.x/cashier-paddle.md:145 +#: ./docs/11.x/cashier-paddle.md:145 +#: ./docs/master/cashier-paddle.md:145 +msgid "The `PADDLE_RETAIN_KEY` is optional and should only be set if you're using Paddle with [Retain](https://developer.paddle.com/paddlejs/retain)." +msgstr "" + +# CODE +# CODE: blade +#: ./docs/8.x/cashier-paddle.md:145 +#: ./docs/9.x/cashier-paddle.md:157 +#: ./docs/10.x/cashier-paddle.md:152 +#: ./docs/11.x/cashier-paddle.md:152 +#: ./docs/master/cashier-paddle.md:152 msgid "\n" " ...\n\n" " @paddleJS\n" -"\n" -msgstr "" - -#: docs/10.x/cashier-paddle.md:block 48 (header) +"" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:151 +#: ./docs/9.x/cashier-paddle.md:165 +#: ./docs/10.x/cashier-paddle.md:160 +#: ./docs/11.x/cashier-paddle.md:160 +#: ./docs/master/cashier-paddle.md:160 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:152 +#: ./docs/9.x/cashier-paddle.md:166 +#: ./docs/10.x/cashier-paddle.md:161 +#: ./docs/11.x/cashier-paddle.md:161 +#: ./docs/master/cashier-paddle.md:161 msgid "Currency Configuration" msgstr "" -#: docs/10.x/cashier-paddle.md:block 49 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:154 +#: ./docs/9.x/cashier-paddle.md:168 msgid "The default Cashier currency is United States Dollars (USD). You can change the default currency by defining a `CASHIER_CURRENCY` environment variable within your application's `.env` file:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 50 (code) -msgid "CASHIER_CURRENCY=EUR\n" +# CODE +# CODE: bash +# CODE: ini +#: ./docs/8.x/cashier-paddle.md:156 +#: ./docs/8.x/cashier-paddle.md:1052 +#: ./docs/9.x/cashier-paddle.md:170 +#: ./docs/9.x/cashier-paddle.md:1124 +msgid "CASHIER_CURRENCY=EUR" msgstr "" -#: docs/10.x/cashier-paddle.md:block 51 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:158 +#: ./docs/9.x/cashier-paddle.md:174 msgid "In addition to configuring Cashier's currency, you may also specify a locale to be used when formatting money values for display on invoices. Internally, Cashier utilizes [PHP's `NumberFormatter` class](https://www.php.net/manual/en/class.numberformatter.php) to set the currency locale:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 52 (code) -msgid "CASHIER_CURRENCY_LOCALE=nl_BE\n" +# CODE +# CODE: ini +#: ./docs/8.x/cashier-paddle.md:160 +#: ./docs/9.x/cashier-paddle.md:176 +#: ./docs/10.x/cashier-paddle.md:165 +#: ./docs/11.x/cashier-paddle.md:165 +#: ./docs/master/cashier-paddle.md:165 +msgid "CASHIER_CURRENCY_LOCALE=nl_BE" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:162 +#: ./docs/9.x/cashier-paddle.md:181 +#: ./docs/10.x/cashier-paddle.md:170 +#: ./docs/11.x/cashier-paddle.md:170 +#: ./docs/master/cashier-paddle.md:170 +msgid "In order to use locales other than `en`, ensure the `ext-intl` PHP extension is installed and configured on your server." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:163 +#: ./docs/master/cashier-paddle.md:163 +msgid "You can specify a locale to be used when formatting money values for display on invoices. Internally, Cashier utilizes [PHP's `NumberFormatter` class](https://www.php.net/manual/en/class.numberformatter.php) class to set the currency locale:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 53 (quote) -msgid "**Warning** In order to use locales other than `en`, ensure the `ext-intl` PHP extension is installed and configured on your server." +# P +#: ./docs/11.x/cashier-paddle.md:163 +msgid "You can specify a locale to be used when formatting money values for display on invoices. Internally, Cashier utilizes [PHP's `NumberFormatter` class](https://www.php.net/manual/en/class.numberformatter.php) to set the currency locale:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 55 (header) +# P +#: ./docs/8.x/cashier-paddle.md:164 +#: ./docs/9.x/cashier-paddle.md:183 +#: ./docs/10.x/cashier-paddle.md:172 +#: ./docs/11.x/cashier-paddle.md:172 +#: ./docs/master/cashier-paddle.md:172 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:165 +#: ./docs/9.x/cashier-paddle.md:184 +#: ./docs/10.x/cashier-paddle.md:173 +#: ./docs/11.x/cashier-paddle.md:173 +#: ./docs/master/cashier-paddle.md:173 msgid "Overriding Default Models" msgstr "" -#: docs/10.x/cashier-paddle.md:block 56 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:167 +#: ./docs/9.x/cashier-paddle.md:186 +#: ./docs/10.x/cashier-paddle.md:175 +#: ./docs/11.x/cashier-paddle.md:175 +#: ./docs/master/cashier-paddle.md:175 msgid "You are free to extend the models used internally by Cashier by defining your own model and extending the corresponding Cashier model:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 57 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:169 +#: ./docs/9.x/cashier-paddle.md:188 +#: ./docs/10.x/cashier-paddle.md:177 +#: ./docs/11.x/cashier-paddle.md:177 +#: ./docs/master/cashier-paddle.md:177 msgid "use Laravel\\Paddle\\Subscription as CashierSubscription;\n\n" "class Subscription extends CashierSubscription\n" "{\n" " // ...\n" -"}\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 58 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:176 +#: ./docs/9.x/cashier-paddle.md:195 +#: ./docs/10.x/cashier-paddle.md:184 +#: ./docs/11.x/cashier-paddle.md:184 +#: ./docs/master/cashier-paddle.md:184 msgid "After defining your model, you may instruct Cashier to use your custom model via the `Laravel\\Paddle\\Cashier` class. Typically, you should inform Cashier about your custom models in the `boot` method of your application's `App\\Providers\\AppServiceProvider` class:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 59 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:178 +#: ./docs/9.x/cashier-paddle.md:197 msgid "use App\\Models\\Cashier\\Receipt;\n" "use App\\Models\\Cashier\\Subscription;\n\n" "/**\n" " * Bootstrap any application services.\n" +" *\n" +" * @return void\n" " */\n" -"public function boot(): void\n" +"public function boot()\n" "{\n" " Cashier::useReceiptModel(Receipt::class);\n" " Cashier::useSubscriptionModel(Subscription::class);\n" -"}\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:186 +#: ./docs/11.x/cashier-paddle.md:186 +#: ./docs/master/cashier-paddle.md:186 +msgid "use App\\Models\\Cashier\\Subscription;\n" +"use App\\Models\\Cashier\\Transaction;\n\n" +"/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Cashier::useSubscriptionModel(Subscription::class);\n" +" Cashier::useTransactionModel(Transaction::class);\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 61 (header) +# P +#: ./docs/8.x/cashier-paddle.md:192 +#: ./docs/9.x/cashier-paddle.md:211 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cashier-paddle.md:193 +#: ./docs/9.x/cashier-paddle.md:212 msgid "Core Concepts" msgstr "" -#: docs/10.x/cashier-paddle.md:block 63 (header) +# P +#: ./docs/8.x/cashier-paddle.md:195 +#: ./docs/9.x/cashier-paddle.md:214 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:196 +#: ./docs/9.x/cashier-paddle.md:215 msgid "Pay Links" msgstr "" -#: docs/10.x/cashier-paddle.md:block 64 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:198 +#: ./docs/11.x/cashier-paddle.md:198 +#: ./docs/master/cashier-paddle.md:198 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:198 +#: ./docs/9.x/cashier-paddle.md:217 msgid "Paddle lacks an extensive CRUD API to perform subscription state changes. Therefore, most interactions with Paddle are done through its [checkout widget](https://developer.paddle.com/guides/how-tos/checkout/paddle-checkout). Before we can display the checkout widget, we must generate a \"pay link\" using Cashier. A \"pay link\" will inform the checkout widget of the billing operation we wish to perform:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 65 (code) +# H2 +#: ./docs/10.x/cashier-paddle.md:199 +#: ./docs/11.x/cashier-paddle.md:199 +#: ./docs/master/cashier-paddle.md:199 +msgid "Quickstart" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:200 +#: ./docs/9.x/cashier-paddle.md:219 msgid "use App\\Models\\User;\n" "use Illuminate\\Http\\Request;\n\n" "Route::get('/user/subscribe', function (Request $request) {\n" @@ -427,136 +1166,464 @@ msgid "use App\\Models\\User;\n" " ->returnTo(route('home'))\n" " ->create();\n\n" " return view('billing', ['payLink' => $payLink]);\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:201 +#: ./docs/11.x/cashier-paddle.md:201 +#: ./docs/master/cashier-paddle.md:201 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:202 +#: ./docs/11.x/cashier-paddle.md:202 +#: ./docs/master/cashier-paddle.md:202 +msgid "Selling Products" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:205 +#: ./docs/10.x/cashier-paddle.md:303 +#: ./docs/11.x/cashier-paddle.md:205 +#: ./docs/11.x/cashier-paddle.md:303 +#: ./docs/master/cashier-paddle.md:205 +#: ./docs/master/cashier-paddle.md:303 +msgid "Before utilizing Paddle Checkout, you should define Products with fixed prices in your Paddle dashboard. In addition, you should [configure Paddle's webhook handling](#handling-paddle-webhooks)." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:207 +#: ./docs/10.x/cashier-paddle.md:305 +#: ./docs/11.x/cashier-paddle.md:207 +#: ./docs/11.x/cashier-paddle.md:305 +#: ./docs/master/cashier-paddle.md:207 +#: ./docs/master/cashier-paddle.md:305 +msgid "Offering product and subscription billing via your application can be intimidating. However, thanks to Cashier and [Paddle's Checkout Overlay](https://www.paddle.com/billing/checkout), you can easily build modern, robust payment integrations." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:209 +#: ./docs/11.x/cashier-paddle.md:209 +#: ./docs/master/cashier-paddle.md:209 +msgid "To charge customers for non-recurring, single-charge products, we'll utilize Cashier to charge customers with Paddle's Checkout Overlay, where they will provide their payment details and confirm their purchase. Once the payment has been made via the Checkout Overlay, the customer will be redirected to a success URL of your choosing within your application:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:211 +#: ./docs/11.x/cashier-paddle.md:211 +#: ./docs/master/cashier-paddle.md:211 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/buy', function (Request $request) {\n" +" $checkout = $request->user()->checkout('pri_deluxe_album')\n" +" ->returnTo(route('dashboard'));\n\n" +" return view('buy', ['checkout' => $checkout]);\n" +"})->name('checkout');" msgstr "" -#: docs/10.x/cashier-paddle.md:block 66 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:211 +#: ./docs/9.x/cashier-paddle.md:230 msgid "Cashier includes a `paddle-button` [Blade component](/docs/{{version}}/blade#components). We may pass the pay link URL to this component as a \"prop\". When this button is clicked, Paddle's checkout widget will be displayed:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 67 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/cashier-paddle.md:213 +#: ./docs/8.x/cashier-paddle.md:482 +#: ./docs/9.x/cashier-paddle.md:232 +#: ./docs/9.x/cashier-paddle.md:510 msgid "\n" " Subscribe\n" -"\n" +"" msgstr "" -#: docs/10.x/cashier-paddle.md:block 68 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:219 +#: ./docs/9.x/cashier-paddle.md:238 msgid "By default, this will display a button with the standard Paddle styling. You can remove all Paddle styling by adding the `data-theme=\"none\"` attribute to the component:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 69 (code) +# P +#: ./docs/10.x/cashier-paddle.md:220 +#: ./docs/11.x/cashier-paddle.md:220 +#: ./docs/master/cashier-paddle.md:220 +msgid "As you can see in the example above, we will utilize Cashier's provided `checkout` method to create a checkout object to present the customer the Paddle Checkout Overlay for a given \"price identifier\". When using Paddle, \"prices\" refer to [defined prices for specific products](https://developer.paddle.com/build/products/create-products-prices)." +msgstr "" + +# CODE: html +#: ./docs/8.x/cashier-paddle.md:221 +#: ./docs/9.x/cashier-paddle.md:240 msgid "\n" " Subscribe\n" -"\n" +"" msgstr "" -#: docs/10.x/cashier-paddle.md:block 70 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:222 +#: ./docs/11.x/cashier-paddle.md:222 +#: ./docs/master/cashier-paddle.md:222 +msgid "If necessary, the `checkout` method will automatically create a customer in Paddle and connect that Paddle customer record to the corresponding user in your application's database. After completing the checkout session, the customer will be redirected to a dedicated success page where you can display an informational message to the customer." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:224 +#: ./docs/11.x/cashier-paddle.md:224 +#: ./docs/master/cashier-paddle.md:224 +msgid "In the `buy` view, we will include a button to display the Checkout Overlay. The `paddle-button` Blade component is included with Cashier Paddle; however, you may also [manually render an overlay checkout](#manually-rendering-an-overlay-checkout):" +msgstr "" + +# CODE: html +#: ./docs/10.x/cashier-paddle.md:226 +#: ./docs/11.x/cashier-paddle.md:226 +#: ./docs/master/cashier-paddle.md:226 +msgid "\n" +" Buy Product\n" +"" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:227 +#: ./docs/9.x/cashier-paddle.md:246 msgid "The Paddle checkout widget is asynchronous. Once the user creates or updates a subscription within the widget, Paddle will send your application webhooks so that you may properly update the subscription state in our own database. Therefore, it's important that you properly [set up webhooks](#handling-paddle-webhooks) to accommodate for state changes from Paddle." msgstr "" -#: docs/10.x/cashier-paddle.md:block 71 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:229 +#: ./docs/9.x/cashier-paddle.md:248 msgid "For more information on pay links, you may review [the Paddle API documentation on pay link generation](https://developer.paddle.com/api-reference/product-api/pay-links/createpaylink)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 72 (quote) -msgid "**Warning** After a subscription state change, the delay for receiving the corresponding webhook is typically minimal but you should account for this in your application by considering that your user's subscription might not be immediately available after completing the checkout." +# P +#: ./docs/8.x/cashier-paddle.md:231 +#: ./docs/9.x/cashier-paddle.md:251 +#: ./docs/10.x/cashier-paddle.md:455 +#: ./docs/11.x/cashier-paddle.md:455 +#: ./docs/master/cashier-paddle.md:455 +msgid "After a subscription state change, the delay for receiving the corresponding webhook is typically minimal but you should account for this in your application by considering that your user's subscription might not be immediately available after completing the checkout." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:232 +#: ./docs/11.x/cashier-paddle.md:232 +#: ./docs/master/cashier-paddle.md:232 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/cashier-paddle.md:233 +#: ./docs/11.x/cashier-paddle.md:233 +#: ./docs/master/cashier-paddle.md:233 +msgid "Providing Meta Data to Paddle Checkout" msgstr "" -#: docs/10.x/cashier-paddle.md:block 74 (header) +# P +#: ./docs/8.x/cashier-paddle.md:233 +#: ./docs/9.x/cashier-paddle.md:253 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:234 +#: ./docs/9.x/cashier-paddle.md:254 msgid "Manually Rendering Pay Links" msgstr "" -#: docs/10.x/cashier-paddle.md:block 75 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:235 +#: ./docs/11.x/cashier-paddle.md:235 +#: ./docs/master/cashier-paddle.md:235 +msgid "When selling products, it's common to keep track of completed orders and purchased products via `Cart` and `Order` models defined by your own application. When redirecting customers to Paddle's Checkout Overlay to complete a purchase, you may need to provide an existing order identifier so that you can associate the completed purchase with the corresponding order when the customer is redirected back to your application." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:236 +#: ./docs/9.x/cashier-paddle.md:256 msgid "You may also manually render a pay link without using Laravel's built-in Blade components. To get started, generate the pay link URL as demonstrated in previous examples:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 76 (code) +# P +#: ./docs/10.x/cashier-paddle.md:237 +#: ./docs/11.x/cashier-paddle.md:237 +#: ./docs/master/cashier-paddle.md:237 +msgid "To accomplish this, you may provide an array of custom data to the `checkout` method. Let's imagine that a pending `Order` is created within our application when a user begins the checkout process. Remember, the `Cart` and `Order` models in this example are illustrative and not provided by Cashier. You are free to implement these concepts based on the needs of your own application:" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:238 +#: ./docs/9.x/cashier-paddle.md:258 msgid "$payLink = $request->user()->newSubscription('default', $premium = 34567)\n" " ->returnTo(route('home'))\n" -" ->create();\n" +" ->create();" msgstr "" -#: docs/10.x/cashier-paddle.md:block 77 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:239 +#: ./docs/11.x/cashier-paddle.md:239 +#: ./docs/master/cashier-paddle.md:239 +msgid "use App\\Models\\Cart;\n" +"use App\\Models\\Order;\n" +"use Illuminate\\Http\\Request;\n\n" +"Route::get('/cart/{cart}/checkout', function (Request $request, Cart $cart) {\n" +" $order = Order::create([\n" +" 'cart_id' => $cart->id,\n" +" 'price_ids' => $cart->price_ids,\n" +" 'status' => 'incomplete',\n" +" ]);\n\n" +" $checkout = $request->user()->checkout($order->price_ids)\n" +" ->customData(['order_id' => $order->id]);\n\n" +" return view('billing', ['checkout' => $checkout]);\n" +"})->name('checkout');" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:242 +#: ./docs/9.x/cashier-paddle.md:262 msgid "Next, simply attach the pay link URL to an `a` element in your HTML:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 78 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:244 +#: ./docs/9.x/cashier-paddle.md:264 msgid "\n" " Paddle Checkout\n" -"\n" +"" msgstr "" -#: docs/10.x/cashier-paddle.md:block 80 (header) +# P +#: ./docs/8.x/cashier-paddle.md:248 +#: ./docs/9.x/cashier-paddle.md:268 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:249 +#: ./docs/9.x/cashier-paddle.md:269 msgid "Payments Requiring Additional Confirmation" msgstr "" -#: docs/10.x/cashier-paddle.md:block 81 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:251 +#: ./docs/9.x/cashier-paddle.md:271 msgid "Sometimes additional verification is required in order to confirm and process a payment. When this happens, Paddle will present a payment confirmation screen. Payment confirmation screens presented by Paddle or Cashier may be tailored to a specific bank or card issuer's payment flow and can include additional card confirmation, a temporary small charge, separate device authentication, or other forms of verification." msgstr "" -#: docs/10.x/cashier-paddle.md:block 83 (header) +# P +#: ./docs/8.x/cashier-paddle.md:253 +#: ./docs/9.x/cashier-paddle.md:273 +#: ./docs/10.x/cashier-paddle.md:492 +#: ./docs/11.x/cashier-paddle.md:492 +#: ./docs/master/cashier-paddle.md:492 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:254 +#: ./docs/9.x/cashier-paddle.md:274 +#: ./docs/10.x/cashier-paddle.md:493 +#: ./docs/11.x/cashier-paddle.md:493 +#: ./docs/master/cashier-paddle.md:493 msgid "Inline Checkout" msgstr "" -#: docs/10.x/cashier-paddle.md:block 84 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:256 +#: ./docs/11.x/cashier-paddle.md:256 +#: ./docs/master/cashier-paddle.md:256 +msgid "As you can see in the example above, when a user begins the checkout process, we will provide all of the cart / order's associated Paddle price identifiers to the `checkout` method. Of course, your application is responsible for associating these items with the \"shopping cart\" or order as a customer adds them. We also provide the order's ID to the Paddle Checkout Overlay via the `customData` method." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:256 +#: ./docs/9.x/cashier-paddle.md:276 +#: ./docs/10.x/cashier-paddle.md:495 +#: ./docs/11.x/cashier-paddle.md:495 +#: ./docs/master/cashier-paddle.md:495 msgid "If you don't want to make use of Paddle's \"overlay\" style checkout widget, Paddle also provides the option to display the widget inline. While this approach does not allow you to adjust any of the checkout's HTML fields, it allows you to embed the widget within your application." msgstr "" -#: docs/10.x/cashier-paddle.md:block 85 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:258 +#: ./docs/11.x/cashier-paddle.md:258 +#: ./docs/master/cashier-paddle.md:258 +msgid "Of course, you will likely want to mark the order as \"complete\" once the customer has finished the checkout process. To accomplish this, you may listen to the webhooks dispatched by Paddle and raised via events by Cashier to store order information in your database." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:258 +#: ./docs/9.x/cashier-paddle.md:278 msgid "To make it easy for you to get started with inline checkout, Cashier includes a `paddle-checkout` Blade component. To get started, you should [generate a pay link](#pay-links) and pass the pay link to the component's `override` attribute:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 86 (code) -msgid "\n" +# P +#: ./docs/10.x/cashier-paddle.md:260 +msgid "To get started, listen for the `TransactionCompleted` event dispatched by Cashier. Typically, you should register the event listener in the `boot` method of one of your application's service providers:" +msgstr "" + +# P +#: ./docs/11.x/cashier-paddle.md:260 +#: ./docs/master/cashier-paddle.md:260 +msgid "To get started, listen for the `TransactionCompleted` event dispatched by Cashier. Typically, you should register the event listener in the `boot` method of your application's `AppServiceProvider`:" +msgstr "" + +# CODE: html +# CODE: blade +#: ./docs/8.x/cashier-paddle.md:260 +#: ./docs/9.x/cashier-paddle.md:280 +msgid "" msgstr "" -#: docs/10.x/cashier-paddle.md:block 87 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:262 +#: ./docs/11.x/cashier-paddle.md:262 +#: ./docs/master/cashier-paddle.md:262 +msgid "use App\\Listeners\\CompleteOrder;\n" +"use Illuminate\\Support\\Facades\\Event;\n" +"use Laravel\\Paddle\\Events\\TransactionCompleted;\n\n" +"/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Event::listen(TransactionCompleted::class, CompleteOrder::class);\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:264 +#: ./docs/9.x/cashier-paddle.md:284 +#: ./docs/10.x/cashier-paddle.md:514 +#: ./docs/11.x/cashier-paddle.md:514 +#: ./docs/master/cashier-paddle.md:514 msgid "To adjust the height of the inline checkout component, you may pass the `height` attribute to the Blade component:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 88 (code) -msgid "\n" +# CODE +# CODE: blade +#: ./docs/8.x/cashier-paddle.md:266 +#: ./docs/9.x/cashier-paddle.md:286 +msgid "" msgstr "" -#: docs/10.x/cashier-paddle.md:block 90 (header) +# P +#: ./docs/8.x/cashier-paddle.md:268 +#: ./docs/9.x/cashier-paddle.md:290 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:269 +#: ./docs/9.x/cashier-paddle.md:291 msgid "Inline Checkout Without Pay Links" msgstr "" -#: docs/10.x/cashier-paddle.md:block 91 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:271 +#: ./docs/9.x/cashier-paddle.md:293 msgid "Alternatively, you may customize the widget with custom options instead of using a pay link:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 92 (code) -msgid "@php\n" -"$options = [\n" +# CODE +#: ./docs/8.x/cashier-paddle.md:273 +msgid "$options = [\n" " 'product' => $productId,\n" " 'title' => 'Product Title',\n" -"];\n" -"@endphp\n\n" -"\n" +"];\n\n" +"" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:274 +#: ./docs/11.x/cashier-paddle.md:274 +#: ./docs/master/cashier-paddle.md:274 +msgid "In this example, the `CompleteOrder` listener might look like the following:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 93 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:276 +#: ./docs/master/cashier-paddle.md:276 +msgid "namespace App\\Listeners;\n\n" +"use App\\Models\\Order;\n" +"use Laravel\\Cashier\\Cashier;\n" +"use Laravel\\Cashier\\Events\\TransactionCompleted;\n\n" +"class CompleteOrder\n" +"{\n" +" /**\n" +" * Handle the incoming Cashier webhook event.\n" +" */\n" +" public function handle(TransactionCompleted $event): void\n" +" {\n" +" $orderId = $event->payload['data']['custom_data']['order_id'] ?? null;\n\n" +" $order = Order::findOrFail($orderId);\n\n" +" $order->update(['status' => 'completed']);\n" +" }\n" +"}" +msgstr "" + +# CODE +#: ./docs/11.x/cashier-paddle.md:276 +msgid "namespace App\\Listeners;\n\n" +"use App\\Models\\Order;\n" +"use Laravel\\Paddle\\Cashier;\n" +"use Laravel\\Paddle\\Events\\TransactionCompleted;\n\n" +"class CompleteOrder\n" +"{\n" +" /**\n" +" * Handle the incoming Cashier webhook event.\n" +" */\n" +" public function handle(TransactionCompleted $event): void\n" +" {\n" +" $orderId = $event->payload['data']['custom_data']['order_id'] ?? null;\n\n" +" $order = Order::findOrFail($orderId);\n\n" +" $order->update(['status' => 'completed']);\n" +" }\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:280 +#: ./docs/9.x/cashier-paddle.md:306 msgid "Please consult Paddle's [guide on Inline Checkout](https://developer.paddle.com/guides/how-tos/checkout/inline-checkout) as well as their [parameter reference](https://developer.paddle.com/reference/paddle-js/parameters) for further details on the inline checkout's available options." msgstr "" -#: docs/10.x/cashier-paddle.md:block 94 (quote) -msgid "**Warning** If you would like to also use the `passthrough` option when specifying custom options, you should provide a key / value array as its value. Cashier will automatically handle converting the array to a JSON string. In addition, the `customer_id` passthrough option is reserved for internal Cashier usage." +# P +#: ./docs/8.x/cashier-paddle.md:282 +#: ./docs/9.x/cashier-paddle.md:309 +msgid "If you would like to also use the `passthrough` option when specifying custom options, you should provide a key / value array as its value. Cashier will automatically handle converting the array to a JSON string. In addition, the `customer_id` passthrough option is reserved for internal Cashier usage." msgstr "" -#: docs/10.x/cashier-paddle.md:block 96 (header) +# P +#: ./docs/8.x/cashier-paddle.md:284 +#: ./docs/9.x/cashier-paddle.md:311 +#: ./docs/10.x/cashier-paddle.md:522 +#: ./docs/11.x/cashier-paddle.md:522 +#: ./docs/master/cashier-paddle.md:522 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:285 +#: ./docs/9.x/cashier-paddle.md:312 msgid "Manually Rendering An Inline Checkout" msgstr "" -#: docs/10.x/cashier-paddle.md:block 97 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:287 +#: ./docs/9.x/cashier-paddle.md:314 msgid "You may also manually render an inline checkout without using Laravel's built-in Blade components. To get started, generate the pay link URL [as demonstrated in previous examples](#pay-links)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 98 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:289 +#: ./docs/9.x/cashier-paddle.md:316 msgid "Next, you may use Paddle.js to initialize the checkout. To keep this example simple, we will demonstrate this using [Alpine.js](https://github.com/alpinejs/alpine); however, you are free to translate this example to your own frontend stack:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 99 (code) +# CODE: html +# CODE: alpine +#: ./docs/8.x/cashier-paddle.md:291 +#: ./docs/9.x/cashier-paddle.md:318 msgid "
    \n" -"
    \n" +"" +msgstr "" + +# CODE: blade +#: ./docs/9.x/cashier-paddle.md:295 +msgid "@php\n" +"$options = [\n" +" 'product' => $productId,\n" +" 'title' => 'Product Title',\n" +"];\n" +"@endphp\n\n" +"" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:297 +#: ./docs/11.x/cashier-paddle.md:297 +#: ./docs/master/cashier-paddle.md:297 +msgid "Please refer to Paddle's documentation for more information on the [data contained by the `transaction.completed` event](https://developer.paddle.com/webhooks/transactions/transaction-completed)." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:299 +#: ./docs/11.x/cashier-paddle.md:299 +#: ./docs/master/cashier-paddle.md:299 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:300 +#: ./docs/11.x/cashier-paddle.md:300 +#: ./docs/master/cashier-paddle.md:300 +msgid "Selling Subscriptions" msgstr "" -#: docs/10.x/cashier-paddle.md:block 101 (header) +# P +#: ./docs/8.x/cashier-paddle.md:304 +#: ./docs/9.x/cashier-paddle.md:331 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:305 +#: ./docs/9.x/cashier-paddle.md:332 msgid "User Identification" msgstr "" -#: docs/10.x/cashier-paddle.md:block 102 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:307 +#: ./docs/11.x/cashier-paddle.md:307 +#: ./docs/master/cashier-paddle.md:307 +msgid "To learn how to sell subscriptions using Cashier and Paddle's Checkout Overlay, let's consider the simple scenario of a subscription service with a basic monthly (`price_basic_monthly`) and yearly (`price_basic_yearly`) plan. These two prices could be grouped under a \"Basic\" product (`pro_basic`) in our Paddle dashboard. In addition, our subscription service might offer an Expert plan as `pro_expert`." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:307 +#: ./docs/9.x/cashier-paddle.md:334 msgid "In contrast to Stripe, Paddle users are unique across all of Paddle, not unique per Paddle account. Because of this, Paddle's API's do not currently provide a method to update a user's details such as their email address. When generating pay links, Paddle identifies users using the `customer_email` parameter. When creating a subscription, Paddle will try to match the user provided email to an existing Paddle user." msgstr "" -#: docs/10.x/cashier-paddle.md:block 103 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:309 +#: ./docs/11.x/cashier-paddle.md:309 +#: ./docs/master/cashier-paddle.md:309 +msgid "First, let's discover how a customer can subscribe to our services. Of course, you can imagine the customer might click a \"subscribe\" button for the Basic plan on our application's pricing page. This button will invoke a Paddle Checkout Overlay for their chosen plan. To get started, let's initiate a checkout session via the `checkout` method:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:309 +#: ./docs/9.x/cashier-paddle.md:336 msgid "In light of this behavior, there are some important things to keep in mind when using Cashier and Paddle. First, you should be aware that even though subscriptions in Cashier are tied to the same application user, **they could be tied to different users within Paddle's internal systems**. Secondly, each subscription has its own connected payment method information and could also have different email addresses within Paddle's internal systems (depending on which email was assigned to the user when the subscription was created)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 104 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:311 +#: ./docs/11.x/cashier-paddle.md:311 +#: ./docs/master/cashier-paddle.md:311 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/subscribe', function (Request $request) {\n" +" $checkout = $request->user()->checkout('price_basic_monthly')\n" +" ->returnTo(route('dashboard'));\n\n" +" return view('subscribe', ['checkout' => $checkout]);\n" +"})->name('subscribe');" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:311 +#: ./docs/9.x/cashier-paddle.md:338 msgid "Therefore, when displaying subscriptions you should always inform the user which email address or payment method information is connected to the subscription on a per-subscription basis. Retrieving this information can be done with the following methods provided by the `Laravel\\Paddle\\Subscription` model:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 105 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:313 +#: ./docs/9.x/cashier-paddle.md:340 msgid "$subscription = $user->subscription('default');\n\n" "$subscription->paddleEmail();\n" "$subscription->paymentMethod();\n" "$subscription->cardBrand();\n" "$subscription->cardLastFour();\n" -"$subscription->cardExpirationDate();\n" +"$subscription->cardExpirationDate();" msgstr "" -#: docs/10.x/cashier-paddle.md:block 106 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:320 +#: ./docs/11.x/cashier-paddle.md:320 +#: ./docs/master/cashier-paddle.md:320 +msgid "In the `subscribe` view, we will include a button to display the Checkout Overlay. The `paddle-button` Blade component is included with Cashier Paddle; however, you may also [manually render an overlay checkout](#manually-rendering-an-overlay-checkout):" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:321 +#: ./docs/9.x/cashier-paddle.md:348 msgid "There is currently no way to modify a user's email address through the Paddle API. When a user wants to update their email address within Paddle, the only way for them to do so is to contact Paddle customer support. When communicating with Paddle, they need to provide the `paddleEmail` value of the subscription to assist Paddle in updating the correct user." msgstr "" -#: docs/10.x/cashier-paddle.md:block 108 (header) +# CODE: html +# CODE: blade +#: ./docs/10.x/cashier-paddle.md:322 +#: ./docs/10.x/cashier-paddle.md:438 +#: ./docs/10.x/cashier-paddle.md:714 +#: ./docs/11.x/cashier-paddle.md:322 +#: ./docs/11.x/cashier-paddle.md:438 +#: ./docs/11.x/cashier-paddle.md:714 +#: ./docs/master/cashier-paddle.md:322 +#: ./docs/master/cashier-paddle.md:438 +#: ./docs/master/cashier-paddle.md:714 +msgid "\n" +" Subscribe\n" +"" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:323 +#: ./docs/9.x/cashier-paddle.md:350 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cashier-paddle.md:324 +#: ./docs/9.x/cashier-paddle.md:351 msgid "Prices" msgstr "" -#: docs/10.x/cashier-paddle.md:block 109 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:326 +#: ./docs/9.x/cashier-paddle.md:353 msgid "Paddle allows you to customize prices per currency, essentially allowing you to configure different prices for different countries. Cashier Paddle allows you to retrieve all of the prices for a given product using the `productPrices` method. This method accepts the product IDs of the products you wish to retrieve prices for:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 110 (code) +# P +#: ./docs/10.x/cashier-paddle.md:328 +#: ./docs/11.x/cashier-paddle.md:328 +#: ./docs/master/cashier-paddle.md:328 +msgid "Now, when the Subscribe button is clicked, the customer will be able to enter their payment details and initiate their subscription. To know when their subscription has actually started (since some payment methods require a few seconds to process), you should also [configure Cashier's webhook handling](#handling-paddle-webhooks)." +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:328 +#: ./docs/9.x/cashier-paddle.md:355 msgid "use Laravel\\Paddle\\Cashier;\n\n" -"$prices = Cashier::productPrices([123, 456]);\n" +"$prices = Cashier::productPrices([123, 456]);" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:330 +#: ./docs/11.x/cashier-paddle.md:330 +#: ./docs/master/cashier-paddle.md:330 +msgid "Now that customers can start subscriptions, we need to restrict certain portions of our application so that only subscribed users can access them. Of course, we can always determine a user's current subscription status via the `subscribed` method provided by Cashier's `Billable` trait:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/cashier-paddle.md:332 +#: ./docs/11.x/cashier-paddle.md:332 +#: ./docs/master/cashier-paddle.md:332 +msgid "@if ($user->subscribed())\n" +"

    You are subscribed.

    \n" +"@endif" msgstr "" -#: docs/10.x/cashier-paddle.md:block 111 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:332 +#: ./docs/9.x/cashier-paddle.md:359 +#: ./docs/10.x/cashier-paddle.md:578 +#: ./docs/11.x/cashier-paddle.md:578 +#: ./docs/master/cashier-paddle.md:578 msgid "The currency will be determined based on the IP address of the request; however, you may optionally provide a specific country to retrieve prices for:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 112 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:334 +#: ./docs/9.x/cashier-paddle.md:361 msgid "use Laravel\\Paddle\\Cashier;\n\n" -"$prices = Cashier::productPrices([123, 456], ['customer_country' => 'BE']);\n" +"$prices = Cashier::productPrices([123, 456], ['customer_country' => 'BE']);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 113 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:338 +#: ./docs/11.x/cashier-paddle.md:338 +#: ./docs/master/cashier-paddle.md:338 +msgid "We can even easily determine if a user is subscribed to specific product or price:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:338 +#: ./docs/9.x/cashier-paddle.md:365 +#: ./docs/10.x/cashier-paddle.md:587 +#: ./docs/11.x/cashier-paddle.md:587 +#: ./docs/master/cashier-paddle.md:587 msgid "After retrieving the prices you may display them however you wish:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 114 (code) +# CODE: blade +#: ./docs/10.x/cashier-paddle.md:340 +#: ./docs/11.x/cashier-paddle.md:340 +#: ./docs/master/cashier-paddle.md:340 +msgid "@if ($user->subscribedToProduct('pro_basic'))\n" +"

    You are subscribed to our Basic product.

    \n" +"@endif\n\n" +"@if ($user->subscribedToPrice('price_basic_monthly'))\n" +"

    You are subscribed to our monthly Basic plan.

    \n" +"@endif" +msgstr "" + +# CODE: html +# CODE: blade +#: ./docs/8.x/cashier-paddle.md:340 +#: ./docs/8.x/cashier-paddle.md:394 +#: ./docs/9.x/cashier-paddle.md:367 +#: ./docs/9.x/cashier-paddle.md:421 msgid "
      \n" " @foreach ($prices as $price)\n" "
    • {{ $price->product_title }} - {{ $price->price()->gross() }}
    • \n" " @endforeach\n" -"
    \n" +"" msgstr "" -#: docs/10.x/cashier-paddle.md:block 115 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:348 +#: ./docs/9.x/cashier-paddle.md:375 msgid "You may also display the net price (excludes tax) and display the tax amount separately:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 116 (code) +# P +#: ./docs/10.x/cashier-paddle.md:350 +#: ./docs/11.x/cashier-paddle.md:350 +#: ./docs/master/cashier-paddle.md:350 +#~ msgid "" +#~ msgstr "" + +# CODE: html +# CODE: blade +#: ./docs/8.x/cashier-paddle.md:350 +#: ./docs/9.x/cashier-paddle.md:377 msgid "
      \n" " @foreach ($prices as $price)\n" "
    • {{ $price->product_title }} - {{ $price->price()->net() }} (+ {{ $price->price()->tax() }} tax)
    • \n" " @endforeach\n" -"
    \n" +"" +msgstr "" + +# H4 +#: ./docs/10.x/cashier-paddle.md:351 +#: ./docs/11.x/cashier-paddle.md:351 +#: ./docs/master/cashier-paddle.md:351 +msgid "Building a Subscribed Middleware" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:353 +#: ./docs/11.x/cashier-paddle.md:353 +#: ./docs/master/cashier-paddle.md:353 +msgid "For convenience, you may wish to create a [middleware](/docs/{{version}}/middleware) which determines if the incoming request is from a subscribed user. Once this middleware has been defined, you may easily assign it to a route to prevent users that are not subscribed from accessing the route:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:355 +#: ./docs/11.x/cashier-paddle.md:355 +#: ./docs/master/cashier-paddle.md:355 +msgid "user()?->subscribed()) {\n" +" // Redirect user to billing page and ask them to subscribe...\n" +" return redirect('/subscribe');\n" +" }\n\n" +" return $next($request);\n" +" }\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 117 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:358 +#: ./docs/9.x/cashier-paddle.md:385 msgid "If you retrieved prices for subscription plans you can display their initial and recurring price separately:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 118 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/cashier-paddle.md:360 +#: ./docs/9.x/cashier-paddle.md:387 msgid "
      \n" " @foreach ($prices as $price)\n" "
    • {{ $price->product_title }} - Initial: {{ $price->initialPrice()->gross() }} - Recurring: {{ $price->recurringPrice()->gross() }}
    • \n" " @endforeach\n" -"
    \n" +"" msgstr "" -#: docs/10.x/cashier-paddle.md:block 119 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:368 +#: ./docs/9.x/cashier-paddle.md:395 msgid "For more information, [check Paddle's API documentation on prices](https://developer.paddle.com/api-reference/checkout-api/prices/getprices)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 121 (header) +# P +#: ./docs/8.x/cashier-paddle.md:370 +#: ./docs/9.x/cashier-paddle.md:397 +#~ msgid "" +#~ msgstr "" + +# H4 +# H2 +#: ./docs/8.x/cashier-paddle.md:371 +#: ./docs/8.x/cashier-paddle.md:415 +#: ./docs/9.x/cashier-paddle.md:398 +#: ./docs/9.x/cashier-paddle.md:443 +#: ./docs/10.x/cashier-paddle.md:642 +#: ./docs/11.x/cashier-paddle.md:642 +#: ./docs/master/cashier-paddle.md:642 msgid "Customers" msgstr "" -#: docs/10.x/cashier-paddle.md:block 122 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:373 +#: ./docs/9.x/cashier-paddle.md:400 +#: ./docs/10.x/cashier-paddle.md:612 +#: ./docs/11.x/cashier-paddle.md:612 +#: ./docs/master/cashier-paddle.md:612 msgid "If a user is already a customer and you would like to display the prices that apply to that customer, you may do so by retrieving the prices directly from the customer instance:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 123 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:375 +#: ./docs/9.x/cashier-paddle.md:402 msgid "use App\\Models\\User;\n\n" -"$prices = User::find(1)->productPrices([123, 456]);\n" +"$prices = User::find(1)->productPrices([123, 456]);" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:379 +#: ./docs/11.x/cashier-paddle.md:379 +#: ./docs/master/cashier-paddle.md:379 +msgid "Once the middleware has been defined, you may assign it to a route:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 124 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:379 +#: ./docs/9.x/cashier-paddle.md:406 msgid "Internally, Cashier will use the user's [`paddleCountry` method](#customer-defaults) to retrieve the prices in their currency. So, for example, a user living in the United States will see prices in USD while a user in Belgium will see prices in EUR. If no matching currency can be found the default currency of the product will be used. You can customize all prices of a product or subscription plan in the Paddle control panel." msgstr "" -#: docs/10.x/cashier-paddle.md:block 126 (header) +# CODE +#: ./docs/10.x/cashier-paddle.md:381 +#: ./docs/11.x/cashier-paddle.md:381 +#: ./docs/master/cashier-paddle.md:381 +msgid "use App\\Http\\Middleware\\Subscribed;\n\n" +"Route::get('/dashboard', function () {\n" +" // ...\n" +"})->middleware([Subscribed::class]);" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:381 +#: ./docs/9.x/cashier-paddle.md:408 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:382 +#: ./docs/8.x/cashier-paddle.md:502 +#: ./docs/9.x/cashier-paddle.md:409 +#: ./docs/9.x/cashier-paddle.md:530 msgid "Coupons" msgstr "" -#: docs/10.x/cashier-paddle.md:block 127 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:384 +#: ./docs/9.x/cashier-paddle.md:411 msgid "You may also choose to display prices after a coupon reduction. When calling the `productPrices` method, coupons may be passed as a comma delimited string:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 128 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:386 +#: ./docs/9.x/cashier-paddle.md:413 msgid "use Laravel\\Paddle\\Cashier;\n\n" "$prices = Cashier::productPrices([123, 456], [\n" " 'coupons' => 'SUMMERSALE,20PERCENTOFF'\n" -"]);\n" +"]);" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:387 +#: ./docs/11.x/cashier-paddle.md:387 +#: ./docs/master/cashier-paddle.md:387 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/cashier-paddle.md:388 +#: ./docs/11.x/cashier-paddle.md:388 +#: ./docs/master/cashier-paddle.md:388 +msgid "Allowing Customers to Manage Their Billing Plan" msgstr "" -#: docs/10.x/cashier-paddle.md:block 129 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:390 +#: ./docs/11.x/cashier-paddle.md:390 +#: ./docs/master/cashier-paddle.md:390 +msgid "Of course, customers may want to change their subscription plan to another product or \"tier\". In our example from above, we'd want to allow the customer to change their plan from a monthly subscription to a yearly subscription. For this you'll need to implement something like a button that leads to the below route:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:392 +#: ./docs/11.x/cashier-paddle.md:392 +#: ./docs/master/cashier-paddle.md:392 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::put('/subscription/{price}/swap', function (Request $request, $price) {\n" +" $user->subscription()->swap($price); // With \"$price\" being \"price_basic_yearly\" for this example.\n\n" +" return redirect()->route('dashboard');\n" +"})->name('subscription.swap');" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:392 +#: ./docs/9.x/cashier-paddle.md:419 msgid "Then, display the calculated prices using the `price` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 131 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:400 +#: ./docs/11.x/cashier-paddle.md:400 +#: ./docs/master/cashier-paddle.md:400 +msgid "Besides swapping plans you'll also need to allow your customers to cancel their subscription. Like swapping plans, provide a button that leads to the following route:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:402 +#: ./docs/11.x/cashier-paddle.md:402 +#: ./docs/master/cashier-paddle.md:402 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::put('/subscription/cancel', function (Request $request, $price) {\n" +" $user->subscription()->cancel();\n\n" +" return redirect()->route('dashboard');\n" +"})->name('subscription.cancel');" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:402 +#: ./docs/9.x/cashier-paddle.md:429 msgid "You may display the original listed prices (without coupon discounts) using the `listPrice` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 132 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/cashier-paddle.md:404 +#: ./docs/9.x/cashier-paddle.md:431 msgid "
      \n" " @foreach ($prices as $price)\n" "
    • {{ $price->product_title }} - {{ $price->listPrice()->gross() }}
    • \n" " @endforeach\n" -"
    \n" +"" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:410 +#: ./docs/master/cashier-paddle.md:410 +msgid "And now your subscription will get cancelled at the end of its billing period." +msgstr "" + +# P +#: ./docs/11.x/cashier-paddle.md:410 +msgid "And now your subscription will get canceled at the end of its billing period." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:412 +#: ./docs/9.x/cashier-paddle.md:440 +msgid "When using the prices API, Paddle only allows applying coupons to one-time purchase products and not to subscription plans." msgstr "" -#: docs/10.x/cashier-paddle.md:block 133 (quote) -msgid "**Warning** When using the prices API, Paddle only allows applying coupons to one-time purchase products and not to subscription plans." +# P +#: ./docs/10.x/cashier-paddle.md:413 +#: ./docs/master/cashier-paddle.md:413 +msgid "As long as you have configured Cashier's webhook handling, Cashier will automatically keep your application's Cashier-related database tables in sync by inspecting the incoming webhooks from Paddle. So, for example, when you cancel a customer's subscription via Paddle's dashboard, Cashier will receive the corresponding webhook and mark the subscription as \"cancelled\" in your application's database." msgstr "" -#: docs/10.x/cashier-paddle.md:block 137 (header) +# P +#: ./docs/11.x/cashier-paddle.md:413 +msgid "As long as you have configured Cashier's webhook handling, Cashier will automatically keep your application's Cashier-related database tables in sync by inspecting the incoming webhooks from Paddle. So, for example, when you cancel a customer's subscription via Paddle's dashboard, Cashier will receive the corresponding webhook and mark the subscription as \"canceled\" in your application's database." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:414 +#: ./docs/9.x/cashier-paddle.md:442 +#: ./docs/10.x/cashier-paddle.md:641 +#: ./docs/11.x/cashier-paddle.md:641 +#: ./docs/master/cashier-paddle.md:641 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:415 +#: ./docs/11.x/cashier-paddle.md:415 +#: ./docs/master/cashier-paddle.md:415 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/cashier-paddle.md:416 +#: ./docs/11.x/cashier-paddle.md:416 +#: ./docs/master/cashier-paddle.md:416 +msgid "Checkout Sessions" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:417 +#: ./docs/9.x/cashier-paddle.md:445 +#: ./docs/10.x/cashier-paddle.md:644 +#: ./docs/11.x/cashier-paddle.md:644 +#: ./docs/master/cashier-paddle.md:644 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:418 +#: ./docs/11.x/cashier-paddle.md:418 +#: ./docs/master/cashier-paddle.md:418 +msgid "Most operations to bill customers are performed using \"checkouts\" via Paddle's [Checkout Overlay widget](https://developer.paddle.com/build/checkout/build-overlay-checkout) or by utilizing [inline checkout](https://developer.paddle.com/build/checkout/build-branded-inline-checkout)." +msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:418 +#: ./docs/9.x/cashier-paddle.md:446 +#: ./docs/10.x/cashier-paddle.md:645 +#: ./docs/11.x/cashier-paddle.md:645 +#: ./docs/master/cashier-paddle.md:645 msgid "Customer Defaults" msgstr "" -#: docs/10.x/cashier-paddle.md:block 138 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:420 +#: ./docs/11.x/cashier-paddle.md:420 +#: ./docs/master/cashier-paddle.md:420 +msgid "Before processing checkout payments using Paddle, you should define your application's [default payment link](https://developer.paddle.com/build/transactions/default-payment-link#set-default-link) in your Paddle checkout settings dashboard." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:420 +#: ./docs/9.x/cashier-paddle.md:448 msgid "Cashier allows you to define some useful defaults for your customers when creating pay links. Setting these defaults allow you to pre-fill a customer's email address, country, and postal code so that they can immediately move on to the payment portion of the checkout widget. You can set these defaults by overriding the following methods on your billable model:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 139 (code) +# P +#: ./docs/10.x/cashier-paddle.md:422 +#: ./docs/11.x/cashier-paddle.md:422 +#: ./docs/master/cashier-paddle.md:422 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:422 +#: ./docs/9.x/cashier-paddle.md:450 msgid "/**\n" " * Get the customer's email address to associate with Paddle.\n" +" *\n" +" * @return string|null\n" " */\n" -"public function paddleEmail(): string|null\n" +"public function paddleEmail()\n" "{\n" " return $this->email;\n" "}\n\n" @@ -733,141 +2227,424 @@ msgid "/**\n" " *\n" " * This needs to be a 2 letter code. See the link below for supported countries.\n" " *\n" +" * @return string|null\n" " * @link https://developer.paddle.com/reference/platform-parameters/supported-countries\n" " */\n" -"public function paddleCountry(): string|null\n" +"public function paddleCountry()\n" "{\n" -" // ...\n" +" //\n" "}\n\n" "/**\n" " * Get the customer's postal code to associate with Paddle.\n" " *\n" " * See the link below for countries which require this.\n" " *\n" +" * @return string|null\n" " * @link https://developer.paddle.com/reference/platform-parameters/supported-countries#countries-requiring-postcode\n" " */\n" -"public function paddlePostcode(): string|null\n" +"public function paddlePostcode()\n" "{\n" -" // ...\n" -"}\n" +" //\n" +"}" +msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:423 +#: ./docs/11.x/cashier-paddle.md:423 +#: ./docs/master/cashier-paddle.md:423 +msgid "Overlay Checkout" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:425 +#: ./docs/11.x/cashier-paddle.md:425 +#: ./docs/master/cashier-paddle.md:425 +msgid "Before displaying the Checkout Overlay widget, you must generate a checkout session using Cashier. A checkout session will inform the checkout widget of the billing operation that should be performed:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:427 +#: ./docs/10.x/cashier-paddle.md:462 +#: ./docs/10.x/cashier-paddle.md:499 +#: ./docs/10.x/cashier-paddle.md:527 +#: ./docs/11.x/cashier-paddle.md:427 +#: ./docs/11.x/cashier-paddle.md:462 +#: ./docs/11.x/cashier-paddle.md:499 +#: ./docs/11.x/cashier-paddle.md:527 +#: ./docs/master/cashier-paddle.md:427 +#: ./docs/master/cashier-paddle.md:462 +#: ./docs/master/cashier-paddle.md:499 +#: ./docs/master/cashier-paddle.md:527 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/buy', function (Request $request) {\n" +" $checkout = $user->checkout('pri_34567')\n" +" ->returnTo(route('dashboard'));\n\n" +" return view('billing', ['checkout' => $checkout]);\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:436 +#: ./docs/11.x/cashier-paddle.md:436 +#: ./docs/master/cashier-paddle.md:436 +msgid "Cashier includes a `paddle-button` [Blade component](/docs/{{version}}/blade#components). You may pass the checkout session to this component as a \"prop\". Then, when this button is clicked, Paddle's checkout widget will be displayed:" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:444 +#: ./docs/11.x/cashier-paddle.md:444 +#: ./docs/master/cashier-paddle.md:444 +msgid "By default, this will display the widget using Paddle's default styling. You can customize the widget by adding [Paddle supported attributes](https://developer.paddle.com/paddlejs/html-data-attributes) like the `data-theme='light'` attribute to the component:" +msgstr "" + +# CODE: html +#: ./docs/10.x/cashier-paddle.md:446 +#: ./docs/11.x/cashier-paddle.md:446 +#: ./docs/master/cashier-paddle.md:446 +msgid "\n" +" Subscribe\n" +"" msgstr "" -#: docs/10.x/cashier-paddle.md:block 140 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:452 +#: ./docs/11.x/cashier-paddle.md:452 +#: ./docs/master/cashier-paddle.md:452 +msgid "The Paddle checkout widget is asynchronous. Once the user creates a subscription within the widget, Paddle will send your application a webhook so that you may properly update the subscription state in your application's database. Therefore, it's important that you properly [set up webhooks](#handling-paddle-webhooks) to accommodate for state changes from Paddle." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:457 +#: ./docs/11.x/cashier-paddle.md:457 +#: ./docs/master/cashier-paddle.md:457 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/cashier-paddle.md:458 +#: ./docs/11.x/cashier-paddle.md:458 +#: ./docs/master/cashier-paddle.md:458 +msgid "Manually Rendering an Overlay Checkout" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:458 +#: ./docs/9.x/cashier-paddle.md:486 msgid "These defaults will be used for every action in Cashier that generates a [pay link](#pay-links)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 142 (header) +# P +#: ./docs/10.x/cashier-paddle.md:460 +#: ./docs/11.x/cashier-paddle.md:460 +#: ./docs/master/cashier-paddle.md:460 +msgid "You may also manually render an overlay checkout without using Laravel's built-in Blade components. To get started, generate the checkout session [as demonstrated in previous examples](#overlay-checkout):" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:460 +#: ./docs/9.x/cashier-paddle.md:488 +#: ./docs/10.x/cashier-paddle.md:687 +#: ./docs/11.x/cashier-paddle.md:687 +#: ./docs/master/cashier-paddle.md:687 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cashier-paddle.md:461 +#: ./docs/9.x/cashier-paddle.md:489 +#: ./docs/10.x/cashier-paddle.md:688 +#: ./docs/11.x/cashier-paddle.md:688 +#: ./docs/master/cashier-paddle.md:688 msgid "Subscriptions" msgstr "" -#: docs/10.x/cashier-paddle.md:block 144 (header) +# P +#: ./docs/8.x/cashier-paddle.md:463 +#: ./docs/9.x/cashier-paddle.md:491 +#: ./docs/10.x/cashier-paddle.md:690 +#: ./docs/11.x/cashier-paddle.md:690 +#: ./docs/master/cashier-paddle.md:690 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:464 +#: ./docs/9.x/cashier-paddle.md:492 +#: ./docs/10.x/cashier-paddle.md:691 +#: ./docs/11.x/cashier-paddle.md:691 +#: ./docs/master/cashier-paddle.md:691 msgid "Creating Subscriptions" msgstr "" -#: docs/10.x/cashier-paddle.md:block 145 (paragraph) -msgid "To create a subscription, first retrieve an instance of your billable model from your database, which typically will be an instance of `App\\Models\\User`. Once you have retrieved the model instance, you may use the `newSubscription` method to create the model's subscription pay link:" +# P +#: ./docs/8.x/cashier-paddle.md:466 +msgid "To create a subscription, first retrieve an instance of your billable model, which typically will be an instance of `App\\Models\\User`. Once you have retrieved the model instance, you may use the `newSubscription` method to create the model's subscription pay link:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 146 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:468 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/user/subscribe', function (Request $request) {\n" -" $payLink = $request->user()->newSubscription('default', $premium = 12345)\n" +" $payLink = $user->newSubscription('default', $premium = 12345)\n" " ->returnTo(route('home'))\n" " ->create();\n\n" " return view('billing', ['payLink' => $payLink]);\n" -"});\n" -msgstr "" - -#: docs/10.x/cashier-paddle.md:block 147 (paragraph) +"});" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:471 +#: ./docs/11.x/cashier-paddle.md:471 +#: ./docs/master/cashier-paddle.md:471 +msgid "Next, you may use Paddle.js to initialize the checkout. In this example, we will create a link that is assigned the `paddle_button` class. Paddle.js will detect this class and display the overlay checkout when the link is clicked:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/cashier-paddle.md:473 +#: ./docs/11.x/cashier-paddle.md:473 +#: ./docs/master/cashier-paddle.md:473 +msgid "getItems();\n" +"$customer = $checkout->getCustomer();\n" +"$custom = $checkout->getCustomData();\n" +"?>\n\n" +"getReturnUrl()) data-success-url='{{ $returnUrl }}' @endif\n" +">\n" +" Buy Product\n" +"" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:478 +#: ./docs/9.x/cashier-paddle.md:506 msgid "The first argument passed to the `newSubscription` method should be the internal name of the subscription. If your application only offers a single subscription, you might call this `default` or `primary`. This subscription name is only for internal application usage and is not meant to be shown to users. In addition, it should not contain spaces and it should never be changed after creating the subscription. The second argument given to the `newSubscription` method is the specific plan the user is subscribing to. This value should correspond to the plan's identifier in Paddle. The `returnTo` method accepts a URL that your user will be redirected to after they successfully complete the checkout." msgstr "" -#: docs/10.x/cashier-paddle.md:block 148 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:480 +#: ./docs/9.x/cashier-paddle.md:508 msgid "The `create` method will create a pay link which you can use to generate a payment button. The payment button can be generated using the `paddle-button` [Blade component](/docs/{{version}}/blade#components) that is included with Cashier Paddle:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 150 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:488 +#: ./docs/9.x/cashier-paddle.md:516 +#: ./docs/10.x/cashier-paddle.md:720 +#: ./docs/11.x/cashier-paddle.md:720 +#: ./docs/master/cashier-paddle.md:720 msgid "After the user has finished their checkout, a `subscription_created` webhook will be dispatched from Paddle. Cashier will receive this webhook and setup the subscription for your customer. In order to make sure all webhooks are properly received and handled by your application, ensure you have properly [setup webhook handling](#handling-paddle-webhooks)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 152 (header) +# P +#: ./docs/8.x/cashier-paddle.md:490 +#: ./docs/9.x/cashier-paddle.md:518 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:491 +#: ./docs/9.x/cashier-paddle.md:519 msgid "Additional Details" msgstr "" -#: docs/10.x/cashier-paddle.md:block 153 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:493 +#: ./docs/9.x/cashier-paddle.md:521 msgid "If you would like to specify additional customer or subscription details, you may do so by passing them as an array of key / value pairs to the `create` method. To learn more about the additional fields supported by Paddle, check out Paddle's documentation on [generating pay links](https://developer.paddle.com/api-reference/product-api/pay-links/createpaylink):" msgstr "" -#: docs/10.x/cashier-paddle.md:block 154 (code) +# P +#: ./docs/9.x/cashier-paddle.md:494 +msgid "To create a subscription, first retrieve an instance of your billable model from your database, which typically will be an instance of `App\\Models\\User`. Once you have retrieved the model instance, you may use the `newSubscription` method to create the model's subscription pay link:" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:495 +#: ./docs/9.x/cashier-paddle.md:523 msgid "$payLink = $user->newSubscription('default', $monthly = 12345)\n" " ->returnTo(route('home'))\n" " ->create([\n" " 'vat_number' => $vatNumber,\n" -" ]);\n" +" ]);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 157 (paragraph) +# CODE +#: ./docs/9.x/cashier-paddle.md:496 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/user/subscribe', function (Request $request) {\n" +" $payLink = $request->user()->newSubscription('default', $premium = 12345)\n" +" ->returnTo(route('home'))\n" +" ->create();\n\n" +" return view('billing', ['payLink' => $payLink]);\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:497 +#: ./docs/11.x/cashier-paddle.md:497 +#: ./docs/master/cashier-paddle.md:497 +msgid "To make it easy for you to get started with inline checkout, Cashier includes a `paddle-checkout` Blade component. To get started, you should [generate a checkout session](#overlay-checkout):" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:501 +#: ./docs/9.x/cashier-paddle.md:529 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:504 +#: ./docs/9.x/cashier-paddle.md:532 msgid "If you would like to apply a coupon when creating the subscription, you may use the `withCoupon` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 158 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:506 +#: ./docs/9.x/cashier-paddle.md:534 msgid "$payLink = $user->newSubscription('default', $monthly = 12345)\n" " ->returnTo(route('home'))\n" " ->withCoupon('code')\n" -" ->create();\n" +" ->create();" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:508 +#: ./docs/11.x/cashier-paddle.md:508 +#: ./docs/master/cashier-paddle.md:508 +msgid "Then, you may pass the checkout session to the component's `checkout` attribute:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/cashier-paddle.md:510 +#: ./docs/11.x/cashier-paddle.md:510 +#: ./docs/master/cashier-paddle.md:510 +msgid "" msgstr "" -#: docs/10.x/cashier-paddle.md:block 160 (header) +# P +#: ./docs/8.x/cashier-paddle.md:511 +#: ./docs/9.x/cashier-paddle.md:539 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:512 +#: ./docs/9.x/cashier-paddle.md:540 msgid "Metadata" msgstr "" -#: docs/10.x/cashier-paddle.md:block 161 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:514 +#: ./docs/9.x/cashier-paddle.md:542 msgid "You can also pass an array of metadata using the `withMetadata` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 162 (code) +# CODE: blade +#: ./docs/10.x/cashier-paddle.md:516 +#: ./docs/11.x/cashier-paddle.md:516 +#: ./docs/master/cashier-paddle.md:516 +msgid "" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:516 +#: ./docs/9.x/cashier-paddle.md:544 msgid "$payLink = $user->newSubscription('default', $monthly = 12345)\n" " ->returnTo(route('home'))\n" " ->withMetadata(['key' => 'value'])\n" -" ->create();\n" +" ->create();" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:520 +#: ./docs/11.x/cashier-paddle.md:520 +#: ./docs/master/cashier-paddle.md:520 +msgid "Please consult Paddle's [guide on Inline Checkout](https://developer.paddle.com/build/checkout/build-branded-inline-checkout) and [available checkout settings](https://developer.paddle.com/build/checkout/set-up-checkout-default-settings) for further details on the inline checkout's customization options." msgstr "" -#: docs/10.x/cashier-paddle.md:block 163 (quote) -msgid "**Warning** When providing metadata, please avoid using `subscription_name` as a metadata key. This key is reserved for internal use by Cashier." +# P +#: ./docs/8.x/cashier-paddle.md:521 +#: ./docs/9.x/cashier-paddle.md:550 +msgid "When providing metadata, please avoid using `subscription_name` as a metadata key. This key is reserved for internal use by Cashier." msgstr "" -#: docs/10.x/cashier-paddle.md:block 165 (header) +# H4 +#: ./docs/10.x/cashier-paddle.md:523 +#: ./docs/11.x/cashier-paddle.md:523 +#: ./docs/master/cashier-paddle.md:523 +msgid "Manually Rendering an Inline Checkout" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:523 +#: ./docs/9.x/cashier-paddle.md:552 +#: ./docs/10.x/cashier-paddle.md:722 +#: ./docs/11.x/cashier-paddle.md:722 +#: ./docs/master/cashier-paddle.md:722 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:524 +#: ./docs/9.x/cashier-paddle.md:553 +#: ./docs/10.x/cashier-paddle.md:723 +#: ./docs/11.x/cashier-paddle.md:723 +#: ./docs/master/cashier-paddle.md:723 msgid "Checking Subscription Status" msgstr "" -#: docs/10.x/cashier-paddle.md:block 166 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:525 +#: ./docs/11.x/cashier-paddle.md:525 +#: ./docs/master/cashier-paddle.md:525 +msgid "You may also manually render an inline checkout without using Laravel's built-in Blade components. To get started, generate the checkout session [as demonstrated in previous examples](#inline-checkout):" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:526 +#: ./docs/9.x/cashier-paddle.md:555 msgid "Once a user is subscribed to your application, you may check their subscription status using a variety of convenient methods. First, the `subscribed` method returns `true` if the user has an active subscription, even if the subscription is currently within its trial period:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 167 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:528 +#: ./docs/9.x/cashier-paddle.md:557 msgid "if ($user->subscribed('default')) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 168 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:532 +#: ./docs/9.x/cashier-paddle.md:561 +#: ./docs/10.x/cashier-paddle.md:737 +#: ./docs/11.x/cashier-paddle.md:737 +#: ./docs/master/cashier-paddle.md:737 msgid "The `subscribed` method also makes a great candidate for a [route middleware](/docs/{{version}}/middleware), allowing you to filter access to routes and controllers based on the user's subscription status:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 169 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:534 +#: ./docs/9.x/cashier-paddle.md:563 msgid "user() && ! $request->user()->subscribed('default')) {\n" " // This user is not a paying customer...\n" @@ -875,130 +2652,468 @@ msgid "options();\n\n" +"$options['settings']['frameTarget'] = 'paddle-checkout';\n" +"$options['settings']['frameInitialHeight'] = 366;\n" +"?>\n\n" +"
    \n" +"
    " +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:552 +#: ./docs/11.x/cashier-paddle.md:552 +#: ./docs/master/cashier-paddle.md:552 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:553 +#: ./docs/11.x/cashier-paddle.md:553 +#: ./docs/master/cashier-paddle.md:553 +msgid "Guest Checkouts" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:555 +#: ./docs/11.x/cashier-paddle.md:555 +#: ./docs/master/cashier-paddle.md:555 +msgid "Sometimes, you may need to create a checkout session for users that do not need an account with your application. To do so, you may use the `guest` method:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:557 +#: ./docs/11.x/cashier-paddle.md:557 +#: ./docs/master/cashier-paddle.md:557 +msgid "use Illuminate\\Http\\Request;\n" +"use Laravel\\Paddle\\Checkout;\n\n" +"Route::get('/buy', function (Request $request) {\n" +" $checkout = Checkout::guest('pri_34567')\n" +" ->returnTo(route('home'));\n\n" +" return view('billing', ['checkout' => $checkout]);\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:560 +#: ./docs/9.x/cashier-paddle.md:589 +#: ./docs/10.x/cashier-paddle.md:765 +#: ./docs/11.x/cashier-paddle.md:765 +#: ./docs/master/cashier-paddle.md:765 msgid "If you would like to determine if a user is still within their trial period, you may use the `onTrial` method. This method can be useful for determining if you should display a warning to the user that they are still on their trial period:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 171 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:562 +#: ./docs/9.x/cashier-paddle.md:591 msgid "if ($user->subscription('default')->onTrial()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 172 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:566 +#: ./docs/9.x/cashier-paddle.md:595 msgid "The `subscribedToPlan` method may be used to determine if the user is subscribed to a given plan based on a given Paddle plan ID. In this example, we will determine if the user's `default` subscription is actively subscribed to the monthly plan:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 173 (code) +# P +#: ./docs/10.x/cashier-paddle.md:567 +#: ./docs/11.x/cashier-paddle.md:567 +#: ./docs/master/cashier-paddle.md:567 +msgid "Then, you may provide the checkout session to the [Paddle button](#overlay-checkout) or [inline checkout](#inline-checkout) Blade components." +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:568 +#: ./docs/9.x/cashier-paddle.md:597 msgid "if ($user->subscribedToPlan($monthly = 12345, 'default')) {\n" -" // ...\n" -"}\n" +" //\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:569 +#: ./docs/11.x/cashier-paddle.md:569 +#: ./docs/master/cashier-paddle.md:569 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/cashier-paddle.md:570 +#: ./docs/11.x/cashier-paddle.md:570 +#: ./docs/master/cashier-paddle.md:570 +msgid "Price Previews" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:572 +#: ./docs/11.x/cashier-paddle.md:572 +#: ./docs/master/cashier-paddle.md:572 +msgid "Paddle allows you to customize prices per currency, essentially allowing you to configure different prices for different countries. Cashier Paddle allows you to retrieve all of these prices using the `previewPrices` method. This method accepts the price IDs you wish to retrieve prices for:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:572 +#: ./docs/9.x/cashier-paddle.md:601 +msgid "By passing an array to the `subscribedToPlan` method, you may determine if the user's `default` subscription is actively subscribed to the monthly or the yearly plan:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:574 +#: ./docs/11.x/cashier-paddle.md:574 +#: ./docs/master/cashier-paddle.md:574 +msgid "use Laravel\\Paddle\\Cashier;\n\n" +"$prices = Cashier::previewPrices(['pri_123', 'pri_456']);" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:574 +#: ./docs/9.x/cashier-paddle.md:603 +msgid "if ($user->subscribedToPlan([$monthly = 12345, $yearly = 54321], 'default')) {\n" +" //\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 174 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:578 +#: ./docs/9.x/cashier-paddle.md:607 msgid "The `recurring` method may be used to determine if the user is currently subscribed and is no longer within their trial period:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 175 (code) +# CODE +#: ./docs/10.x/cashier-paddle.md:580 +#: ./docs/master/cashier-paddle.md:580 +msgid "use Laravel\\Paddle\\Cashier;\n\n" +"$prices = Cashier::productPrices(['pri_123', 'pri_456'], ['address' => [\n" +" 'country_code' => 'BE',\n" +" 'postal_code' => '1234',\n" +"]]);" +msgstr "" + +# CODE +#: ./docs/11.x/cashier-paddle.md:580 +msgid "use Laravel\\Paddle\\Cashier;\n\n" +"$prices = Cashier::previewPrices(['pri_123', 'pri_456'], ['address' => [\n" +" 'country_code' => 'BE',\n" +" 'postal_code' => '1234',\n" +"]]);" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:580 +#: ./docs/9.x/cashier-paddle.md:609 msgid "if ($user->subscription('default')->recurring()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 177 (header) +# P +#: ./docs/8.x/cashier-paddle.md:584 +#: ./docs/9.x/cashier-paddle.md:613 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:585 +#: ./docs/9.x/cashier-paddle.md:614 msgid "Cancelled Subscription Status" msgstr "" -#: docs/10.x/cashier-paddle.md:block 178 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:587 +#: ./docs/9.x/cashier-paddle.md:616 msgid "To determine if the user was once an active subscriber but has cancelled their subscription, you may use the `cancelled` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 179 (code) +# CODE: blade +#: ./docs/10.x/cashier-paddle.md:589 +#: ./docs/10.x/cashier-paddle.md:633 +#: ./docs/11.x/cashier-paddle.md:589 +#: ./docs/11.x/cashier-paddle.md:633 +#: ./docs/master/cashier-paddle.md:589 +#: ./docs/master/cashier-paddle.md:633 +msgid "
      \n" +" @foreach ($prices as $price)\n" +"
    • {{ $price->product['name'] }} - {{ $price->total() }}
    • \n" +" @endforeach\n" +"
    " +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:589 +#: ./docs/9.x/cashier-paddle.md:618 msgid "if ($user->subscription('default')->cancelled()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 180 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:593 +#: ./docs/9.x/cashier-paddle.md:622 msgid "You may also determine if a user has cancelled their subscription, but are still on their \"grace period\" until the subscription fully expires. For example, if a user cancels a subscription on March 5th that was originally scheduled to expire on March 10th, the user is on their \"grace period\" until March 10th. Note that the `subscribed` method still returns `true` during this time:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 181 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:595 +#: ./docs/8.x/cashier-paddle.md:816 +#: ./docs/9.x/cashier-paddle.md:624 +#: ./docs/9.x/cashier-paddle.md:873 msgid "if ($user->subscription('default')->onGracePeriod()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:597 +#: ./docs/11.x/cashier-paddle.md:597 +#: ./docs/master/cashier-paddle.md:597 +msgid "You may also display the subtotal price and tax amount separately:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/cashier-paddle.md:599 +#: ./docs/master/cashier-paddle.md:599 +msgid "
      \n" +" @foreach ($prices as $price)\n" +"
    • {{ $price->product_title }} - {{ $price->subtotal() }} (+ {{ $price->tax() }} tax)
    • \n" +" @endforeach\n" +"
    " +msgstr "" + +# CODE: blade +#: ./docs/11.x/cashier-paddle.md:599 +msgid "
      \n" +" @foreach ($prices as $price)\n" +"
    • {{ $price->product['name'] }} - {{ $price->subtotal() }} (+ {{ $price->tax() }} tax)
    • \n" +" @endforeach\n" +"
    " msgstr "" -#: docs/10.x/cashier-paddle.md:block 182 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:599 +#: ./docs/9.x/cashier-paddle.md:628 msgid "To determine if the user has cancelled their subscription and is no longer within their \"grace period\", you may use the `ended` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 183 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:601 +#: ./docs/9.x/cashier-paddle.md:630 msgid "if ($user->subscription('default')->ended()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:605 +#: ./docs/9.x/cashier-paddle.md:634 +#: ./docs/10.x/cashier-paddle.md:798 +#: ./docs/11.x/cashier-paddle.md:798 +#: ./docs/master/cashier-paddle.md:798 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:606 +#: ./docs/9.x/cashier-paddle.md:635 +#: ./docs/10.x/cashier-paddle.md:799 +#: ./docs/11.x/cashier-paddle.md:799 +#: ./docs/master/cashier-paddle.md:799 +msgid "Past Due Status" msgstr "" -#: docs/10.x/cashier-paddle.md:block 185 (header) -msgid "Past Due Status" +# P +#: ./docs/10.x/cashier-paddle.md:607 +#: ./docs/11.x/cashier-paddle.md:607 +#: ./docs/master/cashier-paddle.md:607 +msgid "For more information, [checkout Paddle's API documentation regarding price previews](https://developer.paddle.com/api-reference/pricing-preview/preview-prices)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 186 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:608 +#: ./docs/9.x/cashier-paddle.md:637 +#: ./docs/10.x/cashier-paddle.md:801 +#: ./docs/11.x/cashier-paddle.md:801 +#: ./docs/master/cashier-paddle.md:801 msgid "If a payment fails for a subscription, it will be marked as `past_due`. When your subscription is in this state it will not be active until the customer has updated their payment information. You may determine if a subscription is past due using the `pastDue` method on the subscription instance:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 187 (code) +# P +#: ./docs/10.x/cashier-paddle.md:609 +#: ./docs/11.x/cashier-paddle.md:609 +#: ./docs/master/cashier-paddle.md:609 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:610 +#: ./docs/11.x/cashier-paddle.md:610 +#: ./docs/master/cashier-paddle.md:610 +msgid "Customer Price Previews" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:610 +#: ./docs/9.x/cashier-paddle.md:639 msgid "if ($user->subscription('default')->pastDue()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 188 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:614 +#: ./docs/11.x/cashier-paddle.md:614 +#: ./docs/master/cashier-paddle.md:614 +msgid "use App\\Models\\User;\n\n" +"$prices = User::find(1)->previewPrices(['pri_123', 'pri_456']);" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:614 +#: ./docs/9.x/cashier-paddle.md:643 msgid "When a subscription is past due, you should instruct the user to [update their payment information](#updating-payment-information). You may configure how past due subscriptions are handled in your [Paddle subscription settings](https://vendors.paddle.com/subscription-settings)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 189 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:616 +#: ./docs/9.x/cashier-paddle.md:645 msgid "If you would like subscriptions to still be considered active when they are `past_due`, you may use the `keepPastDueSubscriptionsActive` method provided by Cashier. Typically, this method should be called in the `register` method of your `AppServiceProvider`:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 190 (code) +# P +#: ./docs/10.x/cashier-paddle.md:618 +#: ./docs/11.x/cashier-paddle.md:618 +#: ./docs/master/cashier-paddle.md:618 +msgid "Internally, Cashier will use the user's customer ID to retrieve the prices in their currency. So, for example, a user living in the United States will see prices in US dollars while a user in Belgium will see prices in Euros. If no matching currency can be found, the default currency of the product will be used. You can customize all prices of a product or subscription plan in the Paddle control panel." +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:618 +#: ./docs/9.x/cashier-paddle.md:647 msgid "use Laravel\\Paddle\\Cashier;\n\n" "/**\n" " * Register any application services.\n" +" *\n" +" * @return void\n" " */\n" -"public function register(): void\n" +"public function register()\n" "{\n" " Cashier::keepPastDueSubscriptionsActive();\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:620 +#: ./docs/11.x/cashier-paddle.md:620 +#: ./docs/master/cashier-paddle.md:620 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:621 +#: ./docs/11.x/cashier-paddle.md:621 +#: ./docs/master/cashier-paddle.md:621 +msgid "Discounts" msgstr "" -#: docs/10.x/cashier-paddle.md:block 191 (quote) -msgid "**Warning** When a subscription is in a `past_due` state it cannot be changed until payment information has been updated. Therefore, the `swap` and `updateQuantity` methods will throw an exception when the subscription is in a `past_due` state." +# P +#: ./docs/10.x/cashier-paddle.md:623 +#: ./docs/11.x/cashier-paddle.md:623 +#: ./docs/master/cashier-paddle.md:623 +msgid "You may also choose to display prices after a discount. When calling the `previewPrices` method, you provide the discount ID via the `discount_id` option:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 193 (header) +# CODE +#: ./docs/10.x/cashier-paddle.md:625 +#: ./docs/11.x/cashier-paddle.md:625 +#: ./docs/master/cashier-paddle.md:625 +msgid "use Laravel\\Paddle\\Cashier;\n\n" +"$prices = Cashier::previewPrices(['pri_123', 'pri_456'], [\n" +" 'discount_id' => 'dsc_123'\n" +"]);" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:630 +#: ./docs/9.x/cashier-paddle.md:660 +#: ./docs/10.x/cashier-paddle.md:822 +#: ./docs/11.x/cashier-paddle.md:822 +#: ./docs/master/cashier-paddle.md:822 +msgid "When a subscription is in a `past_due` state it cannot be changed until payment information has been updated. Therefore, the `swap` and `updateQuantity` methods will throw an exception when the subscription is in a `past_due` state." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:631 +#: ./docs/11.x/cashier-paddle.md:631 +#: ./docs/master/cashier-paddle.md:631 +msgid "Then, display the calculated prices:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:632 +#: ./docs/9.x/cashier-paddle.md:662 +#: ./docs/10.x/cashier-paddle.md:824 +#: ./docs/11.x/cashier-paddle.md:824 +#: ./docs/master/cashier-paddle.md:824 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:633 +#: ./docs/9.x/cashier-paddle.md:663 +#: ./docs/10.x/cashier-paddle.md:825 +#: ./docs/11.x/cashier-paddle.md:825 +#: ./docs/master/cashier-paddle.md:825 msgid "Subscription Scopes" msgstr "" -#: docs/10.x/cashier-paddle.md:block 194 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:635 +#: ./docs/9.x/cashier-paddle.md:665 +#: ./docs/10.x/cashier-paddle.md:827 +#: ./docs/11.x/cashier-paddle.md:827 +#: ./docs/master/cashier-paddle.md:827 msgid "Most subscription states are also available as query scopes so that you may easily query your database for subscriptions that are in a given state:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 195 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:637 +#: ./docs/9.x/cashier-paddle.md:667 msgid "// Get all active subscriptions...\n" "$subscriptions = Subscription::query()->active()->get();\n\n" "// Get all of the cancelled subscriptions for a user...\n" -"$subscriptions = $user->subscriptions()->cancelled()->get();\n" +"$subscriptions = $user->subscriptions()->cancelled()->get();" msgstr "" -#: docs/10.x/cashier-paddle.md:block 196 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:643 +#: ./docs/9.x/cashier-paddle.md:673 +#: ./docs/10.x/cashier-paddle.md:835 +#: ./docs/11.x/cashier-paddle.md:835 +#: ./docs/master/cashier-paddle.md:835 msgid "A complete list of available scopes is available below:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 197 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:645 +#: ./docs/9.x/cashier-paddle.md:675 msgid "Subscription::query()->active();\n" "Subscription::query()->onTrial();\n" "Subscription::query()->notOnTrial();\n" @@ -1012,320 +3127,1002 @@ msgid "Subscription::query()->active();\n" "Subscription::query()->cancelled();\n" "Subscription::query()->notCancelled();\n" "Subscription::query()->onGracePeriod();\n" -"Subscription::query()->notOnGracePeriod();\n" +"Subscription::query()->notOnGracePeriod();" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:647 +#: ./docs/11.x/cashier-paddle.md:647 +#: ./docs/master/cashier-paddle.md:647 +msgid "Cashier allows you to define some useful defaults for your customers when creating checkout sessions. Setting these defaults allow you to pre-fill a customer's email address and name so that they can immediately move on to the payment portion of the checkout widget. You can set these defaults by overriding the following methods on your billable model:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 199 (header) +# CODE +#: ./docs/10.x/cashier-paddle.md:649 +#: ./docs/11.x/cashier-paddle.md:649 +#: ./docs/master/cashier-paddle.md:649 +msgid "/**\n" +" * Get the customer's name to associate with Paddle.\n" +" */\n" +"public function paddleName(): string|null\n" +"{\n" +" return $this->name;\n" +"}\n\n" +"/**\n" +" * Get the customer's email address to associate with Paddle.\n" +" */\n" +"public function paddleEmail(): string|null\n" +"{\n" +" return $this->email;\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:660 +#: ./docs/9.x/cashier-paddle.md:690 +#: ./docs/10.x/cashier-paddle.md:853 +#: ./docs/11.x/cashier-paddle.md:853 +#: ./docs/master/cashier-paddle.md:853 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:661 +#: ./docs/9.x/cashier-paddle.md:691 +#: ./docs/10.x/cashier-paddle.md:854 +#: ./docs/11.x/cashier-paddle.md:854 +#: ./docs/master/cashier-paddle.md:854 msgid "Subscription Single Charges" msgstr "" -#: docs/10.x/cashier-paddle.md:block 200 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:663 +#: ./docs/9.x/cashier-paddle.md:693 msgid "Subscription single charges allow you to charge subscribers with a one-time charge on top of their subscriptions:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 201 (code) -msgid "$response = $user->subscription('default')->charge(12.99, 'Support Add-on');\n" +# P +#: ./docs/10.x/cashier-paddle.md:665 +#: ./docs/11.x/cashier-paddle.md:665 +#: ./docs/master/cashier-paddle.md:665 +msgid "These defaults will be used for every action in Cashier that generates a [checkout session](#checkout-sessions)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 202 (paragraph) -msgid "In contrast to [single charges](#single-charges), this method will immediately charge the customer's stored payment method for the subscription. The charge amount should always be defined in the currency of the subscription." +# CODE +#: ./docs/8.x/cashier-paddle.md:665 +#: ./docs/9.x/cashier-paddle.md:695 +msgid "$response = $user->subscription('default')->charge(12.99, 'Support Add-on');" msgstr "" -#: docs/10.x/cashier-paddle.md:block 204 (header) -msgid "Updating Payment Information" -msgstr "" +# P +#: ./docs/10.x/cashier-paddle.md:667 +#: ./docs/11.x/cashier-paddle.md:667 +#: ./docs/master/cashier-paddle.md:667 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/cashier-paddle.md:block 205 (paragraph) -msgid "Paddle always saves a payment method per subscription. If you want to update the default payment method for a subscription, you should first generate a subscription \"update URL\" using the `updateUrl` method on the subscription model:" +# P +#: ./docs/8.x/cashier-paddle.md:667 +#: ./docs/9.x/cashier-paddle.md:697 +msgid "In contrast to [single charges](#single-charges), this method will immediately charge the customer's stored payment method for the subscription. The charge amount should always be defined in the currency of the subscription." msgstr "" -#: docs/10.x/cashier-paddle.md:block 206 (code) -msgid "use App\\Models\\User;\n\n" -"$user = User::find(1);\n\n" -"$updateUrl = $user->subscription('default')->updateUrl();\n" +# H3 +#: ./docs/10.x/cashier-paddle.md:668 +#: ./docs/11.x/cashier-paddle.md:668 +#: ./docs/master/cashier-paddle.md:668 +msgid "Retrieving Customers" msgstr "" -#: docs/10.x/cashier-paddle.md:block 207 (paragraph) -msgid "Then, you may use the generated URL in combination with Cashier's provided `paddle-button` Blade component to allow the user to initiate the Paddle widget and update their payment information:" +# P +#: ./docs/8.x/cashier-paddle.md:669 +#: ./docs/9.x/cashier-paddle.md:699 +#: ./docs/10.x/cashier-paddle.md:868 +#: ./docs/11.x/cashier-paddle.md:868 +#: ./docs/master/cashier-paddle.md:868 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:670 +#: ./docs/11.x/cashier-paddle.md:670 +#: ./docs/master/cashier-paddle.md:670 +msgid "You can retrieve a customer by their Paddle Customer ID using the `Cashier::findBillable` method. This method will return an instance of the billable model:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 208 (code) -msgid "\n" -" Update Card\n" -"\n" +# H3 +#: ./docs/8.x/cashier-paddle.md:670 +#: ./docs/9.x/cashier-paddle.md:700 +#: ./docs/10.x/cashier-paddle.md:869 +#: ./docs/11.x/cashier-paddle.md:869 +#: ./docs/master/cashier-paddle.md:869 +msgid "Updating Payment Information" msgstr "" -#: docs/10.x/cashier-paddle.md:block 209 (paragraph) -msgid "When a user has finished updating their information, a `subscription_updated` webhook will be dispatched by Paddle and the subscription details will be updated in your application's database." +# CODE +#: ./docs/10.x/cashier-paddle.md:672 +#: ./docs/master/cashier-paddle.md:672 +msgid "use Laravel\\Cashier\\Cashier;\n\n" +"$user = Cashier::findBillable($customerId);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 211 (header) -msgid "Changing Plans" +# CODE +#: ./docs/11.x/cashier-paddle.md:672 +msgid "use Laravel\\Paddle\\Cashier;\n\n" +"$user = Cashier::findBillable($customerId);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 212 (paragraph) -msgid "After a user has subscribed to your application, they may occasionally want to change to a new subscription plan. To update the subscription plan for a user, you should pass the Paddle plan's identifier to the subscription's `swap` method:" +# P +#: ./docs/8.x/cashier-paddle.md:672 +#: ./docs/9.x/cashier-paddle.md:702 +msgid "Paddle always saves a payment method per subscription. If you want to update the default payment method for a subscription, you should first generate a subscription \"update URL\" using the `updateUrl` method on the subscription model:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 213 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:674 +#: ./docs/9.x/cashier-paddle.md:704 msgid "use App\\Models\\User;\n\n" "$user = User::find(1);\n\n" -"$user->subscription('default')->swap($premium = 34567);\n" -msgstr "" - -#: docs/10.x/cashier-paddle.md:block 214 (paragraph) -msgid "If you would like to swap plans and immediately invoice the user instead of waiting for their next billing cycle, you may use the `swapAndInvoice` method:" -msgstr "" - -#: docs/10.x/cashier-paddle.md:block 215 (code) -msgid "$user = User::find(1);\n\n" -"$user->subscription('default')->swapAndInvoice($premium = 34567);\n" +"$updateUrl = $user->subscription('default')->updateUrl();" msgstr "" -#: docs/10.x/cashier-paddle.md:block 216 (quote) -msgid "**Warning** Plans may not be swapped when a trial is active. For additional information regarding this limitation, please see the [Paddle documentation](https://developer.paddle.com/api-reference/subscription-api/users/updateuser#usage-notes)." -msgstr "" +# P +#: ./docs/10.x/cashier-paddle.md:676 +#: ./docs/11.x/cashier-paddle.md:676 +#: ./docs/master/cashier-paddle.md:676 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/cashier-paddle.md:block 218 (header) -msgid "Prorations" +# H3 +#: ./docs/10.x/cashier-paddle.md:677 +#: ./docs/11.x/cashier-paddle.md:677 +#: ./docs/master/cashier-paddle.md:677 +msgid "Creating Customers" msgstr "" -#: docs/10.x/cashier-paddle.md:block 219 (paragraph) -msgid "By default, Paddle prorates charges when swapping between plans. The `noProrate` method may be used to update the subscriptions without prorating the charges:" +# P +#: ./docs/10.x/cashier-paddle.md:679 +#: ./docs/11.x/cashier-paddle.md:679 +#: ./docs/master/cashier-paddle.md:679 +msgid "Occasionally, you may wish to create a Paddle customer without beginning a subscription. You may accomplish this using the `createAsCustomer` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 220 (code) -msgid "$user->subscription('default')->noProrate()->swap($premium = 34567);\n" +# P +#: ./docs/8.x/cashier-paddle.md:680 +#: ./docs/9.x/cashier-paddle.md:710 +msgid "Then, you may use the generated URL in combination with Cashier's provided `paddle-button` Blade component to allow the user to initiate the Paddle widget and update their payment information:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 222 (header) -msgid "Subscription Quantity" +# CODE +#: ./docs/10.x/cashier-paddle.md:681 +#: ./docs/11.x/cashier-paddle.md:681 +#: ./docs/master/cashier-paddle.md:681 +msgid "$customer = $user->createAsCustomer();" msgstr "" -#: docs/10.x/cashier-paddle.md:block 223 (paragraph) -msgid "Sometimes subscriptions are affected by \"quantity\". For example, a project management application might charge $10 per month per project. To easily increment or decrement your subscription's quantity, use the `incrementQuantity` and `decrementQuantity` methods:" +# CODE: html +#: ./docs/8.x/cashier-paddle.md:682 +#: ./docs/9.x/cashier-paddle.md:712 +msgid "\n" +" Update Card\n" +"" msgstr "" -#: docs/10.x/cashier-paddle.md:block 224 (code) -msgid "$user = User::find(1);\n\n" -"$user->subscription('default')->incrementQuantity();\n\n" -"// Add five to the subscription's current quantity...\n" -"$user->subscription('default')->incrementQuantity(5);\n\n" -"$user->subscription('default')->decrementQuantity();\n\n" -"// Subtract five from the subscription's current quantity...\n" -"$user->subscription('default')->decrementQuantity(5);\n" +# P +#: ./docs/10.x/cashier-paddle.md:683 +#: ./docs/11.x/cashier-paddle.md:683 +#: ./docs/master/cashier-paddle.md:683 +msgid "An instance of `Laravel\\Paddle\\Customer` is returned. Once the customer has been created in Paddle, you may begin a subscription at a later date. You may provide an optional `$options` array to pass in any additional [customer creation parameters that are supported by the Paddle API](https://developer.paddle.com/api-reference/customers/create-customer):" msgstr "" -#: docs/10.x/cashier-paddle.md:block 225 (paragraph) -msgid "Alternatively, you may set a specific quantity using the `updateQuantity` method:" +# CODE +#: ./docs/10.x/cashier-paddle.md:685 +#: ./docs/11.x/cashier-paddle.md:685 +#: ./docs/master/cashier-paddle.md:685 +msgid "$customer = $user->createAsCustomer($options);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 226 (code) -msgid "$user->subscription('default')->updateQuantity(10);\n" +# P +#: ./docs/8.x/cashier-paddle.md:688 +#: ./docs/9.x/cashier-paddle.md:718 +#: ./docs/10.x/cashier-paddle.md:881 +#: ./docs/11.x/cashier-paddle.md:881 +#: ./docs/master/cashier-paddle.md:881 +msgid "When a user has finished updating their information, a `subscription_updated` webhook will be dispatched by Paddle and the subscription details will be updated in your application's database." msgstr "" -#: docs/10.x/cashier-paddle.md:block 227 (paragraph) -msgid "The `noProrate` method may be used to update the subscription's quantity without prorating the charges:" +# P +#: ./docs/8.x/cashier-paddle.md:690 +#: ./docs/9.x/cashier-paddle.md:720 +#: ./docs/10.x/cashier-paddle.md:883 +#: ./docs/11.x/cashier-paddle.md:883 +#: ./docs/master/cashier-paddle.md:883 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:691 +#: ./docs/9.x/cashier-paddle.md:721 +#: ./docs/10.x/cashier-paddle.md:884 +#: ./docs/11.x/cashier-paddle.md:884 +#: ./docs/master/cashier-paddle.md:884 +msgid "Changing Plans" msgstr "" -#: docs/10.x/cashier-paddle.md:block 228 (code) -msgid "$user->subscription('default')->noProrate()->updateQuantity(10);\n" +# P +#: ./docs/10.x/cashier-paddle.md:693 +#: ./docs/11.x/cashier-paddle.md:693 +#: ./docs/master/cashier-paddle.md:693 +msgid "To create a subscription, first retrieve an instance of your billable model from your database, which will typically be an instance of `App\\Models\\User`. Once you have retrieved the model instance, you may use the `subscribe` method to create the model's checkout session:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 230 (header) -msgid "Subscription Modifiers" +# P +#: ./docs/8.x/cashier-paddle.md:693 +#: ./docs/9.x/cashier-paddle.md:723 +msgid "After a user has subscribed to your application, they may occasionally want to change to a new subscription plan. To update the subscription plan for a user, you should pass the Paddle plan's identifier to the subscription's `swap` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 231 (paragraph) -msgid "Subscription modifiers allow you to implement [metered billing](https://developer.paddle.com/guides/how-tos/subscriptions/metered-billing#using-subscription-price-modifiers) or extend subscriptions with add-ons." +# CODE +#: ./docs/10.x/cashier-paddle.md:695 +#: ./docs/11.x/cashier-paddle.md:695 +#: ./docs/master/cashier-paddle.md:695 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/user/subscribe', function (Request $request) {\n" +" $checkout = $request->user()->subscribe($premium = 12345, 'default')\n" +" ->returnTo(route('home'));\n\n" +" return view('billing', ['checkout' => $checkout]);\n" +"});" msgstr "" -#: docs/10.x/cashier-paddle.md:block 232 (paragraph) -msgid "For example, you might want to offer a \"Premium Support\" add-on with your standard subscription. You can create this modifier like so:" +# CODE +#: ./docs/8.x/cashier-paddle.md:695 +#: ./docs/9.x/cashier-paddle.md:725 +msgid "use App\\Models\\User;\n\n" +"$user = User::find(1);\n\n" +"$user->subscription('default')->swap($premium = 34567);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 233 (code) -msgid "$modifier = $user->subscription('default')->newModifier(12.99)->create();\n" +# P +#: ./docs/8.x/cashier-paddle.md:701 +#: ./docs/9.x/cashier-paddle.md:731 +#: ./docs/10.x/cashier-paddle.md:894 +#: ./docs/11.x/cashier-paddle.md:894 +#: ./docs/master/cashier-paddle.md:894 +msgid "If you would like to swap plans and immediately invoice the user instead of waiting for their next billing cycle, you may use the `swapAndInvoice` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 234 (paragraph) -msgid "The example above will add a $12.99 add-on to the subscription. By default, this charge will recur on every interval you have configured for the subscription. If you would like, you can add a readable description to the modifier using the modifier's `description` method:" +# CODE +#: ./docs/8.x/cashier-paddle.md:703 +#: ./docs/9.x/cashier-paddle.md:733 +msgid "$user = User::find(1);\n\n" +"$user->subscription('default')->swapAndInvoice($premium = 34567);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 235 (code) -msgid "$modifier = $user->subscription('default')->newModifier(12.99)\n" -" ->description('Premium Support')\n" -" ->create();\n" +# P +#: ./docs/10.x/cashier-paddle.md:704 +#: ./docs/11.x/cashier-paddle.md:704 +#: ./docs/master/cashier-paddle.md:704 +msgid "The first argument given to the `subscribe` method is the specific price the user is subscribing to. This value should correspond to the price's identifier in Paddle. The `returnTo` method accepts a URL that your user will be redirected to after they successfully complete the checkout. The second argument passed to the `subscribe` method should be the internal \"type\" of the subscription. If your application only offers a single subscription, you might call this `default` or `primary`. This subscription type is only for internal application usage and is not meant to be displayed to users. In addition, it should not contain spaces and it should never be changed after creating the subscription." msgstr "" -#: docs/10.x/cashier-paddle.md:block 236 (paragraph) -msgid "To illustrate how to implement metered billing using modifiers, imagine your application charges per SMS message sent by the user. First, you should create a $0 plan in your Paddle dashboard. Once the user has been subscribed to this plan, you can add modifiers representing each individual charge to the subscription:" +# P +#: ./docs/10.x/cashier-paddle.md:706 +#: ./docs/master/cashier-paddle.md:706 +msgid "You may also provide an array of custom meta data regarding the subscription using the `customData` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 237 (code) -msgid "$modifier = $user->subscription('default')->newModifier(0.99)\n" -" ->description('New text message')\n" -" ->oneTime()\n" -" ->create();\n" +# P +#: ./docs/11.x/cashier-paddle.md:706 +msgid "You may also provide an array of custom metadata regarding the subscription using the `customData` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 238 (paragraph) -msgid "As you can see, we invoked the `oneTime` method when creating this modifier. This method will ensure the modifier is only charged once and does not recur every billing interval." +# P +#: ./docs/8.x/cashier-paddle.md:707 +#: ./docs/9.x/cashier-paddle.md:738 +msgid "Plans may not be swapped when a trial is active. For additional information regarding this limitation, please see the [Paddle documentation](https://developer.paddle.com/api-reference/subscription-api/users/updateuser#usage-notes)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 240 (header) -msgid "Retrieving Modifiers" +# CODE +#: ./docs/10.x/cashier-paddle.md:708 +#: ./docs/11.x/cashier-paddle.md:708 +#: ./docs/master/cashier-paddle.md:708 +msgid "$checkout = $request->user()->subscribe($premium = 12345, 'default')\n" +" ->customData(['key' => 'value'])\n" +" ->returnTo(route('home'));" msgstr "" -#: docs/10.x/cashier-paddle.md:block 241 (paragraph) -msgid "You may retrieve a list of all modifiers for a subscription via the `modifiers` method:" -msgstr "" +# P +#: ./docs/8.x/cashier-paddle.md:709 +#: ./docs/9.x/cashier-paddle.md:740 +#: ./docs/10.x/cashier-paddle.md:900 +#: ./docs/11.x/cashier-paddle.md:900 +#: ./docs/master/cashier-paddle.md:900 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/cashier-paddle.md:block 242 (code) -msgid "$modifiers = $user->subscription('default')->modifiers();\n\n" -"foreach ($modifiers as $modifier) {\n" -" $modifier->amount(); // $0.99\n" -" $modifier->description; // New text message.\n" -"}\n" +# H4 +#: ./docs/8.x/cashier-paddle.md:710 +#: ./docs/9.x/cashier-paddle.md:741 +#: ./docs/10.x/cashier-paddle.md:901 +#: ./docs/11.x/cashier-paddle.md:901 +#: ./docs/master/cashier-paddle.md:901 +msgid "Prorations" msgstr "" -#: docs/10.x/cashier-paddle.md:block 244 (header) -msgid "Deleting Modifiers" +# P +#: ./docs/10.x/cashier-paddle.md:712 +#: ./docs/11.x/cashier-paddle.md:712 +#: ./docs/master/cashier-paddle.md:712 +msgid "Once a subscription checkout session has been created, the checkout session may be provided to the `paddle-button` [Blade component](#overlay-checkout) that is included with Cashier Paddle:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 245 (paragraph) -msgid "Modifiers may be deleted by invoking the `delete` method on a `Laravel\\Paddle\\Modifier` instance:" +# P +#: ./docs/8.x/cashier-paddle.md:712 +msgid "By default, Paddle prorates charges when swapping between plans. The `noProrate` method may be used to update the subscription's without prorating the charges:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 246 (code) -msgid "$modifier->delete();\n" +# CODE +#: ./docs/8.x/cashier-paddle.md:714 +#: ./docs/9.x/cashier-paddle.md:745 +msgid "$user->subscription('default')->noProrate()->swap($premium = 34567);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 248 (header) -msgid "Multiple Subscriptions" -msgstr "" +# P +#: ./docs/8.x/cashier-paddle.md:716 +#: ./docs/9.x/cashier-paddle.md:747 +#: ./docs/10.x/cashier-paddle.md:917 +#: ./docs/11.x/cashier-paddle.md:917 +#: ./docs/master/cashier-paddle.md:917 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/cashier-paddle.md:block 249 (paragraph) -msgid "Paddle allows your customers to have multiple subscriptions simultaneously. For example, you may run a gym that offers a swimming subscription and a weight-lifting subscription, and each subscription may have different pricing. Of course, customers should be able to subscribe to either or both plans." +# H3 +#: ./docs/8.x/cashier-paddle.md:717 +#: ./docs/9.x/cashier-paddle.md:748 +#: ./docs/10.x/cashier-paddle.md:918 +#: ./docs/11.x/cashier-paddle.md:918 +#: ./docs/master/cashier-paddle.md:918 +msgid "Subscription Quantity" msgstr "" -#: docs/10.x/cashier-paddle.md:block 250 (paragraph) -msgid "When your application creates subscriptions, you may provide the name of the subscription to the `newSubscription` method. The name may be any string that represents the type of subscription the user is initiating:" +# P +#: ./docs/8.x/cashier-paddle.md:719 +#: ./docs/9.x/cashier-paddle.md:750 +#: ./docs/10.x/cashier-paddle.md:920 +#: ./docs/11.x/cashier-paddle.md:920 +#: ./docs/master/cashier-paddle.md:920 +msgid "Sometimes subscriptions are affected by \"quantity\". For example, a project management application might charge $10 per month per project. To easily increment or decrement your subscription's quantity, use the `incrementQuantity` and `decrementQuantity` methods:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 251 (code) -msgid "use Illuminate\\Http\\Request;\n\n" -"Route::post('/swimming/subscribe', function (Request $request) {\n" -" $request->user()\n" -" ->newSubscription('swimming', $swimmingMonthly = 12345)\n" -" ->create($request->paymentMethodId);\n\n" -" // ...\n" -"});\n" +# CODE +#: ./docs/8.x/cashier-paddle.md:721 +#: ./docs/9.x/cashier-paddle.md:752 +msgid "$user = User::find(1);\n\n" +"$user->subscription('default')->incrementQuantity();\n\n" +"// Add five to the subscription's current quantity...\n" +"$user->subscription('default')->incrementQuantity(5);\n\n" +"$user->subscription('default')->decrementQuantity();\n\n" +"// Subtract five from the subscription's current quantity...\n" +"$user->subscription('default')->decrementQuantity(5);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 252 (paragraph) -msgid "In this example, we initiated a monthly swimming subscription for the customer. However, they may want to swap to a yearly subscription at a later time. When adjusting the customer's subscription, we can simply swap the price on the `swimming` subscription:" +# P +#: ./docs/10.x/cashier-paddle.md:725 +#: ./docs/master/cashier-paddle.md:725 +msgid "Once a user is subscribed to your application, you may check their subscription status using a variety of convenient methods. First, the `subscribed` method returns `true` if the user has an valid subscription, even if the subscription is currently within its trial period:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 253 (code) -msgid "$user->subscription('swimming')->swap($swimmingYearly = 34567);\n" +# P +#: ./docs/11.x/cashier-paddle.md:725 +msgid "Once a user is subscribed to your application, you may check their subscription status using a variety of convenient methods. First, the `subscribed` method returns `true` if the user has a valid subscription, even if the subscription is currently within its trial period:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 254 (paragraph) -msgid "Of course, you may also cancel the subscription entirely:" +# CODE +#: ./docs/10.x/cashier-paddle.md:727 +#: ./docs/11.x/cashier-paddle.md:727 +#: ./docs/master/cashier-paddle.md:727 +msgid "if ($user->subscribed()) {\n" +" // ...\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 255 (code) -msgid "$user->subscription('swimming')->cancel();\n" +# P +#: ./docs/10.x/cashier-paddle.md:731 +#: ./docs/11.x/cashier-paddle.md:731 +#: ./docs/master/cashier-paddle.md:731 +msgid "If your application offers multiple subscriptions, you may specify the subscription when invoking the `subscribed` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 257 (header) -msgid "Pausing Subscriptions" +# CODE +#: ./docs/10.x/cashier-paddle.md:733 +#: ./docs/11.x/cashier-paddle.md:733 +#: ./docs/master/cashier-paddle.md:733 +msgid "if ($user->subscribed('default')) {\n" +" // ...\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 258 (paragraph) -msgid "To pause a subscription, call the `pause` method on the user's subscription:" +# P +#: ./docs/8.x/cashier-paddle.md:733 +#: ./docs/9.x/cashier-paddle.md:764 +#: ./docs/10.x/cashier-paddle.md:934 +#: ./docs/11.x/cashier-paddle.md:934 +#: ./docs/master/cashier-paddle.md:934 +msgid "Alternatively, you may set a specific quantity using the `updateQuantity` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 259 (code) -msgid "$user->subscription('default')->pause();\n" +# CODE +#: ./docs/8.x/cashier-paddle.md:735 +#: ./docs/9.x/cashier-paddle.md:766 +msgid "$user->subscription('default')->updateQuantity(10);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 260 (paragraph) -msgid "When a subscription is paused, Cashier will automatically set the `paused_from` column in your database. This column is used to know when the `paused` method should begin returning `true`. For example, if a customer pauses a subscription on March 1st, but the subscription was not scheduled to recur until March 5th, the `paused` method will continue to return `false` until March 5th. This is done because a user is typically allowed to continue using an application until the end of their billing cycle." +# P +#: ./docs/8.x/cashier-paddle.md:737 +#: ./docs/9.x/cashier-paddle.md:768 +#: ./docs/10.x/cashier-paddle.md:938 +#: ./docs/11.x/cashier-paddle.md:938 +#: ./docs/master/cashier-paddle.md:938 +msgid "The `noProrate` method may be used to update the subscription's quantity without prorating the charges:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 261 (paragraph) -msgid "You may determine if a user has paused their subscription but are still on their \"grace period\" using the `onPausedGracePeriod` method:" +# CODE +#: ./docs/10.x/cashier-paddle.md:739 +#: ./docs/master/cashier-paddle.md:739 +msgid "user() && ! $request->user()->subscribed()) {\n" +" // This user is not a paying customer...\n" +" return redirect('billing');\n" +" }\n\n" +" return $next($request);\n" +" }\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 262 (code) -msgid "if ($user->subscription('default')->onPausedGracePeriod()) {\n" +# CODE +#: ./docs/11.x/cashier-paddle.md:739 +msgid "user() && ! $request->user()->subscribed()) {\n" +" // This user is not a paying customer...\n" +" return redirect('/billing');\n" +" }\n\n" +" return $next($request);\n" +" }\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:739 +#: ./docs/9.x/cashier-paddle.md:770 +msgid "$user->subscription('default')->noProrate()->updateQuantity(10);" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:741 +#: ./docs/9.x/cashier-paddle.md:772 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:742 +#: ./docs/9.x/cashier-paddle.md:773 +msgid "Subscription Modifiers" +msgstr "" + +# P +#: ./docs/9.x/cashier-paddle.md:743 +#: ./docs/10.x/cashier-paddle.md:903 +#: ./docs/11.x/cashier-paddle.md:903 +#: ./docs/master/cashier-paddle.md:903 +msgid "By default, Paddle prorates charges when swapping between plans. The `noProrate` method may be used to update the subscriptions without prorating the charges:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:744 +#: ./docs/9.x/cashier-paddle.md:775 +msgid "Subscription modifiers allow you to implement [metered billing](https://developer.paddle.com/guides/how-tos/subscriptions/metered-billing#using-subscription-price-modifiers) or extend subscriptions with add-ons." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:746 +#: ./docs/9.x/cashier-paddle.md:777 +msgid "For example, you might want to offer a \"Premium Support\" add-on with your standard subscription. You can create this modifier like so:" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:748 +#: ./docs/9.x/cashier-paddle.md:779 +msgid "$modifier = $user->subscription('default')->newModifier(12.99)->create();" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:750 +#: ./docs/9.x/cashier-paddle.md:781 +msgid "The example above will add a $12.99 add-on to the subscription. By default, this charge will recur on every interval you have configured for the subscription. If you would like, you can add a readable description to the modifier using the modifier's `description` method:" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:752 +#: ./docs/9.x/cashier-paddle.md:783 +msgid "$modifier = $user->subscription('default')->newModifier(12.99)\n" +" ->description('Premium Support')\n" +" ->create();" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:756 +#: ./docs/9.x/cashier-paddle.md:787 +msgid "To illustrate how to implement metered billing using modifiers, imagine your application charges per SMS message sent by the user. First, you should create a $0 plan in your Paddle dashboard. Once the user has been subscribed to this plan, you can add modifiers representing each individual charge to the subscription:" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:758 +#: ./docs/9.x/cashier-paddle.md:789 +msgid "$modifier = $user->subscription('default')->newModifier(0.99)\n" +" ->description('New text message')\n" +" ->oneTime()\n" +" ->create();" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:763 +#: ./docs/9.x/cashier-paddle.md:794 +msgid "As you can see, we invoked the `oneTime` method when creating this modifier. This method will ensure the modifier is only charged once and does not recur every billing interval." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:765 +#: ./docs/9.x/cashier-paddle.md:796 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:766 +#: ./docs/9.x/cashier-paddle.md:797 +msgid "Retrieving Modifiers" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:767 +#: ./docs/11.x/cashier-paddle.md:767 +#: ./docs/master/cashier-paddle.md:767 +msgid "if ($user->subscription()->onTrial()) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:768 +#: ./docs/9.x/cashier-paddle.md:799 +msgid "You may retrieve a list of all modifiers for a subscription via the `modifiers` method:" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:770 +#: ./docs/9.x/cashier-paddle.md:801 +msgid "$modifiers = $user->subscription('default')->modifiers();\n\n" +"foreach ($modifiers as $modifier) {\n" +" $modifier->amount(); // $0.99\n" +" $modifier->description; // New text message.\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:771 +#: ./docs/11.x/cashier-paddle.md:771 +#: ./docs/master/cashier-paddle.md:771 +msgid "The `subscribedToPrice` method may be used to determine if the user is subscribed to a given plan based on a given Paddle price ID. In this example, we will determine if the user's `default` subscription is actively subscribed to the monthly price:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:773 +#: ./docs/11.x/cashier-paddle.md:773 +#: ./docs/master/cashier-paddle.md:773 +msgid "if ($user->subscribedToPrice($monthly = 'pri_123', 'default')) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:777 +#: ./docs/11.x/cashier-paddle.md:777 +#: ./docs/master/cashier-paddle.md:777 +msgid "The `recurring` method may be used to determine if the user is currently on an active subscription and is no longer within their trial period or on a grace period:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:777 +#: ./docs/9.x/cashier-paddle.md:808 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:778 +#: ./docs/9.x/cashier-paddle.md:809 +msgid "Deleting Modifiers" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:779 +#: ./docs/11.x/cashier-paddle.md:779 +#: ./docs/master/cashier-paddle.md:779 +msgid "if ($user->subscription()->recurring()) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:780 +#: ./docs/9.x/cashier-paddle.md:811 +msgid "Modifiers may be deleted by invoking the `delete` method on a `Laravel\\Paddle\\Modifier` instance:" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:782 +#: ./docs/9.x/cashier-paddle.md:813 +msgid "$modifier->delete();" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:783 +#: ./docs/11.x/cashier-paddle.md:783 +#: ./docs/master/cashier-paddle.md:783 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/cashier-paddle.md:784 +#: ./docs/11.x/cashier-paddle.md:784 +#: ./docs/master/cashier-paddle.md:784 +msgid "Canceled Subscription Status" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:784 +#: ./docs/9.x/cashier-paddle.md:840 +#: ./docs/10.x/cashier-paddle.md:1013 +#: ./docs/11.x/cashier-paddle.md:1013 +#: ./docs/master/cashier-paddle.md:1013 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:785 +#: ./docs/9.x/cashier-paddle.md:841 +#: ./docs/10.x/cashier-paddle.md:1014 +#: ./docs/11.x/cashier-paddle.md:1014 +#: ./docs/master/cashier-paddle.md:1014 +msgid "Pausing Subscriptions" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:786 +#: ./docs/11.x/cashier-paddle.md:786 +#: ./docs/master/cashier-paddle.md:786 +msgid "To determine if the user was once an active subscriber but has canceled their subscription, you may use the `canceled` method:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:787 +#: ./docs/9.x/cashier-paddle.md:843 +#: ./docs/10.x/cashier-paddle.md:1016 +#: ./docs/11.x/cashier-paddle.md:1016 +#: ./docs/master/cashier-paddle.md:1016 +msgid "To pause a subscription, call the `pause` method on the user's subscription:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:788 +#: ./docs/11.x/cashier-paddle.md:788 +#: ./docs/master/cashier-paddle.md:788 +msgid "if ($user->subscription()->canceled()) {\n" +" // ...\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:789 +#: ./docs/9.x/cashier-paddle.md:845 +msgid "$user->subscription('default')->pause();" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:791 +#: ./docs/9.x/cashier-paddle.md:847 +msgid "When a subscription is paused, Cashier will automatically set the `paused_from` column in your database. This column is used to know when the `paused` method should begin returning `true`. For example, if a customer pauses a subscription on March 1st, but the subscription was not scheduled to recur until March 5th, the `paused` method will continue to return `false` until March 5th. This is done because a user is typically allowed to continue using an application until the end of their billing cycle." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:792 +#: ./docs/11.x/cashier-paddle.md:792 +#: ./docs/master/cashier-paddle.md:792 +msgid "You may also determine if a user has canceled their subscription, but are still on their \"grace period\" until the subscription fully expires. For example, if a user cancels a subscription on March 5th that was originally scheduled to expire on March 10th, the user is on their \"grace period\" until March 10th. In addition, the `subscribed` method will still return `true` during this time:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:793 +#: ./docs/9.x/cashier-paddle.md:849 +#: ./docs/10.x/cashier-paddle.md:1034 +#: ./docs/11.x/cashier-paddle.md:1034 +#: ./docs/master/cashier-paddle.md:1034 +msgid "You may determine if a user has paused their subscription but are still on their \"grace period\" using the `onPausedGracePeriod` method:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:794 +#: ./docs/10.x/cashier-paddle.md:1058 +#: ./docs/11.x/cashier-paddle.md:794 +#: ./docs/11.x/cashier-paddle.md:1058 +#: ./docs/master/cashier-paddle.md:794 +#: ./docs/master/cashier-paddle.md:1058 +msgid "if ($user->subscription()->onGracePeriod()) {\n" " // ...\n" -"}\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:795 +#: ./docs/9.x/cashier-paddle.md:851 +msgid "if ($user->subscription('default')->onPausedGracePeriod()) {\n" +" //\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 263 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:799 +#: ./docs/9.x/cashier-paddle.md:855 msgid "To resume a paused a subscription, you may call the `unpause` method on the user's subscription:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 264 (code) -msgid "$user->subscription('default')->unpause();\n" +# CODE +#: ./docs/8.x/cashier-paddle.md:801 +#: ./docs/9.x/cashier-paddle.md:857 +msgid "$user->subscription('default')->unpause();" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:803 +#: ./docs/11.x/cashier-paddle.md:803 +#: ./docs/master/cashier-paddle.md:803 +msgid "if ($user->subscription()->pastDue()) {\n" +" // ...\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 265 (quote) -msgid "**Warning** A subscription cannot be modified while it is paused. If you want to swap to a different plan or update quantities you must resume the subscription first." +# P +#: ./docs/8.x/cashier-paddle.md:803 +#: ./docs/9.x/cashier-paddle.md:860 +#: ./docs/10.x/cashier-paddle.md:1045 +#: ./docs/11.x/cashier-paddle.md:1045 +#: ./docs/master/cashier-paddle.md:1045 +msgid "A subscription cannot be modified while it is paused. If you want to swap to a different plan or update quantities you must resume the subscription first." msgstr "" -#: docs/10.x/cashier-paddle.md:block 267 (header) +# P +#: ./docs/8.x/cashier-paddle.md:805 +#: ./docs/9.x/cashier-paddle.md:862 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:806 +#: ./docs/9.x/cashier-paddle.md:863 msgid "Cancelling Subscriptions" msgstr "" -#: docs/10.x/cashier-paddle.md:block 268 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:807 +#: ./docs/11.x/cashier-paddle.md:807 +#: ./docs/master/cashier-paddle.md:807 +msgid "When a subscription is past due, you should instruct the user to [update their payment information](#updating-payment-information)." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:808 +#: ./docs/9.x/cashier-paddle.md:865 +#: ./docs/10.x/cashier-paddle.md:1050 +#: ./docs/11.x/cashier-paddle.md:1050 +#: ./docs/master/cashier-paddle.md:1050 msgid "To cancel a subscription, call the `cancel` method on the user's subscription:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 269 (code) -msgid "$user->subscription('default')->cancel();\n" +# P +#: ./docs/10.x/cashier-paddle.md:809 +#: ./docs/11.x/cashier-paddle.md:809 +#: ./docs/master/cashier-paddle.md:809 +msgid "If you would like subscriptions to still be considered valid when they are `past_due`, you may use the `keepPastDueSubscriptionsActive` method provided by Cashier. Typically, this method should be called in the `register` method of your `AppServiceProvider`:" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:810 +#: ./docs/9.x/cashier-paddle.md:867 +msgid "$user->subscription('default')->cancel();" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:811 +#: ./docs/11.x/cashier-paddle.md:811 +#: ./docs/master/cashier-paddle.md:811 +msgid "use Laravel\\Paddle\\Cashier;\n\n" +"/**\n" +" * Register any application services.\n" +" */\n" +"public function register(): void\n" +"{\n" +" Cashier::keepPastDueSubscriptionsActive();\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 270 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:812 +#: ./docs/9.x/cashier-paddle.md:869 msgid "When a subscription is cancelled, Cashier will automatically set the `ends_at` column in your database. This column is used to know when the `subscribed` method should begin returning `false`. For example, if a customer cancels a subscription on March 1st, but the subscription was not scheduled to end until March 5th, the `subscribed` method will continue to return `true` until March 5th. This is done because a user is typically allowed to continue using an application until the end of their billing cycle." msgstr "" -#: docs/10.x/cashier-paddle.md:block 271 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:814 +#: ./docs/9.x/cashier-paddle.md:871 msgid "You may determine if a user has cancelled their subscription but are still on their \"grace period\" using the `onGracePeriod` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 273 (paragraph) +# P +#: ./docs/9.x/cashier-paddle.md:815 +#: ./docs/10.x/cashier-paddle.md:990 +#: ./docs/11.x/cashier-paddle.md:990 +#: ./docs/master/cashier-paddle.md:990 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/cashier-paddle.md:816 +#: ./docs/10.x/cashier-paddle.md:991 +#: ./docs/11.x/cashier-paddle.md:991 +#: ./docs/master/cashier-paddle.md:991 +msgid "Multiple Subscriptions" +msgstr "" + +# P +#: ./docs/9.x/cashier-paddle.md:818 +#: ./docs/10.x/cashier-paddle.md:993 +#: ./docs/11.x/cashier-paddle.md:993 +#: ./docs/master/cashier-paddle.md:993 +msgid "Paddle allows your customers to have multiple subscriptions simultaneously. For example, you may run a gym that offers a swimming subscription and a weight-lifting subscription, and each subscription may have different pricing. Of course, customers should be able to subscribe to either or both plans." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:820 +#: ./docs/9.x/cashier-paddle.md:877 msgid "If you wish to cancel a subscription immediately, you may call the `cancelNow` method on the user's subscription:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 274 (code) -msgid "$user->subscription('default')->cancelNow();\n" +# P +#: ./docs/9.x/cashier-paddle.md:820 +msgid "When your application creates subscriptions, you may provide the name of the subscription to the `newSubscription` method. The name may be any string that represents the type of subscription the user is initiating:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 275 (quote) -msgid "**Warning** Paddle's subscriptions cannot be resumed after cancellation. If your customer wishes to resume their subscription, they will have to subscribe to a new subscription." +# CODE +#: ./docs/8.x/cashier-paddle.md:822 +#: ./docs/9.x/cashier-paddle.md:879 +msgid "$user->subscription('default')->cancelNow();" msgstr "" -#: docs/10.x/cashier-paddle.md:block 277 (header) +# CODE +#: ./docs/9.x/cashier-paddle.md:822 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::post('/swimming/subscribe', function (Request $request) {\n" +" $request->user()\n" +" ->newSubscription('swimming', $swimmingMonthly = 12345)\n" +" ->create($request->paymentMethodId);\n\n" +" // ...\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:824 +#: ./docs/9.x/cashier-paddle.md:882 +msgid "Paddle's subscriptions cannot be resumed after cancellation. If your customer wishes to resume their subscription, they will have to subscribe to a new subscription." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:826 +#: ./docs/9.x/cashier-paddle.md:884 +#: ./docs/10.x/cashier-paddle.md:1073 +#: ./docs/11.x/cashier-paddle.md:1073 +#: ./docs/master/cashier-paddle.md:1073 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cashier-paddle.md:827 +#: ./docs/9.x/cashier-paddle.md:885 +#: ./docs/10.x/cashier-paddle.md:1074 +#: ./docs/11.x/cashier-paddle.md:1074 +#: ./docs/master/cashier-paddle.md:1074 msgid "Subscription Trials" msgstr "" -#: docs/10.x/cashier-paddle.md:block 279 (header) +# CODE +#: ./docs/10.x/cashier-paddle.md:829 +#: ./docs/11.x/cashier-paddle.md:829 +#: ./docs/master/cashier-paddle.md:829 +msgid "// Get all valid subscriptions...\n" +"$subscriptions = Subscription::query()->valid()->get();\n\n" +"// Get all of the canceled subscriptions for a user...\n" +"$subscriptions = $user->subscriptions()->canceled()->get();" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:829 +#: ./docs/9.x/cashier-paddle.md:887 +#: ./docs/10.x/cashier-paddle.md:1076 +#: ./docs/11.x/cashier-paddle.md:1076 +#: ./docs/master/cashier-paddle.md:1076 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:830 +#: ./docs/9.x/cashier-paddle.md:888 +#: ./docs/10.x/cashier-paddle.md:1077 +#: ./docs/11.x/cashier-paddle.md:1077 +#: ./docs/master/cashier-paddle.md:1077 msgid "With Payment Method Up Front" msgstr "" -#: docs/10.x/cashier-paddle.md:block 280 (quote) -msgid "**Warning** While trialing and collecting payment method details up front, Paddle prevents any subscription changes such as swapping plans or updating quantities. If you want to allow a customer to swap plans during a trial the subscription must be cancelled and recreated." +# P +#: ./docs/8.x/cashier-paddle.md:832 +#: ./docs/9.x/cashier-paddle.md:891 +msgid "While trialing and collecting payment method details up front, Paddle prevents any subscription changes such as swapping plans or updating quantities. If you want to allow a customer to swap plans during a trial the subscription must be cancelled and recreated." msgstr "" -#: docs/10.x/cashier-paddle.md:block 281 (paragraph) +# P +#: ./docs/9.x/cashier-paddle.md:832 +#: ./docs/10.x/cashier-paddle.md:1005 +#: ./docs/11.x/cashier-paddle.md:1005 +#: ./docs/master/cashier-paddle.md:1005 +msgid "In this example, we initiated a monthly swimming subscription for the customer. However, they may want to swap to a yearly subscription at a later time. When adjusting the customer's subscription, we can simply swap the price on the `swimming` subscription:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:834 +#: ./docs/9.x/cashier-paddle.md:893 msgid "If you would like to offer trial periods to your customers while still collecting payment method information up front, you should use the `trialDays` method when creating your subscription pay links:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 282 (code) +# CODE +#: ./docs/9.x/cashier-paddle.md:834 +msgid "$user->subscription('swimming')->swap($swimmingYearly = 34567);" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:836 +#: ./docs/9.x/cashier-paddle.md:895 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/user/subscribe', function (Request $request) {\n" " $payLink = $request->user()->newSubscription('default', $monthly = 12345)\n" @@ -1333,200 +4130,624 @@ msgid "use Illuminate\\Http\\Request;\n\n" " ->trialDays(10)\n" " ->create();\n\n" " return view('billing', ['payLink' => $payLink]);\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/9.x/cashier-paddle.md:836 +#: ./docs/10.x/cashier-paddle.md:1009 +#: ./docs/11.x/cashier-paddle.md:1009 +#: ./docs/master/cashier-paddle.md:1009 +msgid "Of course, you may also cancel the subscription entirely:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:837 +#: ./docs/11.x/cashier-paddle.md:837 +#: ./docs/master/cashier-paddle.md:837 +msgid "Subscription::query()->valid();\n" +"Subscription::query()->onTrial();\n" +"Subscription::query()->expiredTrial();\n" +"Subscription::query()->notOnTrial();\n" +"Subscription::query()->active();\n" +"Subscription::query()->recurring();\n" +"Subscription::query()->pastDue();\n" +"Subscription::query()->paused();\n" +"Subscription::query()->notPaused();\n" +"Subscription::query()->onPausedGracePeriod();\n" +"Subscription::query()->notOnPausedGracePeriod();\n" +"Subscription::query()->canceled();\n" +"Subscription::query()->notCanceled();\n" +"Subscription::query()->onGracePeriod();\n" +"Subscription::query()->notOnGracePeriod();" +msgstr "" + +# CODE +#: ./docs/9.x/cashier-paddle.md:838 +#: ./docs/10.x/cashier-paddle.md:1011 +#: ./docs/11.x/cashier-paddle.md:1011 +#: ./docs/master/cashier-paddle.md:1011 +msgid "$user->subscription('swimming')->cancel();" msgstr "" -#: docs/10.x/cashier-paddle.md:block 283 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:847 +#: ./docs/9.x/cashier-paddle.md:906 msgid "This method will set the trial period ending date on the subscription record within your application's database, as well as instruct Paddle to not begin billing the customer until after this date." msgstr "" -#: docs/10.x/cashier-paddle.md:block 284 (quote) -msgid "**Warning** If the customer's subscription is not cancelled before the trial ending date they will be charged as soon as the trial expires, so you should be sure to notify your users of their trial ending date." +# P +#: ./docs/8.x/cashier-paddle.md:849 +#: ./docs/9.x/cashier-paddle.md:909 +msgid "If the customer's subscription is not cancelled before the trial ending date they will be charged as soon as the trial expires, so you should be sure to notify your users of their trial ending date." msgstr "" -#: docs/10.x/cashier-paddle.md:block 285 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:851 +#: ./docs/9.x/cashier-paddle.md:911 +#: ./docs/10.x/cashier-paddle.md:1095 +#: ./docs/11.x/cashier-paddle.md:1095 +#: ./docs/master/cashier-paddle.md:1095 msgid "You may determine if the user is within their trial period using either the `onTrial` method of the user instance or the `onTrial` method of the subscription instance. The two examples below are equivalent:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 286 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:853 +#: ./docs/9.x/cashier-paddle.md:913 msgid "if ($user->onTrial('default')) {\n" -" // ...\n" +" //\n" "}\n\n" "if ($user->subscription('default')->onTrial()) {\n" -" // ...\n" -"}\n" +" //\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 287 (paragraph) -msgid "To determine if an existing trial has expired, you may use the `hasExpiredTrial` methods:" +# P +#: ./docs/10.x/cashier-paddle.md:856 +#: ./docs/11.x/cashier-paddle.md:856 +#: ./docs/master/cashier-paddle.md:856 +msgid "Subscription single charges allow you to charge subscribers with a one-time charge on top of their subscriptions. You must provide one or multiple price ID's when invoking the `charge` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 288 (code) -msgid "if ($user->hasExpiredTrial('default')) {\n" -" // ...\n" -"}\n\n" -"if ($user->subscription('default')->hasExpiredTrial()) {\n" -" // ...\n" -"}\n" +# CODE +#: ./docs/10.x/cashier-paddle.md:858 +#: ./docs/11.x/cashier-paddle.md:858 +#: ./docs/master/cashier-paddle.md:858 +msgid "// Charge a single price...\n" +"$response = $user->subscription()->charge('pri_123');\n\n" +"// Charge multiple prices at once...\n" +"$response = $user->subscription()->charge(['pri_123', 'pri_456']);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 290 (header) +# P +#: ./docs/8.x/cashier-paddle.md:861 +#: ./docs/9.x/cashier-paddle.md:931 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:862 +#: ./docs/9.x/cashier-paddle.md:932 msgid "Defining Trial Days In Paddle / Cashier" msgstr "" -#: docs/10.x/cashier-paddle.md:block 291 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:864 +#: ./docs/11.x/cashier-paddle.md:864 +#: ./docs/master/cashier-paddle.md:864 +msgid "The `charge` method will not actually charge the customer until the next billing interval of their subscription. If you would like to bill the customer immediately, you may use the `chargeAndInvoice` method instead:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:864 +#: ./docs/9.x/cashier-paddle.md:934 msgid "You may choose to define how many trial days your plan's receive in the Paddle dashboard or always pass them explicitly using Cashier. If you choose to define your plan's trial days in Paddle you should be aware that new subscriptions, including new subscriptions for a customer that had a subscription in the past, will always receive a trial period unless you explicitly call the `trialDays(0)` method." msgstr "" -#: docs/10.x/cashier-paddle.md:block 293 (header) +# CODE +#: ./docs/10.x/cashier-paddle.md:866 +#: ./docs/11.x/cashier-paddle.md:866 +#: ./docs/master/cashier-paddle.md:866 +msgid "$response = $user->subscription()->chargeAndInvoice('pri_123');" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:866 +#: ./docs/9.x/cashier-paddle.md:936 +#: ./docs/10.x/cashier-paddle.md:1124 +#: ./docs/11.x/cashier-paddle.md:1124 +#: ./docs/master/cashier-paddle.md:1124 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:867 +#: ./docs/9.x/cashier-paddle.md:937 +#: ./docs/10.x/cashier-paddle.md:1125 +#: ./docs/11.x/cashier-paddle.md:1125 +#: ./docs/master/cashier-paddle.md:1125 msgid "Without Payment Method Up Front" msgstr "" -#: docs/10.x/cashier-paddle.md:block 294 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:869 +#: ./docs/9.x/cashier-paddle.md:939 +#: ./docs/10.x/cashier-paddle.md:1127 +#: ./docs/11.x/cashier-paddle.md:1127 +#: ./docs/master/cashier-paddle.md:1127 msgid "If you would like to offer trial periods without collecting the user's payment method information up front, you may set the `trial_ends_at` column on the customer record attached to your user to your desired trial ending date. This is typically done during user registration:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 295 (code) +# P +#: ./docs/10.x/cashier-paddle.md:871 +#: ./docs/11.x/cashier-paddle.md:871 +#: ./docs/master/cashier-paddle.md:871 +msgid "Paddle always saves a payment method per subscription. If you want to update the default payment method for a subscription, you should redirect your customer to Paddle's hosted payment method update page using the `redirectToUpdatePaymentMethod` method on the subscription model:" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:871 +#: ./docs/9.x/cashier-paddle.md:941 +#: ./docs/10.x/cashier-paddle.md:1129 +#: ./docs/11.x/cashier-paddle.md:1129 +#: ./docs/master/cashier-paddle.md:1129 msgid "use App\\Models\\User;\n\n" "$user = User::create([\n" " // ...\n" "]);\n\n" "$user->createAsCustomer([\n" " 'trial_ends_at' => now()->addDays(10)\n" -"]);\n" +"]);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 296 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:873 +#: ./docs/11.x/cashier-paddle.md:873 +#: ./docs/master/cashier-paddle.md:873 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/update-payment-method', function (Request $request) {\n" +" $user = $request->user();\n\n" +" return $user->subscription()->redirectToUpdatePaymentMethod();\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:881 +#: ./docs/9.x/cashier-paddle.md:951 +#: ./docs/10.x/cashier-paddle.md:1139 +#: ./docs/11.x/cashier-paddle.md:1139 +#: ./docs/master/cashier-paddle.md:1139 msgid "Cashier refers to this type of trial as a \"generic trial\", since it is not attached to any existing subscription. The `onTrial` method on the `User` instance will return `true` if the current date is not past the value of `trial_ends_at`:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 297 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:883 +#: ./docs/9.x/cashier-paddle.md:953 +#: ./docs/10.x/cashier-paddle.md:1141 +#: ./docs/11.x/cashier-paddle.md:1141 +#: ./docs/master/cashier-paddle.md:1141 msgid "if ($user->onTrial()) {\n" " // User is within their trial period...\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:886 +#: ./docs/11.x/cashier-paddle.md:886 +#: ./docs/master/cashier-paddle.md:886 +msgid "After a user has subscribed to your application, they may occasionally want to change to a new subscription plan. To update the subscription plan for a user, you should pass the Paddle price's identifier to the subscription's `swap` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 298 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:887 +#: ./docs/9.x/cashier-paddle.md:957 msgid "Once you are ready to create an actual subscription for the user, you may use the `newSubscription` method as usual:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 299 (code) +# CODE +#: ./docs/10.x/cashier-paddle.md:888 +#: ./docs/11.x/cashier-paddle.md:888 +#: ./docs/master/cashier-paddle.md:888 +msgid "use App\\Models\\User;\n\n" +"$user = User::find(1);\n\n" +"$user->subscription()->swap($premium = 'pri_456');" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:889 +#: ./docs/9.x/cashier-paddle.md:959 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/user/subscribe', function (Request $request) {\n" " $payLink = $user->newSubscription('default', $monthly = 12345)\n" " ->returnTo(route('home'))\n" " ->create();\n\n" " return view('billing', ['payLink' => $payLink]);\n" -"});\n" +"});" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:896 +#: ./docs/11.x/cashier-paddle.md:896 +#: ./docs/master/cashier-paddle.md:896 +msgid "$user = User::find(1);\n\n" +"$user->subscription()->swapAndInvoice($premium = 'pri_456');" msgstr "" -#: docs/10.x/cashier-paddle.md:block 300 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:899 +#: ./docs/9.x/cashier-paddle.md:969 msgid "To retrieve the user's trial ending date, you may use the `trialEndsAt` method. This method will return a Carbon date instance if a user is on a trial or `null` if they aren't. You may also pass an optional subscription name parameter if you would like to get the trial ending date for a specific subscription other than the default one:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 301 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:901 +#: ./docs/9.x/cashier-paddle.md:971 msgid "if ($user->onTrial()) {\n" " $trialEndsAt = $user->trialEndsAt('main');\n" -"}\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:905 +#: ./docs/11.x/cashier-paddle.md:905 +#: ./docs/master/cashier-paddle.md:905 +msgid "$user->subscription('default')->noProrate()->swap($premium = 'pri_456');" msgstr "" -#: docs/10.x/cashier-paddle.md:block 302 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:905 +#: ./docs/9.x/cashier-paddle.md:975 +#: ./docs/10.x/cashier-paddle.md:1162 +#: ./docs/11.x/cashier-paddle.md:1162 +#: ./docs/master/cashier-paddle.md:1162 msgid "You may use the `onGenericTrial` method if you wish to know specifically that the user is within their \"generic\" trial period and has not created an actual subscription yet:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 303 (code) +# P +#: ./docs/10.x/cashier-paddle.md:907 +#: ./docs/11.x/cashier-paddle.md:907 +#: ./docs/master/cashier-paddle.md:907 +msgid "If you would like to disable proration and invoice customers immediately, you may use the `swapAndInvoice` method in combination with `noProrate`:" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:907 +#: ./docs/9.x/cashier-paddle.md:977 +#: ./docs/10.x/cashier-paddle.md:1164 +#: ./docs/11.x/cashier-paddle.md:1164 +#: ./docs/master/cashier-paddle.md:1164 msgid "if ($user->onGenericTrial()) {\n" " // User is within their \"generic\" trial period...\n" -"}\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:909 +#: ./docs/11.x/cashier-paddle.md:909 +#: ./docs/master/cashier-paddle.md:909 +msgid "$user->subscription('default')->noProrate()->swapAndInvoice($premium = 'pri_456');" msgstr "" -#: docs/10.x/cashier-paddle.md:block 304 (quote) -msgid "**Warning** There is no way to extend or modify a trial period on a Paddle subscription after it has been created." +# P +#: ./docs/10.x/cashier-paddle.md:911 +#: ./docs/11.x/cashier-paddle.md:911 +#: ./docs/master/cashier-paddle.md:911 +msgid "Or, to not bill your customer for a subscription change, you may utilize the `doNotBill` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 306 (header) +# P +#: ./docs/8.x/cashier-paddle.md:911 +#: ./docs/9.x/cashier-paddle.md:982 +msgid "There is no way to extend or modify a trial period on a Paddle subscription after it has been created." +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:913 +#: ./docs/11.x/cashier-paddle.md:913 +#: ./docs/master/cashier-paddle.md:913 +msgid "$user->subscription('default')->doNotBill()->swap($premium = 'pri_456');" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:913 +#: ./docs/9.x/cashier-paddle.md:984 +#: ./docs/10.x/cashier-paddle.md:1179 +#: ./docs/11.x/cashier-paddle.md:1179 +#: ./docs/master/cashier-paddle.md:1179 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cashier-paddle.md:914 +#: ./docs/9.x/cashier-paddle.md:985 +#: ./docs/10.x/cashier-paddle.md:1180 +#: ./docs/11.x/cashier-paddle.md:1180 +#: ./docs/master/cashier-paddle.md:1180 msgid "Handling Paddle Webhooks" msgstr "" -#: docs/10.x/cashier-paddle.md:block 307 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:915 +#: ./docs/11.x/cashier-paddle.md:915 +#: ./docs/master/cashier-paddle.md:915 +msgid "For more information on Paddle's proration policies, please consult Paddle's [proration documentation](https://developer.paddle.com/concepts/subscriptions/proration)." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:916 +#: ./docs/9.x/cashier-paddle.md:987 +#: ./docs/10.x/cashier-paddle.md:1182 +#: ./docs/11.x/cashier-paddle.md:1182 +#: ./docs/master/cashier-paddle.md:1182 msgid "Paddle can notify your application of a variety of events via webhooks. By default, a route that points to Cashier's webhook controller is registered by the Cashier service provider. This controller will handle all incoming webhook requests." msgstr "" -#: docs/10.x/cashier-paddle.md:block 308 (paragraph) -msgid "By default, this controller will automatically handle cancelling subscriptions that have too many failed charges ([as defined by your Paddle dunning settings](https://vendors.paddle.com/recover-settings#dunning-form-id)), subscription updates, and payment method changes; however, as we'll soon discover, you can extend this controller to handle any Paddle webhook event you like." +# P +#: ./docs/8.x/cashier-paddle.md:918 +msgid "By default, this controller will automatically handle cancelling subscriptions that have too many failed charges ([as defined by your Paddle subscription settings](https://vendors.paddle.com/subscription-settings)), subscription updates, and payment method changes; however, as we'll soon discover, you can extend this controller to handle any Paddle webhook event you like." msgstr "" -#: docs/10.x/cashier-paddle.md:block 309 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:920 +#: ./docs/9.x/cashier-paddle.md:991 +#: ./docs/10.x/cashier-paddle.md:1186 +#: ./docs/11.x/cashier-paddle.md:1186 +#: ./docs/master/cashier-paddle.md:1186 msgid "To ensure your application can handle Paddle webhooks, be sure to [configure the webhook URL in the Paddle control panel](https://vendors.paddle.com/alerts-webhooks). By default, Cashier's webhook controller responds to the `/paddle/webhook` URL path. The full list of all webhooks you should enable in the Paddle control panel are:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 310 (unordered list) +# P +#: ./docs/9.x/cashier-paddle.md:921 +#: ./docs/10.x/cashier-paddle.md:1104 +#: ./docs/11.x/cashier-paddle.md:1104 +#: ./docs/master/cashier-paddle.md:1104 +msgid "To determine if an existing trial has expired, you may use the `hasExpiredTrial` methods:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:922 +#: ./docs/11.x/cashier-paddle.md:922 +#: ./docs/master/cashier-paddle.md:922 +msgid "$user = User::find(1);\n\n" +"$user->subscription()->incrementQuantity();\n\n" +"// Add five to the subscription's current quantity...\n" +"$user->subscription()->incrementQuantity(5);\n\n" +"$user->subscription()->decrementQuantity();\n\n" +"// Subtract five from the subscription's current quantity...\n" +"$user->subscription()->decrementQuantity(5);" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:922 +#: ./docs/9.x/cashier-paddle.md:993 +#: ./docs/10.x/cashier-paddle.md:1191 +#: ./docs/11.x/cashier-paddle.md:1191 +#: ./docs/master/cashier-paddle.md:1191 msgid "Subscription Created" msgstr "" -#: docs/10.x/cashier-paddle.md:block 310 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:923 +#: ./docs/9.x/cashier-paddle.md:994 +#: ./docs/10.x/cashier-paddle.md:1192 +#: ./docs/11.x/cashier-paddle.md:1192 +#: ./docs/master/cashier-paddle.md:1192 msgid "Subscription Updated" msgstr "" -#: docs/10.x/cashier-paddle.md:block 310 (unordered list) +# CODE +#: ./docs/9.x/cashier-paddle.md:923 +msgid "if ($user->hasExpiredTrial('default')) {\n" +" //\n" +"}\n\n" +"if ($user->subscription('default')->hasExpiredTrial()) {\n" +" //\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:924 +#: ./docs/9.x/cashier-paddle.md:995 msgid "Subscription Cancelled" msgstr "" -#: docs/10.x/cashier-paddle.md:block 310 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:925 +#: ./docs/9.x/cashier-paddle.md:996 msgid "Payment Succeeded" msgstr "" -#: docs/10.x/cashier-paddle.md:block 310 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:926 +#: ./docs/9.x/cashier-paddle.md:997 msgid "Subscription Payment Succeeded" msgstr "" -#: docs/10.x/cashier-paddle.md:block 311 (quote) -msgid "**Warning** Make sure you protect incoming requests with Cashier's included [webhook signature verification](/docs/{{version}}/cashier-paddle#verifying-webhook-signatures) middleware." +# P +#: ./docs/8.x/cashier-paddle.md:928 +#: ./docs/9.x/cashier-paddle.md:1000 +#: ./docs/10.x/cashier-paddle.md:1197 +#: ./docs/11.x/cashier-paddle.md:1197 +#: ./docs/master/cashier-paddle.md:1197 +msgid "Make sure you protect incoming requests with Cashier's included [webhook signature verification](/docs/{{version}}/cashier-paddle#verifying-webhook-signatures) middleware." msgstr "" -#: docs/10.x/cashier-paddle.md:block 313 (header) +# P +#: ./docs/8.x/cashier-paddle.md:930 +#: ./docs/9.x/cashier-paddle.md:1002 +#: ./docs/10.x/cashier-paddle.md:1199 +#: ./docs/11.x/cashier-paddle.md:1199 +#: ./docs/master/cashier-paddle.md:1199 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:931 +#: ./docs/9.x/cashier-paddle.md:1003 msgid "Webhooks & CSRF Protection" msgstr "" -#: docs/10.x/cashier-paddle.md:block 314 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:933 +#: ./docs/9.x/cashier-paddle.md:1005 +#: ./docs/10.x/cashier-paddle.md:1202 msgid "Since Paddle webhooks need to bypass Laravel's [CSRF protection](/docs/{{version}}/csrf), be sure to list the URI as an exception in your `App\\Http\\Middleware\\VerifyCsrfToken` middleware or list the route outside of the `web` middleware group:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 315 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:935 +#: ./docs/9.x/cashier-paddle.md:1007 +#: ./docs/10.x/cashier-paddle.md:1204 msgid "protected $except = [\n" " 'paddle/*',\n" -"];\n" +"];" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:936 +#: ./docs/11.x/cashier-paddle.md:936 +#: ./docs/master/cashier-paddle.md:936 +msgid "$user->subscription()->updateQuantity(10);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 317 (header) +# P +#: ./docs/8.x/cashier-paddle.md:939 +#: ./docs/9.x/cashier-paddle.md:1011 +#: ./docs/10.x/cashier-paddle.md:1208 +#: ./docs/11.x/cashier-paddle.md:1210 +#: ./docs/master/cashier-paddle.md:1210 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:940 +#: ./docs/11.x/cashier-paddle.md:940 +#: ./docs/master/cashier-paddle.md:940 +msgid "$user->subscription()->noProrate()->updateQuantity(10);" +msgstr "" + +# H4 +#: ./docs/8.x/cashier-paddle.md:940 +#: ./docs/9.x/cashier-paddle.md:1012 msgid "Webhooks & Local Development" msgstr "" -#: docs/10.x/cashier-paddle.md:block 318 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:942 +#: ./docs/11.x/cashier-paddle.md:942 +#: ./docs/master/cashier-paddle.md:942 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:942 +#: ./docs/9.x/cashier-paddle.md:1014 +#: ./docs/10.x/cashier-paddle.md:1211 +#: ./docs/11.x/cashier-paddle.md:1213 +#: ./docs/master/cashier-paddle.md:1213 msgid "For Paddle to be able to send your application webhooks during local development, you will need to expose your application via a site sharing service such as [Ngrok](https://ngrok.com/) or [Expose](https://expose.dev/docs/introduction). If you are developing your application locally using [Laravel Sail](/docs/{{version}}/sail), you may use Sail's [site sharing command](/docs/{{version}}/sail#sharing-your-site)." msgstr "" -#: docs/10.x/cashier-paddle.md:block 320 (header) -msgid "Defining Webhook Event Handlers" +# H4 +#: ./docs/10.x/cashier-paddle.md:943 +#: ./docs/11.x/cashier-paddle.md:943 +#: ./docs/master/cashier-paddle.md:943 +msgid "Quantities for Subscriptions With Multiple Products" msgstr "" -#: docs/10.x/cashier-paddle.md:block 321 (paragraph) -msgid "Cashier automatically handles subscription cancellation on failed charges and other common Paddle webhooks. However, if you have additional webhook events you would like to handle, you may do so by listening to the following events that are dispatched by Cashier:" +# P +#: ./docs/8.x/cashier-paddle.md:944 +#: ./docs/9.x/cashier-paddle.md:1016 +#: ./docs/10.x/cashier-paddle.md:1213 +#: ./docs/11.x/cashier-paddle.md:1215 +#: ./docs/master/cashier-paddle.md:1215 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:945 +#: ./docs/11.x/cashier-paddle.md:945 +#: ./docs/master/cashier-paddle.md:945 +msgid "If your subscription is a [subscription with multiple products](#subscriptions-with-multiple-products), you should pass the ID of the price whose quantity you wish to increment or decrement as the second argument to the increment / decrement methods:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 322 (unordered list) -msgid "`Laravel\\Paddle\\Events\\WebhookReceived`" +# H3 +#: ./docs/8.x/cashier-paddle.md:945 +#: ./docs/9.x/cashier-paddle.md:1017 +#: ./docs/10.x/cashier-paddle.md:1214 +#: ./docs/11.x/cashier-paddle.md:1216 +#: ./docs/master/cashier-paddle.md:1216 +msgid "Defining Webhook Event Handlers" msgstr "" -#: docs/10.x/cashier-paddle.md:block 322 (unordered list) -msgid "`Laravel\\Paddle\\Events\\WebhookHandled`" +# CODE +#: ./docs/10.x/cashier-paddle.md:947 +#: ./docs/11.x/cashier-paddle.md:947 +#: ./docs/master/cashier-paddle.md:947 +msgid "$user->subscription()->incrementQuantity(1, 'price_chat');" msgstr "" -#: docs/10.x/cashier-paddle.md:block 323 (paragraph) -msgid "Both events contain the full payload of the Paddle webhook. For example, if you wish to handle the `invoice.payment_succeeded` webhook, you may register a [listener](/docs/{{version}}/events#defining-listeners) that will handle the event:" +# P +#: ./docs/8.x/cashier-paddle.md:947 +#: ./docs/9.x/cashier-paddle.md:1019 +msgid "Cashier automatically handles subscription cancellation on failed charges and other common Paddle webhooks. However, if you have additional webhook events you would like to handle, you may do so by listening to the following events that are dispatched by Cashier:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 324 (code) +# P +#: ./docs/10.x/cashier-paddle.md:949 +#: ./docs/11.x/cashier-paddle.md:949 +#: ./docs/master/cashier-paddle.md:949 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:949 +#: ./docs/9.x/cashier-paddle.md:1021 +#: ./docs/10.x/cashier-paddle.md:1218 +#: ./docs/11.x/cashier-paddle.md:1220 +#: ./docs/master/cashier-paddle.md:1220 +msgid "`Laravel\\Paddle\\Events\\WebhookReceived`" +msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:950 +#: ./docs/11.x/cashier-paddle.md:950 +#: ./docs/master/cashier-paddle.md:950 +msgid "Subscriptions With Multiple Products" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:950 +#: ./docs/9.x/cashier-paddle.md:1022 +#: ./docs/10.x/cashier-paddle.md:1219 +#: ./docs/11.x/cashier-paddle.md:1221 +#: ./docs/master/cashier-paddle.md:1221 +msgid "`Laravel\\Paddle\\Events\\WebhookHandled`" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:952 +#: ./docs/11.x/cashier-paddle.md:952 +#: ./docs/master/cashier-paddle.md:952 +msgid "[Subscription with multiple products](https://developer.paddle.com/build/subscriptions/add-remove-products-prices-addons) allow you to assign multiple billing products to a single subscription. For example, imagine you are building a customer service \"helpdesk\" application that has a base subscription price of $10 per month but offers a live chat add-on product for an additional $15 per month." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:952 +#: ./docs/9.x/cashier-paddle.md:1024 +msgid "Both events contain the full payload of the Paddle webhook. For example, if you wish to handle the `invoice.payment_succeeded` webhook, you may register a [listener](/docs/{{version}}/events#defining-listeners) that will handle the event:" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:954 +#: ./docs/11.x/cashier-paddle.md:954 +#: ./docs/master/cashier-paddle.md:954 +msgid "When creating subscription checkout sessions, you may specify multiple products for a given subscription by passing an array of prices as the first argument to the `subscribe` method:" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:954 +#: ./docs/9.x/cashier-paddle.md:1026 msgid "payload['alert_name'] === 'payment_succeeded') {\n" " // Handle the incoming event...\n" " }\n" " }\n" -"}\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:956 +#: ./docs/11.x/cashier-paddle.md:956 +#: ./docs/master/cashier-paddle.md:956 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::post('/user/subscribe', function (Request $request) {\n" +" $checkout = $request->user()->subscribe([\n" +" 'price_monthly',\n" +" 'price_chat',\n" +" ]);\n\n" +" return view('billing', ['checkout' => $checkout]);\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:967 +#: ./docs/11.x/cashier-paddle.md:967 +#: ./docs/master/cashier-paddle.md:967 +msgid "In the example above, the customer will have two prices attached to their `default` subscription. Both prices will be charged on their respective billing intervals. If necessary, you may pass an associative array of key / value pairs to indicate a specific quantity for each price:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:969 +#: ./docs/11.x/cashier-paddle.md:969 +#: ./docs/master/cashier-paddle.md:969 +msgid "$user = User::find(1);\n\n" +"$checkout = $user->subscribe('default', ['price_monthly', 'price_chat' => 5]);" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:973 +#: ./docs/11.x/cashier-paddle.md:973 +#: ./docs/master/cashier-paddle.md:973 +msgid "If you would like to add another price to an existing subscription, you must use the subscription's `swap` method. When invoking the `swap` method, you should also include the subscription's current prices and quantities as well:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 325 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:975 +#: ./docs/11.x/cashier-paddle.md:975 +#: ./docs/master/cashier-paddle.md:975 +msgid "$user = User::find(1);\n\n" +"$user->subscription()->swap(['price_chat', 'price_original' => 2]);" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:976 +#: ./docs/9.x/cashier-paddle.md:1048 +#: ./docs/10.x/cashier-paddle.md:1242 msgid "Once your listener has been defined, you may register it within your application's `EventServiceProvider`:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 326 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:978 +#: ./docs/9.x/cashier-paddle.md:1050 +#: ./docs/9.x/cashier-paddle.md:1262 +#: ./docs/10.x/cashier-paddle.md:1244 msgid "subscription()->swapAndInvoice(['price_chat', 'price_original' => 2]);" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:983 +#: ./docs/11.x/cashier-paddle.md:983 +#: ./docs/master/cashier-paddle.md:983 +msgid "You may remove prices from subscriptions using the `swap` method and omitting the price you want to remove:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:985 +#: ./docs/11.x/cashier-paddle.md:985 +#: ./docs/master/cashier-paddle.md:985 +msgid "$user->subscription()->swap(['price_original' => 2]);" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:988 +#: ./docs/11.x/cashier-paddle.md:988 +#: ./docs/master/cashier-paddle.md:988 +msgid "You may not remove the last price on a subscription. Instead, you should simply cancel the subscription." msgstr "" -#: docs/10.x/cashier-paddle.md:block 327 (paragraph) +# P +#: ./docs/9.x/cashier-paddle.md:989 +msgid "By default, this controller will automatically handle cancelling subscriptions that have too many failed charges ([as defined by your Paddle dunning settings](https://vendors.paddle.com/recover-settings#dunning-form-id)), subscription updates, and payment method changes; however, as we'll soon discover, you can extend this controller to handle any Paddle webhook event you like." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:995 +#: ./docs/11.x/cashier-paddle.md:995 +#: ./docs/master/cashier-paddle.md:995 +msgid "When your application creates subscriptions, you may provide the type of the subscription to the `subscribe` method as the second argument. The type may be any string that represents the type of subscription the user is initiating:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:995 +#: ./docs/9.x/cashier-paddle.md:1067 +#: ./docs/10.x/cashier-paddle.md:1261 +#: ./docs/11.x/cashier-paddle.md:1244 +#: ./docs/master/cashier-paddle.md:1244 msgid "Cashier also emit events dedicated to the type of the received webhook. In addition to the full payload from Paddle, they also contain the relevant models that were used to process the webhook such as the billable model, the subscription, or the receipt:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 329 (unordered list) +# CODE +#: ./docs/10.x/cashier-paddle.md:997 +#: ./docs/11.x/cashier-paddle.md:997 +#: ./docs/master/cashier-paddle.md:997 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::post('/swimming/subscribe', function (Request $request) {\n" +" $checkout = $request->user()->subscribe($swimmingMonthly = 'pri_123', 'swimming');\n\n" +" return view('billing', ['checkout' => $checkout]);\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:999 +#: ./docs/9.x/cashier-paddle.md:1071 msgid "`Laravel\\Paddle\\Events\\PaymentSucceeded`" msgstr "" -#: docs/10.x/cashier-paddle.md:block 329 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:1000 +#: ./docs/9.x/cashier-paddle.md:1072 msgid "`Laravel\\Paddle\\Events\\SubscriptionPaymentSucceeded`" msgstr "" -#: docs/10.x/cashier-paddle.md:block 329 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:1001 +#: ./docs/9.x/cashier-paddle.md:1073 +#: ./docs/10.x/cashier-paddle.md:1268 +#: ./docs/11.x/cashier-paddle.md:1251 +#: ./docs/master/cashier-paddle.md:1251 msgid "`Laravel\\Paddle\\Events\\SubscriptionCreated`" msgstr "" -#: docs/10.x/cashier-paddle.md:block 329 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:1002 +#: ./docs/9.x/cashier-paddle.md:1074 +#: ./docs/10.x/cashier-paddle.md:1269 +#: ./docs/11.x/cashier-paddle.md:1252 +#: ./docs/master/cashier-paddle.md:1252 msgid "`Laravel\\Paddle\\Events\\SubscriptionUpdated`" msgstr "" -#: docs/10.x/cashier-paddle.md:block 329 (unordered list) +# P +#: ./docs/8.x/cashier-paddle.md:1003 +#: ./docs/9.x/cashier-paddle.md:1075 msgid "`Laravel\\Paddle\\Events\\SubscriptionCancelled`" msgstr "" -#: docs/10.x/cashier-paddle.md:block 331 (paragraph) -msgid "You can also override the default, built-in webhook route by defining the `CASHIER_WEBHOOK` environment variable in your application's `.env` file. This value should be the full URL to your webhook route and needs to match the URL set in your Paddle control panel:" +# CODE +#: ./docs/10.x/cashier-paddle.md:1007 +#: ./docs/11.x/cashier-paddle.md:1007 +#: ./docs/master/cashier-paddle.md:1007 +msgid "$user->subscription('swimming')->swap($swimmingYearly = 'pri_456');" msgstr "" -#: docs/10.x/cashier-paddle.md:block 332 (code) -msgid "CASHIER_WEBHOOK=https://example.com/my-paddle-webhook-url\n" +# P +#: ./docs/8.x/cashier-paddle.md:1007 +#: ./docs/9.x/cashier-paddle.md:1079 +#: ./docs/10.x/cashier-paddle.md:1275 +#: ./docs/11.x/cashier-paddle.md:1258 +#: ./docs/master/cashier-paddle.md:1258 +msgid "You can also override the default, built-in webhook route by defining the `CASHIER_WEBHOOK` environment variable in your application's `.env` file. This value should be the full URL to your webhook route and needs to match the URL set in your Paddle control panel:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 334 (header) +# CODE: bash +# CODE: ini +#: ./docs/8.x/cashier-paddle.md:1009 +#: ./docs/9.x/cashier-paddle.md:1081 +#: ./docs/10.x/cashier-paddle.md:1277 +#: ./docs/11.x/cashier-paddle.md:1260 +#: ./docs/master/cashier-paddle.md:1260 +msgid "CASHIER_WEBHOOK=https://example.com/my-paddle-webhook-url" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1013 +#: ./docs/9.x/cashier-paddle.md:1085 +#: ./docs/10.x/cashier-paddle.md:1281 +#: ./docs/11.x/cashier-paddle.md:1264 +#: ./docs/master/cashier-paddle.md:1264 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:1014 +#: ./docs/9.x/cashier-paddle.md:1086 +#: ./docs/10.x/cashier-paddle.md:1282 +#: ./docs/11.x/cashier-paddle.md:1265 +#: ./docs/master/cashier-paddle.md:1265 msgid "Verifying Webhook Signatures" msgstr "" -#: docs/10.x/cashier-paddle.md:block 335 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:1016 +#: ./docs/9.x/cashier-paddle.md:1088 +#: ./docs/10.x/cashier-paddle.md:1284 +#: ./docs/11.x/cashier-paddle.md:1267 +#: ./docs/master/cashier-paddle.md:1267 msgid "To secure your webhooks, you may use [Paddle's webhook signatures](https://developer.paddle.com/webhook-reference/verifying-webhooks). For convenience, Cashier automatically includes a middleware which validates that the incoming Paddle webhook request is valid." msgstr "" -#: docs/10.x/cashier-paddle.md:block 336 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:1018 +#: ./docs/11.x/cashier-paddle.md:1018 +#: ./docs/master/cashier-paddle.md:1018 +msgid "$user->subscription()->pause();" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1018 +#: ./docs/9.x/cashier-paddle.md:1090 msgid "To enable webhook verification, ensure that the `PADDLE_PUBLIC_KEY` environment variable is defined in your application's `.env` file. The public key may be retrieved from your Paddle account dashboard." msgstr "" -#: docs/10.x/cashier-paddle.md:block 338 (header) +# P +#: ./docs/10.x/cashier-paddle.md:1020 +#: ./docs/11.x/cashier-paddle.md:1020 +#: ./docs/master/cashier-paddle.md:1020 +msgid "When a subscription is paused, Cashier will automatically set the `paused_at` column in your database. This column is used to determine when the `paused` method should begin returning `true`. For example, if a customer pauses a subscription on March 1st, but the subscription was not scheduled to recur until March 5th, the `paused` method will continue to return `false` until March 5th. This is because a user is typically allowed to continue using an application until the end of their billing cycle." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1020 +#: ./docs/9.x/cashier-paddle.md:1092 +#: ./docs/10.x/cashier-paddle.md:1288 +#: ./docs/11.x/cashier-paddle.md:1271 +#: ./docs/master/cashier-paddle.md:1271 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cashier-paddle.md:1021 +#: ./docs/9.x/cashier-paddle.md:1093 +#: ./docs/10.x/cashier-paddle.md:1289 +#: ./docs/11.x/cashier-paddle.md:1272 +#: ./docs/master/cashier-paddle.md:1272 msgid "Single Charges" msgstr "" -#: docs/10.x/cashier-paddle.md:block 340 (header) +# P +#: ./docs/10.x/cashier-paddle.md:1022 +#: ./docs/11.x/cashier-paddle.md:1022 +#: ./docs/master/cashier-paddle.md:1022 +msgid "By default, pausing happens at the next billing interval so the customer can use the remainder of the period they paid for. If you want to pause a subscription immediately, you may use the `pauseNow` method:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1023 +#: ./docs/9.x/cashier-paddle.md:1095 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:1024 +#: ./docs/11.x/cashier-paddle.md:1024 +#: ./docs/master/cashier-paddle.md:1024 +msgid "$user->subscription()->pauseNow();" +msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:1024 +#: ./docs/9.x/cashier-paddle.md:1096 msgid "Simple Charge" msgstr "" -#: docs/10.x/cashier-paddle.md:block 341 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:1026 +#: ./docs/11.x/cashier-paddle.md:1026 +#: ./docs/master/cashier-paddle.md:1026 +msgid "Using the `pauseUntil` method, you can pause the subscription until a specific moment in time:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1026 +#: ./docs/9.x/cashier-paddle.md:1098 msgid "If you would like to make a one-time charge against a customer, you may use the `charge` method on a billable model instance to generate a pay link for the charge. The `charge` method accepts the charge amount (float) as its first argument and a charge description as its second argument:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 342 (code) +# CODE +#: ./docs/10.x/cashier-paddle.md:1028 +#: ./docs/11.x/cashier-paddle.md:1028 +#: ./docs/master/cashier-paddle.md:1028 +msgid "$user->subscription()->pauseUntil(now()->addMonth());" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:1028 +#: ./docs/9.x/cashier-paddle.md:1100 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/store', function (Request $request) {\n" " return view('store', [\n" " 'payLink' => $user->charge(12.99, 'Action Figure')\n" " ]);\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1030 +#: ./docs/11.x/cashier-paddle.md:1030 +#: ./docs/master/cashier-paddle.md:1030 +msgid "Or, you may use the `pauseNowUntil` method to immediately pause the subscription until a given point in time:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 343 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:1032 +#: ./docs/11.x/cashier-paddle.md:1032 +#: ./docs/master/cashier-paddle.md:1032 +msgid "$user->subscription()->pauseNowUntil(now()->addMonth());" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:1036 +#: ./docs/11.x/cashier-paddle.md:1036 +#: ./docs/master/cashier-paddle.md:1036 +msgid "if ($user->subscription()->onPausedGracePeriod()) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1036 +#: ./docs/9.x/cashier-paddle.md:1108 msgid "After generating the pay link, you may use Cashier's provided `paddle-button` Blade component to allow the user to initiate the Paddle widget and complete the charge:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 344 (code) +# CODE: html +# CODE: blade +#: ./docs/8.x/cashier-paddle.md:1038 +#: ./docs/8.x/cashier-paddle.md:1078 +#: ./docs/9.x/cashier-paddle.md:1110 +#: ./docs/9.x/cashier-paddle.md:1150 msgid "\n" " Buy\n" -"\n" +"" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1040 +#: ./docs/11.x/cashier-paddle.md:1040 +#: ./docs/master/cashier-paddle.md:1040 +msgid "To resume a paused subscription, you may invoke the `resume` method on the subscription:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 345 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:1042 +#: ./docs/11.x/cashier-paddle.md:1042 +#: ./docs/master/cashier-paddle.md:1042 +msgid "$user->subscription()->resume();" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1044 +#: ./docs/9.x/cashier-paddle.md:1116 msgid "The `charge` method accepts an array as its third argument, allowing you to pass any options you wish to the underlying Paddle pay link creation. Please consult [the Paddle documentation](https://developer.paddle.com/api-reference/product-api/pay-links/createpaylink) to learn more about the options available to you when creating charges:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 346 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:1046 +#: ./docs/9.x/cashier-paddle.md:1118 msgid "$payLink = $user->charge(12.99, 'Action Figure', [\n" " 'custom_option' => $value,\n" -"]);\n" +"]);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 347 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:1047 +#: ./docs/11.x/cashier-paddle.md:1047 +#: ./docs/master/cashier-paddle.md:1047 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:1048 +#: ./docs/11.x/cashier-paddle.md:1048 +#: ./docs/master/cashier-paddle.md:1048 +msgid "Canceling Subscriptions" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1050 +#: ./docs/9.x/cashier-paddle.md:1122 msgid "Charges happen in the currency specified in the `cashier.currency` configuration option. By default, this is set to USD. You may override the default currency by defining the `CASHIER_CURRENCY` environment variable in your application's `.env` file:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 349 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:1052 +#: ./docs/11.x/cashier-paddle.md:1052 +#: ./docs/master/cashier-paddle.md:1052 +msgid "$user->subscription()->cancel();" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1054 +#: ./docs/11.x/cashier-paddle.md:1054 +#: ./docs/master/cashier-paddle.md:1054 +msgid "When a subscription is canceled, Cashier will automatically set the `ends_at` column in your database. This column is used to determine when the `subscribed` method should begin returning `false`. For example, if a customer cancels a subscription on March 1st, but the subscription was not scheduled to end until March 5th, the `subscribed` method will continue to return `true` until March 5th. This is done because a user is typically allowed to continue using an application until the end of their billing cycle." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1056 +#: ./docs/11.x/cashier-paddle.md:1056 +#: ./docs/master/cashier-paddle.md:1056 +msgid "You may determine if a user has canceled their subscription but are still on their \"grace period\" using the `onGracePeriod` method:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1056 +#: ./docs/9.x/cashier-paddle.md:1128 msgid "You can also [override prices per currency](https://developer.paddle.com/api-reference/product-api/pay-links/createpaylink#price-overrides) using Paddle's dynamic pricing matching system. To do so, pass an array of prices instead of a fixed amount:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 350 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:1058 +#: ./docs/9.x/cashier-paddle.md:1130 msgid "$payLink = $user->charge([\n" " 'USD:19.99',\n" " 'EUR:15.99',\n" -"], 'Action Figure');\n" +"], 'Action Figure');" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1062 +#: ./docs/11.x/cashier-paddle.md:1062 +#: ./docs/master/cashier-paddle.md:1062 +msgid "If you wish to cancel a subscription immediately, you may call the `cancelNow` method on the subscription:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1063 +#: ./docs/9.x/cashier-paddle.md:1135 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:1064 +#: ./docs/11.x/cashier-paddle.md:1064 +#: ./docs/master/cashier-paddle.md:1064 +msgid "$user->subscription()->cancelNow();" msgstr "" -#: docs/10.x/cashier-paddle.md:block 352 (header) +# H3 +#: ./docs/8.x/cashier-paddle.md:1064 +#: ./docs/9.x/cashier-paddle.md:1136 msgid "Charging Products" msgstr "" -#: docs/10.x/cashier-paddle.md:block 353 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:1066 +#: ./docs/11.x/cashier-paddle.md:1066 +#: ./docs/master/cashier-paddle.md:1066 +msgid "To stop a subscription on its grace period from canceling, you may invoke the `stopCancelation` method:" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1066 +#: ./docs/9.x/cashier-paddle.md:1138 msgid "If you would like to make a one-time charge against a specific product configured within Paddle, you may use the `chargeProduct` method on a billable model instance to generate a pay link:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 354 (code) +# CODE +#: ./docs/10.x/cashier-paddle.md:1068 +#: ./docs/11.x/cashier-paddle.md:1068 +#: ./docs/master/cashier-paddle.md:1068 +msgid "$user->subscription()->stopCancelation();" +msgstr "" + +# CODE +#: ./docs/8.x/cashier-paddle.md:1068 +#: ./docs/9.x/cashier-paddle.md:1140 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/store', function (Request $request) {\n" " return view('store', [\n" " 'payLink' => $request->user()->chargeProduct($productId = 123)\n" " ]);\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1071 +#: ./docs/11.x/cashier-paddle.md:1071 +#: ./docs/master/cashier-paddle.md:1071 +msgid "Paddle's subscriptions cannot be resumed after cancelation. If your customer wishes to resume their subscription, they will have to create a new subscription." msgstr "" -#: docs/10.x/cashier-paddle.md:block 355 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:1076 +#: ./docs/9.x/cashier-paddle.md:1148 msgid "Then, you may provide the pay link to the `paddle-button` component to allow the user to initialize the Paddle widget:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 357 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:1079 +#: ./docs/11.x/cashier-paddle.md:1079 +#: ./docs/master/cashier-paddle.md:1079 +msgid "If you would like to offer trial periods to your customers while still collecting payment method information up front, you should use set a trial time in the Paddle dashboard on the price your customer is subscribing to. Then, initiate the checkout session as normal:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:1081 +#: ./docs/11.x/cashier-paddle.md:1081 +#: ./docs/master/cashier-paddle.md:1081 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/user/subscribe', function (Request $request) {\n" +" $checkout = $request->user()->subscribe('pri_monthly')\n" +" ->returnTo(route('home'));\n\n" +" return view('billing', ['checkout' => $checkout]);\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1084 +#: ./docs/9.x/cashier-paddle.md:1156 msgid "The `chargeProduct` method accepts an array as its second argument, allowing you to pass any options you wish to the underlying Paddle pay link creation. Please consult [the Paddle documentation](https://developer.paddle.com/api-reference/product-api/pay-links/createpaylink) regarding the options that are available to you when creating charges:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 358 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:1086 +#: ./docs/9.x/cashier-paddle.md:1158 msgid "$payLink = $user->chargeProduct($productId, [\n" " 'custom_option' => $value,\n" -"]);\n" +"]);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 360 (header) +# P +#: ./docs/10.x/cashier-paddle.md:1090 +#: ./docs/11.x/cashier-paddle.md:1090 +#: ./docs/master/cashier-paddle.md:1090 +msgid "When your application receives the `subscription_created` event, Cashier will set the trial period ending date on the subscription record within your application's database as well as instruct Paddle to not begin billing the customer until after this date." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1090 +#: ./docs/9.x/cashier-paddle.md:1162 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:1091 +#: ./docs/9.x/cashier-paddle.md:1163 msgid "Refunding Orders" msgstr "" -#: docs/10.x/cashier-paddle.md:block 361 (paragraph) +# P +#: ./docs/10.x/cashier-paddle.md:1093 +#: ./docs/11.x/cashier-paddle.md:1093 +#: ./docs/master/cashier-paddle.md:1093 +msgid "If the customer's subscription is not canceled before the trial ending date they will be charged as soon as the trial expires, so you should be sure to notify your users of their trial ending date." +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1093 +#: ./docs/9.x/cashier-paddle.md:1165 msgid "If you need to refund a Paddle order, you may use the `refund` method. This method accepts the Paddle order ID as its first argument. You may retrieve the receipts for a given billable model using the `receipts` method:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 362 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:1095 +#: ./docs/9.x/cashier-paddle.md:1167 msgid "use App\\Models\\User;\n\n" "$user = User::find(1);\n\n" "$receipt = $user->receipts()->first();\n\n" -"$refundRequestId = $user->refund($receipt->order_id);\n" +"$refundRequestId = $user->refund($receipt->order_id);" msgstr "" -#: docs/10.x/cashier-paddle.md:block 363 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:1097 +#: ./docs/11.x/cashier-paddle.md:1097 +#: ./docs/master/cashier-paddle.md:1097 +msgid "if ($user->onTrial()) {\n" +" // ...\n" +"}\n\n" +"if ($user->subscription()->onTrial()) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1103 +#: ./docs/9.x/cashier-paddle.md:1175 msgid "You may optionally specify a specific amount to refund as well as a reason for the refund:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 364 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:1105 +#: ./docs/9.x/cashier-paddle.md:1177 msgid "$receipt = $user->receipts()->first();\n\n" "$refundRequestId = $user->refund(\n" " $receipt->order_id, 5.00, 'Unused product time'\n" -");\n" +");" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:1106 +#: ./docs/11.x/cashier-paddle.md:1106 +#: ./docs/master/cashier-paddle.md:1106 +msgid "if ($user->hasExpiredTrial()) {\n" +" // ...\n" +"}\n\n" +"if ($user->subscription()->hasExpiredTrial()) {\n" +" // ...\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 365 (quote) -msgid "**Note** You can use the `$refundRequestId` as a reference for the refund when contacting Paddle support." +# P +#: ./docs/8.x/cashier-paddle.md:1111 +#: ./docs/9.x/cashier-paddle.md:1184 +msgid "You can use the `$refundRequestId` as a reference for the refund when contacting Paddle support." msgstr "" -#: docs/10.x/cashier-paddle.md:block 367 (header) +# P +#: ./docs/8.x/cashier-paddle.md:1113 +#: ./docs/9.x/cashier-paddle.md:1186 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1114 +#: ./docs/11.x/cashier-paddle.md:1114 +#: ./docs/master/cashier-paddle.md:1114 +msgid "To determine if a user is on trial for a specific subscription type, you may provide the type to the `onTrial` or `hasExpiredTrial` methods:" +msgstr "" + +# H2 +#: ./docs/8.x/cashier-paddle.md:1114 +#: ./docs/9.x/cashier-paddle.md:1187 msgid "Receipts" msgstr "" -#: docs/10.x/cashier-paddle.md:block 368 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:1116 +#: ./docs/11.x/cashier-paddle.md:1116 +#: ./docs/master/cashier-paddle.md:1116 +msgid "if ($user->onTrial('default')) {\n" +" // ...\n" +"}\n\n" +"if ($user->hasExpiredTrial('default')) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1116 +#: ./docs/9.x/cashier-paddle.md:1189 msgid "You may easily retrieve an array of a billable model's receipts via the `receipts` property:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 369 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:1118 +#: ./docs/9.x/cashier-paddle.md:1191 msgid "use App\\Models\\User;\n\n" "$user = User::find(1);\n\n" -"$receipts = $user->receipts;\n" +"$receipts = $user->receipts;" msgstr "" -#: docs/10.x/cashier-paddle.md:block 370 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:1124 +#: ./docs/9.x/cashier-paddle.md:1197 msgid "When listing the receipts for the customer, you may use the receipt instance's methods to display the relevant receipt information. For example, you may wish to list every receipt in a table, allowing the user to easily download any of the receipts:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 371 (code) +# CODE: html +#: ./docs/8.x/cashier-paddle.md:1126 +#: ./docs/9.x/cashier-paddle.md:1199 msgid "\n" " @foreach ($receipts as $receipt)\n" " \n" @@ -1752,432 +5465,708 @@ msgid "
    \n" " \n" " \n" " @endforeach\n" -"
    receipt_url }}\" target=\"_blank\">Download
    \n" +"" msgstr "" -#: docs/10.x/cashier-paddle.md:block 373 (header) +# P +#: ./docs/8.x/cashier-paddle.md:1138 +#: ./docs/9.x/cashier-paddle.md:1211 +#: ./docs/10.x/cashier-paddle.md:1398 +#: ./docs/11.x/cashier-paddle.md:1381 +#: ./docs/master/cashier-paddle.md:1381 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/cashier-paddle.md:1139 +#: ./docs/9.x/cashier-paddle.md:1212 msgid "Past & Upcoming Payments" msgstr "" -#: docs/10.x/cashier-paddle.md:block 374 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:1141 +#: ./docs/9.x/cashier-paddle.md:1214 +#: ./docs/10.x/cashier-paddle.md:1401 +#: ./docs/11.x/cashier-paddle.md:1384 +#: ./docs/master/cashier-paddle.md:1384 msgid "You may use the `lastPayment` and `nextPayment` methods to retrieve and display a customer's past or upcoming payments for recurring subscriptions:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 375 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:1143 +#: ./docs/9.x/cashier-paddle.md:1216 msgid "use App\\Models\\User;\n\n" "$user = User::find(1);\n\n" "$subscription = $user->subscription('default');\n\n" "$lastPayment = $subscription->lastPayment();\n" -"$nextPayment = $subscription->nextPayment();\n" +"$nextPayment = $subscription->nextPayment();" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1145 +#: ./docs/11.x/cashier-paddle.md:1145 +#: ./docs/master/cashier-paddle.md:1145 +msgid "Once you are ready to create an actual subscription for the user, you may use the `subscribe` method as usual:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 376 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:1147 +#: ./docs/11.x/cashier-paddle.md:1147 +#: ./docs/master/cashier-paddle.md:1147 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/user/subscribe', function (Request $request) {\n" +" $checkout = $user->subscribe('pri_monthly')\n" +" ->returnTo(route('home'));\n\n" +" return view('billing', ['checkout' => $checkout]);\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1152 +#: ./docs/9.x/cashier-paddle.md:1225 msgid "Both of these methods will return an instance of `Laravel\\Paddle\\Payment`; however, `nextPayment` will return `null` when the billing cycle has ended (such as when a subscription has been cancelled):" msgstr "" -#: docs/10.x/cashier-paddle.md:block 377 (code) -msgid "Next payment: {{ $nextPayment->amount() }} due on {{ $nextPayment->date()->format('d/m/Y') }}\n" +# CODE +# CODE: blade +#: ./docs/8.x/cashier-paddle.md:1154 +#: ./docs/9.x/cashier-paddle.md:1227 +#: ./docs/10.x/cashier-paddle.md:1414 +#: ./docs/11.x/cashier-paddle.md:1397 +#: ./docs/master/cashier-paddle.md:1397 +msgid "Next payment: {{ $nextPayment->amount() }} due on {{ $nextPayment->date()->format('d/m/Y') }}" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1156 +#: ./docs/11.x/cashier-paddle.md:1156 +#: ./docs/master/cashier-paddle.md:1156 +msgid "To retrieve the user's trial ending date, you may use the `trialEndsAt` method. This method will return a Carbon date instance if a user is on a trial or `null` if they aren't. You may also pass an optional subscription type parameter if you would like to get the trial ending date for a specific subscription other than the default one:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 379 (header) +# P +#: ./docs/8.x/cashier-paddle.md:1156 +#: ./docs/9.x/cashier-paddle.md:1231 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/cashier-paddle.md:1157 +#: ./docs/9.x/cashier-paddle.md:1232 msgid "Handling Failed Payments" msgstr "" -#: docs/10.x/cashier-paddle.md:block 380 (paragraph) +# CODE +#: ./docs/10.x/cashier-paddle.md:1158 +#: ./docs/11.x/cashier-paddle.md:1158 +#: ./docs/master/cashier-paddle.md:1158 +msgid "if ($user->onTrial('default')) {\n" +" $trialEndsAt = $user->trialEndsAt();\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1159 +#: ./docs/9.x/cashier-paddle.md:1234 msgid "Subscription payments fail for various reasons, such as expired cards or a card having insufficient funds. When this happens, we recommend that you let Paddle handle payment failures for you. Specifically, you may [setup Paddle's automatic billing emails](https://vendors.paddle.com/subscription-settings) in your Paddle dashboard." msgstr "" -#: docs/10.x/cashier-paddle.md:block 381 (paragraph) -msgid "Alternatively, you can perform more precise customization by [listening](/docs/{{version}}/events) for the `subscription_payment_failed` Paddle event via the `WebhookReceived` event dispatched by Cashier. You should also ensure the \"Subscription Payment Failed\" option is enabled in the Webhook settings of your Paddle dashboard:" +# P +#: ./docs/8.x/cashier-paddle.md:1161 +msgid "Alternatively, you can perform more precise customization by catching the [`subscription_payment_failed`](https://developer.paddle.com/webhook-reference/subscription-alerts/subscription-payment-failed) webhook and enabling the \"Subscription Payment Failed\" option in the Webhook settings of your Paddle dashboard:" msgstr "" -#: docs/10.x/cashier-paddle.md:block 382 (code) +# CODE +#: ./docs/8.x/cashier-paddle.md:1163 msgid "payload['alert_name'] === 'subscription_payment_failed') {\n" -" // Handle the failed subscription payment...\n" -" }\n" +" // Handle the failed subscription payment...\n" " }\n" -"}\n" +"}" msgstr "" -#: docs/10.x/cashier-paddle.md:block 383 (paragraph) -msgid "Once your listener has been defined, you should register it within your application's `EventServiceProvider`:" +# P +#: ./docs/10.x/cashier-paddle.md:1168 +#: ./docs/11.x/cashier-paddle.md:1168 +#: ./docs/master/cashier-paddle.md:1168 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:1169 +#: ./docs/11.x/cashier-paddle.md:1169 +#: ./docs/master/cashier-paddle.md:1169 +msgid "Extend or Activate a Trial" msgstr "" -#: docs/10.x/cashier-paddle.md:block 386 (header) +# P +#: ./docs/10.x/cashier-paddle.md:1171 +#: ./docs/11.x/cashier-paddle.md:1171 +#: ./docs/master/cashier-paddle.md:1171 +msgid "You can extend an existing trial period on a subscription by invoking the `extendTrial` method and specifying the moment in time that the trial should end:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:1173 +#: ./docs/master/cashier-paddle.md:1173 +msgid "$user->subsription()->extendTrial(now()->addDays(5));" +msgstr "" + +# CODE +#: ./docs/11.x/cashier-paddle.md:1173 +msgid "$user->subscription()->extendTrial(now()->addDays(5));" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1175 +#: ./docs/11.x/cashier-paddle.md:1175 +#: ./docs/master/cashier-paddle.md:1175 +msgid "Or, you may immediately activate a subscription by ending its trial by calling the `activate` method on the subscription:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:1177 +#: ./docs/11.x/cashier-paddle.md:1177 +#: ./docs/master/cashier-paddle.md:1177 +msgid "$user->subscription()->activate();" +msgstr "" + +# P +#: ./docs/8.x/cashier-paddle.md:1183 +#: ./docs/9.x/cashier-paddle.md:1279 +#: ./docs/10.x/cashier-paddle.md:1418 +#: ./docs/11.x/cashier-paddle.md:1401 +#: ./docs/master/cashier-paddle.md:1401 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1184 +#: ./docs/11.x/cashier-paddle.md:1184 +#: ./docs/master/cashier-paddle.md:1184 +msgid "By default, this controller will automatically handle canceling subscriptions that have too many failed charges, subscription updates, and payment method changes; however, as we'll soon discover, you can extend this controller to handle any Paddle webhook event you like." +msgstr "" + +# H2 +#: ./docs/8.x/cashier-paddle.md:1184 +#: ./docs/9.x/cashier-paddle.md:1280 +#: ./docs/10.x/cashier-paddle.md:1419 +#: ./docs/11.x/cashier-paddle.md:1402 +#: ./docs/master/cashier-paddle.md:1402 msgid "Testing" msgstr "" -#: docs/10.x/cashier-paddle.md:block 387 (paragraph) +# P +#: ./docs/8.x/cashier-paddle.md:1186 +#: ./docs/9.x/cashier-paddle.md:1282 +#: ./docs/10.x/cashier-paddle.md:1421 +#: ./docs/11.x/cashier-paddle.md:1404 +#: ./docs/master/cashier-paddle.md:1404 msgid "While testing, you should manually test your billing flow to make sure your integration works as expected." msgstr "" -#: docs/10.x/cashier-paddle.md:block 388 (paragraph) -msgid "For automated tests, including those executed within a CI environment, you may use [Laravel's HTTP Client](/docs/{{version}}/http-client#testing) to fake HTTP calls made to Paddle. Although this does not test the actual responses from Paddle, it does provide a way to test your application without actually calling Paddle's API." +# P +#: ./docs/10.x/cashier-paddle.md:1188 +#: ./docs/11.x/cashier-paddle.md:1188 +#: ./docs/master/cashier-paddle.md:1188 +msgid "Customer Updated" msgstr "" -#: docs/8.x/cashier-paddle.md:block 6 (paragraph) -msgid "While working with Cashier we recommend you also review Paddle's [user guides](https://developer.paddle.com/guides) and [API documentation](https://developer.paddle.com/api-reference/intro)." +# P +#: ./docs/8.x/cashier-paddle.md:1188 +#: ./docs/9.x/cashier-paddle.md:1284 +#: ./docs/10.x/cashier-paddle.md:1423 +#: ./docs/11.x/cashier-paddle.md:1406 +#: ./docs/master/cashier-paddle.md:1406 +msgid "For automated tests, including those executed within a CI environment, you may use [Laravel's HTTP Client](/docs/{{version}}/http-client#testing) to fake HTTP calls made to Paddle. Although this does not test the actual responses from Paddle, it does provide a way to test your application without actually calling Paddle's API." msgstr "" -#: docs/8.x/cashier-paddle.md:block 14 (quote) -msgid "{note} To ensure Cashier properly handles all Paddle events, remember to [set up Cashier's webhook handling](#handling-paddle-webhooks)." +# P +#: ./docs/10.x/cashier-paddle.md:1189 +#: ./docs/11.x/cashier-paddle.md:1189 +#: ./docs/master/cashier-paddle.md:1189 +msgid "Transaction Completed" msgstr "" -#: docs/8.x/cashier-paddle.md:block 19 (paragraph) -msgid "PADDLE_SANDBOX=true" +# P +#: ./docs/10.x/cashier-paddle.md:1190 +#: ./docs/11.x/cashier-paddle.md:1190 +#: ./docs/master/cashier-paddle.md:1190 +msgid "Transaction Updated" msgstr "" -#: docs/8.x/cashier-paddle.md:block 20 (paragraph) -msgid "After you have finished developing your application you may [apply for a Paddle vendor account](https://paddle.com)." +# P +#: ./docs/10.x/cashier-paddle.md:1193 +#: ./docs/11.x/cashier-paddle.md:1193 +#: ./docs/master/cashier-paddle.md:1193 +msgid "Subscription Paused" msgstr "" -#: docs/8.x/cashier-paddle.md:block 28 (code) -msgid "use Laravel\\Paddle\\Cashier;\n\n" -"/**\n" -" * Register any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function register()\n" -"{\n" -" Cashier::ignoreMigrations();\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1194 +#: ./docs/11.x/cashier-paddle.md:1194 +#: ./docs/master/cashier-paddle.md:1194 +msgid "Subscription Canceled" msgstr "" -#: docs/8.x/cashier-paddle.md:block 52 (quote) -msgid "{note} In order to use locales other than `en`, ensure the `ext-intl` PHP extension is installed and configured on your server." +# H4 +#: ./docs/10.x/cashier-paddle.md:1200 +#: ./docs/11.x/cashier-paddle.md:1200 +#: ./docs/master/cashier-paddle.md:1200 +msgid "Webhooks and CSRF Protection" msgstr "" -#: docs/8.x/cashier-paddle.md:block 58 (code) -msgid "use App\\Models\\Cashier\\Receipt;\n" -"use App\\Models\\Cashier\\Subscription;\n\n" -"/**\n" -" * Bootstrap any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Cashier::useReceiptModel(Receipt::class);\n" -" Cashier::useSubscriptionModel(Subscription::class);\n" -"}\n" +# P +#: ./docs/11.x/cashier-paddle.md:1202 +#: ./docs/master/cashier-paddle.md:1202 +msgid "Since Paddle webhooks need to bypass Laravel's [CSRF protection](/docs/{{version}}/csrf), you should ensure that Laravel does not attempt to verify the CSRF token for incoming Paddle webhooks. To accomplish this, you should exclude `paddle/*` from CSRF protection in your application's `bootstrap/app.php` file:" msgstr "" -#: docs/8.x/cashier-paddle.md:block 71 (quote) -msgid "{note} After a subscription state change, the delay for receiving the corresponding webhook is typically minimal but you should account for this in your application by considering that your user's subscription might not be immediately available after completing the checkout." +# CODE +#: ./docs/11.x/cashier-paddle.md:1204 +#: ./docs/master/cashier-paddle.md:1204 +msgid "->withMiddleware(function (Middleware $middleware) {\n" +" $middleware->validateCsrfTokens(except: [\n" +" 'paddle/*',\n" +" ]);\n" +"})" msgstr "" -#: docs/8.x/cashier-paddle.md:block 91 (code) -msgid "$options = [\n" -" 'product' => $productId,\n" -" 'title' => 'Product Title',\n" -"];\n\n" -"\n" +# H4 +#: ./docs/10.x/cashier-paddle.md:1209 +#: ./docs/11.x/cashier-paddle.md:1211 +#: ./docs/master/cashier-paddle.md:1211 +msgid "Webhooks and Local Development" msgstr "" -#: docs/8.x/cashier-paddle.md:block 93 (quote) -msgid "{note} If you would like to also use the `passthrough` option when specifying custom options, you should provide a key / value array as its value. Cashier will automatically handle converting the array to a JSON string. In addition, the `customer_id` passthrough option is reserved for internal Cashier usage." +# P +#: ./docs/10.x/cashier-paddle.md:1216 +#: ./docs/11.x/cashier-paddle.md:1218 +#: ./docs/master/cashier-paddle.md:1218 +msgid "Cashier automatically handles subscription cancelation on failed charges and other common Paddle webhooks. However, if you have additional webhook events you would like to handle, you may do so by listening to the following events that are dispatched by Cashier:" msgstr "" -#: docs/8.x/cashier-paddle.md:block 132 (quote) -msgid "{note} When using the prices API, Paddle only allows applying coupons to one-time purchase products and not to subscription plans." +# P +#: ./docs/10.x/cashier-paddle.md:1221 +#: ./docs/master/cashier-paddle.md:1223 +msgid "Both events contain the full payload of the Paddle webhook. For example, if you wish to handle the `transaction_billed` webhook, you may register a [listener](/docs/{{version}}/events#defining-listeners) that will handle the event:" msgstr "" -#: docs/8.x/cashier-paddle.md:block 138 (code) -msgid "/**\n" -" * Get the customer's email address to associate with Paddle.\n" -" *\n" -" * @return string|null\n" -" */\n" -"public function paddleEmail()\n" -"{\n" -" return $this->email;\n" -"}\n\n" -"/**\n" -" * Get the customer's country to associate with Paddle.\n" -" *\n" -" * This needs to be a 2 letter code. See the link below for supported countries.\n" -" *\n" -" * @return string|null\n" -" * @link https://developer.paddle.com/reference/platform-parameters/supported-countries\n" -" */\n" -"public function paddleCountry()\n" -"{\n" -" //\n" -"}\n\n" -"/**\n" -" * Get the customer's postal code to associate with Paddle.\n" -" *\n" -" * See the link below for countries which require this.\n" -" *\n" -" * @return string|null\n" -" * @link https://developer.paddle.com/reference/platform-parameters/supported-countries#countries-requiring-postcode\n" -" */\n" -"public function paddlePostcode()\n" +# CODE +#: ./docs/10.x/cashier-paddle.md:1223 +#: ./docs/master/cashier-paddle.md:1225 +msgid "payload['alert_name'] === 'transaction_billed') {\n" +" // Handle the incoming event...\n" +" }\n" +" }\n" +"}" msgstr "" -#: docs/8.x/cashier-paddle.md:block 145 (code) -msgid "use Illuminate\\Http\\Request;\n\n" -"Route::get('/user/subscribe', function (Request $request) {\n" -" $payLink = $user->newSubscription('default', $premium = 12345)\n" -" ->returnTo(route('home'))\n" -" ->create();\n\n" -" return view('billing', ['payLink' => $payLink]);\n" -"});\n" +# P +#: ./docs/11.x/cashier-paddle.md:1223 +msgid "Both events contain the full payload of the Paddle webhook. For example, if you wish to handle the `transaction.billed` webhook, you may register a [listener](/docs/{{version}}/events#defining-listeners) that will handle the event:" msgstr "" -#: docs/8.x/cashier-paddle.md:block 162 (quote) -msgid "{note} When providing metadata, please avoid using `subscription_name` as a metadata key. This key is reserved for internal use by Cashier." +# CODE +#: ./docs/11.x/cashier-paddle.md:1225 +msgid "payload['event_type'] === 'transaction.billed') {\n" +" // Handle the incoming event...\n" +" }\n" +" }\n" +"}" msgstr "" -#: docs/8.x/cashier-paddle.md:block 166 (code) -msgid "if ($user->subscribed('default')) {\n" -" //\n" -"}\n" +# P +#: ./docs/9.x/cashier-paddle.md:1236 +msgid "Alternatively, you can perform more precise customization by [listening](/docs/{{version}}/events) for the `subscription_payment_failed` Paddle event via the `WebhookReceived` event dispatched by Cashier. You should also ensure the \"Subscription Payment Failed\" option is enabled in the Webhook settings of your Paddle dashboard:" msgstr "" -#: docs/8.x/cashier-paddle.md:block 168 (code) +# CODE +#: ./docs/9.x/cashier-paddle.md:1238 msgid "user() && ! $request->user()->subscribed('default')) {\n" -" // This user is not a paying customer...\n" -" return redirect('billing');\n" -" }\n\n" -" return $next($request);\n" +" if ($event->payload['alert_name'] === 'subscription_payment_failed') {\n" +" // Handle the failed subscription payment...\n" +" }\n" " }\n" -"}\n" +"}" msgstr "" -#: docs/8.x/cashier-paddle.md:block 170 (code) -msgid "if ($user->subscription('default')->onTrial()) {\n" -" //\n" -"}\n" +# P +#: ./docs/9.x/cashier-paddle.md:1260 +msgid "Once your listener has been defined, you should register it within your application's `EventServiceProvider`:" msgstr "" -#: docs/8.x/cashier-paddle.md:block 172 (code) -msgid "if ($user->subscribedToPlan($monthly = 12345, 'default')) {\n" -" //\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1265 +#: ./docs/11.x/cashier-paddle.md:1248 +#: ./docs/master/cashier-paddle.md:1248 +msgid "`Laravel\\Paddle\\Events\\CustomerUpdated`" msgstr "" -#: docs/8.x/cashier-paddle.md:block 173 (paragraph) -msgid "By passing an array to the `subscribedToPlan` method, you may determine if the user's `default` subscription is actively subscribed to the monthly or the yearly plan:" +# P +#: ./docs/10.x/cashier-paddle.md:1266 +#: ./docs/11.x/cashier-paddle.md:1249 +#: ./docs/master/cashier-paddle.md:1249 +msgid "`Laravel\\Paddle\\Events\\TransactionCompleted`" msgstr "" -#: docs/8.x/cashier-paddle.md:block 174 (code) -msgid "if ($user->subscribedToPlan([$monthly = 12345, $yearly = 54321], 'default')) {\n" -" //\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1267 +#: ./docs/11.x/cashier-paddle.md:1250 +#: ./docs/master/cashier-paddle.md:1250 +msgid "`Laravel\\Paddle\\Events\\TransactionUpdated`" msgstr "" -#: docs/8.x/cashier-paddle.md:block 176 (code) -msgid "if ($user->subscription('default')->recurring()) {\n" -" //\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1270 +#: ./docs/11.x/cashier-paddle.md:1253 +#: ./docs/master/cashier-paddle.md:1253 +msgid "`Laravel\\Paddle\\Events\\SubscriptionPaused`" msgstr "" -#: docs/8.x/cashier-paddle.md:block 180 (code) -msgid "if ($user->subscription('default')->cancelled()) {\n" -" //\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1271 +#: ./docs/11.x/cashier-paddle.md:1254 +#: ./docs/master/cashier-paddle.md:1254 +msgid "`Laravel\\Paddle\\Events\\SubscriptionCanceled`" msgstr "" -#: docs/8.x/cashier-paddle.md:block 182 (code) -msgid "if ($user->subscription('default')->onGracePeriod()) {\n" -" //\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1286 +#: ./docs/11.x/cashier-paddle.md:1269 +#: ./docs/master/cashier-paddle.md:1269 +msgid "To enable webhook verification, ensure that the `PADDLE_WEBHOOK_SECRET` environment variable is defined in your application's `.env` file. The webhook secret may be retrieved from your Paddle account dashboard." msgstr "" -#: docs/8.x/cashier-paddle.md:block 184 (code) -msgid "if ($user->subscription('default')->ended()) {\n" -" //\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1291 +#: ./docs/11.x/cashier-paddle.md:1274 +#: ./docs/master/cashier-paddle.md:1274 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:1292 +#: ./docs/11.x/cashier-paddle.md:1275 +#: ./docs/master/cashier-paddle.md:1275 +msgid "Charging for Products" msgstr "" -#: docs/8.x/cashier-paddle.md:block 188 (code) -msgid "if ($user->subscription('default')->pastDue()) {\n" -" //\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1294 +#: ./docs/11.x/cashier-paddle.md:1277 +#: ./docs/master/cashier-paddle.md:1277 +msgid "If you would like to initiate a product purchase for a customer, you may use the `checkout` method on a billable model instance to generate a checkout session for the purchase. The `checkout` method accepts one or multiple price ID's. If necessary, an associative array may be used to provide the quantity of the product that is being purchased:" msgstr "" -#: docs/8.x/cashier-paddle.md:block 191 (code) -msgid "use Laravel\\Paddle\\Cashier;\n\n" -"/**\n" -" * Register any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function register()\n" -"{\n" -" Cashier::keepPastDueSubscriptionsActive();\n" -"}\n" +# CODE +#: ./docs/10.x/cashier-paddle.md:1296 +#: ./docs/11.x/cashier-paddle.md:1279 +#: ./docs/master/cashier-paddle.md:1279 +msgid "use Illuminate\\Http\\Request;\n\n" +"Route::get('/buy', function (Request $request) {\n" +" $checkout = $request->user()->checkout(['pri_tshirt', 'pri_socks' => 5]);\n\n" +" return view('buy', ['checkout' => $checkout]);\n" +"});" msgstr "" -#: docs/8.x/cashier-paddle.md:block 192 (quote) -msgid "{note} When a subscription is in a `past_due` state it cannot be changed until payment information has been updated. Therefore, the `swap` and `updateQuantity` methods will throw an exception when the subscription is in a `past_due` state." +# P +#: ./docs/10.x/cashier-paddle.md:1304 +#: ./docs/11.x/cashier-paddle.md:1287 +#: ./docs/master/cashier-paddle.md:1287 +msgid "After generating the checkout session, you may use Cashier's provided `paddle-button` [Blade component](#overlay-checkout) to allow the user to view the Paddle checkout widget and complete the purchase:" msgstr "" -#: docs/8.x/cashier-paddle.md:block 217 (quote) -msgid "{note} Plans may not be swapped when a trial is active. For additional information regarding this limitation, please see the [Paddle documentation](https://developer.paddle.com/api-reference/subscription-api/users/updateuser#usage-notes)." +# CODE: blade +#: ./docs/10.x/cashier-paddle.md:1306 +#: ./docs/11.x/cashier-paddle.md:1289 +#: ./docs/master/cashier-paddle.md:1289 +msgid "\n" +" Buy\n" +"" msgstr "" -#: docs/8.x/cashier-paddle.md:block 220 (paragraph) -msgid "By default, Paddle prorates charges when swapping between plans. The `noProrate` method may be used to update the subscription's without prorating the charges:" +# P +#: ./docs/10.x/cashier-paddle.md:1312 +#: ./docs/11.x/cashier-paddle.md:1295 +#: ./docs/master/cashier-paddle.md:1295 +msgid "A checkout session has a `customData` method, allowing you to pass any custom data you wish to the underlying transaction creation. Please consult [the Paddle documentation](https://developer.paddle.com/build/transactions/custom-data) to learn more about the options available to you when passing custom data:" msgstr "" -#: docs/8.x/cashier-paddle.md:block 254 (code) -msgid "if ($user->subscription('default')->onPausedGracePeriod()) {\n" -" //\n" -"}\n" +# CODE +#: ./docs/10.x/cashier-paddle.md:1314 +#: ./docs/11.x/cashier-paddle.md:1297 +#: ./docs/master/cashier-paddle.md:1297 +msgid "$checkout = $user->checkout('pri_tshirt')\n" +" ->customData([\n" +" 'custom_option' => $value,\n" +" ]);" msgstr "" -#: docs/8.x/cashier-paddle.md:block 257 (quote) -msgid "{note} A subscription cannot be modified while it is paused. If you want to swap to a different plan or update quantities you must resume the subscription first." +# P +#: ./docs/10.x/cashier-paddle.md:1319 +#: ./docs/11.x/cashier-paddle.md:1302 +#: ./docs/master/cashier-paddle.md:1302 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:1320 +#: ./docs/11.x/cashier-paddle.md:1303 +#: ./docs/master/cashier-paddle.md:1303 +msgid "Refunding Transactions" msgstr "" -#: docs/8.x/cashier-paddle.md:block 267 (quote) -msgid "{note} Paddle's subscriptions cannot be resumed after cancellation. If your customer wishes to resume their subscription, they will have to subscribe to a new subscription." +# P +#: ./docs/10.x/cashier-paddle.md:1322 +#: ./docs/11.x/cashier-paddle.md:1305 +#: ./docs/master/cashier-paddle.md:1305 +msgid "Refunding transactions will return the refunded amount to your customer's payment method that was used at the time of purchase. If you need to refund a Paddle purchase, you may use the `refund` method on a `Cashier\\Paddle\\Transaction` model. This method accepts a reason as the first argument, one or more price ID's to refund with optional amounts as an associative array. You may retrieve the transactions for a given billable model using the `transactions` method." msgstr "" -#: docs/8.x/cashier-paddle.md:block 272 (quote) -msgid "{note} While trialing and collecting payment method details up front, Paddle prevents any subscription changes such as swapping plans or updating quantities. If you want to allow a customer to swap plans during a trial the subscription must be cancelled and recreated." +# P +#: ./docs/10.x/cashier-paddle.md:1324 +#: ./docs/11.x/cashier-paddle.md:1307 +#: ./docs/master/cashier-paddle.md:1307 +msgid "For example, imagine we want to refund a specific transaction for prices `pri_123` and `pri_456`. We want to fully refund `pri_123`, but only refund two dollars for `pri_456`:" msgstr "" -#: docs/8.x/cashier-paddle.md:block 276 (quote) -msgid "{note} If the customer's subscription is not cancelled before the trial ending date they will be charged as soon as the trial expires, so you should be sure to notify your users of their trial ending date." +# CODE +#: ./docs/10.x/cashier-paddle.md:1326 +#: ./docs/11.x/cashier-paddle.md:1309 +#: ./docs/master/cashier-paddle.md:1309 +msgid "use App\\Models\\User;\n\n" +"$user = User::find(1);\n\n" +"$transaction = $user->transactions()->first();\n\n" +"$response = $transaction->refund('Accidental charge', [\n" +" 'pri_123', // Fully refund this price...\n" +" 'pri_456' => 200, // Only partially refund this price...\n" +"]);" msgstr "" -#: docs/8.x/cashier-paddle.md:block 278 (code) -msgid "if ($user->onTrial('default')) {\n" -" //\n" -"}\n\n" -"if ($user->subscription('default')->onTrial()) {\n" -" //\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1337 +#: ./docs/11.x/cashier-paddle.md:1320 +#: ./docs/master/cashier-paddle.md:1320 +msgid "The example above refunds specific line items in a transaction. If you want to refund the entire transaction, simply provide a reason:" msgstr "" -#: docs/8.x/cashier-paddle.md:block 294 (quote) -msgid "{note} There is no way to extend or modify a trial period on a Paddle subscription after it has been created." +# CODE +#: ./docs/10.x/cashier-paddle.md:1339 +#: ./docs/11.x/cashier-paddle.md:1322 +#: ./docs/master/cashier-paddle.md:1322 +msgid "$response = $transaction->refund('Accidental charge');" msgstr "" -#: docs/8.x/cashier-paddle.md:block 298 (paragraph) -msgid "By default, this controller will automatically handle cancelling subscriptions that have too many failed charges ([as defined by your Paddle subscription settings](https://vendors.paddle.com/subscription-settings)), subscription updates, and payment method changes; however, as we'll soon discover, you can extend this controller to handle any Paddle webhook event you like." +# P +#: ./docs/10.x/cashier-paddle.md:1341 +#: ./docs/11.x/cashier-paddle.md:1324 +#: ./docs/master/cashier-paddle.md:1324 +msgid "For more information on refunds, please consult [Paddle's refund documentation](https://developer.paddle.com/build/transactions/create-transaction-adjustments)." msgstr "" -#: docs/8.x/cashier-paddle.md:block 301 (quote) -msgid "{note} Make sure you protect incoming requests with Cashier's included [webhook signature verification](/docs/{{version}}/cashier-paddle#verifying-webhook-signatures) middleware." +# P +#: ./docs/10.x/cashier-paddle.md:1344 +#: ./docs/11.x/cashier-paddle.md:1327 +#: ./docs/master/cashier-paddle.md:1327 +msgid "Refunds must always be approved by Paddle before fully processing." msgstr "" -#: docs/8.x/cashier-paddle.md:block 314 (code) -msgid "payload['alert_name'] === 'payment_succeeded') {\n" -" // Handle the incoming event...\n" -" }\n" -" }\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1346 +#: ./docs/11.x/cashier-paddle.md:1329 +#: ./docs/master/cashier-paddle.md:1329 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:1347 +#: ./docs/11.x/cashier-paddle.md:1330 +#: ./docs/master/cashier-paddle.md:1330 +msgid "Crediting Transactions" msgstr "" -#: docs/8.x/cashier-paddle.md:block 355 (quote) -msgid "{tip} You can use the `$refundRequestId` as a reference for the refund when contacting Paddle support." +# P +#: ./docs/10.x/cashier-paddle.md:1349 +#: ./docs/11.x/cashier-paddle.md:1332 +#: ./docs/master/cashier-paddle.md:1332 +msgid "Just like refunding, you can also credit transactions. Crediting transactions will add the funds to the customer's balance so it may be used for future purchases. Crediting transactions can only be done for manually-collected transactions and not for automatically-collected transactions (like subscriptions) since Paddle handles subscription credits automatically:" msgstr "" -#: docs/8.x/cashier-paddle.md:block 371 (paragraph) -msgid "Alternatively, you can perform more precise customization by catching the [`subscription_payment_failed`](https://developer.paddle.com/webhook-reference/subscription-alerts/subscription-payment-failed) webhook and enabling the \"Subscription Payment Failed\" option in the Webhook settings of your Paddle dashboard:" +# CODE +#: ./docs/10.x/cashier-paddle.md:1351 +#: ./docs/11.x/cashier-paddle.md:1334 +#: ./docs/master/cashier-paddle.md:1334 +msgid "$transaction = $user->transactions()->first();\n\n" +"// Credit a specific line item fully...\n" +"$response = $transaction->credit('Compensation', 'pri_123');" msgstr "" -#: docs/8.x/cashier-paddle.md:block 372 (code) -msgid "hasExpiredTrial('default')) {\n" -" //\n" -"}\n\n" -"if ($user->subscription('default')->hasExpiredTrial()) {\n" -" //\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1359 +#: ./docs/11.x/cashier-paddle.md:1342 +#: ./docs/master/cashier-paddle.md:1342 +msgid "Credits can only be applied for manually-collected transactions. Automatically-collected transactions are credited by Paddle themselves." msgstr "" -#: docs/9.x/cashier-paddle.md:block 383 (code) -msgid "payload['alert_name'] === 'subscription_payment_failed') {\n" -" // Handle the failed subscription payment...\n" -" }\n" -" }\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1361 +#: ./docs/11.x/cashier-paddle.md:1344 +#: ./docs/master/cashier-paddle.md:1344 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/cashier-paddle.md:1362 +#: ./docs/11.x/cashier-paddle.md:1345 +#: ./docs/master/cashier-paddle.md:1345 +msgid "Transactions" msgstr "" -#: docs/master/cashier-paddle.md:block 174 (code) -msgid "if ($user->subscribedToPlan([$monthly = 12345, $yearly = 54321], 'default')) {\n" -" // ...\n" -"}\n" +# P +#: ./docs/10.x/cashier-paddle.md:1364 +#: ./docs/11.x/cashier-paddle.md:1347 +#: ./docs/master/cashier-paddle.md:1347 +msgid "You may easily retrieve an array of a billable model's transactions via the `transactions` property:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:1366 +#: ./docs/11.x/cashier-paddle.md:1349 +#: ./docs/master/cashier-paddle.md:1349 +msgid "use App\\Models\\User;\n\n" +"$user = User::find(1);\n\n" +"$transactions = $user->transactions;" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1372 +#: ./docs/11.x/cashier-paddle.md:1355 +#: ./docs/master/cashier-paddle.md:1355 +msgid "Transactions represent payments for your products and purchases and are accompanied by invoices. Only completed transactions are stored in your application's database." +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1374 +#: ./docs/11.x/cashier-paddle.md:1357 +#: ./docs/master/cashier-paddle.md:1357 +msgid "When listing the transactions for a customer, you may use the transaction instance's methods to display the relevant payment information. For example, you may wish to list every transaction in a table, allowing the user to easily download any of the invoices:" +msgstr "" + +# CODE +#: ./docs/11.x/cashier-paddle.md:1374 +msgid "use Illuminate\\Http\\Request;\n" +"use Laravel\\Paddle\\Transaction;\n\n" +"Route::get('/download-invoice/{transaction}', function (Request $request, Transaction $transaction) {\n" +" return $transaction->redirectToInvoicePdf();\n" +"})->name('download-invoice');" +msgstr "" + +# CODE: html +#: ./docs/10.x/cashier-paddle.md:1376 +#: ./docs/11.x/cashier-paddle.md:1359 +#: ./docs/master/cashier-paddle.md:1359 +msgid "\n" +" @foreach ($transactions as $transaction)\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" @endforeach\n" +"
    {{ $transaction->billed_at->toFormattedDateString() }}{{ $transaction->total() }}{{ $transaction->tax() }}id) }}\" target=\"_blank\">Download
    " +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1389 +#: ./docs/11.x/cashier-paddle.md:1372 +#: ./docs/master/cashier-paddle.md:1372 +msgid "The `download-invoice` route may look like the following:" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:1391 +#: ./docs/master/cashier-paddle.md:1374 +msgid "use Illuminate\\Http\\Request;\n" +"use Laravel\\Cashier\\Transaction;\n\n" +"Route::get('/download-invoice/{transaction}', function (Request $request, Transaction $transaction) {\n" +" return $transaction->redirectToInvoicePdf();\n" +"})->name('download-invoice');" +msgstr "" + +# H3 +#: ./docs/10.x/cashier-paddle.md:1399 +#: ./docs/11.x/cashier-paddle.md:1382 +#: ./docs/master/cashier-paddle.md:1382 +msgid "Past and Upcoming Payments" +msgstr "" + +# CODE +#: ./docs/10.x/cashier-paddle.md:1403 +#: ./docs/11.x/cashier-paddle.md:1386 +#: ./docs/master/cashier-paddle.md:1386 +msgid "use App\\Models\\User;\n\n" +"$user = User::find(1);\n\n" +"$subscription = $user->subscription();\n\n" +"$lastPayment = $subscription->lastPayment();\n" +"$nextPayment = $subscription->nextPayment();" +msgstr "" + +# P +#: ./docs/10.x/cashier-paddle.md:1412 +#: ./docs/11.x/cashier-paddle.md:1395 +#: ./docs/master/cashier-paddle.md:1395 +msgid "Both of these methods will return an instance of `Laravel\\Paddle\\Payment`; however, `lastPayment` will return `null` when transactions have not been synced by webhooks yet, while `nextPayment` will return `null` when the billing cycle has ended (such as when a subscription has been canceled):" msgstr "" diff --git a/po/zh_TW/collections.po b/po/zh_TW/collections.po index cc8aa6667..d7b92ad95 100644 --- a/po/zh_TW/collections.po +++ b/po/zh_TW/collections.po @@ -10,112 +10,262 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" - -#: docs/10.x/collections.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H1 +#: ./docs/8.x/collections.md:1 +#: ./docs/9.x/collections.md:1 +#: ./docs/10.x/collections.md:1 +#: ./docs/11.x/collections.md:1 +#: ./docs/master/collections.md:1 msgid "Collections" -msgstr "Collection" +msgstr "" -#: docs/10.x/collections.md:block 2 (unordered list) +# P +#: ./docs/8.x/collections.md:3 +#: ./docs/9.x/collections.md:3 +#: ./docs/10.x/collections.md:3 +#: ./docs/11.x/collections.md:3 +#: ./docs/master/collections.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/collections.md:block 2 (unordered list) +# P +#: ./docs/8.x/collections.md:4 +#: ./docs/9.x/collections.md:4 +#: ./docs/10.x/collections.md:4 +#: ./docs/11.x/collections.md:4 +#: ./docs/master/collections.md:4 msgid "[Creating Collections](#creating-collections)" -msgstr "[建立 Collection](#creating-collections)" +msgstr "" -#: docs/10.x/collections.md:block 2 (unordered list) +# P +#: ./docs/8.x/collections.md:5 +#: ./docs/9.x/collections.md:5 +#: ./docs/10.x/collections.md:5 +#: ./docs/11.x/collections.md:5 +#: ./docs/master/collections.md:5 msgid "[Extending Collections](#extending-collections)" -msgstr "[擴充 Collection](#extending-collections)" +msgstr "" -#: docs/10.x/collections.md:block 2 (unordered list) +# P +#: ./docs/8.x/collections.md:6 +#: ./docs/9.x/collections.md:6 +#: ./docs/10.x/collections.md:6 +#: ./docs/11.x/collections.md:6 +#: ./docs/master/collections.md:6 msgid "[Available Methods](#available-methods)" -msgstr "[可用方法](#available-methods)" +msgstr "" -#: docs/10.x/collections.md:block 2 (unordered list) +# P +#: ./docs/8.x/collections.md:7 +#: ./docs/9.x/collections.md:7 +#: ./docs/10.x/collections.md:7 +#: ./docs/11.x/collections.md:7 +#: ./docs/master/collections.md:7 msgid "[Higher Order Messages](#higher-order-messages)" -msgstr "[高階訊息 (Higher Order Message)](#higher-order-messages)" +msgstr "" -#: docs/10.x/collections.md:block 2 (unordered list) +# P +#: ./docs/8.x/collections.md:8 +#: ./docs/9.x/collections.md:8 +#: ./docs/10.x/collections.md:8 +#: ./docs/11.x/collections.md:8 +#: ./docs/master/collections.md:8 msgid "[Lazy Collections](#lazy-collections)" -msgstr "[Lazy Collection](#lazy-collections)" +msgstr "" -#: docs/10.x/collections.md:block 2 (unordered list) +# P +#: ./docs/8.x/collections.md:9 +#: ./docs/9.x/collections.md:9 +#: ./docs/10.x/collections.md:9 +#: ./docs/11.x/collections.md:9 +#: ./docs/master/collections.md:9 msgid "[Introduction](#lazy-collection-introduction)" -msgstr "[簡介](#lazy-collection-introduction)" +msgstr "" -#: docs/10.x/collections.md:block 2 (unordered list) +# P +#: ./docs/8.x/collections.md:10 +#: ./docs/9.x/collections.md:10 +#: ./docs/10.x/collections.md:10 +#: ./docs/11.x/collections.md:10 +#: ./docs/master/collections.md:10 msgid "[Creating Lazy Collections](#creating-lazy-collections)" -msgstr "[建立 Lazy Collection](#creating-lazy-collections)" +msgstr "" -#: docs/10.x/collections.md:block 2 (unordered list) +# P +#: ./docs/8.x/collections.md:11 +#: ./docs/9.x/collections.md:11 +#: ./docs/10.x/collections.md:11 +#: ./docs/11.x/collections.md:11 +#: ./docs/master/collections.md:11 msgid "[The Enumerable Contract](#the-enumerable-contract)" -msgstr "[Enumerable Contract](#the-enumerable-contract)" +msgstr "" -#: docs/10.x/collections.md:block 2 (unordered list) +# P +#: ./docs/8.x/collections.md:12 +#: ./docs/9.x/collections.md:12 +#: ./docs/10.x/collections.md:12 +#: ./docs/11.x/collections.md:12 +#: ./docs/master/collections.md:12 msgid "[Lazy Collection Methods](#lazy-collection-methods)" -msgstr "[Lazy Collection 方法](#lazy-collection-methods)" +msgstr "" -#: docs/10.x/collections.md:block 4 (header) +# P +#: ./docs/8.x/collections.md:14 +#: ./docs/9.x/collections.md:14 +#: ./docs/10.x/collections.md:14 +#: ./docs/11.x/collections.md:14 +#: ./docs/master/collections.md:14 +#~ msgid "" +#~ msgstr "" + +# H2 +# H3 +#: ./docs/8.x/collections.md:15 +#: ./docs/8.x/collections.md:3169 +#: ./docs/9.x/collections.md:15 +#: ./docs/9.x/collections.md:3305 +#: ./docs/10.x/collections.md:15 +#: ./docs/10.x/collections.md:3419 +#: ./docs/11.x/collections.md:15 +#: ./docs/11.x/collections.md:3502 +#: ./docs/master/collections.md:15 +#: ./docs/master/collections.md:3419 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/collections.md:block 5 (paragraph) +# P +#: ./docs/8.x/collections.md:17 +#: ./docs/9.x/collections.md:17 +#: ./docs/10.x/collections.md:17 +#: ./docs/11.x/collections.md:17 +#: ./docs/master/collections.md:17 msgid "The `Illuminate\\Support\\Collection` class provides a fluent, convenient wrapper for working with arrays of data. For example, check out the following code. We'll use the `collect` helper to create a new collection instance from the array, run the `strtoupper` function on each element, and then remove all empty elements:" -msgstr "`Illuminate\\Support\\Collection` 類別為處理陣列資料提供了一個流暢且便利的包裝。舉例來說,看看下列程式碼。我們會使用 `collect` 輔助函式來自陣列建立一個新的 Collection 實體,然後在每個元素上執行 `strtoupper` 函式,並移除所有空元素:" +msgstr "" -#: docs/10.x/collections.md:block 6 (code) -msgid "$collection = collect(['taylor', 'abigail', null])->map(function (string $name) {\n" +# CODE +#: ./docs/10.x/collections.md:19 +#: ./docs/11.x/collections.md:19 +#: ./docs/master/collections.md:19 +msgid "$collection = collect(['taylor', 'abigail', null])->map(function (?string $name) {\n" " return strtoupper($name);\n" "})->reject(function (string $name) {\n" " return empty($name);\n" -"});\n" -msgstr "$collection = collect(['taylor', 'abigail', null])->map(function (string $name) {\n" +"});" +msgstr "" + +# CODE +#: ./docs/8.x/collections.md:19 +#: ./docs/9.x/collections.md:19 +msgid "$collection = collect(['taylor', 'abigail', null])->map(function ($name) {\n" " return strtoupper($name);\n" -"})->reject(function (string $name) {\n" +"})->reject(function ($name) {\n" " return empty($name);\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/collections.md:block 7 (paragraph) +# P +#: ./docs/8.x/collections.md:25 +#: ./docs/9.x/collections.md:25 +#: ./docs/10.x/collections.md:25 +#: ./docs/11.x/collections.md:25 +#: ./docs/master/collections.md:25 msgid "As you can see, the `Collection` class allows you to chain its methods to perform fluent mapping and reducing of the underlying array. In general, collections are immutable, meaning every `Collection` method returns an entirely new `Collection` instance." -msgstr "如你所見,`Collection` 類別能讓你將其方法串在一起呼叫,以流暢地在底層的陣列上進行 Map 與 Reduce 處理。通常來說,Collection 是不可變的(Immutable),這代表每個 `Collection` 方法都會回傳一個全新的 `Collection` 實體。" +msgstr "" -#: docs/10.x/collections.md:block 9 (header) +# P +#: ./docs/8.x/collections.md:27 +#: ./docs/9.x/collections.md:27 +#: ./docs/10.x/collections.md:27 +#: ./docs/11.x/collections.md:27 +#: ./docs/master/collections.md:27 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/collections.md:28 +#: ./docs/9.x/collections.md:28 +#: ./docs/10.x/collections.md:28 +#: ./docs/11.x/collections.md:28 +#: ./docs/master/collections.md:28 msgid "Creating Collections" -msgstr "建立 Collection" +msgstr "" -#: docs/10.x/collections.md:block 10 (paragraph) +# P +#: ./docs/8.x/collections.md:30 +#: ./docs/9.x/collections.md:30 +#: ./docs/10.x/collections.md:30 +#: ./docs/11.x/collections.md:30 +#: ./docs/master/collections.md:30 msgid "As mentioned above, the `collect` helper returns a new `Illuminate\\Support\\Collection` instance for the given array. So, creating a collection is as simple as:" -msgstr "就像上面提到的一樣,`collect` 輔助函式會為給定的陣列回傳一個新的 `Illuminate\\Support\\Collection` 實體。因此,建立 Collection 就這麼簡單:" +msgstr "" -#: docs/10.x/collections.md:block 11 (code) -msgid "$collection = collect([1, 2, 3]);\n" -msgstr "$collection = collect([1, 2, 3]);\n" +# CODE +#: ./docs/8.x/collections.md:32 +#: ./docs/9.x/collections.md:32 +#: ./docs/10.x/collections.md:32 +#: ./docs/11.x/collections.md:32 +#: ./docs/master/collections.md:32 +msgid "$collection = collect([1, 2, 3]);" +msgstr "" -#: docs/10.x/collections.md:block 12 (quote) -msgid "**Note** The results of [Eloquent](/docs/{{version}}/eloquent) queries are always returned as `Collection` instances." -msgstr "**Note** [Eloquent](/docs/{{version}}/eloquent) 查詢的結果總會回傳為 `Collection` 實體。" +# P +#: ./docs/8.x/collections.md:34 +#: ./docs/9.x/collections.md:35 +#: ./docs/10.x/collections.md:35 +#: ./docs/11.x/collections.md:35 +#: ./docs/master/collections.md:35 +msgid "The results of [Eloquent](/docs/{{version}}/eloquent) queries are always returned as `Collection` instances." +msgstr "" -#: docs/10.x/collections.md:block 14 (header) +# P +#: ./docs/8.x/collections.md:36 +#: ./docs/9.x/collections.md:37 +#: ./docs/10.x/collections.md:37 +#: ./docs/11.x/collections.md:37 +#: ./docs/master/collections.md:37 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/collections.md:37 +#: ./docs/9.x/collections.md:38 +#: ./docs/10.x/collections.md:38 +#: ./docs/11.x/collections.md:38 +#: ./docs/master/collections.md:38 msgid "Extending Collections" -msgstr "擴充 Collection" +msgstr "" -#: docs/10.x/collections.md:block 15 (paragraph) +# P +#: ./docs/8.x/collections.md:39 +#: ./docs/9.x/collections.md:40 +#: ./docs/10.x/collections.md:40 +#: ./docs/11.x/collections.md:40 +#: ./docs/master/collections.md:40 msgid "Collections are \"macroable\", which allows you to add additional methods to the `Collection` class at run time. The `Illuminate\\Support\\Collection` class' `macro` method accepts a closure that will be executed when your macro is called. The macro closure may access the collection's other methods via `$this`, just as if it were a real method of the collection class. For example, the following code adds a `toUpper` method to the `Collection` class:" -msgstr "Collection 是「Macroable (可巨集)」的,這代表我們可以在執行階段往 `Collection` 增加額外的方法。`Illuminate\\Support\\Collection` 類別的 `macro` 方法接收一個閉包,該閉包會在 Macro 被呼叫時執行。Macro 閉包也能像真正的 Collection 類別方法一樣,通過 `$this` 來存取該 Collection 的其他方法。舉例來說,下列程式碼會往 `Collection` 類別內新增一個 `toUpper` 方法:" +msgstr "" -#: docs/10.x/collections.md:block 16 (code) +# CODE +#: ./docs/8.x/collections.md:41 +#: ./docs/9.x/collections.md:42 msgid "use Illuminate\\Support\\Collection;\n" "use Illuminate\\Support\\Str;\n\n" "Collection::macro('toUpper', function () {\n" -" return $this->map(function (string $value) {\n" +" return $this->map(function ($value) {\n" " return Str::upper($value);\n" " });\n" "});\n\n" "$collection = collect(['first', 'second']);\n\n" "$upper = $collection->toUpper();\n\n" -"// ['FIRST', 'SECOND']\n" -msgstr "use Illuminate\\Support\\Collection;\n" +"// ['FIRST', 'SECOND']" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:42 +#: ./docs/11.x/collections.md:42 +#: ./docs/master/collections.md:42 +msgid "use Illuminate\\Support\\Collection;\n" "use Illuminate\\Support\\Str;\n\n" "Collection::macro('toUpper', function () {\n" " return $this->map(function (string $value) {\n" @@ -124,31 +274,64 @@ msgstr "use Illuminate\\Support\\Collection;\n" "});\n\n" "$collection = collect(['first', 'second']);\n\n" "$upper = $collection->toUpper();\n\n" -"// ['FIRST', 'SECOND']\n" +"// ['FIRST', 'SECOND']" +msgstr "" -#: docs/10.x/collections.md:block 17 (paragraph) +# P +#: ./docs/8.x/collections.md:56 +#: ./docs/9.x/collections.md:57 +#: ./docs/10.x/collections.md:57 +#: ./docs/11.x/collections.md:57 +#: ./docs/master/collections.md:57 msgid "Typically, you should declare collection macros in the `boot` method of a [service provider](/docs/{{version}}/providers)." -msgstr "一般來說,Collection Macro 的宣告應放置於某個 [Service Provider](/docs/{{version}}/providers) 的 `boot` 方法內。" +msgstr "" -#: docs/10.x/collections.md:block 19 (header) +# P +#: ./docs/8.x/collections.md:58 +#: ./docs/9.x/collections.md:59 +#: ./docs/10.x/collections.md:59 +#: ./docs/11.x/collections.md:59 +#: ./docs/master/collections.md:59 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:59 +#: ./docs/9.x/collections.md:60 +#: ./docs/10.x/collections.md:60 +#: ./docs/11.x/collections.md:60 +#: ./docs/master/collections.md:60 msgid "Macro Arguments" -msgstr "Macro 引數" +msgstr "" -#: docs/10.x/collections.md:block 20 (paragraph) +# P +#: ./docs/8.x/collections.md:61 +#: ./docs/9.x/collections.md:62 +#: ./docs/10.x/collections.md:62 +#: ./docs/11.x/collections.md:62 +#: ./docs/master/collections.md:62 msgid "If necessary, you may define macros that accept additional arguments:" -msgstr "若有需要,也可以定義接受額外引數的 Macro:" +msgstr "" -#: docs/10.x/collections.md:block 21 (code) +# CODE +#: ./docs/8.x/collections.md:63 +#: ./docs/9.x/collections.md:64 msgid "use Illuminate\\Support\\Collection;\n" "use Illuminate\\Support\\Facades\\Lang;\n\n" -"Collection::macro('toLocale', function (string $locale) {\n" -" return $this->map(function (string $value) use ($locale) {\n" +"Collection::macro('toLocale', function ($locale) {\n" +" return $this->map(function ($value) use ($locale) {\n" " return Lang::get($value, [], $locale);\n" " });\n" "});\n\n" "$collection = collect(['first', 'second']);\n\n" -"$translated = $collection->toLocale('es');\n" -msgstr "use Illuminate\\Support\\Collection;\n" +"$translated = $collection->toLocale('es');" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:64 +#: ./docs/11.x/collections.md:64 +#: ./docs/master/collections.md:64 +msgid "use Illuminate\\Support\\Collection;\n" "use Illuminate\\Support\\Facades\\Lang;\n\n" "Collection::macro('toLocale', function (string $locale) {\n" " return $this->map(function (string $value) use ($locale) {\n" @@ -156,55 +339,743 @@ msgstr "use Illuminate\\Support\\Collection;\n" " });\n" "});\n\n" "$collection = collect(['first', 'second']);\n\n" -"$translated = $collection->toLocale('es');\n" +"$translated = $collection->toLocale('es');" +msgstr "" -#: docs/10.x/collections.md:block 23 (header) +# P +#: ./docs/8.x/collections.md:76 +#: ./docs/9.x/collections.md:77 +#: ./docs/10.x/collections.md:77 +#: ./docs/11.x/collections.md:77 +#: ./docs/master/collections.md:77 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/collections.md:77 +#: ./docs/9.x/collections.md:78 +#: ./docs/10.x/collections.md:78 +#: ./docs/11.x/collections.md:78 +#: ./docs/master/collections.md:78 msgid "Available Methods" -msgstr "可用方法" +msgstr "" -#: docs/10.x/collections.md:block 24 (paragraph) +# P +#: ./docs/8.x/collections.md:79 +#: ./docs/9.x/collections.md:80 +#: ./docs/10.x/collections.md:80 +#: ./docs/11.x/collections.md:80 +#: ./docs/master/collections.md:80 msgid "For the majority of the remaining collection documentation, we'll discuss each method available on the `Collection` class. Remember, all of these methods may be chained to fluently manipulate the underlying array. Furthermore, almost every method returns a new `Collection` instance, allowing you to preserve the original copy of the collection when necessary:" -msgstr "在 Collection 說明文件剩下的一大部分,我們會討論 `Collection` 類別內可用的各個方法。請記住,這裡所有的方法都可以互相串接使用,以流利地操作底層的陣列。此外,幾乎所有的函式都會回傳一個新的 `Collection` 實體,讓你可以在有需要的時候保留原始的 Collection 拷貝:" +msgstr "" + +# P +#: ./docs/8.x/collections.md:94 +msgid "[all](#method-all)\n" +"[average](#method-average)\n" +"[avg](#method-avg)\n" +"[chunk](#method-chunk)\n" +"[chunkWhile](#method-chunkwhile)\n" +"[collapse](#method-collapse)\n" +"[collect](#method-collect)\n" +"[combine](#method-combine)\n" +"[concat](#method-concat)\n" +"[contains](#method-contains)\n" +"[containsStrict](#method-containsstrict)\n" +"[count](#method-count)\n" +"[countBy](#method-countBy)\n" +"[crossJoin](#method-crossjoin)\n" +"[dd](#method-dd)\n" +"[diff](#method-diff)\n" +"[diffAssoc](#method-diffassoc)\n" +"[diffKeys](#method-diffkeys)\n" +"[doesntContain](#method-doesntcontain)\n" +"[dump](#method-dump)\n" +"[duplicates](#method-duplicates)\n" +"[duplicatesStrict](#method-duplicatesstrict)\n" +"[each](#method-each)\n" +"[eachSpread](#method-eachspread)\n" +"[every](#method-every)\n" +"[except](#method-except)\n" +"[filter](#method-filter)\n" +"[first](#method-first)\n" +"[firstWhere](#method-first-where)\n" +"[flatMap](#method-flatmap)\n" +"[flatten](#method-flatten)\n" +"[flip](#method-flip)\n" +"[forget](#method-forget)\n" +"[forPage](#method-forpage)\n" +"[get](#method-get)\n" +"[groupBy](#method-groupby)\n" +"[has](#method-has)\n" +"[implode](#method-implode)\n" +"[intersect](#method-intersect)\n" +"[intersectByKeys](#method-intersectbykeys)\n" +"[isEmpty](#method-isempty)\n" +"[isNotEmpty](#method-isnotempty)\n" +"[join](#method-join)\n" +"[keyBy](#method-keyby)\n" +"[keys](#method-keys)\n" +"[last](#method-last)\n" +"[macro](#method-macro)\n" +"[make](#method-make)\n" +"[map](#method-map)\n" +"[mapInto](#method-mapinto)\n" +"[mapSpread](#method-mapspread)\n" +"[mapToGroups](#method-maptogroups)\n" +"[mapWithKeys](#method-mapwithkeys)\n" +"[max](#method-max)\n" +"[median](#method-median)\n" +"[merge](#method-merge)\n" +"[mergeRecursive](#method-mergerecursive)\n" +"[min](#method-min)\n" +"[mode](#method-mode)\n" +"[nth](#method-nth)\n" +"[only](#method-only)\n" +"[pad](#method-pad)\n" +"[partition](#method-partition)\n" +"[pipe](#method-pipe)\n" +"[pipeInto](#method-pipeinto)\n" +"[pipeThrough](#method-pipethrough)\n" +"[pluck](#method-pluck)\n" +"[pop](#method-pop)\n" +"[prepend](#method-prepend)\n" +"[pull](#method-pull)\n" +"[push](#method-push)\n" +"[put](#method-put)\n" +"[random](#method-random)\n" +"[range](#method-range)\n" +"[reduce](#method-reduce)\n" +"[reduceSpread](#method-reduce-spread)\n" +"[reject](#method-reject)\n" +"[replace](#method-replace)\n" +"[replaceRecursive](#method-replacerecursive)\n" +"[reverse](#method-reverse)\n" +"[search](#method-search)\n" +"[shift](#method-shift)\n" +"[shuffle](#method-shuffle)\n" +"[sliding](#method-sliding)\n" +"[skip](#method-skip)\n" +"[skipUntil](#method-skipuntil)\n" +"[skipWhile](#method-skipwhile)\n" +"[slice](#method-slice)\n" +"[sole](#method-sole)\n" +"[some](#method-some)\n" +"[sort](#method-sort)\n" +"[sortBy](#method-sortby)\n" +"[sortByDesc](#method-sortbydesc)\n" +"[sortDesc](#method-sortdesc)\n" +"[sortKeys](#method-sortkeys)\n" +"[sortKeysDesc](#method-sortkeysdesc)\n" +"[sortKeysUsing](#method-sortkeysusing)\n" +"[splice](#method-splice)\n" +"[split](#method-split)\n" +"[splitIn](#method-splitin)\n" +"[sum](#method-sum)\n" +"[take](#method-take)\n" +"[takeUntil](#method-takeuntil)\n" +"[takeWhile](#method-takewhile)\n" +"[tap](#method-tap)\n" +"[times](#method-times)\n" +"[toArray](#method-toarray)\n" +"[toJson](#method-tojson)\n" +"[transform](#method-transform)\n" +"[undot](#method-undot)\n" +"[union](#method-union)\n" +"[unique](#method-unique)\n" +"[uniqueStrict](#method-uniquestrict)\n" +"[unless](#method-unless)\n" +"[unlessEmpty](#method-unlessempty)\n" +"[unlessNotEmpty](#method-unlessnotempty)\n" +"[unwrap](#method-unwrap)\n" +"[values](#method-values)\n" +"[when](#method-when)\n" +"[whenEmpty](#method-whenempty)\n" +"[whenNotEmpty](#method-whennotempty)\n" +"[where](#method-where)\n" +"[whereStrict](#method-wherestrict)\n" +"[whereBetween](#method-wherebetween)\n" +"[whereIn](#method-wherein)\n" +"[whereInStrict](#method-whereinstrict)\n" +"[whereInstanceOf](#method-whereinstanceof)\n" +"[whereNotBetween](#method-wherenotbetween)\n" +"[whereNotIn](#method-wherenotin)\n" +"[whereNotInStrict](#method-wherenotinstrict)\n" +"[whereNotNull](#method-wherenotnull)\n" +"[whereNull](#method-wherenull)\n" +"[wrap](#method-wrap)\n" +"[zip](#method-zip)" +msgstr "" -#: docs/10.x/collections.md:block 27 (paragraph) -msgid "[all](#method-all) [average](#method-average) [avg](#method-avg) [chunk](#method-chunk) [chunkWhile](#method-chunkwhile) [collapse](#method-collapse) [collect](#method-collect) [combine](#method-combine) [concat](#method-concat) [contains](#method-contains) [containsOneItem](#method-containsoneitem) [containsStrict](#method-containsstrict) [count](#method-count) [countBy](#method-countBy) [crossJoin](#method-crossjoin) [dd](#method-dd) [diff](#method-diff) [diffAssoc](#method-diffassoc) [diffAssocUsing](#method-diffassocusing) [diffKeys](#method-diffkeys) [doesntContain](#method-doesntcontain) [dot](#method-dot) [dump](#method-dump) [duplicates](#method-duplicates) [duplicatesStrict](#method-duplicatesstrict) [each](#method-each) [eachSpread](#method-eachspread) [ensure](#method-ensure) [every](#method-every) [except](#method-except) [filter](#method-filter) [first](#method-first) [firstOrFail](#method-first-or-fail) [firstWhere](#method-first-where) [flatMap](#method-flatmap) [flatten](#method-flatten) [flip](#method-flip) [forget](#method-forget) [forPage](#method-forpage) [get](#method-get) [groupBy](#method-groupby) [has](#method-has) [hasAny](#method-hasany) [implode](#method-implode) [intersect](#method-intersect) [intersectAssoc](#method-intersectAssoc) [intersectByKeys](#method-intersectbykeys) [isEmpty](#method-isempty) [isNotEmpty](#method-isnotempty) [join](#method-join) [keyBy](#method-keyby) [keys](#method-keys) [last](#method-last) [lazy](#method-lazy) [macro](#method-macro) [make](#method-make) [map](#method-map) [mapInto](#method-mapinto) [mapSpread](#method-mapspread) [mapToGroups](#method-maptogroups) [mapWithKeys](#method-mapwithkeys) [max](#method-max) [median](#method-median) [merge](#method-merge) [mergeRecursive](#method-mergerecursive) [min](#method-min) [mode](#method-mode) [nth](#method-nth) [only](#method-only) [pad](#method-pad) [partition](#method-partition) [percentage](#method-percentage) [pipe](#method-pipe) [pipeInto](#method-pipeinto) [pipeThrough](#method-pipethrough) [pluck](#method-pluck) [pop](#method-pop) [prepend](#method-prepend) [pull](#method-pull) [push](#method-push) [put](#method-put) [random](#method-random) [range](#method-range) [reduce](#method-reduce) [reduceSpread](#method-reduce-spread) [reject](#method-reject) [replace](#method-replace) [replaceRecursive](#method-replacerecursive) [reverse](#method-reverse) [search](#method-search) [shift](#method-shift) [shuffle](#method-shuffle) [skip](#method-skip) [skipUntil](#method-skipuntil) [skipWhile](#method-skipwhile) [slice](#method-slice) [sliding](#method-sliding) [sole](#method-sole) [some](#method-some) [sort](#method-sort) [sortBy](#method-sortby) [sortByDesc](#method-sortbydesc) [sortDesc](#method-sortdesc) [sortKeys](#method-sortkeys) [sortKeysDesc](#method-sortkeysdesc) [sortKeysUsing](#method-sortkeysusing) [splice](#method-splice) [split](#method-split) [splitIn](#method-splitin) [sum](#method-sum) [take](#method-take) [takeUntil](#method-takeuntil) [takeWhile](#method-takewhile) [tap](#method-tap) [times](#method-times) [toArray](#method-toarray) [toJson](#method-tojson) [transform](#method-transform) [undot](#method-undot) [union](#method-union) [unique](#method-unique) [uniqueStrict](#method-uniquestrict) [unless](#method-unless) [unlessEmpty](#method-unlessempty) [unlessNotEmpty](#method-unlessnotempty) [unwrap](#method-unwrap) [value](#method-value) [values](#method-values) [when](#method-when) [whenEmpty](#method-whenempty) [whenNotEmpty](#method-whennotempty) [where](#method-where) [whereStrict](#method-wherestrict) [whereBetween](#method-wherebetween) [whereIn](#method-wherein) [whereInStrict](#method-whereinstrict) [whereInstanceOf](#method-whereinstanceof) [whereNotBetween](#method-wherenotbetween) [whereNotIn](#method-wherenotin) [whereNotInStrict](#method-wherenotinstrict) [whereNotNull](#method-wherenotnull) [whereNull](#method-wherenull) [wrap](#method-wrap) [zip](#method-zip)" -msgstr "[all](#method-all) [average](#method-average) [avg](#method-avg) [chunk](#method-chunk) [chunkWhile](#method-chunkwhile) [collapse](#method-collapse) [collect](#method-collect) [combine](#method-combine) [concat](#method-concat) [contains](#method-contains) [containsOneItem](#method-containsoneitem) [containsStrict](#method-containsstrict) [count](#method-count) [countBy](#method-countBy) [crossJoin](#method-crossjoin) [dd](#method-dd) [diff](#method-diff) [diffAssoc](#method-diffassoc) [diffAssocUsing](#method-diffassocusing) [diffKeys](#method-diffkeys) [doesntContain](#method-doesntcontain) [dot](#method-dot) [dump](#method-dump) [duplicates](#method-duplicates) [duplicatesStrict](#method-duplicatesstrict) [each](#method-each) [eachSpread](#method-eachspread) [ensure](#method-ensure) [every](#method-every) [except](#method-except) [filter](#method-filter) [first](#method-first) [firstOrFail](#method-first-or-fail) [firstWhere](#method-first-where) [flatMap](#method-flatmap) [flatten](#method-flatten) [flip](#method-flip) [forget](#method-forget) [forPage](#method-forpage) [get](#method-get) [groupBy](#method-groupby) [has](#method-has) [hasAny](#method-hasany) [implode](#method-implode) [intersect](#method-intersect) [intersectAssoc](#method-intersectAssoc) [intersectByKeys](#method-intersectbykeys) [isEmpty](#method-isempty) [isNotEmpty](#method-isnotempty) [join](#method-join) [keyBy](#method-keyby) [keys](#method-keys) [last](#method-last) [lazy](#method-lazy) [macro](#method-macro) [make](#method-make) [map](#method-map) [mapInto](#method-mapinto) [mapSpread](#method-mapspread) [mapToGroups](#method-maptogroups) [mapWithKeys](#method-mapwithkeys) [max](#method-max) [median](#method-median) [merge](#method-merge) [mergeRecursive](#method-mergerecursive) [min](#method-min) [mode](#method-mode) [nth](#method-nth) [only](#method-only) [pad](#method-pad) [partition](#method-partition) [percentage](#method-percentage) [pipe](#method-pipe) [pipeInto](#method-pipeinto) [pipeThrough](#method-pipethrough) [pluck](#method-pluck) [pop](#method-pop) [prepend](#method-prepend) [pull](#method-pull) [push](#method-push) [put](#method-put) [random](#method-random) [range](#method-range) [reduce](#method-reduce) [reduceSpread](#method-reduce-spread) [reject](#method-reject) [replace](#method-replace) [replaceRecursive](#method-replacerecursive) [reverse](#method-reverse) [search](#method-search) [shift](#method-shift) [shuffle](#method-shuffle) [skip](#method-skip) [skipUntil](#method-skipuntil) [skipWhile](#method-skipwhile) [slice](#method-slice) [sliding](#method-sliding) [sole](#method-sole) [some](#method-some) [sort](#method-sort) [sortBy](#method-sortby) [sortByDesc](#method-sortbydesc) [sortDesc](#method-sortdesc) [sortKeys](#method-sortkeys) [sortKeysDesc](#method-sortkeysdesc) [sortKeysUsing](#method-sortkeysusing) [splice](#method-splice) [split](#method-split) [splitIn](#method-splitin) [sum](#method-sum) [take](#method-take) [takeUntil](#method-takeuntil) [takeWhile](#method-takewhile) [tap](#method-tap) [times](#method-times) [toArray](#method-toarray) [toJson](#method-tojson) [transform](#method-transform) [undot](#method-undot) [union](#method-union) [unique](#method-unique) [uniqueStrict](#method-uniquestrict) [unless](#method-unless) [unlessEmpty](#method-unlessempty) [unlessNotEmpty](#method-unlessnotempty) [unwrap](#method-unwrap) [value](#method-value) [values](#method-values) [when](#method-when) [whenEmpty](#method-whenempty) [whenNotEmpty](#method-whennotempty) [where](#method-where) [whereStrict](#method-wherestrict) [whereBetween](#method-wherebetween) [whereIn](#method-wherein) [whereInStrict](#method-whereinstrict) [whereInstanceOf](#method-whereinstanceof) [whereNotBetween](#method-wherenotbetween) [whereNotIn](#method-wherenotin) [whereNotInStrict](#method-wherenotinstrict) [whereNotNull](#method-wherenotnull) [whereNull](#method-wherenull) [wrap](#method-wrap) [zip](#method-zip)" +# P +#: ./docs/10.x/collections.md:97 +#: ./docs/master/collections.md:97 +msgid "[all](#method-all)\n" +"[average](#method-average)\n" +"[avg](#method-avg)\n" +"[chunk](#method-chunk)\n" +"[chunkWhile](#method-chunkwhile)\n" +"[collapse](#method-collapse)\n" +"[collect](#method-collect)\n" +"[combine](#method-combine)\n" +"[concat](#method-concat)\n" +"[contains](#method-contains)\n" +"[containsOneItem](#method-containsoneitem)\n" +"[containsStrict](#method-containsstrict)\n" +"[count](#method-count)\n" +"[countBy](#method-countBy)\n" +"[crossJoin](#method-crossjoin)\n" +"[dd](#method-dd)\n" +"[diff](#method-diff)\n" +"[diffAssoc](#method-diffassoc)\n" +"[diffAssocUsing](#method-diffassocusing)\n" +"[diffKeys](#method-diffkeys)\n" +"[doesntContain](#method-doesntcontain)\n" +"[dot](#method-dot)\n" +"[dump](#method-dump)\n" +"[duplicates](#method-duplicates)\n" +"[duplicatesStrict](#method-duplicatesstrict)\n" +"[each](#method-each)\n" +"[eachSpread](#method-eachspread)\n" +"[ensure](#method-ensure)\n" +"[every](#method-every)\n" +"[except](#method-except)\n" +"[filter](#method-filter)\n" +"[first](#method-first)\n" +"[firstOrFail](#method-first-or-fail)\n" +"[firstWhere](#method-first-where)\n" +"[flatMap](#method-flatmap)\n" +"[flatten](#method-flatten)\n" +"[flip](#method-flip)\n" +"[forget](#method-forget)\n" +"[forPage](#method-forpage)\n" +"[get](#method-get)\n" +"[groupBy](#method-groupby)\n" +"[has](#method-has)\n" +"[hasAny](#method-hasany)\n" +"[implode](#method-implode)\n" +"[intersect](#method-intersect)\n" +"[intersectAssoc](#method-intersectAssoc)\n" +"[intersectByKeys](#method-intersectbykeys)\n" +"[isEmpty](#method-isempty)\n" +"[isNotEmpty](#method-isnotempty)\n" +"[join](#method-join)\n" +"[keyBy](#method-keyby)\n" +"[keys](#method-keys)\n" +"[last](#method-last)\n" +"[lazy](#method-lazy)\n" +"[macro](#method-macro)\n" +"[make](#method-make)\n" +"[map](#method-map)\n" +"[mapInto](#method-mapinto)\n" +"[mapSpread](#method-mapspread)\n" +"[mapToGroups](#method-maptogroups)\n" +"[mapWithKeys](#method-mapwithkeys)\n" +"[max](#method-max)\n" +"[median](#method-median)\n" +"[merge](#method-merge)\n" +"[mergeRecursive](#method-mergerecursive)\n" +"[min](#method-min)\n" +"[mode](#method-mode)\n" +"[nth](#method-nth)\n" +"[only](#method-only)\n" +"[pad](#method-pad)\n" +"[partition](#method-partition)\n" +"[percentage](#method-percentage)\n" +"[pipe](#method-pipe)\n" +"[pipeInto](#method-pipeinto)\n" +"[pipeThrough](#method-pipethrough)\n" +"[pluck](#method-pluck)\n" +"[pop](#method-pop)\n" +"[prepend](#method-prepend)\n" +"[pull](#method-pull)\n" +"[push](#method-push)\n" +"[put](#method-put)\n" +"[random](#method-random)\n" +"[range](#method-range)\n" +"[reduce](#method-reduce)\n" +"[reduceSpread](#method-reduce-spread)\n" +"[reject](#method-reject)\n" +"[replace](#method-replace)\n" +"[replaceRecursive](#method-replacerecursive)\n" +"[reverse](#method-reverse)\n" +"[search](#method-search)\n" +"[select](#method-select)\n" +"[shift](#method-shift)\n" +"[shuffle](#method-shuffle)\n" +"[skip](#method-skip)\n" +"[skipUntil](#method-skipuntil)\n" +"[skipWhile](#method-skipwhile)\n" +"[slice](#method-slice)\n" +"[sliding](#method-sliding)\n" +"[sole](#method-sole)\n" +"[some](#method-some)\n" +"[sort](#method-sort)\n" +"[sortBy](#method-sortby)\n" +"[sortByDesc](#method-sortbydesc)\n" +"[sortDesc](#method-sortdesc)\n" +"[sortKeys](#method-sortkeys)\n" +"[sortKeysDesc](#method-sortkeysdesc)\n" +"[sortKeysUsing](#method-sortkeysusing)\n" +"[splice](#method-splice)\n" +"[split](#method-split)\n" +"[splitIn](#method-splitin)\n" +"[sum](#method-sum)\n" +"[take](#method-take)\n" +"[takeUntil](#method-takeuntil)\n" +"[takeWhile](#method-takewhile)\n" +"[tap](#method-tap)\n" +"[times](#method-times)\n" +"[toArray](#method-toarray)\n" +"[toJson](#method-tojson)\n" +"[transform](#method-transform)\n" +"[undot](#method-undot)\n" +"[union](#method-union)\n" +"[unique](#method-unique)\n" +"[uniqueStrict](#method-uniquestrict)\n" +"[unless](#method-unless)\n" +"[unlessEmpty](#method-unlessempty)\n" +"[unlessNotEmpty](#method-unlessnotempty)\n" +"[unwrap](#method-unwrap)\n" +"[value](#method-value)\n" +"[values](#method-values)\n" +"[when](#method-when)\n" +"[whenEmpty](#method-whenempty)\n" +"[whenNotEmpty](#method-whennotempty)\n" +"[where](#method-where)\n" +"[whereStrict](#method-wherestrict)\n" +"[whereBetween](#method-wherebetween)\n" +"[whereIn](#method-wherein)\n" +"[whereInStrict](#method-whereinstrict)\n" +"[whereInstanceOf](#method-whereinstanceof)\n" +"[whereNotBetween](#method-wherenotbetween)\n" +"[whereNotIn](#method-wherenotin)\n" +"[whereNotInStrict](#method-wherenotinstrict)\n" +"[whereNotNull](#method-wherenotnull)\n" +"[whereNull](#method-wherenull)\n" +"[wrap](#method-wrap)\n" +"[zip](#method-zip)" +msgstr "" + +# P +#: ./docs/11.x/collections.md:97 +msgid "[after](#method-after)\n" +"[all](#method-all)\n" +"[average](#method-average)\n" +"[avg](#method-avg)\n" +"[before](#method-before)\n" +"[chunk](#method-chunk)\n" +"[chunkWhile](#method-chunkwhile)\n" +"[collapse](#method-collapse)\n" +"[collect](#method-collect)\n" +"[combine](#method-combine)\n" +"[concat](#method-concat)\n" +"[contains](#method-contains)\n" +"[containsOneItem](#method-containsoneitem)\n" +"[containsStrict](#method-containsstrict)\n" +"[count](#method-count)\n" +"[countBy](#method-countBy)\n" +"[crossJoin](#method-crossjoin)\n" +"[dd](#method-dd)\n" +"[diff](#method-diff)\n" +"[diffAssoc](#method-diffassoc)\n" +"[diffAssocUsing](#method-diffassocusing)\n" +"[diffKeys](#method-diffkeys)\n" +"[doesntContain](#method-doesntcontain)\n" +"[dot](#method-dot)\n" +"[dump](#method-dump)\n" +"[duplicates](#method-duplicates)\n" +"[duplicatesStrict](#method-duplicatesstrict)\n" +"[each](#method-each)\n" +"[eachSpread](#method-eachspread)\n" +"[ensure](#method-ensure)\n" +"[every](#method-every)\n" +"[except](#method-except)\n" +"[filter](#method-filter)\n" +"[first](#method-first)\n" +"[firstOrFail](#method-first-or-fail)\n" +"[firstWhere](#method-first-where)\n" +"[flatMap](#method-flatmap)\n" +"[flatten](#method-flatten)\n" +"[flip](#method-flip)\n" +"[forget](#method-forget)\n" +"[forPage](#method-forpage)\n" +"[get](#method-get)\n" +"[groupBy](#method-groupby)\n" +"[has](#method-has)\n" +"[hasAny](#method-hasany)\n" +"[implode](#method-implode)\n" +"[intersect](#method-intersect)\n" +"[intersectAssoc](#method-intersectAssoc)\n" +"[intersectByKeys](#method-intersectbykeys)\n" +"[isEmpty](#method-isempty)\n" +"[isNotEmpty](#method-isnotempty)\n" +"[join](#method-join)\n" +"[keyBy](#method-keyby)\n" +"[keys](#method-keys)\n" +"[last](#method-last)\n" +"[lazy](#method-lazy)\n" +"[macro](#method-macro)\n" +"[make](#method-make)\n" +"[map](#method-map)\n" +"[mapInto](#method-mapinto)\n" +"[mapSpread](#method-mapspread)\n" +"[mapToGroups](#method-maptogroups)\n" +"[mapWithKeys](#method-mapwithkeys)\n" +"[max](#method-max)\n" +"[median](#method-median)\n" +"[merge](#method-merge)\n" +"[mergeRecursive](#method-mergerecursive)\n" +"[min](#method-min)\n" +"[mode](#method-mode)\n" +"[multiply](#method-multiply)\n" +"[nth](#method-nth)\n" +"[only](#method-only)\n" +"[pad](#method-pad)\n" +"[partition](#method-partition)\n" +"[percentage](#method-percentage)\n" +"[pipe](#method-pipe)\n" +"[pipeInto](#method-pipeinto)\n" +"[pipeThrough](#method-pipethrough)\n" +"[pluck](#method-pluck)\n" +"[pop](#method-pop)\n" +"[prepend](#method-prepend)\n" +"[pull](#method-pull)\n" +"[push](#method-push)\n" +"[put](#method-put)\n" +"[random](#method-random)\n" +"[range](#method-range)\n" +"[reduce](#method-reduce)\n" +"[reduceSpread](#method-reduce-spread)\n" +"[reject](#method-reject)\n" +"[replace](#method-replace)\n" +"[replaceRecursive](#method-replacerecursive)\n" +"[reverse](#method-reverse)\n" +"[search](#method-search)\n" +"[select](#method-select)\n" +"[shift](#method-shift)\n" +"[shuffle](#method-shuffle)\n" +"[skip](#method-skip)\n" +"[skipUntil](#method-skipuntil)\n" +"[skipWhile](#method-skipwhile)\n" +"[slice](#method-slice)\n" +"[sliding](#method-sliding)\n" +"[sole](#method-sole)\n" +"[some](#method-some)\n" +"[sort](#method-sort)\n" +"[sortBy](#method-sortby)\n" +"[sortByDesc](#method-sortbydesc)\n" +"[sortDesc](#method-sortdesc)\n" +"[sortKeys](#method-sortkeys)\n" +"[sortKeysDesc](#method-sortkeysdesc)\n" +"[sortKeysUsing](#method-sortkeysusing)\n" +"[splice](#method-splice)\n" +"[split](#method-split)\n" +"[splitIn](#method-splitin)\n" +"[sum](#method-sum)\n" +"[take](#method-take)\n" +"[takeUntil](#method-takeuntil)\n" +"[takeWhile](#method-takewhile)\n" +"[tap](#method-tap)\n" +"[times](#method-times)\n" +"[toArray](#method-toarray)\n" +"[toJson](#method-tojson)\n" +"[transform](#method-transform)\n" +"[undot](#method-undot)\n" +"[union](#method-union)\n" +"[unique](#method-unique)\n" +"[uniqueStrict](#method-uniquestrict)\n" +"[unless](#method-unless)\n" +"[unlessEmpty](#method-unlessempty)\n" +"[unlessNotEmpty](#method-unlessnotempty)\n" +"[unwrap](#method-unwrap)\n" +"[value](#method-value)\n" +"[values](#method-values)\n" +"[when](#method-when)\n" +"[whenEmpty](#method-whenempty)\n" +"[whenNotEmpty](#method-whennotempty)\n" +"[where](#method-where)\n" +"[whereStrict](#method-wherestrict)\n" +"[whereBetween](#method-wherebetween)\n" +"[whereIn](#method-wherein)\n" +"[whereInStrict](#method-whereinstrict)\n" +"[whereInstanceOf](#method-whereinstanceof)\n" +"[whereNotBetween](#method-wherenotbetween)\n" +"[whereNotIn](#method-wherenotin)\n" +"[whereNotInStrict](#method-wherenotinstrict)\n" +"[whereNotNull](#method-wherenotnull)\n" +"[whereNull](#method-wherenull)\n" +"[wrap](#method-wrap)\n" +"[zip](#method-zip)" +msgstr "" + +# P +#: ./docs/9.x/collections.md:97 +msgid "[all](#method-all)\n" +"[average](#method-average)\n" +"[avg](#method-avg)\n" +"[chunk](#method-chunk)\n" +"[chunkWhile](#method-chunkwhile)\n" +"[collapse](#method-collapse)\n" +"[collect](#method-collect)\n" +"[combine](#method-combine)\n" +"[concat](#method-concat)\n" +"[contains](#method-contains)\n" +"[containsOneItem](#method-containsoneitem)\n" +"[containsStrict](#method-containsstrict)\n" +"[count](#method-count)\n" +"[countBy](#method-countBy)\n" +"[crossJoin](#method-crossjoin)\n" +"[dd](#method-dd)\n" +"[diff](#method-diff)\n" +"[diffAssoc](#method-diffassoc)\n" +"[diffKeys](#method-diffkeys)\n" +"[doesntContain](#method-doesntcontain)\n" +"[dump](#method-dump)\n" +"[duplicates](#method-duplicates)\n" +"[duplicatesStrict](#method-duplicatesstrict)\n" +"[each](#method-each)\n" +"[eachSpread](#method-eachspread)\n" +"[every](#method-every)\n" +"[except](#method-except)\n" +"[filter](#method-filter)\n" +"[first](#method-first)\n" +"[firstOrFail](#method-first-or-fail)\n" +"[firstWhere](#method-first-where)\n" +"[flatMap](#method-flatmap)\n" +"[flatten](#method-flatten)\n" +"[flip](#method-flip)\n" +"[forget](#method-forget)\n" +"[forPage](#method-forpage)\n" +"[get](#method-get)\n" +"[groupBy](#method-groupby)\n" +"[has](#method-has)\n" +"[hasAny](#method-hasany)\n" +"[implode](#method-implode)\n" +"[intersect](#method-intersect)\n" +"[intersectByKeys](#method-intersectbykeys)\n" +"[isEmpty](#method-isempty)\n" +"[isNotEmpty](#method-isnotempty)\n" +"[join](#method-join)\n" +"[keyBy](#method-keyby)\n" +"[keys](#method-keys)\n" +"[last](#method-last)\n" +"[lazy](#method-lazy)\n" +"[macro](#method-macro)\n" +"[make](#method-make)\n" +"[map](#method-map)\n" +"[mapInto](#method-mapinto)\n" +"[mapSpread](#method-mapspread)\n" +"[mapToGroups](#method-maptogroups)\n" +"[mapWithKeys](#method-mapwithkeys)\n" +"[max](#method-max)\n" +"[median](#method-median)\n" +"[merge](#method-merge)\n" +"[mergeRecursive](#method-mergerecursive)\n" +"[min](#method-min)\n" +"[mode](#method-mode)\n" +"[nth](#method-nth)\n" +"[only](#method-only)\n" +"[pad](#method-pad)\n" +"[partition](#method-partition)\n" +"[pipe](#method-pipe)\n" +"[pipeInto](#method-pipeinto)\n" +"[pipeThrough](#method-pipethrough)\n" +"[pluck](#method-pluck)\n" +"[pop](#method-pop)\n" +"[prepend](#method-prepend)\n" +"[pull](#method-pull)\n" +"[push](#method-push)\n" +"[put](#method-put)\n" +"[random](#method-random)\n" +"[range](#method-range)\n" +"[reduce](#method-reduce)\n" +"[reduceSpread](#method-reduce-spread)\n" +"[reject](#method-reject)\n" +"[replace](#method-replace)\n" +"[replaceRecursive](#method-replacerecursive)\n" +"[reverse](#method-reverse)\n" +"[search](#method-search)\n" +"[shift](#method-shift)\n" +"[shuffle](#method-shuffle)\n" +"[skip](#method-skip)\n" +"[skipUntil](#method-skipuntil)\n" +"[skipWhile](#method-skipwhile)\n" +"[slice](#method-slice)\n" +"[sliding](#method-sliding)\n" +"[sole](#method-sole)\n" +"[some](#method-some)\n" +"[sort](#method-sort)\n" +"[sortBy](#method-sortby)\n" +"[sortByDesc](#method-sortbydesc)\n" +"[sortDesc](#method-sortdesc)\n" +"[sortKeys](#method-sortkeys)\n" +"[sortKeysDesc](#method-sortkeysdesc)\n" +"[sortKeysUsing](#method-sortkeysusing)\n" +"[splice](#method-splice)\n" +"[split](#method-split)\n" +"[splitIn](#method-splitin)\n" +"[sum](#method-sum)\n" +"[take](#method-take)\n" +"[takeUntil](#method-takeuntil)\n" +"[takeWhile](#method-takewhile)\n" +"[tap](#method-tap)\n" +"[times](#method-times)\n" +"[toArray](#method-toarray)\n" +"[toJson](#method-tojson)\n" +"[transform](#method-transform)\n" +"[undot](#method-undot)\n" +"[union](#method-union)\n" +"[unique](#method-unique)\n" +"[uniqueStrict](#method-uniquestrict)\n" +"[unless](#method-unless)\n" +"[unlessEmpty](#method-unlessempty)\n" +"[unlessNotEmpty](#method-unlessnotempty)\n" +"[unwrap](#method-unwrap)\n" +"[value](#method-value)\n" +"[values](#method-values)\n" +"[when](#method-when)\n" +"[whenEmpty](#method-whenempty)\n" +"[whenNotEmpty](#method-whennotempty)\n" +"[where](#method-where)\n" +"[whereStrict](#method-wherestrict)\n" +"[whereBetween](#method-wherebetween)\n" +"[whereIn](#method-wherein)\n" +"[whereInStrict](#method-whereinstrict)\n" +"[whereInstanceOf](#method-whereinstanceof)\n" +"[whereNotBetween](#method-wherenotbetween)\n" +"[whereNotIn](#method-wherenotin)\n" +"[whereNotInStrict](#method-wherenotinstrict)\n" +"[whereNotNull](#method-wherenotnull)\n" +"[whereNull](#method-wherenull)\n" +"[wrap](#method-wrap)\n" +"[zip](#method-zip)" +msgstr "" -#: docs/10.x/collections.md:block 30 (header) +# P +#: ./docs/8.x/collections.md:231 +#: ./docs/9.x/collections.md:239 +#: ./docs/10.x/collections.md:245 +#: ./docs/11.x/collections.md:248 +#: ./docs/master/collections.md:245 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/collections.md:232 +#: ./docs/9.x/collections.md:240 +#: ./docs/10.x/collections.md:246 +#: ./docs/11.x/collections.md:249 +#: ./docs/master/collections.md:246 msgid "Method Listing" -msgstr "方法列表" +msgstr "" -#: docs/10.x/collections.md:block 33 (header) +# P +#: ./docs/8.x/collections.md:244 +#: ./docs/9.x/collections.md:252 +#: ./docs/10.x/collections.md:258 +#: ./docs/11.x/collections.md:290 +#: ./docs/master/collections.md:258 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:245 +#: ./docs/9.x/collections.md:253 +#: ./docs/10.x/collections.md:259 +#: ./docs/master/collections.md:259 msgid "`all()` {.collection-method .first-collection-method}" -msgstr "`all()` {.collection-method .first-collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 34 (paragraph) +# P +#: ./docs/8.x/collections.md:247 +#: ./docs/9.x/collections.md:255 +#: ./docs/10.x/collections.md:261 +#: ./docs/11.x/collections.md:293 +#: ./docs/master/collections.md:261 msgid "The `all` method returns the underlying array represented by the collection:" -msgstr "`all` 方法會回傳該 Collection 所代表的底層陣列:" +msgstr "" -#: docs/10.x/collections.md:block 35 (code) +# CODE +#: ./docs/8.x/collections.md:249 +#: ./docs/9.x/collections.md:257 +#: ./docs/10.x/collections.md:263 +#: ./docs/11.x/collections.md:295 +#: ./docs/master/collections.md:263 msgid "collect([1, 2, 3])->all();\n\n" -"// [1, 2, 3]\n" -msgstr "collect([1, 2, 3])->all();\n\n" -"// [1, 2, 3]\n" +"// [1, 2, 3]" +msgstr "" -#: docs/10.x/collections.md:block 37 (header) +# P +#: ./docs/8.x/collections.md:253 +#: ./docs/9.x/collections.md:261 +#: ./docs/10.x/collections.md:267 +#: ./docs/11.x/collections.md:299 +#: ./docs/master/collections.md:267 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:254 +#: ./docs/9.x/collections.md:262 +#: ./docs/10.x/collections.md:268 +#: ./docs/11.x/collections.md:300 +#: ./docs/master/collections.md:268 msgid "`average()` {.collection-method}" -msgstr "`average()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 38 (paragraph) +# P +#: ./docs/8.x/collections.md:256 +#: ./docs/9.x/collections.md:264 +#: ./docs/10.x/collections.md:270 +#: ./docs/11.x/collections.md:302 +#: ./docs/master/collections.md:270 msgid "Alias for the [`avg`](#method-avg) method." -msgstr "[`avg`](#method-avg) 方法的別名。" +msgstr "" -#: docs/10.x/collections.md:block 40 (header) +# P +#: ./docs/8.x/collections.md:258 +#: ./docs/9.x/collections.md:266 +#: ./docs/10.x/collections.md:272 +#: ./docs/11.x/collections.md:304 +#: ./docs/master/collections.md:272 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:259 +#: ./docs/9.x/collections.md:267 +#: ./docs/10.x/collections.md:273 +#: ./docs/11.x/collections.md:305 +#: ./docs/master/collections.md:273 msgid "`avg()` {.collection-method}" -msgstr "`avg()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 41 (paragraph) +# P +#: ./docs/11.x/collections.md:261 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/collections.md:261 +#: ./docs/9.x/collections.md:269 +#: ./docs/10.x/collections.md:275 +#: ./docs/11.x/collections.md:307 +#: ./docs/master/collections.md:275 msgid "The `avg` method returns the [average value](https://en.wikipedia.org/wiki/Average) of a given key:" -msgstr "`avg` 方法會回傳給定索引鍵的[平均值](https://zh.wikipedia.org/zh-tw/%E5%B9%B3%E5%9D%87%E6%95%B0):" +msgstr "" + +# H4 +#: ./docs/11.x/collections.md:262 +msgid "`after()` {.collection-method .first-collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 42 (code) +# CODE +#: ./docs/8.x/collections.md:263 +#: ./docs/9.x/collections.md:271 +#: ./docs/10.x/collections.md:277 +#: ./docs/11.x/collections.md:309 +#: ./docs/master/collections.md:277 msgid "$average = collect([\n" " ['foo' => 10],\n" " ['foo' => 10],\n" @@ -213,86 +1084,180 @@ msgid "$average = collect([\n" "])->avg('foo');\n\n" "// 20\n\n" "$average = collect([1, 1, 2, 4])->avg();\n\n" -"// 2\n" -msgstr "$average = collect([\n" -" ['foo' => 10],\n" -" ['foo' => 10],\n" -" ['foo' => 20],\n" -" ['foo' => 40]\n" -"])->avg('foo');\n\n" -"// 20\n\n" -"$average = collect([1, 1, 2, 4])->avg();\n\n" -"// 2\n" +"// 2" +msgstr "" + +# P +#: ./docs/11.x/collections.md:264 +msgid "The `after` method returns the item after the given item. `null` is returned if the given item is not found or is the last item:" +msgstr "" + +# CODE +#: ./docs/11.x/collections.md:266 +msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" +"$collection->after(3);\n\n" +"// 4\n\n" +"$collection->after(5);\n\n" +"// null" +msgstr "" + +# P +#: ./docs/11.x/collections.md:276 +msgid "This method searches for the given item using \"loose\" comparison, meaning a string containing an integer value will be considered equal to an integer of the same value. To use \"strict\" comparison, you may provide the `strict` argument to the method:" +msgstr "" -#: docs/10.x/collections.md:block 44 (header) +# P +#: ./docs/8.x/collections.md:276 +#: ./docs/9.x/collections.md:284 +#: ./docs/10.x/collections.md:290 +#: ./docs/11.x/collections.md:347 +#: ./docs/master/collections.md:290 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:277 +#: ./docs/9.x/collections.md:285 +#: ./docs/10.x/collections.md:291 +#: ./docs/11.x/collections.md:348 +#: ./docs/master/collections.md:291 msgid "`chunk()` {.collection-method}" -msgstr "`chunk()` {.collection-method}" +msgstr "" + +# CODE +#: ./docs/11.x/collections.md:278 +msgid "collect([2, 4, 6, 8])->after('4', strict: true);\n\n" +"// null" +msgstr "" -#: docs/10.x/collections.md:block 45 (paragraph) +# P +#: ./docs/8.x/collections.md:279 +#: ./docs/9.x/collections.md:287 +#: ./docs/10.x/collections.md:293 +#: ./docs/11.x/collections.md:350 +#: ./docs/master/collections.md:293 msgid "The `chunk` method breaks the collection into multiple, smaller collections of a given size:" -msgstr "`chunk` 方法會將該 Collection 以給定的大小拆分為多個較小的 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 46 (code) +# CODE +#: ./docs/8.x/collections.md:281 +#: ./docs/9.x/collections.md:289 +#: ./docs/10.x/collections.md:295 +#: ./docs/11.x/collections.md:352 +#: ./docs/master/collections.md:295 msgid "$collection = collect([1, 2, 3, 4, 5, 6, 7]);\n\n" "$chunks = $collection->chunk(4);\n\n" "$chunks->all();\n\n" -"// [[1, 2, 3, 4], [5, 6, 7]]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5, 6, 7]);\n\n" -"$chunks = $collection->chunk(4);\n\n" -"$chunks->all();\n\n" -"// [[1, 2, 3, 4], [5, 6, 7]]\n" +"// [[1, 2, 3, 4], [5, 6, 7]]" +msgstr "" + +# CODE +#: ./docs/11.x/collections.md:284 +msgid "collect([2, 4, 6, 8])->after(function (int $item, int $key) {\n" +" return $item > 5;\n" +"});\n\n" +"// 8" +msgstr "" -#: docs/10.x/collections.md:block 47 (paragraph) +# P +#: ./docs/8.x/collections.md:289 +#: ./docs/9.x/collections.md:297 +#: ./docs/10.x/collections.md:303 msgid "This method is especially useful in [views](/docs/{{version}}/views) when working with a grid system such as [Bootstrap](https://getbootstrap.com/docs/4.1/layout/grid/). For example, imagine you have a collection of [Eloquent](/docs/{{version}}/eloquent) models you want to display in a grid:" -msgstr "此方法特別適合用在 [View](/docs/{{version}}/views) 內,配合如 [Bootstrap](https://getbootstrap.com/docs/4.1/layout/grid/) 等網格系統一起使用。舉例來說,假設我們有一個 [Eloquent](/docs/{{version}}/eloquent) 模型的 Collection 想要在網格上顯示:" +msgstr "" -#: docs/10.x/collections.md:block 48 (code) +# H4 +#: ./docs/11.x/collections.md:291 +msgid "`all()` {.collection-method}" +msgstr "" + +# CODE +# CODE: blade +#: ./docs/8.x/collections.md:291 +#: ./docs/9.x/collections.md:299 +#: ./docs/10.x/collections.md:305 +#: ./docs/11.x/collections.md:362 +#: ./docs/master/collections.md:305 msgid "@foreach ($products->chunk(3) as $chunk)\n" "
    \n" " @foreach ($chunk as $product)\n" "
    {{ $product->name }}
    \n" " @endforeach\n" "
    \n" -"@endforeach\n" -msgstr "@foreach ($products->chunk(3) as $chunk)\n" -"
    \n" -" @foreach ($chunk as $product)\n" -"
    {{ $product->name }}
    \n" -" @endforeach\n" -"
    \n" -"@endforeach\n" +"@endforeach" +msgstr "" -#: docs/10.x/collections.md:block 50 (header) +# P +#: ./docs/8.x/collections.md:299 +#: ./docs/9.x/collections.md:309 +#: ./docs/10.x/collections.md:315 +#: ./docs/11.x/collections.md:372 +#: ./docs/master/collections.md:315 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:300 +#: ./docs/9.x/collections.md:310 +#: ./docs/10.x/collections.md:316 +#: ./docs/11.x/collections.md:373 +#: ./docs/master/collections.md:316 msgid "`chunkWhile()` {.collection-method}" -msgstr "`chunkWhile()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 51 (paragraph) +# P +#: ./docs/8.x/collections.md:302 +#: ./docs/9.x/collections.md:312 +#: ./docs/10.x/collections.md:318 +#: ./docs/11.x/collections.md:375 +#: ./docs/master/collections.md:318 msgid "The `chunkWhile` method breaks the collection into multiple, smaller collections based on the evaluation of the given callback. The `$chunk` variable passed to the closure may be used to inspect the previous element:" -msgstr "`chunkWhile` 方法會依照給定回呼的取值結果來將 Collection 拆分為多個更小的 Collection。傳入閉包的 `$chunk` 變數可用來檢視上一個元素:" +msgstr "" -#: docs/10.x/collections.md:block 52 (code) +# CODE +#: ./docs/8.x/collections.md:304 +#: ./docs/9.x/collections.md:314 msgid "$collection = collect(str_split('AABBCCCD'));\n\n" -"$chunks = $collection->chunkWhile(function (string $value, int $key, Collection $chunk) {\n" -" return $value === $chunk->last();\n" -"});\n\n" -"$chunks->all();\n\n" -"// [['A', 'A'], ['B', 'B'], ['C', 'C', 'C'], ['D']]\n" -msgstr "$collection = collect(str_split('AABBCCCD'));\n\n" -"$chunks = $collection->chunkWhile(function (string $value, int $key, Collection $chunk) {\n" +"$chunks = $collection->chunkWhile(function ($value, $key, $chunk) {\n" " return $value === $chunk->last();\n" "});\n\n" "$chunks->all();\n\n" -"// [['A', 'A'], ['B', 'B'], ['C', 'C', 'C'], ['D']]\n" +"// [['A', 'A'], ['B', 'B'], ['C', 'C', 'C'], ['D']]" +msgstr "" -#: docs/10.x/collections.md:block 54 (header) +# P +#: ./docs/8.x/collections.md:314 +#: ./docs/9.x/collections.md:324 +#: ./docs/10.x/collections.md:330 +#: ./docs/11.x/collections.md:387 +#: ./docs/master/collections.md:330 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:315 +#: ./docs/9.x/collections.md:325 +#: ./docs/10.x/collections.md:331 +#: ./docs/11.x/collections.md:388 +#: ./docs/master/collections.md:331 msgid "`collapse()` {.collection-method}" -msgstr "`collapse()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 55 (paragraph) +# P +#: ./docs/8.x/collections.md:317 +#: ./docs/9.x/collections.md:327 +#: ./docs/10.x/collections.md:333 +#: ./docs/11.x/collections.md:390 +#: ./docs/master/collections.md:333 msgid "The `collapse` method collapses a collection of arrays into a single, flat collection:" -msgstr "`collapse` 方法可以將多個陣列合併為單一的扁平 (Flat) Collection:" +msgstr "" -#: docs/10.x/collections.md:block 56 (code) +# CODE +#: ./docs/8.x/collections.md:319 +#: ./docs/9.x/collections.md:329 +#: ./docs/10.x/collections.md:335 +#: ./docs/11.x/collections.md:392 +#: ./docs/master/collections.md:335 msgid "$collection = collect([\n" " [1, 2, 3],\n" " [4, 5, 6],\n" @@ -300,50 +1265,125 @@ msgid "$collection = collect([\n" "]);\n\n" "$collapsed = $collection->collapse();\n\n" "$collapsed->all();\n\n" -"// [1, 2, 3, 4, 5, 6, 7, 8, 9]\n" -msgstr "$collection = collect([\n" -" [1, 2, 3],\n" -" [4, 5, 6],\n" -" [7, 8, 9],\n" -"]);\n\n" -"$collapsed = $collection->collapse();\n\n" -"$collapsed->all();\n\n" -"// [1, 2, 3, 4, 5, 6, 7, 8, 9]\n" +"// [1, 2, 3, 4, 5, 6, 7, 8, 9]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:320 +#: ./docs/11.x/collections.md:377 +#: ./docs/master/collections.md:320 +msgid "$collection = collect(str_split('AABBCCCD'));\n\n" +"$chunks = $collection->chunkWhile(function (string $value, int $key, Collection $chunk) {\n" +" return $value === $chunk->last();\n" +"});\n\n" +"$chunks->all();\n\n" +"// [['A', 'A'], ['B', 'B'], ['C', 'C', 'C'], ['D']]" +msgstr "" + +# P +#: ./docs/11.x/collections.md:322 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/11.x/collections.md:323 +msgid "`before()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 58 (header) +# P +#: ./docs/11.x/collections.md:325 +msgid "The `before` method is the opposite of the [`after`](#method-after) method. It returns the item before the given item. `null` is returned if the given item is not found or is the first item:" +msgstr "" + +# CODE +#: ./docs/11.x/collections.md:327 +msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" +"$collection->before(3);\n\n" +"// 2\n\n" +"$collection->before(1);\n\n" +"// null\n\n" +"collect([2, 4, 6, 8])->before('4', strict: true);\n\n" +"// null\n\n" +"collect([2, 4, 6, 8])->before(function (int $item, int $key) {\n" +" return $item > 5;\n" +"});\n\n" +"// 4" +msgstr "" + +# P +#: ./docs/8.x/collections.md:331 +#: ./docs/9.x/collections.md:341 +#: ./docs/10.x/collections.md:347 +#: ./docs/11.x/collections.md:404 +#: ./docs/master/collections.md:347 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:332 +#: ./docs/9.x/collections.md:342 +#: ./docs/10.x/collections.md:348 +#: ./docs/11.x/collections.md:405 +#: ./docs/master/collections.md:348 msgid "`collect()` {.collection-method}" -msgstr "`collect()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 59 (paragraph) +# P +#: ./docs/8.x/collections.md:334 +#: ./docs/9.x/collections.md:344 +#: ./docs/10.x/collections.md:350 +#: ./docs/11.x/collections.md:407 +#: ./docs/master/collections.md:350 msgid "The `collect` method returns a new `Collection` instance with the items currently in the collection:" -msgstr "`collect` 方法會回傳一個包含目前 Collection 內項目的新 `Collection` 實體:" +msgstr "" -#: docs/10.x/collections.md:block 60 (code) +# CODE +#: ./docs/8.x/collections.md:336 +#: ./docs/9.x/collections.md:346 +#: ./docs/10.x/collections.md:352 +#: ./docs/11.x/collections.md:409 +#: ./docs/master/collections.md:352 msgid "$collectionA = collect([1, 2, 3]);\n\n" "$collectionB = $collectionA->collect();\n\n" "$collectionB->all();\n\n" -"// [1, 2, 3]\n" -msgstr "$collectionA = collect([1, 2, 3]);\n\n" -"$collectionB = $collectionA->collect();\n\n" -"$collectionB->all();\n\n" -"// [1, 2, 3]\n" +"// [1, 2, 3]" +msgstr "" -#: docs/10.x/collections.md:block 61 (paragraph) +# P +#: ./docs/8.x/collections.md:344 +#: ./docs/9.x/collections.md:354 +#: ./docs/10.x/collections.md:360 +#: ./docs/11.x/collections.md:417 +#: ./docs/master/collections.md:360 msgid "The `collect` method is primarily useful for converting [lazy collections](#lazy-collections) into standard `Collection` instances:" -msgstr "`collect` 方法特別適合用來將 [Lazy Collection](#lazy-collections) 轉換為標準 `Collection` 實體:" +msgstr "" -#: docs/10.x/collections.md:block 62 (code) +# CODE +#: ./docs/8.x/collections.md:346 +#: ./docs/9.x/collections.md:356 msgid "$lazyCollection = LazyCollection::make(function () {\n" " yield 1;\n" " yield 2;\n" " yield 3;\n" "});\n\n" "$collection = $lazyCollection->collect();\n\n" -"$collection::class;\n\n" +"get_class($collection);\n\n" "// 'Illuminate\\Support\\Collection'\n\n" "$collection->all();\n\n" -"// [1, 2, 3]\n" -msgstr "$lazyCollection = LazyCollection::make(function () {\n" +"// [1, 2, 3]" +msgstr "" + +# P +#: ./docs/11.x/collections.md:360 +#: ./docs/master/collections.md:303 +msgid "This method is especially useful in [views](/docs/{{version}}/views) when working with a grid system such as [Bootstrap](https://getbootstrap.com/docs/5.3/layout/grid/). For example, imagine you have a collection of [Eloquent](/docs/{{version}}/eloquent) models you want to display in a grid:" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:362 +#: ./docs/11.x/collections.md:419 +#: ./docs/master/collections.md:362 +msgid "$lazyCollection = LazyCollection::make(function () {\n" " yield 1;\n" " yield 2;\n" " yield 3;\n" @@ -352,209 +1392,418 @@ msgstr "$lazyCollection = LazyCollection::make(function () {\n" "$collection::class;\n\n" "// 'Illuminate\\Support\\Collection'\n\n" "$collection->all();\n\n" -"// [1, 2, 3]\n" +"// [1, 2, 3]" +msgstr "" -#: docs/10.x/collections.md:block 63 (quote) -msgid "**Note** The `collect` method is especially useful when you have an instance of `Enumerable` and need a non-lazy collection instance. Since `collect()` is part of the `Enumerable` contract, you can safely use it to get a `Collection` instance." -msgstr "**Note** `collect` 方法特別適合用於如有 `Enumerable` 實體且需要一個非 Lazy Collection 的實體。由於 `collect()` 是 `Enumerable` Contract 的一部分,因此我們可以安全地使用該方法來取得 `Collection` 實體。" +# P +#: ./docs/8.x/collections.md:362 +#: ./docs/9.x/collections.md:373 +#: ./docs/10.x/collections.md:379 +#: ./docs/11.x/collections.md:436 +#: ./docs/master/collections.md:379 +msgid "The `collect` method is especially useful when you have an instance of `Enumerable` and need a non-lazy collection instance. Since `collect()` is part of the `Enumerable` contract, you can safely use it to get a `Collection` instance." +msgstr "" -#: docs/10.x/collections.md:block 65 (header) +# P +#: ./docs/8.x/collections.md:364 +#: ./docs/9.x/collections.md:375 +#: ./docs/10.x/collections.md:381 +#: ./docs/11.x/collections.md:438 +#: ./docs/master/collections.md:381 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:365 +#: ./docs/9.x/collections.md:376 +#: ./docs/10.x/collections.md:382 +#: ./docs/11.x/collections.md:439 +#: ./docs/master/collections.md:382 msgid "`combine()` {.collection-method}" -msgstr "`combine()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 66 (paragraph) +# P +#: ./docs/8.x/collections.md:367 +#: ./docs/9.x/collections.md:378 +#: ./docs/10.x/collections.md:384 +#: ./docs/11.x/collections.md:441 +#: ./docs/master/collections.md:384 msgid "The `combine` method combines the values of the collection, as keys, with the values of another array or collection:" -msgstr "`combine` 可用來將 Collection 的值作為索引鍵來與作為值的另一個陣列或 Collection 進行合併:" +msgstr "" -#: docs/10.x/collections.md:block 67 (code) +# CODE +#: ./docs/8.x/collections.md:369 +#: ./docs/9.x/collections.md:380 +#: ./docs/10.x/collections.md:386 +#: ./docs/11.x/collections.md:443 +#: ./docs/master/collections.md:386 msgid "$collection = collect(['name', 'age']);\n\n" "$combined = $collection->combine(['George', 29]);\n\n" "$combined->all();\n\n" -"// ['name' => 'George', 'age' => 29]\n" -msgstr "$collection = collect(['name', 'age']);\n\n" -"$combined = $collection->combine(['George', 29]);\n\n" -"$combined->all();\n\n" -"// ['name' => 'George', 'age' => 29]\n" +"// ['name' => 'George', 'age' => 29]" +msgstr "" -#: docs/10.x/collections.md:block 69 (header) +# P +#: ./docs/8.x/collections.md:377 +#: ./docs/9.x/collections.md:388 +#: ./docs/10.x/collections.md:394 +#: ./docs/11.x/collections.md:451 +#: ./docs/master/collections.md:394 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:378 +#: ./docs/9.x/collections.md:389 +#: ./docs/10.x/collections.md:395 +#: ./docs/11.x/collections.md:452 +#: ./docs/master/collections.md:395 msgid "`concat()` {.collection-method}" -msgstr "`concat()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 70 (paragraph) +# P +#: ./docs/8.x/collections.md:380 +#: ./docs/9.x/collections.md:391 +#: ./docs/10.x/collections.md:397 +#: ./docs/11.x/collections.md:454 +#: ./docs/master/collections.md:397 msgid "The `concat` method appends the given `array` or collection's values onto the end of another collection:" -msgstr "`concat` 方法會將給定的 `array` 或 Collection 的值附加到另一個 Collection 的末端:" +msgstr "" -#: docs/10.x/collections.md:block 71 (code) +# CODE +#: ./docs/8.x/collections.md:382 +#: ./docs/9.x/collections.md:393 +#: ./docs/10.x/collections.md:399 +#: ./docs/11.x/collections.md:456 +#: ./docs/master/collections.md:399 msgid "$collection = collect(['John Doe']);\n\n" "$concatenated = $collection->concat(['Jane Doe'])->concat(['name' => 'Johnny Doe']);\n\n" "$concatenated->all();\n\n" -"// ['John Doe', 'Jane Doe', 'Johnny Doe']\n" -msgstr "$collection = collect(['John Doe']);\n\n" -"$concatenated = $collection->concat(['Jane Doe'])->concat(['name' => 'Johnny Doe']);\n\n" -"$concatenated->all();\n\n" -"// ['John Doe', 'Jane Doe', 'Johnny Doe']\n" - -#: docs/10.x/collections.md:block 72 (paragraph) -msgid "The `concat` method numerically reindexes keys for items concatenated onto the original collection. To maintain keys in associative collections, see the [merge](#method-merge) method." -msgstr "`concat` 方法將各個項目串接到原始 Collection 陣列中,而串接的各個項目會依照數字順序重新設定索引鍵。若要保留關聯式 Collection 的索引鍵,請參照 [merge](#method-merge) 方法。" +"// ['John Doe', 'Jane Doe', 'Johnny Doe']" +msgstr "" -#: docs/10.x/collections.md:block 74 (header) +# P +#: ./docs/8.x/collections.md:390 +#: ./docs/9.x/collections.md:403 +#: ./docs/10.x/collections.md:409 +#: ./docs/11.x/collections.md:466 +#: ./docs/master/collections.md:409 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:391 +#: ./docs/9.x/collections.md:404 +#: ./docs/10.x/collections.md:410 +#: ./docs/11.x/collections.md:467 +#: ./docs/master/collections.md:410 msgid "`contains()` {.collection-method}" -msgstr "`contains()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 75 (paragraph) +# P +#: ./docs/8.x/collections.md:393 +#: ./docs/9.x/collections.md:406 +#: ./docs/10.x/collections.md:412 +#: ./docs/11.x/collections.md:469 +#: ./docs/master/collections.md:412 msgid "The `contains` method determines whether the collection contains a given item. You may pass a closure to the `contains` method to determine if an element exists in the collection matching a given truth test:" -msgstr "`contains` 方法可用來判斷該 Collection 是否包含給定的項目。可以傳入一個閉包給 `contains` 方法來根據給定的真值條件測試判斷某個元素是否在該 Collection 內:" +msgstr "" -#: docs/10.x/collections.md:block 76 (code) +# CODE +#: ./docs/8.x/collections.md:395 +#: ./docs/9.x/collections.md:408 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->contains(function (int $value, int $key) {\n" -" return $value > 5;\n" -"});\n\n" -"// false\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->contains(function (int $value, int $key) {\n" +"$collection->contains(function ($value, $key) {\n" " return $value > 5;\n" "});\n\n" -"// false\n" +"// false" +msgstr "" + +# P +#: ./docs/9.x/collections.md:401 +#: ./docs/10.x/collections.md:407 +#: ./docs/11.x/collections.md:464 +#: ./docs/master/collections.md:407 +msgid "The `concat` method numerically reindexes keys for items concatenated onto the original collection. To maintain keys in associative collections, see the [merge](#method-merge) method." +msgstr "" -#: docs/10.x/collections.md:block 77 (paragraph) +# P +#: ./docs/8.x/collections.md:403 +#: ./docs/9.x/collections.md:416 +#: ./docs/10.x/collections.md:422 +#: ./docs/11.x/collections.md:479 +#: ./docs/master/collections.md:422 msgid "Alternatively, you may pass a string to the `contains` method to determine whether the collection contains a given item value:" -msgstr "或者,也可以將字串傳入 `contains` 方法來判斷該 Collection 是否包含給定的項目值:" +msgstr "" -#: docs/10.x/collections.md:block 78 (code) +# CODE +#: ./docs/8.x/collections.md:405 +#: ./docs/9.x/collections.md:418 +#: ./docs/10.x/collections.md:424 +#: ./docs/11.x/collections.md:481 +#: ./docs/master/collections.md:424 msgid "$collection = collect(['name' => 'Desk', 'price' => 100]);\n\n" "$collection->contains('Desk');\n\n" "// true\n\n" "$collection->contains('New York');\n\n" -"// false\n" -msgstr "$collection = collect(['name' => 'Desk', 'price' => 100]);\n\n" -"$collection->contains('Desk');\n\n" -"// true\n\n" -"$collection->contains('New York');\n\n" -"// false\n" +"// false" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:414 +#: ./docs/11.x/collections.md:471 +#: ./docs/master/collections.md:414 +msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" +"$collection->contains(function (int $value, int $key) {\n" +" return $value > 5;\n" +"});\n\n" +"// false" +msgstr "" -#: docs/10.x/collections.md:block 79 (paragraph) +# P +#: ./docs/8.x/collections.md:415 +#: ./docs/9.x/collections.md:428 +#: ./docs/10.x/collections.md:434 +#: ./docs/11.x/collections.md:491 +#: ./docs/master/collections.md:434 msgid "You may also pass a key / value pair to the `contains` method, which will determine if the given pair exists in the collection:" -msgstr "也可以傳入一組索引鍵/值配對給 `contains` 方法,用來判斷給定的索引鍵/值配對是否存在於該 Collection 內:" +msgstr "" -#: docs/10.x/collections.md:block 80 (code) +# CODE +#: ./docs/8.x/collections.md:417 +#: ./docs/9.x/collections.md:430 +#: ./docs/10.x/collections.md:436 +#: ./docs/11.x/collections.md:493 +#: ./docs/master/collections.md:436 msgid "$collection = collect([\n" " ['product' => 'Desk', 'price' => 200],\n" " ['product' => 'Chair', 'price' => 100],\n" "]);\n\n" "$collection->contains('product', 'Bookcase');\n\n" -"// false\n" -msgstr "$collection = collect([\n" -" ['product' => 'Desk', 'price' => 200],\n" -" ['product' => 'Chair', 'price' => 100],\n" -"]);\n\n" -"$collection->contains('product', 'Bookcase');\n\n" -"// false\n" +"// false" +msgstr "" -#: docs/10.x/collections.md:block 81 (paragraph) +# P +#: ./docs/8.x/collections.md:426 +#: ./docs/9.x/collections.md:439 +#: ./docs/10.x/collections.md:445 +#: ./docs/11.x/collections.md:502 +#: ./docs/master/collections.md:445 msgid "The `contains` method uses \"loose\" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value. Use the [`containsStrict`](#method-containsstrict) method to filter using \"strict\" comparisons." -msgstr "`contains` 方法在比對項目值時使用了「鬆散 (Loose)」的比對方法。這標示,具有整數值的字串與一個有相同值的整數會被視為相同。請使用 [`containsStrict`](#method-containsstrict) 方法來使用「嚴格 (Strict)」比對進行過濾。" +msgstr "" -#: docs/10.x/collections.md:block 82 (paragraph) +# P +#: ./docs/8.x/collections.md:428 +#: ./docs/9.x/collections.md:441 +#: ./docs/10.x/collections.md:447 +#: ./docs/11.x/collections.md:504 +#: ./docs/master/collections.md:447 msgid "For the inverse of `contains`, see the [doesntContain](#method-doesntcontain) method." -msgstr "請參考 [doesntContain](#method-doesntcontain) 方法以瞭解與 `contains` 相反的方法。" - -#: docs/10.x/collections.md:block 84 (header) -msgid "`containsOneItem()` {.collection-method}" -msgstr "`containsOneItem()` {.collection-method}" - -#: docs/10.x/collections.md:block 85 (paragraph) -msgid "The `containsOneItem` method determines whether the collection contains a single item:" -msgstr "`containsOneItem` 用於判斷該 Collection 是否只包含一個項目:" - -#: docs/10.x/collections.md:block 86 (code) -msgid "collect([])->containsOneItem();\n\n" -"// false\n\n" -"collect(['1'])->containsOneItem();\n\n" -"// true\n\n" -"collect(['1', '2'])->containsOneItem();\n\n" -"// false\n" -msgstr "collect([])->containsOneItem();\n\n" -"// false\n\n" -"collect(['1'])->containsOneItem();\n\n" -"// true\n\n" -"collect(['1', '2'])->containsOneItem();\n\n" -"// false\n" +msgstr "" -#: docs/10.x/collections.md:block 88 (header) +# P +#: ./docs/8.x/collections.md:430 +#: ./docs/9.x/collections.md:460 +#: ./docs/10.x/collections.md:466 +#: ./docs/11.x/collections.md:523 +#: ./docs/master/collections.md:466 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:431 +#: ./docs/9.x/collections.md:461 +#: ./docs/10.x/collections.md:467 +#: ./docs/11.x/collections.md:524 +#: ./docs/master/collections.md:467 msgid "`containsStrict()` {.collection-method}" -msgstr "`containsStrict()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 89 (paragraph) +# P +#: ./docs/8.x/collections.md:433 +#: ./docs/9.x/collections.md:463 +#: ./docs/10.x/collections.md:469 +#: ./docs/11.x/collections.md:526 +#: ./docs/master/collections.md:469 msgid "This method has the same signature as the [`contains`](#method-contains) method; however, all values are compared using \"strict\" comparisons." -msgstr "該方法與 [`contains`](#method-contains) 方法的簽章一致。不過,所有的數值比對都是使用「嚴格」比對模式。" +msgstr "" -#: docs/10.x/collections.md:block 90 (quote) -msgid "**Note** This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-contains)." -msgstr "**Note** 在使用 [Eloquent Collection](/docs/{{version}}/eloquent-collections#method-contains) 時,該方法的行為有經過修改。" +# P +#: ./docs/8.x/collections.md:435 +#: ./docs/9.x/collections.md:466 +#: ./docs/10.x/collections.md:472 +#: ./docs/11.x/collections.md:529 +#: ./docs/master/collections.md:472 +msgid "This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-contains)." +msgstr "" -#: docs/10.x/collections.md:block 92 (header) +# P +#: ./docs/8.x/collections.md:437 +#: ./docs/9.x/collections.md:468 +#: ./docs/10.x/collections.md:474 +#: ./docs/11.x/collections.md:531 +#: ./docs/master/collections.md:474 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:438 +#: ./docs/9.x/collections.md:469 +#: ./docs/10.x/collections.md:475 +#: ./docs/11.x/collections.md:532 +#: ./docs/master/collections.md:475 msgid "`count()` {.collection-method}" -msgstr "`count()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 93 (paragraph) +# P +#: ./docs/8.x/collections.md:440 +#: ./docs/9.x/collections.md:471 +#: ./docs/10.x/collections.md:477 +#: ./docs/11.x/collections.md:534 +#: ./docs/master/collections.md:477 msgid "The `count` method returns the total number of items in the collection:" -msgstr "`count` 方法回傳該 Collection 內的項目總數:" +msgstr "" -#: docs/10.x/collections.md:block 94 (code) +# CODE +#: ./docs/8.x/collections.md:442 +#: ./docs/9.x/collections.md:473 +#: ./docs/10.x/collections.md:479 +#: ./docs/11.x/collections.md:536 +#: ./docs/master/collections.md:479 msgid "$collection = collect([1, 2, 3, 4]);\n\n" "$collection->count();\n\n" -"// 4\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$collection->count();\n\n" -"// 4\n" +"// 4" +msgstr "" + +# P +#: ./docs/9.x/collections.md:443 +#: ./docs/10.x/collections.md:449 +#: ./docs/11.x/collections.md:506 +#: ./docs/master/collections.md:449 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/collections.md:444 +#: ./docs/10.x/collections.md:450 +#: ./docs/11.x/collections.md:507 +#: ./docs/master/collections.md:450 +msgid "`containsOneItem()` {.collection-method}" +msgstr "" + +# P +#: ./docs/9.x/collections.md:446 +#: ./docs/10.x/collections.md:452 +#: ./docs/11.x/collections.md:509 +#: ./docs/master/collections.md:452 +msgid "The `containsOneItem` method determines whether the collection contains a single item:" +msgstr "" + +# P +#: ./docs/8.x/collections.md:448 +#: ./docs/9.x/collections.md:479 +#: ./docs/10.x/collections.md:485 +#: ./docs/11.x/collections.md:542 +#: ./docs/master/collections.md:485 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/9.x/collections.md:448 +#: ./docs/10.x/collections.md:454 +#: ./docs/11.x/collections.md:511 +#: ./docs/master/collections.md:454 +msgid "collect([])->containsOneItem();\n\n" +"// false\n\n" +"collect(['1'])->containsOneItem();\n\n" +"// true\n\n" +"collect(['1', '2'])->containsOneItem();\n\n" +"// false" +msgstr "" -#: docs/10.x/collections.md:block 96 (header) +# H4 +#: ./docs/8.x/collections.md:449 +#: ./docs/9.x/collections.md:480 +#: ./docs/10.x/collections.md:486 +#: ./docs/11.x/collections.md:543 +#: ./docs/master/collections.md:486 msgid "`countBy()` {.collection-method}" -msgstr "`countBy()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 97 (paragraph) +# P +#: ./docs/8.x/collections.md:451 +#: ./docs/9.x/collections.md:482 +#: ./docs/10.x/collections.md:488 +#: ./docs/11.x/collections.md:545 +#: ./docs/master/collections.md:488 msgid "The `countBy` method counts the occurrences of values in the collection. By default, the method counts the occurrences of every element, allowing you to count certain \"types\" of elements in the collection:" -msgstr "`countBy` 方法會計算在該 Collection 內各個值的出現次數。預設情況下,該方法會計算所有元素的出現次數,讓你可以計算該 Collection 中特定「類型」的元素:" +msgstr "" -#: docs/10.x/collections.md:block 98 (code) +# CODE +#: ./docs/8.x/collections.md:453 +#: ./docs/9.x/collections.md:484 +#: ./docs/10.x/collections.md:490 +#: ./docs/11.x/collections.md:547 +#: ./docs/master/collections.md:490 msgid "$collection = collect([1, 2, 2, 2, 3]);\n\n" "$counted = $collection->countBy();\n\n" "$counted->all();\n\n" -"// [1 => 1, 2 => 3, 3 => 1]\n" -msgstr "$collection = collect([1, 2, 2, 2, 3]);\n\n" -"$counted = $collection->countBy();\n\n" -"$counted->all();\n\n" -"// [1 => 1, 2 => 3, 3 => 1]\n" +"// [1 => 1, 2 => 3, 3 => 1]" +msgstr "" -#: docs/10.x/collections.md:block 99 (paragraph) +# P +#: ./docs/8.x/collections.md:461 +#: ./docs/9.x/collections.md:492 +#: ./docs/10.x/collections.md:498 +#: ./docs/11.x/collections.md:555 +#: ./docs/master/collections.md:498 msgid "You pass a closure to the `countBy` method to count all items by a custom value:" -msgstr "可以將一個閉包傳給 `countBy` 方法來依照自訂值計算所有項目:" +msgstr "" -#: docs/10.x/collections.md:block 100 (code) +# CODE +#: ./docs/8.x/collections.md:463 +#: ./docs/9.x/collections.md:494 msgid "$collection = collect(['alice@gmail.com', 'bob@yahoo.com', 'carlos@gmail.com']);\n\n" -"$counted = $collection->countBy(function (string $email) {\n" -" return substr(strrchr($email, \"@\"), 1);\n" -"});\n\n" -"$counted->all();\n\n" -"// ['gmail.com' => 2, 'yahoo.com' => 1]\n" -msgstr "$collection = collect(['alice@gmail.com', 'bob@yahoo.com', 'carlos@gmail.com']);\n\n" -"$counted = $collection->countBy(function (string $email) {\n" +"$counted = $collection->countBy(function ($email) {\n" " return substr(strrchr($email, \"@\"), 1);\n" "});\n\n" "$counted->all();\n\n" -"// ['gmail.com' => 2, 'yahoo.com' => 1]\n" +"// ['gmail.com' => 2, 'yahoo.com' => 1]" +msgstr "" -#: docs/10.x/collections.md:block 102 (header) +# P +#: ./docs/8.x/collections.md:473 +#: ./docs/9.x/collections.md:504 +#: ./docs/10.x/collections.md:510 +#: ./docs/11.x/collections.md:567 +#: ./docs/master/collections.md:510 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:474 +#: ./docs/9.x/collections.md:505 +#: ./docs/10.x/collections.md:511 +#: ./docs/11.x/collections.md:568 +#: ./docs/master/collections.md:511 msgid "`crossJoin()` {.collection-method}" -msgstr "`crossJoin()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 103 (paragraph) +# P +#: ./docs/8.x/collections.md:476 +#: ./docs/9.x/collections.md:507 +#: ./docs/10.x/collections.md:513 +#: ./docs/11.x/collections.md:570 +#: ./docs/master/collections.md:513 msgid "The `crossJoin` method cross joins the collection's values among the given arrays or collections, returning a Cartesian product with all possible permutations:" -msgstr "The `crossJoin` method cross joins the collection's values among the given arrays or collections, returning a Cartesian product with all possible permutations:" +msgstr "" -#: docs/10.x/collections.md:block 104 (code) +# CODE +#: ./docs/8.x/collections.md:478 +#: ./docs/9.x/collections.md:509 +#: ./docs/10.x/collections.md:515 +#: ./docs/11.x/collections.md:572 +#: ./docs/master/collections.md:515 msgid "$collection = collect([1, 2]);\n\n" "$matrix = $collection->crossJoin(['a', 'b']);\n\n" "$matrix->all();\n\n" @@ -580,43 +1829,54 @@ msgid "$collection = collect([1, 2]);\n\n" " [2, 'b', 'I'],\n" " [2, 'b', 'II'],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([1, 2]);\n\n" -"$matrix = $collection->crossJoin(['a', 'b']);\n\n" -"$matrix->all();\n\n" -"/*\n" -" [\n" -" [1, 'a'],\n" -" [1, 'b'],\n" -" [2, 'a'],\n" -" [2, 'b'],\n" -" ]\n" -"*/\n\n" -"$collection = collect([1, 2]);\n\n" -"$matrix = $collection->crossJoin(['a', 'b'], ['I', 'II']);\n\n" -"$matrix->all();\n\n" -"/*\n" -" [\n" -" [1, 'a', 'I'],\n" -" [1, 'a', 'II'],\n" -" [1, 'b', 'I'],\n" -" [1, 'b', 'II'],\n" -" [2, 'a', 'I'],\n" -" [2, 'a', 'II'],\n" -" [2, 'b', 'I'],\n" -" [2, 'b', 'II'],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:500 +#: ./docs/11.x/collections.md:557 +#: ./docs/master/collections.md:500 +msgid "$collection = collect(['alice@gmail.com', 'bob@yahoo.com', 'carlos@gmail.com']);\n\n" +"$counted = $collection->countBy(function (string $email) {\n" +" return substr(strrchr($email, \"@\"), 1);\n" +"});\n\n" +"$counted->all();\n\n" +"// ['gmail.com' => 2, 'yahoo.com' => 1]" +msgstr "" -#: docs/10.x/collections.md:block 106 (header) +# P +#: ./docs/8.x/collections.md:512 +#: ./docs/9.x/collections.md:543 +#: ./docs/10.x/collections.md:549 +#: ./docs/11.x/collections.md:606 +#: ./docs/master/collections.md:549 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:513 +#: ./docs/9.x/collections.md:544 +#: ./docs/10.x/collections.md:550 +#: ./docs/11.x/collections.md:607 +#: ./docs/master/collections.md:550 msgid "`dd()` {.collection-method}" -msgstr "`dd()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 107 (paragraph) +# P +#: ./docs/8.x/collections.md:515 +#: ./docs/9.x/collections.md:546 +#: ./docs/10.x/collections.md:552 +#: ./docs/11.x/collections.md:609 +#: ./docs/master/collections.md:552 msgid "The `dd` method dumps the collection's items and ends execution of the script:" -msgstr "`dd` 方法會傾印該 Collection 的項目,並結束目前的指令碼執行:" +msgstr "" -#: docs/10.x/collections.md:block 108 (code) +# CODE +#: ./docs/8.x/collections.md:517 +#: ./docs/9.x/collections.md:548 +#: ./docs/10.x/collections.md:554 +#: ./docs/11.x/collections.md:611 +#: ./docs/master/collections.md:554 msgid "$collection = collect(['John Doe', 'Jane Doe']);\n\n" "$collection->dd();\n\n" "/*\n" @@ -626,53 +1886,99 @@ msgid "$collection = collect(['John Doe', 'Jane Doe']);\n\n" " 1 => \"Jane Doe\"\n" " ]\n" " }\n" -"*/\n" -msgstr "$collection = collect(['John Doe', 'Jane Doe']);\n\n" -"$collection->dd();\n\n" -"/*\n" -" Collection {\n" -" #items: array:2 [\n" -" 0 => \"John Doe\"\n" -" 1 => \"Jane Doe\"\n" -" ]\n" -" }\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 109 (paragraph) +# P +#: ./docs/8.x/collections.md:530 +#: ./docs/9.x/collections.md:561 +#: ./docs/10.x/collections.md:567 +#: ./docs/11.x/collections.md:624 +#: ./docs/master/collections.md:567 msgid "If you do not want to stop executing the script, use the [`dump`](#method-dump) method instead." -msgstr "若不想結束目前的指令碼執行,請改為使用 [`dump`](#method-dump) 方法。" +msgstr "" -#: docs/10.x/collections.md:block 111 (header) +# P +#: ./docs/8.x/collections.md:532 +#: ./docs/9.x/collections.md:563 +#: ./docs/10.x/collections.md:569 +#: ./docs/11.x/collections.md:626 +#: ./docs/master/collections.md:569 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:533 +#: ./docs/9.x/collections.md:564 +#: ./docs/10.x/collections.md:570 +#: ./docs/11.x/collections.md:627 +#: ./docs/master/collections.md:570 msgid "`diff()` {.collection-method}" -msgstr "`diff()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 112 (paragraph) +# P +#: ./docs/8.x/collections.md:535 +#: ./docs/9.x/collections.md:566 +#: ./docs/10.x/collections.md:572 +#: ./docs/11.x/collections.md:629 +#: ./docs/master/collections.md:572 msgid "The `diff` method compares the collection against another collection or a plain PHP `array` based on its values. This method will return the values in the original collection that are not present in the given collection:" -msgstr "`diff` 方法會將該 Collection 的值與另一個 Collection 或純 PHP `array` 陣列進行比對。該方法會回傳在原始 Collection 中有出現,但給定的 Collection 中未出現的值:" +msgstr "" -#: docs/10.x/collections.md:block 113 (code) +# CODE +#: ./docs/8.x/collections.md:537 +#: ./docs/9.x/collections.md:568 +#: ./docs/10.x/collections.md:574 +#: ./docs/11.x/collections.md:631 +#: ./docs/master/collections.md:574 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" "$diff = $collection->diff([2, 4, 6, 8]);\n\n" "$diff->all();\n\n" -"// [1, 3, 5]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$diff = $collection->diff([2, 4, 6, 8]);\n\n" -"$diff->all();\n\n" -"// [1, 3, 5]\n" +"// [1, 3, 5]" +msgstr "" -#: docs/10.x/collections.md:block 114 (quote) -msgid "**Note** This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-diff)." -msgstr "**Note** 在使用 [Eloquent Collection](/docs/{{version}}/eloquent-collections#method-diff) 時,該方法的行為有經過修改。" +# P +#: ./docs/8.x/collections.md:545 +#: ./docs/9.x/collections.md:577 +#: ./docs/10.x/collections.md:583 +#: ./docs/11.x/collections.md:640 +#: ./docs/master/collections.md:583 +msgid "This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-diff)." +msgstr "" -#: docs/10.x/collections.md:block 116 (header) +# P +#: ./docs/8.x/collections.md:547 +#: ./docs/9.x/collections.md:579 +#: ./docs/10.x/collections.md:585 +#: ./docs/11.x/collections.md:642 +#: ./docs/master/collections.md:585 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:548 +#: ./docs/9.x/collections.md:580 +#: ./docs/10.x/collections.md:586 +#: ./docs/11.x/collections.md:643 +#: ./docs/master/collections.md:586 msgid "`diffAssoc()` {.collection-method}" -msgstr "`diffAssoc()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 117 (paragraph) +# P +#: ./docs/8.x/collections.md:550 +#: ./docs/9.x/collections.md:582 +#: ./docs/10.x/collections.md:588 +#: ./docs/11.x/collections.md:645 +#: ./docs/master/collections.md:588 msgid "The `diffAssoc` method compares the collection against another collection or a plain PHP `array` based on its keys and values. This method will return the key / value pairs in the original collection that are not present in the given collection:" -msgstr "`diffAssoc` 方法會將該 Collection 的索引鍵/值與另一個 Collection 或純 PHP `array` 陣列進行比對。該方法會回傳在原始 Collection 中有出現,但給定的 Collection 中未出現的索引鍵/值配對:" +msgstr "" -#: docs/10.x/collections.md:block 118 (code) +# CODE +#: ./docs/8.x/collections.md:552 +#: ./docs/9.x/collections.md:584 +#: ./docs/10.x/collections.md:590 +#: ./docs/11.x/collections.md:647 +#: ./docs/master/collections.md:590 msgid "$collection = collect([\n" " 'color' => 'orange',\n" " 'type' => 'fruit',\n" @@ -685,68 +1991,42 @@ msgid "$collection = collect([\n" " 'used' => 6,\n" "]);\n\n" "$diff->all();\n\n" -"// ['color' => 'orange', 'remain' => 6]\n" -msgstr "$collection = collect([\n" -" 'color' => 'orange',\n" -" 'type' => 'fruit',\n" -" 'remain' => 6,\n" -"]);\n\n" -"$diff = $collection->diffAssoc([\n" -" 'color' => 'yellow',\n" -" 'type' => 'fruit',\n" -" 'remain' => 3,\n" -" 'used' => 6,\n" -"]);\n\n" -"$diff->all();\n\n" -"// ['color' => 'orange', 'remain' => 6]\n" - -#: docs/10.x/collections.md:block 120 (header) -msgid "`diffAssocUsing()` {.collection-method}" -msgstr "`diffAssocUsing()` {.collection-method}" - -#: docs/10.x/collections.md:block 121 (paragraph) -msgid "Unlike `diffAssoc`, `diffAssocUsing` accepts a user supplied callback function for the indices comparison:" -msgstr "與 `diffAssoc` 不同,`diffAssocUsing` 可傳入一個使用者提供的回呼函式,用於比較索引:" - -#: docs/10.x/collections.md:block 122 (code) -msgid "$collection = collect([\n" -" 'color' => 'orange',\n" -" 'type' => 'fruit',\n" -" 'remain' => 6,\n" -"]);\n\n" -"$diff = $collection->diffAssocUsing([\n" -" 'Color' => 'yellow',\n" -" 'Type' => 'fruit',\n" -" 'Remain' => 3,\n" -"], 'strnatcasecmp');\n\n" -"$diff->all();\n\n" -"// ['color' => 'orange', 'remain' => 6]\n" -msgstr "$collection = collect([\n" -" 'color' => 'orange',\n" -" 'type' => 'fruit',\n" -" 'remain' => 6,\n" -"]);\n\n" -"$diff = $collection->diffAssocUsing([\n" -" 'Color' => 'yellow',\n" -" 'Type' => 'fruit',\n" -" 'Remain' => 3,\n" -"], 'strnatcasecmp');\n\n" -"$diff->all();\n\n" -"// ['color' => 'orange', 'remain' => 6]\n" - -#: docs/10.x/collections.md:block 123 (paragraph) -msgid "The callback must be a comparison function that returns an integer less than, equal to, or greater than zero. For more information, refer to the PHP documentation on [`array_diff_uassoc`](https://www.php.net/array_diff_uassoc#refsect1-function.array-diff-uassoc-parameters), which is the PHP function that the `diffAssocUsing` method utilizes internally." -msgstr "該回呼必須為回傳一個小於、等於、或大於 0 之整數的比較函式。更多資訊請參考 PHP 說明文件中有關 [`array_diff_uassoc`](https://www.php.net/array_diff_uassoc#refsect1-function.array-diff-uassoc-parameters) 的部分。`array_diff_uassoc` 是 `diffAssocUsing` 方法內部所使用的 PHP 函式。" +"// ['color' => 'orange', 'remain' => 6]" +msgstr "" -#: docs/10.x/collections.md:block 125 (header) +# P +#: ./docs/8.x/collections.md:569 +#: ./docs/9.x/collections.md:601 +#: ./docs/10.x/collections.md:630 +#: ./docs/11.x/collections.md:687 +#: ./docs/master/collections.md:630 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:570 +#: ./docs/9.x/collections.md:602 +#: ./docs/10.x/collections.md:631 +#: ./docs/11.x/collections.md:688 +#: ./docs/master/collections.md:631 msgid "`diffKeys()` {.collection-method}" -msgstr "`diffKeys()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 126 (paragraph) +# P +#: ./docs/8.x/collections.md:572 +#: ./docs/9.x/collections.md:604 +#: ./docs/10.x/collections.md:633 +#: ./docs/11.x/collections.md:690 +#: ./docs/master/collections.md:633 msgid "The `diffKeys` method compares the collection against another collection or a plain PHP `array` based on its keys. This method will return the key / value pairs in the original collection that are not present in the given collection:" -msgstr "`diffKey` 方法會將該 Collection 的索引鍵與另一個 Collection 或純 PHP `array` 陣列進行比對。該方法會回傳在原始 Collection 中有出現,但給定的 Collection 中未出現的索引對:" +msgstr "" -#: docs/10.x/collections.md:block 127 (code) +# CODE +#: ./docs/8.x/collections.md:574 +#: ./docs/9.x/collections.md:606 +#: ./docs/10.x/collections.md:635 +#: ./docs/11.x/collections.md:692 +#: ./docs/master/collections.md:635 msgid "$collection = collect([\n" " 'one' => 10,\n" " 'two' => 20,\n" @@ -761,108 +2041,179 @@ msgid "$collection = collect([\n" " 'eight' => 8,\n" "]);\n\n" "$diff->all();\n\n" -"// ['one' => 10, 'three' => 30, 'five' => 50]\n" -msgstr "$collection = collect([\n" -" 'one' => 10,\n" -" 'two' => 20,\n" -" 'three' => 30,\n" -" 'four' => 40,\n" -" 'five' => 50,\n" -"]);\n\n" -"$diff = $collection->diffKeys([\n" -" 'two' => 2,\n" -" 'four' => 4,\n" -" 'six' => 6,\n" -" 'eight' => 8,\n" -"]);\n\n" -"$diff->all();\n\n" -"// ['one' => 10, 'three' => 30, 'five' => 50]\n" +"// ['one' => 10, 'three' => 30, 'five' => 50]" +msgstr "" -#: docs/10.x/collections.md:block 129 (header) +# P +#: ./docs/8.x/collections.md:593 +#: ./docs/9.x/collections.md:625 +#: ./docs/10.x/collections.md:654 +#: ./docs/11.x/collections.md:711 +#: ./docs/master/collections.md:654 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:594 +#: ./docs/9.x/collections.md:626 +#: ./docs/10.x/collections.md:655 +#: ./docs/11.x/collections.md:712 +#: ./docs/master/collections.md:655 msgid "`doesntContain()` {.collection-method}" -msgstr "`doesntContain()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 130 (paragraph) +# P +#: ./docs/8.x/collections.md:596 +#: ./docs/9.x/collections.md:628 +#: ./docs/10.x/collections.md:657 +#: ./docs/11.x/collections.md:714 +#: ./docs/master/collections.md:657 msgid "The `doesntContain` method determines whether the collection does not contain a given item. You may pass a closure to the `doesntContain` method to determine if an element does not exist in the collection matching a given truth test:" -msgstr "`doesntContain` 方法可用來判斷該 Collection 是否不包含給定的項目。可以傳入一個閉包給 `doesntContain` 方法來根據給定的真值條件測試判斷某個元素是否不在該 Collection 內:" +msgstr "" -#: docs/10.x/collections.md:block 131 (code) +# CODE +#: ./docs/8.x/collections.md:598 +#: ./docs/9.x/collections.md:630 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->doesntContain(function (int $value, int $key) {\n" -" return $value < 5;\n" -"});\n\n" -"// false\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->doesntContain(function (int $value, int $key) {\n" +"$collection->doesntContain(function ($value, $key) {\n" " return $value < 5;\n" "});\n\n" -"// false\n" +"// false" +msgstr "" -#: docs/10.x/collections.md:block 132 (paragraph) +# P +#: ./docs/8.x/collections.md:606 +#: ./docs/9.x/collections.md:638 +#: ./docs/10.x/collections.md:667 +#: ./docs/11.x/collections.md:724 +#: ./docs/master/collections.md:667 msgid "Alternatively, you may pass a string to the `doesntContain` method to determine whether the collection does not contain a given item value:" -msgstr "或者,也可以將字串傳入 `doesntContain` 方法來判斷該 Collection 是否不包含給定的項目值:" +msgstr "" + +# P +#: ./docs/10.x/collections.md:607 +#: ./docs/11.x/collections.md:664 +#: ./docs/master/collections.md:607 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/collections.md:608 +#: ./docs/11.x/collections.md:665 +#: ./docs/master/collections.md:608 +msgid "`diffAssocUsing()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 133 (code) +# CODE +#: ./docs/8.x/collections.md:608 +#: ./docs/9.x/collections.md:640 +#: ./docs/10.x/collections.md:669 +#: ./docs/11.x/collections.md:726 +#: ./docs/master/collections.md:669 msgid "$collection = collect(['name' => 'Desk', 'price' => 100]);\n\n" "$collection->doesntContain('Table');\n\n" "// true\n\n" "$collection->doesntContain('Desk');\n\n" -"// false\n" -msgstr "$collection = collect(['name' => 'Desk', 'price' => 100]);\n\n" -"$collection->doesntContain('Table');\n\n" -"// true\n\n" -"$collection->doesntContain('Desk');\n\n" -"// false\n" +"// false" +msgstr "" -#: docs/10.x/collections.md:block 134 (paragraph) -msgid "You may also pass a key / value pair to the `doesntContain` method, which will determine if the given pair does not exist in the collection:" -msgstr "也可以傳入一組索引鍵/值配對給 `doesntContains` 方法,用來判斷給定的索引鍵/值配對是否不存在於該 Collection 內:" +# P +#: ./docs/10.x/collections.md:610 +#: ./docs/11.x/collections.md:667 +#: ./docs/master/collections.md:610 +msgid "Unlike `diffAssoc`, `diffAssocUsing` accepts a user supplied callback function for the indices comparison:" +msgstr "" -#: docs/10.x/collections.md:block 135 (code) +# CODE +#: ./docs/10.x/collections.md:612 +#: ./docs/11.x/collections.md:669 +#: ./docs/master/collections.md:612 msgid "$collection = collect([\n" -" ['product' => 'Desk', 'price' => 200],\n" -" ['product' => 'Chair', 'price' => 100],\n" +" 'color' => 'orange',\n" +" 'type' => 'fruit',\n" +" 'remain' => 6,\n" "]);\n\n" -"$collection->doesntContain('product', 'Bookcase');\n\n" -"// true\n" -msgstr "$collection = collect([\n" +"$diff = $collection->diffAssocUsing([\n" +" 'Color' => 'yellow',\n" +" 'Type' => 'fruit',\n" +" 'Remain' => 3,\n" +"], 'strnatcasecmp');\n\n" +"$diff->all();\n\n" +"// ['color' => 'orange', 'remain' => 6]" +msgstr "" + +# P +#: ./docs/8.x/collections.md:618 +#: ./docs/9.x/collections.md:650 +#: ./docs/10.x/collections.md:679 +#: ./docs/11.x/collections.md:736 +#: ./docs/master/collections.md:679 +msgid "You may also pass a key / value pair to the `doesntContain` method, which will determine if the given pair does not exist in the collection:" +msgstr "" + +# CODE +#: ./docs/8.x/collections.md:620 +#: ./docs/9.x/collections.md:652 +#: ./docs/10.x/collections.md:681 +#: ./docs/11.x/collections.md:738 +#: ./docs/master/collections.md:681 +msgid "$collection = collect([\n" " ['product' => 'Desk', 'price' => 200],\n" " ['product' => 'Chair', 'price' => 100],\n" "]);\n\n" "$collection->doesntContain('product', 'Bookcase');\n\n" -"// true\n" - -#: docs/10.x/collections.md:block 136 (paragraph) -msgid "The `doesntContain` method uses \"loose\" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value." -msgstr "`doesntContain` 方法在比對項目值時使用了「鬆散 (Loose)」的比對方法。這表示,具有整數值的字串與一個有相同值的整數會被視為相同。" - -#: docs/10.x/collections.md:block 138 (header) -msgid "`dot()` {.collection-method}" -msgstr "`dot()` {.collection-method}" +"// true" +msgstr "" -#: docs/10.x/collections.md:block 139 (paragraph) -msgid "The `dot` method flattens a multi-dimensional collection into a single level collection that uses \"dot\" notation to indicate depth:" -msgstr "`dot` 方法將多為 Collection 扁平化 (Flatten) 為一個使用「點 (.)」標記法來表示深度的一維 Collection:" +# P +#: ./docs/10.x/collections.md:628 +#: ./docs/11.x/collections.md:685 +#: ./docs/master/collections.md:628 +msgid "The callback must be a comparison function that returns an integer less than, equal to, or greater than zero. For more information, refer to the PHP documentation on [`array_diff_uassoc`](https://www.php.net/array_diff_uassoc#refsect1-function.array-diff-uassoc-parameters), which is the PHP function that the `diffAssocUsing` method utilizes internally." +msgstr "" -#: docs/10.x/collections.md:block 140 (code) -msgid "$collection = collect(['products' => ['desk' => ['price' => 100]]]);\n\n" -"$flattened = $collection->dot();\n\n" -"$flattened->all();\n\n" -"// ['products.desk.price' => 100]\n" -msgstr "$collection = collect(['products' => ['desk' => ['price' => 100]]]);\n\n" -"$flattened = $collection->dot();\n\n" -"$flattened->all();\n\n" -"// ['products.desk.price' => 100]\n" +# P +#: ./docs/8.x/collections.md:629 +#: ./docs/9.x/collections.md:661 +#: ./docs/10.x/collections.md:690 +#: ./docs/11.x/collections.md:747 +#: ./docs/master/collections.md:690 +msgid "The `doesntContain` method uses \"loose\" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value." +msgstr "" -#: docs/10.x/collections.md:block 142 (header) +# P +#: ./docs/8.x/collections.md:631 +#: ./docs/9.x/collections.md:663 +#: ./docs/10.x/collections.md:705 +#: ./docs/11.x/collections.md:762 +#: ./docs/master/collections.md:705 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:632 +#: ./docs/9.x/collections.md:664 +#: ./docs/10.x/collections.md:706 +#: ./docs/11.x/collections.md:763 +#: ./docs/master/collections.md:706 msgid "`dump()` {.collection-method}" -msgstr "`dump()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 143 (paragraph) +# P +#: ./docs/8.x/collections.md:634 +#: ./docs/9.x/collections.md:666 +#: ./docs/10.x/collections.md:708 +#: ./docs/11.x/collections.md:765 +#: ./docs/master/collections.md:708 msgid "The `dump` method dumps the collection's items:" -msgstr "`dump` 方法會傾印出該 Collection 中的項目:" +msgstr "" -#: docs/10.x/collections.md:block 144 (code) +# CODE +#: ./docs/8.x/collections.md:636 +#: ./docs/9.x/collections.md:668 +#: ./docs/10.x/collections.md:710 +#: ./docs/11.x/collections.md:767 +#: ./docs/master/collections.md:710 msgid "$collection = collect(['John Doe', 'Jane Doe']);\n\n" "$collection->dump();\n\n" "/*\n" @@ -872,317 +2223,599 @@ msgid "$collection = collect(['John Doe', 'Jane Doe']);\n\n" " 1 => \"Jane Doe\"\n" " ]\n" " }\n" -"*/\n" -msgstr "$collection = collect(['John Doe', 'Jane Doe']);\n\n" -"$collection->dump();\n\n" -"/*\n" -" Collection {\n" -" #items: array:2 [\n" -" 0 => \"John Doe\"\n" -" 1 => \"Jane Doe\"\n" -" ]\n" -" }\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 145 (paragraph) +# P +#: ./docs/8.x/collections.md:649 +#: ./docs/9.x/collections.md:681 +#: ./docs/10.x/collections.md:723 +#: ./docs/11.x/collections.md:780 +#: ./docs/master/collections.md:723 msgid "If you want to stop executing the script after dumping the collection, use the [`dd`](#method-dd) method instead." -msgstr "若想在傾印該 Collection 後停止執行指令碼,請使用 [`dd`](#method-dd) 方法來代替。" +msgstr "" -#: docs/10.x/collections.md:block 147 (header) +# P +#: ./docs/8.x/collections.md:651 +#: ./docs/9.x/collections.md:683 +#: ./docs/10.x/collections.md:725 +#: ./docs/11.x/collections.md:782 +#: ./docs/master/collections.md:725 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:652 +#: ./docs/9.x/collections.md:684 +#: ./docs/10.x/collections.md:726 +#: ./docs/11.x/collections.md:783 +#: ./docs/master/collections.md:726 msgid "`duplicates()` {.collection-method}" -msgstr "`duplicates()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 148 (paragraph) +# P +#: ./docs/8.x/collections.md:654 +#: ./docs/9.x/collections.md:686 +#: ./docs/10.x/collections.md:728 +#: ./docs/11.x/collections.md:785 +#: ./docs/master/collections.md:728 msgid "The `duplicates` method retrieves and returns duplicate values from the collection:" -msgstr "`duplicates` 方法會取得並回傳該 Collection 中重複的值:" +msgstr "" -#: docs/10.x/collections.md:block 149 (code) +# CODE +#: ./docs/8.x/collections.md:656 +#: ./docs/9.x/collections.md:688 +#: ./docs/10.x/collections.md:730 +#: ./docs/11.x/collections.md:787 +#: ./docs/master/collections.md:730 msgid "$collection = collect(['a', 'b', 'a', 'c', 'b']);\n\n" "$collection->duplicates();\n\n" -"// [2 => 'a', 4 => 'b']\n" -msgstr "$collection = collect(['a', 'b', 'a', 'c', 'b']);\n\n" -"$collection->duplicates();\n\n" -"// [2 => 'a', 4 => 'b']\n" +"// [2 => 'a', 4 => 'b']" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:659 +#: ./docs/11.x/collections.md:716 +#: ./docs/master/collections.md:659 +msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" +"$collection->doesntContain(function (int $value, int $key) {\n" +" return $value < 5;\n" +"});\n\n" +"// false" +msgstr "" -#: docs/10.x/collections.md:block 150 (paragraph) +# P +#: ./docs/8.x/collections.md:662 +#: ./docs/9.x/collections.md:694 +#: ./docs/10.x/collections.md:736 +#: ./docs/11.x/collections.md:793 +#: ./docs/master/collections.md:736 msgid "If the collection contains arrays or objects, you can pass the key of the attributes that you wish to check for duplicate values:" -msgstr "若該 Collection 內包含陣列或物件,則可以傳入想用來檢查重複值的屬性索引鍵:" +msgstr "" -#: docs/10.x/collections.md:block 151 (code) +# CODE +#: ./docs/8.x/collections.md:664 +#: ./docs/9.x/collections.md:696 +#: ./docs/10.x/collections.md:738 +#: ./docs/11.x/collections.md:795 +#: ./docs/master/collections.md:738 msgid "$employees = collect([\n" " ['email' => 'abigail@example.com', 'position' => 'Developer'],\n" " ['email' => 'james@example.com', 'position' => 'Designer'],\n" " ['email' => 'victoria@example.com', 'position' => 'Developer'],\n" "]);\n\n" "$employees->duplicates('position');\n\n" -"// [2 => 'Developer']\n" -msgstr "$employees = collect([\n" -" ['email' => 'abigail@example.com', 'position' => 'Developer'],\n" -" ['email' => 'james@example.com', 'position' => 'Designer'],\n" -" ['email' => 'victoria@example.com', 'position' => 'Developer'],\n" -"]);\n\n" -"$employees->duplicates('position');\n\n" -"// [2 => 'Developer']\n" +"// [2 => 'Developer']" +msgstr "" -#: docs/10.x/collections.md:block 153 (header) +# P +#: ./docs/8.x/collections.md:674 +#: ./docs/9.x/collections.md:706 +#: ./docs/10.x/collections.md:748 +#: ./docs/11.x/collections.md:805 +#: ./docs/master/collections.md:748 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:675 +#: ./docs/9.x/collections.md:707 +#: ./docs/10.x/collections.md:749 +#: ./docs/11.x/collections.md:806 +#: ./docs/master/collections.md:749 msgid "`duplicatesStrict()` {.collection-method}" -msgstr "`duplicatesStrict()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 154 (paragraph) +# P +#: ./docs/8.x/collections.md:677 +#: ./docs/9.x/collections.md:709 +#: ./docs/10.x/collections.md:751 +#: ./docs/11.x/collections.md:808 +#: ./docs/master/collections.md:751 msgid "This method has the same signature as the [`duplicates`](#method-duplicates) method; however, all values are compared using \"strict\" comparisons." -msgstr "該方法與 [`duplicates`](#method-duplicates) 方法的簽章一致。不過,所有的數值比對都是使用「嚴格」比對模式。" +msgstr "" -#: docs/10.x/collections.md:block 156 (header) +# P +#: ./docs/8.x/collections.md:679 +#: ./docs/9.x/collections.md:711 +#: ./docs/10.x/collections.md:753 +#: ./docs/11.x/collections.md:810 +#: ./docs/master/collections.md:753 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:680 +#: ./docs/9.x/collections.md:712 +#: ./docs/10.x/collections.md:754 +#: ./docs/11.x/collections.md:811 +#: ./docs/master/collections.md:754 msgid "`each()` {.collection-method}" -msgstr "`each()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 157 (paragraph) +# P +#: ./docs/8.x/collections.md:682 +#: ./docs/9.x/collections.md:714 +#: ./docs/10.x/collections.md:756 +#: ./docs/11.x/collections.md:813 +#: ./docs/master/collections.md:756 msgid "The `each` method iterates over the items in the collection and passes each item to a closure:" -msgstr "`each` 方法會迭代 Collection 中的項目,並將各個項目傳給閉包:" +msgstr "" -#: docs/10.x/collections.md:block 158 (code) -msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$collection->each(function (int $item, int $key) {\n" -" // ...\n" -"});\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$collection->each(function (int $item, int $key) {\n" -" // ...\n" -"});\n" +# CODE +#: ./docs/8.x/collections.md:684 +#: ./docs/9.x/collections.md:716 +msgid "$collection->each(function ($item, $key) {\n" +" //\n" +"});" +msgstr "" -#: docs/10.x/collections.md:block 159 (paragraph) +# P +#: ./docs/8.x/collections.md:688 +#: ./docs/9.x/collections.md:720 +#: ./docs/10.x/collections.md:764 +#: ./docs/11.x/collections.md:821 +#: ./docs/master/collections.md:764 msgid "If you would like to stop iterating through the items, you may return `false` from your closure:" -msgstr "若想停止迭代項目,可以在閉包內回傳 `false`:" +msgstr "" -#: docs/10.x/collections.md:block 160 (code) -msgid "$collection->each(function (int $item, int $key) {\n" +# CODE +#: ./docs/8.x/collections.md:690 +#: ./docs/9.x/collections.md:722 +msgid "$collection->each(function ($item, $key) {\n" " if (/* condition */) {\n" " return false;\n" " }\n" -"});\n" -msgstr "$collection->each(function (int $item, int $key) {\n" -" if (/* 條件 */) {\n" -" return false;\n" -" }\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/collections.md:block 162 (header) +# P +#: ./docs/10.x/collections.md:692 +#: ./docs/11.x/collections.md:749 +#: ./docs/master/collections.md:692 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/collections.md:693 +#: ./docs/11.x/collections.md:750 +#: ./docs/master/collections.md:693 +msgid "`dot()` {.collection-method}" +msgstr "" + +# P +#: ./docs/10.x/collections.md:695 +#: ./docs/11.x/collections.md:752 +#: ./docs/master/collections.md:695 +msgid "The `dot` method flattens a multi-dimensional collection into a single level collection that uses \"dot\" notation to indicate depth:" +msgstr "" + +# P +#: ./docs/8.x/collections.md:696 +#: ./docs/9.x/collections.md:728 +#: ./docs/10.x/collections.md:772 +#: ./docs/11.x/collections.md:829 +#: ./docs/master/collections.md:772 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/collections.md:697 +#: ./docs/11.x/collections.md:754 +#: ./docs/master/collections.md:697 +msgid "$collection = collect(['products' => ['desk' => ['price' => 100]]]);\n\n" +"$flattened = $collection->dot();\n\n" +"$flattened->all();\n\n" +"// ['products.desk.price' => 100]" +msgstr "" + +# H4 +#: ./docs/8.x/collections.md:697 +#: ./docs/9.x/collections.md:729 +#: ./docs/10.x/collections.md:773 +#: ./docs/11.x/collections.md:830 +#: ./docs/master/collections.md:773 msgid "`eachSpread()` {.collection-method}" -msgstr "`eachSpread()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 163 (paragraph) +# P +#: ./docs/8.x/collections.md:699 +#: ./docs/9.x/collections.md:731 +#: ./docs/10.x/collections.md:775 +#: ./docs/11.x/collections.md:832 +#: ./docs/master/collections.md:775 msgid "The `eachSpread` method iterates over the collection's items, passing each nested item value into the given callback:" -msgstr "`eachSpread` 方法會迭代該 Collection 的項目,並將每個巢狀項目傳入給定的回呼:" +msgstr "" -#: docs/10.x/collections.md:block 164 (code) +# CODE +#: ./docs/8.x/collections.md:701 +#: ./docs/9.x/collections.md:733 msgid "$collection = collect([['John Doe', 35], ['Jane Doe', 33]]);\n\n" -"$collection->eachSpread(function (string $name, int $age) {\n" -" // ...\n" -"});\n" -msgstr "$collection = collect([['John Doe', 35], ['Jane Doe', 33]]);\n\n" -"$collection->eachSpread(function (string $name, int $age) {\n" -" // ...\n" -"});\n" +"$collection->eachSpread(function ($name, $age) {\n" +" //\n" +"});" +msgstr "" -#: docs/10.x/collections.md:block 165 (paragraph) +# P +#: ./docs/8.x/collections.md:707 +#: ./docs/9.x/collections.md:739 +#: ./docs/10.x/collections.md:783 +#: ./docs/11.x/collections.md:840 +#: ./docs/master/collections.md:783 msgid "You may stop iterating through the items by returning `false` from the callback:" -msgstr "可以通過在回呼內回傳 `false` 來停止迭代項目:" +msgstr "" -#: docs/10.x/collections.md:block 166 (code) -msgid "$collection->eachSpread(function (string $name, int $age) {\n" -" return false;\n" -"});\n" -msgstr "$collection->eachSpread(function (string $name, int $age) {\n" +# CODE +#: ./docs/8.x/collections.md:709 +#: ./docs/9.x/collections.md:741 +msgid "$collection->eachSpread(function ($name, $age) {\n" " return false;\n" -"});\n" - -#: docs/10.x/collections.md:block 168 (header) -msgid "`ensure()` {.collection-method}" -msgstr "`ensure()` {.collection-method}" - -#: docs/10.x/collections.md:block 169 (paragraph) -msgid "The `ensure` method may be used to verify that all elements of a collection are of a given type. Otherwise, an `UnexpectedValueException` will be thrown:" -msgstr "`ensure` 方法用於驗證 Collection 是否所有元素都是給定的型別。若有不符型別的元素,則會擲回 `UnexpectedValueException`:" - -#: docs/10.x/collections.md:block 170 (code) -msgid "return $collection->ensure(User::class);\n" -msgstr "return $collection->ensure(User::class);\n" - -#: docs/10.x/collections.md:block 171 (paragraph) -msgid "Primitive types such as `string`, `int`, `float`, `bool`, and `array` may also be specified:" -msgstr "也可以指定如 `string`, `int`, `float`, `bool` 與 `array` 等原生型別:" - -#: docs/10.x/collections.md:block 172 (code) -msgid "return $collection->ensure('int');\n" -msgstr "return $collection->ensure('int');\n" - -#: docs/10.x/collections.md:block 173 (quote) -msgid "**Warning** The `ensure` method does not guarantee that elements of different types will not be added to the collection at a later time." -msgstr "**Warning** `ensure` 方法並不保證在檢查之後不會有其他不符該型別的元素被加進 Collection。" +"});" +msgstr "" -#: docs/10.x/collections.md:block 175 (header) +# P +#: ./docs/8.x/collections.md:713 +#: ./docs/9.x/collections.md:745 +#: ./docs/10.x/collections.md:805 +#: ./docs/11.x/collections.md:862 +#: ./docs/master/collections.md:805 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:714 +#: ./docs/9.x/collections.md:746 +#: ./docs/10.x/collections.md:806 +#: ./docs/11.x/collections.md:863 +#: ./docs/master/collections.md:806 msgid "`every()` {.collection-method}" -msgstr "`every()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 176 (paragraph) +# P +#: ./docs/8.x/collections.md:716 +#: ./docs/9.x/collections.md:748 +#: ./docs/10.x/collections.md:808 +#: ./docs/11.x/collections.md:865 +#: ./docs/master/collections.md:808 msgid "The `every` method may be used to verify that all elements of a collection pass a given truth test:" -msgstr "`every` 方法可以用來認證某個 Collection 中的所有元素是否都通過了給定的布林測試:" +msgstr "" -#: docs/10.x/collections.md:block 177 (code) -msgid "collect([1, 2, 3, 4])->every(function (int $value, int $key) {\n" -" return $value > 2;\n" -"});\n\n" -"// false\n" -msgstr "collect([1, 2, 3, 4])->every(function (int $value, int $key) {\n" +# CODE +#: ./docs/8.x/collections.md:718 +#: ./docs/9.x/collections.md:750 +msgid "collect([1, 2, 3, 4])->every(function ($value, $key) {\n" " return $value > 2;\n" "});\n\n" -"// false\n" +"// false" +msgstr "" -#: docs/10.x/collections.md:block 178 (paragraph) +# P +#: ./docs/8.x/collections.md:724 +#: ./docs/9.x/collections.md:756 +#: ./docs/10.x/collections.md:816 +#: ./docs/11.x/collections.md:873 +#: ./docs/master/collections.md:816 msgid "If the collection is empty, the `every` method will return true:" -msgstr "若 Collection 為空,則 `every` 方法總是回傳 true:" +msgstr "" -#: docs/10.x/collections.md:block 179 (code) +# CODE +#: ./docs/8.x/collections.md:726 +#: ./docs/9.x/collections.md:758 msgid "$collection = collect([]);\n\n" -"$collection->every(function (int $value, int $key) {\n" -" return $value > 2;\n" -"});\n\n" -"// true\n" -msgstr "$collection = collect([]);\n\n" -"$collection->every(function (int $value, int $key) {\n" +"$collection->every(function ($value, $key) {\n" " return $value > 2;\n" "});\n\n" -"// true\n" +"// true" +msgstr "" -#: docs/10.x/collections.md:block 181 (header) +# P +#: ./docs/8.x/collections.md:734 +#: ./docs/9.x/collections.md:766 +#: ./docs/10.x/collections.md:826 +#: ./docs/11.x/collections.md:883 +#: ./docs/master/collections.md:826 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:735 +#: ./docs/9.x/collections.md:767 +#: ./docs/10.x/collections.md:827 +#: ./docs/11.x/collections.md:884 +#: ./docs/master/collections.md:827 msgid "`except()` {.collection-method}" -msgstr "`except()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 182 (paragraph) +# P +#: ./docs/8.x/collections.md:737 +#: ./docs/9.x/collections.md:769 +#: ./docs/10.x/collections.md:829 +#: ./docs/11.x/collections.md:886 +#: ./docs/master/collections.md:829 msgid "The `except` method returns all items in the collection except for those with the specified keys:" -msgstr "`except` 方法會回傳該 Collection 中,除了具有特定索引鍵外的所有項目:" +msgstr "" -#: docs/10.x/collections.md:block 183 (code) +# CODE +#: ./docs/8.x/collections.md:739 +#: ./docs/9.x/collections.md:771 +#: ./docs/10.x/collections.md:831 +#: ./docs/11.x/collections.md:888 +#: ./docs/master/collections.md:831 msgid "$collection = collect(['product_id' => 1, 'price' => 100, 'discount' => false]);\n\n" "$filtered = $collection->except(['price', 'discount']);\n\n" "$filtered->all();\n\n" -"// ['product_id' => 1]\n" -msgstr "$collection = collect(['product_id' => 1, 'price' => 100, 'discount' => false]);\n\n" -"$filtered = $collection->except(['price', 'discount']);\n\n" -"$filtered->all();\n\n" -"// ['product_id' => 1]\n" +"// ['product_id' => 1]" +msgstr "" -#: docs/10.x/collections.md:block 184 (paragraph) +# P +#: ./docs/8.x/collections.md:747 +#: ./docs/9.x/collections.md:779 +#: ./docs/10.x/collections.md:839 +#: ./docs/11.x/collections.md:896 +#: ./docs/master/collections.md:839 msgid "For the inverse of `except`, see the [only](#method-only) method." -msgstr "請參考 [only](#method-only) 方法以瞭解與 `except` 相反的方法。" +msgstr "" -#: docs/10.x/collections.md:block 185 (quote) -msgid "**Note** This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-except)." -msgstr "**Note** 在使用 [Eloquent Collection](/docs/{{version}}/eloquent-collections#method-except) 時,該方法的行為有經過修改。" +# P +#: ./docs/8.x/collections.md:749 +#: ./docs/9.x/collections.md:782 +#: ./docs/10.x/collections.md:842 +#: ./docs/11.x/collections.md:899 +#: ./docs/master/collections.md:842 +msgid "This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-except)." +msgstr "" -#: docs/10.x/collections.md:block 187 (header) +# P +#: ./docs/8.x/collections.md:751 +#: ./docs/9.x/collections.md:784 +#: ./docs/10.x/collections.md:844 +#: ./docs/11.x/collections.md:901 +#: ./docs/master/collections.md:844 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:752 +#: ./docs/9.x/collections.md:785 +#: ./docs/10.x/collections.md:845 +#: ./docs/11.x/collections.md:902 +#: ./docs/master/collections.md:845 msgid "`filter()` {.collection-method}" -msgstr "`filter()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 188 (paragraph) +# P +#: ./docs/8.x/collections.md:754 +#: ./docs/9.x/collections.md:787 +#: ./docs/10.x/collections.md:847 +#: ./docs/11.x/collections.md:904 +#: ./docs/master/collections.md:847 msgid "The `filter` method filters the collection using the given callback, keeping only those items that pass a given truth test:" -msgstr "`filter` 方法會使用給定的回呼來篩選該 Collection,並只保留通過給定布林測試的項目:" +msgstr "" -#: docs/10.x/collections.md:block 189 (code) +# CODE +#: ./docs/8.x/collections.md:756 +#: ./docs/9.x/collections.md:789 msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$filtered = $collection->filter(function (int $value, int $key) {\n" -" return $value > 2;\n" -"});\n\n" -"$filtered->all();\n\n" -"// [3, 4]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$filtered = $collection->filter(function (int $value, int $key) {\n" +"$filtered = $collection->filter(function ($value, $key) {\n" " return $value > 2;\n" "});\n\n" "$filtered->all();\n\n" -"// [3, 4]\n" +"// [3, 4]" +msgstr "" -#: docs/10.x/collections.md:block 190 (paragraph) -msgid "If no callback is supplied, all entries of the collection that are equivalent to `false` will be removed:" -msgstr "若未提供回呼,則該 Collection 中所有等價於 `false` 的項目都會被移除:" +# CODE +#: ./docs/10.x/collections.md:758 +#: ./docs/11.x/collections.md:815 +#: ./docs/master/collections.md:758 +msgid "$collection = collect([1, 2, 3, 4]);\n\n" +"$collection->each(function (int $item, int $key) {\n" +" // ...\n" +"});" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:766 +#: ./docs/11.x/collections.md:823 +#: ./docs/master/collections.md:766 +msgid "$collection->each(function (int $item, int $key) {\n" +" if (/* condition */) {\n" +" return false;\n" +" }\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/collections.md:766 +#: ./docs/9.x/collections.md:799 +#: ./docs/10.x/collections.md:859 +#: ./docs/11.x/collections.md:916 +#: ./docs/master/collections.md:859 +msgid "If no callback is supplied, all entries of the collection that are equivalent to `false` will be removed:" +msgstr "" -#: docs/10.x/collections.md:block 191 (code) +# CODE +#: ./docs/8.x/collections.md:768 +#: ./docs/9.x/collections.md:801 +#: ./docs/10.x/collections.md:861 +#: ./docs/11.x/collections.md:918 +#: ./docs/master/collections.md:861 msgid "$collection = collect([1, 2, 3, null, false, '', 0, []]);\n\n" "$collection->filter()->all();\n\n" -"// [1, 2, 3]\n" -msgstr "$collection = collect([1, 2, 3, null, false, '', 0, []]);\n\n" -"$collection->filter()->all();\n\n" -"// [1, 2, 3]\n" +"// [1, 2, 3]" +msgstr "" -#: docs/10.x/collections.md:block 192 (paragraph) +# P +#: ./docs/8.x/collections.md:774 +#: ./docs/9.x/collections.md:807 +#: ./docs/10.x/collections.md:867 +#: ./docs/11.x/collections.md:924 +#: ./docs/master/collections.md:867 msgid "For the inverse of `filter`, see the [reject](#method-reject) method." -msgstr "請參考 [reject](#method-reject) 方法以瞭解與 `filter` 相反的方法。" +msgstr "" -#: docs/10.x/collections.md:block 194 (header) +# P +#: ./docs/8.x/collections.md:776 +#: ./docs/9.x/collections.md:809 +#: ./docs/10.x/collections.md:869 +#: ./docs/11.x/collections.md:926 +#: ./docs/master/collections.md:869 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/collections.md:777 +#: ./docs/11.x/collections.md:834 +#: ./docs/master/collections.md:777 +msgid "$collection = collect([['John Doe', 35], ['Jane Doe', 33]]);\n\n" +"$collection->eachSpread(function (string $name, int $age) {\n" +" // ...\n" +"});" +msgstr "" + +# H4 +#: ./docs/8.x/collections.md:777 +#: ./docs/9.x/collections.md:810 +#: ./docs/10.x/collections.md:870 +#: ./docs/11.x/collections.md:927 +#: ./docs/master/collections.md:870 msgid "`first()` {.collection-method}" -msgstr "`first()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 195 (paragraph) +# P +#: ./docs/8.x/collections.md:779 +#: ./docs/9.x/collections.md:812 +#: ./docs/10.x/collections.md:872 +#: ./docs/11.x/collections.md:929 +#: ./docs/master/collections.md:872 msgid "The `first` method returns the first element in the collection that passes a given truth test:" -msgstr "`first` 方法會回傳該 Collection 中通過給定布林測試的第一個元素:" +msgstr "" -#: docs/10.x/collections.md:block 196 (code) -msgid "collect([1, 2, 3, 4])->first(function (int $value, int $key) {\n" -" return $value > 2;\n" -"});\n\n" -"// 3\n" -msgstr "collect([1, 2, 3, 4])->first(function (int $value, int $key) {\n" +# CODE +#: ./docs/8.x/collections.md:781 +#: ./docs/9.x/collections.md:814 +msgid "collect([1, 2, 3, 4])->first(function ($value, $key) {\n" " return $value > 2;\n" "});\n\n" -"// 3\n" +"// 3" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:785 +#: ./docs/11.x/collections.md:842 +#: ./docs/master/collections.md:785 +msgid "$collection->eachSpread(function (string $name, int $age) {\n" +" return false;\n" +"});" +msgstr "" -#: docs/10.x/collections.md:block 197 (paragraph) +# P +#: ./docs/8.x/collections.md:787 +#: ./docs/9.x/collections.md:820 +#: ./docs/10.x/collections.md:880 +#: ./docs/11.x/collections.md:937 +#: ./docs/master/collections.md:880 msgid "You may also call the `first` method with no arguments to get the first element in the collection. If the collection is empty, `null` is returned:" -msgstr "呼叫 `first` 方法時也可以不給任何引數,以取得該 Collection 中的第一個元素。若該 Collection 為空,則會回傳 `null`:" +msgstr "" -#: docs/10.x/collections.md:block 198 (code) +# P +#: ./docs/10.x/collections.md:789 +#: ./docs/11.x/collections.md:846 +#: ./docs/master/collections.md:789 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/8.x/collections.md:789 +#: ./docs/9.x/collections.md:822 +#: ./docs/10.x/collections.md:882 +#: ./docs/11.x/collections.md:939 +#: ./docs/master/collections.md:882 msgid "collect([1, 2, 3, 4])->first();\n\n" -"// 1\n" -msgstr "collect([1, 2, 3, 4])->first();\n\n" -"// 1\n" - -#: docs/10.x/collections.md:block 200 (header) -msgid "`firstOrFail()` {.collection-method}" -msgstr "`firstOrFail()` {.collection-method}" - -#: docs/10.x/collections.md:block 201 (paragraph) -msgid "The `firstOrFail` method is identical to the `first` method; however, if no result is found, an `Illuminate\\Support\\ItemNotFoundException` exception will be thrown:" -msgstr "`firstOrFail` 方法與 `first` 方法完全相同。不過,若無結果,則會擲回 `Illuminate\\Support\\ItemNotFoundException` Exception:" +"// 1" +msgstr "" -#: docs/10.x/collections.md:block 202 (code) -msgid "collect([1, 2, 3, 4])->firstOrFail(function (int $value, int $key) {\n" -" return $value > 5;\n" -"});\n\n" -"// Throws ItemNotFoundException...\n" -msgstr "collect([1, 2, 3, 4])->firstOrFail(function (int $value, int $key) {\n" -" return $value > 5;\n" -"});\n\n" -"// 回擲 (Throw) ItemNotFoundException...\n" +# H4 +#: ./docs/10.x/collections.md:790 +#: ./docs/11.x/collections.md:847 +#: ./docs/master/collections.md:790 +msgid "`ensure()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 203 (paragraph) -msgid "You may also call the `firstOrFail` method with no arguments to get the first element in the collection. If the collection is empty, an `Illuminate\\Support\\ItemNotFoundException` exception will be thrown:" -msgstr "我們也可以不帶任何參數地呼叫 `firstOrFail` 方法,以取得該 Collection 中的第一個元素。若該 Collection 為空,則會擲回 `Illuminate\\Support\\ItemNotFoundException` Exception:" +# P +#: ./docs/10.x/collections.md:792 +#: ./docs/11.x/collections.md:849 +#: ./docs/master/collections.md:792 +msgid "The `ensure` method may be used to verify that all elements of a collection are of a given type or list of types. Otherwise, an `UnexpectedValueException` will be thrown:" +msgstr "" -#: docs/10.x/collections.md:block 204 (code) -msgid "collect([])->firstOrFail();\n\n" -"// Throws ItemNotFoundException...\n" -msgstr "collect([])->firstOrFail();\n\n" -"// 擲回 ItemNotFoundException...\n" +# P +#: ./docs/8.x/collections.md:793 +#: ./docs/9.x/collections.md:843 +#: ./docs/10.x/collections.md:903 +#: ./docs/11.x/collections.md:960 +#: ./docs/master/collections.md:903 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/collections.md:794 +#: ./docs/11.x/collections.md:851 +#: ./docs/master/collections.md:794 +msgid "return $collection->ensure(User::class);\n\n" +"return $collection->ensure([User::class, Customer::class]);" +msgstr "" -#: docs/10.x/collections.md:block 206 (header) +# H4 +#: ./docs/8.x/collections.md:794 +#: ./docs/9.x/collections.md:844 +#: ./docs/10.x/collections.md:904 +#: ./docs/11.x/collections.md:961 +#: ./docs/master/collections.md:904 msgid "`firstWhere()` {.collection-method}" -msgstr "`firstWhere()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 207 (paragraph) +# P +#: ./docs/8.x/collections.md:796 +#: ./docs/9.x/collections.md:846 +#: ./docs/10.x/collections.md:906 +#: ./docs/11.x/collections.md:963 +#: ./docs/master/collections.md:906 msgid "The `firstWhere` method returns the first element in the collection with the given key / value pair:" -msgstr "`firstWhere` 方法會回傳該 Collection 中具有給定索引鍵/值配對的第一個元素:" +msgstr "" + +# P +#: ./docs/10.x/collections.md:798 +#: ./docs/11.x/collections.md:855 +#: ./docs/master/collections.md:798 +msgid "Primitive types such as `string`, `int`, `float`, `bool`, and `array` may also be specified:" +msgstr "" -#: docs/10.x/collections.md:block 208 (code) +# CODE +#: ./docs/8.x/collections.md:798 +#: ./docs/9.x/collections.md:848 +#: ./docs/10.x/collections.md:908 +#: ./docs/11.x/collections.md:965 +#: ./docs/master/collections.md:908 msgid "$collection = collect([\n" " ['name' => 'Regena', 'age' => null],\n" " ['name' => 'Linda', 'age' => 14],\n" @@ -1190,75 +2823,206 @@ msgid "$collection = collect([\n" " ['name' => 'Linda', 'age' => 84],\n" "]);\n\n" "$collection->firstWhere('name', 'Linda');\n\n" -"// ['name' => 'Linda', 'age' => 14]\n" -msgstr "$collection = collect([\n" -" ['name' => 'Regena', 'age' => null],\n" -" ['name' => 'Linda', 'age' => 14],\n" -" ['name' => 'Diego', 'age' => 23],\n" -" ['name' => 'Linda', 'age' => 84],\n" -"]);\n\n" -"$collection->firstWhere('name', 'Linda');\n\n" -"// ['name' => 'Linda', 'age' => 14]\n" +"// ['name' => 'Linda', 'age' => 14]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:800 +#: ./docs/11.x/collections.md:857 +#: ./docs/master/collections.md:800 +msgid "return $collection->ensure('int');" +msgstr "" + +# P +#: ./docs/10.x/collections.md:803 +#: ./docs/11.x/collections.md:860 +#: ./docs/master/collections.md:803 +msgid "The `ensure` method does not guarantee that elements of different types will not be added to the collection at a later time." +msgstr "" -#: docs/10.x/collections.md:block 209 (paragraph) +# P +#: ./docs/8.x/collections.md:809 +#: ./docs/9.x/collections.md:859 +#: ./docs/10.x/collections.md:919 +#: ./docs/11.x/collections.md:976 +#: ./docs/master/collections.md:919 msgid "You may also call the `firstWhere` method with a comparison operator:" -msgstr "也可以使用比較運算子來呼叫 `firstWhere` 方法:" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:810 +#: ./docs/11.x/collections.md:867 +#: ./docs/master/collections.md:810 +msgid "collect([1, 2, 3, 4])->every(function (int $value, int $key) {\n" +" return $value > 2;\n" +"});\n\n" +"// false" +msgstr "" -#: docs/10.x/collections.md:block 210 (code) +# CODE +#: ./docs/8.x/collections.md:811 +#: ./docs/9.x/collections.md:861 +#: ./docs/10.x/collections.md:921 +#: ./docs/11.x/collections.md:978 +#: ./docs/master/collections.md:921 msgid "$collection->firstWhere('age', '>=', 18);\n\n" -"// ['name' => 'Diego', 'age' => 23]\n" -msgstr "$collection->firstWhere('age', '>=', 18);\n\n" -"// ['name' => 'Diego', 'age' => 23]\n" +"// ['name' => 'Diego', 'age' => 23]" +msgstr "" -#: docs/10.x/collections.md:block 211 (paragraph) +# P +#: ./docs/8.x/collections.md:815 +#: ./docs/9.x/collections.md:865 +#: ./docs/10.x/collections.md:925 +#: ./docs/11.x/collections.md:982 +#: ./docs/master/collections.md:925 msgid "Like the [where](#method-where) method, you may pass one argument to the `firstWhere` method. In this scenario, the `firstWhere` method will return the first item where the given item key's value is \"truthy\":" -msgstr "與 [where](#method-where) 方法類似,可以傳入一個引數給 `firstWhere` 方法。在這種情境下,`firstWhere` 方法會回傳給定項目的索引鍵值可被視為「True」的第一個項目:" +msgstr "" -#: docs/10.x/collections.md:block 212 (code) +# CODE +#: ./docs/8.x/collections.md:817 +#: ./docs/9.x/collections.md:867 +#: ./docs/10.x/collections.md:927 +#: ./docs/11.x/collections.md:984 +#: ./docs/master/collections.md:927 msgid "$collection->firstWhere('age');\n\n" -"// ['name' => 'Linda', 'age' => 14]\n" -msgstr "$collection->firstWhere('age');\n\n" -"// ['name' => 'Linda', 'age' => 14]\n" +"// ['name' => 'Linda', 'age' => 14]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:818 +#: ./docs/11.x/collections.md:875 +#: ./docs/master/collections.md:818 +msgid "$collection = collect([]);\n\n" +"$collection->every(function (int $value, int $key) {\n" +" return $value > 2;\n" +"});\n\n" +"// true" +msgstr "" -#: docs/10.x/collections.md:block 214 (header) +# P +#: ./docs/8.x/collections.md:821 +#: ./docs/9.x/collections.md:871 +#: ./docs/10.x/collections.md:931 +#: ./docs/11.x/collections.md:988 +#: ./docs/master/collections.md:931 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:822 +#: ./docs/9.x/collections.md:872 +#: ./docs/10.x/collections.md:932 +#: ./docs/11.x/collections.md:989 +#: ./docs/master/collections.md:932 msgid "`flatMap()` {.collection-method}" -msgstr "`flatMap()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 215 (paragraph) +# P +#: ./docs/8.x/collections.md:824 +#: ./docs/9.x/collections.md:874 +#: ./docs/10.x/collections.md:934 +#: ./docs/11.x/collections.md:991 +#: ./docs/master/collections.md:934 msgid "The `flatMap` method iterates through the collection and passes each value to the given closure. The closure is free to modify the item and return it, thus forming a new collection of modified items. Then, the array is flattened by one level:" -msgstr "`flatMap` 方法會迭代該 Collection,並將每個值傳入給定的閉包。該閉包可自由修改項目並進行回傳,藉此依據修改的項目來建立一個新的 Collection。接著,陣列會被扁平化一個階層:" +msgstr "" -#: docs/10.x/collections.md:block 216 (code) +# CODE +#: ./docs/8.x/collections.md:826 +#: ./docs/9.x/collections.md:876 msgid "$collection = collect([\n" " ['name' => 'Sally'],\n" " ['school' => 'Arkansas'],\n" " ['age' => 28]\n" "]);\n\n" -"$flattened = $collection->flatMap(function (array $values) {\n" +"$flattened = $collection->flatMap(function ($values) {\n" " return array_map('strtoupper', $values);\n" "});\n\n" "$flattened->all();\n\n" -"// ['name' => 'SALLY', 'school' => 'ARKANSAS', 'age' => '28'];\n" -msgstr "$collection = collect([\n" -" ['name' => 'Sally'],\n" -" ['school' => 'Arkansas'],\n" -" ['age' => 28]\n" -"]);\n\n" -"$flattened = $collection->flatMap(function (array $values) {\n" -" return array_map('strtoupper', $values);\n" +"// ['name' => 'SALLY', 'school' => 'ARKANSAS', 'age' => '28'];" +msgstr "" + +# P +#: ./docs/9.x/collections.md:826 +#: ./docs/10.x/collections.md:886 +#: ./docs/11.x/collections.md:943 +#: ./docs/master/collections.md:886 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/collections.md:827 +#: ./docs/10.x/collections.md:887 +#: ./docs/11.x/collections.md:944 +#: ./docs/master/collections.md:887 +msgid "`firstOrFail()` {.collection-method}" +msgstr "" + +# P +#: ./docs/9.x/collections.md:829 +#: ./docs/10.x/collections.md:889 +#: ./docs/11.x/collections.md:946 +#: ./docs/master/collections.md:889 +msgid "The `firstOrFail` method is identical to the `first` method; however, if no result is found, an `Illuminate\\Support\\ItemNotFoundException` exception will be thrown:" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:831 +msgid "collect([1, 2, 3, 4])->firstOrFail(function ($value, $key) {\n" +" return $value > 5;\n" "});\n\n" -"$flattened->all();\n\n" -"// ['name' => 'SALLY', 'school' => 'ARKANSAS', 'age' => '28'];\n" +"// Throws ItemNotFoundException..." +msgstr "" -#: docs/10.x/collections.md:block 218 (header) +# P +#: ./docs/9.x/collections.md:837 +#: ./docs/10.x/collections.md:897 +#: ./docs/11.x/collections.md:954 +#: ./docs/master/collections.md:897 +msgid "You may also call the `firstOrFail` method with no arguments to get the first element in the collection. If the collection is empty, an `Illuminate\\Support\\ItemNotFoundException` exception will be thrown:" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:839 +#: ./docs/10.x/collections.md:899 +#: ./docs/11.x/collections.md:956 +#: ./docs/master/collections.md:899 +msgid "collect([])->firstOrFail();\n\n" +"// Throws ItemNotFoundException..." +msgstr "" + +# P +#: ./docs/8.x/collections.md:840 +#: ./docs/9.x/collections.md:890 +#: ./docs/10.x/collections.md:950 +#: ./docs/11.x/collections.md:1007 +#: ./docs/master/collections.md:950 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:841 +#: ./docs/9.x/collections.md:891 +#: ./docs/10.x/collections.md:951 +#: ./docs/11.x/collections.md:1008 +#: ./docs/master/collections.md:951 msgid "`flatten()` {.collection-method}" -msgstr "`flatten()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 219 (paragraph) +# P +#: ./docs/8.x/collections.md:843 +#: ./docs/9.x/collections.md:893 +#: ./docs/10.x/collections.md:953 +#: ./docs/11.x/collections.md:1010 +#: ./docs/master/collections.md:953 msgid "The `flatten` method flattens a multi-dimensional collection into a single dimension:" -msgstr "`flatten` 方法會將一個多維 Collection 扁平化為單一維度:" +msgstr "" -#: docs/10.x/collections.md:block 220 (code) +# CODE +#: ./docs/8.x/collections.md:845 +#: ./docs/9.x/collections.md:895 +#: ./docs/10.x/collections.md:955 +#: ./docs/11.x/collections.md:1012 +#: ./docs/master/collections.md:955 msgid "$collection = collect([\n" " 'name' => 'taylor',\n" " 'languages' => [\n" @@ -1267,22 +3031,36 @@ msgid "$collection = collect([\n" "]);\n\n" "$flattened = $collection->flatten();\n\n" "$flattened->all();\n\n" -"// ['taylor', 'php', 'javascript'];\n" -msgstr "$collection = collect([\n" -" 'name' => 'taylor',\n" -" 'languages' => [\n" -" 'php', 'javascript'\n" -" ]\n" -"]);\n\n" -"$flattened = $collection->flatten();\n\n" -"$flattened->all();\n\n" -"// ['taylor', 'php', 'javascript'];\n" +"// ['taylor', 'php', 'javascript'];" +msgstr "" -#: docs/10.x/collections.md:block 221 (paragraph) +# CODE +#: ./docs/10.x/collections.md:849 +#: ./docs/11.x/collections.md:906 +#: ./docs/master/collections.md:849 +msgid "$collection = collect([1, 2, 3, 4]);\n\n" +"$filtered = $collection->filter(function (int $value, int $key) {\n" +" return $value > 2;\n" +"});\n\n" +"$filtered->all();\n\n" +"// [3, 4]" +msgstr "" + +# P +#: ./docs/8.x/collections.md:858 +#: ./docs/9.x/collections.md:908 +#: ./docs/10.x/collections.md:968 +#: ./docs/11.x/collections.md:1025 +#: ./docs/master/collections.md:968 msgid "If necessary, you may pass the `flatten` method a \"depth\" argument:" -msgstr "若有需要,可以傳入一個可選的「depth 深度」引數:" +msgstr "" -#: docs/10.x/collections.md:block 222 (code) +# CODE +#: ./docs/8.x/collections.md:860 +#: ./docs/9.x/collections.md:910 +#: ./docs/10.x/collections.md:970 +#: ./docs/11.x/collections.md:1027 +#: ./docs/master/collections.md:970 msgid "$collection = collect([\n" " 'Apple' => [\n" " [\n" @@ -1304,143 +3082,290 @@ msgid "$collection = collect([\n" " ['name' => 'iPhone 6S', 'brand' => 'Apple'],\n" " ['name' => 'Galaxy S7', 'brand' => 'Samsung'],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" 'Apple' => [\n" -" [\n" -" 'name' => 'iPhone 6S',\n" -" 'brand' => 'Apple'\n" -" ],\n" -" ],\n" -" 'Samsung' => [\n" -" [\n" -" 'name' => 'Galaxy S7',\n" -" 'brand' => 'Samsung'\n" -" ],\n" -" ],\n" -"]);\n\n" -"$products = $collection->flatten(1);\n\n" -"$products->values()->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'iPhone 6S', 'brand' => 'Apple'],\n" -" ['name' => 'Galaxy S7', 'brand' => 'Samsung'],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:874 +#: ./docs/11.x/collections.md:931 +#: ./docs/master/collections.md:874 +msgid "collect([1, 2, 3, 4])->first(function (int $value, int $key) {\n" +" return $value > 2;\n" +"});\n\n" +"// 3" +msgstr "" -#: docs/10.x/collections.md:block 223 (paragraph) +# P +#: ./docs/8.x/collections.md:886 +#: ./docs/9.x/collections.md:936 +#: ./docs/10.x/collections.md:996 +#: ./docs/11.x/collections.md:1053 +#: ./docs/master/collections.md:996 msgid "In this example, calling `flatten` without providing the depth would have also flattened the nested arrays, resulting in `['iPhone 6S', 'Apple', 'Galaxy S7', 'Samsung']`. Providing a depth allows you to specify the number of levels nested arrays will be flattened." -msgstr "在此範例中,在不提供深度的情況下呼叫 `flatten` 會連巢狀陣列也一併被扁平化,產生 `['iPhone 6S', 'Apple', 'Galaxy S7', 'Samsung']`。若提供了深度,則可指定哪些等級的巢狀陣列要被扁平化。" +msgstr "" -#: docs/10.x/collections.md:block 225 (header) +# P +#: ./docs/8.x/collections.md:888 +#: ./docs/9.x/collections.md:938 +#: ./docs/10.x/collections.md:998 +#: ./docs/11.x/collections.md:1055 +#: ./docs/master/collections.md:998 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:889 +#: ./docs/9.x/collections.md:939 +#: ./docs/10.x/collections.md:999 +#: ./docs/11.x/collections.md:1056 +#: ./docs/master/collections.md:999 msgid "`flip()` {.collection-method}" -msgstr "`flip()` {.collection-method}" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:891 +#: ./docs/11.x/collections.md:948 +#: ./docs/master/collections.md:891 +msgid "collect([1, 2, 3, 4])->firstOrFail(function (int $value, int $key) {\n" +" return $value > 5;\n" +"});\n\n" +"// Throws ItemNotFoundException..." +msgstr "" -#: docs/10.x/collections.md:block 226 (paragraph) +# P +#: ./docs/8.x/collections.md:891 +#: ./docs/9.x/collections.md:941 +#: ./docs/10.x/collections.md:1001 +#: ./docs/11.x/collections.md:1058 +#: ./docs/master/collections.md:1001 msgid "The `flip` method swaps the collection's keys with their corresponding values:" -msgstr "`flip` 方法會將該 Collection 的索引鍵與其對應的值進行呼喚:" +msgstr "" -#: docs/10.x/collections.md:block 227 (code) +# CODE +#: ./docs/8.x/collections.md:893 +#: ./docs/9.x/collections.md:943 +#: ./docs/10.x/collections.md:1003 +#: ./docs/11.x/collections.md:1060 +#: ./docs/master/collections.md:1003 msgid "$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);\n\n" "$flipped = $collection->flip();\n\n" "$flipped->all();\n\n" -"// ['taylor' => 'name', 'laravel' => 'framework']\n" -msgstr "$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);\n\n" -"$flipped = $collection->flip();\n\n" -"$flipped->all();\n\n" -"// ['taylor' => 'name', 'laravel' => 'framework']\n" +"// ['taylor' => 'name', 'laravel' => 'framework']" +msgstr "" -#: docs/10.x/collections.md:block 229 (header) +# P +#: ./docs/8.x/collections.md:901 +#: ./docs/9.x/collections.md:951 +#: ./docs/10.x/collections.md:1011 +#: ./docs/11.x/collections.md:1068 +#: ./docs/master/collections.md:1011 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:902 +#: ./docs/9.x/collections.md:952 +#: ./docs/10.x/collections.md:1012 +#: ./docs/11.x/collections.md:1069 +#: ./docs/master/collections.md:1012 msgid "`forget()` {.collection-method}" -msgstr "`forget()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 230 (paragraph) +# P +#: ./docs/8.x/collections.md:904 +#: ./docs/9.x/collections.md:954 +#: ./docs/10.x/collections.md:1014 +#: ./docs/11.x/collections.md:1071 +#: ./docs/master/collections.md:1014 msgid "The `forget` method removes an item from the collection by its key:" -msgstr "`forget` 方法根據項目的索引鍵來在該 Collection 中移除項目:" +msgstr "" -#: docs/10.x/collections.md:block 231 (code) +# CODE +#: ./docs/8.x/collections.md:906 +#: ./docs/9.x/collections.md:956 +#: ./docs/10.x/collections.md:1016 +#: ./docs/master/collections.md:1016 msgid "$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);\n\n" "$collection->forget('name');\n\n" "$collection->all();\n\n" -"// ['framework' => 'laravel']\n" -msgstr "$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);\n\n" -"$collection->forget('name');\n\n" -"$collection->all();\n\n" -"// ['framework' => 'laravel']\n" +"// ['framework' => 'laravel']" +msgstr "" -#: docs/10.x/collections.md:block 232 (quote) -msgid "**Warning** Unlike most other collection methods, `forget` does not return a new modified collection; it modifies the collection it is called on." -msgstr "**Warning** 與其他大多數 Collection 方法不同,`forget` 不會回傳經過修改的新 Collection。該方法會修改被呼叫的那個 Collection。" +# P +#: ./docs/8.x/collections.md:914 +#: ./docs/9.x/collections.md:965 +#: ./docs/10.x/collections.md:1025 +#: ./docs/master/collections.md:1025 +msgid "Unlike most other collection methods, `forget` does not return a new modified collection; it modifies the collection it is called on." +msgstr "" -#: docs/10.x/collections.md:block 234 (header) +# P +#: ./docs/8.x/collections.md:916 +#: ./docs/9.x/collections.md:967 +#: ./docs/10.x/collections.md:1027 +#: ./docs/11.x/collections.md:1088 +#: ./docs/master/collections.md:1027 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:917 +#: ./docs/9.x/collections.md:968 +#: ./docs/10.x/collections.md:1028 +#: ./docs/11.x/collections.md:1089 +#: ./docs/master/collections.md:1028 msgid "`forPage()` {.collection-method}" -msgstr "`forPage()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 235 (paragraph) +# P +#: ./docs/8.x/collections.md:919 +#: ./docs/9.x/collections.md:970 +#: ./docs/10.x/collections.md:1030 +#: ./docs/11.x/collections.md:1091 +#: ./docs/master/collections.md:1030 msgid "The `forPage` method returns a new collection containing the items that would be present on a given page number. The method accepts the page number as its first argument and the number of items to show per page as its second argument:" -msgstr "`forPage` 會回傳一個新的 Collection,包含指定頁碼上的項目。該方法接受第一個引數為頁碼,而第二個引數則為每頁要顯示幾個項目:" +msgstr "" -#: docs/10.x/collections.md:block 236 (code) +# CODE +#: ./docs/8.x/collections.md:921 +#: ./docs/9.x/collections.md:972 +#: ./docs/10.x/collections.md:1032 +#: ./docs/11.x/collections.md:1093 +#: ./docs/master/collections.md:1032 msgid "$collection = collect([1, 2, 3, 4, 5, 6, 7, 8, 9]);\n\n" "$chunk = $collection->forPage(2, 3);\n\n" "$chunk->all();\n\n" -"// [4, 5, 6]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5, 6, 7, 8, 9]);\n\n" -"$chunk = $collection->forPage(2, 3);\n\n" -"$chunk->all();\n\n" -"// [4, 5, 6]\n" +"// [4, 5, 6]" +msgstr "" -#: docs/10.x/collections.md:block 238 (header) +# P +#: ./docs/8.x/collections.md:929 +#: ./docs/9.x/collections.md:980 +#: ./docs/10.x/collections.md:1040 +#: ./docs/11.x/collections.md:1101 +#: ./docs/master/collections.md:1040 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:930 +#: ./docs/9.x/collections.md:981 +#: ./docs/10.x/collections.md:1041 +#: ./docs/11.x/collections.md:1102 +#: ./docs/master/collections.md:1041 msgid "`get()` {.collection-method}" -msgstr "`get()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 239 (paragraph) +# P +#: ./docs/8.x/collections.md:932 +#: ./docs/9.x/collections.md:983 +#: ./docs/10.x/collections.md:1043 +#: ./docs/11.x/collections.md:1104 +#: ./docs/master/collections.md:1043 msgid "The `get` method returns the item at a given key. If the key does not exist, `null` is returned:" -msgstr "`get` 方法會回傳給定索引鍵上的項目。若該索引鍵不存在,則會回傳 `null`:" +msgstr "" -#: docs/10.x/collections.md:block 240 (code) +# CODE +#: ./docs/8.x/collections.md:934 +#: ./docs/9.x/collections.md:985 +#: ./docs/10.x/collections.md:1045 +#: ./docs/11.x/collections.md:1106 +#: ./docs/master/collections.md:1045 msgid "$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);\n\n" "$value = $collection->get('name');\n\n" -"// taylor\n" -msgstr "$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);\n\n" -"$value = $collection->get('name');\n\n" -"// taylor\n" +"// taylor" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:936 +#: ./docs/11.x/collections.md:993 +#: ./docs/master/collections.md:936 +msgid "$collection = collect([\n" +" ['name' => 'Sally'],\n" +" ['school' => 'Arkansas'],\n" +" ['age' => 28]\n" +"]);\n\n" +"$flattened = $collection->flatMap(function (array $values) {\n" +" return array_map('strtoupper', $values);\n" +"});\n\n" +"$flattened->all();\n\n" +"// ['name' => 'SALLY', 'school' => 'ARKANSAS', 'age' => '28'];" +msgstr "" -#: docs/10.x/collections.md:block 241 (paragraph) +# P +#: ./docs/8.x/collections.md:940 +#: ./docs/9.x/collections.md:991 +#: ./docs/10.x/collections.md:1051 +#: ./docs/11.x/collections.md:1112 +#: ./docs/master/collections.md:1051 msgid "You may optionally pass a default value as the second argument:" -msgstr "也可以傳入可選的第二個引數提供預設值:" +msgstr "" -#: docs/10.x/collections.md:block 242 (code) +# CODE +#: ./docs/8.x/collections.md:942 +#: ./docs/9.x/collections.md:993 +#: ./docs/10.x/collections.md:1053 +#: ./docs/11.x/collections.md:1114 +#: ./docs/master/collections.md:1053 msgid "$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);\n\n" "$value = $collection->get('age', 34);\n\n" -"// 34\n" -msgstr "$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);\n\n" -"$value = $collection->get('age', 34);\n\n" -"// 34\n" +"// 34" +msgstr "" -#: docs/10.x/collections.md:block 243 (paragraph) +# P +#: ./docs/8.x/collections.md:948 +#: ./docs/9.x/collections.md:999 +#: ./docs/10.x/collections.md:1059 +#: ./docs/11.x/collections.md:1120 +#: ./docs/master/collections.md:1059 msgid "You may even pass a callback as the method's default value. The result of the callback will be returned if the specified key does not exist:" -msgstr "也可以傳入一個回呼來作為該方法的預設值。若特定的索引鍵不存在,就會回傳該回呼的結果:" +msgstr "" -#: docs/10.x/collections.md:block 244 (code) +# CODE +#: ./docs/8.x/collections.md:950 +#: ./docs/9.x/collections.md:1001 +#: ./docs/10.x/collections.md:1061 +#: ./docs/11.x/collections.md:1122 +#: ./docs/master/collections.md:1061 msgid "$collection->get('email', function () {\n" " return 'taylor@example.com';\n" "});\n\n" -"// taylor@example.com\n" -msgstr "$collection->get('email', function () {\n" -" return 'taylor@example.com';\n" -"});\n\n" -"// taylor@example.com\n" +"// taylor@example.com" +msgstr "" -#: docs/10.x/collections.md:block 246 (header) +# P +#: ./docs/8.x/collections.md:956 +#: ./docs/9.x/collections.md:1007 +#: ./docs/10.x/collections.md:1067 +#: ./docs/11.x/collections.md:1128 +#: ./docs/master/collections.md:1067 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:957 +#: ./docs/9.x/collections.md:1008 +#: ./docs/10.x/collections.md:1068 +#: ./docs/11.x/collections.md:1129 +#: ./docs/master/collections.md:1068 msgid "`groupBy()` {.collection-method}" -msgstr "`groupBy()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 247 (paragraph) +# P +#: ./docs/8.x/collections.md:959 +#: ./docs/9.x/collections.md:1010 +#: ./docs/10.x/collections.md:1070 +#: ./docs/11.x/collections.md:1131 +#: ./docs/master/collections.md:1070 msgid "The `groupBy` method groups the collection's items by a given key:" -msgstr "`groupBy` 方法會依照給定的索引鍵來將該 Collection 的項目分組:" +msgstr "" -#: docs/10.x/collections.md:block 248 (code) +# CODE +#: ./docs/8.x/collections.md:961 +#: ./docs/9.x/collections.md:1012 +#: ./docs/10.x/collections.md:1072 +#: ./docs/11.x/collections.md:1133 +#: ./docs/master/collections.md:1072 msgid "$collection = collect([\n" " ['account_id' => 'account-x10', 'product' => 'Chair'],\n" " ['account_id' => 'account-x10', 'product' => 'Bookcase'],\n" @@ -1458,47 +3383,22 @@ msgid "$collection = collect([\n" " ['account_id' => 'account-x11', 'product' => 'Desk'],\n" " ],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['account_id' => 'account-x10', 'product' => 'Chair'],\n" -" ['account_id' => 'account-x10', 'product' => 'Bookcase'],\n" -" ['account_id' => 'account-x11', 'product' => 'Desk'],\n" -"]);\n\n" -"$grouped = $collection->groupBy('account_id');\n\n" -"$grouped->all();\n\n" -"/*\n" -" [\n" -" 'account-x10' => [\n" -" ['account_id' => 'account-x10', 'product' => 'Chair'],\n" -" ['account_id' => 'account-x10', 'product' => 'Bookcase'],\n" -" ],\n" -" 'account-x11' => [\n" -" ['account_id' => 'account-x11', 'product' => 'Desk'],\n" -" ],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 249 (paragraph) +# P +#: ./docs/8.x/collections.md:983 +#: ./docs/9.x/collections.md:1034 +#: ./docs/10.x/collections.md:1094 +#: ./docs/11.x/collections.md:1155 +#: ./docs/master/collections.md:1094 msgid "Instead of passing a string `key`, you may pass a callback. The callback should return the value you wish to key the group by:" -msgstr "除了傳入字串 `key` 以外,也可以傳入一個回呼。該回呼應回傳用於分組的索引鍵值:" +msgstr "" -#: docs/10.x/collections.md:block 250 (code) -msgid "$grouped = $collection->groupBy(function (array $item, int $key) {\n" -" return substr($item['account_id'], -3);\n" -"});\n\n" -"$grouped->all();\n\n" -"/*\n" -" [\n" -" 'x10' => [\n" -" ['account_id' => 'account-x10', 'product' => 'Chair'],\n" -" ['account_id' => 'account-x10', 'product' => 'Bookcase'],\n" -" ],\n" -" 'x11' => [\n" -" ['account_id' => 'account-x11', 'product' => 'Desk'],\n" -" ],\n" -" ]\n" -"*/\n" -msgstr "$grouped = $collection->groupBy(function (array $item, int $key) {\n" +# CODE +#: ./docs/8.x/collections.md:985 +#: ./docs/9.x/collections.md:1036 +msgid "$grouped = $collection->groupBy(function ($item, $key) {\n" " return substr($item['account_id'], -3);\n" "});\n\n" "$grouped->all();\n\n" @@ -1512,22 +3412,29 @@ msgstr "$grouped = $collection->groupBy(function (array $item, int $key) {\n" " ['account_id' => 'account-x11', 'product' => 'Desk'],\n" " ],\n" " ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 251 (paragraph) +# P +#: ./docs/8.x/collections.md:1003 +#: ./docs/9.x/collections.md:1054 +#: ./docs/10.x/collections.md:1114 +#: ./docs/11.x/collections.md:1175 +#: ./docs/master/collections.md:1114 msgid "Multiple grouping criteria may be passed as an array. Each array element will be applied to the corresponding level within a multi-dimensional array:" -msgstr "若有多個分組的方法,則可傳入陣列。陣列中的各個元素會被在對應的多維陣列上的層級:" +msgstr "" -#: docs/10.x/collections.md:block 252 (code) +# CODE +#: ./docs/8.x/collections.md:1005 msgid "$data = new Collection([\n" " 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" " 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" " 30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],\n" " 40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],\n" "]);\n\n" -"$result = $data->groupBy(['skill', function (array $item) {\n" +"$result = $data->groupBy(['skill', function ($item) {\n" " return $item['roles'];\n" -"}], preserveKeys: true);\n\n" +"}], $preserveKeys = true);\n\n" "/*\n" "[\n" " 1 => [\n" @@ -1551,14 +3458,60 @@ msgid "$data = new Collection([\n" " ],\n" " ],\n" "];\n" -"*/\n" -msgstr "$data = new Collection([\n" +"*/" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1041 +#: ./docs/9.x/collections.md:1092 +#: ./docs/10.x/collections.md:1152 +#: ./docs/11.x/collections.md:1213 +#: ./docs/master/collections.md:1152 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1042 +#: ./docs/9.x/collections.md:1093 +#: ./docs/10.x/collections.md:1153 +#: ./docs/11.x/collections.md:1214 +#: ./docs/master/collections.md:1153 +msgid "`has()` {.collection-method}" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1044 +#: ./docs/9.x/collections.md:1095 +#: ./docs/10.x/collections.md:1155 +#: ./docs/11.x/collections.md:1216 +#: ./docs/master/collections.md:1155 +msgid "The `has` method determines if a given key exists in the collection:" +msgstr "" + +# CODE +#: ./docs/8.x/collections.md:1046 +#: ./docs/9.x/collections.md:1097 +#: ./docs/10.x/collections.md:1157 +#: ./docs/11.x/collections.md:1218 +#: ./docs/master/collections.md:1157 +msgid "$collection = collect(['account_id' => 1, 'product' => 'Desk', 'amount' => 5]);\n\n" +"$collection->has('product');\n\n" +"// true\n\n" +"$collection->has(['product', 'amount']);\n\n" +"// true\n\n" +"$collection->has(['amount', 'price']);\n\n" +"// false" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:1056 +msgid "$data = new Collection([\n" " 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" " 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" " 30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],\n" " 40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],\n" "]);\n\n" -"$result = $data->groupBy(['skill', function (array $item) {\n" +"$result = $data->groupBy(['skill', function ($item) {\n" " return $item['roles'];\n" "}], preserveKeys: true);\n\n" "/*\n" @@ -1584,163 +3537,187 @@ msgstr "$data = new Collection([\n" " ],\n" " ],\n" "];\n" -"*/\n" - -#: docs/10.x/collections.md:block 254 (header) -msgid "`has()` {.collection-method}" -msgstr "`has()` {.collection-method}" - -#: docs/10.x/collections.md:block 255 (paragraph) -msgid "The `has` method determines if a given key exists in the collection:" -msgstr "`has` 方法用於判斷給定的索引鍵是否存在於該 Collection 上:" - -#: docs/10.x/collections.md:block 256 (code) -msgid "$collection = collect(['account_id' => 1, 'product' => 'Desk', 'amount' => 5]);\n\n" -"$collection->has('product');\n\n" -"// true\n\n" -"$collection->has(['product', 'amount']);\n\n" -"// true\n\n" -"$collection->has(['amount', 'price']);\n\n" -"// false\n" -msgstr "$collection = collect(['account_id' => 1, 'product' => 'Desk', 'amount' => 5]);\n\n" -"$collection->has('product');\n\n" -"// true\n\n" -"$collection->has(['product', 'amount']);\n\n" -"// true\n\n" -"$collection->has(['amount', 'price']);\n\n" -"// false\n" - -#: docs/10.x/collections.md:block 258 (header) -msgid "`hasAny()` {.collection-method}" -msgstr "`hasAny()` {.collection-method}" - -#: docs/10.x/collections.md:block 259 (paragraph) -msgid "The `hasAny` method determines whether any of the given keys exist in the collection:" -msgstr "`hasAny` 方法用於判斷給定的多個索引鍵中,是否有任何索引鍵存在於該 Collection 上:" - -#: docs/10.x/collections.md:block 260 (code) -msgid "$collection = collect(['account_id' => 1, 'product' => 'Desk', 'amount' => 5]);\n\n" -"$collection->hasAny(['product', 'price']);\n\n" -"// true\n\n" -"$collection->hasAny(['name', 'price']);\n\n" -"// false\n" -msgstr "$collection = collect(['account_id' => 1, 'product' => 'Desk', 'amount' => 5]);\n\n" -"$collection->hasAny(['product', 'price']);\n\n" -"// true\n\n" -"$collection->hasAny(['name', 'price']);\n\n" -"// false\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 262 (header) +# P +#: ./docs/8.x/collections.md:1060 +#: ./docs/9.x/collections.md:1126 +#: ./docs/10.x/collections.md:1186 +#: ./docs/11.x/collections.md:1247 +#: ./docs/master/collections.md:1186 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1061 +#: ./docs/9.x/collections.md:1127 +#: ./docs/10.x/collections.md:1187 +#: ./docs/11.x/collections.md:1248 +#: ./docs/master/collections.md:1187 msgid "`implode()` {.collection-method}" -msgstr "`implode()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 263 (paragraph) +# P +#: ./docs/8.x/collections.md:1063 +#: ./docs/9.x/collections.md:1129 +#: ./docs/10.x/collections.md:1189 +#: ./docs/11.x/collections.md:1250 +#: ./docs/master/collections.md:1189 msgid "The `implode` method joins items in a collection. Its arguments depend on the type of items in the collection. If the collection contains arrays or objects, you should pass the key of the attributes you wish to join, and the \"glue\" string you wish to place between the values:" -msgstr "`implode` 方法可將 Collection 內多個項目串聯。該方法的引數會依照該 Collection 中項目的類型而有所不同。若該 Collection 中包含陣列或物件,則應傳入欲串聯的屬性之索引鍵,以及要用來串聯各個值的「Glue (黏著)」字串:" +msgstr "" -#: docs/10.x/collections.md:block 264 (code) +# CODE +#: ./docs/8.x/collections.md:1065 +#: ./docs/9.x/collections.md:1131 +#: ./docs/10.x/collections.md:1191 +#: ./docs/11.x/collections.md:1252 +#: ./docs/master/collections.md:1191 msgid "$collection = collect([\n" " ['account_id' => 1, 'product' => 'Desk'],\n" " ['account_id' => 2, 'product' => 'Chair'],\n" "]);\n\n" "$collection->implode('product', ', ');\n\n" -"// Desk, Chair\n" -msgstr "$collection = collect([\n" -" ['account_id' => 1, 'product' => 'Desk'],\n" -" ['account_id' => 2, 'product' => 'Chair'],\n" -"]);\n\n" -"$collection->implode('product', ', ');\n\n" -"// Desk, Chair\n" +"// Desk, Chair" +msgstr "" + +# CODE +#: ./docs/11.x/collections.md:1073 +msgid "$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);\n\n" +"// Forget a single key...\n" +"$collection->forget('name');\n\n" +"// ['framework' => 'laravel']\n\n" +"// Forget multiple keys...\n" +"$collection->forget(['name', 'framework']);\n\n" +"// []" +msgstr "" -#: docs/10.x/collections.md:block 265 (paragraph) +# P +#: ./docs/8.x/collections.md:1074 +#: ./docs/9.x/collections.md:1140 +#: ./docs/10.x/collections.md:1200 +#: ./docs/11.x/collections.md:1261 +#: ./docs/master/collections.md:1200 msgid "If the collection contains simple strings or numeric values, you should pass the \"glue\" as the only argument to the method:" -msgstr "若該 Collection 中只包含了單純的字串或數字值,則只需要傳入「Glue (黏著)」字串作為該方法唯一的引數即可:" +msgstr "" -#: docs/10.x/collections.md:block 266 (code) +# CODE +#: ./docs/8.x/collections.md:1076 +#: ./docs/9.x/collections.md:1142 +#: ./docs/10.x/collections.md:1202 +#: ./docs/11.x/collections.md:1263 +#: ./docs/master/collections.md:1202 msgid "collect([1, 2, 3, 4, 5])->implode('-');\n\n" -"// '1-2-3-4-5'\n" -msgstr "collect([1, 2, 3, 4, 5])->implode('-');\n\n" -"// '1-2-3-4-5'\n" - -#: docs/10.x/collections.md:block 267 (paragraph) -msgid "You may pass a closure to the `implode` method if you would like to format the values being imploded:" -msgstr "若想為 implode 後的值自定格式,可以傳入一個閉包給 `implode` 方法:" - -#: docs/10.x/collections.md:block 268 (code) -msgid "$collection->implode(function (array $item, int $key) {\n" -" return strtoupper($item['product']);\n" -"}, ', ');\n\n" -"// DESK, CHAIR\n" -msgstr "$collection->implode(function (array $item, int $key) {\n" -" return strtoupper($item['product']);\n" -"}, ', ');\n\n" -"// DESK, CHAIR\n" +"// '1-2-3-4-5'" +msgstr "" -#: docs/10.x/collections.md:block 270 (header) +# P +#: ./docs/8.x/collections.md:1080 +#: ./docs/9.x/collections.md:1154 +#: ./docs/10.x/collections.md:1214 +#: ./docs/11.x/collections.md:1275 +#: ./docs/master/collections.md:1214 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1081 +#: ./docs/9.x/collections.md:1155 +#: ./docs/10.x/collections.md:1215 +#: ./docs/11.x/collections.md:1276 +#: ./docs/master/collections.md:1215 msgid "`intersect()` {.collection-method}" -msgstr "`intersect()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 271 (paragraph) +# P +#: ./docs/8.x/collections.md:1083 +#: ./docs/9.x/collections.md:1157 +#: ./docs/10.x/collections.md:1217 +#: ./docs/11.x/collections.md:1278 +#: ./docs/master/collections.md:1217 msgid "The `intersect` method removes any values from the original collection that are not present in the given `array` or collection. The resulting collection will preserve the original collection's keys:" -msgstr "`intersect` 方法會從原始 Collection 中移除給定 `array` 或 Collection 中不存在的值。產生的 Collection 會保有原始 Collection 的索引鍵:" +msgstr "" -#: docs/10.x/collections.md:block 272 (code) +# CODE +#: ./docs/8.x/collections.md:1085 +#: ./docs/9.x/collections.md:1159 +#: ./docs/10.x/collections.md:1219 +#: ./docs/11.x/collections.md:1280 +#: ./docs/master/collections.md:1219 msgid "$collection = collect(['Desk', 'Sofa', 'Chair']);\n\n" "$intersect = $collection->intersect(['Desk', 'Chair', 'Bookcase']);\n\n" "$intersect->all();\n\n" -"// [0 => 'Desk', 2 => 'Chair']\n" -msgstr "$collection = collect(['Desk', 'Sofa', 'Chair']);\n\n" -"$intersect = $collection->intersect(['Desk', 'Chair', 'Bookcase']);\n\n" -"$intersect->all();\n\n" -"// [0 => 'Desk', 2 => 'Chair']\n" - -#: docs/10.x/collections.md:block 273 (quote) -msgid "**Note** This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-intersect)." -msgstr "**Note** 在使用 [Eloquent Collection](/docs/{{version}}/eloquent-collections#method-intersect) 時,該方法的行為有經過修改。" +"// [0 => 'Desk', 2 => 'Chair']" +msgstr "" -#: docs/10.x/collections.md:block 275 (header) -msgid "`intersectAssoc()` {.collection-method}" -msgstr "`intersectAssoc()` {.collection-method}" +# P +#: ./docs/11.x/collections.md:1086 +msgid "Unlike most other collection methods, `forget` does not return a new modified collection; it modifies and returns the collection it is called on." +msgstr "" -#: docs/10.x/collections.md:block 276 (paragraph) -msgid "The `intersectAssoc` method compares the original collection against another collection or `array`, returning the key / value pairs that are present in all of the given collections:" -msgstr "`intersectAssoc` 方法會將原始 Collection 與另一個 Collection 或 `array` 比較,並回傳有包含在所有給定 Collection 中的索引鍵/值配對:" +# P +#: ./docs/8.x/collections.md:1093 +#: ./docs/9.x/collections.md:1168 +#: ./docs/10.x/collections.md:1228 +#: ./docs/11.x/collections.md:1289 +#: ./docs/master/collections.md:1228 +msgid "This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-intersect)." +msgstr "" -#: docs/10.x/collections.md:block 277 (code) -msgid "$collection = collect([\n" -" 'color' => 'red',\n" -" 'size' => 'M',\n" -" 'material' => 'cotton'\n" -"]);\n\n" -"$intersect = $collection->intersectAssoc([\n" -" 'color' => 'blue',\n" -" 'size' => 'M',\n" -" 'material' => 'polyester'\n" -"]);\n\n" -"$intersect->all();\n\n" -"// ['size' => 'M']\n" -msgstr "$collection = collect([\n" -" 'color' => 'red',\n" -" 'size' => 'M',\n" -" 'material' => 'cotton'\n" -"]);\n\n" -"$intersect = $collection->intersectAssoc([\n" -" 'color' => 'blue',\n" -" 'size' => 'M',\n" -" 'material' => 'polyester'\n" -"]);\n\n" -"$intersect->all();\n\n" -"// ['size' => 'M']\n" +# P +#: ./docs/8.x/collections.md:1095 +#: ./docs/9.x/collections.md:1170 +#: ./docs/10.x/collections.md:1251 +#: ./docs/11.x/collections.md:1312 +#: ./docs/master/collections.md:1251 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1096 +#: ./docs/11.x/collections.md:1157 +#: ./docs/master/collections.md:1096 +msgid "$grouped = $collection->groupBy(function (array $item, int $key) {\n" +" return substr($item['account_id'], -3);\n" +"});\n\n" +"$grouped->all();\n\n" +"/*\n" +" [\n" +" 'x10' => [\n" +" ['account_id' => 'account-x10', 'product' => 'Chair'],\n" +" ['account_id' => 'account-x10', 'product' => 'Bookcase'],\n" +" ],\n" +" 'x11' => [\n" +" ['account_id' => 'account-x11', 'product' => 'Desk'],\n" +" ],\n" +" ]\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 279 (header) +# H4 +#: ./docs/8.x/collections.md:1096 +#: ./docs/9.x/collections.md:1171 +#: ./docs/10.x/collections.md:1252 +#: ./docs/11.x/collections.md:1313 +#: ./docs/master/collections.md:1252 msgid "`intersectByKeys()` {.collection-method}" -msgstr "`intersectByKeys()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 280 (paragraph) +# P +#: ./docs/8.x/collections.md:1098 +#: ./docs/9.x/collections.md:1173 +#: ./docs/10.x/collections.md:1254 +#: ./docs/11.x/collections.md:1315 +#: ./docs/master/collections.md:1254 msgid "The `intersectByKeys` method removes any keys and their corresponding values from the original collection that are not present in the given `array` or collection:" -msgstr "`intersectByKeys` 方法會自原始 Collection 中移除其索引鍵不存在於給定 `array` 或 Collection 中的索引鍵與值:" +msgstr "" -#: docs/10.x/collections.md:block 281 (code) +# CODE +#: ./docs/8.x/collections.md:1100 +#: ./docs/9.x/collections.md:1175 +#: ./docs/10.x/collections.md:1256 +#: ./docs/11.x/collections.md:1317 +#: ./docs/master/collections.md:1256 msgid "$collection = collect([\n" " 'serial' => 'UX301', 'type' => 'screen', 'year' => 2009,\n" "]);\n\n" @@ -1748,73 +3725,231 @@ msgid "$collection = collect([\n" " 'reference' => 'UX404', 'type' => 'tab', 'year' => 2011,\n" "]);\n\n" "$intersect->all();\n\n" -"// ['type' => 'screen', 'year' => 2009]\n" -msgstr "$collection = collect([\n" -" 'serial' => 'UX301', 'type' => 'screen', 'year' => 2009,\n" -"]);\n\n" -"$intersect = $collection->intersectByKeys([\n" -" 'reference' => 'UX404', 'type' => 'tab', 'year' => 2011,\n" -"]);\n\n" -"$intersect->all();\n\n" -"// ['type' => 'screen', 'year' => 2009]\n" +"// ['type' => 'screen', 'year' => 2009]" +msgstr "" + +# P +#: ./docs/9.x/collections.md:1111 +#: ./docs/10.x/collections.md:1171 +#: ./docs/11.x/collections.md:1232 +#: ./docs/master/collections.md:1171 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/collections.md:1112 +#: ./docs/9.x/collections.md:1187 +#: ./docs/10.x/collections.md:1268 +#: ./docs/11.x/collections.md:1329 +#: ./docs/master/collections.md:1268 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/collections.md:1112 +#: ./docs/10.x/collections.md:1172 +#: ./docs/11.x/collections.md:1233 +#: ./docs/master/collections.md:1172 +msgid "`hasAny()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 283 (header) +# H4 +#: ./docs/8.x/collections.md:1113 +#: ./docs/9.x/collections.md:1188 +#: ./docs/10.x/collections.md:1269 +#: ./docs/11.x/collections.md:1330 +#: ./docs/master/collections.md:1269 msgid "`isEmpty()` {.collection-method}" -msgstr "`isEmpty()` {.collection-method}" +msgstr "" + +# P +#: ./docs/9.x/collections.md:1114 +#: ./docs/10.x/collections.md:1174 +#: ./docs/11.x/collections.md:1235 +#: ./docs/master/collections.md:1174 +msgid "The `hasAny` method determines whether any of the given keys exist in the collection:" +msgstr "" -#: docs/10.x/collections.md:block 284 (paragraph) +# P +#: ./docs/8.x/collections.md:1115 +#: ./docs/9.x/collections.md:1190 +#: ./docs/10.x/collections.md:1271 +#: ./docs/11.x/collections.md:1332 +#: ./docs/master/collections.md:1271 msgid "The `isEmpty` method returns `true` if the collection is empty; otherwise, `false` is returned:" -msgstr "`isEmpty` 會在該 Collection 為空時回傳 `true`。否則會回傳 `false`:" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1116 +#: ./docs/11.x/collections.md:1177 +#: ./docs/master/collections.md:1116 +msgid "$data = new Collection([\n" +" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" +" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" +" 30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],\n" +" 40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],\n" +"]);\n\n" +"$result = $data->groupBy(['skill', function (array $item) {\n" +" return $item['roles'];\n" +"}], preserveKeys: true);\n\n" +"/*\n" +"[\n" +" 1 => [\n" +" 'Role_1' => [\n" +" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" +" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" +" ],\n" +" 'Role_2' => [\n" +" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" +" ],\n" +" 'Role_3' => [\n" +" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" +" ],\n" +" ],\n" +" 2 => [\n" +" 'Role_1' => [\n" +" 30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],\n" +" ],\n" +" 'Role_2' => [\n" +" 40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],\n" +" ],\n" +" ],\n" +"];\n" +"*/" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:1116 +#: ./docs/10.x/collections.md:1176 +#: ./docs/11.x/collections.md:1237 +#: ./docs/master/collections.md:1176 +msgid "$collection = collect(['account_id' => 1, 'product' => 'Desk', 'amount' => 5]);\n\n" +"$collection->hasAny(['product', 'price']);\n\n" +"// true\n\n" +"$collection->hasAny(['name', 'price']);\n\n" +"// false" +msgstr "" -#: docs/10.x/collections.md:block 285 (code) +# CODE +#: ./docs/8.x/collections.md:1117 +#: ./docs/9.x/collections.md:1192 +#: ./docs/10.x/collections.md:1273 +#: ./docs/11.x/collections.md:1334 +#: ./docs/master/collections.md:1273 msgid "collect([])->isEmpty();\n\n" -"// true\n" -msgstr "collect([])->isEmpty();\n\n" -"// true\n" +"// true" +msgstr "" -#: docs/10.x/collections.md:block 287 (header) +# P +#: ./docs/8.x/collections.md:1121 +#: ./docs/9.x/collections.md:1196 +#: ./docs/10.x/collections.md:1277 +#: ./docs/11.x/collections.md:1338 +#: ./docs/master/collections.md:1277 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1122 +#: ./docs/9.x/collections.md:1197 +#: ./docs/10.x/collections.md:1278 +#: ./docs/11.x/collections.md:1339 +#: ./docs/master/collections.md:1278 msgid "`isNotEmpty()` {.collection-method}" -msgstr "`isNotEmpty()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 288 (paragraph) +# P +#: ./docs/8.x/collections.md:1124 +#: ./docs/9.x/collections.md:1199 +#: ./docs/10.x/collections.md:1280 +#: ./docs/11.x/collections.md:1341 +#: ./docs/master/collections.md:1280 msgid "The `isNotEmpty` method returns `true` if the collection is not empty; otherwise, `false` is returned:" -msgstr "`isNotEmpty` 會在該 Collection 不為空時回傳 `true`。否則會回傳 `false`:" +msgstr "" -#: docs/10.x/collections.md:block 289 (code) +# CODE +#: ./docs/8.x/collections.md:1126 +#: ./docs/9.x/collections.md:1201 +#: ./docs/10.x/collections.md:1282 +#: ./docs/11.x/collections.md:1343 +#: ./docs/master/collections.md:1282 msgid "collect([])->isNotEmpty();\n\n" -"// false\n" -msgstr "collect([])->isNotEmpty();\n\n" -"// false\n" +"// false" +msgstr "" -#: docs/10.x/collections.md:block 291 (header) +# P +#: ./docs/8.x/collections.md:1130 +#: ./docs/9.x/collections.md:1205 +#: ./docs/10.x/collections.md:1286 +#: ./docs/11.x/collections.md:1347 +#: ./docs/master/collections.md:1286 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1131 +#: ./docs/9.x/collections.md:1206 +#: ./docs/10.x/collections.md:1287 +#: ./docs/11.x/collections.md:1348 +#: ./docs/master/collections.md:1287 msgid "`join()` {.collection-method}" -msgstr "`join()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 292 (paragraph) +# P +#: ./docs/8.x/collections.md:1133 +#: ./docs/9.x/collections.md:1208 +#: ./docs/10.x/collections.md:1289 +#: ./docs/11.x/collections.md:1350 +#: ./docs/master/collections.md:1289 msgid "The `join` method joins the collection's values with a string. Using this method's second argument, you may also specify how the final element should be appended to the string:" -msgstr "`join` 方法會將該 Collection 中的值合併為一個字串。使用該方法的第二個引數可用來指定最後一個元素要如何被加進字串裡:" +msgstr "" -#: docs/10.x/collections.md:block 293 (code) +# CODE +#: ./docs/8.x/collections.md:1135 +#: ./docs/9.x/collections.md:1210 +#: ./docs/10.x/collections.md:1291 +#: ./docs/11.x/collections.md:1352 +#: ./docs/master/collections.md:1291 msgid "collect(['a', 'b', 'c'])->join(', '); // 'a, b, c'\n" "collect(['a', 'b', 'c'])->join(', ', ', and '); // 'a, b, and c'\n" "collect(['a', 'b'])->join(', ', ' and '); // 'a and b'\n" "collect(['a'])->join(', ', ' and '); // 'a'\n" -"collect([])->join(', ', ' and '); // ''\n" -msgstr "collect(['a', 'b', 'c'])->join(', '); // 'a, b, c'\n" -"collect(['a', 'b', 'c'])->join(', ', ', and '); // 'a, b, and c'\n" -"collect(['a', 'b'])->join(', ', ' and '); // 'a and b'\n" -"collect(['a'])->join(', ', ' and '); // 'a'\n" -"collect([])->join(', ', ' and '); // ''\n" +"collect([])->join(', ', ' and '); // ''" +msgstr "" -#: docs/10.x/collections.md:block 295 (header) +# P +#: ./docs/8.x/collections.md:1141 +#: ./docs/9.x/collections.md:1216 +#: ./docs/10.x/collections.md:1297 +#: ./docs/11.x/collections.md:1358 +#: ./docs/master/collections.md:1297 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1142 +#: ./docs/9.x/collections.md:1217 +#: ./docs/10.x/collections.md:1298 +#: ./docs/11.x/collections.md:1359 +#: ./docs/master/collections.md:1298 msgid "`keyBy()` {.collection-method}" -msgstr "`keyBy()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 296 (paragraph) +# P +#: ./docs/8.x/collections.md:1144 +#: ./docs/9.x/collections.md:1219 +#: ./docs/10.x/collections.md:1300 +#: ./docs/11.x/collections.md:1361 +#: ./docs/master/collections.md:1300 msgid "The `keyBy` method keys the collection by the given key. If multiple items have the same key, only the last one will appear in the new collection:" -msgstr "`keyBy` 方法依照給定的索引鍵來將該 Collection 加上索引鍵。若多個項目有相同的索引鍵,則新的 Collection 中只會包含最後一個項目:" +msgstr "" -#: docs/10.x/collections.md:block 297 (code) +# CODE +#: ./docs/8.x/collections.md:1146 +#: ./docs/9.x/collections.md:1221 +#: ./docs/10.x/collections.md:1302 +#: ./docs/11.x/collections.md:1363 +#: ./docs/master/collections.md:1302 msgid "$collection = collect([\n" " ['product_id' => 'prod-100', 'name' => 'Desk'],\n" " ['product_id' => 'prod-200', 'name' => 'Chair'],\n" @@ -1826,36 +3961,37 @@ msgid "$collection = collect([\n" " 'prod-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],\n" " 'prod-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['product_id' => 'prod-100', 'name' => 'Desk'],\n" -" ['product_id' => 'prod-200', 'name' => 'Chair'],\n" -"]);\n\n" -"$keyed = $collection->keyBy('product_id');\n\n" -"$keyed->all();\n\n" -"/*\n" -" [\n" -" 'prod-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],\n" -" 'prod-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" + +# P +#: ./docs/9.x/collections.md:1146 +#: ./docs/10.x/collections.md:1206 +#: ./docs/11.x/collections.md:1267 +#: ./docs/master/collections.md:1206 +msgid "You may pass a closure to the `implode` method if you would like to format the values being imploded:" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:1148 +msgid "$collection->implode(function ($item, $key) {\n" +" return strtoupper($item['product']);\n" +"}, ', ');\n\n" +"// DESK, CHAIR" +msgstr "" -#: docs/10.x/collections.md:block 298 (paragraph) +# P +#: ./docs/8.x/collections.md:1162 +#: ./docs/9.x/collections.md:1237 +#: ./docs/10.x/collections.md:1318 +#: ./docs/11.x/collections.md:1379 +#: ./docs/master/collections.md:1318 msgid "You may also pass a callback to the method. The callback should return the value to key the collection by:" -msgstr "也可以傳入回呼給該方法。該回呼應回傳用於為該 Collection 加上索引鍵的值:" +msgstr "" -#: docs/10.x/collections.md:block 299 (code) -msgid "$keyed = $collection->keyBy(function (array $item, int $key) {\n" -" return strtoupper($item['product_id']);\n" -"});\n\n" -"$keyed->all();\n\n" -"/*\n" -" [\n" -" 'PROD-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],\n" -" 'PROD-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],\n" -" ]\n" -"*/\n" -msgstr "$keyed = $collection->keyBy(function (array $item, int $key) {\n" +# CODE +#: ./docs/8.x/collections.md:1164 +msgid "$keyed = $collection->keyBy(function ($item) {\n" " return strtoupper($item['product_id']);\n" "});\n\n" "$keyed->all();\n\n" @@ -1864,211 +4000,396 @@ msgstr "$keyed = $collection->keyBy(function (array $item, int $key) {\n" " 'PROD-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],\n" " 'PROD-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],\n" " ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 301 (header) +# P +#: ./docs/8.x/collections.md:1177 +#: ./docs/9.x/collections.md:1252 +#: ./docs/10.x/collections.md:1333 +#: ./docs/11.x/collections.md:1394 +#: ./docs/master/collections.md:1333 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1178 +#: ./docs/9.x/collections.md:1253 +#: ./docs/10.x/collections.md:1334 +#: ./docs/11.x/collections.md:1395 +#: ./docs/master/collections.md:1334 msgid "`keys()` {.collection-method}" -msgstr "`keys()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 302 (paragraph) +# P +#: ./docs/8.x/collections.md:1180 +#: ./docs/9.x/collections.md:1255 +#: ./docs/10.x/collections.md:1336 +#: ./docs/11.x/collections.md:1397 +#: ./docs/master/collections.md:1336 msgid "The `keys` method returns all of the collection's keys:" -msgstr "`keys` 方法回傳該 Collection 中的所有索引鍵:" +msgstr "" -#: docs/10.x/collections.md:block 303 (code) +# CODE +#: ./docs/8.x/collections.md:1182 +#: ./docs/9.x/collections.md:1257 +#: ./docs/10.x/collections.md:1338 +#: ./docs/11.x/collections.md:1399 +#: ./docs/master/collections.md:1338 msgid "$collection = collect([\n" " 'prod-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],\n" " 'prod-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],\n" "]);\n\n" "$keys = $collection->keys();\n\n" "$keys->all();\n\n" -"// ['prod-100', 'prod-200']\n" -msgstr "$collection = collect([\n" -" 'prod-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],\n" -" 'prod-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],\n" -"]);\n\n" -"$keys = $collection->keys();\n\n" -"$keys->all();\n\n" -"// ['prod-100', 'prod-200']\n" +"// ['prod-100', 'prod-200']" +msgstr "" -#: docs/10.x/collections.md:block 305 (header) +# P +#: ./docs/8.x/collections.md:1193 +#: ./docs/9.x/collections.md:1268 +#: ./docs/10.x/collections.md:1349 +#: ./docs/11.x/collections.md:1410 +#: ./docs/master/collections.md:1349 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1194 +#: ./docs/9.x/collections.md:1269 +#: ./docs/10.x/collections.md:1350 +#: ./docs/11.x/collections.md:1411 +#: ./docs/master/collections.md:1350 msgid "`last()` {.collection-method}" -msgstr "`last()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 306 (paragraph) +# P +#: ./docs/8.x/collections.md:1196 +#: ./docs/9.x/collections.md:1271 +#: ./docs/10.x/collections.md:1352 +#: ./docs/11.x/collections.md:1413 +#: ./docs/master/collections.md:1352 msgid "The `last` method returns the last element in the collection that passes a given truth test:" -msgstr "`last` 方法會回傳該 Collection 中通過給定布林測試的最後一個元素:" +msgstr "" -#: docs/10.x/collections.md:block 307 (code) -msgid "collect([1, 2, 3, 4])->last(function (int $value, int $key) {\n" -" return $value < 3;\n" -"});\n\n" -"// 2\n" -msgstr "collect([1, 2, 3, 4])->last(function (int $value, int $key) {\n" +# CODE +#: ./docs/8.x/collections.md:1198 +#: ./docs/9.x/collections.md:1273 +msgid "collect([1, 2, 3, 4])->last(function ($value, $key) {\n" " return $value < 3;\n" "});\n\n" -"// 2\n" +"// 2" +msgstr "" -#: docs/10.x/collections.md:block 308 (paragraph) +# P +#: ./docs/8.x/collections.md:1204 +#: ./docs/9.x/collections.md:1279 +#: ./docs/10.x/collections.md:1360 +#: ./docs/11.x/collections.md:1421 +#: ./docs/master/collections.md:1360 msgid "You may also call the `last` method with no arguments to get the last element in the collection. If the collection is empty, `null` is returned:" -msgstr "呼叫 `last` 方法時也可以不給任何引數,以取得該 Collection 中的最後一個元素。若該 Collection 為空,則會回傳 `null`:" +msgstr "" -#: docs/10.x/collections.md:block 309 (code) +# CODE +#: ./docs/8.x/collections.md:1206 +#: ./docs/9.x/collections.md:1281 +#: ./docs/10.x/collections.md:1362 +#: ./docs/11.x/collections.md:1423 +#: ./docs/master/collections.md:1362 msgid "collect([1, 2, 3, 4])->last();\n\n" -"// 4\n" -msgstr "collect([1, 2, 3, 4])->last();\n\n" -"// 4\n" - -#: docs/10.x/collections.md:block 311 (header) -msgid "`lazy()` {.collection-method}" -msgstr "`lazy()` {.collection-method}" - -#: docs/10.x/collections.md:block 312 (paragraph) -msgid "The `lazy` method returns a new [`LazyCollection`](#lazy-collections) instance from the underlying array of items:" -msgstr "`lazy` 方法使用底層項目陣列來回傳一個新的 [`LazyCollection`](#lazy-collections) 實體:" - -#: docs/10.x/collections.md:block 313 (code) -msgid "$lazyCollection = collect([1, 2, 3, 4])->lazy();\n\n" -"$lazyCollection::class;\n\n" -"// Illuminate\\Support\\LazyCollection\n\n" -"$lazyCollection->all();\n\n" -"// [1, 2, 3, 4]\n" -msgstr "$lazyCollection = collect([1, 2, 3, 4])->lazy();\n\n" -"$lazyCollection::class;\n\n" -"// Illuminate\\Support\\LazyCollection\n\n" -"$lazyCollection->all();\n\n" -"// [1, 2, 3, 4]\n" - -#: docs/10.x/collections.md:block 314 (paragraph) -msgid "This is especially useful when you need to perform transformations on a huge `Collection` that contains many items:" -msgstr "若想轉換一個有許多項目的大型 `Collection`,就特別適合使用該方法:" - -#: docs/10.x/collections.md:block 315 (code) -msgid "$count = $hugeCollection\n" -" ->lazy()\n" -" ->where('country', 'FR')\n" -" ->where('balance', '>', '100')\n" -" ->count();\n" -msgstr "$count = $hugeCollection\n" -" ->lazy()\n" -" ->where('country', 'FR')\n" -" ->where('balance', '>', '100')\n" -" ->count();\n" +"// 4" +msgstr "" -#: docs/10.x/collections.md:block 316 (paragraph) -msgid "By converting the collection to a `LazyCollection`, we avoid having to allocate a ton of additional memory. Though the original collection still keeps *its* values in memory, the subsequent filters will not. Therefore, virtually no additional memory will be allocated when filtering the collection's results." -msgstr "將 Collection 轉為 `LazyCollection` 後,就可避免使用到大量額外的記憶體。雖然,**原始陣列的值** 還是會保存在記憶體中,但之後所進行的篩選結果將不會被保存在記憶體中。因此,在篩選 Collection 結果時,將不會使用到額外的記憶體。" +# CODE +#: ./docs/10.x/collections.md:1208 +#: ./docs/11.x/collections.md:1269 +#: ./docs/master/collections.md:1208 +msgid "$collection->implode(function (array $item, int $key) {\n" +" return strtoupper($item['product']);\n" +"}, ', ');\n\n" +"// DESK, CHAIR" +msgstr "" -#: docs/10.x/collections.md:block 318 (header) +# P +#: ./docs/8.x/collections.md:1210 +#: ./docs/9.x/collections.md:1310 +#: ./docs/10.x/collections.md:1391 +#: ./docs/11.x/collections.md:1452 +#: ./docs/master/collections.md:1391 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1211 +#: ./docs/9.x/collections.md:1311 +#: ./docs/10.x/collections.md:1392 +#: ./docs/11.x/collections.md:1453 +#: ./docs/master/collections.md:1392 msgid "`macro()` {.collection-method}" -msgstr "`macro()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 319 (paragraph) +# P +#: ./docs/8.x/collections.md:1213 +#: ./docs/9.x/collections.md:1313 +#: ./docs/10.x/collections.md:1394 +#: ./docs/11.x/collections.md:1455 +#: ./docs/master/collections.md:1394 msgid "The static `macro` method allows you to add methods to the `Collection` class at run time. Refer to the documentation on [extending collections](#extending-collections) for more information." -msgstr "靜態 `macro` 方法可用來在執行階段將方法加入 `Collection` 類別內。更多資訊請參考有關[擴充 Collection](#extending-collections) 的說明文件。" +msgstr "" -#: docs/10.x/collections.md:block 321 (header) +# P +#: ./docs/8.x/collections.md:1215 +#: ./docs/9.x/collections.md:1315 +#: ./docs/10.x/collections.md:1396 +#: ./docs/11.x/collections.md:1457 +#: ./docs/master/collections.md:1396 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1216 +#: ./docs/9.x/collections.md:1316 +#: ./docs/10.x/collections.md:1397 +#: ./docs/11.x/collections.md:1458 +#: ./docs/master/collections.md:1397 msgid "`make()` {.collection-method}" -msgstr "`make()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 322 (paragraph) +# P +#: ./docs/8.x/collections.md:1218 +#: ./docs/9.x/collections.md:1318 +#: ./docs/10.x/collections.md:1399 +#: ./docs/11.x/collections.md:1460 +#: ./docs/master/collections.md:1399 msgid "The static `make` method creates a new collection instance. See the [Creating Collections](#creating-collections) section." -msgstr "The static `make` method creates a new collection instance. See the [Creating Collections](#creating-collections) section." +msgstr "" -#: docs/10.x/collections.md:block 324 (header) +# P +#: ./docs/8.x/collections.md:1220 +#: ./docs/9.x/collections.md:1320 +#: ./docs/10.x/collections.md:1401 +#: ./docs/11.x/collections.md:1462 +#: ./docs/master/collections.md:1401 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1221 +#: ./docs/9.x/collections.md:1321 +#: ./docs/10.x/collections.md:1402 +#: ./docs/11.x/collections.md:1463 +#: ./docs/master/collections.md:1402 msgid "`map()` {.collection-method}" -msgstr "`map()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 325 (paragraph) +# P +#: ./docs/8.x/collections.md:1223 +#: ./docs/9.x/collections.md:1323 +#: ./docs/10.x/collections.md:1404 +#: ./docs/11.x/collections.md:1465 +#: ./docs/master/collections.md:1404 msgid "The `map` method iterates through the collection and passes each value to the given callback. The callback is free to modify the item and return it, thus forming a new collection of modified items:" -msgstr "`map` 方法會迭代該 Collection,並將每個值傳入給定的回呼。該回呼可自由修改項目並進行回傳,藉此依據修改的項目來建立一個新的 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 326 (code) +# CODE +#: ./docs/8.x/collections.md:1225 +#: ./docs/9.x/collections.md:1325 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$multiplied = $collection->map(function (int $item, int $key) {\n" -" return $item * 2;\n" -"});\n\n" -"$multiplied->all();\n\n" -"// [2, 4, 6, 8, 10]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$multiplied = $collection->map(function (int $item, int $key) {\n" +"$multiplied = $collection->map(function ($item, $key) {\n" " return $item * 2;\n" "});\n\n" "$multiplied->all();\n\n" -"// [2, 4, 6, 8, 10]\n" +"// [2, 4, 6, 8, 10]" +msgstr "" + +# P +#: ./docs/10.x/collections.md:1230 +#: ./docs/11.x/collections.md:1291 +#: ./docs/master/collections.md:1230 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/collections.md:1231 +#: ./docs/11.x/collections.md:1292 +#: ./docs/master/collections.md:1231 +msgid "`intersectAssoc()` {.collection-method}" +msgstr "" + +# P +#: ./docs/10.x/collections.md:1233 +#: ./docs/11.x/collections.md:1294 +#: ./docs/master/collections.md:1233 +msgid "The `intersectAssoc` method compares the original collection against another collection or `array`, returning the key / value pairs that are present in all of the given collections:" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1235 +#: ./docs/11.x/collections.md:1296 +#: ./docs/master/collections.md:1235 +msgid "$collection = collect([\n" +" 'color' => 'red',\n" +" 'size' => 'M',\n" +" 'material' => 'cotton'\n" +"]);\n\n" +"$intersect = $collection->intersectAssoc([\n" +" 'color' => 'blue',\n" +" 'size' => 'M',\n" +" 'material' => 'polyester'\n" +"]);\n\n" +"$intersect->all();\n\n" +"// ['size' => 'M']" +msgstr "" -#: docs/10.x/collections.md:block 327 (quote) -msgid "**Warning** Like most other collection methods, `map` returns a new collection instance; it does not modify the collection it is called on. If you want to transform the original collection, use the [`transform`](#method-transform) method." -msgstr "**Warning** 與其他 Collection 方法類似,`map` 會回傳一個新的 Collection 實體。該方法不會修改正在呼叫的 Collection。若想改變原始 Collection,請使用 [`transform`](#method-transform) 方法代替。" +# P +#: ./docs/8.x/collections.md:1235 +#: ./docs/9.x/collections.md:1336 +#: ./docs/10.x/collections.md:1417 +#: ./docs/11.x/collections.md:1478 +#: ./docs/master/collections.md:1417 +msgid "Like most other collection methods, `map` returns a new collection instance; it does not modify the collection it is called on. If you want to transform the original collection, use the [`transform`](#method-transform) method." +msgstr "" -#: docs/10.x/collections.md:block 329 (header) +# P +#: ./docs/8.x/collections.md:1237 +#: ./docs/9.x/collections.md:1338 +#: ./docs/10.x/collections.md:1419 +#: ./docs/11.x/collections.md:1480 +#: ./docs/master/collections.md:1419 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1238 +#: ./docs/9.x/collections.md:1339 +#: ./docs/10.x/collections.md:1420 +#: ./docs/11.x/collections.md:1481 +#: ./docs/master/collections.md:1420 msgid "`mapInto()` {.collection-method}" -msgstr "`mapInto()` {.collection-method}" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:1239 +msgid "$keyed = $collection->keyBy(function ($item, $key) {\n" +" return strtoupper($item['product_id']);\n" +"});\n\n" +"$keyed->all();\n\n" +"/*\n" +" [\n" +" 'PROD-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],\n" +" 'PROD-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],\n" +" ]\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 330 (paragraph) +# P +#: ./docs/8.x/collections.md:1240 +#: ./docs/9.x/collections.md:1341 +#: ./docs/10.x/collections.md:1422 +#: ./docs/11.x/collections.md:1483 +#: ./docs/master/collections.md:1422 msgid "The `mapInto()` method iterates over the collection, creating a new instance of the given class by passing the value into the constructor:" -msgstr "The `mapInto()` method iterates over the collection, creating a new instance of the given class by passing the value into the constructor:" +msgstr "" -#: docs/10.x/collections.md:block 331 (code) +# CODE +#: ./docs/8.x/collections.md:1242 +#: ./docs/9.x/collections.md:1343 msgid "class Currency\n" "{\n" " /**\n" " * Create a new currency instance.\n" +" *\n" +" * @param string $code\n" +" * @return void\n" " */\n" -" function __construct(\n" -" public string $code\n" -" ) {}\n" -"}\n\n" -"$collection = collect(['USD', 'EUR', 'GBP']);\n\n" -"$currencies = $collection->mapInto(Currency::class);\n\n" -"$currencies->all();\n\n" -"// [Currency('USD'), Currency('EUR'), Currency('GBP')]\n" -msgstr "class Currency\n" -"{\n" -" /**\n" -" * Create a new currency instance.\n" -" */\n" -" function __construct(\n" -" public string $code\n" -" ) {}\n" +" function __construct(string $code)\n" +" {\n" +" $this->code = $code;\n" +" }\n" "}\n\n" "$collection = collect(['USD', 'EUR', 'GBP']);\n\n" "$currencies = $collection->mapInto(Currency::class);\n\n" "$currencies->all();\n\n" -"// [Currency('USD'), Currency('EUR'), Currency('GBP')]\n" +"// [Currency('USD'), Currency('EUR'), Currency('GBP')]" +msgstr "" -#: docs/10.x/collections.md:block 333 (header) +# P +#: ./docs/8.x/collections.md:1264 +#: ./docs/9.x/collections.md:1365 +#: ./docs/10.x/collections.md:1442 +#: ./docs/11.x/collections.md:1503 +#: ./docs/master/collections.md:1442 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1265 +#: ./docs/9.x/collections.md:1366 +#: ./docs/10.x/collections.md:1443 +#: ./docs/11.x/collections.md:1504 +#: ./docs/master/collections.md:1443 msgid "`mapSpread()` {.collection-method}" -msgstr "`mapSpread()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 334 (paragraph) +# P +#: ./docs/8.x/collections.md:1267 +#: ./docs/9.x/collections.md:1368 +#: ./docs/10.x/collections.md:1445 +#: ./docs/11.x/collections.md:1506 +#: ./docs/master/collections.md:1445 msgid "The `mapSpread` method iterates over the collection's items, passing each nested item value into the given closure. The closure is free to modify the item and return it, thus forming a new collection of modified items:" -msgstr "`mapSpread` 方法會迭代該 Collection 的項目,並將各個巢狀項目傳入給定的閉包內。該閉包可修改這些項目並回傳,藉此以修改過的項目來建立新的 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 335 (code) +# CODE +#: ./docs/8.x/collections.md:1269 +#: ./docs/9.x/collections.md:1370 msgid "$collection = collect([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n\n" "$chunks = $collection->chunk(2);\n\n" -"$sequence = $chunks->mapSpread(function (int $even, int $odd) {\n" -" return $even + $odd;\n" -"});\n\n" -"$sequence->all();\n\n" -"// [1, 5, 9, 13, 17]\n" -msgstr "$collection = collect([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n\n" -"$chunks = $collection->chunk(2);\n\n" -"$sequence = $chunks->mapSpread(function (int $even, int $odd) {\n" +"$sequence = $chunks->mapSpread(function ($even, $odd) {\n" " return $even + $odd;\n" "});\n\n" "$sequence->all();\n\n" -"// [1, 5, 9, 13, 17]\n" +"// [1, 5, 9, 13, 17]" +msgstr "" -#: docs/10.x/collections.md:block 337 (header) +# P +#: ./docs/8.x/collections.md:1281 +#: ./docs/9.x/collections.md:1382 +#: ./docs/10.x/collections.md:1459 +#: ./docs/11.x/collections.md:1520 +#: ./docs/master/collections.md:1459 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1282 +#: ./docs/9.x/collections.md:1383 +#: ./docs/10.x/collections.md:1460 +#: ./docs/11.x/collections.md:1521 +#: ./docs/master/collections.md:1460 msgid "`mapToGroups()` {.collection-method}" -msgstr "`mapToGroups()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 338 (paragraph) +# P +#: ./docs/8.x/collections.md:1284 +#: ./docs/9.x/collections.md:1385 +#: ./docs/10.x/collections.md:1462 +#: ./docs/11.x/collections.md:1523 +#: ./docs/master/collections.md:1462 msgid "The `mapToGroups` method groups the collection's items by the given closure. The closure should return an associative array containing a single key / value pair, thus forming a new collection of grouped values:" -msgstr "`mapToGroups` 方法使用給定的閉包來分組該 Collection 的項目。該閉包應回傳一個包含單一索引鍵/值配對的關聯性陣列,藉此以經過分組的值來建立新的 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 339 (code) +# P +#: ./docs/9.x/collections.md:1285 +#: ./docs/10.x/collections.md:1366 +#: ./docs/11.x/collections.md:1427 +#: ./docs/master/collections.md:1366 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/8.x/collections.md:1286 +#: ./docs/9.x/collections.md:1387 msgid "$collection = collect([\n" " [\n" " 'name' => 'John Doe',\n" @@ -2083,33 +4404,7 @@ msgid "$collection = collect([\n" " 'department' => 'Marketing',\n" " ]\n" "]);\n\n" -"$grouped = $collection->mapToGroups(function (array $item, int $key) {\n" -" return [$item['department'] => $item['name']];\n" -"});\n\n" -"$grouped->all();\n\n" -"/*\n" -" [\n" -" 'Sales' => ['John Doe', 'Jane Doe'],\n" -" 'Marketing' => ['Johnny Doe'],\n" -" ]\n" -"*/\n\n" -"$grouped->get('Sales')->all();\n\n" -"// ['John Doe', 'Jane Doe']\n" -msgstr "$collection = collect([\n" -" [\n" -" 'name' => 'John Doe',\n" -" 'department' => 'Sales',\n" -" ],\n" -" [\n" -" 'name' => 'Jane Doe',\n" -" 'department' => 'Sales',\n" -" ],\n" -" [\n" -" 'name' => 'Johnny Doe',\n" -" 'department' => 'Marketing',\n" -" ]\n" -"]);\n\n" -"$grouped = $collection->mapToGroups(function (array $item, int $key) {\n" +"$grouped = $collection->mapToGroups(function ($item, $key) {\n" " return [$item['department'] => $item['name']];\n" "});\n\n" "$grouped->all();\n\n" @@ -2120,40 +4415,109 @@ msgstr "$collection = collect([\n" " ]\n" "*/\n\n" "$grouped->get('Sales')->all();\n\n" -"// ['John Doe', 'Jane Doe']\n" +"// ['John Doe', 'Jane Doe']" +msgstr "" -#: docs/10.x/collections.md:block 341 (header) -msgid "`mapWithKeys()` {.collection-method}" -msgstr "`mapWithKeys()` {.collection-method}" +# H4 +#: ./docs/9.x/collections.md:1286 +#: ./docs/10.x/collections.md:1367 +#: ./docs/11.x/collections.md:1428 +#: ./docs/master/collections.md:1367 +msgid "`lazy()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 342 (paragraph) -msgid "The `mapWithKeys` method iterates through the collection and passes each value to the given callback. The callback should return an associative array containing a single key / value pair:" -msgstr "`mapWithKeys` 方法會迭代該 Collection,並將各個值傳入給定的回呼。該回呼應回傳一個包含單一索引鍵/值配對的關聯性陣列:" +# P +#: ./docs/9.x/collections.md:1288 +#: ./docs/10.x/collections.md:1369 +#: ./docs/11.x/collections.md:1430 +#: ./docs/master/collections.md:1369 +msgid "The `lazy` method returns a new [`LazyCollection`](#lazy-collections) instance from the underlying array of items:" +msgstr "" -#: docs/10.x/collections.md:block 343 (code) -msgid "$collection = collect([\n" -" [\n" -" 'name' => 'John',\n" -" 'department' => 'Sales',\n" -" 'email' => 'john@example.com',\n" -" ],\n" -" [\n" -" 'name' => 'Jane',\n" -" 'department' => 'Marketing',\n" -" 'email' => 'jane@example.com',\n" -" ]\n" -"]);\n\n" -"$keyed = $collection->mapWithKeys(function (array $item, int $key) {\n" -" return [$item['email'] => $item['name']];\n" +# CODE +#: ./docs/9.x/collections.md:1290 +msgid "$lazyCollection = collect([1, 2, 3, 4])->lazy();\n\n" +"get_class($lazyCollection);\n\n" +"// Illuminate\\Support\\LazyCollection\n\n" +"$lazyCollection->all();\n\n" +"// [1, 2, 3, 4]" +msgstr "" + +# P +#: ./docs/9.x/collections.md:1300 +#: ./docs/10.x/collections.md:1381 +#: ./docs/11.x/collections.md:1442 +#: ./docs/master/collections.md:1381 +msgid "This is especially useful when you need to perform transformations on a huge `Collection` that contains many items:" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:1302 +#: ./docs/10.x/collections.md:1383 +#: ./docs/11.x/collections.md:1444 +#: ./docs/master/collections.md:1383 +msgid "$count = $hugeCollection\n" +" ->lazy()\n" +" ->where('country', 'FR')\n" +" ->where('balance', '>', '100')\n" +" ->count();" +msgstr "" + +# P +#: ./docs/9.x/collections.md:1308 +#: ./docs/10.x/collections.md:1389 +#: ./docs/11.x/collections.md:1450 +#: ./docs/master/collections.md:1389 +msgid "By converting the collection to a `LazyCollection`, we avoid having to allocate a ton of additional memory. Though the original collection still keeps *its* values in memory, the subsequent filters will not. Therefore, virtually no additional memory will be allocated when filtering the collection's results." +msgstr "" + +# P +#: ./docs/8.x/collections.md:1318 +#: ./docs/9.x/collections.md:1419 +#: ./docs/10.x/collections.md:1496 +#: ./docs/11.x/collections.md:1557 +#: ./docs/master/collections.md:1496 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1319 +#: ./docs/9.x/collections.md:1420 +#: ./docs/10.x/collections.md:1497 +#: ./docs/11.x/collections.md:1558 +#: ./docs/master/collections.md:1497 +msgid "`mapWithKeys()` {.collection-method}" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1320 +#: ./docs/11.x/collections.md:1381 +#: ./docs/master/collections.md:1320 +msgid "$keyed = $collection->keyBy(function (array $item, int $key) {\n" +" return strtoupper($item['product_id']);\n" "});\n\n" "$keyed->all();\n\n" "/*\n" " [\n" -" 'john@example.com' => 'John',\n" -" 'jane@example.com' => 'Jane',\n" +" 'PROD-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],\n" +" 'PROD-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" +"*/" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1321 +#: ./docs/9.x/collections.md:1422 +#: ./docs/10.x/collections.md:1499 +#: ./docs/11.x/collections.md:1560 +#: ./docs/master/collections.md:1499 +msgid "The `mapWithKeys` method iterates through the collection and passes each value to the given callback. The callback should return an associative array containing a single key / value pair:" +msgstr "" + +# CODE +#: ./docs/8.x/collections.md:1323 +#: ./docs/9.x/collections.md:1424 +msgid "$collection = collect([\n" " [\n" " 'name' => 'John',\n" " 'department' => 'Sales',\n" @@ -2165,7 +4529,7 @@ msgstr "$collection = collect([\n" " 'email' => 'jane@example.com',\n" " ]\n" "]);\n\n" -"$keyed = $collection->mapWithKeys(function (array $item, int $key) {\n" +"$keyed = $collection->mapWithKeys(function ($item, $key) {\n" " return [$item['email'] => $item['name']];\n" "});\n\n" "$keyed->all();\n\n" @@ -2174,41 +4538,94 @@ msgstr "$collection = collect([\n" " 'john@example.com' => 'John',\n" " 'jane@example.com' => 'Jane',\n" " ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 345 (header) +# P +#: ./docs/8.x/collections.md:1349 +#: ./docs/9.x/collections.md:1450 +#: ./docs/10.x/collections.md:1527 +#: ./docs/11.x/collections.md:1588 +#: ./docs/master/collections.md:1527 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1350 +#: ./docs/9.x/collections.md:1451 +#: ./docs/10.x/collections.md:1528 +#: ./docs/11.x/collections.md:1589 +#: ./docs/master/collections.md:1528 msgid "`max()` {.collection-method}" -msgstr "`max()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 346 (paragraph) +# P +#: ./docs/8.x/collections.md:1352 +#: ./docs/9.x/collections.md:1453 +#: ./docs/10.x/collections.md:1530 +#: ./docs/11.x/collections.md:1591 +#: ./docs/master/collections.md:1530 msgid "The `max` method returns the maximum value of a given key:" -msgstr "`max` 方法回傳給定索引鍵的最大值:" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1354 +#: ./docs/11.x/collections.md:1415 +#: ./docs/master/collections.md:1354 +msgid "collect([1, 2, 3, 4])->last(function (int $value, int $key) {\n" +" return $value < 3;\n" +"});\n\n" +"// 2" +msgstr "" -#: docs/10.x/collections.md:block 347 (code) +# CODE +#: ./docs/8.x/collections.md:1354 +#: ./docs/9.x/collections.md:1455 +#: ./docs/10.x/collections.md:1532 +#: ./docs/11.x/collections.md:1593 +#: ./docs/master/collections.md:1532 msgid "$max = collect([\n" " ['foo' => 10],\n" " ['foo' => 20]\n" "])->max('foo');\n\n" "// 20\n\n" "$max = collect([1, 2, 3, 4, 5])->max();\n\n" -"// 5\n" -msgstr "$max = collect([\n" -" ['foo' => 10],\n" -" ['foo' => 20]\n" -"])->max('foo');\n\n" -"// 20\n\n" -"$max = collect([1, 2, 3, 4, 5])->max();\n\n" -"// 5\n" +"// 5" +msgstr "" -#: docs/10.x/collections.md:block 349 (header) +# P +#: ./docs/8.x/collections.md:1365 +#: ./docs/9.x/collections.md:1466 +#: ./docs/10.x/collections.md:1543 +#: ./docs/11.x/collections.md:1604 +#: ./docs/master/collections.md:1543 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1366 +#: ./docs/9.x/collections.md:1467 +#: ./docs/10.x/collections.md:1544 +#: ./docs/11.x/collections.md:1605 +#: ./docs/master/collections.md:1544 msgid "`median()` {.collection-method}" -msgstr "`median()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 350 (paragraph) +# P +#: ./docs/8.x/collections.md:1368 +#: ./docs/9.x/collections.md:1469 +#: ./docs/10.x/collections.md:1546 +#: ./docs/11.x/collections.md:1607 +#: ./docs/master/collections.md:1546 msgid "The `median` method returns the [median value](https://en.wikipedia.org/wiki/Median) of a given key:" -msgstr "`medium` 方法會回傳給定索引鍵的[中位數](https://zh.wikipedia.org/zh-tw/%E4%B8%AD%E4%BD%8D%E6%95%B8):" +msgstr "" -#: docs/10.x/collections.md:block 351 (code) +# CODE +#: ./docs/8.x/collections.md:1370 +#: ./docs/9.x/collections.md:1471 +#: ./docs/10.x/collections.md:1548 +#: ./docs/11.x/collections.md:1609 +#: ./docs/master/collections.md:1548 msgid "$median = collect([\n" " ['foo' => 10],\n" " ['foo' => 10],\n" @@ -2217,58 +4634,117 @@ msgid "$median = collect([\n" "])->median('foo');\n\n" "// 15\n\n" "$median = collect([1, 1, 2, 4])->median();\n\n" -"// 1.5\n" -msgstr "$median = collect([\n" -" ['foo' => 10],\n" -" ['foo' => 10],\n" -" ['foo' => 20],\n" -" ['foo' => 40]\n" -"])->median('foo');\n\n" -"// 15\n\n" -"$median = collect([1, 1, 2, 4])->median();\n\n" -"// 1.5\n" +"// 1.5" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1371 +#: ./docs/11.x/collections.md:1432 +#: ./docs/master/collections.md:1371 +msgid "$lazyCollection = collect([1, 2, 3, 4])->lazy();\n\n" +"$lazyCollection::class;\n\n" +"// Illuminate\\Support\\LazyCollection\n\n" +"$lazyCollection->all();\n\n" +"// [1, 2, 3, 4]" +msgstr "" -#: docs/10.x/collections.md:block 353 (header) +# P +#: ./docs/8.x/collections.md:1383 +#: ./docs/9.x/collections.md:1484 +#: ./docs/10.x/collections.md:1561 +#: ./docs/11.x/collections.md:1622 +#: ./docs/master/collections.md:1561 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1384 +#: ./docs/9.x/collections.md:1485 +#: ./docs/10.x/collections.md:1562 +#: ./docs/11.x/collections.md:1623 +#: ./docs/master/collections.md:1562 msgid "`merge()` {.collection-method}" -msgstr "`merge()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 354 (paragraph) -msgid "The `merge` method merges the given array or collection with the original collection. If a string key in the given items matches a string key in the original collection, the given item's value will overwrite the value in the original collection:" -msgstr "`merge` 方法會將給定的陣列或 Collection 與原始 Collection 合併。若在給定項目中有字串索引鍵與原始 Collection 中的字串索引鍵相同,則給定項目的值會覆蓋原始 Collection 中的值:" +# P +#: ./docs/8.x/collections.md:1386 +msgid "The `merge` method merges the given array or collection with the original collection. If a string key in the given items matches a string key in the original collection, the given items's value will overwrite the value in the original collection:" +msgstr "" -#: docs/10.x/collections.md:block 355 (code) +# CODE +#: ./docs/8.x/collections.md:1388 +#: ./docs/9.x/collections.md:1489 +#: ./docs/10.x/collections.md:1566 +#: ./docs/11.x/collections.md:1627 +#: ./docs/master/collections.md:1566 msgid "$collection = collect(['product_id' => 1, 'price' => 100]);\n\n" "$merged = $collection->merge(['price' => 200, 'discount' => false]);\n\n" "$merged->all();\n\n" -"// ['product_id' => 1, 'price' => 200, 'discount' => false]\n" -msgstr "$collection = collect(['product_id' => 1, 'price' => 100]);\n\n" -"$merged = $collection->merge(['price' => 200, 'discount' => false]);\n\n" -"$merged->all();\n\n" -"// ['product_id' => 1, 'price' => 200, 'discount' => false]\n" +"// ['product_id' => 1, 'price' => 200, 'discount' => false]" +msgstr "" -#: docs/10.x/collections.md:block 356 (paragraph) -msgid "If the given item's keys are numeric, the values will be appended to the end of the collection:" -msgstr "若給定項目的索引鍵是數字值,則其值會被加到該 Collection 的最後面:" +# P +#: ./docs/8.x/collections.md:1396 +msgid "If the given items's keys are numeric, the values will be appended to the end of the collection:" +msgstr "" -#: docs/10.x/collections.md:block 357 (code) +# CODE +#: ./docs/8.x/collections.md:1398 +#: ./docs/9.x/collections.md:1499 +#: ./docs/10.x/collections.md:1576 +#: ./docs/11.x/collections.md:1637 +#: ./docs/master/collections.md:1576 msgid "$collection = collect(['Desk', 'Chair']);\n\n" "$merged = $collection->merge(['Bookcase', 'Door']);\n\n" "$merged->all();\n\n" -"// ['Desk', 'Chair', 'Bookcase', 'Door']\n" -msgstr "$collection = collect(['Desk', 'Chair']);\n\n" -"$merged = $collection->merge(['Bookcase', 'Door']);\n\n" -"$merged->all();\n\n" -"// ['Desk', 'Chair', 'Bookcase', 'Door']\n" +"// ['Desk', 'Chair', 'Bookcase', 'Door']" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1406 +#: ./docs/11.x/collections.md:1467 +#: ./docs/master/collections.md:1406 +msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" +"$multiplied = $collection->map(function (int $item, int $key) {\n" +" return $item * 2;\n" +"});\n\n" +"$multiplied->all();\n\n" +"// [2, 4, 6, 8, 10]" +msgstr "" -#: docs/10.x/collections.md:block 359 (header) +# P +#: ./docs/8.x/collections.md:1406 +#: ./docs/9.x/collections.md:1507 +#: ./docs/10.x/collections.md:1584 +#: ./docs/11.x/collections.md:1645 +#: ./docs/master/collections.md:1584 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1407 +#: ./docs/9.x/collections.md:1508 +#: ./docs/10.x/collections.md:1585 +#: ./docs/11.x/collections.md:1646 +#: ./docs/master/collections.md:1585 msgid "`mergeRecursive()` {.collection-method}" -msgstr "`mergeRecursive()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 360 (paragraph) +# P +#: ./docs/8.x/collections.md:1409 +#: ./docs/9.x/collections.md:1510 +#: ./docs/10.x/collections.md:1587 +#: ./docs/11.x/collections.md:1648 +#: ./docs/master/collections.md:1587 msgid "The `mergeRecursive` method merges the given array or collection recursively with the original collection. If a string key in the given items matches a string key in the original collection, then the values for these keys are merged together into an array, and this is done recursively:" -msgstr "`mergeRecursive` 方法會將給定的陣列或 Collection 與原始 Collection 遞迴合併。若在給定項目中有字串索引鍵與原始 Collection 中的字串索引鍵相同,則這些索引鍵的值將被一起合併為一個陣列,且此一過程將遞迴進行:" +msgstr "" -#: docs/10.x/collections.md:block 361 (code) +# CODE +#: ./docs/8.x/collections.md:1411 +#: ./docs/9.x/collections.md:1512 +#: ./docs/10.x/collections.md:1589 +#: ./docs/11.x/collections.md:1650 +#: ./docs/master/collections.md:1589 msgid "$collection = collect(['product_id' => 1, 'price' => 100]);\n\n" "$merged = $collection->mergeRecursive([\n" " 'product_id' => 2,\n" @@ -2276,43 +4752,99 @@ msgid "$collection = collect(['product_id' => 1, 'price' => 100]);\n\n" " 'discount' => false\n" "]);\n\n" "$merged->all();\n\n" -"// ['product_id' => [1, 2], 'price' => [100, 200], 'discount' => false]\n" -msgstr "$collection = collect(['product_id' => 1, 'price' => 100]);\n\n" -"$merged = $collection->mergeRecursive([\n" -" 'product_id' => 2,\n" -" 'price' => 200,\n" -" 'discount' => false\n" -"]);\n\n" -"$merged->all();\n\n" -"// ['product_id' => [1, 2], 'price' => [100, 200], 'discount' => false]\n" +"// ['product_id' => [1, 2], 'price' => [100, 200], 'discount' => false]" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1423 +#: ./docs/9.x/collections.md:1524 +#: ./docs/10.x/collections.md:1601 +#: ./docs/11.x/collections.md:1662 +#: ./docs/master/collections.md:1601 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1424 +#: ./docs/master/collections.md:1424 +msgid "class Currency\n" +"{\n" +" /**\n" +" * Create a new currency instance.\n" +" */\n" +" function __construct(\n" +" public string $code\n" +" ) {}\n" +"}\n\n" +"$collection = collect(['USD', 'EUR', 'GBP']);\n\n" +"$currencies = $collection->mapInto(Currency::class);\n\n" +"$currencies->all();\n\n" +"// [Currency('USD'), Currency('EUR'), Currency('GBP')]" +msgstr "" -#: docs/10.x/collections.md:block 363 (header) +# H4 +#: ./docs/8.x/collections.md:1424 +#: ./docs/9.x/collections.md:1525 +#: ./docs/10.x/collections.md:1602 +#: ./docs/11.x/collections.md:1663 +#: ./docs/master/collections.md:1602 msgid "`min()` {.collection-method}" -msgstr "`min()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 364 (paragraph) +# P +#: ./docs/8.x/collections.md:1426 +#: ./docs/9.x/collections.md:1527 +#: ./docs/10.x/collections.md:1604 +#: ./docs/11.x/collections.md:1665 +#: ./docs/master/collections.md:1604 msgid "The `min` method returns the minimum value of a given key:" -msgstr "`min` 方法回傳給定索引鍵的最小值:" +msgstr "" -#: docs/10.x/collections.md:block 365 (code) +# CODE +#: ./docs/8.x/collections.md:1428 +#: ./docs/9.x/collections.md:1529 +#: ./docs/10.x/collections.md:1606 +#: ./docs/11.x/collections.md:1667 +#: ./docs/master/collections.md:1606 msgid "$min = collect([['foo' => 10], ['foo' => 20]])->min('foo');\n\n" "// 10\n\n" "$min = collect([1, 2, 3, 4, 5])->min();\n\n" -"// 1\n" -msgstr "$min = collect([['foo' => 10], ['foo' => 20]])->min('foo');\n\n" -"// 10\n\n" -"$min = collect([1, 2, 3, 4, 5])->min();\n\n" -"// 1\n" +"// 1" +msgstr "" -#: docs/10.x/collections.md:block 367 (header) +# P +#: ./docs/8.x/collections.md:1436 +#: ./docs/9.x/collections.md:1537 +#: ./docs/10.x/collections.md:1614 +#: ./docs/11.x/collections.md:1675 +#: ./docs/master/collections.md:1614 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1437 +#: ./docs/9.x/collections.md:1538 +#: ./docs/10.x/collections.md:1615 +#: ./docs/11.x/collections.md:1676 +#: ./docs/master/collections.md:1615 msgid "`mode()` {.collection-method}" -msgstr "`mode()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 368 (paragraph) +# P +#: ./docs/8.x/collections.md:1439 +#: ./docs/9.x/collections.md:1540 +#: ./docs/10.x/collections.md:1617 +#: ./docs/11.x/collections.md:1678 +#: ./docs/master/collections.md:1617 msgid "The `mode` method returns the [mode value](https://en.wikipedia.org/wiki/Mode_(statistics)) of a given key:" -msgstr "`mode` 方法會回傳給定索引鍵的[眾數](https://zh.wikipedia.org/zh-tw/%E4%BC%97%E6%95%B0_%28%E6%95%B0%E5%AD%A6%29):" +msgstr "" -#: docs/10.x/collections.md:block 369 (code) +# CODE +#: ./docs/8.x/collections.md:1441 +#: ./docs/9.x/collections.md:1542 +#: ./docs/10.x/collections.md:1619 +#: ./docs/11.x/collections.md:1680 +#: ./docs/master/collections.md:1619 msgid "$mode = collect([\n" " ['foo' => 10],\n" " ['foo' => 10],\n" @@ -2323,54 +4855,144 @@ msgid "$mode = collect([\n" "$mode = collect([1, 1, 2, 4])->mode();\n\n" "// [1]\n\n" "$mode = collect([1, 1, 2, 2])->mode();\n\n" -"// [1, 2]\n" -msgstr "$mode = collect([\n" -" ['foo' => 10],\n" -" ['foo' => 10],\n" -" ['foo' => 20],\n" -" ['foo' => 40]\n" -"])->mode('foo');\n\n" -"// [10]\n\n" -"$mode = collect([1, 1, 2, 4])->mode();\n\n" -"// [1]\n\n" -"$mode = collect([1, 1, 2, 2])->mode();\n\n" -"// [1, 2]\n" +"// [1, 2]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1447 +#: ./docs/11.x/collections.md:1508 +#: ./docs/master/collections.md:1447 +msgid "$collection = collect([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n\n" +"$chunks = $collection->chunk(2);\n\n" +"$sequence = $chunks->mapSpread(function (int $even, int $odd) {\n" +" return $even + $odd;\n" +"});\n\n" +"$sequence->all();\n\n" +"// [1, 5, 9, 13, 17]" +msgstr "" -#: docs/10.x/collections.md:block 371 (header) +# P +#: ./docs/8.x/collections.md:1458 +#: ./docs/9.x/collections.md:1559 +#: ./docs/10.x/collections.md:1636 +#: ./docs/11.x/collections.md:1720 +#: ./docs/master/collections.md:1636 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1459 +#: ./docs/9.x/collections.md:1560 +#: ./docs/10.x/collections.md:1637 +#: ./docs/11.x/collections.md:1721 +#: ./docs/master/collections.md:1637 msgid "`nth()` {.collection-method}" -msgstr "`nth()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 372 (paragraph) +# P +#: ./docs/8.x/collections.md:1461 +#: ./docs/9.x/collections.md:1562 +#: ./docs/10.x/collections.md:1639 +#: ./docs/11.x/collections.md:1723 +#: ./docs/master/collections.md:1639 msgid "The `nth` method creates a new collection consisting of every n-th element:" -msgstr "`nth` 方法會使用每 n 個元素來建立新的 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 373 (code) +# CODE +#: ./docs/8.x/collections.md:1463 +#: ./docs/9.x/collections.md:1564 +#: ./docs/10.x/collections.md:1641 +#: ./docs/11.x/collections.md:1725 +#: ./docs/master/collections.md:1641 msgid "$collection = collect(['a', 'b', 'c', 'd', 'e', 'f']);\n\n" "$collection->nth(4);\n\n" -"// ['a', 'e']\n" -msgstr "$collection = collect(['a', 'b', 'c', 'd', 'e', 'f']);\n\n" -"$collection->nth(4);\n\n" -"// ['a', 'e']\n" - -#: docs/10.x/collections.md:block 374 (paragraph) -msgid "You may optionally pass a starting offset as the second argument:" -msgstr "也可以傳入可選的第二個引數來設定起始偏移值:" +"// ['a', 'e']" +msgstr "" -#: docs/10.x/collections.md:block 375 (code) +# CODE +#: ./docs/10.x/collections.md:1464 +#: ./docs/11.x/collections.md:1525 +#: ./docs/master/collections.md:1464 +msgid "$collection = collect([\n" +" [\n" +" 'name' => 'John Doe',\n" +" 'department' => 'Sales',\n" +" ],\n" +" [\n" +" 'name' => 'Jane Doe',\n" +" 'department' => 'Sales',\n" +" ],\n" +" [\n" +" 'name' => 'Johnny Doe',\n" +" 'department' => 'Marketing',\n" +" ]\n" +"]);\n\n" +"$grouped = $collection->mapToGroups(function (array $item, int $key) {\n" +" return [$item['department'] => $item['name']];\n" +"});\n\n" +"$grouped->all();\n\n" +"/*\n" +" [\n" +" 'Sales' => ['John Doe', 'Jane Doe'],\n" +" 'Marketing' => ['Johnny Doe'],\n" +" ]\n" +"*/\n\n" +"$grouped->get('Sales')->all();\n\n" +"// ['John Doe', 'Jane Doe']" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1469 +#: ./docs/9.x/collections.md:1570 +#: ./docs/10.x/collections.md:1647 +#: ./docs/11.x/collections.md:1731 +#: ./docs/master/collections.md:1647 +msgid "You may optionally pass a starting offset as the second argument:" +msgstr "" + +# CODE +#: ./docs/8.x/collections.md:1471 +#: ./docs/9.x/collections.md:1572 +#: ./docs/10.x/collections.md:1649 +#: ./docs/11.x/collections.md:1733 +#: ./docs/master/collections.md:1649 msgid "$collection->nth(4, 1);\n\n" -"// ['b', 'f']\n" -msgstr "$collection->nth(4, 1);\n\n" -"// ['b', 'f']\n" +"// ['b', 'f']" +msgstr "" -#: docs/10.x/collections.md:block 377 (header) +# P +#: ./docs/8.x/collections.md:1475 +#: ./docs/9.x/collections.md:1576 +#: ./docs/10.x/collections.md:1653 +#: ./docs/11.x/collections.md:1737 +#: ./docs/master/collections.md:1653 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1476 +#: ./docs/9.x/collections.md:1577 +#: ./docs/10.x/collections.md:1654 +#: ./docs/11.x/collections.md:1738 +#: ./docs/master/collections.md:1654 msgid "`only()` {.collection-method}" -msgstr "`only()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 378 (paragraph) +# P +#: ./docs/8.x/collections.md:1478 +#: ./docs/9.x/collections.md:1579 +#: ./docs/10.x/collections.md:1656 +#: ./docs/11.x/collections.md:1740 +#: ./docs/master/collections.md:1656 msgid "The `only` method returns the items in the collection with the specified keys:" -msgstr "`only` 方法會回傳該 Collection 中具有特定索引鍵的所有項目:" +msgstr "" -#: docs/10.x/collections.md:block 379 (code) +# CODE +#: ./docs/8.x/collections.md:1480 +#: ./docs/9.x/collections.md:1581 +#: ./docs/10.x/collections.md:1658 +#: ./docs/11.x/collections.md:1742 +#: ./docs/master/collections.md:1658 msgid "$collection = collect([\n" " 'product_id' => 1,\n" " 'name' => 'Desk',\n" @@ -2379,274 +5001,412 @@ msgid "$collection = collect([\n" "]);\n\n" "$filtered = $collection->only(['product_id', 'name']);\n\n" "$filtered->all();\n\n" -"// ['product_id' => 1, 'name' => 'Desk']\n" -msgstr "$collection = collect([\n" -" 'product_id' => 1,\n" -" 'name' => 'Desk',\n" -" 'price' => 100,\n" -" 'discount' => false\n" -"]);\n\n" -"$filtered = $collection->only(['product_id', 'name']);\n\n" -"$filtered->all();\n\n" -"// ['product_id' => 1, 'name' => 'Desk']\n" +"// ['product_id' => 1, 'name' => 'Desk']" +msgstr "" + +# CODE +#: ./docs/11.x/collections.md:1485 +msgid "class Currency\n" +"{\n" +" /**\n" +" * Create a new currency instance.\n" +" */\n" +" function __construct(\n" +" public string $code,\n" +" ) {}\n" +"}\n\n" +"$collection = collect(['USD', 'EUR', 'GBP']);\n\n" +"$currencies = $collection->mapInto(Currency::class);\n\n" +"$currencies->all();\n\n" +"// [Currency('USD'), Currency('EUR'), Currency('GBP')]" +msgstr "" + +# P +#: ./docs/9.x/collections.md:1487 +#: ./docs/10.x/collections.md:1564 +#: ./docs/11.x/collections.md:1625 +#: ./docs/master/collections.md:1564 +msgid "The `merge` method merges the given array or collection with the original collection. If a string key in the given items matches a string key in the original collection, the given item's value will overwrite the value in the original collection:" +msgstr "" -#: docs/10.x/collections.md:block 380 (paragraph) +# P +#: ./docs/8.x/collections.md:1493 +#: ./docs/9.x/collections.md:1594 +#: ./docs/10.x/collections.md:1671 +#: ./docs/11.x/collections.md:1755 +#: ./docs/master/collections.md:1671 msgid "For the inverse of `only`, see the [except](#method-except) method." -msgstr "請參考 [except](#method-except) 方法以瞭解與 `only` 相反的方法。" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1495 +#: ./docs/9.x/collections.md:1597 +#: ./docs/10.x/collections.md:1674 +#: ./docs/11.x/collections.md:1758 +#: ./docs/master/collections.md:1674 +msgid "This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-only)." +msgstr "" -#: docs/10.x/collections.md:block 381 (quote) -msgid "**Note** This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-only)." -msgstr "**Note** 在使用 [Eloquent Collection](/docs/{{version}}/eloquent-collections#method-only) 時,該方法的行為有經過修改。" +# P +#: ./docs/8.x/collections.md:1497 +#: ./docs/9.x/collections.md:1599 +#: ./docs/10.x/collections.md:1676 +#: ./docs/11.x/collections.md:1760 +#: ./docs/master/collections.md:1676 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/collections.md:1497 +#: ./docs/10.x/collections.md:1574 +#: ./docs/11.x/collections.md:1635 +#: ./docs/master/collections.md:1574 +msgid "If the given item's keys are numeric, the values will be appended to the end of the collection:" +msgstr "" -#: docs/10.x/collections.md:block 383 (header) +# H4 +#: ./docs/8.x/collections.md:1498 +#: ./docs/9.x/collections.md:1600 +#: ./docs/10.x/collections.md:1677 +#: ./docs/11.x/collections.md:1761 +#: ./docs/master/collections.md:1677 msgid "`pad()` {.collection-method}" -msgstr "`pad()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 384 (paragraph) +# P +#: ./docs/8.x/collections.md:1500 +#: ./docs/9.x/collections.md:1602 +#: ./docs/10.x/collections.md:1679 +#: ./docs/11.x/collections.md:1763 +#: ./docs/master/collections.md:1679 msgid "The `pad` method will fill the array with the given value until the array reaches the specified size. This method behaves like the [array_pad](https://secure.php.net/manual/en/function.array-pad.php) PHP function." -msgstr "`pad` 方法會以給定的值來填充陣列,直到該陣列達到特定大小。該方法的行為與 [array_pad](https://secure.php.net/manual/en/function.array-pad.php) PHP 方法類似。" +msgstr "" -#: docs/10.x/collections.md:block 385 (paragraph) +# CODE +#: ./docs/10.x/collections.md:1501 +#: ./docs/11.x/collections.md:1562 +#: ./docs/master/collections.md:1501 +msgid "$collection = collect([\n" +" [\n" +" 'name' => 'John',\n" +" 'department' => 'Sales',\n" +" 'email' => 'john@example.com',\n" +" ],\n" +" [\n" +" 'name' => 'Jane',\n" +" 'department' => 'Marketing',\n" +" 'email' => 'jane@example.com',\n" +" ]\n" +"]);\n\n" +"$keyed = $collection->mapWithKeys(function (array $item, int $key) {\n" +" return [$item['email'] => $item['name']];\n" +"});\n\n" +"$keyed->all();\n\n" +"/*\n" +" [\n" +" 'john@example.com' => 'John',\n" +" 'jane@example.com' => 'Jane',\n" +" ]\n" +"*/" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1502 +#: ./docs/9.x/collections.md:1604 +#: ./docs/10.x/collections.md:1681 +#: ./docs/11.x/collections.md:1765 +#: ./docs/master/collections.md:1681 msgid "To pad to the left, you should specify a negative size. No padding will take place if the absolute value of the given size is less than or equal to the length of the array:" -msgstr "若要向左填充,則可指定負數大小。若給定大小的絕對值小於或等於該陣列的長度,則不會進行填充:" +msgstr "" -#: docs/10.x/collections.md:block 386 (code) +# CODE +#: ./docs/8.x/collections.md:1504 +#: ./docs/9.x/collections.md:1606 +#: ./docs/10.x/collections.md:1683 +#: ./docs/11.x/collections.md:1767 +#: ./docs/master/collections.md:1683 msgid "$collection = collect(['A', 'B', 'C']);\n\n" "$filtered = $collection->pad(5, 0);\n\n" "$filtered->all();\n\n" "// ['A', 'B', 'C', 0, 0]\n\n" "$filtered = $collection->pad(-5, 0);\n\n" "$filtered->all();\n\n" -"// [0, 0, 'A', 'B', 'C']\n" -msgstr "$collection = collect(['A', 'B', 'C']);\n\n" -"$filtered = $collection->pad(5, 0);\n\n" -"$filtered->all();\n\n" -"// ['A', 'B', 'C', 0, 0]\n\n" -"$filtered = $collection->pad(-5, 0);\n\n" -"$filtered->all();\n\n" -"// [0, 0, 'A', 'B', 'C']\n" +"// [0, 0, 'A', 'B', 'C']" +msgstr "" -#: docs/10.x/collections.md:block 388 (header) +# P +#: ./docs/8.x/collections.md:1518 +#: ./docs/9.x/collections.md:1620 +#: ./docs/10.x/collections.md:1697 +#: ./docs/11.x/collections.md:1781 +#: ./docs/master/collections.md:1697 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1519 +#: ./docs/9.x/collections.md:1621 +#: ./docs/10.x/collections.md:1698 +#: ./docs/11.x/collections.md:1782 +#: ./docs/master/collections.md:1698 msgid "`partition()` {.collection-method}" -msgstr "`partition()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 389 (paragraph) +# P +#: ./docs/8.x/collections.md:1521 +#: ./docs/9.x/collections.md:1623 +#: ./docs/10.x/collections.md:1700 +#: ./docs/11.x/collections.md:1784 +#: ./docs/master/collections.md:1700 msgid "The `partition` method may be combined with PHP array destructuring to separate elements that pass a given truth test from those that do not:" -msgstr "`partition` 方法可用來與 PHP 的陣列結構函式一起使用,以區分出符合與不符合給定布林測試的元素:" +msgstr "" -#: docs/10.x/collections.md:block 390 (code) +# CODE +#: ./docs/8.x/collections.md:1523 +#: ./docs/9.x/collections.md:1625 msgid "$collection = collect([1, 2, 3, 4, 5, 6]);\n\n" -"[$underThree, $equalOrAboveThree] = $collection->partition(function (int $i) {\n" -" return $i < 3;\n" -"});\n\n" -"$underThree->all();\n\n" -"// [1, 2]\n\n" -"$equalOrAboveThree->all();\n\n" -"// [3, 4, 5, 6]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5, 6]);\n\n" -"[$underThree, $equalOrAboveThree] = $collection->partition(function (int $i) {\n" +"[$underThree, $equalOrAboveThree] = $collection->partition(function ($i) {\n" " return $i < 3;\n" "});\n\n" "$underThree->all();\n\n" "// [1, 2]\n\n" "$equalOrAboveThree->all();\n\n" -"// [3, 4, 5, 6]\n" - -#: docs/10.x/collections.md:block 392 (header) -msgid "`percentage()` {.collection-method}" -msgstr "`percentage()` {.collection-method}" - -#: docs/10.x/collections.md:block 393 (paragraph) -msgid "The `percentage` method may be used to quickly determine the percentage of items in the collection that pass a given truth test:" -msgstr "`percentage` 方法可用來快速判斷 Collection 中是否至少有特定百分比的項目通過給定的真值測試:" - -#: docs/10.x/collections.md:block 394 (code) -msgid "$collection = collect([1, 1, 2, 2, 2, 3]);\n\n" -"$percentage = $collection->percentage(fn ($value) => $value === 1);\n\n" -"// 33.33\n" -msgstr "$collection = collect([1, 1, 2, 2, 2, 3]);\n\n" -"$percentage = $collection->percentage(fn ($value) => $value === 1);\n\n" -"// 33.33\n" - -#: docs/10.x/collections.md:block 395 (paragraph) -msgid "By default, the percentage will be rounded to two decimal places. However, you may customize this behavior by providing a second argument to the method:" -msgstr "預設情況下,百分比會被四捨五入到小數點後兩位。不過,也可以提供第二個引數給該方法來自定此行為:" - -#: docs/10.x/collections.md:block 396 (code) -msgid "$percentage = $collection->percentage(fn ($value) => $value === 1, precision: 3);\n\n" -"// 33.333\n" -msgstr "$percentage = $collection->percentage(fn ($value) => $value === 1, precision: 3);\n\n" -"// 33.333\n" +"// [3, 4, 5, 6]" +msgstr "" -#: docs/10.x/collections.md:block 398 (header) +# P +#: ./docs/8.x/collections.md:1537 +#: ./docs/9.x/collections.md:1639 +#: ./docs/10.x/collections.md:1737 +#: ./docs/11.x/collections.md:1821 +#: ./docs/master/collections.md:1737 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1538 +#: ./docs/9.x/collections.md:1640 +#: ./docs/10.x/collections.md:1738 +#: ./docs/11.x/collections.md:1822 +#: ./docs/master/collections.md:1738 msgid "`pipe()` {.collection-method}" -msgstr "`pipe()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 399 (paragraph) +# P +#: ./docs/8.x/collections.md:1540 +#: ./docs/9.x/collections.md:1642 +#: ./docs/10.x/collections.md:1740 +#: ./docs/11.x/collections.md:1824 +#: ./docs/master/collections.md:1740 msgid "The `pipe` method passes the collection to the given closure and returns the result of the executed closure:" -msgstr "`pipe` 方法會將該 Collection 傳入給定閉包,並回傳執行該閉包的結果:" +msgstr "" -#: docs/10.x/collections.md:block 400 (code) +# CODE +#: ./docs/8.x/collections.md:1542 +#: ./docs/9.x/collections.md:1644 msgid "$collection = collect([1, 2, 3]);\n\n" -"$piped = $collection->pipe(function (Collection $collection) {\n" -" return $collection->sum();\n" -"});\n\n" -"// 6\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$piped = $collection->pipe(function (Collection $collection) {\n" +"$piped = $collection->pipe(function ($collection) {\n" " return $collection->sum();\n" "});\n\n" -"// 6\n" +"// 6" +msgstr "" -#: docs/10.x/collections.md:block 402 (header) +# P +#: ./docs/8.x/collections.md:1550 +#: ./docs/9.x/collections.md:1652 +#: ./docs/10.x/collections.md:1750 +#: ./docs/11.x/collections.md:1834 +#: ./docs/master/collections.md:1750 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1551 +#: ./docs/9.x/collections.md:1653 +#: ./docs/10.x/collections.md:1751 +#: ./docs/11.x/collections.md:1835 +#: ./docs/master/collections.md:1751 msgid "`pipeInto()` {.collection-method}" -msgstr "`pipeInto()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 403 (paragraph) +# P +#: ./docs/8.x/collections.md:1553 +#: ./docs/9.x/collections.md:1655 +#: ./docs/10.x/collections.md:1753 +#: ./docs/11.x/collections.md:1837 +#: ./docs/master/collections.md:1753 msgid "The `pipeInto` method creates a new instance of the given class and passes the collection into the constructor:" -msgstr "`pipeInto` 方法會以給定的類別建立新實體,並將該 Collection 傳入其建構函式內:" +msgstr "" -#: docs/10.x/collections.md:block 404 (code) +# CODE +#: ./docs/8.x/collections.md:1555 +#: ./docs/9.x/collections.md:1657 msgid "class ResourceCollection\n" "{\n" " /**\n" -" * Create a new ResourceCollection instance.\n" +" * The Collection instance.\n" " */\n" -" public function __construct(\n" -" public Collection $collection,\n" -" ) {}\n" -"}\n\n" -"$collection = collect([1, 2, 3]);\n\n" -"$resource = $collection->pipeInto(ResourceCollection::class);\n\n" -"$resource->collection->all();\n\n" -"// [1, 2, 3]\n" -msgstr "class ResourceCollection\n" -"{\n" +" public $collection;\n\n" " /**\n" " * Create a new ResourceCollection instance.\n" +" *\n" +" * @param Collection $collection\n" +" * @return void\n" " */\n" -" public function __construct(\n" -" public Collection $collection,\n" -" ) {}\n" +" public function __construct(Collection $collection)\n" +" {\n" +" $this->collection = $collection;\n" +" }\n" "}\n\n" "$collection = collect([1, 2, 3]);\n\n" "$resource = $collection->pipeInto(ResourceCollection::class);\n\n" "$resource->collection->all();\n\n" -"// [1, 2, 3]\n" +"// [1, 2, 3]" +msgstr "" -#: docs/10.x/collections.md:block 406 (header) +# P +#: ./docs/8.x/collections.md:1582 +#: ./docs/9.x/collections.md:1684 +#: ./docs/10.x/collections.md:1773 +#: ./docs/11.x/collections.md:1857 +#: ./docs/master/collections.md:1773 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1583 +#: ./docs/9.x/collections.md:1685 +#: ./docs/10.x/collections.md:1774 +#: ./docs/11.x/collections.md:1858 +#: ./docs/master/collections.md:1774 msgid "`pipeThrough()` {.collection-method}" -msgstr "`pipeThrough()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 407 (paragraph) +# P +#: ./docs/8.x/collections.md:1585 +#: ./docs/9.x/collections.md:1687 +#: ./docs/10.x/collections.md:1776 +#: ./docs/11.x/collections.md:1860 +#: ./docs/master/collections.md:1776 msgid "The `pipeThrough` method passes the collection to the given array of closures and returns the result of the executed closures:" -msgstr "`pipeThrough` 方法會將該 Collection 傳入給定之包含閉包的陣列,並回傳這些閉包的執行結果:" +msgstr "" -#: docs/10.x/collections.md:block 408 (code) -msgid "use Illuminate\\Support\\Collection;\n\n" -"$collection = collect([1, 2, 3]);\n\n" -"$result = $collection->pipeThrough([\n" -" function (Collection $collection) {\n" -" return $collection->merge([4, 5]);\n" -" },\n" -" function (Collection $collection) {\n" -" return $collection->sum();\n" -" },\n" -"]);\n\n" -"// 15\n" -msgstr "use Illuminate\\Support\\Collection;\n\n" -"$collection = collect([1, 2, 3]);\n\n" +# CODE +#: ./docs/8.x/collections.md:1587 +#: ./docs/9.x/collections.md:1689 +msgid "$collection = collect([1, 2, 3]);\n\n" "$result = $collection->pipeThrough([\n" -" function (Collection $collection) {\n" +" function ($collection) {\n" " return $collection->merge([4, 5]);\n" " },\n" -" function (Collection $collection) {\n" +" function ($collection) {\n" " return $collection->sum();\n" " },\n" "]);\n\n" -"// 15\n" +"// 15" +msgstr "" -#: docs/10.x/collections.md:block 410 (header) +# P +#: ./docs/8.x/collections.md:1600 +#: ./docs/9.x/collections.md:1702 +#: ./docs/10.x/collections.md:1793 +#: ./docs/11.x/collections.md:1877 +#: ./docs/master/collections.md:1793 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1601 +#: ./docs/9.x/collections.md:1703 +#: ./docs/10.x/collections.md:1794 +#: ./docs/11.x/collections.md:1878 +#: ./docs/master/collections.md:1794 msgid "`pluck()` {.collection-method}" -msgstr "`pluck()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 411 (paragraph) +# P +#: ./docs/8.x/collections.md:1603 +#: ./docs/9.x/collections.md:1705 +#: ./docs/10.x/collections.md:1796 +#: ./docs/11.x/collections.md:1880 +#: ./docs/master/collections.md:1796 msgid "The `pluck` method retrieves all of the values for a given key:" -msgstr "`pluck` 方法可取得給定索引鍵內的所有值:" +msgstr "" -#: docs/10.x/collections.md:block 412 (code) +# CODE +#: ./docs/8.x/collections.md:1605 +#: ./docs/9.x/collections.md:1707 +#: ./docs/10.x/collections.md:1798 +#: ./docs/11.x/collections.md:1882 +#: ./docs/master/collections.md:1798 msgid "$collection = collect([\n" " ['product_id' => 'prod-100', 'name' => 'Desk'],\n" " ['product_id' => 'prod-200', 'name' => 'Chair'],\n" "]);\n\n" "$plucked = $collection->pluck('name');\n\n" "$plucked->all();\n\n" -"// ['Desk', 'Chair']\n" -msgstr "$collection = collect([\n" -" ['product_id' => 'prod-100', 'name' => 'Desk'],\n" -" ['product_id' => 'prod-200', 'name' => 'Chair'],\n" -"]);\n\n" -"$plucked = $collection->pluck('name');\n\n" -"$plucked->all();\n\n" -"// ['Desk', 'Chair']\n" +"// ['Desk', 'Chair']" +msgstr "" -#: docs/10.x/collections.md:block 413 (paragraph) +# P +#: ./docs/8.x/collections.md:1616 +#: ./docs/9.x/collections.md:1718 +#: ./docs/10.x/collections.md:1809 +#: ./docs/11.x/collections.md:1893 +#: ./docs/master/collections.md:1809 msgid "You may also specify how you wish the resulting collection to be keyed:" -msgstr "也可以指定產生的 Collection 要如何設定索引鍵:" +msgstr "" -#: docs/10.x/collections.md:block 414 (code) +# CODE +#: ./docs/8.x/collections.md:1618 +#: ./docs/9.x/collections.md:1720 +#: ./docs/10.x/collections.md:1811 +#: ./docs/11.x/collections.md:1895 +#: ./docs/master/collections.md:1811 msgid "$plucked = $collection->pluck('name', 'product_id');\n\n" "$plucked->all();\n\n" -"// ['prod-100' => 'Desk', 'prod-200' => 'Chair']\n" -msgstr "$plucked = $collection->pluck('name', 'product_id');\n\n" -"$plucked->all();\n\n" -"// ['prod-100' => 'Desk', 'prod-200' => 'Chair']\n" +"// ['prod-100' => 'Desk', 'prod-200' => 'Chair']" +msgstr "" -#: docs/10.x/collections.md:block 415 (paragraph) +# P +#: ./docs/8.x/collections.md:1624 +#: ./docs/9.x/collections.md:1726 +#: ./docs/10.x/collections.md:1817 +#: ./docs/11.x/collections.md:1901 +#: ./docs/master/collections.md:1817 msgid "The `pluck` method also supports retrieving nested values using \"dot\" notation:" -msgstr "`pluck` 方法也支援使用「點 (.)」標記法來取得巢狀數值:" +msgstr "" -#: docs/10.x/collections.md:block 416 (code) +# CODE +#: ./docs/8.x/collections.md:1626 msgid "$collection = collect([\n" " [\n" -" 'name' => 'Laracon',\n" -" 'speakers' => [\n" -" 'first_day' => ['Rosa', 'Judith'],\n" -" ],\n" -" ],\n" -" [\n" -" 'name' => 'VueConf',\n" -" 'speakers' => [\n" -" 'first_day' => ['Abigail', 'Joey'],\n" -" ],\n" -" ],\n" -"]);\n\n" -"$plucked = $collection->pluck('speakers.first_day');\n\n" -"$plucked->all();\n\n" -"// [['Rosa', 'Judith'], ['Abigail', 'Joey']]\n" -msgstr "$collection = collect([\n" -" [\n" -" 'name' => 'Laracon',\n" " 'speakers' => [\n" " 'first_day' => ['Rosa', 'Judith'],\n" -" ],\n" -" ],\n" -" [\n" -" 'name' => 'VueConf',\n" -" 'speakers' => [\n" -" 'first_day' => ['Abigail', 'Joey'],\n" +" 'second_day' => ['Angela', 'Kathleen'],\n" " ],\n" " ],\n" "]);\n\n" "$plucked = $collection->pluck('speakers.first_day');\n\n" "$plucked->all();\n\n" -"// [['Rosa', 'Judith'], ['Abigail', 'Joey']]\n" +"// ['Rosa', 'Judith']" +msgstr "" -#: docs/10.x/collections.md:block 417 (paragraph) +# P +#: ./docs/8.x/collections.md:1641 +#: ./docs/9.x/collections.md:1749 +#: ./docs/10.x/collections.md:1840 +#: ./docs/11.x/collections.md:1924 +#: ./docs/master/collections.md:1840 msgid "If duplicate keys exist, the last matching element will be inserted into the plucked collection:" -msgstr "若存在重複的索引鍵,則最後一個相符合的元素會被插入 pluck 後的 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 418 (code) +# CODE +#: ./docs/8.x/collections.md:1643 +#: ./docs/9.x/collections.md:1751 +#: ./docs/10.x/collections.md:1842 +#: ./docs/11.x/collections.md:1926 +#: ./docs/master/collections.md:1842 msgid "$collection = collect([\n" " ['brand' => 'Tesla', 'color' => 'red'],\n" " ['brand' => 'Pagani', 'color' => 'white'],\n" @@ -2655,242 +5415,583 @@ msgid "$collection = collect([\n" "]);\n\n" "$plucked = $collection->pluck('color', 'brand');\n\n" "$plucked->all();\n\n" -"// ['Tesla' => 'black', 'Pagani' => 'orange']\n" -msgstr "$collection = collect([\n" -" ['brand' => 'Tesla', 'color' => 'red'],\n" -" ['brand' => 'Pagani', 'color' => 'white'],\n" -" ['brand' => 'Tesla', 'color' => 'black'],\n" -" ['brand' => 'Pagani', 'color' => 'orange'],\n" -"]);\n\n" -"$plucked = $collection->pluck('color', 'brand');\n\n" -"$plucked->all();\n\n" -"// ['Tesla' => 'black', 'Pagani' => 'orange']\n" +"// ['Tesla' => 'black', 'Pagani' => 'orange']" +msgstr "" -#: docs/10.x/collections.md:block 420 (header) +# P +#: ./docs/8.x/collections.md:1656 +#: ./docs/9.x/collections.md:1764 +#: ./docs/10.x/collections.md:1855 +#: ./docs/11.x/collections.md:1939 +#: ./docs/master/collections.md:1855 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1657 +#: ./docs/9.x/collections.md:1765 +#: ./docs/10.x/collections.md:1856 +#: ./docs/11.x/collections.md:1940 +#: ./docs/master/collections.md:1856 msgid "`pop()` {.collection-method}" -msgstr "`pop()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 421 (paragraph) +# P +#: ./docs/8.x/collections.md:1659 +#: ./docs/9.x/collections.md:1767 +#: ./docs/10.x/collections.md:1858 +#: ./docs/11.x/collections.md:1942 +#: ./docs/master/collections.md:1858 msgid "The `pop` method removes and returns the last item from the collection:" -msgstr "`pop` 方法會從該 Collection 中移除最後一個項目並將其回傳:" +msgstr "" -#: docs/10.x/collections.md:block 422 (code) +# CODE +#: ./docs/8.x/collections.md:1661 +#: ./docs/9.x/collections.md:1769 +#: ./docs/10.x/collections.md:1860 +#: ./docs/11.x/collections.md:1944 +#: ./docs/master/collections.md:1860 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" "$collection->pop();\n\n" "// 5\n\n" "$collection->all();\n\n" -"// [1, 2, 3, 4]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->pop();\n\n" -"// 5\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 4]\n" +"// [1, 2, 3, 4]" +msgstr "" -#: docs/10.x/collections.md:block 423 (paragraph) +# P +#: ./docs/8.x/collections.md:1671 +#: ./docs/9.x/collections.md:1779 +#: ./docs/10.x/collections.md:1870 +#: ./docs/11.x/collections.md:1954 +#: ./docs/master/collections.md:1870 msgid "You may pass an integer to the `pop` method to remove and return multiple items from the end of a collection:" -msgstr "可以將整數傳入 `pop` 方法以從 Collection 的結尾移除並回傳多個項目:" +msgstr "" -#: docs/10.x/collections.md:block 424 (code) +# CODE +#: ./docs/8.x/collections.md:1673 +#: ./docs/9.x/collections.md:1781 +#: ./docs/10.x/collections.md:1872 +#: ./docs/11.x/collections.md:1956 +#: ./docs/master/collections.md:1872 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" "$collection->pop(3);\n\n" "// collect([5, 4, 3])\n\n" "$collection->all();\n\n" -"// [1, 2]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->pop(3);\n\n" -"// collect([5, 4, 3])\n\n" -"$collection->all();\n\n" -"// [1, 2]\n" +"// [1, 2]" +msgstr "" -#: docs/10.x/collections.md:block 426 (header) +# P +#: ./docs/8.x/collections.md:1683 +#: ./docs/9.x/collections.md:1791 +#: ./docs/10.x/collections.md:1882 +#: ./docs/11.x/collections.md:1966 +#: ./docs/master/collections.md:1882 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1684 +#: ./docs/9.x/collections.md:1792 +#: ./docs/10.x/collections.md:1883 +#: ./docs/11.x/collections.md:1967 +#: ./docs/master/collections.md:1883 msgid "`prepend()` {.collection-method}" -msgstr "`prepend()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 427 (paragraph) +# P +#: ./docs/8.x/collections.md:1686 +#: ./docs/9.x/collections.md:1794 +#: ./docs/10.x/collections.md:1885 +#: ./docs/11.x/collections.md:1969 +#: ./docs/master/collections.md:1885 msgid "The `prepend` method adds an item to the beginning of the collection:" -msgstr "`prepend` 方法會將項目加至該 Collection 的開頭:" +msgstr "" -#: docs/10.x/collections.md:block 428 (code) +# CODE +#: ./docs/8.x/collections.md:1688 +#: ./docs/9.x/collections.md:1796 +#: ./docs/10.x/collections.md:1887 +#: ./docs/11.x/collections.md:1971 +#: ./docs/master/collections.md:1887 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" "$collection->prepend(0);\n\n" "$collection->all();\n\n" -"// [0, 1, 2, 3, 4, 5]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->prepend(0);\n\n" -"$collection->all();\n\n" -"// [0, 1, 2, 3, 4, 5]\n" +"// [0, 1, 2, 3, 4, 5]" +msgstr "" -#: docs/10.x/collections.md:block 429 (paragraph) +# P +#: ./docs/8.x/collections.md:1696 +#: ./docs/9.x/collections.md:1804 +#: ./docs/10.x/collections.md:1895 +#: ./docs/11.x/collections.md:1979 +#: ./docs/master/collections.md:1895 msgid "You may also pass a second argument to specify the key of the prepended item:" -msgstr "也可以傳入第二個引數來指定要被加到前面之項目的索引鍵:" +msgstr "" + +# P +#: ./docs/11.x/collections.md:1697 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/11.x/collections.md:1698 +msgid "`multiply()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 430 (code) +# CODE +#: ./docs/8.x/collections.md:1698 +#: ./docs/9.x/collections.md:1806 +#: ./docs/10.x/collections.md:1897 +#: ./docs/11.x/collections.md:1981 +#: ./docs/master/collections.md:1897 msgid "$collection = collect(['one' => 1, 'two' => 2]);\n\n" "$collection->prepend(0, 'zero');\n\n" "$collection->all();\n\n" -"// ['zero' => 0, 'one' => 1, 'two' => 2]\n" -msgstr "$collection = collect(['one' => 1, 'two' => 2]);\n\n" -"$collection->prepend(0, 'zero');\n\n" -"$collection->all();\n\n" -"// ['zero' => 0, 'one' => 1, 'two' => 2]\n" +"// ['zero' => 0, 'one' => 1, 'two' => 2]" +msgstr "" + +# P +#: ./docs/11.x/collections.md:1700 +msgid "The `multiply` method creates the specified number of copies of all items in the collection:" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1702 +#: ./docs/11.x/collections.md:1786 +#: ./docs/master/collections.md:1702 +msgid "$collection = collect([1, 2, 3, 4, 5, 6]);\n\n" +"[$underThree, $equalOrAboveThree] = $collection->partition(function (int $i) {\n" +" return $i < 3;\n" +"});\n\n" +"$underThree->all();\n\n" +"// [1, 2]\n\n" +"$equalOrAboveThree->all();\n\n" +"// [3, 4, 5, 6]" +msgstr "" + +# CODE: php +#: ./docs/11.x/collections.md:1702 +msgid "$users = collect([\n" +" ['name' => 'User #1', 'email' => 'user1@example.com'],\n" +" ['name' => 'User #2', 'email' => 'user2@example.com'],\n" +"])->multiply(3);\n\n" +"/*\n" +" [\n" +" ['name' => 'User #1', 'email' => 'user1@example.com'],\n" +" ['name' => 'User #2', 'email' => 'user2@example.com'],\n" +" ['name' => 'User #1', 'email' => 'user1@example.com'],\n" +" ['name' => 'User #2', 'email' => 'user2@example.com'],\n" +" ['name' => 'User #1', 'email' => 'user1@example.com'],\n" +" ['name' => 'User #2', 'email' => 'user2@example.com'],\n" +" ]\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 432 (header) +# P +#: ./docs/8.x/collections.md:1706 +#: ./docs/9.x/collections.md:1814 +#: ./docs/10.x/collections.md:1905 +#: ./docs/11.x/collections.md:1989 +#: ./docs/master/collections.md:1905 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1707 +#: ./docs/9.x/collections.md:1815 +#: ./docs/10.x/collections.md:1906 +#: ./docs/11.x/collections.md:1990 +#: ./docs/master/collections.md:1906 msgid "`pull()` {.collection-method}" -msgstr "`pull()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 433 (paragraph) +# P +#: ./docs/8.x/collections.md:1709 +#: ./docs/9.x/collections.md:1817 +#: ./docs/10.x/collections.md:1908 +#: ./docs/11.x/collections.md:1992 +#: ./docs/master/collections.md:1908 msgid "The `pull` method removes and returns an item from the collection by its key:" -msgstr "`pull` 方法根據項目的索引鍵來在該 Collection 中移除項目並將其回傳:" +msgstr "" -#: docs/10.x/collections.md:block 434 (code) +# CODE +#: ./docs/8.x/collections.md:1711 +#: ./docs/9.x/collections.md:1819 +#: ./docs/10.x/collections.md:1910 +#: ./docs/11.x/collections.md:1994 +#: ./docs/master/collections.md:1910 msgid "$collection = collect(['product_id' => 'prod-100', 'name' => 'Desk']);\n\n" "$collection->pull('name');\n\n" "// 'Desk'\n\n" "$collection->all();\n\n" -"// ['product_id' => 'prod-100']\n" -msgstr "$collection = collect(['product_id' => 'prod-100', 'name' => 'Desk']);\n\n" -"$collection->pull('name');\n\n" -"// 'Desk'\n\n" -"$collection->all();\n\n" -"// ['product_id' => 'prod-100']\n" +"// ['product_id' => 'prod-100']" +msgstr "" + +# P +#: ./docs/10.x/collections.md:1716 +#: ./docs/11.x/collections.md:1800 +#: ./docs/master/collections.md:1716 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/collections.md:1717 +#: ./docs/11.x/collections.md:1801 +#: ./docs/master/collections.md:1717 +msgid "`percentage()` {.collection-method}" +msgstr "" + +# P +#: ./docs/10.x/collections.md:1719 +#: ./docs/11.x/collections.md:1803 +#: ./docs/master/collections.md:1719 +msgid "The `percentage` method may be used to quickly determine the percentage of items in the collection that pass a given truth test:" +msgstr "" -#: docs/10.x/collections.md:block 436 (header) +# CODE: php +#: ./docs/10.x/collections.md:1721 +#: ./docs/11.x/collections.md:1805 +#: ./docs/master/collections.md:1721 +msgid "$collection = collect([1, 1, 2, 2, 2, 3]);\n\n" +"$percentage = $collection->percentage(fn ($value) => $value === 1);\n\n" +"// 33.33" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1721 +#: ./docs/9.x/collections.md:1829 +#: ./docs/10.x/collections.md:1920 +#: ./docs/11.x/collections.md:2004 +#: ./docs/master/collections.md:1920 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1722 +#: ./docs/9.x/collections.md:1830 +#: ./docs/10.x/collections.md:1921 +#: ./docs/11.x/collections.md:2005 +#: ./docs/master/collections.md:1921 msgid "`push()` {.collection-method}" -msgstr "`push()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 437 (paragraph) +# P +#: ./docs/8.x/collections.md:1724 +#: ./docs/9.x/collections.md:1832 +#: ./docs/10.x/collections.md:1923 +#: ./docs/11.x/collections.md:2007 +#: ./docs/master/collections.md:1923 msgid "The `push` method appends an item to the end of the collection:" -msgstr "`push` 方法會將項目加至該 Collection 的結尾:" +msgstr "" -#: docs/10.x/collections.md:block 438 (code) +# CODE +#: ./docs/8.x/collections.md:1726 +#: ./docs/9.x/collections.md:1834 +#: ./docs/10.x/collections.md:1925 +#: ./docs/11.x/collections.md:2009 +#: ./docs/master/collections.md:1925 msgid "$collection = collect([1, 2, 3, 4]);\n\n" "$collection->push(5);\n\n" "$collection->all();\n\n" -"// [1, 2, 3, 4, 5]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$collection->push(5);\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 4, 5]\n" +"// [1, 2, 3, 4, 5]" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:1728 +#: ./docs/10.x/collections.md:1819 +#: ./docs/11.x/collections.md:1903 +#: ./docs/master/collections.md:1819 +msgid "$collection = collect([\n" +" [\n" +" 'name' => 'Laracon',\n" +" 'speakers' => [\n" +" 'first_day' => ['Rosa', 'Judith'],\n" +" ],\n" +" ],\n" +" [\n" +" 'name' => 'VueConf',\n" +" 'speakers' => [\n" +" 'first_day' => ['Abigail', 'Joey'],\n" +" ],\n" +" ],\n" +"]);\n\n" +"$plucked = $collection->pluck('speakers.first_day');\n\n" +"$plucked->all();\n\n" +"// [['Rosa', 'Judith'], ['Abigail', 'Joey']]" +msgstr "" + +# P +#: ./docs/10.x/collections.md:1729 +#: ./docs/11.x/collections.md:1813 +#: ./docs/master/collections.md:1729 +msgid "By default, the percentage will be rounded to two decimal places. However, you may customize this behavior by providing a second argument to the method:" +msgstr "" + +# CODE: php +#: ./docs/10.x/collections.md:1731 +#: ./docs/11.x/collections.md:1815 +#: ./docs/master/collections.md:1731 +msgid "$percentage = $collection->percentage(fn ($value) => $value === 1, precision: 3);\n\n" +"// 33.333" +msgstr "" -#: docs/10.x/collections.md:block 440 (header) +# P +#: ./docs/8.x/collections.md:1734 +#: ./docs/9.x/collections.md:1842 +#: ./docs/10.x/collections.md:1933 +#: ./docs/11.x/collections.md:2017 +#: ./docs/master/collections.md:1933 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1735 +#: ./docs/9.x/collections.md:1843 +#: ./docs/10.x/collections.md:1934 +#: ./docs/11.x/collections.md:2018 +#: ./docs/master/collections.md:1934 msgid "`put()` {.collection-method}" -msgstr "`put()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 441 (paragraph) +# P +#: ./docs/8.x/collections.md:1737 +#: ./docs/9.x/collections.md:1845 +#: ./docs/10.x/collections.md:1936 +#: ./docs/11.x/collections.md:2020 +#: ./docs/master/collections.md:1936 msgid "The `put` method sets the given key and value in the collection:" -msgstr "`put` 方法將給定的索引鍵與值設定至該 Collection 內:" +msgstr "" -#: docs/10.x/collections.md:block 442 (code) +# CODE +#: ./docs/8.x/collections.md:1739 +#: ./docs/9.x/collections.md:1847 +#: ./docs/10.x/collections.md:1938 +#: ./docs/11.x/collections.md:2022 +#: ./docs/master/collections.md:1938 msgid "$collection = collect(['product_id' => 1, 'name' => 'Desk']);\n\n" "$collection->put('price', 100);\n\n" "$collection->all();\n\n" -"// ['product_id' => 1, 'name' => 'Desk', 'price' => 100]\n" -msgstr "$collection = collect(['product_id' => 1, 'name' => 'Desk']);\n\n" -"$collection->put('price', 100);\n\n" -"$collection->all();\n\n" -"// ['product_id' => 1, 'name' => 'Desk', 'price' => 100]\n" +"// ['product_id' => 1, 'name' => 'Desk', 'price' => 100]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1742 +#: ./docs/11.x/collections.md:1826 +#: ./docs/master/collections.md:1742 +msgid "$collection = collect([1, 2, 3]);\n\n" +"$piped = $collection->pipe(function (Collection $collection) {\n" +" return $collection->sum();\n" +"});\n\n" +"// 6" +msgstr "" -#: docs/10.x/collections.md:block 444 (header) +# P +#: ./docs/8.x/collections.md:1747 +#: ./docs/9.x/collections.md:1855 +#: ./docs/10.x/collections.md:1946 +#: ./docs/11.x/collections.md:2030 +#: ./docs/master/collections.md:1946 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1748 +#: ./docs/9.x/collections.md:1856 +#: ./docs/10.x/collections.md:1947 +#: ./docs/11.x/collections.md:2031 +#: ./docs/master/collections.md:1947 msgid "`random()` {.collection-method}" -msgstr "`random()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 445 (paragraph) +# P +#: ./docs/8.x/collections.md:1750 +#: ./docs/9.x/collections.md:1858 +#: ./docs/10.x/collections.md:1949 +#: ./docs/11.x/collections.md:2033 +#: ./docs/master/collections.md:1949 msgid "The `random` method returns a random item from the collection:" -msgstr "`random` 方法會從該 Collection 內回傳一個隨機的項目:" +msgstr "" -#: docs/10.x/collections.md:block 446 (code) +# CODE +#: ./docs/8.x/collections.md:1752 +#: ./docs/9.x/collections.md:1860 +#: ./docs/10.x/collections.md:1951 +#: ./docs/11.x/collections.md:2035 +#: ./docs/master/collections.md:1951 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" "$collection->random();\n\n" -"// 4 - (retrieved randomly)\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->random();\n\n" -"// 4 - (隨機取得)\n" +"// 4 - (retrieved randomly)" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1755 +#: ./docs/master/collections.md:1755 +msgid "class ResourceCollection\n" +"{\n" +" /**\n" +" * Create a new ResourceCollection instance.\n" +" */\n" +" public function __construct(\n" +" public Collection $collection,\n" +" ) {}\n" +"}\n\n" +"$collection = collect([1, 2, 3]);\n\n" +"$resource = $collection->pipeInto(ResourceCollection::class);\n\n" +"$resource->collection->all();\n\n" +"// [1, 2, 3]" +msgstr "" -#: docs/10.x/collections.md:block 447 (paragraph) +# P +#: ./docs/8.x/collections.md:1758 +#: ./docs/9.x/collections.md:1866 +#: ./docs/10.x/collections.md:1957 +#: ./docs/11.x/collections.md:2041 +#: ./docs/master/collections.md:1957 msgid "You may pass an integer to `random` to specify how many items you would like to randomly retrieve. A collection of items is always returned when explicitly passing the number of items you wish to receive:" -msgstr "也可以傳入一個整數給 `random` 來指定要隨機取得幾個項目。當有明顯傳入要取得記得項目的時候,將總是回傳一個包含項目的 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 448 (code) +# CODE +#: ./docs/8.x/collections.md:1760 +#: ./docs/9.x/collections.md:1868 +#: ./docs/10.x/collections.md:1959 +#: ./docs/11.x/collections.md:2043 +#: ./docs/master/collections.md:1959 msgid "$random = $collection->random(3);\n\n" "$random->all();\n\n" -"// [2, 4, 5] - (retrieved randomly)\n" -msgstr "$random = $collection->random(3);\n\n" -"$random->all();\n\n" -"// [2, 4, 5] - (retrieved randomly)\n" +"// [2, 4, 5] - (retrieved randomly)" +msgstr "" -#: docs/10.x/collections.md:block 449 (paragraph) +# P +#: ./docs/8.x/collections.md:1766 +#: ./docs/9.x/collections.md:1874 +#: ./docs/10.x/collections.md:1965 +#: ./docs/11.x/collections.md:2049 +#: ./docs/master/collections.md:1965 msgid "If the collection instance has fewer items than requested, the `random` method will throw an `InvalidArgumentException`." -msgstr "若該 Collection 實體內的項目比所要求的還要少,則 `random` 方法會擲回一個 `InvalidArgumentException`。" - -#: docs/10.x/collections.md:block 450 (paragraph) -msgid "The `random` method also accepts a closure, which will receive the current collection instance:" -msgstr "`random` 函式也接受傳入一個閉包,該閉包會收到目前 Collection 的實體:" - -#: docs/10.x/collections.md:block 451 (code) -msgid "use Illuminate\\Support\\Collection;\n\n" -"$random = $collection->random(fn (Collection $items) => min(10, count($items)));\n\n" -"$random->all();\n\n" -"// [1, 2, 3, 4, 5] - (retrieved randomly)\n" -msgstr "use Illuminate\\Support\\Collection;\n\n" -"$random = $collection->random(fn (Collection $items) => min(10, count($items)));\n\n" -"$random->all();\n\n" -"// [1, 2, 3, 4, 5] - (隨機取得)\n" +msgstr "" -#: docs/10.x/collections.md:block 453 (header) +# P +#: ./docs/8.x/collections.md:1768 +#: ./docs/9.x/collections.md:1884 +#: ./docs/10.x/collections.md:1977 +#: ./docs/11.x/collections.md:2061 +#: ./docs/master/collections.md:1977 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1769 +#: ./docs/9.x/collections.md:1885 +#: ./docs/10.x/collections.md:1978 +#: ./docs/11.x/collections.md:2062 +#: ./docs/master/collections.md:1978 msgid "`range()` {.collection-method}" -msgstr "`range()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 454 (paragraph) +# P +#: ./docs/8.x/collections.md:1771 +#: ./docs/9.x/collections.md:1887 +#: ./docs/10.x/collections.md:1980 +#: ./docs/11.x/collections.md:2064 +#: ./docs/master/collections.md:1980 msgid "The `range` method returns a collection containing integers between the specified range:" -msgstr "`range` 方法回傳一個包含了介於指定範圍內整數的 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 455 (code) +# CODE +#: ./docs/8.x/collections.md:1773 +#: ./docs/9.x/collections.md:1889 +#: ./docs/10.x/collections.md:1982 +#: ./docs/11.x/collections.md:2066 +#: ./docs/master/collections.md:1982 msgid "$collection = collect()->range(3, 6);\n\n" "$collection->all();\n\n" -"// [3, 4, 5, 6]\n" -msgstr "$collection = collect()->range(3, 6);\n\n" -"$collection->all();\n\n" -"// [3, 4, 5, 6]\n" +"// [3, 4, 5, 6]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1778 +#: ./docs/11.x/collections.md:1862 +#: ./docs/master/collections.md:1778 +msgid "use Illuminate\\Support\\Collection;\n\n" +"$collection = collect([1, 2, 3]);\n\n" +"$result = $collection->pipeThrough([\n" +" function (Collection $collection) {\n" +" return $collection->merge([4, 5]);\n" +" },\n" +" function (Collection $collection) {\n" +" return $collection->sum();\n" +" },\n" +"]);\n\n" +"// 15" +msgstr "" -#: docs/10.x/collections.md:block 457 (header) +# P +#: ./docs/8.x/collections.md:1779 +#: ./docs/9.x/collections.md:1895 +#: ./docs/10.x/collections.md:1988 +#: ./docs/11.x/collections.md:2072 +#: ./docs/master/collections.md:1988 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1780 +#: ./docs/9.x/collections.md:1896 +#: ./docs/10.x/collections.md:1989 +#: ./docs/11.x/collections.md:2073 +#: ./docs/master/collections.md:1989 msgid "`reduce()` {.collection-method}" -msgstr "`reduce()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 458 (paragraph) +# P +#: ./docs/8.x/collections.md:1782 +#: ./docs/9.x/collections.md:1898 +#: ./docs/10.x/collections.md:1991 +#: ./docs/11.x/collections.md:2075 +#: ./docs/master/collections.md:1991 msgid "The `reduce` method reduces the collection to a single value, passing the result of each iteration into the subsequent iteration:" -msgstr "`reduce` 方法會將該 Collection 歸約 (Reduce) 為單一值,將各個迭代的結果傳送至接下來的迭代中:" +msgstr "" -#: docs/10.x/collections.md:block 459 (code) +# CODE +#: ./docs/8.x/collections.md:1784 +#: ./docs/9.x/collections.md:1900 msgid "$collection = collect([1, 2, 3]);\n\n" -"$total = $collection->reduce(function (?int $carry, int $item) {\n" -" return $carry + $item;\n" -"});\n\n" -"// 6\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$total = $collection->reduce(function (?int $carry, int $item) {\n" +"$total = $collection->reduce(function ($carry, $item) {\n" " return $carry + $item;\n" "});\n\n" -"// 6\n" +"// 6" +msgstr "" -#: docs/10.x/collections.md:block 460 (paragraph) +# P +#: ./docs/8.x/collections.md:1792 +#: ./docs/9.x/collections.md:1908 +#: ./docs/10.x/collections.md:2001 +#: ./docs/11.x/collections.md:2085 +#: ./docs/master/collections.md:2001 msgid "The value for `$carry` on the first iteration is `null`; however, you may specify its initial value by passing a second argument to `reduce`:" -msgstr "第一次迭代時,`$carry` 的值為 `null`。不過,也可以通過將第二個引數傳給 `reduce` 來指定初始值:" +msgstr "" -#: docs/10.x/collections.md:block 461 (code) -msgid "$collection->reduce(function (int $carry, int $item) {\n" -" return $carry + $item;\n" -"}, 4);\n\n" -"// 10\n" -msgstr "$collection->reduce(function (int $carry, int $item) {\n" +# CODE +#: ./docs/8.x/collections.md:1794 +#: ./docs/9.x/collections.md:1910 +msgid "$collection->reduce(function ($carry, $item) {\n" " return $carry + $item;\n" "}, 4);\n\n" -"// 10\n" +"// 10" +msgstr "" -#: docs/10.x/collections.md:block 462 (paragraph) +# P +#: ./docs/8.x/collections.md:1800 +#: ./docs/9.x/collections.md:1916 +#: ./docs/10.x/collections.md:2009 +#: ./docs/11.x/collections.md:2093 +#: ./docs/master/collections.md:2009 msgid "The `reduce` method also passes array keys in associative collections to the given callback:" -msgstr "`reduce` 方法也會將關聯式 Collection 的索引鍵傳入給定的回呼中:" +msgstr "" -#: docs/10.x/collections.md:block 463 (code) +# CODE +#: ./docs/8.x/collections.md:1802 +#: ./docs/9.x/collections.md:1918 msgid "$collection = collect([\n" " 'usd' => 1400,\n" " 'gbp' => 1200,\n" @@ -2901,106 +6002,188 @@ msgid "$collection = collect([\n" " 'gbp' => 1.37,\n" " 'eur' => 1.22,\n" "];\n\n" -"$collection->reduce(function (int $carry, int $value, int $key) use ($ratio) {\n" -" return $carry + ($value * $ratio[$key]);\n" -"});\n\n" -"// 4264\n" -msgstr "$collection = collect([\n" -" 'usd' => 1400,\n" -" 'gbp' => 1200,\n" -" 'eur' => 1000,\n" -"]);\n\n" -"$ratio = [\n" -" 'usd' => 1,\n" -" 'gbp' => 1.37,\n" -" 'eur' => 1.22,\n" -"];\n\n" -"$collection->reduce(function (int $carry, int $value, int $key) use ($ratio) {\n" +"$collection->reduce(function ($carry, $value, $key) use ($ratio) {\n" " return $carry + ($value * $ratio[$key]);\n" "});\n\n" -"// 4264\n" +"// 4264" +msgstr "" -#: docs/10.x/collections.md:block 465 (header) +# P +#: ./docs/8.x/collections.md:1820 +#: ./docs/9.x/collections.md:1936 +#: ./docs/10.x/collections.md:2029 +#: ./docs/11.x/collections.md:2113 +#: ./docs/master/collections.md:2029 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1821 +#: ./docs/9.x/collections.md:1937 +#: ./docs/10.x/collections.md:2030 +#: ./docs/11.x/collections.md:2114 +#: ./docs/master/collections.md:2030 msgid "`reduceSpread()` {.collection-method}" -msgstr "`reduceSpread()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 466 (paragraph) +# P +#: ./docs/8.x/collections.md:1823 +#: ./docs/9.x/collections.md:1939 +#: ./docs/10.x/collections.md:2032 +#: ./docs/11.x/collections.md:2116 +#: ./docs/master/collections.md:2032 msgid "The `reduceSpread` method reduces the collection to an array of values, passing the results of each iteration into the subsequent iteration. This method is similar to the `reduce` method; however, it can accept multiple initial values:" -msgstr "`reduceSpread` 方法會將該 Collection 歸約 (Reduce) 為一組包含值的陣列,並將每次迭代的結果傳遞給下一個迭代。這個方法與 `reduce` 方法類似,不過 `reduceSpread` 接受多個初始值:" +msgstr "" -#: docs/10.x/collections.md:block 467 (code) +# CODE: php +#: ./docs/8.x/collections.md:1825 msgid "[$creditsRemaining, $batch] = Image::where('status', 'unprocessed')\n" -" ->get()\n" -" ->reduceSpread(function (int $creditsRemaining, Collection $batch, Image $image) {\n" -" if ($creditsRemaining >= $image->creditsRequired()) {\n" -" $batch->push($image);\n\n" -" $creditsRemaining -= $image->creditsRequired();\n" -" }\n\n" -" return [$creditsRemaining, $batch];\n" -" }, $creditsAvailable, collect());\n" -msgstr "[$creditsRemaining, $batch] = Image::where('status', 'unprocessed')\n" -" ->get()\n" -" ->reduceSpread(function (int $creditsRemaining, Collection $batch, Image $image) {\n" -" if ($creditsRemaining >= $image->creditsRequired()) {\n" -" $batch->push($image);\n\n" -" $creditsRemaining -= $image->creditsRequired();\n" -" }\n\n" -" return [$creditsRemaining, $batch];\n" -" }, $creditsAvailable, collect());\n" +" ->get()\n" +" ->reduceSpread(function ($creditsRemaining, $batch, $image) {\n" +" if ($creditsRemaining >= $image->creditsRequired()) {\n" +" $batch->push($image);\n\n" +" $creditsRemaining -= $image->creditsRequired();\n" +" }\n\n" +" return [$creditsRemaining, $batch];\n" +" }, $creditsAvailable, collect());" +msgstr "" + +# CODE +#: ./docs/11.x/collections.md:1839 +msgid "class ResourceCollection\n" +"{\n" +" /**\n" +" * Create a new ResourceCollection instance.\n" +" */\n" +" public function __construct(\n" +" public Collection $collection,\n" +" ) {}\n" +"}\n\n" +"$collection = collect([1, 2, 3]);\n\n" +"$resource = $collection->pipeInto(ResourceCollection::class);\n\n" +"$resource->collection->all();\n\n" +"// [1, 2, 3]" +msgstr "" -#: docs/10.x/collections.md:block 469 (header) +# P +#: ./docs/8.x/collections.md:1839 +#: ./docs/9.x/collections.md:1953 +#: ./docs/10.x/collections.md:2046 +#: ./docs/11.x/collections.md:2130 +#: ./docs/master/collections.md:2046 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1840 +#: ./docs/9.x/collections.md:1954 +#: ./docs/10.x/collections.md:2047 +#: ./docs/11.x/collections.md:2131 +#: ./docs/master/collections.md:2047 msgid "`reject()` {.collection-method}" -msgstr "`reject()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 470 (paragraph) +# P +#: ./docs/8.x/collections.md:1842 +#: ./docs/9.x/collections.md:1956 +#: ./docs/10.x/collections.md:2049 +#: ./docs/11.x/collections.md:2133 +#: ./docs/master/collections.md:2049 msgid "The `reject` method filters the collection using the given closure. The closure should return `true` if the item should be removed from the resulting collection:" -msgstr "`reject` 方法會使用給定的閉包來過濾該 Collection。若某項目應自產生的 Collection 內移除,則該閉包應回傳 `true`:" +msgstr "" -#: docs/10.x/collections.md:block 471 (code) +# CODE +#: ./docs/8.x/collections.md:1844 +#: ./docs/9.x/collections.md:1958 msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$filtered = $collection->reject(function (int $value, int $key) {\n" -" return $value > 2;\n" -"});\n\n" -"$filtered->all();\n\n" -"// [1, 2]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$filtered = $collection->reject(function (int $value, int $key) {\n" +"$filtered = $collection->reject(function ($value, $key) {\n" " return $value > 2;\n" "});\n\n" "$filtered->all();\n\n" -"// [1, 2]\n" +"// [1, 2]" +msgstr "" -#: docs/10.x/collections.md:block 472 (paragraph) +# P +#: ./docs/8.x/collections.md:1854 +#: ./docs/9.x/collections.md:1968 +#: ./docs/10.x/collections.md:2061 +#: ./docs/11.x/collections.md:2145 +#: ./docs/master/collections.md:2061 msgid "For the inverse of the `reject` method, see the [`filter`](#method-filter) method." -msgstr "有關與 `reject` 相反的方法。請參考 [`filter`](#method-filter) 方法。" +msgstr "" -#: docs/10.x/collections.md:block 474 (header) +# P +#: ./docs/8.x/collections.md:1856 +#: ./docs/9.x/collections.md:1970 +#: ./docs/10.x/collections.md:2063 +#: ./docs/11.x/collections.md:2147 +#: ./docs/master/collections.md:2063 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1857 +#: ./docs/9.x/collections.md:1971 +#: ./docs/10.x/collections.md:2064 +#: ./docs/11.x/collections.md:2148 +#: ./docs/master/collections.md:2064 msgid "`replace()` {.collection-method}" -msgstr "`replace()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 475 (paragraph) +# P +#: ./docs/8.x/collections.md:1859 +#: ./docs/9.x/collections.md:1973 +#: ./docs/10.x/collections.md:2066 +#: ./docs/11.x/collections.md:2150 +#: ./docs/master/collections.md:2066 msgid "The `replace` method behaves similarly to `merge`; however, in addition to overwriting matching items that have string keys, the `replace` method will also overwrite items in the collection that have matching numeric keys:" -msgstr "`replace` 方法與 `merge` 方法類似。不過,除了複寫有字串索引鍵的相符項目外,`replace` 還會複寫該 Collection 中符合數字索引鍵的項目:" +msgstr "" -#: docs/10.x/collections.md:block 476 (code) +# CODE +#: ./docs/8.x/collections.md:1861 +#: ./docs/9.x/collections.md:1975 +#: ./docs/10.x/collections.md:2068 +#: ./docs/11.x/collections.md:2152 +#: ./docs/master/collections.md:2068 msgid "$collection = collect(['Taylor', 'Abigail', 'James']);\n\n" "$replaced = $collection->replace([1 => 'Victoria', 3 => 'Finn']);\n\n" "$replaced->all();\n\n" -"// ['Taylor', 'Victoria', 'James', 'Finn']\n" -msgstr "$collection = collect(['Taylor', 'Abigail', 'James']);\n\n" -"$replaced = $collection->replace([1 => 'Victoria', 3 => 'Finn']);\n\n" -"$replaced->all();\n\n" -"// ['Taylor', 'Victoria', 'James', 'Finn']\n" +"// ['Taylor', 'Victoria', 'James', 'Finn']" +msgstr "" -#: docs/10.x/collections.md:block 478 (header) +# P +#: ./docs/8.x/collections.md:1869 +#: ./docs/9.x/collections.md:1983 +#: ./docs/10.x/collections.md:2076 +#: ./docs/11.x/collections.md:2160 +#: ./docs/master/collections.md:2076 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1870 +#: ./docs/9.x/collections.md:1984 +#: ./docs/10.x/collections.md:2077 +#: ./docs/11.x/collections.md:2161 +#: ./docs/master/collections.md:2077 msgid "`replaceRecursive()` {.collection-method}" -msgstr "`replaceRecursive()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 479 (paragraph) +# P +#: ./docs/8.x/collections.md:1872 +#: ./docs/9.x/collections.md:1986 +#: ./docs/10.x/collections.md:2079 +#: ./docs/11.x/collections.md:2163 +#: ./docs/master/collections.md:2079 msgid "This method works like `replace`, but it will recur into arrays and apply the same replacement process to the inner values:" -msgstr "該方法與 `replace` 類似,但這個方法會遞迴僅各個陣列,並將相同的取代過程套用至內部的數值:" +msgstr "" -#: docs/10.x/collections.md:block 480 (code) +# CODE +#: ./docs/8.x/collections.md:1874 +#: ./docs/9.x/collections.md:1988 +#: ./docs/10.x/collections.md:2081 +#: ./docs/11.x/collections.md:2165 +#: ./docs/master/collections.md:2081 msgid "$collection = collect([\n" " 'Taylor',\n" " 'Abigail',\n" @@ -3015,32 +6198,57 @@ msgid "$collection = collect([\n" " 2 => [1 => 'King']\n" "]);\n\n" "$replaced->all();\n\n" -"// ['Charlie', 'Abigail', ['James', 'King', 'Finn']]\n" -msgstr "$collection = collect([\n" -" 'Taylor',\n" -" 'Abigail',\n" -" [\n" -" 'James',\n" -" 'Victoria',\n" -" 'Finn'\n" -" ]\n" -"]);\n\n" -"$replaced = $collection->replaceRecursive([\n" -" 'Charlie',\n" -" 2 => [1 => 'King']\n" -"]);\n\n" -"$replaced->all();\n\n" -"// ['Charlie', 'Abigail', ['James', 'King', 'Finn']]\n" +"// ['Charlie', 'Abigail', ['James', 'King', 'Finn']]" +msgstr "" + +# P +#: ./docs/9.x/collections.md:1876 +#: ./docs/10.x/collections.md:1967 +#: ./docs/11.x/collections.md:2051 +#: ./docs/master/collections.md:1967 +msgid "The `random` method also accepts a closure, which will receive the current collection instance:" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:1878 +msgid "$random = $collection->random(fn ($items) => min(10, count($items)));\n\n" +"$random->all();\n\n" +"// [1, 2, 3, 4, 5] - (retrieved randomly)" +msgstr "" -#: docs/10.x/collections.md:block 482 (header) +# P +#: ./docs/8.x/collections.md:1893 +#: ./docs/9.x/collections.md:2007 +#: ./docs/10.x/collections.md:2100 +#: ./docs/11.x/collections.md:2184 +#: ./docs/master/collections.md:2100 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1894 +#: ./docs/9.x/collections.md:2008 +#: ./docs/10.x/collections.md:2101 +#: ./docs/11.x/collections.md:2185 +#: ./docs/master/collections.md:2101 msgid "`reverse()` {.collection-method}" -msgstr "`reverse()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 483 (paragraph) +# P +#: ./docs/8.x/collections.md:1896 +#: ./docs/9.x/collections.md:2010 +#: ./docs/10.x/collections.md:2103 +#: ./docs/11.x/collections.md:2187 +#: ./docs/master/collections.md:2103 msgid "The `reverse` method reverses the order of the collection's items, preserving the original keys:" -msgstr "`reverse` 方法會將該 Collection 項目的順序顛倒過來,但保留原來的索引鍵:" +msgstr "" -#: docs/10.x/collections.md:block 484 (code) +# CODE +#: ./docs/8.x/collections.md:1898 +#: ./docs/9.x/collections.md:2012 +#: ./docs/10.x/collections.md:2105 +#: ./docs/11.x/collections.md:2189 +#: ./docs/master/collections.md:2105 msgid "$collection = collect(['a', 'b', 'c', 'd', 'e']);\n\n" "$reversed = $collection->reverse();\n\n" "$reversed->all();\n\n" @@ -3052,375 +6260,813 @@ msgid "$collection = collect(['a', 'b', 'c', 'd', 'e']);\n\n" " 1 => 'b',\n" " 0 => 'a',\n" " ]\n" -"*/\n" -msgstr "$collection = collect(['a', 'b', 'c', 'd', 'e']);\n\n" -"$reversed = $collection->reverse();\n\n" -"$reversed->all();\n\n" -"/*\n" -" [\n" -" 4 => 'e',\n" -" 3 => 'd',\n" -" 2 => 'c',\n" -" 1 => 'b',\n" -" 0 => 'a',\n" -" ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 486 (header) +# P +#: ./docs/8.x/collections.md:1914 +#: ./docs/9.x/collections.md:2028 +#: ./docs/10.x/collections.md:2121 +#: ./docs/11.x/collections.md:2205 +#: ./docs/master/collections.md:2121 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1915 +#: ./docs/9.x/collections.md:2029 +#: ./docs/10.x/collections.md:2122 +#: ./docs/11.x/collections.md:2206 +#: ./docs/master/collections.md:2122 msgid "`search()` {.collection-method}" -msgstr "`search()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 487 (paragraph) +# P +#: ./docs/8.x/collections.md:1917 +#: ./docs/9.x/collections.md:2031 +#: ./docs/10.x/collections.md:2124 +#: ./docs/11.x/collections.md:2208 +#: ./docs/master/collections.md:2124 msgid "The `search` method searches the collection for the given value and returns its key if found. If the item is not found, `false` is returned:" -msgstr "`search` 方法在該 Collection 中搜尋給定的值,並在找到後回傳其索引鍵。若找不到該項目,則會回傳 `false`:" +msgstr "" -#: docs/10.x/collections.md:block 488 (code) +# CODE +#: ./docs/8.x/collections.md:1919 +#: ./docs/9.x/collections.md:2033 +#: ./docs/10.x/collections.md:2126 +#: ./docs/11.x/collections.md:2210 +#: ./docs/master/collections.md:2126 msgid "$collection = collect([2, 4, 6, 8]);\n\n" "$collection->search(4);\n\n" -"// 1\n" -msgstr "$collection = collect([2, 4, 6, 8]);\n\n" -"$collection->search(4);\n\n" -"// 1\n" +"// 1" +msgstr "" -#: docs/10.x/collections.md:block 489 (paragraph) +# P +#: ./docs/8.x/collections.md:1925 +#: ./docs/9.x/collections.md:2039 +#: ./docs/10.x/collections.md:2132 +#: ./docs/11.x/collections.md:2216 +#: ./docs/master/collections.md:2132 msgid "The search is done using a \"loose\" comparison, meaning a string with an integer value will be considered equal to an integer of the same value. To use \"strict\" comparison, pass `true` as the second argument to the method:" -msgstr "這裡的搜尋是使用「鬆散 (Loose)」比對的,這表示,一個整數值與一個有相同值的字串會被視為相等。若要使用「嚴格 (Strict)」比對,可傳入 `true` 作為該方法的第二個引數:" +msgstr "" -#: docs/10.x/collections.md:block 490 (code) +# CODE +#: ./docs/8.x/collections.md:1927 +#: ./docs/9.x/collections.md:2041 +#: ./docs/10.x/collections.md:2134 +#: ./docs/master/collections.md:2134 msgid "collect([2, 4, 6, 8])->search('4', $strict = true);\n\n" -"// false\n" -msgstr "collect([2, 4, 6, 8])->search('4', $strict = true);\n\n" -"// false\n" +"// false" +msgstr "" -#: docs/10.x/collections.md:block 491 (paragraph) +# P +#: ./docs/8.x/collections.md:1931 +#: ./docs/9.x/collections.md:2045 +#: ./docs/10.x/collections.md:2138 +#: ./docs/11.x/collections.md:282 +#: ./docs/11.x/collections.md:2222 +#: ./docs/master/collections.md:2138 msgid "Alternatively, you may provide your own closure to search for the first item that passes a given truth test:" -msgstr "或者,也可以提供你自己的閉包來搜尋符合給定布林測試的第一個項目:" +msgstr "" -#: docs/10.x/collections.md:block 492 (code) -msgid "collect([2, 4, 6, 8])->search(function (int $item, int $key) {\n" -" return $item > 5;\n" -"});\n\n" -"// 2\n" -msgstr "collect([2, 4, 6, 8])->search(function (int $item, int $key) {\n" +# CODE +#: ./docs/8.x/collections.md:1933 +#: ./docs/9.x/collections.md:2047 +msgid "collect([2, 4, 6, 8])->search(function ($item, $key) {\n" " return $item > 5;\n" "});\n\n" -"// 2\n" +"// 2" +msgstr "" -#: docs/10.x/collections.md:block 494 (header) +# P +#: ./docs/8.x/collections.md:1939 +#: ./docs/9.x/collections.md:2053 +#: ./docs/10.x/collections.md:2167 +#: ./docs/11.x/collections.md:2251 +#: ./docs/master/collections.md:2167 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1940 +#: ./docs/9.x/collections.md:2054 +#: ./docs/10.x/collections.md:2168 +#: ./docs/11.x/collections.md:2252 +#: ./docs/master/collections.md:2168 msgid "`shift()` {.collection-method}" -msgstr "`shift()` {.collection-method}" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:1941 +msgid "[$creditsRemaining, $batch] = Image::where('status', 'unprocessed')\n" +" ->get()\n" +" ->reduceSpread(function ($creditsRemaining, $batch, $image) {\n" +" if ($creditsRemaining >= $image->creditsRequired()) {\n" +" $batch->push($image);\n\n" +" $creditsRemaining -= $image->creditsRequired();\n" +" }\n\n" +" return [$creditsRemaining, $batch];\n" +" }, $creditsAvailable, collect());" +msgstr "" -#: docs/10.x/collections.md:block 495 (paragraph) +# P +#: ./docs/8.x/collections.md:1942 +#: ./docs/9.x/collections.md:2056 +#: ./docs/10.x/collections.md:2170 +#: ./docs/11.x/collections.md:2254 +#: ./docs/master/collections.md:2170 msgid "The `shift` method removes and returns the first item from the collection:" -msgstr "`shift` 方法會從該 Collection 中移除第一個項目並將其回傳:" +msgstr "" -#: docs/10.x/collections.md:block 496 (code) +# CODE +#: ./docs/8.x/collections.md:1944 +#: ./docs/9.x/collections.md:2058 +#: ./docs/10.x/collections.md:2172 +#: ./docs/11.x/collections.md:2256 +#: ./docs/master/collections.md:2172 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" "$collection->shift();\n\n" "// 1\n\n" "$collection->all();\n\n" -"// [2, 3, 4, 5]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->shift();\n\n" -"// 1\n\n" -"$collection->all();\n\n" -"// [2, 3, 4, 5]\n" +"// [2, 3, 4, 5]" +msgstr "" -#: docs/10.x/collections.md:block 497 (paragraph) +# P +#: ./docs/8.x/collections.md:1954 +#: ./docs/9.x/collections.md:2068 +#: ./docs/10.x/collections.md:2182 +#: ./docs/11.x/collections.md:2266 +#: ./docs/master/collections.md:2182 msgid "You may pass an integer to the `shift` method to remove and return multiple items from the beginning of a collection:" -msgstr "可以將整數傳入 `shift` 方法以從 Collection 的開頭移除並回傳多個項目:" +msgstr "" -#: docs/10.x/collections.md:block 498 (code) +# CODE +#: ./docs/8.x/collections.md:1956 +#: ./docs/9.x/collections.md:2070 +#: ./docs/10.x/collections.md:2184 +#: ./docs/11.x/collections.md:2268 +#: ./docs/master/collections.md:2184 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" "$collection->shift(3);\n\n" "// collect([1, 2, 3])\n\n" "$collection->all();\n\n" -"// [4, 5]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->shift(3);\n\n" -"// collect([1, 2, 3])\n\n" -"$collection->all();\n\n" -"// [4, 5]\n" +"// [4, 5]" +msgstr "" -#: docs/10.x/collections.md:block 500 (header) +# P +#: ./docs/8.x/collections.md:1966 +#: ./docs/9.x/collections.md:2080 +#: ./docs/10.x/collections.md:2194 +#: ./docs/11.x/collections.md:2278 +#: ./docs/master/collections.md:2194 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1967 +#: ./docs/9.x/collections.md:2081 +#: ./docs/10.x/collections.md:2195 +#: ./docs/11.x/collections.md:2279 +#: ./docs/master/collections.md:2195 msgid "`shuffle()` {.collection-method}" -msgstr "`shuffle()` {.collection-method}" - -#: docs/10.x/collections.md:block 501 (paragraph) -msgid "The `shuffle` method randomly shuffles the items in the collection:" -msgstr "`shuffle` 方法會隨機排序該 Collection 內的項目:" +msgstr "" -#: docs/10.x/collections.md:block 502 (code) +# CODE +#: ./docs/10.x/collections.md:1969 +#: ./docs/11.x/collections.md:2053 +#: ./docs/master/collections.md:1969 +msgid "use Illuminate\\Support\\Collection;\n\n" +"$random = $collection->random(fn (Collection $items) => min(10, count($items)));\n\n" +"$random->all();\n\n" +"// [1, 2, 3, 4, 5] - (retrieved randomly)" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1969 +#: ./docs/9.x/collections.md:2083 +#: ./docs/10.x/collections.md:2197 +#: ./docs/11.x/collections.md:2281 +#: ./docs/master/collections.md:2197 +msgid "The `shuffle` method randomly shuffles the items in the collection:" +msgstr "" + +# CODE +#: ./docs/8.x/collections.md:1971 +#: ./docs/9.x/collections.md:2085 +#: ./docs/10.x/collections.md:2199 +#: ./docs/11.x/collections.md:2283 +#: ./docs/master/collections.md:2199 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" "$shuffled = $collection->shuffle();\n\n" "$shuffled->all();\n\n" -"// [3, 2, 5, 1, 4] - (generated randomly)\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$shuffled = $collection->shuffle();\n\n" -"$shuffled->all();\n\n" -"// [3, 2, 5, 1, 4] - (隨機產生)\n" +"// [3, 2, 5, 1, 4] - (generated randomly)" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1979 +#: ./docs/9.x/collections.md:2175 +#: ./docs/10.x/collections.md:2289 +#: ./docs/11.x/collections.md:2373 +#: ./docs/master/collections.md:2289 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:1980 +#: ./docs/9.x/collections.md:2176 +#: ./docs/10.x/collections.md:2290 +#: ./docs/11.x/collections.md:2374 +#: ./docs/master/collections.md:2290 +msgid "`sliding()` {.collection-method}" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1982 +#: ./docs/9.x/collections.md:2178 +#: ./docs/10.x/collections.md:2292 +#: ./docs/11.x/collections.md:2376 +#: ./docs/master/collections.md:2292 +msgid "The `sliding` method returns a new collection of chunks representing a \"sliding window\" view of the items in the collection:" +msgstr "" + +# CODE +#: ./docs/8.x/collections.md:1984 +#: ./docs/9.x/collections.md:2180 +#: ./docs/10.x/collections.md:2294 +#: ./docs/11.x/collections.md:2378 +#: ./docs/master/collections.md:2294 +msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" +"$chunks = $collection->sliding(2);\n\n" +"$chunks->toArray();\n\n" +"// [[1, 2], [2, 3], [3, 4], [4, 5]]" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1992 +#: ./docs/9.x/collections.md:2188 +#: ./docs/10.x/collections.md:2302 +#: ./docs/11.x/collections.md:2386 +#: ./docs/master/collections.md:2302 +msgid "This is especially useful in conjunction with the [`eachSpread`](#method-eachspread) method:" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:1993 +#: ./docs/11.x/collections.md:2077 +#: ./docs/master/collections.md:1993 +msgid "$collection = collect([1, 2, 3]);\n\n" +"$total = $collection->reduce(function (?int $carry, int $item) {\n" +" return $carry + $item;\n" +"});\n\n" +"// 6" +msgstr "" + +# CODE +#: ./docs/8.x/collections.md:1994 +#: ./docs/9.x/collections.md:2190 +msgid "$transactions->sliding(2)->eachSpread(function ($previous, $current) {\n" +" $current->total = $previous->total + $current->amount;\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/collections.md:1998 +#: ./docs/9.x/collections.md:2194 +#: ./docs/10.x/collections.md:2308 +#: ./docs/11.x/collections.md:2392 +#: ./docs/master/collections.md:2308 +msgid "You may optionally pass a second \"step\" value, which determines the distance between the first item of every chunk:" +msgstr "" + +# CODE +#: ./docs/8.x/collections.md:2000 +#: ./docs/9.x/collections.md:2196 +#: ./docs/10.x/collections.md:2310 +#: ./docs/11.x/collections.md:2394 +#: ./docs/master/collections.md:2310 +msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" +"$chunks = $collection->sliding(3, step: 2);\n\n" +"$chunks->toArray();\n\n" +"// [[1, 2, 3], [3, 4, 5]]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2003 +#: ./docs/11.x/collections.md:2087 +#: ./docs/master/collections.md:2003 +msgid "$collection->reduce(function (int $carry, int $item) {\n" +" return $carry + $item;\n" +"}, 4);\n\n" +"// 10" +msgstr "" -#: docs/10.x/collections.md:block 504 (header) +# P +#: ./docs/8.x/collections.md:2008 +#: ./docs/9.x/collections.md:2093 +#: ./docs/10.x/collections.md:2207 +#: ./docs/11.x/collections.md:2291 +#: ./docs/master/collections.md:2207 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2009 +#: ./docs/9.x/collections.md:2094 +#: ./docs/10.x/collections.md:2208 +#: ./docs/11.x/collections.md:2292 +#: ./docs/master/collections.md:2208 msgid "`skip()` {.collection-method}" -msgstr "`skip()` {.collection-method}" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2011 +#: ./docs/11.x/collections.md:2095 +#: ./docs/master/collections.md:2011 +msgid "$collection = collect([\n" +" 'usd' => 1400,\n" +" 'gbp' => 1200,\n" +" 'eur' => 1000,\n" +"]);\n\n" +"$ratio = [\n" +" 'usd' => 1,\n" +" 'gbp' => 1.37,\n" +" 'eur' => 1.22,\n" +"];\n\n" +"$collection->reduce(function (int $carry, int $value, int $key) use ($ratio) {\n" +" return $carry + ($value * $ratio[$key]);\n" +"});\n\n" +"// 4264" +msgstr "" -#: docs/10.x/collections.md:block 505 (paragraph) +# P +#: ./docs/8.x/collections.md:2011 +#: ./docs/9.x/collections.md:2096 +#: ./docs/10.x/collections.md:2210 +#: ./docs/11.x/collections.md:2294 +#: ./docs/master/collections.md:2210 msgid "The `skip` method returns a new collection, with the given number of elements removed from the beginning of the collection:" -msgstr "`skip` 方法會從該 Collection 的開頭移除給定數量的元素,作為一個新的陣列回傳:" +msgstr "" -#: docs/10.x/collections.md:block 506 (code) +# CODE +#: ./docs/8.x/collections.md:2013 +#: ./docs/9.x/collections.md:2098 +#: ./docs/10.x/collections.md:2212 +#: ./docs/11.x/collections.md:2296 +#: ./docs/master/collections.md:2212 msgid "$collection = collect([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\n\n" "$collection = $collection->skip(4);\n\n" "$collection->all();\n\n" -"// [5, 6, 7, 8, 9, 10]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\n\n" -"$collection = $collection->skip(4);\n\n" -"$collection->all();\n\n" -"// [5, 6, 7, 8, 9, 10]\n" +"// [5, 6, 7, 8, 9, 10]" +msgstr "" -#: docs/10.x/collections.md:block 508 (header) +# P +#: ./docs/8.x/collections.md:2021 +#: ./docs/9.x/collections.md:2106 +#: ./docs/10.x/collections.md:2220 +#: ./docs/11.x/collections.md:2304 +#: ./docs/master/collections.md:2220 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2022 +#: ./docs/9.x/collections.md:2107 +#: ./docs/10.x/collections.md:2221 +#: ./docs/11.x/collections.md:2305 +#: ./docs/master/collections.md:2221 msgid "`skipUntil()` {.collection-method}" -msgstr "`skipUntil()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 509 (paragraph) +# P +#: ./docs/8.x/collections.md:2024 +#: ./docs/9.x/collections.md:2109 +#: ./docs/10.x/collections.md:2223 +#: ./docs/11.x/collections.md:2307 +#: ./docs/master/collections.md:2223 msgid "The `skipUntil` method skips over items from the collection until the given callback returns `true` and then returns the remaining items in the collection as a new collection instance:" -msgstr "`skipUtil` 方法會一直跳過,直到給定的回呼回傳 `true`。接著,會回傳該 Collection 中剩下的項目作為一個新的 Collection 實體:" +msgstr "" -#: docs/10.x/collections.md:block 510 (code) +# CODE +#: ./docs/8.x/collections.md:2026 +#: ./docs/9.x/collections.md:2111 msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->skipUntil(function (int $item) {\n" -" return $item >= 3;\n" -"});\n\n" -"$subset->all();\n\n" -"// [3, 4]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->skipUntil(function (int $item) {\n" +"$subset = $collection->skipUntil(function ($item) {\n" " return $item >= 3;\n" "});\n\n" "$subset->all();\n\n" -"// [3, 4]\n" +"// [3, 4]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2034 +#: ./docs/11.x/collections.md:2118 +#: ./docs/master/collections.md:2034 +msgid "[$creditsRemaining, $batch] = Image::where('status', 'unprocessed')\n" +" ->get()\n" +" ->reduceSpread(function (int $creditsRemaining, Collection $batch, Image $image) {\n" +" if ($creditsRemaining >= $image->creditsRequired()) {\n" +" $batch->push($image);\n\n" +" $creditsRemaining -= $image->creditsRequired();\n" +" }\n\n" +" return [$creditsRemaining, $batch];\n" +" }, $creditsAvailable, collect());" +msgstr "" -#: docs/10.x/collections.md:block 511 (paragraph) +# P +#: ./docs/8.x/collections.md:2036 +#: ./docs/9.x/collections.md:2121 +#: ./docs/10.x/collections.md:2235 +#: ./docs/11.x/collections.md:2319 +#: ./docs/master/collections.md:2235 msgid "You may also pass a simple value to the `skipUntil` method to skip all items until the given value is found:" -msgstr "也可以傳入一個簡單的值給 `skipUntil` 方法,來跳過直到找到指定項目之前的所有項目:" +msgstr "" -#: docs/10.x/collections.md:block 512 (code) +# CODE +#: ./docs/8.x/collections.md:2038 +#: ./docs/9.x/collections.md:2123 +#: ./docs/10.x/collections.md:2237 +#: ./docs/11.x/collections.md:2321 +#: ./docs/master/collections.md:2237 msgid "$collection = collect([1, 2, 3, 4]);\n\n" "$subset = $collection->skipUntil(3);\n\n" "$subset->all();\n\n" -"// [3, 4]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->skipUntil(3);\n\n" -"$subset->all();\n\n" -"// [3, 4]\n" +"// [3, 4]" +msgstr "" -#: docs/10.x/collections.md:block 513 (quote) -msgid "**Warning** If the given value is not found or the callback never returns `true`, the `skipUntil` method will return an empty collection." -msgstr "**Warning** 若找不到給定的值,或是回呼從未回傳 `true`,則 `skipUntil` 方法會回傳一個空 Collection。" +# P +#: ./docs/8.x/collections.md:2046 +#: ./docs/9.x/collections.md:2132 +#: ./docs/10.x/collections.md:2246 +#: ./docs/11.x/collections.md:2330 +#: ./docs/master/collections.md:2246 +msgid "If the given value is not found or the callback never returns `true`, the `skipUntil` method will return an empty collection." +msgstr "" -#: docs/10.x/collections.md:block 515 (header) +# P +#: ./docs/8.x/collections.md:2048 +#: ./docs/9.x/collections.md:2134 +#: ./docs/10.x/collections.md:2248 +#: ./docs/11.x/collections.md:2332 +#: ./docs/master/collections.md:2248 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2049 +#: ./docs/9.x/collections.md:2135 +#: ./docs/10.x/collections.md:2249 +#: ./docs/11.x/collections.md:2333 +#: ./docs/master/collections.md:2249 msgid "`skipWhile()` {.collection-method}" -msgstr "`skipWhile()` {.collection-method}" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2051 +#: ./docs/11.x/collections.md:2135 +#: ./docs/master/collections.md:2051 +msgid "$collection = collect([1, 2, 3, 4]);\n\n" +"$filtered = $collection->reject(function (int $value, int $key) {\n" +" return $value > 2;\n" +"});\n\n" +"$filtered->all();\n\n" +"// [1, 2]" +msgstr "" -#: docs/10.x/collections.md:block 516 (paragraph) +# P +#: ./docs/8.x/collections.md:2051 +#: ./docs/9.x/collections.md:2137 +#: ./docs/10.x/collections.md:2251 +#: ./docs/11.x/collections.md:2335 +#: ./docs/master/collections.md:2251 msgid "The `skipWhile` method skips over items from the collection while the given callback returns `true` and then returns the remaining items in the collection as a new collection:" -msgstr "`skipWhile` 方法會在給定的回呼回傳 `true` 的時候從該 Collection 中跳過項目,並回傳該 Collection 中剩餘的項目作為一個新的 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 517 (code) +# CODE +#: ./docs/8.x/collections.md:2053 +#: ./docs/9.x/collections.md:2139 msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->skipWhile(function (int $item) {\n" -" return $item <= 3;\n" -"});\n\n" -"$subset->all();\n\n" -"// [4]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->skipWhile(function (int $item) {\n" +"$subset = $collection->skipWhile(function ($item) {\n" " return $item <= 3;\n" "});\n\n" "$subset->all();\n\n" -"// [4]\n" +"// [4]" +msgstr "" -#: docs/10.x/collections.md:block 518 (quote) -msgid "**Warning** If the callback never returns `false`, the `skipWhile` method will return an empty collection." -msgstr "**Warning** 若該回呼從未回傳 `true`,則 `skipWhile` 方法會回傳一個空 Collection。" +# P +#: ./docs/8.x/collections.md:2063 +#: ./docs/9.x/collections.md:2150 +#: ./docs/10.x/collections.md:2264 +#: ./docs/11.x/collections.md:2348 +#: ./docs/master/collections.md:2264 +msgid "If the callback never returns `false`, the `skipWhile` method will return an empty collection." +msgstr "" -#: docs/10.x/collections.md:block 520 (header) +# P +#: ./docs/8.x/collections.md:2065 +#: ./docs/9.x/collections.md:2152 +#: ./docs/10.x/collections.md:2266 +#: ./docs/11.x/collections.md:2350 +#: ./docs/master/collections.md:2266 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2066 +#: ./docs/9.x/collections.md:2153 +#: ./docs/10.x/collections.md:2267 +#: ./docs/11.x/collections.md:2351 +#: ./docs/master/collections.md:2267 msgid "`slice()` {.collection-method}" -msgstr "`slice()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 521 (paragraph) +# P +#: ./docs/8.x/collections.md:2068 +#: ./docs/9.x/collections.md:2155 +#: ./docs/10.x/collections.md:2269 +#: ./docs/11.x/collections.md:2353 +#: ./docs/master/collections.md:2269 msgid "The `slice` method returns a slice of the collection starting at the given index:" -msgstr "`slice` 方法會回傳該 Collection 從給定索引開始的部分:" +msgstr "" -#: docs/10.x/collections.md:block 522 (code) +# CODE +#: ./docs/8.x/collections.md:2070 +#: ./docs/9.x/collections.md:2157 +#: ./docs/10.x/collections.md:2271 +#: ./docs/11.x/collections.md:2355 +#: ./docs/master/collections.md:2271 msgid "$collection = collect([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\n\n" "$slice = $collection->slice(4);\n\n" "$slice->all();\n\n" -"// [5, 6, 7, 8, 9, 10]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\n\n" -"$slice = $collection->slice(4);\n\n" -"$slice->all();\n\n" -"// [5, 6, 7, 8, 9, 10]\n" +"// [5, 6, 7, 8, 9, 10]" +msgstr "" -#: docs/10.x/collections.md:block 523 (paragraph) +# P +#: ./docs/8.x/collections.md:2078 +#: ./docs/9.x/collections.md:2165 +#: ./docs/10.x/collections.md:2279 +#: ./docs/11.x/collections.md:2363 +#: ./docs/master/collections.md:2279 msgid "If you would like to limit the size of the returned slice, pass the desired size as the second argument to the method:" -msgstr "若想限制回傳部分的大小,可傳入需要的大小作為該方法的第二個引數:" +msgstr "" -#: docs/10.x/collections.md:block 524 (code) +# CODE +#: ./docs/8.x/collections.md:2080 +#: ./docs/9.x/collections.md:2167 +#: ./docs/10.x/collections.md:2281 +#: ./docs/11.x/collections.md:2365 +#: ./docs/master/collections.md:2281 msgid "$slice = $collection->slice(4, 2);\n\n" "$slice->all();\n\n" -"// [5, 6]\n" -msgstr "$slice = $collection->slice(4, 2);\n\n" -"$slice->all();\n\n" -"// [5, 6]\n" +"// [5, 6]" +msgstr "" -#: docs/10.x/collections.md:block 525 (paragraph) +# P +#: ./docs/8.x/collections.md:2086 +#: ./docs/9.x/collections.md:2173 +#: ./docs/10.x/collections.md:2287 +#: ./docs/11.x/collections.md:2371 +#: ./docs/master/collections.md:2287 msgid "The returned slice will preserve keys by default. If you do not wish to preserve the original keys, you can use the [`values`](#method-values) method to reindex them." -msgstr "回傳的部分預設會保留索引鍵。若不想保留原始的索引鍵,可以使用 [`values`](#method-values) 方法來重新索引這些項目。" - -#: docs/10.x/collections.md:block 527 (header) -msgid "`sliding()` {.collection-method}" -msgstr "`sliding()` {.collection-method}" - -#: docs/10.x/collections.md:block 528 (paragraph) -msgid "The `sliding` method returns a new collection of chunks representing a \"sliding window\" view of the items in the collection:" -msgstr "`sliding` 方法會以代表「Sliding Window」的方式將該 Collection 中的項目拆分為數個片段並回傳一個新的 Collection:" - -#: docs/10.x/collections.md:block 529 (code) -msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$chunks = $collection->sliding(2);\n\n" -"$chunks->toArray();\n\n" -"// [[1, 2], [2, 3], [3, 4], [4, 5]]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$chunks = $collection->sliding(2);\n\n" -"$chunks->toArray();\n\n" -"// [[1, 2], [2, 3], [3, 4], [4, 5]]\n" - -#: docs/10.x/collections.md:block 530 (paragraph) -msgid "This is especially useful in conjunction with the [`eachSpread`](#method-eachspread) method:" -msgstr "這個方法特別適合與 [`eachSpread`](#method-eachspread) 方法一起使用:" - -#: docs/10.x/collections.md:block 531 (code) -msgid "$transactions->sliding(2)->eachSpread(function (Collection $previous, Collection $current) {\n" -" $current->total = $previous->total + $current->amount;\n" -"});\n" -msgstr "$transactions->sliding(2)->eachSpread(function (Collection $previous, Collection $current) {\n" -" $current->total = $previous->total + $current->amount;\n" -"});\n" - -#: docs/10.x/collections.md:block 532 (paragraph) -msgid "You may optionally pass a second \"step\" value, which determines the distance between the first item of every chunk:" -msgstr "也可以傳入第二個可選的「區間 (step)」值,用來判斷每個片段中第一個項目的距離:" - -#: docs/10.x/collections.md:block 533 (code) -msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$chunks = $collection->sliding(3, step: 2);\n\n" -"$chunks->toArray();\n\n" -"// [[1, 2, 3], [3, 4, 5]]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$chunks = $collection->sliding(3, step: 2);\n\n" -"$chunks->toArray();\n\n" -"// [[1, 2, 3], [3, 4, 5]]\n" +msgstr "" -#: docs/10.x/collections.md:block 535 (header) +# P +#: ./docs/8.x/collections.md:2088 +#: ./docs/9.x/collections.md:2204 +#: ./docs/10.x/collections.md:2318 +#: ./docs/11.x/collections.md:2402 +#: ./docs/master/collections.md:2318 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2089 +#: ./docs/9.x/collections.md:2205 +#: ./docs/10.x/collections.md:2319 +#: ./docs/11.x/collections.md:2403 +#: ./docs/master/collections.md:2319 msgid "`sole()` {.collection-method}" -msgstr "`sole()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 536 (paragraph) +# P +#: ./docs/8.x/collections.md:2091 +#: ./docs/9.x/collections.md:2207 +#: ./docs/10.x/collections.md:2321 +#: ./docs/11.x/collections.md:2405 +#: ./docs/master/collections.md:2321 msgid "The `sole` method returns the first element in the collection that passes a given truth test, but only if the truth test matches exactly one element:" -msgstr "`sole` 方法會回傳該 Collection 中第一個且唯一一個通過給定真值條件測試的元素:" +msgstr "" -#: docs/10.x/collections.md:block 537 (code) -msgid "collect([1, 2, 3, 4])->sole(function (int $value, int $key) {\n" -" return $value === 2;\n" -"});\n\n" -"// 2\n" -msgstr "collect([1, 2, 3, 4])->sole(function (int $value, int $key) {\n" +# CODE +#: ./docs/8.x/collections.md:2093 +#: ./docs/9.x/collections.md:2209 +msgid "collect([1, 2, 3, 4])->sole(function ($value, $key) {\n" " return $value === 2;\n" "});\n\n" -"// 2\n" +"// 2" +msgstr "" -#: docs/10.x/collections.md:block 538 (paragraph) +# P +#: ./docs/8.x/collections.md:2099 +#: ./docs/9.x/collections.md:2215 +#: ./docs/10.x/collections.md:2329 +#: ./docs/11.x/collections.md:2413 +#: ./docs/master/collections.md:2329 msgid "You may also pass a key / value pair to the `sole` method, which will return the first element in the collection that matches the given pair, but only if it exactly one element matches:" -msgstr "也可以傳入一組索引鍵/值配對給 `sole` 方法,`sole` 方法會回傳該 Collection 中符合給定索引鍵/值配對的第一個且唯一一個項目:" +msgstr "" -#: docs/10.x/collections.md:block 539 (code) +# CODE +#: ./docs/8.x/collections.md:2101 +#: ./docs/9.x/collections.md:2217 +#: ./docs/10.x/collections.md:2331 +#: ./docs/11.x/collections.md:2415 +#: ./docs/master/collections.md:2331 msgid "$collection = collect([\n" " ['product' => 'Desk', 'price' => 200],\n" " ['product' => 'Chair', 'price' => 100],\n" "]);\n\n" "$collection->sole('product', 'Chair');\n\n" -"// ['product' => 'Chair', 'price' => 100]\n" -msgstr "$collection = collect([\n" -" ['product' => 'Desk', 'price' => 200],\n" -" ['product' => 'Chair', 'price' => 100],\n" -"]);\n\n" -"$collection->sole('product', 'Chair');\n\n" -"// ['product' => 'Chair', 'price' => 100]\n" +"// ['product' => 'Chair', 'price' => 100]" +msgstr "" -#: docs/10.x/collections.md:block 540 (paragraph) +# P +#: ./docs/8.x/collections.md:2110 +#: ./docs/9.x/collections.md:2226 +#: ./docs/10.x/collections.md:2340 +#: ./docs/11.x/collections.md:2424 +#: ./docs/master/collections.md:2340 msgid "Alternatively, you may also call the `sole` method with no argument to get the first element in the collection if there is only one element:" -msgstr "或者,也可以在不給定引數的情況下呼叫 `sole`,以在該 Collection 中只有一個元素時取得其第一個元素:" +msgstr "" -#: docs/10.x/collections.md:block 541 (code) +# CODE +#: ./docs/8.x/collections.md:2112 +#: ./docs/9.x/collections.md:2228 +#: ./docs/10.x/collections.md:2342 +#: ./docs/11.x/collections.md:2426 +#: ./docs/master/collections.md:2342 msgid "$collection = collect([\n" " ['product' => 'Desk', 'price' => 200],\n" "]);\n\n" "$collection->sole();\n\n" -"// ['product' => 'Desk', 'price' => 200]\n" -msgstr "$collection = collect([\n" -" ['product' => 'Desk', 'price' => 200],\n" -"]);\n\n" -"$collection->sole();\n\n" -"// ['product' => 'Desk', 'price' => 200]\n" +"// ['product' => 'Desk', 'price' => 200]" +msgstr "" -#: docs/10.x/collections.md:block 542 (paragraph) +# P +#: ./docs/8.x/collections.md:2120 +#: ./docs/9.x/collections.md:2236 +#: ./docs/10.x/collections.md:2350 +#: ./docs/11.x/collections.md:2434 +#: ./docs/master/collections.md:2350 msgid "If there are no elements in the collection that should be returned by the `sole` method, an `\\Illuminate\\Collections\\ItemNotFoundException` exception will be thrown. If there is more than one element that should be returned, an `\\Illuminate\\Collections\\MultipleItemsFoundException` will be thrown." -msgstr "若該 Collection 中沒有能被 `sole` 方法回傳的元素,則會擲回一個 `\\Illuminate\\Collections\\ItemNotFoundException` 例外。若有多於一個能被回傳的元素,則會擲回 `\\Illuminate\\Collections\\MultipleItemsFoundException` 例外。" +msgstr "" -#: docs/10.x/collections.md:block 544 (header) +# P +#: ./docs/8.x/collections.md:2122 +#: ./docs/9.x/collections.md:2238 +#: ./docs/10.x/collections.md:2352 +#: ./docs/11.x/collections.md:2436 +#: ./docs/master/collections.md:2352 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2123 +#: ./docs/9.x/collections.md:2239 +#: ./docs/10.x/collections.md:2353 +#: ./docs/11.x/collections.md:2437 +#: ./docs/master/collections.md:2353 msgid "`some()` {.collection-method}" -msgstr "`some()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 545 (paragraph) +# P +#: ./docs/8.x/collections.md:2125 +#: ./docs/9.x/collections.md:2241 +#: ./docs/10.x/collections.md:2355 +#: ./docs/11.x/collections.md:2439 +#: ./docs/master/collections.md:2355 msgid "Alias for the [`contains`](#method-contains) method." -msgstr "[`contains`](#method-contains) 方法的別名。" +msgstr "" -#: docs/10.x/collections.md:block 547 (header) +# P +#: ./docs/8.x/collections.md:2127 +#: ./docs/9.x/collections.md:2243 +#: ./docs/10.x/collections.md:2357 +#: ./docs/11.x/collections.md:2441 +#: ./docs/master/collections.md:2357 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2128 +#: ./docs/9.x/collections.md:2244 +#: ./docs/10.x/collections.md:2358 +#: ./docs/11.x/collections.md:2442 +#: ./docs/master/collections.md:2358 msgid "`sort()` {.collection-method}" -msgstr "`sort()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 548 (paragraph) +# P +#: ./docs/8.x/collections.md:2130 +#: ./docs/9.x/collections.md:2246 +#: ./docs/10.x/collections.md:2360 +#: ./docs/11.x/collections.md:2444 +#: ./docs/master/collections.md:2360 msgid "The `sort` method sorts the collection. The sorted collection keeps the original array keys, so in the following example we will use the [`values`](#method-values) method to reset the keys to consecutively numbered indexes:" -msgstr "`sort` 方法可排列該 Collection。經過排列的 Collection 會保留原始的陣列索引鍵,因此,在下列範例中我們使用了 [`values`](#method-values) 方法來將索引鍵重設成連續的數字索引:" +msgstr "" -#: docs/10.x/collections.md:block 549 (code) +# CODE +#: ./docs/8.x/collections.md:2132 +#: ./docs/9.x/collections.md:2248 +#: ./docs/10.x/collections.md:2362 +#: ./docs/11.x/collections.md:2446 +#: ./docs/master/collections.md:2362 msgid "$collection = collect([5, 3, 1, 2, 4]);\n\n" "$sorted = $collection->sort();\n\n" "$sorted->values()->all();\n\n" -"// [1, 2, 3, 4, 5]\n" -msgstr "$collection = collect([5, 3, 1, 2, 4]);\n\n" -"$sorted = $collection->sort();\n\n" -"$sorted->values()->all();\n\n" -"// [1, 2, 3, 4, 5]\n" +"// [1, 2, 3, 4, 5]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2140 +#: ./docs/11.x/collections.md:2224 +#: ./docs/master/collections.md:2140 +msgid "collect([2, 4, 6, 8])->search(function (int $item, int $key) {\n" +" return $item > 5;\n" +"});\n\n" +"// 2" +msgstr "" -#: docs/10.x/collections.md:block 550 (paragraph) +# P +#: ./docs/8.x/collections.md:2140 +#: ./docs/9.x/collections.md:2256 +#: ./docs/10.x/collections.md:2370 +#: ./docs/11.x/collections.md:2454 +#: ./docs/master/collections.md:2370 msgid "If your sorting needs are more advanced, you may pass a callback to `sort` with your own algorithm. Refer to the PHP documentation on [`uasort`](https://secure.php.net/manual/en/function.uasort.php#refsect1-function.uasort-parameters), which is what the collection's `sort` method calls utilizes internally." -msgstr "若有進階的排序需求,可以傳入包含自訂演算法的回呼給 `sort`。請參考 PHP 說明文件中的 [`uasort`](https://secure.php.net/manual/en/function.uasort.php#refsect1-function.uasort-parameters),該函式為 Collection 的 `sort` 方法內部所使用。" +msgstr "" -#: docs/10.x/collections.md:block 551 (quote) -msgid "**Note** If you need to sort a collection of nested arrays or objects, see the [`sortBy`](#method-sortby) and [`sortByDesc`](#method-sortbydesc) methods." -msgstr "**Note** 若有需要排序包含巢狀陣列或物件的 Collection,請參考 [`sortBy`](#method-sortby) 與 [`sortByDesc`](#method-sortbydesc) 方法。" +# P +#: ./docs/8.x/collections.md:2142 +#: ./docs/9.x/collections.md:2259 +#: ./docs/10.x/collections.md:2373 +#: ./docs/11.x/collections.md:2457 +#: ./docs/master/collections.md:2373 +msgid "If you need to sort a collection of nested arrays or objects, see the [`sortBy`](#method-sortby) and [`sortByDesc`](#method-sortbydesc) methods." +msgstr "" -#: docs/10.x/collections.md:block 553 (header) +# P +#: ./docs/8.x/collections.md:2144 +#: ./docs/9.x/collections.md:2261 +#: ./docs/10.x/collections.md:2375 +#: ./docs/11.x/collections.md:2459 +#: ./docs/master/collections.md:2375 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2145 +#: ./docs/9.x/collections.md:2262 +#: ./docs/10.x/collections.md:2376 +#: ./docs/11.x/collections.md:2460 +#: ./docs/master/collections.md:2376 msgid "`sortBy()` {.collection-method}" -msgstr "`sortBy()` {.collection-method}" +msgstr "" + +# P +#: ./docs/10.x/collections.md:2146 +#: ./docs/11.x/collections.md:2230 +#: ./docs/master/collections.md:2146 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/collections.md:2147 +#: ./docs/11.x/collections.md:2231 +#: ./docs/master/collections.md:2147 +msgid "`select()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 554 (paragraph) +# P +#: ./docs/8.x/collections.md:2147 +#: ./docs/9.x/collections.md:2264 +#: ./docs/10.x/collections.md:2378 +#: ./docs/11.x/collections.md:2462 +#: ./docs/master/collections.md:2378 msgid "The `sortBy` method sorts the collection by the given key. The sorted collection keeps the original array keys, so in the following example we will use the [`values`](#method-values) method to reset the keys to consecutively numbered indexes:" -msgstr "`sortBy` 方法可依照給定的索引鍵來排列該 Collection。經過排列的 Collection 會保留原始的陣列索引鍵,因此,在下列範例中我們使用了 [`values`](#method-values) 方法來將索引鍵重設成連續的數字索引:" +msgstr "" + +# P +#: ./docs/10.x/collections.md:2149 +#: ./docs/11.x/collections.md:2233 +#: ./docs/master/collections.md:2149 +msgid "The `select` method selects the given keys from the collection, similar to an SQL `SELECT` statement:" +msgstr "" -#: docs/10.x/collections.md:block 555 (code) +# CODE +#: ./docs/8.x/collections.md:2149 +#: ./docs/9.x/collections.md:2266 +#: ./docs/10.x/collections.md:2380 +#: ./docs/11.x/collections.md:2464 +#: ./docs/master/collections.md:2380 msgid "$collection = collect([\n" " ['name' => 'Desk', 'price' => 200],\n" " ['name' => 'Chair', 'price' => 100],\n" @@ -3434,27 +7080,41 @@ msgid "$collection = collect([\n" " ['name' => 'Bookcase', 'price' => 150],\n" " ['name' => 'Desk', 'price' => 200],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['name' => 'Desk', 'price' => 200],\n" -" ['name' => 'Chair', 'price' => 100],\n" -" ['name' => 'Bookcase', 'price' => 150],\n" +"*/" +msgstr "" + +# CODE: php +#: ./docs/10.x/collections.md:2151 +#: ./docs/11.x/collections.md:2235 +#: ./docs/master/collections.md:2151 +msgid "$users = collect([\n" +" ['name' => 'Taylor Otwell', 'role' => 'Developer', 'status' => 'active'],\n" +" ['name' => 'Victoria Faith', 'role' => 'Researcher', 'status' => 'active'],\n" "]);\n\n" -"$sorted = $collection->sortBy('price');\n\n" -"$sorted->values()->all();\n\n" +"$users->select(['name', 'role']);\n\n" "/*\n" " [\n" -" ['name' => 'Chair', 'price' => 100],\n" -" ['name' => 'Bookcase', 'price' => 150],\n" -" ['name' => 'Desk', 'price' => 200],\n" -" ]\n" -"*/\n" +" ['name' => 'Taylor Otwell', 'role' => 'Developer'],\n" +" ['name' => 'Victoria Faith', 'role' => 'Researcher'],\n" +" ],\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 556 (paragraph) +# P +#: ./docs/8.x/collections.md:2167 +#: ./docs/9.x/collections.md:2284 +#: ./docs/10.x/collections.md:2398 +#: ./docs/11.x/collections.md:2482 +#: ./docs/master/collections.md:2398 msgid "The `sortBy` method accepts [sort flags](https://www.php.net/manual/en/function.sort.php) as its second argument:" -msgstr "`sortBy` 方法也接受[排序旗標](https://www.php.net/manual/en/function.sort.php)作為其第二引數:" +msgstr "" -#: docs/10.x/collections.md:block 557 (code) +# CODE +#: ./docs/8.x/collections.md:2169 +#: ./docs/9.x/collections.md:2286 +#: ./docs/10.x/collections.md:2400 +#: ./docs/11.x/collections.md:2484 +#: ./docs/master/collections.md:2400 msgid "$collection = collect([\n" " ['title' => 'Item 1'],\n" " ['title' => 'Item 12'],\n" @@ -3468,49 +7128,27 @@ msgid "$collection = collect([\n" " ['title' => 'Item 3'],\n" " ['title' => 'Item 12'],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['title' => 'Item 1'],\n" -" ['title' => 'Item 12'],\n" -" ['title' => 'Item 3'],\n" -"]);\n\n" -"$sorted = $collection->sortBy('title', SORT_NATURAL);\n\n" -"$sorted->values()->all();\n\n" -"/*\n" -" [\n" -" ['title' => 'Item 1'],\n" -" ['title' => 'Item 3'],\n" -" ['title' => 'Item 12'],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 558 (paragraph) +# P +#: ./docs/8.x/collections.md:2187 +#: ./docs/9.x/collections.md:2304 +#: ./docs/10.x/collections.md:2418 +#: ./docs/11.x/collections.md:2502 +#: ./docs/master/collections.md:2418 msgid "Alternatively, you may pass your own closure to determine how to sort the collection's values:" -msgstr "此外,也可以傳入你自己的閉包來判斷該如何排序該 Collection 的值:" +msgstr "" -#: docs/10.x/collections.md:block 559 (code) +# CODE +#: ./docs/8.x/collections.md:2189 +#: ./docs/9.x/collections.md:2306 msgid "$collection = collect([\n" " ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" " ['name' => 'Chair', 'colors' => ['Black']],\n" " ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" "]);\n\n" -"$sorted = $collection->sortBy(function (array $product, int $key) {\n" -" return count($product['colors']);\n" -"});\n\n" -"$sorted->values()->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'Chair', 'colors' => ['Black']],\n" -" ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" -" ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" -" ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" -" ['name' => 'Chair', 'colors' => ['Black']],\n" -" ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" -"]);\n\n" -"$sorted = $collection->sortBy(function (array $product, int $key) {\n" +"$sorted = $collection->sortBy(function ($product, $key) {\n" " return count($product['colors']);\n" "});\n\n" "$sorted->values()->all();\n\n" @@ -3520,13 +7158,24 @@ msgstr "$collection = collect([\n" " ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" " ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" " ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 560 (paragraph) +# P +#: ./docs/8.x/collections.md:2209 +#: ./docs/9.x/collections.md:2326 +#: ./docs/10.x/collections.md:2440 +#: ./docs/11.x/collections.md:2524 +#: ./docs/master/collections.md:2440 msgid "If you would like to sort your collection by multiple attributes, you may pass an array of sort operations to the `sortBy` method. Each sort operation should be an array consisting of the attribute that you wish to sort by and the direction of the desired sort:" -msgstr "若想以多個屬性來排序 Collection,可以傳入包含排序操作的陣列給 `sortBy` 方法。各個排序操作應為一個陣列,該陣列由欲排序屬性以及排序順序所組成:" +msgstr "" -#: docs/10.x/collections.md:block 561 (code) +# CODE +#: ./docs/8.x/collections.md:2211 +#: ./docs/9.x/collections.md:2328 +#: ./docs/10.x/collections.md:2442 +#: ./docs/11.x/collections.md:2526 +#: ./docs/master/collections.md:2442 msgid "$collection = collect([\n" " ['name' => 'Taylor Otwell', 'age' => 34],\n" " ['name' => 'Abigail Otwell', 'age' => 30],\n" @@ -3545,16 +7194,48 @@ msgid "$collection = collect([\n" " ['name' => 'Taylor Otwell', 'age' => 36],\n" " ['name' => 'Taylor Otwell', 'age' => 34],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" +"*/" +msgstr "" + +# CODE +#: ./docs/11.x/collections.md:2218 +msgid "collect([2, 4, 6, 8])->search('4', strict: true);\n\n" +"// false" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2225 +#: ./docs/11.x/collections.md:2309 +#: ./docs/master/collections.md:2225 +msgid "$collection = collect([1, 2, 3, 4]);\n\n" +"$subset = $collection->skipUntil(function (int $item) {\n" +" return $item >= 3;\n" +"});\n\n" +"$subset->all();\n\n" +"// [3, 4]" +msgstr "" + +# P +#: ./docs/8.x/collections.md:2234 +#: ./docs/9.x/collections.md:2351 +#: ./docs/10.x/collections.md:2465 +#: ./docs/11.x/collections.md:2549 +#: ./docs/master/collections.md:2465 +msgid "When sorting a collection by multiple attributes, you may also provide closures that define each sort operation:" +msgstr "" + +# CODE +#: ./docs/8.x/collections.md:2236 +#: ./docs/9.x/collections.md:2353 +msgid "$collection = collect([\n" " ['name' => 'Taylor Otwell', 'age' => 34],\n" " ['name' => 'Abigail Otwell', 'age' => 30],\n" " ['name' => 'Taylor Otwell', 'age' => 36],\n" " ['name' => 'Abigail Otwell', 'age' => 32],\n" "]);\n\n" "$sorted = $collection->sortBy([\n" -" ['name', 'asc'],\n" -" ['age', 'desc'],\n" +" fn ($a, $b) => $a['name'] <=> $b['name'],\n" +" fn ($a, $b) => $b['age'] <=> $a['age'],\n" "]);\n\n" "$sorted->values()->all();\n\n" "/*\n" @@ -3564,91 +7245,129 @@ msgstr "$collection = collect([\n" " ['name' => 'Taylor Otwell', 'age' => 36],\n" " ['name' => 'Taylor Otwell', 'age' => 34],\n" " ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 562 (paragraph) -msgid "When sorting a collection by multiple attributes, you may also provide closures that define each sort operation:" -msgstr "當以多個屬性排序 Collection 時,也可以提供閉包來定義各個排序操作:" +# CODE +#: ./docs/10.x/collections.md:2253 +#: ./docs/11.x/collections.md:2337 +#: ./docs/master/collections.md:2253 +msgid "$collection = collect([1, 2, 3, 4]);\n\n" +"$subset = $collection->skipWhile(function (int $item) {\n" +" return $item <= 3;\n" +"});\n\n" +"$subset->all();\n\n" +"// [4]" +msgstr "" -#: docs/10.x/collections.md:block 563 (code) -msgid "$collection = collect([\n" -" ['name' => 'Taylor Otwell', 'age' => 34],\n" -" ['name' => 'Abigail Otwell', 'age' => 30],\n" -" ['name' => 'Taylor Otwell', 'age' => 36],\n" -" ['name' => 'Abigail Otwell', 'age' => 32],\n" -"]);\n\n" -"$sorted = $collection->sortBy([\n" -" fn (array $a, array $b) => $a['name'] <=> $b['name'],\n" -" fn (array $a, array $b) => $b['age'] <=> $a['age'],\n" -"]);\n\n" -"$sorted->values()->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'Abigail Otwell', 'age' => 32],\n" -" ['name' => 'Abigail Otwell', 'age' => 30],\n" -" ['name' => 'Taylor Otwell', 'age' => 36],\n" -" ['name' => 'Taylor Otwell', 'age' => 34],\n" -" ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['name' => 'Taylor Otwell', 'age' => 34],\n" -" ['name' => 'Abigail Otwell', 'age' => 30],\n" -" ['name' => 'Taylor Otwell', 'age' => 36],\n" -" ['name' => 'Abigail Otwell', 'age' => 32],\n" -"]);\n\n" -"$sorted = $collection->sortBy([\n" -" fn (array $a, array $b) => $a['name'] <=> $b['name'],\n" -" fn (array $a, array $b) => $b['age'] <=> $a['age'],\n" -"]);\n\n" -"$sorted->values()->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'Abigail Otwell', 'age' => 32],\n" -" ['name' => 'Abigail Otwell', 'age' => 30],\n" -" ['name' => 'Taylor Otwell', 'age' => 36],\n" -" ['name' => 'Taylor Otwell', 'age' => 34],\n" -" ]\n" -"*/\n" - -#: docs/10.x/collections.md:block 565 (header) +# P +#: ./docs/8.x/collections.md:2259 +#: ./docs/9.x/collections.md:2376 +#: ./docs/10.x/collections.md:2490 +#: ./docs/11.x/collections.md:2574 +#: ./docs/master/collections.md:2490 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2260 +#: ./docs/9.x/collections.md:2377 +#: ./docs/10.x/collections.md:2491 +#: ./docs/11.x/collections.md:2575 +#: ./docs/master/collections.md:2491 msgid "`sortByDesc()` {.collection-method}" -msgstr "`sortByDesc()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 566 (paragraph) +# P +#: ./docs/8.x/collections.md:2262 +#: ./docs/9.x/collections.md:2379 +#: ./docs/10.x/collections.md:2493 +#: ./docs/11.x/collections.md:2577 +#: ./docs/master/collections.md:2493 msgid "This method has the same signature as the [`sortBy`](#method-sortby) method, but will sort the collection in the opposite order." -msgstr "該方法的簽章與 [`sortBy`](#method-sortby) 方法相同,但會以相反的順序來排序該 Collection。" +msgstr "" -#: docs/10.x/collections.md:block 568 (header) +# P +#: ./docs/8.x/collections.md:2264 +#: ./docs/9.x/collections.md:2381 +#: ./docs/10.x/collections.md:2495 +#: ./docs/11.x/collections.md:2579 +#: ./docs/master/collections.md:2495 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2265 +#: ./docs/9.x/collections.md:2382 +#: ./docs/10.x/collections.md:2496 +#: ./docs/11.x/collections.md:2580 +#: ./docs/master/collections.md:2496 msgid "`sortDesc()` {.collection-method}" -msgstr "`sortDesc()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 569 (paragraph) +# P +#: ./docs/8.x/collections.md:2267 +#: ./docs/9.x/collections.md:2384 +#: ./docs/10.x/collections.md:2498 +#: ./docs/11.x/collections.md:2582 +#: ./docs/master/collections.md:2498 msgid "This method will sort the collection in the opposite order as the [`sort`](#method-sort) method:" -msgstr "該方法會以與 [`sort`](#method-sort) 方法相反的順序來排序該 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 570 (code) +# CODE +#: ./docs/8.x/collections.md:2269 +#: ./docs/9.x/collections.md:2386 +#: ./docs/10.x/collections.md:2500 +#: ./docs/11.x/collections.md:2584 +#: ./docs/master/collections.md:2500 msgid "$collection = collect([5, 3, 1, 2, 4]);\n\n" "$sorted = $collection->sortDesc();\n\n" "$sorted->values()->all();\n\n" -"// [5, 4, 3, 2, 1]\n" -msgstr "$collection = collect([5, 3, 1, 2, 4]);\n\n" -"$sorted = $collection->sortDesc();\n\n" -"$sorted->values()->all();\n\n" -"// [5, 4, 3, 2, 1]\n" +"// [5, 4, 3, 2, 1]" +msgstr "" -#: docs/10.x/collections.md:block 571 (paragraph) +# P +#: ./docs/8.x/collections.md:2277 +#: ./docs/9.x/collections.md:2394 +#: ./docs/10.x/collections.md:2508 +#: ./docs/11.x/collections.md:2592 +#: ./docs/master/collections.md:2508 msgid "Unlike `sort`, you may not pass a closure to `sortDesc`. Instead, you should use the [`sort`](#method-sort) method and invert your comparison." -msgstr "與 `sort` 不同,`sortDesc` 不接受傳入閉包。可以使用 [`sort`](#method-sort) 方法並使用相反的比較來代替。" +msgstr "" -#: docs/10.x/collections.md:block 573 (header) +# P +#: ./docs/8.x/collections.md:2279 +#: ./docs/9.x/collections.md:2396 +#: ./docs/10.x/collections.md:2510 +#: ./docs/11.x/collections.md:2594 +#: ./docs/master/collections.md:2510 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2280 +#: ./docs/9.x/collections.md:2397 +#: ./docs/10.x/collections.md:2511 +#: ./docs/11.x/collections.md:2595 +#: ./docs/master/collections.md:2511 msgid "`sortKeys()` {.collection-method}" -msgstr "`sortKeys()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 574 (paragraph) +# P +#: ./docs/8.x/collections.md:2282 +#: ./docs/9.x/collections.md:2399 +#: ./docs/10.x/collections.md:2513 +#: ./docs/11.x/collections.md:2597 +#: ./docs/master/collections.md:2513 msgid "The `sortKeys` method sorts the collection by the keys of the underlying associative array:" -msgstr "`sortKeys` 方法以底層關聯式陣列的索引鍵來排序該 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 575 (code) +# CODE +#: ./docs/8.x/collections.md:2284 +#: ./docs/9.x/collections.md:2401 +#: ./docs/10.x/collections.md:2515 +#: ./docs/11.x/collections.md:2599 +#: ./docs/master/collections.md:2515 msgid "$collection = collect([\n" " 'id' => 22345,\n" " 'first' => 'John',\n" @@ -3662,39 +7381,78 @@ msgid "$collection = collect([\n" " 'id' => 22345,\n" " 'last' => 'Doe',\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" 'id' => 22345,\n" -" 'first' => 'John',\n" -" 'last' => 'Doe',\n" -"]);\n\n" -"$sorted = $collection->sortKeys();\n\n" -"$sorted->all();\n\n" -"/*\n" -" [\n" -" 'first' => 'John',\n" -" 'id' => 22345,\n" -" 'last' => 'Doe',\n" -" ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 577 (header) +# P +#: ./docs/8.x/collections.md:2302 +#: ./docs/9.x/collections.md:2419 +#: ./docs/10.x/collections.md:2533 +#: ./docs/11.x/collections.md:2617 +#: ./docs/master/collections.md:2533 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2303 +#: ./docs/9.x/collections.md:2420 +#: ./docs/10.x/collections.md:2534 +#: ./docs/11.x/collections.md:2618 +#: ./docs/master/collections.md:2534 msgid "`sortKeysDesc()` {.collection-method}" -msgstr "`sortKeysDesc()` {.collection-method}" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2304 +#: ./docs/11.x/collections.md:2388 +#: ./docs/master/collections.md:2304 +msgid "$transactions->sliding(2)->eachSpread(function (Collection $previous, Collection $current) {\n" +" $current->total = $previous->total + $current->amount;\n" +"});" +msgstr "" -#: docs/10.x/collections.md:block 578 (paragraph) +# P +#: ./docs/8.x/collections.md:2305 +#: ./docs/9.x/collections.md:2422 +#: ./docs/10.x/collections.md:2536 +#: ./docs/11.x/collections.md:2620 +#: ./docs/master/collections.md:2536 msgid "This method has the same signature as the [`sortKeys`](#method-sortkeys) method, but will sort the collection in the opposite order." -msgstr "該方法的簽章與 [`sortKeys`](#method-sortkeys) 方法相同,但會以相反的順序來排序該 Collection。" +msgstr "" -#: docs/10.x/collections.md:block 580 (header) +# P +#: ./docs/8.x/collections.md:2307 +#: ./docs/9.x/collections.md:2424 +#: ./docs/10.x/collections.md:2538 +#: ./docs/11.x/collections.md:2622 +#: ./docs/master/collections.md:2538 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2308 +#: ./docs/9.x/collections.md:2425 +#: ./docs/10.x/collections.md:2539 +#: ./docs/11.x/collections.md:2623 +#: ./docs/master/collections.md:2539 msgid "`sortKeysUsing()` {.collection-method}" -msgstr "`sortKeysUsing()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 581 (paragraph) +# P +#: ./docs/8.x/collections.md:2310 +#: ./docs/9.x/collections.md:2427 +#: ./docs/10.x/collections.md:2541 +#: ./docs/11.x/collections.md:2625 +#: ./docs/master/collections.md:2541 msgid "The `sortKeysUsing` method sorts the collection by the keys of the underlying associative array using a callback:" -msgstr "`sortKeysUsing` 方法使用給定的回呼來以底層關聯式陣列的索引鍵排序該 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 582 (code) +# CODE +#: ./docs/8.x/collections.md:2312 +#: ./docs/9.x/collections.md:2429 +#: ./docs/10.x/collections.md:2543 +#: ./docs/11.x/collections.md:2627 +#: ./docs/master/collections.md:2543 msgid "$collection = collect([\n" " 'ID' => 22345,\n" " 'first' => 'John',\n" @@ -3708,397 +7466,739 @@ msgid "$collection = collect([\n" " 'ID' => 22345,\n" " 'last' => 'Doe',\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" 'ID' => 22345,\n" -" 'first' => 'John',\n" -" 'last' => 'Doe',\n" -"]);\n\n" -"$sorted = $collection->sortKeysUsing('strnatcasecmp');\n\n" -"$sorted->all();\n\n" -"/*\n" -" [\n" -" 'first' => 'John',\n" -" 'ID' => 22345,\n" -" 'last' => 'Doe',\n" -" ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 583 (paragraph) +# CODE +#: ./docs/10.x/collections.md:2323 +#: ./docs/11.x/collections.md:2407 +#: ./docs/master/collections.md:2323 +msgid "collect([1, 2, 3, 4])->sole(function (int $value, int $key) {\n" +" return $value === 2;\n" +"});\n\n" +"// 2" +msgstr "" + +# P +#: ./docs/8.x/collections.md:2330 +#: ./docs/9.x/collections.md:2447 +#: ./docs/10.x/collections.md:2561 +#: ./docs/11.x/collections.md:2645 +#: ./docs/master/collections.md:2561 msgid "The callback must be a comparison function that returns an integer less than, equal to, or greater than zero. For more information, refer to the PHP documentation on [`uksort`](https://www.php.net/manual/en/function.uksort.php#refsect1-function.uksort-parameters), which is the PHP function that `sortKeysUsing` method utilizes internally." -msgstr "該回呼必須為回傳一個小於、等於、或大於 0 之整數的比較函式。更多資訊請參考 PHP 說明文件中有關 [`uksort`](https://www.php.net/manual/en/function.uksort.php#refsect1-function.uksort-parameters) 的部分。`uksort` 時 `sortKeysUsing` 方法內部所使用的 PHP 函式。" +msgstr "" -#: docs/10.x/collections.md:block 585 (header) +# P +#: ./docs/8.x/collections.md:2332 +#: ./docs/9.x/collections.md:2449 +#: ./docs/10.x/collections.md:2563 +#: ./docs/11.x/collections.md:2647 +#: ./docs/master/collections.md:2563 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2333 +#: ./docs/9.x/collections.md:2450 +#: ./docs/10.x/collections.md:2564 +#: ./docs/11.x/collections.md:2648 +#: ./docs/master/collections.md:2564 msgid "`splice()` {.collection-method}" -msgstr "`splice()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 586 (paragraph) +# P +#: ./docs/8.x/collections.md:2335 +#: ./docs/9.x/collections.md:2452 +#: ./docs/10.x/collections.md:2566 +#: ./docs/11.x/collections.md:2650 +#: ./docs/master/collections.md:2566 msgid "The `splice` method removes and returns a slice of items starting at the specified index:" -msgstr "`splice` 方法會自指定的索引開始移除一部分的項目並將其回傳:" +msgstr "" -#: docs/10.x/collections.md:block 587 (code) +# CODE +#: ./docs/8.x/collections.md:2337 +#: ./docs/9.x/collections.md:2454 +#: ./docs/10.x/collections.md:2568 +#: ./docs/11.x/collections.md:2652 +#: ./docs/master/collections.md:2568 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" "$chunk = $collection->splice(2);\n\n" "$chunk->all();\n\n" "// [3, 4, 5]\n\n" "$collection->all();\n\n" -"// [1, 2]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$chunk = $collection->splice(2);\n\n" -"$chunk->all();\n\n" -"// [3, 4, 5]\n\n" -"$collection->all();\n\n" -"// [1, 2]\n" +"// [1, 2]" +msgstr "" -#: docs/10.x/collections.md:block 588 (paragraph) +# P +#: ./docs/8.x/collections.md:2349 +#: ./docs/9.x/collections.md:2466 +#: ./docs/10.x/collections.md:2580 +#: ./docs/11.x/collections.md:2664 +#: ./docs/master/collections.md:2580 msgid "You may pass a second argument to limit the size of the resulting collection:" -msgstr "可以傳入第二個引數來限制產生 Collection 的大小:" +msgstr "" -#: docs/10.x/collections.md:block 589 (code) +# CODE +#: ./docs/8.x/collections.md:2351 +#: ./docs/9.x/collections.md:2468 +#: ./docs/10.x/collections.md:2582 +#: ./docs/11.x/collections.md:2666 +#: ./docs/master/collections.md:2582 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" "$chunk = $collection->splice(2, 1);\n\n" "$chunk->all();\n\n" "// [3]\n\n" "$collection->all();\n\n" -"// [1, 2, 4, 5]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$chunk = $collection->splice(2, 1);\n\n" -"$chunk->all();\n\n" -"// [3]\n\n" -"$collection->all();\n\n" -"// [1, 2, 4, 5]\n" +"// [1, 2, 4, 5]" +msgstr "" -#: docs/10.x/collections.md:block 590 (paragraph) +# P +#: ./docs/8.x/collections.md:2363 +#: ./docs/9.x/collections.md:2480 +#: ./docs/10.x/collections.md:2594 +#: ./docs/11.x/collections.md:2678 +#: ./docs/master/collections.md:2594 msgid "In addition, you may pass a third argument containing the new items to replace the items removed from the collection:" -msgstr "此外,也可以傳入一個包含用來取代自 Collection 內移除項目的新項目作為第三個引數:" +msgstr "" -#: docs/10.x/collections.md:block 591 (code) +# CODE +#: ./docs/8.x/collections.md:2365 +#: ./docs/9.x/collections.md:2482 +#: ./docs/10.x/collections.md:2596 +#: ./docs/11.x/collections.md:2680 +#: ./docs/master/collections.md:2596 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" "$chunk = $collection->splice(2, 1, [10, 11]);\n\n" "$chunk->all();\n\n" "// [3]\n\n" "$collection->all();\n\n" -"// [1, 2, 10, 11, 4, 5]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$chunk = $collection->splice(2, 1, [10, 11]);\n\n" -"$chunk->all();\n\n" -"// [3]\n\n" -"$collection->all();\n\n" -"// [1, 2, 10, 11, 4, 5]\n" +"// [1, 2, 10, 11, 4, 5]" +msgstr "" -#: docs/10.x/collections.md:block 593 (header) +# P +#: ./docs/8.x/collections.md:2377 +#: ./docs/9.x/collections.md:2494 +#: ./docs/10.x/collections.md:2608 +#: ./docs/11.x/collections.md:2692 +#: ./docs/master/collections.md:2608 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2378 +#: ./docs/9.x/collections.md:2495 +#: ./docs/10.x/collections.md:2609 +#: ./docs/11.x/collections.md:2693 +#: ./docs/master/collections.md:2609 msgid "`split()` {.collection-method}" -msgstr "`split()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 594 (paragraph) +# P +#: ./docs/8.x/collections.md:2380 +#: ./docs/9.x/collections.md:2497 +#: ./docs/10.x/collections.md:2611 +#: ./docs/11.x/collections.md:2695 +#: ./docs/master/collections.md:2611 msgid "The `split` method breaks a collection into the given number of groups:" -msgstr "`split` 方法會將 Collection 拆解成給定數量的群組:" +msgstr "" -#: docs/10.x/collections.md:block 595 (code) +# CODE +#: ./docs/8.x/collections.md:2382 +#: ./docs/9.x/collections.md:2499 +#: ./docs/10.x/collections.md:2613 +#: ./docs/11.x/collections.md:2697 +#: ./docs/master/collections.md:2613 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" "$groups = $collection->split(3);\n\n" "$groups->all();\n\n" -"// [[1, 2], [3, 4], [5]]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$groups = $collection->split(3);\n\n" -"$groups->all();\n\n" -"// [[1, 2], [3, 4], [5]]\n" +"// [[1, 2], [3, 4], [5]]" +msgstr "" -#: docs/10.x/collections.md:block 597 (header) +# P +#: ./docs/8.x/collections.md:2390 +#: ./docs/9.x/collections.md:2507 +#: ./docs/10.x/collections.md:2621 +#: ./docs/11.x/collections.md:2705 +#: ./docs/master/collections.md:2621 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2391 +#: ./docs/9.x/collections.md:2508 +#: ./docs/10.x/collections.md:2622 +#: ./docs/11.x/collections.md:2706 +#: ./docs/master/collections.md:2622 msgid "`splitIn()` {.collection-method}" -msgstr "`splitIn()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 598 (paragraph) +# P +#: ./docs/8.x/collections.md:2393 +#: ./docs/9.x/collections.md:2510 +#: ./docs/10.x/collections.md:2624 +#: ./docs/11.x/collections.md:2708 +#: ./docs/master/collections.md:2624 msgid "The `splitIn` method breaks a collection into the given number of groups, filling non-terminal groups completely before allocating the remainder to the final group:" -msgstr "`splitIn` 方法會將 Collection 拆解成給定數量的群組,並會在將剩餘項目填至最後一個群組前先填滿非結尾的群組:" +msgstr "" -#: docs/10.x/collections.md:block 599 (code) +# CODE +#: ./docs/8.x/collections.md:2395 +#: ./docs/9.x/collections.md:2512 +#: ./docs/10.x/collections.md:2626 +#: ./docs/11.x/collections.md:2710 +#: ./docs/master/collections.md:2626 msgid "$collection = collect([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\n\n" "$groups = $collection->splitIn(3);\n\n" "$groups->all();\n\n" -"// [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10]]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\n\n" -"$groups = $collection->splitIn(3);\n\n" -"$groups->all();\n\n" -"// [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10]]\n" +"// [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10]]" +msgstr "" -#: docs/10.x/collections.md:block 601 (header) +# P +#: ./docs/8.x/collections.md:2403 +#: ./docs/9.x/collections.md:2520 +#: ./docs/10.x/collections.md:2634 +#: ./docs/11.x/collections.md:2718 +#: ./docs/master/collections.md:2634 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2404 +#: ./docs/9.x/collections.md:2521 +#: ./docs/10.x/collections.md:2635 +#: ./docs/11.x/collections.md:2719 +#: ./docs/master/collections.md:2635 msgid "`sum()` {.collection-method}" -msgstr "`sum()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 602 (paragraph) +# P +#: ./docs/8.x/collections.md:2406 +#: ./docs/9.x/collections.md:2523 +#: ./docs/10.x/collections.md:2637 +#: ./docs/11.x/collections.md:2721 +#: ./docs/master/collections.md:2637 msgid "The `sum` method returns the sum of all items in the collection:" -msgstr "`sum` 方法會回傳該 Collection 中所有項目的綜合:" +msgstr "" -#: docs/10.x/collections.md:block 603 (code) +# CODE +#: ./docs/8.x/collections.md:2408 +#: ./docs/9.x/collections.md:2525 +#: ./docs/10.x/collections.md:2639 +#: ./docs/11.x/collections.md:2723 +#: ./docs/master/collections.md:2639 msgid "collect([1, 2, 3, 4, 5])->sum();\n\n" -"// 15\n" -msgstr "collect([1, 2, 3, 4, 5])->sum();\n\n" -"// 15\n" +"// 15" +msgstr "" -#: docs/10.x/collections.md:block 604 (paragraph) +# P +#: ./docs/8.x/collections.md:2412 +#: ./docs/9.x/collections.md:2529 +#: ./docs/10.x/collections.md:2643 +#: ./docs/11.x/collections.md:2727 +#: ./docs/master/collections.md:2643 msgid "If the collection contains nested arrays or objects, you should pass a key that will be used to determine which values to sum:" -msgstr "若該 Collection 包含了巢狀陣列或物件,應傳入一個用來判斷要加總哪個值的索引鍵:" +msgstr "" -#: docs/10.x/collections.md:block 605 (code) +# CODE +#: ./docs/8.x/collections.md:2414 +#: ./docs/9.x/collections.md:2531 +#: ./docs/10.x/collections.md:2645 +#: ./docs/11.x/collections.md:2729 +#: ./docs/master/collections.md:2645 msgid "$collection = collect([\n" " ['name' => 'JavaScript: The Good Parts', 'pages' => 176],\n" " ['name' => 'JavaScript: The Definitive Guide', 'pages' => 1096],\n" "]);\n\n" "$collection->sum('pages');\n\n" -"// 1272\n" -msgstr "$collection = collect([\n" -" ['name' => 'JavaScript: The Good Parts', 'pages' => 176],\n" -" ['name' => 'JavaScript: The Definitive Guide', 'pages' => 1096],\n" -"]);\n\n" -"$collection->sum('pages');\n\n" -"// 1272\n" - -#: docs/10.x/collections.md:block 606 (paragraph) -msgid "In addition, you may pass your own closure to determine which values of the collection to sum:" -msgstr "此外,也可以傳入你自己的閉包來判斷該 Collection 中的哪個值要被加總:" +"// 1272" +msgstr "" -#: docs/10.x/collections.md:block 607 (code) +# CODE +#: ./docs/10.x/collections.md:2420 +#: ./docs/11.x/collections.md:2504 +#: ./docs/master/collections.md:2420 msgid "$collection = collect([\n" -" ['name' => 'Chair', 'colors' => ['Black']],\n" " ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" +" ['name' => 'Chair', 'colors' => ['Black']],\n" " ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" "]);\n\n" -"$collection->sum(function (array $product) {\n" +"$sorted = $collection->sortBy(function (array $product, int $key) {\n" " return count($product['colors']);\n" "});\n\n" -"// 6\n" -msgstr "$collection = collect([\n" +"$sorted->values()->all();\n\n" +"/*\n" +" [\n" +" ['name' => 'Chair', 'colors' => ['Black']],\n" +" ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" +" ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" +" ]\n" +"*/" +msgstr "" + +# P +#: ./docs/8.x/collections.md:2423 +#: ./docs/9.x/collections.md:2540 +#: ./docs/10.x/collections.md:2654 +#: ./docs/11.x/collections.md:2738 +#: ./docs/master/collections.md:2654 +msgid "In addition, you may pass your own closure to determine which values of the collection to sum:" +msgstr "" + +# CODE +#: ./docs/8.x/collections.md:2425 +#: ./docs/9.x/collections.md:2542 +msgid "$collection = collect([\n" " ['name' => 'Chair', 'colors' => ['Black']],\n" " ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" " ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" "]);\n\n" -"$collection->sum(function (array $product) {\n" +"$collection->sum(function ($product) {\n" " return count($product['colors']);\n" "});\n\n" -"// 6\n" +"// 6" +msgstr "" -#: docs/10.x/collections.md:block 609 (header) +# P +#: ./docs/8.x/collections.md:2437 +#: ./docs/9.x/collections.md:2554 +#: ./docs/10.x/collections.md:2668 +#: ./docs/11.x/collections.md:2752 +#: ./docs/master/collections.md:2668 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2438 +#: ./docs/9.x/collections.md:2555 +#: ./docs/10.x/collections.md:2669 +#: ./docs/11.x/collections.md:2753 +#: ./docs/master/collections.md:2669 msgid "`take()` {.collection-method}" -msgstr "`take()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 610 (paragraph) +# P +#: ./docs/8.x/collections.md:2440 +#: ./docs/9.x/collections.md:2557 +#: ./docs/10.x/collections.md:2671 +#: ./docs/11.x/collections.md:2755 +#: ./docs/master/collections.md:2671 msgid "The `take` method returns a new collection with the specified number of items:" -msgstr "`take` 方法會回傳包含特定數量項目的新 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 611 (code) +# CODE +#: ./docs/8.x/collections.md:2442 +#: ./docs/9.x/collections.md:2559 +#: ./docs/10.x/collections.md:2673 +#: ./docs/11.x/collections.md:2757 +#: ./docs/master/collections.md:2673 msgid "$collection = collect([0, 1, 2, 3, 4, 5]);\n\n" "$chunk = $collection->take(3);\n\n" "$chunk->all();\n\n" -"// [0, 1, 2]\n" -msgstr "$collection = collect([0, 1, 2, 3, 4, 5]);\n\n" -"$chunk = $collection->take(3);\n\n" -"$chunk->all();\n\n" -"// [0, 1, 2]\n" +"// [0, 1, 2]" +msgstr "" -#: docs/10.x/collections.md:block 612 (paragraph) +# P +#: ./docs/8.x/collections.md:2450 +#: ./docs/9.x/collections.md:2567 +#: ./docs/10.x/collections.md:2681 +#: ./docs/11.x/collections.md:2765 +#: ./docs/master/collections.md:2681 msgid "You may also pass a negative integer to take the specified number of items from the end of the collection:" -msgstr "也可以傳入負數整數來從該 Collection 的結尾開始取特定數量的項目:" +msgstr "" -#: docs/10.x/collections.md:block 613 (code) +# CODE +#: ./docs/8.x/collections.md:2452 +#: ./docs/9.x/collections.md:2569 +#: ./docs/10.x/collections.md:2683 +#: ./docs/11.x/collections.md:2767 +#: ./docs/master/collections.md:2683 msgid "$collection = collect([0, 1, 2, 3, 4, 5]);\n\n" "$chunk = $collection->take(-2);\n\n" "$chunk->all();\n\n" -"// [4, 5]\n" -msgstr "$collection = collect([0, 1, 2, 3, 4, 5]);\n\n" -"$chunk = $collection->take(-2);\n\n" -"$chunk->all();\n\n" -"// [4, 5]\n" +"// [4, 5]" +msgstr "" -#: docs/10.x/collections.md:block 615 (header) +# P +#: ./docs/8.x/collections.md:2460 +#: ./docs/9.x/collections.md:2577 +#: ./docs/10.x/collections.md:2691 +#: ./docs/11.x/collections.md:2775 +#: ./docs/master/collections.md:2691 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2461 +#: ./docs/9.x/collections.md:2578 +#: ./docs/10.x/collections.md:2692 +#: ./docs/11.x/collections.md:2776 +#: ./docs/master/collections.md:2692 msgid "`takeUntil()` {.collection-method}" -msgstr "`takeUntil()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 616 (paragraph) +# P +#: ./docs/8.x/collections.md:2463 +#: ./docs/9.x/collections.md:2580 +#: ./docs/10.x/collections.md:2694 +#: ./docs/11.x/collections.md:2778 +#: ./docs/master/collections.md:2694 msgid "The `takeUntil` method returns items in the collection until the given callback returns `true`:" -msgstr "`takeUntil` 方法會回傳該 Collection 中的項目,直到給定的回呼回傳 `true`:" +msgstr "" -#: docs/10.x/collections.md:block 617 (code) +# CODE +#: ./docs/8.x/collections.md:2465 +#: ./docs/9.x/collections.md:2582 msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->takeUntil(function (int $item) {\n" -" return $item >= 3;\n" -"});\n\n" -"$subset->all();\n\n" -"// [1, 2]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->takeUntil(function (int $item) {\n" +"$subset = $collection->takeUntil(function ($item) {\n" " return $item >= 3;\n" "});\n\n" "$subset->all();\n\n" -"// [1, 2]\n" +"// [1, 2]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2467 +#: ./docs/11.x/collections.md:2551 +#: ./docs/master/collections.md:2467 +msgid "$collection = collect([\n" +" ['name' => 'Taylor Otwell', 'age' => 34],\n" +" ['name' => 'Abigail Otwell', 'age' => 30],\n" +" ['name' => 'Taylor Otwell', 'age' => 36],\n" +" ['name' => 'Abigail Otwell', 'age' => 32],\n" +"]);\n\n" +"$sorted = $collection->sortBy([\n" +" fn (array $a, array $b) => $a['name'] <=> $b['name'],\n" +" fn (array $a, array $b) => $b['age'] <=> $a['age'],\n" +"]);\n\n" +"$sorted->values()->all();\n\n" +"/*\n" +" [\n" +" ['name' => 'Abigail Otwell', 'age' => 32],\n" +" ['name' => 'Abigail Otwell', 'age' => 30],\n" +" ['name' => 'Taylor Otwell', 'age' => 36],\n" +" ['name' => 'Taylor Otwell', 'age' => 34],\n" +" ]\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 618 (paragraph) +# P +#: ./docs/8.x/collections.md:2475 +#: ./docs/9.x/collections.md:2592 +#: ./docs/10.x/collections.md:2706 +#: ./docs/11.x/collections.md:2790 +#: ./docs/master/collections.md:2706 msgid "You may also pass a simple value to the `takeUntil` method to get the items until the given value is found:" -msgstr "也可以傳入一個簡單的值給 `takeUntil` 方法,來取直到找到指定項目之前的所有項目:" +msgstr "" -#: docs/10.x/collections.md:block 619 (code) +# CODE +#: ./docs/8.x/collections.md:2477 +#: ./docs/9.x/collections.md:2594 +#: ./docs/10.x/collections.md:2708 +#: ./docs/11.x/collections.md:2792 +#: ./docs/master/collections.md:2708 msgid "$collection = collect([1, 2, 3, 4]);\n\n" "$subset = $collection->takeUntil(3);\n\n" "$subset->all();\n\n" -"// [1, 2]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->takeUntil(3);\n\n" -"$subset->all();\n\n" -"// [1, 2]\n" +"// [1, 2]" +msgstr "" -#: docs/10.x/collections.md:block 620 (quote) -msgid "**Warning** If the given value is not found or the callback never returns `true`, the `takeUntil` method will return all items in the collection." -msgstr "**Warning** 若找不到給定的值,或是回呼從未回傳 `true`,則 `skipUntil` 方法會回傳該 Collection 中的所有項目。" +# P +#: ./docs/8.x/collections.md:2485 +#: ./docs/9.x/collections.md:2603 +#: ./docs/10.x/collections.md:2717 +#: ./docs/11.x/collections.md:2801 +#: ./docs/master/collections.md:2717 +msgid "If the given value is not found or the callback never returns `true`, the `takeUntil` method will return all items in the collection." +msgstr "" -#: docs/10.x/collections.md:block 622 (header) +# P +#: ./docs/8.x/collections.md:2487 +#: ./docs/9.x/collections.md:2605 +#: ./docs/10.x/collections.md:2719 +#: ./docs/11.x/collections.md:2803 +#: ./docs/master/collections.md:2719 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2488 +#: ./docs/9.x/collections.md:2606 +#: ./docs/10.x/collections.md:2720 +#: ./docs/11.x/collections.md:2804 +#: ./docs/master/collections.md:2720 msgid "`takeWhile()` {.collection-method}" -msgstr "`takeWhile()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 623 (paragraph) +# P +#: ./docs/8.x/collections.md:2490 +#: ./docs/9.x/collections.md:2608 +#: ./docs/10.x/collections.md:2722 +#: ./docs/11.x/collections.md:2806 +#: ./docs/master/collections.md:2722 msgid "The `takeWhile` method returns items in the collection until the given callback returns `false`:" -msgstr "`takeWhile` 方法會回傳該 Collection 中的項目,直到給定的回呼回傳 `false`:" +msgstr "" -#: docs/10.x/collections.md:block 624 (code) +# CODE +#: ./docs/8.x/collections.md:2492 +#: ./docs/9.x/collections.md:2610 msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->takeWhile(function (int $item) {\n" -" return $item < 3;\n" -"});\n\n" -"$subset->all();\n\n" -"// [1, 2]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->takeWhile(function (int $item) {\n" +"$subset = $collection->takeWhile(function ($item) {\n" " return $item < 3;\n" "});\n\n" "$subset->all();\n\n" -"// [1, 2]\n" +"// [1, 2]" +msgstr "" -#: docs/10.x/collections.md:block 625 (quote) -msgid "**Warning** If the callback never returns `false`, the `takeWhile` method will return all items in the collection." -msgstr "**Warning** 若回呼從未回傳 `false`,則 `takeWhile` 方法會回傳該 Collection 中的所有項目。" +# P +#: ./docs/8.x/collections.md:2502 +#: ./docs/9.x/collections.md:2621 +#: ./docs/10.x/collections.md:2735 +#: ./docs/11.x/collections.md:2819 +#: ./docs/master/collections.md:2735 +msgid "If the callback never returns `false`, the `takeWhile` method will return all items in the collection." +msgstr "" -#: docs/10.x/collections.md:block 627 (header) +# P +#: ./docs/8.x/collections.md:2504 +#: ./docs/9.x/collections.md:2623 +#: ./docs/10.x/collections.md:2737 +#: ./docs/11.x/collections.md:2821 +#: ./docs/master/collections.md:2737 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2505 +#: ./docs/9.x/collections.md:2624 +#: ./docs/10.x/collections.md:2738 +#: ./docs/11.x/collections.md:2822 +#: ./docs/master/collections.md:2738 msgid "`tap()` {.collection-method}" -msgstr "`tap()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 628 (paragraph) +# P +#: ./docs/8.x/collections.md:2507 +#: ./docs/9.x/collections.md:2626 +#: ./docs/10.x/collections.md:2740 +#: ./docs/11.x/collections.md:2824 +#: ./docs/master/collections.md:2740 msgid "The `tap` method passes the collection to the given callback, allowing you to \"tap\" into the collection at a specific point and do something with the items while not affecting the collection itself. The collection is then returned by the `tap` method:" -msgstr "`tap` 方法會將該 Collection 傳給給定的回呼,讓你能在特定的時間點上「竊聽 (Tap)」該 Collection,並在不影響該 Collection 本身的情況下對其中的項目做點事情。該 Collection 會接著被 `tap` 方法回傳:" +msgstr "" -#: docs/10.x/collections.md:block 629 (code) +# CODE +#: ./docs/8.x/collections.md:2509 +#: ./docs/9.x/collections.md:2628 msgid "collect([2, 4, 3, 1, 5])\n" " ->sort()\n" -" ->tap(function (Collection $collection) {\n" +" ->tap(function ($collection) {\n" " Log::debug('Values after sorting', $collection->values()->all());\n" " })\n" " ->shift();\n\n" -"// 1\n" -msgstr "collect([2, 4, 3, 1, 5])\n" -" ->sort()\n" -" ->tap(function (Collection $collection) {\n" -" Log::debug('排序後的值', $collection->values()->all());\n" -" })\n" -" ->shift();\n\n" -"// 1\n" +"// 1" +msgstr "" -#: docs/10.x/collections.md:block 631 (header) +# P +#: ./docs/8.x/collections.md:2518 +#: ./docs/9.x/collections.md:2637 +#: ./docs/10.x/collections.md:2751 +#: ./docs/11.x/collections.md:2835 +#: ./docs/master/collections.md:2751 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2519 +#: ./docs/9.x/collections.md:2638 +#: ./docs/10.x/collections.md:2752 +#: ./docs/11.x/collections.md:2836 +#: ./docs/master/collections.md:2752 msgid "`times()` {.collection-method}" -msgstr "`times()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 632 (paragraph) +# P +#: ./docs/8.x/collections.md:2521 +#: ./docs/9.x/collections.md:2640 +#: ./docs/10.x/collections.md:2754 +#: ./docs/11.x/collections.md:2838 +#: ./docs/master/collections.md:2754 msgid "The static `times` method creates a new collection by invoking the given closure a specified number of times:" -msgstr "`times` 靜態方法會通過叫用給定的閉包特定次數來建立一個新的 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 633 (code) -msgid "$collection = Collection::times(10, function (int $number) {\n" -" return $number * 9;\n" -"});\n\n" -"$collection->all();\n\n" -"// [9, 18, 27, 36, 45, 54, 63, 72, 81, 90]\n" -msgstr "$collection = Collection::times(10, function (int $number) {\n" +# CODE +#: ./docs/8.x/collections.md:2523 +#: ./docs/9.x/collections.md:2642 +msgid "$collection = Collection::times(10, function ($number) {\n" " return $number * 9;\n" "});\n\n" "$collection->all();\n\n" -"// [9, 18, 27, 36, 45, 54, 63, 72, 81, 90]\n" +"// [9, 18, 27, 36, 45, 54, 63, 72, 81, 90]" +msgstr "" -#: docs/10.x/collections.md:block 635 (header) +# P +#: ./docs/8.x/collections.md:2531 +#: ./docs/9.x/collections.md:2650 +#: ./docs/10.x/collections.md:2764 +#: ./docs/11.x/collections.md:2848 +#: ./docs/master/collections.md:2764 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2532 +#: ./docs/9.x/collections.md:2651 +#: ./docs/10.x/collections.md:2765 +#: ./docs/11.x/collections.md:2849 +#: ./docs/master/collections.md:2765 msgid "`toArray()` {.collection-method}" -msgstr "`toArray()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 636 (paragraph) +# P +#: ./docs/8.x/collections.md:2534 +#: ./docs/9.x/collections.md:2653 +#: ./docs/10.x/collections.md:2767 +#: ./docs/11.x/collections.md:2851 +#: ./docs/master/collections.md:2767 msgid "The `toArray` method converts the collection into a plain PHP `array`. If the collection's values are [Eloquent](/docs/{{version}}/eloquent) models, the models will also be converted to arrays:" -msgstr "`toArray` 方法將該 Collection 轉為純 PHP `array`。若該 Collection 的值為 [Eloquent](/docs/{{version}}/eloquent) Model,則該 Model 也會被轉為陣列:" +msgstr "" -#: docs/10.x/collections.md:block 637 (code) +# CODE +#: ./docs/8.x/collections.md:2536 +#: ./docs/9.x/collections.md:2655 +#: ./docs/10.x/collections.md:2769 +#: ./docs/11.x/collections.md:2853 +#: ./docs/master/collections.md:2769 msgid "$collection = collect(['name' => 'Desk', 'price' => 200]);\n\n" "$collection->toArray();\n\n" "/*\n" " [\n" " ['name' => 'Desk', 'price' => 200],\n" " ]\n" -"*/\n" -msgstr "$collection = collect(['name' => 'Desk', 'price' => 200]);\n\n" -"$collection->toArray();\n\n" -"/*\n" -" [\n" -" ['name' => 'Desk', 'price' => 200],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 638 (quote) -msgid "**Warning** `toArray` also converts all of the collection's nested objects that are an instance of `Arrayable` to an array. If you want to get the raw array underlying the collection, use the [`all`](#method-all) method instead." -msgstr "**Warning** `toArray` 也會將該 Collection 中所有 `Arrayable` 實作的巢狀物件轉換為陣列。若只是想取得該 Collection 底層的原始陣列,請使用 [`all`](#method-all) 方法代替。" +# P +#: ./docs/8.x/collections.md:2546 +#: ./docs/9.x/collections.md:2666 +#: ./docs/10.x/collections.md:2780 +#: ./docs/11.x/collections.md:2864 +#: ./docs/master/collections.md:2780 +msgid "`toArray` also converts all of the collection's nested objects that are an instance of `Arrayable` to an array. If you want to get the raw array underlying the collection, use the [`all`](#method-all) method instead." +msgstr "" -#: docs/10.x/collections.md:block 640 (header) +# P +#: ./docs/8.x/collections.md:2548 +#: ./docs/9.x/collections.md:2668 +#: ./docs/10.x/collections.md:2782 +#: ./docs/11.x/collections.md:2866 +#: ./docs/master/collections.md:2782 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2549 +#: ./docs/9.x/collections.md:2669 +#: ./docs/10.x/collections.md:2783 +#: ./docs/11.x/collections.md:2867 +#: ./docs/master/collections.md:2783 msgid "`toJson()` {.collection-method}" -msgstr "`toJson()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 641 (paragraph) +# P +#: ./docs/8.x/collections.md:2551 +#: ./docs/9.x/collections.md:2671 +#: ./docs/10.x/collections.md:2785 +#: ./docs/11.x/collections.md:2869 +#: ./docs/master/collections.md:2785 msgid "The `toJson` method converts the collection into a JSON serialized string:" -msgstr "`toJson` 方法將該 Collection 轉為經過 JSON 序列化的字串:" +msgstr "" -#: docs/10.x/collections.md:block 642 (code) +# CODE +#: ./docs/8.x/collections.md:2553 +#: ./docs/9.x/collections.md:2673 +#: ./docs/10.x/collections.md:2787 +#: ./docs/11.x/collections.md:2871 +#: ./docs/master/collections.md:2787 msgid "$collection = collect(['name' => 'Desk', 'price' => 200]);\n\n" "$collection->toJson();\n\n" -"// '{\"name\":\"Desk\", \"price\":200}'\n" -msgstr "$collection = collect(['name' => 'Desk', 'price' => 200]);\n\n" -"$collection->toJson();\n\n" -"// '{\"name\":\"Desk\", \"price\":200}'\n" +"// '{\"name\":\"Desk\", \"price\":200}'" +msgstr "" -#: docs/10.x/collections.md:block 644 (header) +# P +#: ./docs/8.x/collections.md:2559 +#: ./docs/9.x/collections.md:2679 +#: ./docs/10.x/collections.md:2793 +#: ./docs/11.x/collections.md:2877 +#: ./docs/master/collections.md:2793 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2560 +#: ./docs/9.x/collections.md:2680 +#: ./docs/10.x/collections.md:2794 +#: ./docs/11.x/collections.md:2878 +#: ./docs/master/collections.md:2794 msgid "`transform()` {.collection-method}" -msgstr "`transform()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 645 (paragraph) +# P +#: ./docs/8.x/collections.md:2562 +#: ./docs/9.x/collections.md:2682 +#: ./docs/10.x/collections.md:2796 +#: ./docs/11.x/collections.md:2880 +#: ./docs/master/collections.md:2796 msgid "The `transform` method iterates over the collection and calls the given callback with each item in the collection. The items in the collection will be replaced by the values returned by the callback:" -msgstr "`transform` 方法迭代該 Collection,並以該 Collection 中的各個項目呼叫給定的回呼。該 Collection 中的項目將被這個回呼所回傳的值取代:" +msgstr "" -#: docs/10.x/collections.md:block 646 (code) +# CODE +#: ./docs/8.x/collections.md:2564 +#: ./docs/9.x/collections.md:2684 msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->transform(function (int $item, int $key) {\n" -" return $item * 2;\n" -"});\n\n" -"$collection->all();\n\n" -"// [2, 4, 6, 8, 10]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->transform(function (int $item, int $key) {\n" +"$collection->transform(function ($item, $key) {\n" " return $item * 2;\n" "});\n\n" "$collection->all();\n\n" -"// [2, 4, 6, 8, 10]\n" +"// [2, 4, 6, 8, 10]" +msgstr "" -#: docs/10.x/collections.md:block 647 (quote) -msgid "**Warning** Unlike most other collection methods, `transform` modifies the collection itself. If you wish to create a new collection instead, use the [`map`](#method-map) method." -msgstr "**Warning** 與其他 Collection 方法不同,`transform` 會修改該 Collection 本身。若想建立新的 Collection,請使用 [`map`](#method-map) 方法代替。" +# P +#: ./docs/8.x/collections.md:2574 +#: ./docs/9.x/collections.md:2695 +#: ./docs/10.x/collections.md:2809 +#: ./docs/11.x/collections.md:2893 +#: ./docs/master/collections.md:2809 +msgid "Unlike most other collection methods, `transform` modifies the collection itself. If you wish to create a new collection instead, use the [`map`](#method-map) method." +msgstr "" -#: docs/10.x/collections.md:block 649 (header) +# P +#: ./docs/8.x/collections.md:2576 +#: ./docs/9.x/collections.md:2697 +#: ./docs/10.x/collections.md:2811 +#: ./docs/11.x/collections.md:2895 +#: ./docs/master/collections.md:2811 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2577 +#: ./docs/9.x/collections.md:2698 +#: ./docs/10.x/collections.md:2812 +#: ./docs/11.x/collections.md:2896 +#: ./docs/master/collections.md:2812 msgid "`undot()` {.collection-method}" -msgstr "`undot()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 650 (paragraph) +# P +#: ./docs/8.x/collections.md:2579 +#: ./docs/9.x/collections.md:2700 +#: ./docs/10.x/collections.md:2814 +#: ./docs/11.x/collections.md:2898 +#: ./docs/master/collections.md:2814 msgid "The `undot` method expands a single-dimensional collection that uses \"dot\" notation into a multi-dimensional collection:" -msgstr "`undot` 方法將一組使用「點 (.)」標記法的一維 Collection 展開為多維 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 651 (code) +# CODE +#: ./docs/8.x/collections.md:2581 msgid "$person = collect([\n" " 'name.first_name' => 'Marie',\n" " 'name.last_name' => 'Valentine',\n" @@ -4107,7 +8207,7 @@ msgid "$person = collect([\n" " 'address.suburb' => 'Detroit',\n" " 'address.state' => 'MI',\n" " 'address.postcode' => '48219'\n" -"]);\n\n" +"])\n\n" "$person = $person->undot();\n\n" "$person->toArray();\n\n" "/*\n" @@ -4124,75 +8224,102 @@ msgid "$person = collect([\n" " \"postcode\" => \"48219\",\n" " ],\n" " ]\n" -"*/\n" -msgstr "$person = collect([\n" -" 'name.first_name' => 'Marie',\n" -" 'name.last_name' => 'Valentine',\n" -" 'address.line_1' => '2992 Eagle Drive',\n" -" 'address.line_2' => '',\n" -" 'address.suburb' => 'Detroit',\n" -" 'address.state' => 'MI',\n" -" 'address.postcode' => '48219'\n" -"]);\n\n" -"$person = $person->undot();\n\n" -"$person->toArray();\n\n" -"/*\n" -" [\n" -" \"name\" => [\n" -" \"first_name\" => \"Marie\",\n" -" \"last_name\" => \"Valentine\",\n" -" ],\n" -" \"address\" => [\n" -" \"line_1\" => \"2992 Eagle Drive\",\n" -" \"line_2\" => \"\",\n" -" \"suburb\" => \"Detroit\",\n" -" \"state\" => \"MI\",\n" -" \"postcode\" => \"48219\",\n" -" ],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 653 (header) +# P +#: ./docs/8.x/collections.md:2611 +#: ./docs/9.x/collections.md:2732 +#: ./docs/10.x/collections.md:2846 +#: ./docs/11.x/collections.md:2930 +#: ./docs/master/collections.md:2846 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2612 +#: ./docs/9.x/collections.md:2733 +#: ./docs/10.x/collections.md:2847 +#: ./docs/11.x/collections.md:2931 +#: ./docs/master/collections.md:2847 msgid "`union()` {.collection-method}" -msgstr "`union()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 654 (paragraph) +# P +#: ./docs/8.x/collections.md:2614 +#: ./docs/9.x/collections.md:2735 +#: ./docs/10.x/collections.md:2849 +#: ./docs/11.x/collections.md:2933 +#: ./docs/master/collections.md:2849 msgid "The `union` method adds the given array to the collection. If the given array contains keys that are already in the original collection, the original collection's values will be preferred:" -msgstr "`union` 方法將給定的陣列加至該 Collection 中。若給定的陣列包含了已存在於原始 Collection 中的索引鍵,則會優先使用原始 Collection 中的值:" +msgstr "" -#: docs/10.x/collections.md:block 655 (code) +# CODE +#: ./docs/8.x/collections.md:2616 +#: ./docs/9.x/collections.md:2737 +#: ./docs/10.x/collections.md:2851 +#: ./docs/11.x/collections.md:2935 +#: ./docs/master/collections.md:2851 msgid "$collection = collect([1 => ['a'], 2 => ['b']]);\n\n" "$union = $collection->union([3 => ['c'], 1 => ['d']]);\n\n" "$union->all();\n\n" -"// [1 => ['a'], 2 => ['b'], 3 => ['c']]\n" -msgstr "$collection = collect([1 => ['a'], 2 => ['b']]);\n\n" -"$union = $collection->union([3 => ['c'], 1 => ['d']]);\n\n" -"$union->all();\n\n" -"// [1 => ['a'], 2 => ['b'], 3 => ['c']]\n" +"// [1 => ['a'], 2 => ['b'], 3 => ['c']]" +msgstr "" -#: docs/10.x/collections.md:block 657 (header) +# P +#: ./docs/8.x/collections.md:2624 +#: ./docs/9.x/collections.md:2745 +#: ./docs/10.x/collections.md:2859 +#: ./docs/11.x/collections.md:2943 +#: ./docs/master/collections.md:2859 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2625 +#: ./docs/9.x/collections.md:2746 +#: ./docs/10.x/collections.md:2860 +#: ./docs/11.x/collections.md:2944 +#: ./docs/master/collections.md:2860 msgid "`unique()` {.collection-method}" -msgstr "`unique()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 658 (paragraph) +# P +#: ./docs/8.x/collections.md:2627 +#: ./docs/9.x/collections.md:2748 +#: ./docs/10.x/collections.md:2862 +#: ./docs/11.x/collections.md:2946 +#: ./docs/master/collections.md:2862 msgid "The `unique` method returns all of the unique items in the collection. The returned collection keeps the original array keys, so in the following example we will use the [`values`](#method-values) method to reset the keys to consecutively numbered indexes:" -msgstr "`unique` 方法會回傳該 Collection 中所有不重複的項目。回傳的 Collection 會保留原始的陣列索引鍵,因此,在下列範例中我們使用了 [`values`](#method-values) 方法來將索引鍵重設成連續的數字索引:" +msgstr "" -#: docs/10.x/collections.md:block 659 (code) +# CODE +#: ./docs/8.x/collections.md:2629 +#: ./docs/9.x/collections.md:2750 +#: ./docs/10.x/collections.md:2864 +#: ./docs/11.x/collections.md:2948 +#: ./docs/master/collections.md:2864 msgid "$collection = collect([1, 1, 2, 2, 3, 4, 2]);\n\n" "$unique = $collection->unique();\n\n" "$unique->values()->all();\n\n" -"// [1, 2, 3, 4]\n" -msgstr "$collection = collect([1, 1, 2, 2, 3, 4, 2]);\n\n" -"$unique = $collection->unique();\n\n" -"$unique->values()->all();\n\n" -"// [1, 2, 3, 4]\n" +"// [1, 2, 3, 4]" +msgstr "" -#: docs/10.x/collections.md:block 660 (paragraph) +# P +#: ./docs/8.x/collections.md:2637 +#: ./docs/9.x/collections.md:2758 +#: ./docs/10.x/collections.md:2872 +#: ./docs/11.x/collections.md:2956 +#: ./docs/master/collections.md:2872 msgid "When dealing with nested arrays or objects, you may specify the key used to determine uniqueness:" -msgstr "在處理巢狀陣列或物件時,可以指定用來判斷是否重複的索引鍵:" +msgstr "" -#: docs/10.x/collections.md:block 661 (code) +# CODE +#: ./docs/8.x/collections.md:2639 +#: ./docs/9.x/collections.md:2760 +#: ./docs/10.x/collections.md:2874 +#: ./docs/11.x/collections.md:2958 +#: ./docs/master/collections.md:2874 msgid "$collection = collect([\n" " ['name' => 'iPhone 6', 'brand' => 'Apple', 'type' => 'phone'],\n" " ['name' => 'iPhone 5', 'brand' => 'Apple', 'type' => 'phone'],\n" @@ -4207,41 +8334,37 @@ msgid "$collection = collect([\n" " ['name' => 'iPhone 6', 'brand' => 'Apple', 'type' => 'phone'],\n" " ['name' => 'Galaxy S6', 'brand' => 'Samsung', 'type' => 'phone'],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['name' => 'iPhone 6', 'brand' => 'Apple', 'type' => 'phone'],\n" -" ['name' => 'iPhone 5', 'brand' => 'Apple', 'type' => 'phone'],\n" -" ['name' => 'Apple Watch', 'brand' => 'Apple', 'type' => 'watch'],\n" -" ['name' => 'Galaxy S6', 'brand' => 'Samsung', 'type' => 'phone'],\n" -" ['name' => 'Galaxy Gear', 'brand' => 'Samsung', 'type' => 'watch'],\n" +"*/" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2656 +#: ./docs/11.x/collections.md:2740 +#: ./docs/master/collections.md:2656 +msgid "$collection = collect([\n" +" ['name' => 'Chair', 'colors' => ['Black']],\n" +" ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" +" ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" "]);\n\n" -"$unique = $collection->unique('brand');\n\n" -"$unique->values()->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'iPhone 6', 'brand' => 'Apple', 'type' => 'phone'],\n" -" ['name' => 'Galaxy S6', 'brand' => 'Samsung', 'type' => 'phone'],\n" -" ]\n" -"*/\n" +"$collection->sum(function (array $product) {\n" +" return count($product['colors']);\n" +"});\n\n" +"// 6" +msgstr "" -#: docs/10.x/collections.md:block 662 (paragraph) +# P +#: ./docs/8.x/collections.md:2658 +#: ./docs/9.x/collections.md:2779 +#: ./docs/10.x/collections.md:2893 +#: ./docs/11.x/collections.md:2977 +#: ./docs/master/collections.md:2893 msgid "Finally, you may also pass your own closure to the `unique` method to specify which value should determine an item's uniqueness:" -msgstr "此外,還可以傳入你自己的閉包給 `unique` 方法,來指定要用哪個值判斷項目是否重複:" +msgstr "" -#: docs/10.x/collections.md:block 663 (code) -msgid "$unique = $collection->unique(function (array $item) {\n" -" return $item['brand'].$item['type'];\n" -"});\n\n" -"$unique->values()->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'iPhone 6', 'brand' => 'Apple', 'type' => 'phone'],\n" -" ['name' => 'Apple Watch', 'brand' => 'Apple', 'type' => 'watch'],\n" -" ['name' => 'Galaxy S6', 'brand' => 'Samsung', 'type' => 'phone'],\n" -" ['name' => 'Galaxy Gear', 'brand' => 'Samsung', 'type' => 'watch'],\n" -" ]\n" -"*/\n" -msgstr "$unique = $collection->unique(function (array $item) {\n" +# CODE +#: ./docs/8.x/collections.md:2660 +#: ./docs/9.x/collections.md:2781 +msgid "$unique = $collection->unique(function ($item) {\n" " return $item['brand'].$item['type'];\n" "});\n\n" "$unique->values()->all();\n\n" @@ -4252,147 +8375,324 @@ msgstr "$unique = $collection->unique(function (array $item) {\n" " ['name' => 'Galaxy S6', 'brand' => 'Samsung', 'type' => 'phone'],\n" " ['name' => 'Galaxy Gear', 'brand' => 'Samsung', 'type' => 'watch'],\n" " ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 664 (paragraph) +# P +#: ./docs/8.x/collections.md:2675 +#: ./docs/9.x/collections.md:2796 +#: ./docs/10.x/collections.md:2910 +#: ./docs/11.x/collections.md:2994 +#: ./docs/master/collections.md:2910 msgid "The `unique` method uses \"loose\" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value. Use the [`uniqueStrict`](#method-uniquestrict) method to filter using \"strict\" comparisons." -msgstr "`unique` 方法在比對項目值時使用了「鬆散 (Loose)」的比對方法。這標示,具有整數值的字串與一個有相同值的整數會被視為相同。請使用 [`uniqueStrict`](#method-uniquestrict) 方法來使用「嚴格 (Strict)」比對進行過濾。" +msgstr "" -#: docs/10.x/collections.md:block 665 (quote) -msgid "**Note** This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-unique)." -msgstr "**Note** 在使用 [Eloquent Collection](/docs/{{version}}/eloquent-collections#method-unique) 時,該方法的行為有經過修改。" +# P +#: ./docs/8.x/collections.md:2677 +#: ./docs/9.x/collections.md:2799 +#: ./docs/10.x/collections.md:2913 +#: ./docs/11.x/collections.md:2997 +#: ./docs/master/collections.md:2913 +msgid "This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-unique)." +msgstr "" -#: docs/10.x/collections.md:block 667 (header) +# P +#: ./docs/8.x/collections.md:2679 +#: ./docs/9.x/collections.md:2801 +#: ./docs/10.x/collections.md:2915 +#: ./docs/11.x/collections.md:2999 +#: ./docs/master/collections.md:2915 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2680 +#: ./docs/9.x/collections.md:2802 +#: ./docs/10.x/collections.md:2916 +#: ./docs/11.x/collections.md:3000 +#: ./docs/master/collections.md:2916 msgid "`uniqueStrict()` {.collection-method}" -msgstr "`uniqueStrict()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 668 (paragraph) +# P +#: ./docs/8.x/collections.md:2682 +#: ./docs/9.x/collections.md:2804 +#: ./docs/10.x/collections.md:2918 +#: ./docs/11.x/collections.md:3002 +#: ./docs/master/collections.md:2918 msgid "This method has the same signature as the [`unique`](#method-unique) method; however, all values are compared using \"strict\" comparisons." -msgstr "該方法與 [`unique`](#method-unique) 方法的簽章一致。不過,所有的數值比對都是使用「嚴格」比對模式。" +msgstr "" -#: docs/10.x/collections.md:block 670 (header) +# P +#: ./docs/8.x/collections.md:2684 +#: ./docs/9.x/collections.md:2806 +#: ./docs/10.x/collections.md:2920 +#: ./docs/11.x/collections.md:3004 +#: ./docs/master/collections.md:2920 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2685 +#: ./docs/9.x/collections.md:2807 +#: ./docs/10.x/collections.md:2921 +#: ./docs/11.x/collections.md:3005 +#: ./docs/master/collections.md:2921 msgid "`unless()` {.collection-method}" -msgstr "`unless()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 671 (paragraph) +# P +#: ./docs/8.x/collections.md:2687 +#: ./docs/9.x/collections.md:2809 +#: ./docs/10.x/collections.md:2923 +#: ./docs/11.x/collections.md:3007 +#: ./docs/master/collections.md:2923 msgid "The `unless` method will execute the given callback unless the first argument given to the method evaluates to `true`:" -msgstr "`unless` 方法只會在傳入該方法的第一個引數取值不為 `true` 時執行給定的回呼:" +msgstr "" -#: docs/10.x/collections.md:block 672 (code) +# CODE +#: ./docs/8.x/collections.md:2689 +#: ./docs/9.x/collections.md:2811 msgid "$collection = collect([1, 2, 3]);\n\n" -"$collection->unless(true, function (Collection $collection) {\n" +"$collection->unless(true, function ($collection) {\n" " return $collection->push(4);\n" "});\n\n" -"$collection->unless(false, function (Collection $collection) {\n" +"$collection->unless(false, function ($collection) {\n" " return $collection->push(5);\n" "});\n\n" "$collection->all();\n\n" -"// [1, 2, 3, 5]\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$collection->unless(true, function (Collection $collection) {\n" -" return $collection->push(4);\n" -"});\n\n" -"$collection->unless(false, function (Collection $collection) {\n" -" return $collection->push(5);\n" +"// [1, 2, 3, 5]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2696 +#: ./docs/11.x/collections.md:2780 +#: ./docs/master/collections.md:2696 +msgid "$collection = collect([1, 2, 3, 4]);\n\n" +"$subset = $collection->takeUntil(function (int $item) {\n" +" return $item >= 3;\n" "});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 5]\n" +"$subset->all();\n\n" +"// [1, 2]" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:2702 +#: ./docs/10.x/collections.md:2816 +#: ./docs/11.x/collections.md:2900 +#: ./docs/master/collections.md:2816 +msgid "$person = collect([\n" +" 'name.first_name' => 'Marie',\n" +" 'name.last_name' => 'Valentine',\n" +" 'address.line_1' => '2992 Eagle Drive',\n" +" 'address.line_2' => '',\n" +" 'address.suburb' => 'Detroit',\n" +" 'address.state' => 'MI',\n" +" 'address.postcode' => '48219'\n" +"]);\n\n" +"$person = $person->undot();\n\n" +"$person->toArray();\n\n" +"/*\n" +" [\n" +" \"name\" => [\n" +" \"first_name\" => \"Marie\",\n" +" \"last_name\" => \"Valentine\",\n" +" ],\n" +" \"address\" => [\n" +" \"line_1\" => \"2992 Eagle Drive\",\n" +" \"line_2\" => \"\",\n" +" \"suburb\" => \"Detroit\",\n" +" \"state\" => \"MI\",\n" +" \"postcode\" => \"48219\",\n" +" ],\n" +" ]\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 673 (paragraph) +# P +#: ./docs/8.x/collections.md:2703 +#: ./docs/9.x/collections.md:2825 +#: ./docs/10.x/collections.md:2939 +#: ./docs/11.x/collections.md:3023 +#: ./docs/master/collections.md:2939 msgid "A second callback may be passed to the `unless` method. The second callback will be executed when the first argument given to the `unless` method evaluates to `true`:" -msgstr "可以傳入第二個回呼給 `unless` 方法。當第一個傳給 `unless` 方法的引數為 `true` 時,會呼叫第二個回呼:" +msgstr "" -#: docs/10.x/collections.md:block 674 (code) +# CODE +#: ./docs/8.x/collections.md:2705 +#: ./docs/9.x/collections.md:2827 msgid "$collection = collect([1, 2, 3]);\n\n" -"$collection->unless(true, function (Collection $collection) {\n" -" return $collection->push(4);\n" -"}, function (Collection $collection) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 5]\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$collection->unless(true, function (Collection $collection) {\n" +"$collection->unless(true, function ($collection) {\n" " return $collection->push(4);\n" -"}, function (Collection $collection) {\n" +"}, function ($collection) {\n" " return $collection->push(5);\n" "});\n\n" "$collection->all();\n\n" -"// [1, 2, 3, 5]\n" +"// [1, 2, 3, 5]" +msgstr "" -#: docs/10.x/collections.md:block 675 (paragraph) +# P +#: ./docs/8.x/collections.md:2717 +#: ./docs/9.x/collections.md:2839 +#: ./docs/10.x/collections.md:2953 +#: ./docs/11.x/collections.md:3037 +#: ./docs/master/collections.md:2953 msgid "For the inverse of `unless`, see the [`when`](#method-when) method." -msgstr "請參考 [when](#method-when) 方法以瞭解與 `unless` 相反的方法。" +msgstr "" -#: docs/10.x/collections.md:block 677 (header) +# P +#: ./docs/8.x/collections.md:2719 +#: ./docs/9.x/collections.md:2841 +#: ./docs/10.x/collections.md:2955 +#: ./docs/11.x/collections.md:3039 +#: ./docs/master/collections.md:2955 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2720 +#: ./docs/9.x/collections.md:2842 +#: ./docs/10.x/collections.md:2956 +#: ./docs/11.x/collections.md:3040 +#: ./docs/master/collections.md:2956 msgid "`unlessEmpty()` {.collection-method}" -msgstr "`unlessEmpty()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 678 (paragraph) +# P +#: ./docs/8.x/collections.md:2722 +#: ./docs/9.x/collections.md:2844 +#: ./docs/10.x/collections.md:2958 +#: ./docs/11.x/collections.md:3042 +#: ./docs/master/collections.md:2958 msgid "Alias for the [`whenNotEmpty`](#method-whennotempty) method." -msgstr "[`whenNotEmpty`](#method-whennotempty) 方法的別名。" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2724 +#: ./docs/11.x/collections.md:2808 +#: ./docs/master/collections.md:2724 +msgid "$collection = collect([1, 2, 3, 4]);\n\n" +"$subset = $collection->takeWhile(function (int $item) {\n" +" return $item < 3;\n" +"});\n\n" +"$subset->all();\n\n" +"// [1, 2]" +msgstr "" -#: docs/10.x/collections.md:block 680 (header) +# P +#: ./docs/8.x/collections.md:2724 +#: ./docs/9.x/collections.md:2846 +#: ./docs/10.x/collections.md:2960 +#: ./docs/11.x/collections.md:3044 +#: ./docs/master/collections.md:2960 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2725 +#: ./docs/9.x/collections.md:2847 +#: ./docs/10.x/collections.md:2961 +#: ./docs/11.x/collections.md:3045 +#: ./docs/master/collections.md:2961 msgid "`unlessNotEmpty()` {.collection-method}" -msgstr "`unlessNotEmpty()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 681 (paragraph) +# P +#: ./docs/8.x/collections.md:2727 +#: ./docs/9.x/collections.md:2849 +#: ./docs/10.x/collections.md:2963 +#: ./docs/11.x/collections.md:3047 +#: ./docs/master/collections.md:2963 msgid "Alias for the [`whenEmpty`](#method-whenempty) method." -msgstr "[`whenEmpty`](#method-whenempty) 方法的別名。" +msgstr "" -#: docs/10.x/collections.md:block 683 (header) +# P +#: ./docs/8.x/collections.md:2729 +#: ./docs/9.x/collections.md:2851 +#: ./docs/10.x/collections.md:2965 +#: ./docs/11.x/collections.md:3049 +#: ./docs/master/collections.md:2965 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2730 +#: ./docs/9.x/collections.md:2852 +#: ./docs/10.x/collections.md:2966 +#: ./docs/11.x/collections.md:3050 +#: ./docs/master/collections.md:2966 msgid "`unwrap()` {.collection-method}" -msgstr "`unwrap()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 684 (paragraph) +# P +#: ./docs/8.x/collections.md:2732 +#: ./docs/9.x/collections.md:2854 +#: ./docs/10.x/collections.md:2968 +#: ./docs/11.x/collections.md:3052 +#: ./docs/master/collections.md:2968 msgid "The static `unwrap` method returns the collection's underlying items from the given value when applicable:" -msgstr "靜態 `unwrap` 方法會可能的情況下從給定值中取得該 Collection 的底層項目:" +msgstr "" -#: docs/10.x/collections.md:block 685 (code) +# CODE +#: ./docs/8.x/collections.md:2734 +#: ./docs/9.x/collections.md:2856 +#: ./docs/10.x/collections.md:2970 +#: ./docs/11.x/collections.md:3054 +#: ./docs/master/collections.md:2970 msgid "Collection::unwrap(collect('John Doe'));\n\n" "// ['John Doe']\n\n" "Collection::unwrap(['John Doe']);\n\n" "// ['John Doe']\n\n" "Collection::unwrap('John Doe');\n\n" -"// 'John Doe'\n" -msgstr "Collection::unwrap(collect('John Doe'));\n\n" -"// ['John Doe']\n\n" -"Collection::unwrap(['John Doe']);\n\n" -"// ['John Doe']\n\n" -"Collection::unwrap('John Doe');\n\n" -"// 'John Doe'\n" - -#: docs/10.x/collections.md:block 687 (header) -msgid "`value()` {.collection-method}" -msgstr "`value()` {.collection-method}" - -#: docs/10.x/collections.md:block 688 (paragraph) -msgid "The `value` method retrieves a given value from the first element of the collection:" -msgstr "`value` 方法會取得該 Collection 中的第一個元素內取得給定的值:" +"// 'John Doe'" +msgstr "" -#: docs/10.x/collections.md:block 689 (code) -msgid "$collection = collect([\n" -" ['product' => 'Desk', 'price' => 200],\n" -" ['product' => 'Speaker', 'price' => 400],\n" -"]);\n\n" -"$value = $collection->value('price');\n\n" -"// 200\n" -msgstr "$collection = collect([\n" -" ['product' => 'Desk', 'price' => 200],\n" -" ['product' => 'Speaker', 'price' => 400],\n" -"]);\n\n" -"$value = $collection->value('price');\n\n" -"// 200\n" +# CODE +#: ./docs/10.x/collections.md:2742 +#: ./docs/11.x/collections.md:2826 +#: ./docs/master/collections.md:2742 +msgid "collect([2, 4, 3, 1, 5])\n" +" ->sort()\n" +" ->tap(function (Collection $collection) {\n" +" Log::debug('Values after sorting', $collection->values()->all());\n" +" })\n" +" ->shift();\n\n" +"// 1" +msgstr "" -#: docs/10.x/collections.md:block 691 (header) +# P +#: ./docs/8.x/collections.md:2746 +#: ./docs/9.x/collections.md:2882 +#: ./docs/10.x/collections.md:2996 +#: ./docs/11.x/collections.md:3080 +#: ./docs/master/collections.md:2996 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2747 +#: ./docs/9.x/collections.md:2883 +#: ./docs/10.x/collections.md:2997 +#: ./docs/11.x/collections.md:3081 +#: ./docs/master/collections.md:2997 msgid "`values()` {.collection-method}" -msgstr "`values()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 692 (paragraph) +# P +#: ./docs/8.x/collections.md:2749 +#: ./docs/9.x/collections.md:2885 +#: ./docs/10.x/collections.md:2999 +#: ./docs/11.x/collections.md:3083 +#: ./docs/master/collections.md:2999 msgid "The `values` method returns a new collection with the keys reset to consecutive integers:" -msgstr "`values` 方法回傳將索引鍵重設為連續整數的新 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 693 (code) +# CODE +#: ./docs/8.x/collections.md:2751 +#: ./docs/9.x/collections.md:2887 +#: ./docs/10.x/collections.md:3001 +#: ./docs/11.x/collections.md:3085 +#: ./docs/master/collections.md:3001 msgid "$collection = collect([\n" " 10 => ['product' => 'Desk', 'price' => 200],\n" " 11 => ['product' => 'Desk', 'price' => 200],\n" @@ -4404,203 +8704,318 @@ msgid "$collection = collect([\n" " 0 => ['product' => 'Desk', 'price' => 200],\n" " 1 => ['product' => 'Desk', 'price' => 200],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" 10 => ['product' => 'Desk', 'price' => 200],\n" -" 11 => ['product' => 'Desk', 'price' => 200],\n" -"]);\n\n" -"$values = $collection->values();\n\n" -"$values->all();\n\n" -"/*\n" -" [\n" -" 0 => ['product' => 'Desk', 'price' => 200],\n" -" 1 => ['product' => 'Desk', 'price' => 200],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2756 +#: ./docs/11.x/collections.md:2840 +#: ./docs/master/collections.md:2756 +msgid "$collection = Collection::times(10, function (int $number) {\n" +" return $number * 9;\n" +"});\n\n" +"$collection->all();\n\n" +"// [9, 18, 27, 36, 45, 54, 63, 72, 81, 90]" +msgstr "" -#: docs/10.x/collections.md:block 695 (header) +# P +#: ./docs/8.x/collections.md:2767 +#: ./docs/9.x/collections.md:2903 +#: ./docs/10.x/collections.md:3017 +#: ./docs/11.x/collections.md:3101 +#: ./docs/master/collections.md:3017 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2768 +#: ./docs/9.x/collections.md:2904 +#: ./docs/10.x/collections.md:3018 +#: ./docs/11.x/collections.md:3102 +#: ./docs/master/collections.md:3018 msgid "`when()` {.collection-method}" -msgstr "`when()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 696 (paragraph) -msgid "The `when` method will execute the given callback when the first argument given to the method evaluates to `true`. The collection instance and the first argument given to the `when` method will be provided to the closure:" -msgstr "`when` 方法會在傳給該方法的第一個引數取值為 `true` 時執行給定的回呼。Collection 實體與傳給 `when` 方法的第一個引數會被提供給該閉包:" +# P +#: ./docs/8.x/collections.md:2770 +msgid "The `when` method will execute the given callback when the first argument given to the method evaluates to `true`:" +msgstr "" -#: docs/10.x/collections.md:block 697 (code) +# CODE +#: ./docs/8.x/collections.md:2772 msgid "$collection = collect([1, 2, 3]);\n\n" -"$collection->when(true, function (Collection $collection, int $value) {\n" -" return $collection->push(4);\n" -"});\n\n" -"$collection->when(false, function (Collection $collection, int $value) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 4]\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$collection->when(true, function (Collection $collection, int $value) {\n" +"$collection->when(true, function ($collection) {\n" " return $collection->push(4);\n" "});\n\n" -"$collection->when(false, function (Collection $collection, int $value) {\n" +"$collection->when(false, function ($collection) {\n" " return $collection->push(5);\n" "});\n\n" "$collection->all();\n\n" -"// [1, 2, 3, 4]\n" +"// [1, 2, 3, 4]" +msgstr "" -#: docs/10.x/collections.md:block 698 (paragraph) +# P +#: ./docs/8.x/collections.md:2786 +#: ./docs/9.x/collections.md:2922 +#: ./docs/10.x/collections.md:3036 +#: ./docs/11.x/collections.md:3120 +#: ./docs/master/collections.md:3036 msgid "A second callback may be passed to the `when` method. The second callback will be executed when the first argument given to the `when` method evaluates to `false`:" -msgstr "可以傳入第二個回呼給 `when` 方法。當第一個傳給 `when` 方法的引數為 `false` 時,會呼叫第二個回呼:" +msgstr "" -#: docs/10.x/collections.md:block 699 (code) +# CODE +#: ./docs/8.x/collections.md:2788 msgid "$collection = collect([1, 2, 3]);\n\n" -"$collection->when(false, function (Collection $collection, int $value) {\n" +"$collection->when(false, function ($collection) {\n" " return $collection->push(4);\n" -"}, function (Collection $collection) {\n" +"}, function ($collection) {\n" " return $collection->push(5);\n" "});\n\n" "$collection->all();\n\n" -"// [1, 2, 3, 5]\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$collection->when(false, function (Collection $collection, int $value) {\n" -" return $collection->push(4);\n" -"}, function (Collection $collection) {\n" -" return $collection->push(5);\n" +"// [1, 2, 3, 5]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2798 +#: ./docs/11.x/collections.md:2882 +#: ./docs/master/collections.md:2798 +msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" +"$collection->transform(function (int $item, int $key) {\n" +" return $item * 2;\n" "});\n\n" "$collection->all();\n\n" -"// [1, 2, 3, 5]\n" +"// [2, 4, 6, 8, 10]" +msgstr "" -#: docs/10.x/collections.md:block 700 (paragraph) +# P +#: ./docs/8.x/collections.md:2800 +#: ./docs/9.x/collections.md:2936 +#: ./docs/10.x/collections.md:3050 +#: ./docs/11.x/collections.md:3134 +#: ./docs/master/collections.md:3050 msgid "For the inverse of `when`, see the [`unless`](#method-unless) method." -msgstr "請參考 [`unless`](#method-unless) 方法以瞭解與 `when` 相反的方法。" +msgstr "" -#: docs/10.x/collections.md:block 702 (header) +# P +#: ./docs/8.x/collections.md:2802 +#: ./docs/9.x/collections.md:2938 +#: ./docs/10.x/collections.md:3052 +#: ./docs/11.x/collections.md:3136 +#: ./docs/master/collections.md:3052 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2803 +#: ./docs/9.x/collections.md:2939 +#: ./docs/10.x/collections.md:3053 +#: ./docs/11.x/collections.md:3137 +#: ./docs/master/collections.md:3053 msgid "`whenEmpty()` {.collection-method}" -msgstr "`whenEmpty()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 703 (paragraph) +# P +#: ./docs/8.x/collections.md:2805 +#: ./docs/9.x/collections.md:2941 +#: ./docs/10.x/collections.md:3055 +#: ./docs/11.x/collections.md:3139 +#: ./docs/master/collections.md:3055 msgid "The `whenEmpty` method will execute the given callback when the collection is empty:" -msgstr "`whenEmpty` 方法會在該 Collection 為空時執行給定的回呼:" +msgstr "" -#: docs/10.x/collections.md:block 704 (code) +# CODE +#: ./docs/8.x/collections.md:2807 +#: ./docs/9.x/collections.md:2943 msgid "$collection = collect(['Michael', 'Tom']);\n\n" -"$collection->whenEmpty(function (Collection $collection) {\n" -" return $collection->push('Adam');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['Michael', 'Tom']\n\n\n" -"$collection = collect();\n\n" -"$collection->whenEmpty(function (Collection $collection) {\n" -" return $collection->push('Adam');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['Adam']\n" -msgstr "$collection = collect(['Michael', 'Tom']);\n\n" -"$collection->whenEmpty(function (Collection $collection) {\n" +"$collection->whenEmpty(function ($collection) {\n" " return $collection->push('Adam');\n" "});\n\n" "$collection->all();\n\n" "// ['Michael', 'Tom']\n\n\n" "$collection = collect();\n\n" -"$collection->whenEmpty(function (Collection $collection) {\n" +"$collection->whenEmpty(function ($collection) {\n" " return $collection->push('Adam');\n" "});\n\n" "$collection->all();\n\n" -"// ['Adam']\n" +"// ['Adam']" +msgstr "" -#: docs/10.x/collections.md:block 705 (paragraph) +# P +#: ./docs/8.x/collections.md:2828 +#: ./docs/9.x/collections.md:2964 +#: ./docs/10.x/collections.md:3078 +#: ./docs/11.x/collections.md:3162 +#: ./docs/master/collections.md:3078 msgid "A second closure may be passed to the `whenEmpty` method that will be executed when the collection is not empty:" -msgstr "可以傳入第二個閉包給 `whenEmpty` 方法,該閉包會在該 Collection 不為空時被執行:" +msgstr "" -#: docs/10.x/collections.md:block 706 (code) +# CODE +#: ./docs/8.x/collections.md:2830 +#: ./docs/9.x/collections.md:2966 msgid "$collection = collect(['Michael', 'Tom']);\n\n" -"$collection->whenEmpty(function (Collection $collection) {\n" -" return $collection->push('Adam');\n" -"}, function (Collection $collection) {\n" -" return $collection->push('Taylor');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['Michael', 'Tom', 'Taylor']\n" -msgstr "$collection = collect(['Michael', 'Tom']);\n\n" -"$collection->whenEmpty(function (Collection $collection) {\n" +"$collection->whenEmpty(function ($collection) {\n" " return $collection->push('Adam');\n" -"}, function (Collection $collection) {\n" +"}, function ($collection) {\n" " return $collection->push('Taylor');\n" "});\n\n" "$collection->all();\n\n" -"// ['Michael', 'Tom', 'Taylor']\n" +"// ['Michael', 'Tom', 'Taylor']" +msgstr "" -#: docs/10.x/collections.md:block 707 (paragraph) +# P +#: ./docs/8.x/collections.md:2842 +#: ./docs/9.x/collections.md:2978 +#: ./docs/10.x/collections.md:3092 +#: ./docs/11.x/collections.md:3176 +#: ./docs/master/collections.md:3092 msgid "For the inverse of `whenEmpty`, see the [`whenNotEmpty`](#method-whennotempty) method." -msgstr "請參考 [`whenNotEmpty`](#method-whennotempty) 方法以瞭解與 `whenEmpty` 相反的方法。" +msgstr "" -#: docs/10.x/collections.md:block 709 (header) +# P +#: ./docs/8.x/collections.md:2844 +#: ./docs/9.x/collections.md:2980 +#: ./docs/10.x/collections.md:3094 +#: ./docs/11.x/collections.md:3178 +#: ./docs/master/collections.md:3094 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2845 +#: ./docs/9.x/collections.md:2981 +#: ./docs/10.x/collections.md:3095 +#: ./docs/11.x/collections.md:3179 +#: ./docs/master/collections.md:3095 msgid "`whenNotEmpty()` {.collection-method}" -msgstr "`whenNotEmpty()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 710 (paragraph) +# P +#: ./docs/8.x/collections.md:2847 +#: ./docs/9.x/collections.md:2983 +#: ./docs/10.x/collections.md:3097 +#: ./docs/11.x/collections.md:3181 +#: ./docs/master/collections.md:3097 msgid "The `whenNotEmpty` method will execute the given callback when the collection is not empty:" -msgstr "`whenNotEmpty` 方法會在該 Collection 不為空時執行給定的回呼:" +msgstr "" -#: docs/10.x/collections.md:block 711 (code) +# CODE +#: ./docs/8.x/collections.md:2849 +#: ./docs/9.x/collections.md:2985 msgid "$collection = collect(['michael', 'tom']);\n\n" -"$collection->whenNotEmpty(function (Collection $collection) {\n" +"$collection->whenNotEmpty(function ($collection) {\n" " return $collection->push('adam');\n" "});\n\n" "$collection->all();\n\n" "// ['michael', 'tom', 'adam']\n\n\n" "$collection = collect();\n\n" -"$collection->whenNotEmpty(function (Collection $collection) {\n" -" return $collection->push('adam');\n" -"});\n\n" -"$collection->all();\n\n" -"// []\n" -msgstr "$collection = collect(['michael', 'tom']);\n\n" -"$collection->whenNotEmpty(function (Collection $collection) {\n" +"$collection->whenNotEmpty(function ($collection) {\n" " return $collection->push('adam');\n" "});\n\n" "$collection->all();\n\n" -"// ['michael', 'tom', 'adam']\n\n\n" -"$collection = collect();\n\n" -"$collection->whenNotEmpty(function (Collection $collection) {\n" -" return $collection->push('adam');\n" -"});\n\n" -"$collection->all();\n\n" -"// []\n" +"// []" +msgstr "" -#: docs/10.x/collections.md:block 712 (paragraph) +# P +#: ./docs/9.x/collections.md:2868 +#: ./docs/10.x/collections.md:2982 +#: ./docs/11.x/collections.md:3066 +#: ./docs/master/collections.md:2982 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/collections.md:2869 +#: ./docs/10.x/collections.md:2983 +#: ./docs/11.x/collections.md:3067 +#: ./docs/master/collections.md:2983 +msgid "`value()` {.collection-method}" +msgstr "" + +# P +#: ./docs/8.x/collections.md:2870 +#: ./docs/9.x/collections.md:3006 +#: ./docs/10.x/collections.md:3120 +#: ./docs/11.x/collections.md:3204 +#: ./docs/master/collections.md:3120 msgid "A second closure may be passed to the `whenNotEmpty` method that will be executed when the collection is empty:" -msgstr "可以傳入第二個閉包給 `whenNotEmpty` 方法,該閉包會在該 Collection 為空時被執行:" +msgstr "" -#: docs/10.x/collections.md:block 713 (code) +# P +#: ./docs/9.x/collections.md:2871 +#: ./docs/10.x/collections.md:2985 +#: ./docs/11.x/collections.md:3069 +#: ./docs/master/collections.md:2985 +msgid "The `value` method retrieves a given value from the first element of the collection:" +msgstr "" + +# CODE +#: ./docs/8.x/collections.md:2872 +#: ./docs/9.x/collections.md:3008 msgid "$collection = collect();\n\n" -"$collection->whenNotEmpty(function (Collection $collection) {\n" -" return $collection->push('adam');\n" -"}, function (Collection $collection) {\n" -" return $collection->push('taylor');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['taylor']\n" -msgstr "$collection = collect();\n\n" -"$collection->whenNotEmpty(function (Collection $collection) {\n" +"$collection->whenNotEmpty(function ($collection) {\n" " return $collection->push('adam');\n" -"}, function (Collection $collection) {\n" +"}, function ($collection) {\n" " return $collection->push('taylor');\n" "});\n\n" "$collection->all();\n\n" -"// ['taylor']\n" +"// ['taylor']" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:2873 +#: ./docs/10.x/collections.md:2987 +#: ./docs/11.x/collections.md:3071 +#: ./docs/master/collections.md:2987 +msgid "$collection = collect([\n" +" ['product' => 'Desk', 'price' => 200],\n" +" ['product' => 'Speaker', 'price' => 400],\n" +"]);\n\n" +"$value = $collection->value('price');\n\n" +"// 200" +msgstr "" -#: docs/10.x/collections.md:block 714 (paragraph) +# P +#: ./docs/8.x/collections.md:2884 +#: ./docs/9.x/collections.md:3020 +#: ./docs/10.x/collections.md:3134 +#: ./docs/11.x/collections.md:3218 +#: ./docs/master/collections.md:3134 msgid "For the inverse of `whenNotEmpty`, see the [`whenEmpty`](#method-whenempty) method." -msgstr "請參考 [`whenEmpty`](#method-whenempty) 方法以瞭解與 `whenNotEmpty` 相反的方法。" +msgstr "" -#: docs/10.x/collections.md:block 716 (header) +# P +#: ./docs/8.x/collections.md:2886 +#: ./docs/9.x/collections.md:3022 +#: ./docs/10.x/collections.md:3136 +#: ./docs/11.x/collections.md:3220 +#: ./docs/master/collections.md:3136 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2887 +#: ./docs/9.x/collections.md:3023 +#: ./docs/10.x/collections.md:3137 +#: ./docs/11.x/collections.md:3221 +#: ./docs/master/collections.md:3137 msgid "`where()` {.collection-method}" -msgstr "`where()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 717 (paragraph) +# P +#: ./docs/8.x/collections.md:2889 +#: ./docs/9.x/collections.md:3025 +#: ./docs/10.x/collections.md:3139 +#: ./docs/11.x/collections.md:3223 +#: ./docs/master/collections.md:3139 msgid "The `where` method filters the collection by a given key / value pair:" -msgstr "`where` 方法使用給定的索引鍵/值配對來篩選該 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 718 (code) +# CODE +#: ./docs/8.x/collections.md:2891 +#: ./docs/9.x/collections.md:3027 +#: ./docs/10.x/collections.md:3141 +#: ./docs/11.x/collections.md:3225 +#: ./docs/master/collections.md:3141 msgid "$collection = collect([\n" " ['product' => 'Desk', 'price' => 200],\n" " ['product' => 'Chair', 'price' => 100],\n" @@ -4614,31 +9029,68 @@ msgid "$collection = collect([\n" " ['product' => 'Chair', 'price' => 100],\n" " ['product' => 'Door', 'price' => 100],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['product' => 'Desk', 'price' => 200],\n" -" ['product' => 'Chair', 'price' => 100],\n" -" ['product' => 'Bookcase', 'price' => 150],\n" -" ['product' => 'Door', 'price' => 100],\n" -"]);\n\n" -"$filtered = $collection->where('price', 100);\n\n" -"$filtered->all();\n\n" +"*/" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2895 +#: ./docs/11.x/collections.md:2979 +#: ./docs/master/collections.md:2895 +msgid "$unique = $collection->unique(function (array $item) {\n" +" return $item['brand'].$item['type'];\n" +"});\n\n" +"$unique->values()->all();\n\n" "/*\n" " [\n" -" ['product' => 'Chair', 'price' => 100],\n" -" ['product' => 'Door', 'price' => 100],\n" +" ['name' => 'iPhone 6', 'brand' => 'Apple', 'type' => 'phone'],\n" +" ['name' => 'Apple Watch', 'brand' => 'Apple', 'type' => 'watch'],\n" +" ['name' => 'Galaxy S6', 'brand' => 'Samsung', 'type' => 'phone'],\n" +" ['name' => 'Galaxy Gear', 'brand' => 'Samsung', 'type' => 'watch'],\n" " ]\n" -"*/\n" +"*/" +msgstr "" + +# P +#: ./docs/9.x/collections.md:2906 +#: ./docs/10.x/collections.md:3020 +#: ./docs/11.x/collections.md:3104 +#: ./docs/master/collections.md:3020 +msgid "The `when` method will execute the given callback when the first argument given to the method evaluates to `true`. The collection instance and the first argument given to the `when` method will be provided to the closure:" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:2908 +msgid "$collection = collect([1, 2, 3]);\n\n" +"$collection->when(true, function ($collection, $value) {\n" +" return $collection->push(4);\n" +"});\n\n" +"$collection->when(false, function ($collection, $value) {\n" +" return $collection->push(5);\n" +"});\n\n" +"$collection->all();\n\n" +"// [1, 2, 3, 4]" +msgstr "" -#: docs/10.x/collections.md:block 719 (paragraph) +# P +#: ./docs/8.x/collections.md:2909 +#: ./docs/9.x/collections.md:3045 +#: ./docs/10.x/collections.md:3159 +#: ./docs/11.x/collections.md:3243 +#: ./docs/master/collections.md:3159 msgid "The `where` method uses \"loose\" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value. Use the [`whereStrict`](#method-wherestrict) method to filter using \"strict\" comparisons." -msgstr "`where` 方法在比對項目值時使用了「鬆散 (Loose)」的比對方法。這標示,具有整數值的字串與一個有相同值的整數會被視為相同。請使用 [`whereStrict`](#method-wherestrict) 方法來使用「嚴格 (Strict)」比對進行過濾。" +msgstr "" -#: docs/10.x/collections.md:block 720 (paragraph) -msgid "Optionally, you may pass a comparison operator as the second parameter. Supported operators are: '===', '!==', '!=', '==', '=', '<>', '>', '<', '>=', and '<=':" -msgstr "也可以選擇性地傳入一個比較運算子來作為該方法的第二個參數。支援的運算子有 '===', '!==', '!=', '==', '=', '<>', '>', '<', '>=', 與 '<=':" +# P +#: ./docs/8.x/collections.md:2911 +msgid "Optionally, you may pass a comparison operator as the second parameter." +msgstr "" -#: docs/10.x/collections.md:block 721 (code) +# CODE +#: ./docs/8.x/collections.md:2913 +#: ./docs/9.x/collections.md:3049 +#: ./docs/10.x/collections.md:3163 +#: ./docs/11.x/collections.md:3247 +#: ./docs/master/collections.md:3163 msgid "$collection = collect([\n" " ['name' => 'Jim', 'deleted_at' => '2019-01-01 00:00:00'],\n" " ['name' => 'Sally', 'deleted_at' => '2019-01-02 00:00:00'],\n" @@ -4651,38 +9103,96 @@ msgid "$collection = collect([\n" " ['name' => 'Jim', 'deleted_at' => '2019-01-01 00:00:00'],\n" " ['name' => 'Sally', 'deleted_at' => '2019-01-02 00:00:00'],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['name' => 'Jim', 'deleted_at' => '2019-01-01 00:00:00'],\n" -" ['name' => 'Sally', 'deleted_at' => '2019-01-02 00:00:00'],\n" -" ['name' => 'Sue', 'deleted_at' => null],\n" -"]);\n\n" -"$filtered = $collection->where('deleted_at', '!=', null);\n\n" -"$filtered->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'Jim', 'deleted_at' => '2019-01-01 00:00:00'],\n" -" ['name' => 'Sally', 'deleted_at' => '2019-01-02 00:00:00'],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" + +# CODE +#: ./docs/9.x/collections.md:2924 +msgid "$collection = collect([1, 2, 3]);\n\n" +"$collection->when(false, function ($collection, $value) {\n" +" return $collection->push(4);\n" +"}, function ($collection) {\n" +" return $collection->push(5);\n" +"});\n\n" +"$collection->all();\n\n" +"// [1, 2, 3, 5]" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2925 +#: ./docs/11.x/collections.md:3009 +#: ./docs/master/collections.md:2925 +msgid "$collection = collect([1, 2, 3]);\n\n" +"$collection->unless(true, function (Collection $collection) {\n" +" return $collection->push(4);\n" +"});\n\n" +"$collection->unless(false, function (Collection $collection) {\n" +" return $collection->push(5);\n" +"});\n\n" +"$collection->all();\n\n" +"// [1, 2, 3, 5]" +msgstr "" -#: docs/10.x/collections.md:block 723 (header) +# P +#: ./docs/8.x/collections.md:2930 +#: ./docs/9.x/collections.md:3066 +#: ./docs/10.x/collections.md:3180 +#: ./docs/11.x/collections.md:3264 +#: ./docs/master/collections.md:3180 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2931 +#: ./docs/9.x/collections.md:3067 +#: ./docs/10.x/collections.md:3181 +#: ./docs/11.x/collections.md:3265 +#: ./docs/master/collections.md:3181 msgid "`whereStrict()` {.collection-method}" -msgstr "`whereStrict()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 724 (paragraph) +# P +#: ./docs/8.x/collections.md:2933 +#: ./docs/9.x/collections.md:3069 +#: ./docs/10.x/collections.md:3183 +#: ./docs/11.x/collections.md:3267 +#: ./docs/master/collections.md:3183 msgid "This method has the same signature as the [`where`](#method-where) method; however, all values are compared using \"strict\" comparisons." -msgstr "該方法與 [`where`](#method-where) 方法的簽章一致。不過,所有的數值比對都是使用「嚴格」比對模式。" +msgstr "" -#: docs/10.x/collections.md:block 726 (header) +# P +#: ./docs/8.x/collections.md:2935 +#: ./docs/9.x/collections.md:3071 +#: ./docs/10.x/collections.md:3185 +#: ./docs/11.x/collections.md:3269 +#: ./docs/master/collections.md:3185 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2936 +#: ./docs/9.x/collections.md:3072 +#: ./docs/10.x/collections.md:3186 +#: ./docs/11.x/collections.md:3270 +#: ./docs/master/collections.md:3186 msgid "`whereBetween()` {.collection-method}" -msgstr "`whereBetween()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 727 (paragraph) +# P +#: ./docs/8.x/collections.md:2938 +#: ./docs/9.x/collections.md:3074 +#: ./docs/10.x/collections.md:3188 +#: ./docs/11.x/collections.md:3272 +#: ./docs/master/collections.md:3188 msgid "The `whereBetween` method filters the collection by determining if a specified item value is within a given range:" -msgstr "`whereBetween` 方法會判斷特定項目值是否介於給定範圍來篩選該 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 728 (code) +# CODE +#: ./docs/8.x/collections.md:2940 +#: ./docs/9.x/collections.md:3076 +#: ./docs/10.x/collections.md:3190 +#: ./docs/11.x/collections.md:3274 +#: ./docs/master/collections.md:3190 msgid "$collection = collect([\n" " ['product' => 'Desk', 'price' => 200],\n" " ['product' => 'Chair', 'price' => 80],\n" @@ -4698,33 +9208,56 @@ msgid "$collection = collect([\n" " ['product' => 'Bookcase', 'price' => 150],\n" " ['product' => 'Door', 'price' => 100],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['product' => 'Desk', 'price' => 200],\n" -" ['product' => 'Chair', 'price' => 80],\n" -" ['product' => 'Bookcase', 'price' => 150],\n" -" ['product' => 'Pencil', 'price' => 30],\n" -" ['product' => 'Door', 'price' => 100],\n" -"]);\n\n" -"$filtered = $collection->whereBetween('price', [100, 200]);\n\n" -"$filtered->all();\n\n" -"/*\n" -" [\n" -" ['product' => 'Desk', 'price' => 200],\n" -" ['product' => 'Bookcase', 'price' => 150],\n" -" ['product' => 'Door', 'price' => 100],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:2941 +#: ./docs/11.x/collections.md:3025 +#: ./docs/master/collections.md:2941 +msgid "$collection = collect([1, 2, 3]);\n\n" +"$collection->unless(true, function (Collection $collection) {\n" +" return $collection->push(4);\n" +"}, function (Collection $collection) {\n" +" return $collection->push(5);\n" +"});\n\n" +"$collection->all();\n\n" +"// [1, 2, 3, 5]" +msgstr "" -#: docs/10.x/collections.md:block 730 (header) +# P +#: ./docs/8.x/collections.md:2960 +#: ./docs/9.x/collections.md:3096 +#: ./docs/10.x/collections.md:3210 +#: ./docs/11.x/collections.md:3294 +#: ./docs/master/collections.md:3210 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2961 +#: ./docs/9.x/collections.md:3097 +#: ./docs/10.x/collections.md:3211 +#: ./docs/11.x/collections.md:3295 +#: ./docs/master/collections.md:3211 msgid "`whereIn()` {.collection-method}" -msgstr "`whereIn()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 731 (paragraph) +# P +#: ./docs/8.x/collections.md:2963 +#: ./docs/9.x/collections.md:3099 +#: ./docs/10.x/collections.md:3213 +#: ./docs/11.x/collections.md:3297 +#: ./docs/master/collections.md:3213 msgid "The `whereIn` method removes elements from the collection that do not have a specified item value that is contained within the given array:" -msgstr "`whereIn` 方法會從該 Collection 中移除項目值不包含在給定陣列中的項目:" +msgstr "" -#: docs/10.x/collections.md:block 732 (code) +# CODE +#: ./docs/8.x/collections.md:2965 +#: ./docs/9.x/collections.md:3101 +#: ./docs/10.x/collections.md:3215 +#: ./docs/11.x/collections.md:3299 +#: ./docs/master/collections.md:3215 msgid "$collection = collect([\n" " ['product' => 'Desk', 'price' => 200],\n" " ['product' => 'Chair', 'price' => 100],\n" @@ -4738,43 +9271,78 @@ msgid "$collection = collect([\n" " ['product' => 'Desk', 'price' => 200],\n" " ['product' => 'Bookcase', 'price' => 150],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['product' => 'Desk', 'price' => 200],\n" -" ['product' => 'Chair', 'price' => 100],\n" -" ['product' => 'Bookcase', 'price' => 150],\n" -" ['product' => 'Door', 'price' => 100],\n" -"]);\n\n" -"$filtered = $collection->whereIn('price', [150, 200]);\n\n" -"$filtered->all();\n\n" -"/*\n" -" [\n" -" ['product' => 'Desk', 'price' => 200],\n" -" ['product' => 'Bookcase', 'price' => 150],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 733 (paragraph) +# P +#: ./docs/8.x/collections.md:2983 +#: ./docs/9.x/collections.md:3119 +#: ./docs/10.x/collections.md:3233 +#: ./docs/11.x/collections.md:3317 +#: ./docs/master/collections.md:3233 msgid "The `whereIn` method uses \"loose\" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value. Use the [`whereInStrict`](#method-whereinstrict) method to filter using \"strict\" comparisons." -msgstr "`whereIn` 方法在比對項目值時使用了「鬆散 (Loose)」的比對方法。這標示,具有整數值的字串與一個有相同值的整數會被視為相同。請使用 [`whereInStrict`](#method-whereinstrict) 方法來使用「嚴格 (Strict)」比對進行過濾。" +msgstr "" -#: docs/10.x/collections.md:block 735 (header) +# P +#: ./docs/8.x/collections.md:2985 +#: ./docs/9.x/collections.md:3121 +#: ./docs/10.x/collections.md:3235 +#: ./docs/11.x/collections.md:3319 +#: ./docs/master/collections.md:3235 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2986 +#: ./docs/9.x/collections.md:3122 +#: ./docs/10.x/collections.md:3236 +#: ./docs/11.x/collections.md:3320 +#: ./docs/master/collections.md:3236 msgid "`whereInStrict()` {.collection-method}" -msgstr "`whereInStrict()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 736 (paragraph) +# P +#: ./docs/8.x/collections.md:2988 +#: ./docs/9.x/collections.md:3124 +#: ./docs/10.x/collections.md:3238 +#: ./docs/11.x/collections.md:3322 +#: ./docs/master/collections.md:3238 msgid "This method has the same signature as the [`whereIn`](#method-wherein) method; however, all values are compared using \"strict\" comparisons." -msgstr "該方法與 [`whereIn`](#method-wherein) 方法的簽章一致。不過,所有的數值比對都是使用「嚴格」比對模式。" +msgstr "" -#: docs/10.x/collections.md:block 738 (header) +# P +#: ./docs/8.x/collections.md:2990 +#: ./docs/9.x/collections.md:3126 +#: ./docs/10.x/collections.md:3240 +#: ./docs/11.x/collections.md:3324 +#: ./docs/master/collections.md:3240 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:2991 +#: ./docs/9.x/collections.md:3127 +#: ./docs/10.x/collections.md:3241 +#: ./docs/11.x/collections.md:3325 +#: ./docs/master/collections.md:3241 msgid "`whereInstanceOf()` {.collection-method}" -msgstr "`whereInstanceOf()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 739 (paragraph) +# P +#: ./docs/8.x/collections.md:2993 +#: ./docs/9.x/collections.md:3129 +#: ./docs/10.x/collections.md:3243 +#: ./docs/11.x/collections.md:3327 +#: ./docs/master/collections.md:3243 msgid "The `whereInstanceOf` method filters the collection by a given class type:" -msgstr "`whereInstanceOf` 方法使用給定的類別型別來篩選該 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 740 (code) +# CODE +#: ./docs/8.x/collections.md:2995 +#: ./docs/9.x/collections.md:3131 +#: ./docs/10.x/collections.md:3245 +#: ./docs/11.x/collections.md:3329 +#: ./docs/master/collections.md:3245 msgid "use App\\Models\\User;\n" "use App\\Models\\Post;\n\n" "$collection = collect([\n" @@ -4784,27 +9352,42 @@ msgid "use App\\Models\\User;\n" "]);\n\n" "$filtered = $collection->whereInstanceOf(User::class);\n\n" "$filtered->all();\n\n" -"// [App\\Models\\User, App\\Models\\User]\n" -msgstr "use App\\Models\\User;\n" -"use App\\Models\\Post;\n\n" -"$collection = collect([\n" -" new User,\n" -" new User,\n" -" new Post,\n" -"]);\n\n" -"$filtered = $collection->whereInstanceOf(User::class);\n\n" -"$filtered->all();\n\n" -"// [App\\Models\\User, App\\Models\\User]\n" +"// [App\\Models\\User, App\\Models\\User]" +msgstr "" -#: docs/10.x/collections.md:block 742 (header) +# P +#: ./docs/8.x/collections.md:3010 +#: ./docs/9.x/collections.md:3146 +#: ./docs/10.x/collections.md:3260 +#: ./docs/11.x/collections.md:3344 +#: ./docs/master/collections.md:3260 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:3011 +#: ./docs/9.x/collections.md:3147 +#: ./docs/10.x/collections.md:3261 +#: ./docs/11.x/collections.md:3345 +#: ./docs/master/collections.md:3261 msgid "`whereNotBetween()` {.collection-method}" -msgstr "`whereNotBetween()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 743 (paragraph) +# P +#: ./docs/8.x/collections.md:3013 +#: ./docs/9.x/collections.md:3149 +#: ./docs/10.x/collections.md:3263 +#: ./docs/11.x/collections.md:3347 +#: ./docs/master/collections.md:3263 msgid "The `whereNotBetween` method filters the collection by determining if a specified item value is outside of a given range:" -msgstr "`whereNotBetween` 方法會判斷特定項目值是否不在給定範圍來篩選該 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 744 (code) +# CODE +#: ./docs/8.x/collections.md:3015 +#: ./docs/9.x/collections.md:3151 +#: ./docs/10.x/collections.md:3265 +#: ./docs/11.x/collections.md:3349 +#: ./docs/master/collections.md:3265 msgid "$collection = collect([\n" " ['product' => 'Desk', 'price' => 200],\n" " ['product' => 'Chair', 'price' => 80],\n" @@ -4819,32 +9402,71 @@ msgid "$collection = collect([\n" " ['product' => 'Chair', 'price' => 80],\n" " ['product' => 'Pencil', 'price' => 30],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['product' => 'Desk', 'price' => 200],\n" -" ['product' => 'Chair', 'price' => 80],\n" -" ['product' => 'Bookcase', 'price' => 150],\n" -" ['product' => 'Pencil', 'price' => 30],\n" -" ['product' => 'Door', 'price' => 100],\n" -"]);\n\n" -"$filtered = $collection->whereNotBetween('price', [100, 200]);\n\n" -"$filtered->all();\n\n" -"/*\n" -" [\n" -" ['product' => 'Chair', 'price' => 80],\n" -" ['product' => 'Pencil', 'price' => 30],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:3022 +#: ./docs/11.x/collections.md:3106 +#: ./docs/master/collections.md:3022 +msgid "$collection = collect([1, 2, 3]);\n\n" +"$collection->when(true, function (Collection $collection, int $value) {\n" +" return $collection->push(4);\n" +"});\n\n" +"$collection->when(false, function (Collection $collection, int $value) {\n" +" return $collection->push(5);\n" +"});\n\n" +"$collection->all();\n\n" +"// [1, 2, 3, 4]" +msgstr "" -#: docs/10.x/collections.md:block 746 (header) +# P +#: ./docs/8.x/collections.md:3034 +#: ./docs/9.x/collections.md:3170 +#: ./docs/10.x/collections.md:3284 +#: ./docs/11.x/collections.md:3368 +#: ./docs/master/collections.md:3284 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:3035 +#: ./docs/9.x/collections.md:3171 +#: ./docs/10.x/collections.md:3285 +#: ./docs/11.x/collections.md:3369 +#: ./docs/master/collections.md:3285 msgid "`whereNotIn()` {.collection-method}" -msgstr "`whereNotIn()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 747 (paragraph) +# P +#: ./docs/8.x/collections.md:3037 +#: ./docs/9.x/collections.md:3173 +#: ./docs/10.x/collections.md:3287 +#: ./docs/11.x/collections.md:3371 +#: ./docs/master/collections.md:3287 msgid "The `whereNotIn` method removes elements from the collection that have a specified item value that is contained within the given array:" -msgstr "`whereNotIn` 方法會從該 Collection 中移除項目值不在給定陣列中的項目:" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:3038 +#: ./docs/11.x/collections.md:3122 +#: ./docs/master/collections.md:3038 +msgid "$collection = collect([1, 2, 3]);\n\n" +"$collection->when(false, function (Collection $collection, int $value) {\n" +" return $collection->push(4);\n" +"}, function (Collection $collection) {\n" +" return $collection->push(5);\n" +"});\n\n" +"$collection->all();\n\n" +"// [1, 2, 3, 5]" +msgstr "" -#: docs/10.x/collections.md:block 748 (code) +# CODE +#: ./docs/8.x/collections.md:3039 +#: ./docs/9.x/collections.md:3175 +#: ./docs/10.x/collections.md:3289 +#: ./docs/11.x/collections.md:3373 +#: ./docs/master/collections.md:3289 msgid "$collection = collect([\n" " ['product' => 'Desk', 'price' => 200],\n" " ['product' => 'Chair', 'price' => 100],\n" @@ -4858,43 +9480,104 @@ msgid "$collection = collect([\n" " ['product' => 'Chair', 'price' => 100],\n" " ['product' => 'Door', 'price' => 100],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['product' => 'Desk', 'price' => 200],\n" -" ['product' => 'Chair', 'price' => 100],\n" -" ['product' => 'Bookcase', 'price' => 150],\n" -" ['product' => 'Door', 'price' => 100],\n" -"]);\n\n" -"$filtered = $collection->whereNotIn('price', [150, 200]);\n\n" -"$filtered->all();\n\n" -"/*\n" -" [\n" -" ['product' => 'Chair', 'price' => 100],\n" -" ['product' => 'Door', 'price' => 100],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" + +# P +#: ./docs/9.x/collections.md:3047 +#: ./docs/10.x/collections.md:3161 +#: ./docs/11.x/collections.md:3245 +#: ./docs/master/collections.md:3161 +msgid "Optionally, you may pass a comparison operator as the second parameter. Supported operators are: '===', '!==', '!=', '==', '=', '<>', '>', '<', '>=', and '<=':" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:3057 +#: ./docs/11.x/collections.md:3141 +#: ./docs/master/collections.md:3057 +msgid "$collection = collect(['Michael', 'Tom']);\n\n" +"$collection->whenEmpty(function (Collection $collection) {\n" +" return $collection->push('Adam');\n" +"});\n\n" +"$collection->all();\n\n" +"// ['Michael', 'Tom']\n\n\n" +"$collection = collect();\n\n" +"$collection->whenEmpty(function (Collection $collection) {\n" +" return $collection->push('Adam');\n" +"});\n\n" +"$collection->all();\n\n" +"// ['Adam']" +msgstr "" -#: docs/10.x/collections.md:block 749 (paragraph) +# P +#: ./docs/8.x/collections.md:3057 +#: ./docs/9.x/collections.md:3193 +#: ./docs/10.x/collections.md:3307 +#: ./docs/11.x/collections.md:3391 +#: ./docs/master/collections.md:3307 msgid "The `whereNotIn` method uses \"loose\" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value. Use the [`whereNotInStrict`](#method-wherenotinstrict) method to filter using \"strict\" comparisons." -msgstr "`whereNotIn` 方法在比對項目值時使用了「鬆散 (Loose)」的比對方法。這標示,具有整數值的字串與一個有相同值的整數會被視為相同。請使用 [`whereNotInStrict`](#method-wherenotinstrict) 方法來使用「嚴格 (Strict)」比對進行過濾。" +msgstr "" -#: docs/10.x/collections.md:block 751 (header) +# P +#: ./docs/8.x/collections.md:3059 +#: ./docs/9.x/collections.md:3195 +#: ./docs/10.x/collections.md:3309 +#: ./docs/11.x/collections.md:3393 +#: ./docs/master/collections.md:3309 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:3060 +#: ./docs/9.x/collections.md:3196 +#: ./docs/10.x/collections.md:3310 +#: ./docs/11.x/collections.md:3394 +#: ./docs/master/collections.md:3310 msgid "`whereNotInStrict()` {.collection-method}" -msgstr "`whereNotInStrict()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 752 (paragraph) +# P +#: ./docs/8.x/collections.md:3062 +#: ./docs/9.x/collections.md:3198 +#: ./docs/10.x/collections.md:3312 +#: ./docs/11.x/collections.md:3396 +#: ./docs/master/collections.md:3312 msgid "This method has the same signature as the [`whereNotIn`](#method-wherenotin) method; however, all values are compared using \"strict\" comparisons." -msgstr "該方法與 [`whereNotIn`](#method-wherenotin) 方法的簽章一致。不過,所有的數值比對都是使用「嚴格」比對模式。" +msgstr "" -#: docs/10.x/collections.md:block 754 (header) +# P +#: ./docs/8.x/collections.md:3064 +#: ./docs/9.x/collections.md:3200 +#: ./docs/10.x/collections.md:3314 +#: ./docs/11.x/collections.md:3398 +#: ./docs/master/collections.md:3314 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:3065 +#: ./docs/9.x/collections.md:3201 +#: ./docs/10.x/collections.md:3315 +#: ./docs/11.x/collections.md:3399 +#: ./docs/master/collections.md:3315 msgid "`whereNotNull()` {.collection-method}" -msgstr "`whereNotNull()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 755 (paragraph) +# P +#: ./docs/8.x/collections.md:3067 +#: ./docs/9.x/collections.md:3203 +#: ./docs/10.x/collections.md:3317 +#: ./docs/11.x/collections.md:3401 +#: ./docs/master/collections.md:3317 msgid "The `whereNotNull` method returns items from the collection where the given key is not `null`:" -msgstr "`whereNotNull` 方法回傳該 Collection 中給定索引鍵不為 `null` 的項目:" +msgstr "" -#: docs/10.x/collections.md:block 756 (code) +# CODE +#: ./docs/8.x/collections.md:3069 +#: ./docs/9.x/collections.md:3205 +#: ./docs/10.x/collections.md:3319 +#: ./docs/11.x/collections.md:3403 +#: ./docs/master/collections.md:3319 msgid "$collection = collect([\n" " ['name' => 'Desk'],\n" " ['name' => null],\n" @@ -4907,30 +9590,56 @@ msgid "$collection = collect([\n" " ['name' => 'Desk'],\n" " ['name' => 'Bookcase'],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['name' => 'Desk'],\n" -" ['name' => null],\n" -" ['name' => 'Bookcase'],\n" -"]);\n\n" -"$filtered = $collection->whereNotNull('name');\n\n" -"$filtered->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'Desk'],\n" -" ['name' => 'Bookcase'],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" -#: docs/10.x/collections.md:block 758 (header) +# CODE +#: ./docs/10.x/collections.md:3080 +#: ./docs/11.x/collections.md:3164 +#: ./docs/master/collections.md:3080 +msgid "$collection = collect(['Michael', 'Tom']);\n\n" +"$collection->whenEmpty(function (Collection $collection) {\n" +" return $collection->push('Adam');\n" +"}, function (Collection $collection) {\n" +" return $collection->push('Taylor');\n" +"});\n\n" +"$collection->all();\n\n" +"// ['Michael', 'Tom', 'Taylor']" +msgstr "" + +# P +#: ./docs/8.x/collections.md:3086 +#: ./docs/9.x/collections.md:3222 +#: ./docs/10.x/collections.md:3336 +#: ./docs/11.x/collections.md:3420 +#: ./docs/master/collections.md:3336 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:3087 +#: ./docs/9.x/collections.md:3223 +#: ./docs/10.x/collections.md:3337 +#: ./docs/11.x/collections.md:3421 +#: ./docs/master/collections.md:3337 msgid "`whereNull()` {.collection-method}" -msgstr "`whereNull()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 759 (paragraph) +# P +#: ./docs/8.x/collections.md:3089 +#: ./docs/9.x/collections.md:3225 +#: ./docs/10.x/collections.md:3339 +#: ./docs/11.x/collections.md:3423 +#: ./docs/master/collections.md:3339 msgid "The `whereNull` method returns items from the collection where the given key is `null`:" -msgstr "`whereNull` 方法回傳該 Collection 中給定索引鍵為 `null` 的項目:" +msgstr "" -#: docs/10.x/collections.md:block 760 (code) +# CODE +#: ./docs/8.x/collections.md:3091 +#: ./docs/9.x/collections.md:3227 +#: ./docs/10.x/collections.md:3341 +#: ./docs/11.x/collections.md:3425 +#: ./docs/master/collections.md:3341 msgid "$collection = collect([\n" " ['name' => 'Desk'],\n" " ['name' => null],\n" @@ -4942,29 +9651,60 @@ msgid "$collection = collect([\n" " [\n" " ['name' => null],\n" " ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['name' => 'Desk'],\n" -" ['name' => null],\n" -" ['name' => 'Bookcase'],\n" -"]);\n\n" -"$filtered = $collection->whereNull('name');\n\n" -"$filtered->all();\n\n" -"/*\n" -" [\n" -" ['name' => null],\n" -" ]\n" -"*/\n" +"*/" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:3099 +#: ./docs/11.x/collections.md:3183 +#: ./docs/master/collections.md:3099 +msgid "$collection = collect(['michael', 'tom']);\n\n" +"$collection->whenNotEmpty(function (Collection $collection) {\n" +" return $collection->push('adam');\n" +"});\n\n" +"$collection->all();\n\n" +"// ['michael', 'tom', 'adam']\n\n\n" +"$collection = collect();\n\n" +"$collection->whenNotEmpty(function (Collection $collection) {\n" +" return $collection->push('adam');\n" +"});\n\n" +"$collection->all();\n\n" +"// []" +msgstr "" -#: docs/10.x/collections.md:block 762 (header) +# P +#: ./docs/8.x/collections.md:3108 +#: ./docs/9.x/collections.md:3244 +#: ./docs/10.x/collections.md:3358 +#: ./docs/11.x/collections.md:3441 +#: ./docs/master/collections.md:3358 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:3109 +#: ./docs/9.x/collections.md:3245 +#: ./docs/10.x/collections.md:3359 +#: ./docs/11.x/collections.md:3442 +#: ./docs/master/collections.md:3359 msgid "`wrap()` {.collection-method}" -msgstr "`wrap()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 763 (paragraph) +# P +#: ./docs/8.x/collections.md:3111 +#: ./docs/9.x/collections.md:3247 +#: ./docs/10.x/collections.md:3361 +#: ./docs/11.x/collections.md:3444 +#: ./docs/master/collections.md:3361 msgid "The static `wrap` method wraps the given value in a collection when applicable:" -msgstr "靜態 `wrap` 方法會在可能的情況下將給定值包裝成 Collection:" +msgstr "" -#: docs/10.x/collections.md:block 764 (code) +# CODE +#: ./docs/8.x/collections.md:3113 +#: ./docs/9.x/collections.md:3249 +#: ./docs/10.x/collections.md:3363 +#: ./docs/11.x/collections.md:3446 +#: ./docs/master/collections.md:3363 msgid "use Illuminate\\Support\\Collection;\n\n" "$collection = Collection::wrap('John Doe');\n\n" "$collection->all();\n\n" @@ -4974,83 +9714,185 @@ msgid "use Illuminate\\Support\\Collection;\n\n" "// ['John Doe']\n\n" "$collection = Collection::wrap(collect('John Doe'));\n\n" "$collection->all();\n\n" -"// ['John Doe']\n" -msgstr "use Illuminate\\Support\\Collection;\n\n" -"$collection = Collection::wrap('John Doe');\n\n" -"$collection->all();\n\n" -"// ['John Doe']\n\n" -"$collection = Collection::wrap(['John Doe']);\n\n" -"$collection->all();\n\n" -"// ['John Doe']\n\n" -"$collection = Collection::wrap(collect('John Doe'));\n\n" +"// ['John Doe']" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:3122 +#: ./docs/11.x/collections.md:3206 +#: ./docs/master/collections.md:3122 +msgid "$collection = collect();\n\n" +"$collection->whenNotEmpty(function (Collection $collection) {\n" +" return $collection->push('adam');\n" +"}, function (Collection $collection) {\n" +" return $collection->push('taylor');\n" +"});\n\n" "$collection->all();\n\n" -"// ['John Doe']\n" +"// ['taylor']" +msgstr "" -#: docs/10.x/collections.md:block 766 (header) +# P +#: ./docs/8.x/collections.md:3133 +#: ./docs/9.x/collections.md:3269 +#: ./docs/10.x/collections.md:3383 +#: ./docs/11.x/collections.md:3466 +#: ./docs/master/collections.md:3383 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:3134 +#: ./docs/9.x/collections.md:3270 +#: ./docs/10.x/collections.md:3384 +#: ./docs/11.x/collections.md:3467 +#: ./docs/master/collections.md:3384 msgid "`zip()` {.collection-method}" -msgstr "`zip()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 767 (paragraph) +# P +#: ./docs/8.x/collections.md:3136 +#: ./docs/9.x/collections.md:3272 +#: ./docs/10.x/collections.md:3386 +#: ./docs/11.x/collections.md:3469 +#: ./docs/master/collections.md:3386 msgid "The `zip` method merges together the values of the given array with the values of the original collection at their corresponding index:" -msgstr "`zip` 方法將給定陣列與原始 Collection 在其對應索引上合併在一起:" +msgstr "" -#: docs/10.x/collections.md:block 768 (code) +# CODE +#: ./docs/8.x/collections.md:3138 +#: ./docs/9.x/collections.md:3274 +#: ./docs/10.x/collections.md:3388 +#: ./docs/11.x/collections.md:3471 +#: ./docs/master/collections.md:3388 msgid "$collection = collect(['Chair', 'Desk']);\n\n" "$zipped = $collection->zip([100, 200]);\n\n" "$zipped->all();\n\n" -"// [['Chair', 100], ['Desk', 200]]\n" -msgstr "$collection = collect(['Chair', 'Desk']);\n\n" -"$zipped = $collection->zip([100, 200]);\n\n" -"$zipped->all();\n\n" -"// [['Chair', 100], ['Desk', 200]]\n" +"// [['Chair', 100], ['Desk', 200]]" +msgstr "" -#: docs/10.x/collections.md:block 770 (header) +# P +#: ./docs/8.x/collections.md:3146 +#: ./docs/9.x/collections.md:3282 +#: ./docs/10.x/collections.md:3396 +#: ./docs/11.x/collections.md:3479 +#: ./docs/master/collections.md:3396 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/collections.md:3147 +#: ./docs/9.x/collections.md:3283 +#: ./docs/10.x/collections.md:3397 +#: ./docs/11.x/collections.md:3480 +#: ./docs/master/collections.md:3397 msgid "Higher Order Messages" -msgstr "高階訊息" +msgstr "" -#: docs/10.x/collections.md:block 771 (paragraph) +# P +#: ./docs/8.x/collections.md:3149 +#: ./docs/9.x/collections.md:3285 +#: ./docs/10.x/collections.md:3399 +#: ./docs/11.x/collections.md:3482 +#: ./docs/master/collections.md:3399 msgid "Collections also provide support for \"higher order messages\", which are short-cuts for performing common actions on collections. The collection methods that provide higher order messages are: [`average`](#method-average), [`avg`](#method-avg), [`contains`](#method-contains), [`each`](#method-each), [`every`](#method-every), [`filter`](#method-filter), [`first`](#method-first), [`flatMap`](#method-flatmap), [`groupBy`](#method-groupby), [`keyBy`](#method-keyby), [`map`](#method-map), [`max`](#method-max), [`min`](#method-min), [`partition`](#method-partition), [`reject`](#method-reject), [`skipUntil`](#method-skipuntil), [`skipWhile`](#method-skipwhile), [`some`](#method-some), [`sortBy`](#method-sortby), [`sortByDesc`](#method-sortbydesc), [`sum`](#method-sum), [`takeUntil`](#method-takeuntil), [`takeWhile`](#method-takewhile), and [`unique`](#method-unique)." -msgstr "Collection 也提供了「高階訊息 (Higher Order Message)」的支援,在 Collection 上進行常見操作的時候可用來當作捷徑。有提供高階訊息的 Collection 方法為:[`average`](#method-average), [`avg`](#method-avg), [`contains`](#method-contains), [`each`](#method-each), [`every`](#method-every), [`filter`](#method-filter), [`first`](#method-first), [`flatMap`](#method-flatmap), [`groupBy`](#method-groupby), [`keyBy`](#method-keyby), [`map`](#method-map), [`max`](#method-max), [`min`](#method-min), [`partition`](#method-partition), [`reject`](#method-reject), [`skipUntil`](#method-skipuntil), [`skipWhile`](#method-skipwhile), [`some`](#method-some), [`sortBy`](#method-sortby), [`sortByDesc`](#method-sortbydesc), [`sum`](#method-sum), [`takeUntil`](#method-takeuntil), [`takeWhile`](#method-takewhile) 與 [`unique`](#method-unique)。" +msgstr "" -#: docs/10.x/collections.md:block 772 (paragraph) +# P +#: ./docs/8.x/collections.md:3151 +#: ./docs/9.x/collections.md:3287 +#: ./docs/10.x/collections.md:3401 +#: ./docs/11.x/collections.md:3484 +#: ./docs/master/collections.md:3401 msgid "Each higher order message can be accessed as a dynamic property on a collection instance. For instance, let's use the `each` higher order message to call a method on each object within a collection:" -msgstr "各個高階訊息都可作為 Collection 實體上的一個動態屬性來存取。舉例來說,我們來使用 `each` 高階訊息,在 Collection 中的各個物件上呼叫一個方法:" +msgstr "" -#: docs/10.x/collections.md:block 773 (code) +# CODE +#: ./docs/8.x/collections.md:3153 +#: ./docs/9.x/collections.md:3289 +#: ./docs/10.x/collections.md:3403 +#: ./docs/11.x/collections.md:3486 +#: ./docs/master/collections.md:3403 msgid "use App\\Models\\User;\n\n" "$users = User::where('votes', '>', 500)->get();\n\n" -"$users->each->markAsVip();\n" -msgstr "use App\\Models\\User;\n\n" -"$users = User::where('votes', '>', 500)->get();\n\n" -"$users->each->markAsVip();\n" +"$users->each->markAsVip();" +msgstr "" -#: docs/10.x/collections.md:block 774 (paragraph) +# P +#: ./docs/8.x/collections.md:3159 +#: ./docs/9.x/collections.md:3295 +#: ./docs/10.x/collections.md:3409 +#: ./docs/11.x/collections.md:3492 +#: ./docs/master/collections.md:3409 msgid "Likewise, we can use the `sum` higher order message to gather the total number of \"votes\" for a collection of users:" -msgstr "類似地,我們也可以使用 `sum` 高階訊息來取得使用者 Collection 中的所有「votes」加總:" +msgstr "" -#: docs/10.x/collections.md:block 775 (code) +# CODE +#: ./docs/8.x/collections.md:3161 +#: ./docs/9.x/collections.md:3297 +#: ./docs/10.x/collections.md:3411 +#: ./docs/11.x/collections.md:3494 +#: ./docs/master/collections.md:3411 msgid "$users = User::where('group', 'Development')->get();\n\n" -"return $users->sum->votes;\n" -msgstr "$users = User::where('group', 'Development')->get();\n\n" -"return $users->sum->votes;\n" +"return $users->sum->votes;" +msgstr "" -#: docs/10.x/collections.md:block 777 (header) +# P +#: ./docs/8.x/collections.md:3165 +#: ./docs/9.x/collections.md:3301 +#: ./docs/10.x/collections.md:3415 +#: ./docs/11.x/collections.md:3498 +#: ./docs/master/collections.md:3415 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/collections.md:3166 +#: ./docs/9.x/collections.md:3302 +#: ./docs/10.x/collections.md:3416 +#: ./docs/11.x/collections.md:3499 +#: ./docs/master/collections.md:3416 msgid "Lazy Collections" -msgstr "Lazy Collection" +msgstr "" -#: docs/10.x/collections.md:block 780 (quote) -msgid "**Warning** Before learning more about Laravel's lazy collections, take some time to familiarize yourself with [PHP generators](https://www.php.net/manual/en/language.generators.overview.php)." -msgstr "**Warning** 在開始學習有關 Laravel 的 Lazy Collection 之前,建議先花點時間熟悉 [PHP Generator](https://www.php.net/manual/en/language.generators.overview.php)。" +# P +#: ./docs/8.x/collections.md:3168 +#: ./docs/9.x/collections.md:3304 +#: ./docs/10.x/collections.md:3418 +#: ./docs/11.x/collections.md:3501 +#: ./docs/master/collections.md:3418 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/collections.md:3171 +#: ./docs/9.x/collections.md:3308 +#: ./docs/10.x/collections.md:3422 +#: ./docs/11.x/collections.md:3505 +#: ./docs/master/collections.md:3422 +msgid "Before learning more about Laravel's lazy collections, take some time to familiarize yourself with [PHP generators](https://www.php.net/manual/en/language.generators.overview.php)." +msgstr "" -#: docs/10.x/collections.md:block 781 (paragraph) +# P +#: ./docs/8.x/collections.md:3173 +#: ./docs/9.x/collections.md:3310 +#: ./docs/10.x/collections.md:3424 +#: ./docs/11.x/collections.md:3507 +#: ./docs/master/collections.md:3424 msgid "To supplement the already powerful `Collection` class, the `LazyCollection` class leverages PHP's [generators](https://www.php.net/manual/en/language.generators.overview.php) to allow you to work with very large datasets while keeping memory usage low." -msgstr "為了補強已經很強大的 `Collection` 類別,`LazyCollection` 類別使用了 PHP 的 [Generator](https://www.php.net/manual/en/language.generators.overview.php) 來讓你能在不使用太多記憶體的情況下處理非常大量的資料。" +msgstr "" -#: docs/10.x/collections.md:block 782 (paragraph) +# P +#: ./docs/8.x/collections.md:3175 +#: ./docs/9.x/collections.md:3312 +#: ./docs/10.x/collections.md:3426 +#: ./docs/11.x/collections.md:3509 +#: ./docs/master/collections.md:3426 msgid "For example, imagine your application needs to process a multi-gigabyte log file while taking advantage of Laravel's collection methods to parse the logs. Instead of reading the entire file into memory at once, lazy collections may be used to keep only a small part of the file in memory at a given time:" -msgstr "舉例來說,假設你的專案需要處理一個好幾 GB 的日誌檔,但又想利用 Laravel 的 Collection 方法來解析日誌。比起一次將整個檔案讀入記憶體,使用 Lazy Collection 的話,記憶體內一次就只會保持一小部分的檔案。" +msgstr "" -#: docs/10.x/collections.md:block 783 (code) +# CODE +#: ./docs/8.x/collections.md:3177 +#: ./docs/9.x/collections.md:3314 msgid "use App\\Models\\LogEntry;\n" "use Illuminate\\Support\\LazyCollection;\n\n" "LazyCollection::make(function () {\n" @@ -5058,129 +9900,302 @@ msgid "use App\\Models\\LogEntry;\n" " while (($line = fgets($handle)) !== false) {\n" " yield $line;\n" " }\n" -"})->chunk(4)->map(function (array $lines) {\n" +"})->chunk(4)->map(function ($lines) {\n" " return LogEntry::fromLines($lines);\n" "})->each(function (LogEntry $logEntry) {\n" " // Process the log entry...\n" -"});\n" -msgstr "use App\\Models\\LogEntry;\n" -"use Illuminate\\Support\\LazyCollection;\n\n" -"LazyCollection::make(function () {\n" -" $handle = fopen('log.txt', 'r');\n\n" -" while (($line = fgets($handle)) !== false) {\n" -" yield $line;\n" -" }\n" -"})->chunk(4)->map(function (array $lines) {\n" -" return LogEntry::fromLines($lines);\n" -"})->each(function (LogEntry $logEntry) {\n" -" // 處理 Log Entry...\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/collections.md:block 784 (paragraph) +# P +#: ./docs/8.x/collections.md:3192 +#: ./docs/9.x/collections.md:3329 +#: ./docs/10.x/collections.md:3443 +#: ./docs/11.x/collections.md:3526 +#: ./docs/master/collections.md:3443 msgid "Or, imagine you need to iterate through 10,000 Eloquent models. When using traditional Laravel collections, all 10,000 Eloquent models must be loaded into memory at the same time:" -msgstr "或者,想像一下需要迭代 10,000 個 Eloquent Model。在使用傳統 Laravel Collection 時,必須要一次將 10,000 個 Eloquent Model 讀入記憶體:" +msgstr "" -#: docs/10.x/collections.md:block 785 (code) +# CODE +#: ./docs/8.x/collections.md:3194 +#: ./docs/9.x/collections.md:3331 msgid "use App\\Models\\User;\n\n" -"$users = User::all()->filter(function (User $user) {\n" -" return $user->id > 500;\n" -"});\n" -msgstr "use App\\Models\\User;\n\n" -"$users = User::all()->filter(function (User $user) {\n" +"$users = User::all()->filter(function ($user) {\n" " return $user->id > 500;\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/collections.md:block 786 (paragraph) +# P +#: ./docs/8.x/collections.md:3200 +#: ./docs/9.x/collections.md:3337 +#: ./docs/10.x/collections.md:3451 +#: ./docs/11.x/collections.md:3534 +#: ./docs/master/collections.md:3451 msgid "However, the query builder's `cursor` method returns a `LazyCollection` instance. This allows you to still only run a single query against the database but also only keep one Eloquent model loaded in memory at a time. In this example, the `filter` callback is not executed until we actually iterate over each user individually, allowing for a drastic reduction in memory usage:" -msgstr "不過,Query Builder 的 `cursor` 方法回傳了一個 `LazyCollection` 實體。這樣一來就能讓你在只執行單一資料庫查詢的情況下,一次只將一個 Eloquent Model 讀入記憶體。在這個例子中,`filter` 回呼只會在實際迭代到個別使用者的時候才會被執行,讓我們能有效降低記憶體使用:" +msgstr "" -#: docs/10.x/collections.md:block 787 (code) +# CODE +#: ./docs/8.x/collections.md:3202 +#: ./docs/9.x/collections.md:3339 msgid "use App\\Models\\User;\n\n" -"$users = User::cursor()->filter(function (User $user) {\n" -" return $user->id > 500;\n" -"});\n\n" -"foreach ($users as $user) {\n" -" echo $user->id;\n" -"}\n" -msgstr "use App\\Models\\User;\n\n" -"$users = User::cursor()->filter(function (User $user) {\n" +"$users = User::cursor()->filter(function ($user) {\n" " return $user->id > 500;\n" "});\n\n" "foreach ($users as $user) {\n" " echo $user->id;\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/collections.md:block 789 (header) +# P +#: ./docs/8.x/collections.md:3212 +#: ./docs/9.x/collections.md:3349 +#: ./docs/10.x/collections.md:3463 +#: ./docs/11.x/collections.md:3546 +#: ./docs/master/collections.md:3463 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/collections.md:3213 +#: ./docs/9.x/collections.md:3350 +#: ./docs/10.x/collections.md:3464 +#: ./docs/11.x/collections.md:3547 +#: ./docs/master/collections.md:3464 msgid "Creating Lazy Collections" -msgstr "建立 Lazy Collection" +msgstr "" -#: docs/10.x/collections.md:block 790 (paragraph) +# P +#: ./docs/8.x/collections.md:3215 +#: ./docs/9.x/collections.md:3352 +#: ./docs/10.x/collections.md:3466 +#: ./docs/11.x/collections.md:3549 +#: ./docs/master/collections.md:3466 msgid "To create a lazy collection instance, you should pass a PHP generator function to the collection's `make` method:" -msgstr "若要建立 Lazy Collection 實體,應傳入 PHP Generator 方法至該 Collection 的 `make` 方法:" +msgstr "" -#: docs/10.x/collections.md:block 791 (code) +# CODE +#: ./docs/8.x/collections.md:3217 +#: ./docs/9.x/collections.md:3354 +#: ./docs/10.x/collections.md:3468 +#: ./docs/11.x/collections.md:3551 +#: ./docs/master/collections.md:3468 msgid "use Illuminate\\Support\\LazyCollection;\n\n" "LazyCollection::make(function () {\n" " $handle = fopen('log.txt', 'r');\n\n" " while (($line = fgets($handle)) !== false) {\n" " yield $line;\n" " }\n" -"});\n" -msgstr "use Illuminate\\Support\\LazyCollection;\n\n" -"LazyCollection::make(function () {\n" -" $handle = fopen('log.txt', 'r');\n\n" -" while (($line = fgets($handle)) !== false) {\n" -" yield $line;\n" -" }\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/collections.md:block 793 (header) +# P +#: ./docs/8.x/collections.md:3227 +#: ./docs/9.x/collections.md:3364 +#: ./docs/10.x/collections.md:3478 +#: ./docs/11.x/collections.md:3561 +#: ./docs/master/collections.md:3478 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/collections.md:3228 +#: ./docs/9.x/collections.md:3365 +#: ./docs/10.x/collections.md:3479 +#: ./docs/11.x/collections.md:3562 +#: ./docs/master/collections.md:3479 msgid "The Enumerable Contract" -msgstr "Enumerable Contract" +msgstr "" -#: docs/10.x/collections.md:block 794 (paragraph) +# P +#: ./docs/8.x/collections.md:3230 +#: ./docs/9.x/collections.md:3367 +#: ./docs/10.x/collections.md:3481 +#: ./docs/11.x/collections.md:3564 +#: ./docs/master/collections.md:3481 msgid "Almost all methods available on the `Collection` class are also available on the `LazyCollection` class. Both of these classes implement the `Illuminate\\Support\\Enumerable` contract, which defines the following methods:" -msgstr "幾乎所有在 `Collection` 類別中可用的方法都可在 `LazyCollection` 類別上使用。這兩個類別都實作了 `Illuminate\\Support\\Enumerable` Contract,該介面定義了下列方法:" +msgstr "" -#: docs/10.x/collections.md:block 797 (paragraph) -msgid "[all](#method-all) [average](#method-average) [avg](#method-avg) [chunk](#method-chunk) [chunkWhile](#method-chunkwhile) [collapse](#method-collapse) [collect](#method-collect) [combine](#method-combine) [concat](#method-concat) [contains](#method-contains) [containsStrict](#method-containsstrict) [count](#method-count) [countBy](#method-countBy) [crossJoin](#method-crossjoin) [dd](#method-dd) [diff](#method-diff) [diffAssoc](#method-diffassoc) [diffKeys](#method-diffkeys) [dump](#method-dump) [duplicates](#method-duplicates) [duplicatesStrict](#method-duplicatesstrict) [each](#method-each) [eachSpread](#method-eachspread) [every](#method-every) [except](#method-except) [filter](#method-filter) [first](#method-first) [firstOrFail](#method-first-or-fail) [firstWhere](#method-first-where) [flatMap](#method-flatmap) [flatten](#method-flatten) [flip](#method-flip) [forPage](#method-forpage) [get](#method-get) [groupBy](#method-groupby) [has](#method-has) [implode](#method-implode) [intersect](#method-intersect) [intersectAssoc](#method-intersectAssoc) [intersectByKeys](#method-intersectbykeys) [isEmpty](#method-isempty) [isNotEmpty](#method-isnotempty) [join](#method-join) [keyBy](#method-keyby) [keys](#method-keys) [last](#method-last) [macro](#method-macro) [make](#method-make) [map](#method-map) [mapInto](#method-mapinto) [mapSpread](#method-mapspread) [mapToGroups](#method-maptogroups) [mapWithKeys](#method-mapwithkeys) [max](#method-max) [median](#method-median) [merge](#method-merge) [mergeRecursive](#method-mergerecursive) [min](#method-min) [mode](#method-mode) [nth](#method-nth) [only](#method-only) [pad](#method-pad) [partition](#method-partition) [pipe](#method-pipe) [pluck](#method-pluck) [random](#method-random) [reduce](#method-reduce) [reject](#method-reject) [replace](#method-replace) [replaceRecursive](#method-replacerecursive) [reverse](#method-reverse) [search](#method-search) [shuffle](#method-shuffle) [skip](#method-skip) [slice](#method-slice) [sole](#method-sole) [some](#method-some) [sort](#method-sort) [sortBy](#method-sortby) [sortByDesc](#method-sortbydesc) [sortKeys](#method-sortkeys) [sortKeysDesc](#method-sortkeysdesc) [split](#method-split) [sum](#method-sum) [take](#method-take) [tap](#method-tap) [times](#method-times) [toArray](#method-toarray) [toJson](#method-tojson) [union](#method-union) [unique](#method-unique) [uniqueStrict](#method-uniquestrict) [unless](#method-unless) [unlessEmpty](#method-unlessempty) [unlessNotEmpty](#method-unlessnotempty) [unwrap](#method-unwrap) [values](#method-values) [when](#method-when) [whenEmpty](#method-whenempty) [whenNotEmpty](#method-whennotempty) [where](#method-where) [whereStrict](#method-wherestrict) [whereBetween](#method-wherebetween) [whereIn](#method-wherein) [whereInStrict](#method-whereinstrict) [whereInstanceOf](#method-whereinstanceof) [whereNotBetween](#method-wherenotbetween) [whereNotIn](#method-wherenotin) [whereNotInStrict](#method-wherenotinstrict) [wrap](#method-wrap) [zip](#method-zip)" -msgstr "[all](#method-all) [average](#method-average) [avg](#method-avg) [chunk](#method-chunk) [chunkWhile](#method-chunkwhile) [collapse](#method-collapse) [collect](#method-collect) [combine](#method-combine) [concat](#method-concat) [contains](#method-contains) [containsStrict](#method-containsstrict) [count](#method-count) [countBy](#method-countBy) [crossJoin](#method-crossjoin) [dd](#method-dd) [diff](#method-diff) [diffAssoc](#method-diffassoc) [diffKeys](#method-diffkeys) [dump](#method-dump) [duplicates](#method-duplicates) [duplicatesStrict](#method-duplicatesstrict) [each](#method-each) [eachSpread](#method-eachspread) [every](#method-every) [except](#method-except) [filter](#method-filter) [first](#method-first) [firstOrFail](#method-first-or-fail) [firstWhere](#method-first-where) [flatMap](#method-flatmap) [flatten](#method-flatten) [flip](#method-flip) [forPage](#method-forpage) [get](#method-get) [groupBy](#method-groupby) [has](#method-has) [implode](#method-implode) [intersect](#method-intersect) [intersectAssoc](#method-intersectAssoc) [intersectByKeys](#method-intersectbykeys) [isEmpty](#method-isempty) [isNotEmpty](#method-isnotempty) [join](#method-join) [keyBy](#method-keyby) [keys](#method-keys) [last](#method-last) [macro](#method-macro) [make](#method-make) [map](#method-map) [mapInto](#method-mapinto) [mapSpread](#method-mapspread) [mapToGroups](#method-maptogroups) [mapWithKeys](#method-mapwithkeys) [max](#method-max) [median](#method-median) [merge](#method-merge) [mergeRecursive](#method-mergerecursive) [min](#method-min) [mode](#method-mode) [nth](#method-nth) [only](#method-only) [pad](#method-pad) [partition](#method-partition) [pipe](#method-pipe) [pluck](#method-pluck) [random](#method-random) [reduce](#method-reduce) [reject](#method-reject) [replace](#method-replace) [replaceRecursive](#method-replacerecursive) [reverse](#method-reverse) [search](#method-search) [shuffle](#method-shuffle) [skip](#method-skip) [slice](#method-slice) [sole](#method-sole) [some](#method-some) [sort](#method-sort) [sortBy](#method-sortby) [sortByDesc](#method-sortbydesc) [sortKeys](#method-sortkeys) [sortKeysDesc](#method-sortkeysdesc) [split](#method-split) [sum](#method-sum) [take](#method-take) [tap](#method-tap) [times](#method-times) [toArray](#method-toarray) [toJson](#method-tojson) [union](#method-union) [unique](#method-unique) [uniqueStrict](#method-uniquestrict) [unless](#method-unless) [unlessEmpty](#method-unlessempty) [unlessNotEmpty](#method-unlessnotempty) [unwrap](#method-unwrap) [values](#method-values) [when](#method-when) [whenEmpty](#method-whenempty) [whenNotEmpty](#method-whennotempty) [where](#method-where) [whereStrict](#method-wherestrict) [whereBetween](#method-wherebetween) [whereIn](#method-wherein) [whereInStrict](#method-whereinstrict) [whereInstanceOf](#method-whereinstanceof) [whereNotBetween](#method-wherenotbetween) [whereNotIn](#method-wherenotin) [whereNotInStrict](#method-wherenotinstrict) [wrap](#method-wrap) [zip](#method-zip)" +# P +#: ./docs/8.x/collections.md:3234 +msgid "[all](#method-all)\n" +"[average](#method-average)\n" +"[avg](#method-avg)\n" +"[chunk](#method-chunk)\n" +"[chunkWhile](#method-chunkwhile)\n" +"[collapse](#method-collapse)\n" +"[collect](#method-collect)\n" +"[combine](#method-combine)\n" +"[concat](#method-concat)\n" +"[contains](#method-contains)\n" +"[containsStrict](#method-containsstrict)\n" +"[count](#method-count)\n" +"[countBy](#method-countBy)\n" +"[crossJoin](#method-crossjoin)\n" +"[dd](#method-dd)\n" +"[diff](#method-diff)\n" +"[diffAssoc](#method-diffassoc)\n" +"[diffKeys](#method-diffkeys)\n" +"[dump](#method-dump)\n" +"[duplicates](#method-duplicates)\n" +"[duplicatesStrict](#method-duplicatesstrict)\n" +"[each](#method-each)\n" +"[eachSpread](#method-eachspread)\n" +"[every](#method-every)\n" +"[except](#method-except)\n" +"[filter](#method-filter)\n" +"[first](#method-first)\n" +"[firstWhere](#method-first-where)\n" +"[flatMap](#method-flatmap)\n" +"[flatten](#method-flatten)\n" +"[flip](#method-flip)\n" +"[forPage](#method-forpage)\n" +"[get](#method-get)\n" +"[groupBy](#method-groupby)\n" +"[has](#method-has)\n" +"[implode](#method-implode)\n" +"[intersect](#method-intersect)\n" +"[intersectByKeys](#method-intersectbykeys)\n" +"[isEmpty](#method-isempty)\n" +"[isNotEmpty](#method-isnotempty)\n" +"[join](#method-join)\n" +"[keyBy](#method-keyby)\n" +"[keys](#method-keys)\n" +"[last](#method-last)\n" +"[macro](#method-macro)\n" +"[make](#method-make)\n" +"[map](#method-map)\n" +"[mapInto](#method-mapinto)\n" +"[mapSpread](#method-mapspread)\n" +"[mapToGroups](#method-maptogroups)\n" +"[mapWithKeys](#method-mapwithkeys)\n" +"[max](#method-max)\n" +"[median](#method-median)\n" +"[merge](#method-merge)\n" +"[mergeRecursive](#method-mergerecursive)\n" +"[min](#method-min)\n" +"[mode](#method-mode)\n" +"[nth](#method-nth)\n" +"[only](#method-only)\n" +"[pad](#method-pad)\n" +"[partition](#method-partition)\n" +"[pipe](#method-pipe)\n" +"[pluck](#method-pluck)\n" +"[random](#method-random)\n" +"[reduce](#method-reduce)\n" +"[reject](#method-reject)\n" +"[replace](#method-replace)\n" +"[replaceRecursive](#method-replacerecursive)\n" +"[reverse](#method-reverse)\n" +"[search](#method-search)\n" +"[shuffle](#method-shuffle)\n" +"[skip](#method-skip)\n" +"[slice](#method-slice)\n" +"[some](#method-some)\n" +"[sort](#method-sort)\n" +"[sortBy](#method-sortby)\n" +"[sortByDesc](#method-sortbydesc)\n" +"[sortKeys](#method-sortkeys)\n" +"[sortKeysDesc](#method-sortkeysdesc)\n" +"[split](#method-split)\n" +"[sum](#method-sum)\n" +"[take](#method-take)\n" +"[tap](#method-tap)\n" +"[times](#method-times)\n" +"[toArray](#method-toarray)\n" +"[toJson](#method-tojson)\n" +"[union](#method-union)\n" +"[unique](#method-unique)\n" +"[uniqueStrict](#method-uniquestrict)\n" +"[unless](#method-unless)\n" +"[unlessEmpty](#method-unlessempty)\n" +"[unlessNotEmpty](#method-unlessnotempty)\n" +"[unwrap](#method-unwrap)\n" +"[values](#method-values)\n" +"[when](#method-when)\n" +"[whenEmpty](#method-whenempty)\n" +"[whenNotEmpty](#method-whennotempty)\n" +"[where](#method-where)\n" +"[whereStrict](#method-wherestrict)\n" +"[whereBetween](#method-wherebetween)\n" +"[whereIn](#method-wherein)\n" +"[whereInStrict](#method-whereinstrict)\n" +"[whereInstanceOf](#method-whereinstanceof)\n" +"[whereNotBetween](#method-wherenotbetween)\n" +"[whereNotIn](#method-wherenotin)\n" +"[whereNotInStrict](#method-wherenotinstrict)\n" +"[wrap](#method-wrap)\n" +"[zip](#method-zip)" +msgstr "" -#: docs/10.x/collections.md:block 799 (quote) -msgid "**Warning** Methods that mutate the collection (such as `shift`, `pop`, `prepend` etc.) are **not** available on the `LazyCollection` class." -msgstr "**Warning** 會修改 (Mutate) Collection 的方法 (如 `shift`、`pop`、`prepend` 等) 在 `LazyCollection` 類別上都 **不可用**。" +# P +#: ./docs/8.x/collections.md:3345 +#: ./docs/9.x/collections.md:3498 +#: ./docs/10.x/collections.md:3613 +#: ./docs/11.x/collections.md:3696 +#: ./docs/master/collections.md:3613 +msgid "Methods that mutate the collection (such as `shift`, `pop`, `prepend` etc.) are **not** available on the `LazyCollection` class." +msgstr "" -#: docs/10.x/collections.md:block 801 (header) +# P +#: ./docs/8.x/collections.md:3347 +#: ./docs/9.x/collections.md:3500 +#: ./docs/10.x/collections.md:3615 +#: ./docs/11.x/collections.md:3698 +#: ./docs/master/collections.md:3615 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/collections.md:3348 +#: ./docs/9.x/collections.md:3501 +#: ./docs/10.x/collections.md:3616 +#: ./docs/11.x/collections.md:3699 +#: ./docs/master/collections.md:3616 msgid "Lazy Collection Methods" -msgstr "Lazy Collection 方法" +msgstr "" -#: docs/10.x/collections.md:block 802 (paragraph) +# P +#: ./docs/8.x/collections.md:3350 +#: ./docs/9.x/collections.md:3503 +#: ./docs/10.x/collections.md:3618 +#: ./docs/11.x/collections.md:3701 +#: ./docs/master/collections.md:3618 msgid "In addition to the methods defined in the `Enumerable` contract, the `LazyCollection` class contains the following methods:" -msgstr "除了在 `Enumerable` Contract 上定義的方法外,`LazyCollection` 類別還包含了下列方法:" +msgstr "" -#: docs/10.x/collections.md:block 804 (header) +# P +#: ./docs/8.x/collections.md:3352 +#: ./docs/9.x/collections.md:3505 +#: ./docs/10.x/collections.md:3620 +#: ./docs/11.x/collections.md:3703 +#: ./docs/master/collections.md:3620 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:3353 +#: ./docs/9.x/collections.md:3506 +#: ./docs/10.x/collections.md:3621 +#: ./docs/11.x/collections.md:3704 +#: ./docs/master/collections.md:3621 msgid "`takeUntilTimeout()` {.collection-method}" -msgstr "`takeUntilTimeout()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 805 (paragraph) +# P +#: ./docs/8.x/collections.md:3355 +#: ./docs/9.x/collections.md:3508 +#: ./docs/10.x/collections.md:3623 +#: ./docs/11.x/collections.md:3706 +#: ./docs/master/collections.md:3623 msgid "The `takeUntilTimeout` method returns a new lazy collection that will enumerate values until the specified time. After that time, the collection will then stop enumerating:" -msgstr "`takeUntilTimeout` 方法會回傳一個在特定時間前枚舉出值的新 Lazy Collection。在這個時間之後,該 Collection 便會停止枚舉:" +msgstr "" -#: docs/10.x/collections.md:block 806 (code) +# CODE +#: ./docs/8.x/collections.md:3357 +#: ./docs/9.x/collections.md:3510 msgid "$lazyCollection = LazyCollection::times(INF)\n" " ->takeUntilTimeout(now()->addMinute());\n\n" -"$lazyCollection->each(function (int $number) {\n" -" dump($number);\n\n" -" sleep(1);\n" -"});\n\n" -"// 1\n" -"// 2\n" -"// ...\n" -"// 58\n" -"// 59\n" -msgstr "$lazyCollection = LazyCollection::times(INF)\n" -" ->takeUntilTimeout(now()->addMinute());\n\n" -"$lazyCollection->each(function (int $number) {\n" +"$lazyCollection->each(function ($number) {\n" " dump($number);\n\n" " sleep(1);\n" "});\n\n" @@ -5188,65 +10203,218 @@ msgstr "$lazyCollection = LazyCollection::times(INF)\n" "// 2\n" "// ...\n" "// 58\n" -"// 59\n" +"// 59" +msgstr "" -#: docs/10.x/collections.md:block 807 (paragraph) +# P +#: ./docs/8.x/collections.md:3372 +#: ./docs/9.x/collections.md:3525 +#: ./docs/10.x/collections.md:3640 +#: ./docs/11.x/collections.md:3723 +#: ./docs/master/collections.md:3640 msgid "To illustrate the usage of this method, imagine an application that submits invoices from the database using a cursor. You could define a [scheduled task](/docs/{{version}}/scheduling) that runs every 15 minutes and only processes invoices for a maximum of 14 minutes:" -msgstr "為了說明如何使用這個方法,請想像一下有個會使用 Cursor 將發票存入資料庫的專案。我們可以定義一個每 15 分鐘會執行的[排程任務](/docs/{{version}}/scheduling),並在該任務中只處理 14 分鐘的發票:" +msgstr "" -#: docs/10.x/collections.md:block 808 (code) +# CODE +#: ./docs/8.x/collections.md:3374 +#: ./docs/9.x/collections.md:3527 msgid "use App\\Models\\Invoice;\n" "use Illuminate\\Support\\Carbon;\n\n" "Invoice::pending()->cursor()\n" " ->takeUntilTimeout(\n" " Carbon::createFromTimestamp(LARAVEL_START)->add(14, 'minutes')\n" " )\n" -" ->each(fn (Invoice $invoice) => $invoice->submit());\n" -msgstr "use App\\Models\\Invoice;\n" -"use Illuminate\\Support\\Carbon;\n\n" -"Invoice::pending()->cursor()\n" -" ->takeUntilTimeout(\n" -" Carbon::createFromTimestamp(LARAVEL_START)->add(14, 'minutes')\n" -" )\n" -" ->each(fn (Invoice $invoice) => $invoice->submit());\n" +" ->each(fn ($invoice) => $invoice->submit());" +msgstr "" -#: docs/10.x/collections.md:block 810 (header) +# P +#: ./docs/8.x/collections.md:3383 +#: ./docs/9.x/collections.md:3536 +#: ./docs/10.x/collections.md:3651 +#: ./docs/11.x/collections.md:3734 +#: ./docs/master/collections.md:3651 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:3384 +#: ./docs/9.x/collections.md:3537 +#: ./docs/10.x/collections.md:3652 +#: ./docs/11.x/collections.md:3735 +#: ./docs/master/collections.md:3652 msgid "`tapEach()` {.collection-method}" -msgstr "`tapEach()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 811 (paragraph) +# P +#: ./docs/9.x/collections.md:3384 +msgid "[all](#method-all)\n" +"[average](#method-average)\n" +"[avg](#method-avg)\n" +"[chunk](#method-chunk)\n" +"[chunkWhile](#method-chunkwhile)\n" +"[collapse](#method-collapse)\n" +"[collect](#method-collect)\n" +"[combine](#method-combine)\n" +"[concat](#method-concat)\n" +"[contains](#method-contains)\n" +"[containsStrict](#method-containsstrict)\n" +"[count](#method-count)\n" +"[countBy](#method-countBy)\n" +"[crossJoin](#method-crossjoin)\n" +"[dd](#method-dd)\n" +"[diff](#method-diff)\n" +"[diffAssoc](#method-diffassoc)\n" +"[diffKeys](#method-diffkeys)\n" +"[dump](#method-dump)\n" +"[duplicates](#method-duplicates)\n" +"[duplicatesStrict](#method-duplicatesstrict)\n" +"[each](#method-each)\n" +"[eachSpread](#method-eachspread)\n" +"[every](#method-every)\n" +"[except](#method-except)\n" +"[filter](#method-filter)\n" +"[first](#method-first)\n" +"[firstOrFail](#method-first-or-fail)\n" +"[firstWhere](#method-first-where)\n" +"[flatMap](#method-flatmap)\n" +"[flatten](#method-flatten)\n" +"[flip](#method-flip)\n" +"[forPage](#method-forpage)\n" +"[get](#method-get)\n" +"[groupBy](#method-groupby)\n" +"[has](#method-has)\n" +"[implode](#method-implode)\n" +"[intersect](#method-intersect)\n" +"[intersectByKeys](#method-intersectbykeys)\n" +"[isEmpty](#method-isempty)\n" +"[isNotEmpty](#method-isnotempty)\n" +"[join](#method-join)\n" +"[keyBy](#method-keyby)\n" +"[keys](#method-keys)\n" +"[last](#method-last)\n" +"[macro](#method-macro)\n" +"[make](#method-make)\n" +"[map](#method-map)\n" +"[mapInto](#method-mapinto)\n" +"[mapSpread](#method-mapspread)\n" +"[mapToGroups](#method-maptogroups)\n" +"[mapWithKeys](#method-mapwithkeys)\n" +"[max](#method-max)\n" +"[median](#method-median)\n" +"[merge](#method-merge)\n" +"[mergeRecursive](#method-mergerecursive)\n" +"[min](#method-min)\n" +"[mode](#method-mode)\n" +"[nth](#method-nth)\n" +"[only](#method-only)\n" +"[pad](#method-pad)\n" +"[partition](#method-partition)\n" +"[pipe](#method-pipe)\n" +"[pluck](#method-pluck)\n" +"[random](#method-random)\n" +"[reduce](#method-reduce)\n" +"[reject](#method-reject)\n" +"[replace](#method-replace)\n" +"[replaceRecursive](#method-replacerecursive)\n" +"[reverse](#method-reverse)\n" +"[search](#method-search)\n" +"[shuffle](#method-shuffle)\n" +"[skip](#method-skip)\n" +"[slice](#method-slice)\n" +"[sole](#method-sole)\n" +"[some](#method-some)\n" +"[sort](#method-sort)\n" +"[sortBy](#method-sortby)\n" +"[sortByDesc](#method-sortbydesc)\n" +"[sortKeys](#method-sortkeys)\n" +"[sortKeysDesc](#method-sortkeysdesc)\n" +"[split](#method-split)\n" +"[sum](#method-sum)\n" +"[take](#method-take)\n" +"[tap](#method-tap)\n" +"[times](#method-times)\n" +"[toArray](#method-toarray)\n" +"[toJson](#method-tojson)\n" +"[union](#method-union)\n" +"[unique](#method-unique)\n" +"[uniqueStrict](#method-uniquestrict)\n" +"[unless](#method-unless)\n" +"[unlessEmpty](#method-unlessempty)\n" +"[unlessNotEmpty](#method-unlessnotempty)\n" +"[unwrap](#method-unwrap)\n" +"[values](#method-values)\n" +"[when](#method-when)\n" +"[whenEmpty](#method-whenempty)\n" +"[whenNotEmpty](#method-whennotempty)\n" +"[where](#method-where)\n" +"[whereStrict](#method-wherestrict)\n" +"[whereBetween](#method-wherebetween)\n" +"[whereIn](#method-wherein)\n" +"[whereInStrict](#method-whereinstrict)\n" +"[whereInstanceOf](#method-whereinstanceof)\n" +"[whereNotBetween](#method-wherenotbetween)\n" +"[whereNotIn](#method-wherenotin)\n" +"[whereNotInStrict](#method-wherenotinstrict)\n" +"[wrap](#method-wrap)\n" +"[zip](#method-zip)" +msgstr "" + +# P +#: ./docs/8.x/collections.md:3386 +#: ./docs/9.x/collections.md:3539 +#: ./docs/10.x/collections.md:3654 +#: ./docs/11.x/collections.md:3737 +#: ./docs/master/collections.md:3654 msgid "While the `each` method calls the given callback for each item in the collection right away, the `tapEach` method only calls the given callback as the items are being pulled out of the list one by one:" -msgstr "`each` 方法會直接為 Collection 中各個項目呼叫給定的回呼,而 `tapEach` 方法則只會對被從清單中取出的項目一個一個呼叫給定的回呼:" +msgstr "" -#: docs/10.x/collections.md:block 812 (code) +# CODE +#: ./docs/8.x/collections.md:3388 +#: ./docs/9.x/collections.md:3541 msgid "// Nothing has been dumped so far...\n" -"$lazyCollection = LazyCollection::times(INF)->tapEach(function (int $value) {\n" +"$lazyCollection = LazyCollection::times(INF)->tapEach(function ($value) {\n" " dump($value);\n" "});\n\n" "// Three items are dumped...\n" "$array = $lazyCollection->take(3)->all();\n\n" "// 1\n" "// 2\n" -"// 3\n" -msgstr "// Nothing has been dumped so far...\n" -"$lazyCollection = LazyCollection::times(INF)->tapEach(function (int $value) {\n" -" dump($value);\n" -"});\n\n" -"// 傾印了三個項目...\n" -"$array = $lazyCollection->take(3)->all();\n\n" -"// 1\n" -"// 2\n" -"// 3\n" +"// 3" +msgstr "" -#: docs/10.x/collections.md:block 814 (header) +# P +#: ./docs/8.x/collections.md:3400 +#: ./docs/9.x/collections.md:3553 +#: ./docs/10.x/collections.md:3668 +#: ./docs/11.x/collections.md:3767 +#: ./docs/master/collections.md:3668 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/collections.md:3401 +#: ./docs/9.x/collections.md:3554 +#: ./docs/10.x/collections.md:3669 +#: ./docs/11.x/collections.md:3768 +#: ./docs/master/collections.md:3669 msgid "`remember()` {.collection-method}" -msgstr "`remember()` {.collection-method}" +msgstr "" -#: docs/10.x/collections.md:block 815 (paragraph) +# P +#: ./docs/8.x/collections.md:3403 +#: ./docs/9.x/collections.md:3556 +#: ./docs/10.x/collections.md:3671 +#: ./docs/11.x/collections.md:3770 +#: ./docs/master/collections.md:3671 msgid "The `remember` method returns a new lazy collection that will remember any values that have already been enumerated and will not retrieve them again on subsequent collection enumerations:" -msgstr "`remember` 方法會回傳一個新的 Lazy Collection,該 Lazy Collection 會記住任何已經被枚舉過的值,並在接下來的 Collection 枚舉時不會再取出這些值:" +msgstr "" -#: docs/10.x/collections.md:block 816 (code) +# CODE +#: ./docs/8.x/collections.md:3405 +#: ./docs/9.x/collections.md:3558 +#: ./docs/10.x/collections.md:3673 +#: ./docs/11.x/collections.md:3772 +#: ./docs/master/collections.md:3673 msgid "// No query has been executed yet...\n" "$users = User::cursor()->remember();\n\n" "// The query is executed...\n" @@ -5254,1635 +10422,235 @@ msgid "// No query has been executed yet...\n" "$users->take(5)->all();\n\n" "// First 5 users come from the collection's cache...\n" "// The rest are hydrated from the database...\n" -"$users->take(20)->all();\n" -msgstr "// 還未執行任何查詢...\n" -"$users = User::cursor()->remember();\n\n" -"// 已執行查詢...\n" -"// 已從資料庫中填入了前 5 位使用者...\n" -"$users->take(5)->all();\n\n" -"// 從 Collection 的 Cache 中取得前 5 位使用者...\n" -"// 剩下的則從資料庫中取得並填過來...\n" -"$users->take(20)->all();\n" - -#: docs/8.x/collections.md:block 6 (code) -msgid "$collection = collect(['taylor', 'abigail', null])->map(function ($name) {\n" -" return strtoupper($name);\n" -"})->reject(function ($name) {\n" -" return empty($name);\n" -"});\n" -msgstr "$collection = collect(['taylor', 'abigail', null])->map(function ($name) {\n" -" return strtoupper($name);\n" -"})->reject(function ($name) {\n" -" return empty($name);\n" -"});\n" +"$users->take(20)->all();" +msgstr "" -#: docs/8.x/collections.md:block 12 (quote) -msgid "{tip} The results of [Eloquent](/docs/{{version}}/eloquent) queries are always returned as `Collection` instances." -msgstr "{tip} [Eloquent](/docs/{{version}}/eloquent) 查詢的結果總會回傳為 `Collection` 實體。" +# CODE +#: ./docs/10.x/collections.md:3428 +#: ./docs/11.x/collections.md:3511 +#: ./docs/master/collections.md:3428 +msgid "use App\\Models\\LogEntry;\n" +"use Illuminate\\Support\\LazyCollection;\n\n" +"LazyCollection::make(function () {\n" +" $handle = fopen('log.txt', 'r');\n\n" +" while (($line = fgets($handle)) !== false) {\n" +" yield $line;\n" +" }\n" +"})->chunk(4)->map(function (array $lines) {\n" +" return LogEntry::fromLines($lines);\n" +"})->each(function (LogEntry $logEntry) {\n" +" // Process the log entry...\n" +"});" +msgstr "" -#: docs/8.x/collections.md:block 16 (code) -msgid "use Illuminate\\Support\\Collection;\n" -"use Illuminate\\Support\\Str;\n\n" -"Collection::macro('toUpper', function () {\n" -" return $this->map(function ($value) {\n" -" return Str::upper($value);\n" -" });\n" -"});\n\n" -"$collection = collect(['first', 'second']);\n\n" -"$upper = $collection->toUpper();\n\n" -"// ['FIRST', 'SECOND']\n" -msgstr "use Illuminate\\Support\\Collection;\n" -"use Illuminate\\Support\\Str;\n\n" -"Collection::macro('toUpper', function () {\n" -" return $this->map(function ($value) {\n" -" return Str::upper($value);\n" -" });\n" -"});\n\n" -"$collection = collect(['first', 'second']);\n\n" -"$upper = $collection->toUpper();\n\n" -"// ['FIRST', 'SECOND']\n" +# CODE +#: ./docs/10.x/collections.md:3445 +#: ./docs/11.x/collections.md:3528 +#: ./docs/master/collections.md:3445 +msgid "use App\\Models\\User;\n\n" +"$users = User::all()->filter(function (User $user) {\n" +" return $user->id > 500;\n" +"});" +msgstr "" -#: docs/8.x/collections.md:block 21 (code) -msgid "use Illuminate\\Support\\Collection;\n" -"use Illuminate\\Support\\Facades\\Lang;\n\n" -"Collection::macro('toLocale', function ($locale) {\n" -" return $this->map(function ($value) use ($locale) {\n" -" return Lang::get($value, [], $locale);\n" -" });\n" -"});\n\n" -"$collection = collect(['first', 'second']);\n\n" -"$translated = $collection->toLocale('es');\n" -msgstr "use Illuminate\\Support\\Collection;\n" -"use Illuminate\\Support\\Facades\\Lang;\n\n" -"Collection::macro('toLocale', function ($locale) {\n" -" return $this->map(function ($value) use ($locale) {\n" -" return Lang::get($value, [], $locale);\n" -" });\n" +# CODE +#: ./docs/10.x/collections.md:3453 +#: ./docs/11.x/collections.md:3536 +#: ./docs/master/collections.md:3453 +msgid "use App\\Models\\User;\n\n" +"$users = User::cursor()->filter(function (User $user) {\n" +" return $user->id > 500;\n" "});\n\n" -"$collection = collect(['first', 'second']);\n\n" -"$translated = $collection->toLocale('es');\n" +"foreach ($users as $user) {\n" +" echo $user->id;\n" +"}" +msgstr "" -#: docs/8.x/collections.md:block 27 (paragraph) -msgid "[all](#method-all) [average](#method-average) [avg](#method-avg) [chunk](#method-chunk) [chunkWhile](#method-chunkwhile) [collapse](#method-collapse) [collect](#method-collect) [combine](#method-combine) [concat](#method-concat) [contains](#method-contains) [containsStrict](#method-containsstrict) [count](#method-count) [countBy](#method-countBy) [crossJoin](#method-crossjoin) [dd](#method-dd) [diff](#method-diff) [diffAssoc](#method-diffassoc) [diffKeys](#method-diffkeys) [doesntContain](#method-doesntcontain) [dump](#method-dump) [duplicates](#method-duplicates) [duplicatesStrict](#method-duplicatesstrict) [each](#method-each) [eachSpread](#method-eachspread) [every](#method-every) [except](#method-except) [filter](#method-filter) [first](#method-first) [firstWhere](#method-first-where) [flatMap](#method-flatmap) [flatten](#method-flatten) [flip](#method-flip) [forget](#method-forget) [forPage](#method-forpage) [get](#method-get) [groupBy](#method-groupby) [has](#method-has) [implode](#method-implode) [intersect](#method-intersect) [intersectByKeys](#method-intersectbykeys) [isEmpty](#method-isempty) [isNotEmpty](#method-isnotempty) [join](#method-join) [keyBy](#method-keyby) [keys](#method-keys) [last](#method-last) [macro](#method-macro) [make](#method-make) [map](#method-map) [mapInto](#method-mapinto) [mapSpread](#method-mapspread) [mapToGroups](#method-maptogroups) [mapWithKeys](#method-mapwithkeys) [max](#method-max) [median](#method-median) [merge](#method-merge) [mergeRecursive](#method-mergerecursive) [min](#method-min) [mode](#method-mode) [nth](#method-nth) [only](#method-only) [pad](#method-pad) [partition](#method-partition) [pipe](#method-pipe) [pipeInto](#method-pipeinto) [pipeThrough](#method-pipethrough) [pluck](#method-pluck) [pop](#method-pop) [prepend](#method-prepend) [pull](#method-pull) [push](#method-push) [put](#method-put) [random](#method-random) [range](#method-range) [reduce](#method-reduce) [reduceSpread](#method-reduce-spread) [reject](#method-reject) [replace](#method-replace) [replaceRecursive](#method-replacerecursive) [reverse](#method-reverse) [search](#method-search) [shift](#method-shift) [shuffle](#method-shuffle) [sliding](#method-sliding) [skip](#method-skip) [skipUntil](#method-skipuntil) [skipWhile](#method-skipwhile) [slice](#method-slice) [sole](#method-sole) [some](#method-some) [sort](#method-sort) [sortBy](#method-sortby) [sortByDesc](#method-sortbydesc) [sortDesc](#method-sortdesc) [sortKeys](#method-sortkeys) [sortKeysDesc](#method-sortkeysdesc) [sortKeysUsing](#method-sortkeysusing) [splice](#method-splice) [split](#method-split) [splitIn](#method-splitin) [sum](#method-sum) [take](#method-take) [takeUntil](#method-takeuntil) [takeWhile](#method-takewhile) [tap](#method-tap) [times](#method-times) [toArray](#method-toarray) [toJson](#method-tojson) [transform](#method-transform) [undot](#method-undot) [union](#method-union) [unique](#method-unique) [uniqueStrict](#method-uniquestrict) [unless](#method-unless) [unlessEmpty](#method-unlessempty) [unlessNotEmpty](#method-unlessnotempty) [unwrap](#method-unwrap) [values](#method-values) [when](#method-when) [whenEmpty](#method-whenempty) [whenNotEmpty](#method-whennotempty) [where](#method-where) [whereStrict](#method-wherestrict) [whereBetween](#method-wherebetween) [whereIn](#method-wherein) [whereInStrict](#method-whereinstrict) [whereInstanceOf](#method-whereinstanceof) [whereNotBetween](#method-wherenotbetween) [whereNotIn](#method-wherenotin) [whereNotInStrict](#method-wherenotinstrict) [whereNotNull](#method-wherenotnull) [whereNull](#method-wherenull) [wrap](#method-wrap) [zip](#method-zip)" -msgstr "[all](#method-all) [average](#method-average) [avg](#method-avg) [chunk](#method-chunk) [chunkWhile](#method-chunkwhile) [collapse](#method-collapse) [collect](#method-collect) [combine](#method-combine) [concat](#method-concat) [contains](#method-contains) [containsStrict](#method-containsstrict) [count](#method-count) [countBy](#method-countBy) [crossJoin](#method-crossjoin) [dd](#method-dd) [diff](#method-diff) [diffAssoc](#method-diffassoc) [diffKeys](#method-diffkeys) [doesntContain](#method-doesntcontain) [dump](#method-dump) [duplicates](#method-duplicates) [duplicatesStrict](#method-duplicatesstrict) [each](#method-each) [eachSpread](#method-eachspread) [every](#method-every) [except](#method-except) [filter](#method-filter) [first](#method-first) [firstWhere](#method-first-where) [flatMap](#method-flatmap) [flatten](#method-flatten) [flip](#method-flip) [forget](#method-forget) [forPage](#method-forpage) [get](#method-get) [groupBy](#method-groupby) [has](#method-has) [implode](#method-implode) [intersect](#method-intersect) [intersectByKeys](#method-intersectbykeys) [isEmpty](#method-isempty) [isNotEmpty](#method-isnotempty) [join](#method-join) [keyBy](#method-keyby) [keys](#method-keys) [last](#method-last) [macro](#method-macro) [make](#method-make) [map](#method-map) [mapInto](#method-mapinto) [mapSpread](#method-mapspread) [mapToGroups](#method-maptogroups) [mapWithKeys](#method-mapwithkeys) [max](#method-max) [median](#method-median) [merge](#method-merge) [mergeRecursive](#method-mergerecursive) [min](#method-min) [mode](#method-mode) [nth](#method-nth) [only](#method-only) [pad](#method-pad) [partition](#method-partition) [pipe](#method-pipe) [pipeInto](#method-pipeinto) [pipeThrough](#method-pipethrough) [pluck](#method-pluck) [pop](#method-pop) [prepend](#method-prepend) [pull](#method-pull) [push](#method-push) [put](#method-put) [random](#method-random) [range](#method-range) [reduce](#method-reduce) [reduceSpread](#method-reduce-spread) [reject](#method-reject) [replace](#method-replace) [replaceRecursive](#method-replacerecursive) [reverse](#method-reverse) [search](#method-search) [shift](#method-shift) [shuffle](#method-shuffle) [sliding](#method-sliding) [skip](#method-skip) [skipUntil](#method-skipuntil) [skipWhile](#method-skipwhile) [slice](#method-slice) [sole](#method-sole) [some](#method-some) [sort](#method-sort) [sortBy](#method-sortby) [sortByDesc](#method-sortbydesc) [sortDesc](#method-sortdesc) [sortKeys](#method-sortkeys) [sortKeysDesc](#method-sortkeysdesc) [sortKeysUsing](#method-sortkeysusing) [splice](#method-splice) [split](#method-split) [splitIn](#method-splitin) [sum](#method-sum) [take](#method-take) [takeUntil](#method-takeuntil) [takeWhile](#method-takewhile) [tap](#method-tap) [times](#method-times) [toArray](#method-toarray) [toJson](#method-tojson) [transform](#method-transform) [undot](#method-undot) [union](#method-union) [unique](#method-unique) [uniqueStrict](#method-uniquestrict) [unless](#method-unless) [unlessEmpty](#method-unlessempty) [unlessNotEmpty](#method-unlessnotempty) [unwrap](#method-unwrap) [values](#method-values) [when](#method-when) [whenEmpty](#method-whenempty) [whenNotEmpty](#method-whennotempty) [where](#method-where) [whereStrict](#method-wherestrict) [whereBetween](#method-wherebetween) [whereIn](#method-wherein) [whereInStrict](#method-whereinstrict) [whereInstanceOf](#method-whereinstanceof) [whereNotBetween](#method-wherenotbetween) [whereNotIn](#method-wherenotin) [whereNotInStrict](#method-wherenotinstrict) [whereNotNull](#method-wherenotnull) [whereNull](#method-wherenull) [wrap](#method-wrap) [zip](#method-zip)" +# P +#: ./docs/10.x/collections.md:3498 +#: ./docs/11.x/collections.md:3581 +#: ./docs/master/collections.md:3498 +msgid "[all](#method-all)\n" +"[average](#method-average)\n" +"[avg](#method-avg)\n" +"[chunk](#method-chunk)\n" +"[chunkWhile](#method-chunkwhile)\n" +"[collapse](#method-collapse)\n" +"[collect](#method-collect)\n" +"[combine](#method-combine)\n" +"[concat](#method-concat)\n" +"[contains](#method-contains)\n" +"[containsStrict](#method-containsstrict)\n" +"[count](#method-count)\n" +"[countBy](#method-countBy)\n" +"[crossJoin](#method-crossjoin)\n" +"[dd](#method-dd)\n" +"[diff](#method-diff)\n" +"[diffAssoc](#method-diffassoc)\n" +"[diffKeys](#method-diffkeys)\n" +"[dump](#method-dump)\n" +"[duplicates](#method-duplicates)\n" +"[duplicatesStrict](#method-duplicatesstrict)\n" +"[each](#method-each)\n" +"[eachSpread](#method-eachspread)\n" +"[every](#method-every)\n" +"[except](#method-except)\n" +"[filter](#method-filter)\n" +"[first](#method-first)\n" +"[firstOrFail](#method-first-or-fail)\n" +"[firstWhere](#method-first-where)\n" +"[flatMap](#method-flatmap)\n" +"[flatten](#method-flatten)\n" +"[flip](#method-flip)\n" +"[forPage](#method-forpage)\n" +"[get](#method-get)\n" +"[groupBy](#method-groupby)\n" +"[has](#method-has)\n" +"[implode](#method-implode)\n" +"[intersect](#method-intersect)\n" +"[intersectAssoc](#method-intersectAssoc)\n" +"[intersectByKeys](#method-intersectbykeys)\n" +"[isEmpty](#method-isempty)\n" +"[isNotEmpty](#method-isnotempty)\n" +"[join](#method-join)\n" +"[keyBy](#method-keyby)\n" +"[keys](#method-keys)\n" +"[last](#method-last)\n" +"[macro](#method-macro)\n" +"[make](#method-make)\n" +"[map](#method-map)\n" +"[mapInto](#method-mapinto)\n" +"[mapSpread](#method-mapspread)\n" +"[mapToGroups](#method-maptogroups)\n" +"[mapWithKeys](#method-mapwithkeys)\n" +"[max](#method-max)\n" +"[median](#method-median)\n" +"[merge](#method-merge)\n" +"[mergeRecursive](#method-mergerecursive)\n" +"[min](#method-min)\n" +"[mode](#method-mode)\n" +"[nth](#method-nth)\n" +"[only](#method-only)\n" +"[pad](#method-pad)\n" +"[partition](#method-partition)\n" +"[pipe](#method-pipe)\n" +"[pluck](#method-pluck)\n" +"[random](#method-random)\n" +"[reduce](#method-reduce)\n" +"[reject](#method-reject)\n" +"[replace](#method-replace)\n" +"[replaceRecursive](#method-replacerecursive)\n" +"[reverse](#method-reverse)\n" +"[search](#method-search)\n" +"[shuffle](#method-shuffle)\n" +"[skip](#method-skip)\n" +"[slice](#method-slice)\n" +"[sole](#method-sole)\n" +"[some](#method-some)\n" +"[sort](#method-sort)\n" +"[sortBy](#method-sortby)\n" +"[sortByDesc](#method-sortbydesc)\n" +"[sortKeys](#method-sortkeys)\n" +"[sortKeysDesc](#method-sortkeysdesc)\n" +"[split](#method-split)\n" +"[sum](#method-sum)\n" +"[take](#method-take)\n" +"[tap](#method-tap)\n" +"[times](#method-times)\n" +"[toArray](#method-toarray)\n" +"[toJson](#method-tojson)\n" +"[union](#method-union)\n" +"[unique](#method-unique)\n" +"[uniqueStrict](#method-uniquestrict)\n" +"[unless](#method-unless)\n" +"[unlessEmpty](#method-unlessempty)\n" +"[unlessNotEmpty](#method-unlessnotempty)\n" +"[unwrap](#method-unwrap)\n" +"[values](#method-values)\n" +"[when](#method-when)\n" +"[whenEmpty](#method-whenempty)\n" +"[whenNotEmpty](#method-whennotempty)\n" +"[where](#method-where)\n" +"[whereStrict](#method-wherestrict)\n" +"[whereBetween](#method-wherebetween)\n" +"[whereIn](#method-wherein)\n" +"[whereInStrict](#method-whereinstrict)\n" +"[whereInstanceOf](#method-whereinstanceof)\n" +"[whereNotBetween](#method-wherenotbetween)\n" +"[whereNotIn](#method-wherenotin)\n" +"[whereNotInStrict](#method-wherenotinstrict)\n" +"[wrap](#method-wrap)\n" +"[zip](#method-zip)" +msgstr "" -#: docs/8.x/collections.md:block 52 (code) -msgid "$collection = collect(str_split('AABBCCCD'));\n\n" -"$chunks = $collection->chunkWhile(function ($value, $key, $chunk) {\n" -" return $value === $chunk->last();\n" -"});\n\n" -"$chunks->all();\n\n" -"// [['A', 'A'], ['B', 'B'], ['C', 'C', 'C'], ['D']]\n" -msgstr "$collection = collect(str_split('AABBCCCD'));\n\n" -"$chunks = $collection->chunkWhile(function ($value, $key, $chunk) {\n" -" return $value === $chunk->last();\n" +# CODE +#: ./docs/10.x/collections.md:3625 +#: ./docs/11.x/collections.md:3708 +#: ./docs/master/collections.md:3625 +msgid "$lazyCollection = LazyCollection::times(INF)\n" +" ->takeUntilTimeout(now()->addMinute());\n\n" +"$lazyCollection->each(function (int $number) {\n" +" dump($number);\n\n" +" sleep(1);\n" "});\n\n" -"$chunks->all();\n\n" -"// [['A', 'A'], ['B', 'B'], ['C', 'C', 'C'], ['D']]\n" +"// 1\n" +"// 2\n" +"// ...\n" +"// 58\n" +"// 59" +msgstr "" -#: docs/8.x/collections.md:block 62 (code) -msgid "$lazyCollection = LazyCollection::make(function () {\n" -" yield 1;\n" -" yield 2;\n" -" yield 3;\n" -"});\n\n" -"$collection = $lazyCollection->collect();\n\n" -"get_class($collection);\n\n" -"// 'Illuminate\\Support\\Collection'\n\n" -"$collection->all();\n\n" -"// [1, 2, 3]\n" -msgstr "$lazyCollection = LazyCollection::make(function () {\n" -" yield 1;\n" -" yield 2;\n" -" yield 3;\n" +# CODE +#: ./docs/10.x/collections.md:3642 +#: ./docs/11.x/collections.md:3725 +#: ./docs/master/collections.md:3642 +msgid "use App\\Models\\Invoice;\n" +"use Illuminate\\Support\\Carbon;\n\n" +"Invoice::pending()->cursor()\n" +" ->takeUntilTimeout(\n" +" Carbon::createFromTimestamp(LARAVEL_START)->add(14, 'minutes')\n" +" )\n" +" ->each(fn (Invoice $invoice) => $invoice->submit());" +msgstr "" + +# CODE +#: ./docs/10.x/collections.md:3656 +#: ./docs/11.x/collections.md:3739 +#: ./docs/master/collections.md:3656 +msgid "// Nothing has been dumped so far...\n" +"$lazyCollection = LazyCollection::times(INF)->tapEach(function (int $value) {\n" +" dump($value);\n" "});\n\n" -"$collection = $lazyCollection->collect();\n\n" -"get_class($collection);\n\n" -"// 'Illuminate\\Support\\Collection'\n\n" -"$collection->all();\n\n" -"// [1, 2, 3]\n" +"// Three items are dumped...\n" +"$array = $lazyCollection->take(3)->all();\n\n" +"// 1\n" +"// 2\n" +"// 3" +msgstr "" -#: docs/8.x/collections.md:block 63 (quote) -msgid "{tip} The `collect` method is especially useful when you have an instance of `Enumerable` and need a non-lazy collection instance. Since `collect()` is part of the `Enumerable` contract, you can safely use it to get a `Collection` instance." -msgstr "{tip} `collect` 方法特別適合用於如有 `Enumerable` 實體且需要一個非 Lazy Collection 的實體。由於 `collect()` 是 `Enumerable` Contract 的一部分,因此我們可以安全地使用該方法來取得 `Collection` 實體。" +# P +#: ./docs/11.x/collections.md:3751 +#~ msgid "" +#~ msgstr "" -#: docs/8.x/collections.md:block 75 (code) -msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->contains(function ($value, $key) {\n" -" return $value > 5;\n" -"});\n\n" -"// false\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->contains(function ($value, $key) {\n" -" return $value > 5;\n" -"});\n\n" -"// false\n" +# H4 +#: ./docs/11.x/collections.md:3752 +msgid "`throttle()` {.collection-method}" +msgstr "" -#: docs/8.x/collections.md:block 85 (quote) -msgid "{tip} This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-contains)." -msgstr "{tip} 在使用 [Eloquent Collection](/docs/{{version}}/eloquent-collections#method-contains) 時,該方法的行為有經過修改。" +# P +#: ./docs/11.x/collections.md:3754 +msgid "The `throttle` method will throttle the lazy collection such that each value is returned after the specified number of seconds. This method is especially useful for situations where you may be interacting with external APIs that rate limit incoming requests:" +msgstr "" -#: docs/8.x/collections.md:block 95 (code) -msgid "$collection = collect(['alice@gmail.com', 'bob@yahoo.com', 'carlos@gmail.com']);\n\n" -"$counted = $collection->countBy(function ($email) {\n" -" return substr(strrchr($email, \"@\"), 1);\n" -"});\n\n" -"$counted->all();\n\n" -"// ['gmail.com' => 2, 'yahoo.com' => 1]\n" -msgstr "$collection = collect(['alice@gmail.com', 'bob@yahoo.com', 'carlos@gmail.com']);\n\n" -"$counted = $collection->countBy(function ($email) {\n" -" return substr(strrchr($email, \"@\"), 1);\n" -"});\n\n" -"$counted->all();\n\n" -"// ['gmail.com' => 2, 'yahoo.com' => 1]\n" - -#: docs/8.x/collections.md:block 109 (quote) -msgid "{tip} This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-diff)." -msgstr "{tip} 在使用 [Eloquent Collection](/docs/{{version}}/eloquent-collections#method-diff) 時,該方法的行為有經過修改。" - -#: docs/8.x/collections.md:block 121 (code) -msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->doesntContain(function ($value, $key) {\n" -" return $value < 5;\n" -"});\n\n" -"// false\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->doesntContain(function ($value, $key) {\n" -" return $value < 5;\n" -"});\n\n" -"// false\n" - -#: docs/8.x/collections.md:block 144 (code) -msgid "$collection->each(function ($item, $key) {\n" -" //\n" -"});\n" -msgstr "$collection->each(function ($item, $key) {\n" -" //\n" -"});\n" - -#: docs/8.x/collections.md:block 146 (code) -msgid "$collection->each(function ($item, $key) {\n" -" if (/* condition */) {\n" -" return false;\n" -" }\n" -"});\n" -msgstr "$collection->each(function ($item, $key) {\n" -" if (/* condition */) {\n" -" return false;\n" -" }\n" -"});\n" - -#: docs/8.x/collections.md:block 150 (code) -msgid "$collection = collect([['John Doe', 35], ['Jane Doe', 33]]);\n\n" -"$collection->eachSpread(function ($name, $age) {\n" -" //\n" -"});\n" -msgstr "$collection = collect([['John Doe', 35], ['Jane Doe', 33]]);\n\n" -"$collection->eachSpread(function ($name, $age) {\n" -" //\n" -"});\n" - -#: docs/8.x/collections.md:block 152 (code) -msgid "$collection->eachSpread(function ($name, $age) {\n" -" return false;\n" -"});\n" -msgstr "$collection->eachSpread(function ($name, $age) {\n" -" return false;\n" -"});\n" - -#: docs/8.x/collections.md:block 156 (code) -msgid "collect([1, 2, 3, 4])->every(function ($value, $key) {\n" -" return $value > 2;\n" -"});\n\n" -"// false\n" -msgstr "collect([1, 2, 3, 4])->every(function ($value, $key) {\n" -" return $value > 2;\n" -"});\n\n" -"// false\n" - -#: docs/8.x/collections.md:block 158 (code) -msgid "$collection = collect([]);\n\n" -"$collection->every(function ($value, $key) {\n" -" return $value > 2;\n" -"});\n\n" -"// true\n" -msgstr "$collection = collect([]);\n\n" -"$collection->every(function ($value, $key) {\n" -" return $value > 2;\n" -"});\n\n" -"// true\n" - -#: docs/8.x/collections.md:block 164 (quote) -msgid "{tip} This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-except)." -msgstr "{tip} 在使用 [Eloquent Collection](/docs/{{version}}/eloquent-collections#method-except) 時,該方法的行為有經過修改。" - -#: docs/8.x/collections.md:block 168 (code) -msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$filtered = $collection->filter(function ($value, $key) {\n" -" return $value > 2;\n" -"});\n\n" -"$filtered->all();\n\n" -"// [3, 4]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$filtered = $collection->filter(function ($value, $key) {\n" -" return $value > 2;\n" -"});\n\n" -"$filtered->all();\n\n" -"// [3, 4]\n" - -#: docs/8.x/collections.md:block 175 (code) -msgid "collect([1, 2, 3, 4])->first(function ($value, $key) {\n" -" return $value > 2;\n" -"});\n\n" -"// 3\n" -msgstr "collect([1, 2, 3, 4])->first(function ($value, $key) {\n" -" return $value > 2;\n" -"});\n\n" -"// 3\n" - -#: docs/8.x/collections.md:block 189 (code) -msgid "$collection = collect([\n" -" ['name' => 'Sally'],\n" -" ['school' => 'Arkansas'],\n" -" ['age' => 28]\n" -"]);\n\n" -"$flattened = $collection->flatMap(function ($values) {\n" -" return array_map('strtoupper', $values);\n" -"});\n\n" -"$flattened->all();\n\n" -"// ['name' => 'SALLY', 'school' => 'ARKANSAS', 'age' => '28'];\n" -msgstr "$collection = collect([\n" -" ['name' => 'Sally'],\n" -" ['school' => 'Arkansas'],\n" -" ['age' => 28]\n" -"]);\n\n" -"$flattened = $collection->flatMap(function ($values) {\n" -" return array_map('strtoupper', $values);\n" -"});\n\n" -"$flattened->all();\n\n" -"// ['name' => 'SALLY', 'school' => 'ARKANSAS', 'age' => '28'];\n" - -#: docs/8.x/collections.md:block 205 (quote) -msgid "{note} Unlike most other collection methods, `forget` does not return a new modified collection; it modifies the collection it is called on." -msgstr "{note} 與其他大多數 Collection 方法不同,`forget` 不會回傳經過修改的新 Collection。該方法會修改被呼叫的那個 Collection。" - -#: docs/8.x/collections.md:block 223 (code) -msgid "$grouped = $collection->groupBy(function ($item, $key) {\n" -" return substr($item['account_id'], -3);\n" -"});\n\n" -"$grouped->all();\n\n" -"/*\n" -" [\n" -" 'x10' => [\n" -" ['account_id' => 'account-x10', 'product' => 'Chair'],\n" -" ['account_id' => 'account-x10', 'product' => 'Bookcase'],\n" -" ],\n" -" 'x11' => [\n" -" ['account_id' => 'account-x11', 'product' => 'Desk'],\n" -" ],\n" -" ]\n" -"*/\n" -msgstr "$grouped = $collection->groupBy(function ($item, $key) {\n" -" return substr($item['account_id'], -3);\n" -"});\n\n" -"$grouped->all();\n\n" -"/*\n" -" [\n" -" 'x10' => [\n" -" ['account_id' => 'account-x10', 'product' => 'Chair'],\n" -" ['account_id' => 'account-x10', 'product' => 'Bookcase'],\n" -" ],\n" -" 'x11' => [\n" -" ['account_id' => 'account-x11', 'product' => 'Desk'],\n" -" ],\n" -" ]\n" -"*/\n" - -#: docs/8.x/collections.md:block 225 (code) -msgid "$data = new Collection([\n" -" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" -" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" -" 30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],\n" -" 40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],\n" -"]);\n\n" -"$result = $data->groupBy(['skill', function ($item) {\n" -" return $item['roles'];\n" -"}], $preserveKeys = true);\n\n" -"/*\n" -"[\n" -" 1 => [\n" -" 'Role_1' => [\n" -" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" -" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" -" ],\n" -" 'Role_2' => [\n" -" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" -" ],\n" -" 'Role_3' => [\n" -" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" -" ],\n" -" ],\n" -" 2 => [\n" -" 'Role_1' => [\n" -" 30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],\n" -" ],\n" -" 'Role_2' => [\n" -" 40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],\n" -" ],\n" -" ],\n" -"];\n" -"*/\n" -msgstr "$data = new Collection([\n" -" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" -" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" -" 30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],\n" -" 40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],\n" -"]);\n\n" -"$result = $data->groupBy(['skill', function ($item) {\n" -" return $item['roles'];\n" -"}], $preserveKeys = true);\n\n" -"/*\n" -"[\n" -" 1 => [\n" -" 'Role_1' => [\n" -" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" -" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" -" ],\n" -" 'Role_2' => [\n" -" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" -" ],\n" -" 'Role_3' => [\n" -" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" -" ],\n" -" ],\n" -" 2 => [\n" -" 'Role_1' => [\n" -" 30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],\n" -" ],\n" -" 'Role_2' => [\n" -" 40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],\n" -" ],\n" -" ],\n" -"];\n" -"*/\n" - -#: docs/8.x/collections.md:block 240 (quote) -msgid "{tip} This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-intersect)." -msgstr "{tip} 在使用 [Eloquent Collection](/docs/{{version}}/eloquent-collections#method-intersect) 時,該方法的行為有經過修改。" - -#: docs/8.x/collections.md:block 262 (code) -msgid "$keyed = $collection->keyBy(function ($item) {\n" -" return strtoupper($item['product_id']);\n" -"});\n\n" -"$keyed->all();\n\n" -"/*\n" -" [\n" -" 'PROD-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],\n" -" 'PROD-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],\n" -" ]\n" -"*/\n" -msgstr "$keyed = $collection->keyBy(function ($item) {\n" -" return strtoupper($item['product_id']);\n" -"});\n\n" -"$keyed->all();\n\n" -"/*\n" -" [\n" -" 'PROD-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],\n" -" 'PROD-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],\n" -" ]\n" -"*/\n" - -#: docs/8.x/collections.md:block 270 (code) -msgid "collect([1, 2, 3, 4])->last(function ($value, $key) {\n" -" return $value < 3;\n" -"});\n\n" -"// 2\n" -msgstr "collect([1, 2, 3, 4])->last(function ($value, $key) {\n" -" return $value < 3;\n" -"});\n\n" -"// 2\n" - -#: docs/8.x/collections.md:block 282 (code) -msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$multiplied = $collection->map(function ($item, $key) {\n" -" return $item * 2;\n" -"});\n\n" -"$multiplied->all();\n\n" -"// [2, 4, 6, 8, 10]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$multiplied = $collection->map(function ($item, $key) {\n" -" return $item * 2;\n" -"});\n\n" -"$multiplied->all();\n\n" -"// [2, 4, 6, 8, 10]\n" - -#: docs/8.x/collections.md:block 283 (quote) -msgid "{note} Like most other collection methods, `map` returns a new collection instance; it does not modify the collection it is called on. If you want to transform the original collection, use the [`transform`](#method-transform) method." -msgstr "{note} 與其他 Collection 方法類似,`map` 會回傳一個新的 Collection 實體。該方法不會修改正在呼叫的 Collection。若想改變原始 Collection,請使用 [`transform`](#method-transform) 方法代替。" - -#: docs/8.x/collections.md:block 287 (code) -msgid "class Currency\n" -"{\n" -" /**\n" -" * Create a new currency instance.\n" -" *\n" -" * @param string $code\n" -" * @return void\n" -" */\n" -" function __construct(string $code)\n" -" {\n" -" $this->code = $code;\n" -" }\n" -"}\n\n" -"$collection = collect(['USD', 'EUR', 'GBP']);\n\n" -"$currencies = $collection->mapInto(Currency::class);\n\n" -"$currencies->all();\n\n" -"// [Currency('USD'), Currency('EUR'), Currency('GBP')]\n" -msgstr "class Currency\n" -"{\n" -" /**\n" -" * Create a new currency instance.\n" -" *\n" -" * @param string $code\n" -" * @return void\n" -" */\n" -" function __construct(string $code)\n" -" {\n" -" $this->code = $code;\n" -" }\n" -"}\n\n" -"$collection = collect(['USD', 'EUR', 'GBP']);\n\n" -"$currencies = $collection->mapInto(Currency::class);\n\n" -"$currencies->all();\n\n" -"// [Currency('USD'), Currency('EUR'), Currency('GBP')]\n" - -#: docs/8.x/collections.md:block 291 (code) -msgid "$collection = collect([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n\n" -"$chunks = $collection->chunk(2);\n\n" -"$sequence = $chunks->mapSpread(function ($even, $odd) {\n" -" return $even + $odd;\n" -"});\n\n" -"$sequence->all();\n\n" -"// [1, 5, 9, 13, 17]\n" -msgstr "$collection = collect([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);\n\n" -"$chunks = $collection->chunk(2);\n\n" -"$sequence = $chunks->mapSpread(function ($even, $odd) {\n" -" return $even + $odd;\n" -"});\n\n" -"$sequence->all();\n\n" -"// [1, 5, 9, 13, 17]\n" - -#: docs/8.x/collections.md:block 295 (code) -msgid "$collection = collect([\n" -" [\n" -" 'name' => 'John Doe',\n" -" 'department' => 'Sales',\n" -" ],\n" -" [\n" -" 'name' => 'Jane Doe',\n" -" 'department' => 'Sales',\n" -" ],\n" -" [\n" -" 'name' => 'Johnny Doe',\n" -" 'department' => 'Marketing',\n" -" ]\n" -"]);\n\n" -"$grouped = $collection->mapToGroups(function ($item, $key) {\n" -" return [$item['department'] => $item['name']];\n" -"});\n\n" -"$grouped->all();\n\n" -"/*\n" -" [\n" -" 'Sales' => ['John Doe', 'Jane Doe'],\n" -" 'Marketing' => ['Johnny Doe'],\n" -" ]\n" -"*/\n\n" -"$grouped->get('Sales')->all();\n\n" -"// ['John Doe', 'Jane Doe']\n" -msgstr "$collection = collect([\n" -" [\n" -" 'name' => 'John Doe',\n" -" 'department' => 'Sales',\n" -" ],\n" -" [\n" -" 'name' => 'Jane Doe',\n" -" 'department' => 'Sales',\n" -" ],\n" -" [\n" -" 'name' => 'Johnny Doe',\n" -" 'department' => 'Marketing',\n" -" ]\n" -"]);\n\n" -"$grouped = $collection->mapToGroups(function ($item, $key) {\n" -" return [$item['department'] => $item['name']];\n" -"});\n\n" -"$grouped->all();\n\n" -"/*\n" -" [\n" -" 'Sales' => ['John Doe', 'Jane Doe'],\n" -" 'Marketing' => ['Johnny Doe'],\n" -" ]\n" -"*/\n\n" -"$grouped->get('Sales')->all();\n\n" -"// ['John Doe', 'Jane Doe']\n" - -#: docs/8.x/collections.md:block 299 (code) -msgid "$collection = collect([\n" -" [\n" -" 'name' => 'John',\n" -" 'department' => 'Sales',\n" -" 'email' => 'john@example.com',\n" -" ],\n" -" [\n" -" 'name' => 'Jane',\n" -" 'department' => 'Marketing',\n" -" 'email' => 'jane@example.com',\n" -" ]\n" -"]);\n\n" -"$keyed = $collection->mapWithKeys(function ($item, $key) {\n" -" return [$item['email'] => $item['name']];\n" -"});\n\n" -"$keyed->all();\n\n" -"/*\n" -" [\n" -" 'john@example.com' => 'John',\n" -" 'jane@example.com' => 'Jane',\n" -" ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" [\n" -" 'name' => 'John',\n" -" 'department' => 'Sales',\n" -" 'email' => 'john@example.com',\n" -" ],\n" -" [\n" -" 'name' => 'Jane',\n" -" 'department' => 'Marketing',\n" -" 'email' => 'jane@example.com',\n" -" ]\n" -"]);\n\n" -"$keyed = $collection->mapWithKeys(function ($item, $key) {\n" -" return [$item['email'] => $item['name']];\n" -"});\n\n" -"$keyed->all();\n\n" -"/*\n" -" [\n" -" 'john@example.com' => 'John',\n" -" 'jane@example.com' => 'Jane',\n" -" ]\n" -"*/\n" - -#: docs/8.x/collections.md:block 310 (paragraph) -msgid "The `merge` method merges the given array or collection with the original collection. If a string key in the given items matches a string key in the original collection, the given items's value will overwrite the value in the original collection:" -msgstr "`merge` 方法會將給定的陣列或 Collection 與原始 Collection 合併。若在給定項目中有字串索引鍵與原始 Collection 中的字串索引鍵相同,則給定項目的值會覆蓋原始 Collection 中的值:" - -#: docs/8.x/collections.md:block 312 (paragraph) -msgid "If the given items's keys are numeric, the values will be appended to the end of the collection:" -msgstr "若給定項目的索引鍵是數字值,則其值會被加到該 Collection 的最後面:" - -#: docs/8.x/collections.md:block 337 (quote) -msgid "{tip} This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-only)." -msgstr "{tip} 在使用 [Eloquent Collection](/docs/{{version}}/eloquent-collections#method-only) 時,該方法的行為有經過修改。" - -#: docs/8.x/collections.md:block 346 (code) -msgid "$collection = collect([1, 2, 3, 4, 5, 6]);\n\n" -"[$underThree, $equalOrAboveThree] = $collection->partition(function ($i) {\n" -" return $i < 3;\n" -"});\n\n" -"$underThree->all();\n\n" -"// [1, 2]\n\n" -"$equalOrAboveThree->all();\n\n" -"// [3, 4, 5, 6]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5, 6]);\n\n" -"[$underThree, $equalOrAboveThree] = $collection->partition(function ($i) {\n" -" return $i < 3;\n" -"});\n\n" -"$underThree->all();\n\n" -"// [1, 2]\n\n" -"$equalOrAboveThree->all();\n\n" -"// [3, 4, 5, 6]\n" - -#: docs/8.x/collections.md:block 350 (code) -msgid "$collection = collect([1, 2, 3]);\n\n" -"$piped = $collection->pipe(function ($collection) {\n" -" return $collection->sum();\n" -"});\n\n" -"// 6\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$piped = $collection->pipe(function ($collection) {\n" -" return $collection->sum();\n" -"});\n\n" -"// 6\n" - -#: docs/8.x/collections.md:block 354 (code) -msgid "class ResourceCollection\n" -"{\n" -" /**\n" -" * The Collection instance.\n" -" */\n" -" public $collection;\n\n" -" /**\n" -" * Create a new ResourceCollection instance.\n" -" *\n" -" * @param Collection $collection\n" -" * @return void\n" -" */\n" -" public function __construct(Collection $collection)\n" -" {\n" -" $this->collection = $collection;\n" -" }\n" -"}\n\n" -"$collection = collect([1, 2, 3]);\n\n" -"$resource = $collection->pipeInto(ResourceCollection::class);\n\n" -"$resource->collection->all();\n\n" -"// [1, 2, 3]\n" -msgstr "class ResourceCollection\n" -"{\n" -" /**\n" -" * The Collection instance.\n" -" */\n" -" public $collection;\n\n" -" /**\n" -" * Create a new ResourceCollection instance.\n" -" *\n" -" * @param Collection $collection\n" -" * @return void\n" -" */\n" -" public function __construct(Collection $collection)\n" -" {\n" -" $this->collection = $collection;\n" -" }\n" -"}\n\n" -"$collection = collect([1, 2, 3]);\n\n" -"$resource = $collection->pipeInto(ResourceCollection::class);\n\n" -"$resource->collection->all();\n\n" -"// [1, 2, 3]\n" - -#: docs/8.x/collections.md:block 358 (code) -msgid "$collection = collect([1, 2, 3]);\n\n" -"$result = $collection->pipeThrough([\n" -" function ($collection) {\n" -" return $collection->merge([4, 5]);\n" -" },\n" -" function ($collection) {\n" -" return $collection->sum();\n" -" },\n" -"]);\n\n" -"// 15\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$result = $collection->pipeThrough([\n" -" function ($collection) {\n" -" return $collection->merge([4, 5]);\n" -" },\n" -" function ($collection) {\n" -" return $collection->sum();\n" -" },\n" -"]);\n\n" -"// 15\n" - -#: docs/8.x/collections.md:block 366 (code) -msgid "$collection = collect([\n" -" [\n" -" 'speakers' => [\n" -" 'first_day' => ['Rosa', 'Judith'],\n" -" 'second_day' => ['Angela', 'Kathleen'],\n" -" ],\n" -" ],\n" -"]);\n\n" -"$plucked = $collection->pluck('speakers.first_day');\n\n" -"$plucked->all();\n\n" -"// ['Rosa', 'Judith']\n" -msgstr "$collection = collect([\n" -" [\n" -" 'speakers' => [\n" -" 'first_day' => ['Rosa', 'Judith'],\n" -" 'second_day' => ['Angela', 'Kathleen'],\n" -" ],\n" -" ],\n" -"]);\n\n" -"$plucked = $collection->pluck('speakers.first_day');\n\n" -"$plucked->all();\n\n" -"// ['Rosa', 'Judith']\n" - -#: docs/8.x/collections.md:block 407 (code) -msgid "$collection = collect([1, 2, 3]);\n\n" -"$total = $collection->reduce(function ($carry, $item) {\n" -" return $carry + $item;\n" -"});\n\n" -"// 6\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$total = $collection->reduce(function ($carry, $item) {\n" -" return $carry + $item;\n" -"});\n\n" -"// 6\n" - -#: docs/8.x/collections.md:block 409 (code) -msgid "$collection->reduce(function ($carry, $item) {\n" -" return $carry + $item;\n" -"}, 4);\n\n" -"// 10\n" -msgstr "$collection->reduce(function ($carry, $item) {\n" -" return $carry + $item;\n" -"}, 4);\n\n" -"// 10\n" - -#: docs/8.x/collections.md:block 411 (code) -msgid "$collection = collect([\n" -" 'usd' => 1400,\n" -" 'gbp' => 1200,\n" -" 'eur' => 1000,\n" -"]);\n\n" -"$ratio = [\n" -" 'usd' => 1,\n" -" 'gbp' => 1.37,\n" -" 'eur' => 1.22,\n" -"];\n\n" -"$collection->reduce(function ($carry, $value, $key) use ($ratio) {\n" -" return $carry + ($value * $ratio[$key]);\n" -"});\n\n" -"// 4264\n" -msgstr "$collection = collect([\n" -" 'usd' => 1400,\n" -" 'gbp' => 1200,\n" -" 'eur' => 1000,\n" -"]);\n\n" -"$ratio = [\n" -" 'usd' => 1,\n" -" 'gbp' => 1.37,\n" -" 'eur' => 1.22,\n" -"];\n\n" -"$collection->reduce(function ($carry, $value, $key) use ($ratio) {\n" -" return $carry + ($value * $ratio[$key]);\n" -"});\n\n" -"// 4264\n" - -#: docs/8.x/collections.md:block 415 (code) -msgid "[$creditsRemaining, $batch] = Image::where('status', 'unprocessed')\n" -" ->get()\n" -" ->reduceSpread(function ($creditsRemaining, $batch, $image) {\n" -" if ($creditsRemaining >= $image->creditsRequired()) {\n" -" $batch->push($image);\n\n" -" $creditsRemaining -= $image->creditsRequired();\n" -" }\n\n" -" return [$creditsRemaining, $batch];\n" -" }, $creditsAvailable, collect());\n" -msgstr "[$creditsRemaining, $batch] = Image::where('status', 'unprocessed')\n" -" ->get()\n" -" ->reduceSpread(function ($creditsRemaining, $batch, $image) {\n" -" if ($creditsRemaining >= $image->creditsRequired()) {\n" -" $batch->push($image);\n\n" -" $creditsRemaining -= $image->creditsRequired();\n" -" }\n\n" -" return [$creditsRemaining, $batch];\n" -" }, $creditsAvailable, collect());\n" - -#: docs/8.x/collections.md:block 419 (code) -msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$filtered = $collection->reject(function ($value, $key) {\n" -" return $value > 2;\n" -"});\n\n" -"$filtered->all();\n\n" -"// [1, 2]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$filtered = $collection->reject(function ($value, $key) {\n" -" return $value > 2;\n" -"});\n\n" -"$filtered->all();\n\n" -"// [1, 2]\n" - -#: docs/8.x/collections.md:block 440 (code) -msgid "collect([2, 4, 6, 8])->search(function ($item, $key) {\n" -" return $item > 5;\n" -"});\n\n" -"// 2\n" -msgstr "collect([2, 4, 6, 8])->search(function ($item, $key) {\n" -" return $item > 5;\n" -"});\n\n" -"// 2\n" - -#: docs/8.x/collections.md:block 456 (code) -msgid "$transactions->sliding(2)->eachSpread(function ($previous, $current) {\n" -" $current->total = $previous->total + $current->amount;\n" -"});\n" -msgstr "$transactions->sliding(2)->eachSpread(function ($previous, $current) {\n" -" $current->total = $previous->total + $current->amount;\n" -"});\n" - -#: docs/8.x/collections.md:block 466 (code) -msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->skipUntil(function ($item) {\n" -" return $item >= 3;\n" -"});\n\n" -"$subset->all();\n\n" -"// [3, 4]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->skipUntil(function ($item) {\n" -" return $item >= 3;\n" -"});\n\n" -"$subset->all();\n\n" -"// [3, 4]\n" - -#: docs/8.x/collections.md:block 469 (quote) -msgid "{note} If the given value is not found or the callback never returns `true`, the `skipUntil` method will return an empty collection." -msgstr "{note} 若找不到給定的值,或是回呼從未回傳 `true`,則 `skipUntil` 方法會回傳一個空 Collection。" - -#: docs/8.x/collections.md:block 473 (code) -msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->skipWhile(function ($item) {\n" -" return $item <= 3;\n" -"});\n\n" -"$subset->all();\n\n" -"// [4]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->skipWhile(function ($item) {\n" -" return $item <= 3;\n" -"});\n\n" -"$subset->all();\n\n" -"// [4]\n" - -#: docs/8.x/collections.md:block 474 (quote) -msgid "{note} If the callback never returns `false`, the `skipWhile` method will return an empty collection." -msgstr "{note} 若該回呼從未回傳 `true`,則 `skipWhile` 方法會回傳一個空 Collection。" - -#: docs/8.x/collections.md:block 485 (code) -msgid "collect([1, 2, 3, 4])->sole(function ($value, $key) {\n" -" return $value === 2;\n" -"});\n\n" -"// 2\n" -msgstr "collect([1, 2, 3, 4])->sole(function ($value, $key) {\n" -" return $value === 2;\n" -"});\n\n" -"// 2\n" - -#: docs/8.x/collections.md:block 499 (quote) -msgid "{tip} If you need to sort a collection of nested arrays or objects, see the [`sortBy`](#method-sortby) and [`sortByDesc`](#method-sortbydesc) methods." -msgstr "{tip} 若有需要排序包含巢狀陣列或物件的 Collection,請參考 [`sortBy`](#method-sortby) 與 [`sortByDesc`](#method-sortbydesc) 方法。" - -#: docs/8.x/collections.md:block 507 (code) -msgid "$collection = collect([\n" -" ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" -" ['name' => 'Chair', 'colors' => ['Black']],\n" -" ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" -"]);\n\n" -"$sorted = $collection->sortBy(function ($product, $key) {\n" -" return count($product['colors']);\n" -"});\n\n" -"$sorted->values()->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'Chair', 'colors' => ['Black']],\n" -" ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" -" ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" -" ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" -" ['name' => 'Chair', 'colors' => ['Black']],\n" -" ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" -"]);\n\n" -"$sorted = $collection->sortBy(function ($product, $key) {\n" -" return count($product['colors']);\n" -"});\n\n" -"$sorted->values()->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'Chair', 'colors' => ['Black']],\n" -" ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" -" ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" -" ]\n" -"*/\n" - -#: docs/8.x/collections.md:block 511 (code) -msgid "$collection = collect([\n" -" ['name' => 'Taylor Otwell', 'age' => 34],\n" -" ['name' => 'Abigail Otwell', 'age' => 30],\n" -" ['name' => 'Taylor Otwell', 'age' => 36],\n" -" ['name' => 'Abigail Otwell', 'age' => 32],\n" -"]);\n\n" -"$sorted = $collection->sortBy([\n" -" fn ($a, $b) => $a['name'] <=> $b['name'],\n" -" fn ($a, $b) => $b['age'] <=> $a['age'],\n" -"]);\n\n" -"$sorted->values()->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'Abigail Otwell', 'age' => 32],\n" -" ['name' => 'Abigail Otwell', 'age' => 30],\n" -" ['name' => 'Taylor Otwell', 'age' => 36],\n" -" ['name' => 'Taylor Otwell', 'age' => 34],\n" -" ]\n" -"*/\n" -msgstr "$collection = collect([\n" -" ['name' => 'Taylor Otwell', 'age' => 34],\n" -" ['name' => 'Abigail Otwell', 'age' => 30],\n" -" ['name' => 'Taylor Otwell', 'age' => 36],\n" -" ['name' => 'Abigail Otwell', 'age' => 32],\n" -"]);\n\n" -"$sorted = $collection->sortBy([\n" -" fn ($a, $b) => $a['name'] <=> $b['name'],\n" -" fn ($a, $b) => $b['age'] <=> $a['age'],\n" -"]);\n\n" -"$sorted->values()->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'Abigail Otwell', 'age' => 32],\n" -" ['name' => 'Abigail Otwell', 'age' => 30],\n" -" ['name' => 'Taylor Otwell', 'age' => 36],\n" -" ['name' => 'Taylor Otwell', 'age' => 34],\n" -" ]\n" -"*/\n" - -#: docs/8.x/collections.md:block 555 (code) -msgid "$collection = collect([\n" -" ['name' => 'Chair', 'colors' => ['Black']],\n" -" ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" -" ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" -"]);\n\n" -"$collection->sum(function ($product) {\n" -" return count($product['colors']);\n" -"});\n\n" -"// 6\n" -msgstr "$collection = collect([\n" -" ['name' => 'Chair', 'colors' => ['Black']],\n" -" ['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],\n" -" ['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],\n" -"]);\n\n" -"$collection->sum(function ($product) {\n" -" return count($product['colors']);\n" -"});\n\n" -"// 6\n" - -#: docs/8.x/collections.md:block 565 (code) -msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->takeUntil(function ($item) {\n" -" return $item >= 3;\n" -"});\n\n" -"$subset->all();\n\n" -"// [1, 2]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->takeUntil(function ($item) {\n" -" return $item >= 3;\n" -"});\n\n" -"$subset->all();\n\n" -"// [1, 2]\n" - -#: docs/8.x/collections.md:block 568 (quote) -msgid "{note} If the given value is not found or the callback never returns `true`, the `takeUntil` method will return all items in the collection." -msgstr "{note} 若找不到給定的值,或是回呼從未回傳 `true`,則 `skipUntil` 方法會回傳該 Collection 中的所有項目。" - -#: docs/8.x/collections.md:block 572 (code) -msgid "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->takeWhile(function ($item) {\n" -" return $item < 3;\n" -"});\n\n" -"$subset->all();\n\n" -"// [1, 2]\n" -msgstr "$collection = collect([1, 2, 3, 4]);\n\n" -"$subset = $collection->takeWhile(function ($item) {\n" -" return $item < 3;\n" -"});\n\n" -"$subset->all();\n\n" -"// [1, 2]\n" - -#: docs/8.x/collections.md:block 573 (quote) -msgid "{note} If the callback never returns `false`, the `takeWhile` method will return all items in the collection." -msgstr "{note} 若回呼從未回傳 `false`,則 `takeWhile` 方法會回傳該 Collection 中的所有項目。" - -#: docs/8.x/collections.md:block 577 (code) -msgid "collect([2, 4, 3, 1, 5])\n" -" ->sort()\n" -" ->tap(function ($collection) {\n" -" Log::debug('Values after sorting', $collection->values()->all());\n" -" })\n" -" ->shift();\n\n" -"// 1\n" -msgstr "collect([2, 4, 3, 1, 5])\n" -" ->sort()\n" -" ->tap(function ($collection) {\n" -" Log::debug('Values after sorting', $collection->values()->all());\n" -" })\n" -" ->shift();\n\n" -"// 1\n" - -#: docs/8.x/collections.md:block 581 (code) -msgid "$collection = Collection::times(10, function ($number) {\n" -" return $number * 9;\n" -"});\n\n" -"$collection->all();\n\n" -"// [9, 18, 27, 36, 45, 54, 63, 72, 81, 90]\n" -msgstr "$collection = Collection::times(10, function ($number) {\n" -" return $number * 9;\n" -"});\n\n" -"$collection->all();\n\n" -"// [9, 18, 27, 36, 45, 54, 63, 72, 81, 90]\n" - -#: docs/8.x/collections.md:block 586 (quote) -msgid "{note} `toArray` also converts all of the collection's nested objects that are an instance of `Arrayable` to an array. If you want to get the raw array underlying the collection, use the [`all`](#method-all) method instead." -msgstr "{note} `toArray` 也會將該 Collection 中所有 `Arrayable` 實作的巢狀物件轉換為陣列。若只是想取得該 Collection 底層的原始陣列,請使用 [`all`](#method-all) 方法代替。" - -#: docs/8.x/collections.md:block 594 (code) -msgid "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->transform(function ($item, $key) {\n" -" return $item * 2;\n" -"});\n\n" -"$collection->all();\n\n" -"// [2, 4, 6, 8, 10]\n" -msgstr "$collection = collect([1, 2, 3, 4, 5]);\n\n" -"$collection->transform(function ($item, $key) {\n" -" return $item * 2;\n" -"});\n\n" -"$collection->all();\n\n" -"// [2, 4, 6, 8, 10]\n" - -#: docs/8.x/collections.md:block 595 (quote) -msgid "{note} Unlike most other collection methods, `transform` modifies the collection itself. If you wish to create a new collection instead, use the [`map`](#method-map) method." -msgstr "{note} 與其他 Collection 方法不同,`transform` 會修改該 Collection 本身。若想建立新的 Collection,請使用 [`map`](#method-map) 方法代替。" - -#: docs/8.x/collections.md:block 599 (code) -msgid "$person = collect([\n" -" 'name.first_name' => 'Marie',\n" -" 'name.last_name' => 'Valentine',\n" -" 'address.line_1' => '2992 Eagle Drive',\n" -" 'address.line_2' => '',\n" -" 'address.suburb' => 'Detroit',\n" -" 'address.state' => 'MI',\n" -" 'address.postcode' => '48219'\n" -"])\n\n" -"$person = $person->undot();\n\n" -"$person->toArray();\n\n" -"/*\n" -" [\n" -" \"name\" => [\n" -" \"first_name\" => \"Marie\",\n" -" \"last_name\" => \"Valentine\",\n" -" ],\n" -" \"address\" => [\n" -" \"line_1\" => \"2992 Eagle Drive\",\n" -" \"line_2\" => \"\",\n" -" \"suburb\" => \"Detroit\",\n" -" \"state\" => \"MI\",\n" -" \"postcode\" => \"48219\",\n" -" ],\n" -" ]\n" -"*/\n" -msgstr "$person = collect([\n" -" 'name.first_name' => 'Marie',\n" -" 'name.last_name' => 'Valentine',\n" -" 'address.line_1' => '2992 Eagle Drive',\n" -" 'address.line_2' => '',\n" -" 'address.suburb' => 'Detroit',\n" -" 'address.state' => 'MI',\n" -" 'address.postcode' => '48219'\n" -"])\n\n" -"$person = $person->undot();\n\n" -"$person->toArray();\n\n" -"/*\n" -" [\n" -" \"name\" => [\n" -" \"first_name\" => \"Marie\",\n" -" \"last_name\" => \"Valentine\",\n" -" ],\n" -" \"address\" => [\n" -" \"line_1\" => \"2992 Eagle Drive\",\n" -" \"line_2\" => \"\",\n" -" \"suburb\" => \"Detroit\",\n" -" \"state\" => \"MI\",\n" -" \"postcode\" => \"48219\",\n" -" ],\n" -" ]\n" -"*/\n" - -#: docs/8.x/collections.md:block 611 (code) -msgid "$unique = $collection->unique(function ($item) {\n" -" return $item['brand'].$item['type'];\n" -"});\n\n" -"$unique->values()->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'iPhone 6', 'brand' => 'Apple', 'type' => 'phone'],\n" -" ['name' => 'Apple Watch', 'brand' => 'Apple', 'type' => 'watch'],\n" -" ['name' => 'Galaxy S6', 'brand' => 'Samsung', 'type' => 'phone'],\n" -" ['name' => 'Galaxy Gear', 'brand' => 'Samsung', 'type' => 'watch'],\n" -" ]\n" -"*/\n" -msgstr "$unique = $collection->unique(function ($item) {\n" -" return $item['brand'].$item['type'];\n" -"});\n\n" -"$unique->values()->all();\n\n" -"/*\n" -" [\n" -" ['name' => 'iPhone 6', 'brand' => 'Apple', 'type' => 'phone'],\n" -" ['name' => 'Apple Watch', 'brand' => 'Apple', 'type' => 'watch'],\n" -" ['name' => 'Galaxy S6', 'brand' => 'Samsung', 'type' => 'phone'],\n" -" ['name' => 'Galaxy Gear', 'brand' => 'Samsung', 'type' => 'watch'],\n" -" ]\n" -"*/\n" - -#: docs/8.x/collections.md:block 613 (quote) -msgid "{tip} This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-unique)." -msgstr "{tip} 在使用 [Eloquent Collection](/docs/{{version}}/eloquent-collections#method-unique) 時,該方法的行為有經過修改。" - -#: docs/8.x/collections.md:block 620 (code) -msgid "$collection = collect([1, 2, 3]);\n\n" -"$collection->unless(true, function ($collection) {\n" -" return $collection->push(4);\n" -"});\n\n" -"$collection->unless(false, function ($collection) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 5]\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$collection->unless(true, function ($collection) {\n" -" return $collection->push(4);\n" -"});\n\n" -"$collection->unless(false, function ($collection) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 5]\n" - -#: docs/8.x/collections.md:block 622 (code) -msgid "$collection = collect([1, 2, 3]);\n\n" -"$collection->unless(true, function ($collection) {\n" -" return $collection->push(4);\n" -"}, function ($collection) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 5]\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$collection->unless(true, function ($collection) {\n" -" return $collection->push(4);\n" -"}, function ($collection) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 5]\n" - -#: docs/8.x/collections.md:block 640 (paragraph) -msgid "The `when` method will execute the given callback when the first argument given to the method evaluates to `true`:" -msgstr "`when` 方法會在傳入該方法的第一個引數取值為 `true` 時執行給定的回呼:" - -#: docs/8.x/collections.md:block 641 (code) -msgid "$collection = collect([1, 2, 3]);\n\n" -"$collection->when(true, function ($collection) {\n" -" return $collection->push(4);\n" -"});\n\n" -"$collection->when(false, function ($collection) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 4]\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$collection->when(true, function ($collection) {\n" -" return $collection->push(4);\n" -"});\n\n" -"$collection->when(false, function ($collection) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 4]\n" - -#: docs/8.x/collections.md:block 643 (code) -msgid "$collection = collect([1, 2, 3]);\n\n" -"$collection->when(false, function ($collection) {\n" -" return $collection->push(4);\n" -"}, function ($collection) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 5]\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$collection->when(false, function ($collection) {\n" -" return $collection->push(4);\n" -"}, function ($collection) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 5]\n" - -#: docs/8.x/collections.md:block 648 (code) -msgid "$collection = collect(['Michael', 'Tom']);\n\n" -"$collection->whenEmpty(function ($collection) {\n" -" return $collection->push('Adam');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['Michael', 'Tom']\n\n\n" -"$collection = collect();\n\n" -"$collection->whenEmpty(function ($collection) {\n" -" return $collection->push('Adam');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['Adam']\n" -msgstr "$collection = collect(['Michael', 'Tom']);\n\n" -"$collection->whenEmpty(function ($collection) {\n" -" return $collection->push('Adam');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['Michael', 'Tom']\n\n\n" -"$collection = collect();\n\n" -"$collection->whenEmpty(function ($collection) {\n" -" return $collection->push('Adam');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['Adam']\n" - -#: docs/8.x/collections.md:block 650 (code) -msgid "$collection = collect(['Michael', 'Tom']);\n\n" -"$collection->whenEmpty(function ($collection) {\n" -" return $collection->push('Adam');\n" -"}, function ($collection) {\n" -" return $collection->push('Taylor');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['Michael', 'Tom', 'Taylor']\n" -msgstr "$collection = collect(['Michael', 'Tom']);\n\n" -"$collection->whenEmpty(function ($collection) {\n" -" return $collection->push('Adam');\n" -"}, function ($collection) {\n" -" return $collection->push('Taylor');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['Michael', 'Tom', 'Taylor']\n" - -#: docs/8.x/collections.md:block 655 (code) -msgid "$collection = collect(['michael', 'tom']);\n\n" -"$collection->whenNotEmpty(function ($collection) {\n" -" return $collection->push('adam');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['michael', 'tom', 'adam']\n\n\n" -"$collection = collect();\n\n" -"$collection->whenNotEmpty(function ($collection) {\n" -" return $collection->push('adam');\n" -"});\n\n" -"$collection->all();\n\n" -"// []\n" -msgstr "$collection = collect(['michael', 'tom']);\n\n" -"$collection->whenNotEmpty(function ($collection) {\n" -" return $collection->push('adam');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['michael', 'tom', 'adam']\n\n\n" -"$collection = collect();\n\n" -"$collection->whenNotEmpty(function ($collection) {\n" -" return $collection->push('adam');\n" -"});\n\n" -"$collection->all();\n\n" -"// []\n" - -#: docs/8.x/collections.md:block 657 (code) -msgid "$collection = collect();\n\n" -"$collection->whenNotEmpty(function ($collection) {\n" -" return $collection->push('adam');\n" -"}, function ($collection) {\n" -" return $collection->push('taylor');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['taylor']\n" -msgstr "$collection = collect();\n\n" -"$collection->whenNotEmpty(function ($collection) {\n" -" return $collection->push('adam');\n" -"}, function ($collection) {\n" -" return $collection->push('taylor');\n" -"});\n\n" -"$collection->all();\n\n" -"// ['taylor']\n" - -#: docs/8.x/collections.md:block 664 (paragraph) -msgid "Optionally, you may pass a comparison operator as the second parameter." -msgstr "若有需要,也可以傳入一個比較運算子來作為第二個參數。" - -#: docs/8.x/collections.md:block 724 (quote) -msgid "{note} Before learning more about Laravel's lazy collections, take some time to familiarize yourself with [PHP generators](https://www.php.net/manual/en/language.generators.overview.php)." -msgstr "{note} 在開始學習有關 Laravel 的 Lazy Collection 之前,建議先花點時間熟悉 [PHP Generator](https://www.php.net/manual/en/language.generators.overview.php)。" - -#: docs/8.x/collections.md:block 727 (code) -msgid "use App\\Models\\LogEntry;\n" -"use Illuminate\\Support\\LazyCollection;\n\n" -"LazyCollection::make(function () {\n" -" $handle = fopen('log.txt', 'r');\n\n" -" while (($line = fgets($handle)) !== false) {\n" -" yield $line;\n" -" }\n" -"})->chunk(4)->map(function ($lines) {\n" -" return LogEntry::fromLines($lines);\n" -"})->each(function (LogEntry $logEntry) {\n" -" // Process the log entry...\n" -"});\n" -msgstr "use App\\Models\\LogEntry;\n" -"use Illuminate\\Support\\LazyCollection;\n\n" -"LazyCollection::make(function () {\n" -" $handle = fopen('log.txt', 'r');\n\n" -" while (($line = fgets($handle)) !== false) {\n" -" yield $line;\n" -" }\n" -"})->chunk(4)->map(function ($lines) {\n" -" return LogEntry::fromLines($lines);\n" -"})->each(function (LogEntry $logEntry) {\n" -" // Process the log entry...\n" -"});\n" - -#: docs/8.x/collections.md:block 729 (code) -msgid "use App\\Models\\User;\n\n" -"$users = User::all()->filter(function ($user) {\n" -" return $user->id > 500;\n" -"});\n" -msgstr "use App\\Models\\User;\n\n" -"$users = User::all()->filter(function ($user) {\n" -" return $user->id > 500;\n" -"});\n" - -#: docs/8.x/collections.md:block 731 (code) +# CODE: php +#: ./docs/11.x/collections.md:3756 msgid "use App\\Models\\User;\n\n" -"$users = User::cursor()->filter(function ($user) {\n" -" return $user->id > 500;\n" -"});\n\n" -"foreach ($users as $user) {\n" -" echo $user->id;\n" -"}\n" -msgstr "use App\\Models\\User;\n\n" -"$users = User::cursor()->filter(function ($user) {\n" -" return $user->id > 500;\n" -"});\n\n" -"foreach ($users as $user) {\n" -" echo $user->id;\n" -"}\n" - -#: docs/8.x/collections.md:block 740 (paragraph) -msgid "[all](#method-all) [average](#method-average) [avg](#method-avg) [chunk](#method-chunk) [chunkWhile](#method-chunkwhile) [collapse](#method-collapse) [collect](#method-collect) [combine](#method-combine) [concat](#method-concat) [contains](#method-contains) [containsStrict](#method-containsstrict) [count](#method-count) [countBy](#method-countBy) [crossJoin](#method-crossjoin) [dd](#method-dd) [diff](#method-diff) [diffAssoc](#method-diffassoc) [diffKeys](#method-diffkeys) [dump](#method-dump) [duplicates](#method-duplicates) [duplicatesStrict](#method-duplicatesstrict) [each](#method-each) [eachSpread](#method-eachspread) [every](#method-every) [except](#method-except) [filter](#method-filter) [first](#method-first) [firstWhere](#method-first-where) [flatMap](#method-flatmap) [flatten](#method-flatten) [flip](#method-flip) [forPage](#method-forpage) [get](#method-get) [groupBy](#method-groupby) [has](#method-has) [implode](#method-implode) [intersect](#method-intersect) [intersectByKeys](#method-intersectbykeys) [isEmpty](#method-isempty) [isNotEmpty](#method-isnotempty) [join](#method-join) [keyBy](#method-keyby) [keys](#method-keys) [last](#method-last) [macro](#method-macro) [make](#method-make) [map](#method-map) [mapInto](#method-mapinto) [mapSpread](#method-mapspread) [mapToGroups](#method-maptogroups) [mapWithKeys](#method-mapwithkeys) [max](#method-max) [median](#method-median) [merge](#method-merge) [mergeRecursive](#method-mergerecursive) [min](#method-min) [mode](#method-mode) [nth](#method-nth) [only](#method-only) [pad](#method-pad) [partition](#method-partition) [pipe](#method-pipe) [pluck](#method-pluck) [random](#method-random) [reduce](#method-reduce) [reject](#method-reject) [replace](#method-replace) [replaceRecursive](#method-replacerecursive) [reverse](#method-reverse) [search](#method-search) [shuffle](#method-shuffle) [skip](#method-skip) [slice](#method-slice) [some](#method-some) [sort](#method-sort) [sortBy](#method-sortby) [sortByDesc](#method-sortbydesc) [sortKeys](#method-sortkeys) [sortKeysDesc](#method-sortkeysdesc) [split](#method-split) [sum](#method-sum) [take](#method-take) [tap](#method-tap) [times](#method-times) [toArray](#method-toarray) [toJson](#method-tojson) [union](#method-union) [unique](#method-unique) [uniqueStrict](#method-uniquestrict) [unless](#method-unless) [unlessEmpty](#method-unlessempty) [unlessNotEmpty](#method-unlessnotempty) [unwrap](#method-unwrap) [values](#method-values) [when](#method-when) [whenEmpty](#method-whenempty) [whenNotEmpty](#method-whennotempty) [where](#method-where) [whereStrict](#method-wherestrict) [whereBetween](#method-wherebetween) [whereIn](#method-wherein) [whereInStrict](#method-whereinstrict) [whereInstanceOf](#method-whereinstanceof) [whereNotBetween](#method-wherenotbetween) [whereNotIn](#method-wherenotin) [whereNotInStrict](#method-wherenotinstrict) [wrap](#method-wrap) [zip](#method-zip)" -msgstr "[all](#method-all) [average](#method-average) [avg](#method-avg) [chunk](#method-chunk) [chunkWhile](#method-chunkwhile) [collapse](#method-collapse) [collect](#method-collect) [combine](#method-combine) [concat](#method-concat) [contains](#method-contains) [containsStrict](#method-containsstrict) [count](#method-count) [countBy](#method-countBy) [crossJoin](#method-crossjoin) [dd](#method-dd) [diff](#method-diff) [diffAssoc](#method-diffassoc) [diffKeys](#method-diffkeys) [dump](#method-dump) [duplicates](#method-duplicates) [duplicatesStrict](#method-duplicatesstrict) [each](#method-each) [eachSpread](#method-eachspread) [every](#method-every) [except](#method-except) [filter](#method-filter) [first](#method-first) [firstWhere](#method-first-where) [flatMap](#method-flatmap) [flatten](#method-flatten) [flip](#method-flip) [forPage](#method-forpage) [get](#method-get) [groupBy](#method-groupby) [has](#method-has) [implode](#method-implode) [intersect](#method-intersect) [intersectByKeys](#method-intersectbykeys) [isEmpty](#method-isempty) [isNotEmpty](#method-isnotempty) [join](#method-join) [keyBy](#method-keyby) [keys](#method-keys) [last](#method-last) [macro](#method-macro) [make](#method-make) [map](#method-map) [mapInto](#method-mapinto) [mapSpread](#method-mapspread) [mapToGroups](#method-maptogroups) [mapWithKeys](#method-mapwithkeys) [max](#method-max) [median](#method-median) [merge](#method-merge) [mergeRecursive](#method-mergerecursive) [min](#method-min) [mode](#method-mode) [nth](#method-nth) [only](#method-only) [pad](#method-pad) [partition](#method-partition) [pipe](#method-pipe) [pluck](#method-pluck) [random](#method-random) [reduce](#method-reduce) [reject](#method-reject) [replace](#method-replace) [replaceRecursive](#method-replacerecursive) [reverse](#method-reverse) [search](#method-search) [shuffle](#method-shuffle) [skip](#method-skip) [slice](#method-slice) [some](#method-some) [sort](#method-sort) [sortBy](#method-sortby) [sortByDesc](#method-sortbydesc) [sortKeys](#method-sortkeys) [sortKeysDesc](#method-sortkeysdesc) [split](#method-split) [sum](#method-sum) [take](#method-take) [tap](#method-tap) [times](#method-times) [toArray](#method-toarray) [toJson](#method-tojson) [union](#method-union) [unique](#method-unique) [uniqueStrict](#method-uniquestrict) [unless](#method-unless) [unlessEmpty](#method-unlessempty) [unlessNotEmpty](#method-unlessnotempty) [unwrap](#method-unwrap) [values](#method-values) [when](#method-when) [whenEmpty](#method-whenempty) [whenNotEmpty](#method-whennotempty) [where](#method-where) [whereStrict](#method-wherestrict) [whereBetween](#method-wherebetween) [whereIn](#method-wherein) [whereInStrict](#method-whereinstrict) [whereInstanceOf](#method-whereinstanceof) [whereNotBetween](#method-wherenotbetween) [whereNotIn](#method-wherenotin) [whereNotInStrict](#method-wherenotinstrict) [wrap](#method-wrap) [zip](#method-zip)" - -#: docs/8.x/collections.md:block 742 (quote) -msgid "{note} Methods that mutate the collection (such as `shift`, `pop`, `prepend` etc.) are **not** available on the `LazyCollection` class." -msgstr "{note} 會^[修改](Mutate) Collection 的方法 (如 `shift`、`pop`、`prepend` 等) 在 `LazyCollection` 類別上都 **不可用**。" - -#: docs/8.x/collections.md:block 749 (code) -msgid "$lazyCollection = LazyCollection::times(INF)\n" -" ->takeUntilTimeout(now()->addMinute());\n\n" -"$lazyCollection->each(function ($number) {\n" -" dump($number);\n\n" -" sleep(1);\n" -"});\n\n" -"// 1\n" -"// 2\n" -"// ...\n" -"// 58\n" -"// 59\n" -msgstr "$lazyCollection = LazyCollection::times(INF)\n" -" ->takeUntilTimeout(now()->addMinute());\n\n" -"$lazyCollection->each(function ($number) {\n" -" dump($number);\n\n" -" sleep(1);\n" -"});\n\n" -"// 1\n" -"// 2\n" -"// ...\n" -"// 58\n" -"// 59\n" - -#: docs/8.x/collections.md:block 751 (code) -msgid "use App\\Models\\Invoice;\n" -"use Illuminate\\Support\\Carbon;\n\n" -"Invoice::pending()->cursor()\n" -" ->takeUntilTimeout(\n" -" Carbon::createFromTimestamp(LARAVEL_START)->add(14, 'minutes')\n" -" )\n" -" ->each(fn ($invoice) => $invoice->submit());\n" -msgstr "use App\\Models\\Invoice;\n" -"use Illuminate\\Support\\Carbon;\n\n" -"Invoice::pending()->cursor()\n" -" ->takeUntilTimeout(\n" -" Carbon::createFromTimestamp(LARAVEL_START)->add(14, 'minutes')\n" -" )\n" -" ->each(fn ($invoice) => $invoice->submit());\n" - -#: docs/8.x/collections.md:block 755 (code) -msgid "// Nothing has been dumped so far...\n" -"$lazyCollection = LazyCollection::times(INF)->tapEach(function ($value) {\n" -" dump($value);\n" -"});\n\n" -"// Three items are dumped...\n" -"$array = $lazyCollection->take(3)->all();\n\n" -"// 1\n" -"// 2\n" -"// 3\n" -msgstr "// 還未傾印任何結果...\n" -"$lazyCollection = LazyCollection::times(INF)->tapEach(function ($value) {\n" -" dump($value);\n" -"});\n\n" -"// 傾印三個項目...\n" -"$array = $lazyCollection->take(3)->all();\n\n" -"// 1\n" -"// 2\n" -"// 3\n" - -#: docs/9.x/collections.md:block 27 (paragraph) -msgid "[all](#method-all) [average](#method-average) [avg](#method-avg) [chunk](#method-chunk) [chunkWhile](#method-chunkwhile) [collapse](#method-collapse) [collect](#method-collect) [combine](#method-combine) [concat](#method-concat) [contains](#method-contains) [containsOneItem](#method-containsoneitem) [containsStrict](#method-containsstrict) [count](#method-count) [countBy](#method-countBy) [crossJoin](#method-crossjoin) [dd](#method-dd) [diff](#method-diff) [diffAssoc](#method-diffassoc) [diffKeys](#method-diffkeys) [doesntContain](#method-doesntcontain) [dump](#method-dump) [duplicates](#method-duplicates) [duplicatesStrict](#method-duplicatesstrict) [each](#method-each) [eachSpread](#method-eachspread) [every](#method-every) [except](#method-except) [filter](#method-filter) [first](#method-first) [firstOrFail](#method-first-or-fail) [firstWhere](#method-first-where) [flatMap](#method-flatmap) [flatten](#method-flatten) [flip](#method-flip) [forget](#method-forget) [forPage](#method-forpage) [get](#method-get) [groupBy](#method-groupby) [has](#method-has) [hasAny](#method-hasany) [implode](#method-implode) [intersect](#method-intersect) [intersectByKeys](#method-intersectbykeys) [isEmpty](#method-isempty) [isNotEmpty](#method-isnotempty) [join](#method-join) [keyBy](#method-keyby) [keys](#method-keys) [last](#method-last) [lazy](#method-lazy) [macro](#method-macro) [make](#method-make) [map](#method-map) [mapInto](#method-mapinto) [mapSpread](#method-mapspread) [mapToGroups](#method-maptogroups) [mapWithKeys](#method-mapwithkeys) [max](#method-max) [median](#method-median) [merge](#method-merge) [mergeRecursive](#method-mergerecursive) [min](#method-min) [mode](#method-mode) [nth](#method-nth) [only](#method-only) [pad](#method-pad) [partition](#method-partition) [pipe](#method-pipe) [pipeInto](#method-pipeinto) [pipeThrough](#method-pipethrough) [pluck](#method-pluck) [pop](#method-pop) [prepend](#method-prepend) [pull](#method-pull) [push](#method-push) [put](#method-put) [random](#method-random) [range](#method-range) [reduce](#method-reduce) [reduceSpread](#method-reduce-spread) [reject](#method-reject) [replace](#method-replace) [replaceRecursive](#method-replacerecursive) [reverse](#method-reverse) [search](#method-search) [shift](#method-shift) [shuffle](#method-shuffle) [skip](#method-skip) [skipUntil](#method-skipuntil) [skipWhile](#method-skipwhile) [slice](#method-slice) [sliding](#method-sliding) [sole](#method-sole) [some](#method-some) [sort](#method-sort) [sortBy](#method-sortby) [sortByDesc](#method-sortbydesc) [sortDesc](#method-sortdesc) [sortKeys](#method-sortkeys) [sortKeysDesc](#method-sortkeysdesc) [sortKeysUsing](#method-sortkeysusing) [splice](#method-splice) [split](#method-split) [splitIn](#method-splitin) [sum](#method-sum) [take](#method-take) [takeUntil](#method-takeuntil) [takeWhile](#method-takewhile) [tap](#method-tap) [times](#method-times) [toArray](#method-toarray) [toJson](#method-tojson) [transform](#method-transform) [undot](#method-undot) [union](#method-union) [unique](#method-unique) [uniqueStrict](#method-uniquestrict) [unless](#method-unless) [unlessEmpty](#method-unlessempty) [unlessNotEmpty](#method-unlessnotempty) [unwrap](#method-unwrap) [value](#method-value) [values](#method-values) [when](#method-when) [whenEmpty](#method-whenempty) [whenNotEmpty](#method-whennotempty) [where](#method-where) [whereStrict](#method-wherestrict) [whereBetween](#method-wherebetween) [whereIn](#method-wherein) [whereInStrict](#method-whereinstrict) [whereInstanceOf](#method-whereinstanceof) [whereNotBetween](#method-wherenotbetween) [whereNotIn](#method-wherenotin) [whereNotInStrict](#method-wherenotinstrict) [whereNotNull](#method-wherenotnull) [whereNull](#method-wherenull) [wrap](#method-wrap) [zip](#method-zip)" -msgstr "[all](#method-all) [average](#method-average) [avg](#method-avg) [chunk](#method-chunk) [chunkWhile](#method-chunkwhile) [collapse](#method-collapse) [collect](#method-collect) [combine](#method-combine) [concat](#method-concat) [contains](#method-contains) [containsOneItem](#method-containsoneitem) [containsStrict](#method-containsstrict) [count](#method-count) [countBy](#method-countBy) [crossJoin](#method-crossjoin) [dd](#method-dd) [diff](#method-diff) [diffAssoc](#method-diffassoc) [diffKeys](#method-diffkeys) [doesntContain](#method-doesntcontain) [dump](#method-dump) [duplicates](#method-duplicates) [duplicatesStrict](#method-duplicatesstrict) [each](#method-each) [eachSpread](#method-eachspread) [every](#method-every) [except](#method-except) [filter](#method-filter) [first](#method-first) [firstOrFail](#method-first-or-fail) [firstWhere](#method-first-where) [flatMap](#method-flatmap) [flatten](#method-flatten) [flip](#method-flip) [forget](#method-forget) [forPage](#method-forpage) [get](#method-get) [groupBy](#method-groupby) [has](#method-has) [hasAny](#method-hasany) [implode](#method-implode) [intersect](#method-intersect) [intersectByKeys](#method-intersectbykeys) [isEmpty](#method-isempty) [isNotEmpty](#method-isnotempty) [join](#method-join) [keyBy](#method-keyby) [keys](#method-keys) [last](#method-last) [lazy](#method-lazy) [macro](#method-macro) [make](#method-make) [map](#method-map) [mapInto](#method-mapinto) [mapSpread](#method-mapspread) [mapToGroups](#method-maptogroups) [mapWithKeys](#method-mapwithkeys) [max](#method-max) [median](#method-median) [merge](#method-merge) [mergeRecursive](#method-mergerecursive) [min](#method-min) [mode](#method-mode) [nth](#method-nth) [only](#method-only) [pad](#method-pad) [partition](#method-partition) [pipe](#method-pipe) [pipeInto](#method-pipeinto) [pipeThrough](#method-pipethrough) [pluck](#method-pluck) [pop](#method-pop) [prepend](#method-prepend) [pull](#method-pull) [push](#method-push) [put](#method-put) [random](#method-random) [range](#method-range) [reduce](#method-reduce) [reduceSpread](#method-reduce-spread) [reject](#method-reject) [replace](#method-replace) [replaceRecursive](#method-replacerecursive) [reverse](#method-reverse) [search](#method-search) [shift](#method-shift) [shuffle](#method-shuffle) [skip](#method-skip) [skipUntil](#method-skipuntil) [skipWhile](#method-skipwhile) [slice](#method-slice) [sliding](#method-sliding) [sole](#method-sole) [some](#method-some) [sort](#method-sort) [sortBy](#method-sortby) [sortByDesc](#method-sortbydesc) [sortDesc](#method-sortdesc) [sortKeys](#method-sortkeys) [sortKeysDesc](#method-sortkeysdesc) [sortKeysUsing](#method-sortkeysusing) [splice](#method-splice) [split](#method-split) [splitIn](#method-splitin) [sum](#method-sum) [take](#method-take) [takeUntil](#method-takeuntil) [takeWhile](#method-takewhile) [tap](#method-tap) [times](#method-times) [toArray](#method-toarray) [toJson](#method-tojson) [transform](#method-transform) [undot](#method-undot) [union](#method-union) [unique](#method-unique) [uniqueStrict](#method-uniquestrict) [unless](#method-unless) [unlessEmpty](#method-unlessempty) [unlessNotEmpty](#method-unlessnotempty) [unwrap](#method-unwrap) [value](#method-value) [values](#method-values) [when](#method-when) [whenEmpty](#method-whenempty) [whenNotEmpty](#method-whennotempty) [where](#method-where) [whereStrict](#method-wherestrict) [whereBetween](#method-wherebetween) [whereIn](#method-wherein) [whereInStrict](#method-whereinstrict) [whereInstanceOf](#method-whereinstanceof) [whereNotBetween](#method-wherenotbetween) [whereNotIn](#method-wherenotin) [whereNotInStrict](#method-wherenotinstrict) [whereNotNull](#method-wherenotnull) [whereNull](#method-wherenull) [wrap](#method-wrap) [zip](#method-zip)" - -#: docs/9.x/collections.md:block 186 (code) -msgid "collect([1, 2, 3, 4])->firstOrFail(function ($value, $key) {\n" -" return $value > 5;\n" -"});\n\n" -"// Throws ItemNotFoundException...\n" -msgstr "collect([1, 2, 3, 4])->firstOrFail(function ($value, $key) {\n" -" return $value > 5;\n" -"});\n\n" -"// 擲回 ItemNotFoundException...\n" - -#: docs/9.x/collections.md:block 236 (code) -msgid "$data = new Collection([\n" -" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" -" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" -" 30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],\n" -" 40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],\n" -"]);\n\n" -"$result = $data->groupBy(['skill', function ($item) {\n" -" return $item['roles'];\n" -"}], preserveKeys: true);\n\n" -"/*\n" -"[\n" -" 1 => [\n" -" 'Role_1' => [\n" -" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" -" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" -" ],\n" -" 'Role_2' => [\n" -" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" -" ],\n" -" 'Role_3' => [\n" -" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" -" ],\n" -" ],\n" -" 2 => [\n" -" 'Role_1' => [\n" -" 30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],\n" -" ],\n" -" 'Role_2' => [\n" -" 40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],\n" -" ],\n" -" ],\n" -"];\n" -"*/\n" -msgstr "$data = new Collection([\n" -" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" -" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" -" 30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],\n" -" 40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],\n" -"]);\n\n" -"$result = $data->groupBy(['skill', function ($item) {\n" -" return $item['roles'];\n" -"}], preserveKeys: true);\n\n" -"/*\n" -"[\n" -" 1 => [\n" -" 'Role_1' => [\n" -" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" -" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" -" ],\n" -" 'Role_2' => [\n" -" 20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],\n" -" ],\n" -" 'Role_3' => [\n" -" 10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],\n" -" ],\n" -" ],\n" -" 2 => [\n" -" 'Role_1' => [\n" -" 30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],\n" -" ],\n" -" 'Role_2' => [\n" -" 40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],\n" -" ],\n" -" ],\n" -"];\n" -"*/\n" - -#: docs/9.x/collections.md:block 252 (code) -msgid "$collection->implode(function ($item, $key) {\n" -" return strtoupper($item['product']);\n" -"}, ', ');\n\n" -"// DESK, CHAIR\n" -msgstr "$collection->implode(function ($item, $key) {\n" -" return strtoupper($item['product']);\n" -"}, ', ');\n\n" -"// DESK, CHAIR\n" - -#: docs/9.x/collections.md:block 279 (code) -msgid "$keyed = $collection->keyBy(function ($item, $key) {\n" -" return strtoupper($item['product_id']);\n" -"});\n\n" -"$keyed->all();\n\n" -"/*\n" -" [\n" -" 'PROD-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],\n" -" 'PROD-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],\n" -" ]\n" -"*/\n" -msgstr "$keyed = $collection->keyBy(function ($item, $key) {\n" -" return strtoupper($item['product_id']);\n" -"});\n\n" -"$keyed->all();\n\n" -"/*\n" -" [\n" -" 'PROD-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],\n" -" 'PROD-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],\n" -" ]\n" -"*/\n" - -#: docs/9.x/collections.md:block 293 (code) -msgid "$lazyCollection = collect([1, 2, 3, 4])->lazy();\n\n" -"get_class($lazyCollection);\n\n" -"// Illuminate\\Support\\LazyCollection\n\n" -"$lazyCollection->all();\n\n" -"// [1, 2, 3, 4]\n" -msgstr "$lazyCollection = collect([1, 2, 3, 4])->lazy();\n\n" -"get_class($lazyCollection);\n\n" -"// Illuminate\\Support\\LazyCollection\n\n" -"$lazyCollection->all();\n\n" -"// [1, 2, 3, 4]\n" - -#: docs/9.x/collections.md:block 425 (code) -msgid "$random = $collection->random(fn ($items) => min(10, count($items)));\n\n" -"$random->all();\n\n" -"// [1, 2, 3, 4, 5] - (retrieved randomly)\n" -msgstr "$random = $collection->random(fn ($items) => min(10, count($items)));\n\n" -"$random->all();\n\n" -"// [1, 2, 3, 4, 5] - (隨機取得)\n" - -#: docs/9.x/collections.md:block 441 (code) -msgid "[$creditsRemaining, $batch] = Image::where('status', 'unprocessed')\n" -" ->get()\n" -" ->reduceSpread(function ($creditsRemaining, $batch, $image) {\n" -" if ($creditsRemaining >= $image->creditsRequired()) {\n" -" $batch->push($image);\n\n" -" $creditsRemaining -= $image->creditsRequired();\n" -" }\n\n" -" return [$creditsRemaining, $batch];\n" -" }, $creditsAvailable, collect());\n" -msgstr "[$creditsRemaining, $batch] = Image::where('status', 'unprocessed')\n" -" ->get()\n" -" ->reduceSpread(function ($creditsRemaining, $batch, $image) {\n" -" if ($creditsRemaining >= $image->creditsRequired()) {\n" -" $batch->push($image);\n\n" -" $creditsRemaining -= $image->creditsRequired();\n" -" }\n\n" -" return [$creditsRemaining, $batch];\n" -" }, $creditsAvailable, collect());\n" - -#: docs/9.x/collections.md:block 671 (code) -msgid "$collection = collect([1, 2, 3]);\n\n" -"$collection->when(true, function ($collection, $value) {\n" -" return $collection->push(4);\n" -"});\n\n" -"$collection->when(false, function ($collection, $value) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 4]\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$collection->when(true, function ($collection, $value) {\n" -" return $collection->push(4);\n" -"});\n\n" -"$collection->when(false, function ($collection, $value) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 4]\n" - -#: docs/9.x/collections.md:block 673 (code) -msgid "$collection = collect([1, 2, 3]);\n\n" -"$collection->when(false, function ($collection, $value) {\n" -" return $collection->push(4);\n" -"}, function ($collection) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 5]\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$collection->when(false, function ($collection, $value) {\n" -" return $collection->push(4);\n" -"}, function ($collection) {\n" -" return $collection->push(5);\n" -"});\n\n" -"$collection->all();\n\n" -"// [1, 2, 3, 5]\n" - -#: docs/9.x/collections.md:block 771 (paragraph) -msgid "[all](#method-all) [average](#method-average) [avg](#method-avg) [chunk](#method-chunk) [chunkWhile](#method-chunkwhile) [collapse](#method-collapse) [collect](#method-collect) [combine](#method-combine) [concat](#method-concat) [contains](#method-contains) [containsStrict](#method-containsstrict) [count](#method-count) [countBy](#method-countBy) [crossJoin](#method-crossjoin) [dd](#method-dd) [diff](#method-diff) [diffAssoc](#method-diffassoc) [diffKeys](#method-diffkeys) [dump](#method-dump) [duplicates](#method-duplicates) [duplicatesStrict](#method-duplicatesstrict) [each](#method-each) [eachSpread](#method-eachspread) [every](#method-every) [except](#method-except) [filter](#method-filter) [first](#method-first) [firstOrFail](#method-first-or-fail) [firstWhere](#method-first-where) [flatMap](#method-flatmap) [flatten](#method-flatten) [flip](#method-flip) [forPage](#method-forpage) [get](#method-get) [groupBy](#method-groupby) [has](#method-has) [implode](#method-implode) [intersect](#method-intersect) [intersectByKeys](#method-intersectbykeys) [isEmpty](#method-isempty) [isNotEmpty](#method-isnotempty) [join](#method-join) [keyBy](#method-keyby) [keys](#method-keys) [last](#method-last) [macro](#method-macro) [make](#method-make) [map](#method-map) [mapInto](#method-mapinto) [mapSpread](#method-mapspread) [mapToGroups](#method-maptogroups) [mapWithKeys](#method-mapwithkeys) [max](#method-max) [median](#method-median) [merge](#method-merge) [mergeRecursive](#method-mergerecursive) [min](#method-min) [mode](#method-mode) [nth](#method-nth) [only](#method-only) [pad](#method-pad) [partition](#method-partition) [pipe](#method-pipe) [pluck](#method-pluck) [random](#method-random) [reduce](#method-reduce) [reject](#method-reject) [replace](#method-replace) [replaceRecursive](#method-replacerecursive) [reverse](#method-reverse) [search](#method-search) [shuffle](#method-shuffle) [skip](#method-skip) [slice](#method-slice) [sole](#method-sole) [some](#method-some) [sort](#method-sort) [sortBy](#method-sortby) [sortByDesc](#method-sortbydesc) [sortKeys](#method-sortkeys) [sortKeysDesc](#method-sortkeysdesc) [split](#method-split) [sum](#method-sum) [take](#method-take) [tap](#method-tap) [times](#method-times) [toArray](#method-toarray) [toJson](#method-tojson) [union](#method-union) [unique](#method-unique) [uniqueStrict](#method-uniquestrict) [unless](#method-unless) [unlessEmpty](#method-unlessempty) [unlessNotEmpty](#method-unlessnotempty) [unwrap](#method-unwrap) [values](#method-values) [when](#method-when) [whenEmpty](#method-whenempty) [whenNotEmpty](#method-whennotempty) [where](#method-where) [whereStrict](#method-wherestrict) [whereBetween](#method-wherebetween) [whereIn](#method-wherein) [whereInStrict](#method-whereinstrict) [whereInstanceOf](#method-whereinstanceof) [whereNotBetween](#method-wherenotbetween) [whereNotIn](#method-wherenotin) [whereNotInStrict](#method-wherenotinstrict) [wrap](#method-wrap) [zip](#method-zip)" -msgstr "[all](#method-all) [average](#method-average) [avg](#method-avg) [chunk](#method-chunk) [chunkWhile](#method-chunkwhile) [collapse](#method-collapse) [collect](#method-collect) [combine](#method-combine) [concat](#method-concat) [contains](#method-contains) [containsStrict](#method-containsstrict) [count](#method-count) [countBy](#method-countBy) [crossJoin](#method-crossjoin) [dd](#method-dd) [diff](#method-diff) [diffAssoc](#method-diffassoc) [diffKeys](#method-diffkeys) [dump](#method-dump) [duplicates](#method-duplicates) [duplicatesStrict](#method-duplicatesstrict) [each](#method-each) [eachSpread](#method-eachspread) [every](#method-every) [except](#method-except) [filter](#method-filter) [first](#method-first) [firstOrFail](#method-first-or-fail) [firstWhere](#method-first-where) [flatMap](#method-flatmap) [flatten](#method-flatten) [flip](#method-flip) [forPage](#method-forpage) [get](#method-get) [groupBy](#method-groupby) [has](#method-has) [implode](#method-implode) [intersect](#method-intersect) [intersectByKeys](#method-intersectbykeys) [isEmpty](#method-isempty) [isNotEmpty](#method-isnotempty) [join](#method-join) [keyBy](#method-keyby) [keys](#method-keys) [last](#method-last) [macro](#method-macro) [make](#method-make) [map](#method-map) [mapInto](#method-mapinto) [mapSpread](#method-mapspread) [mapToGroups](#method-maptogroups) [mapWithKeys](#method-mapwithkeys) [max](#method-max) [median](#method-median) [merge](#method-merge) [mergeRecursive](#method-mergerecursive) [min](#method-min) [mode](#method-mode) [nth](#method-nth) [only](#method-only) [pad](#method-pad) [partition](#method-partition) [pipe](#method-pipe) [pluck](#method-pluck) [random](#method-random) [reduce](#method-reduce) [reject](#method-reject) [replace](#method-replace) [replaceRecursive](#method-replacerecursive) [reverse](#method-reverse) [search](#method-search) [shuffle](#method-shuffle) [skip](#method-skip) [slice](#method-slice) [sole](#method-sole) [some](#method-some) [sort](#method-sort) [sortBy](#method-sortby) [sortByDesc](#method-sortbydesc) [sortKeys](#method-sortkeys) [sortKeysDesc](#method-sortkeysdesc) [split](#method-split) [sum](#method-sum) [take](#method-take) [tap](#method-tap) [times](#method-times) [toArray](#method-toarray) [toJson](#method-tojson) [union](#method-union) [unique](#method-unique) [uniqueStrict](#method-uniquestrict) [unless](#method-unless) [unlessEmpty](#method-unlessempty) [unlessNotEmpty](#method-unlessnotempty) [unwrap](#method-unwrap) [values](#method-values) [when](#method-when) [whenEmpty](#method-whenempty) [whenNotEmpty](#method-whennotempty) [where](#method-where) [whereStrict](#method-wherestrict) [whereBetween](#method-wherebetween) [whereIn](#method-wherein) [whereInStrict](#method-whereinstrict) [whereInstanceOf](#method-whereinstanceof) [whereNotBetween](#method-wherenotbetween) [whereNotIn](#method-wherenotin) [whereNotInStrict](#method-wherenotinstrict) [wrap](#method-wrap) [zip](#method-zip)" - -#: docs/master/collections.md:block 433 (code) -msgid "$collection = collect([1, 2, 3]);\n\n" -"$total = $collection->reduce(function (int $carry, int $item) {\n" -" return $carry + $item;\n" -"});\n\n" -"// 6\n" -msgstr "$collection = collect([1, 2, 3]);\n\n" -"$total = $collection->reduce(function (int $carry, int $item) {\n" -" return $carry + $item;\n" -"});\n\n" -"// 6\n" +"User::where('vip', true)\n" +" ->cursor()\n" +" ->throttle(seconds: 1)\n" +" ->each(function (User $user) {\n" +" // Call external API...\n" +" });" +msgstr "" diff --git a/po/zh_TW/concurrency.po b/po/zh_TW/concurrency.po new file mode 100644 index 000000000..94da075f9 --- /dev/null +++ b/po/zh_TW/concurrency.po @@ -0,0 +1,192 @@ +msgid "" +msgstr "" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Crowdin-Project: laravel-docs\n" +"X-Crowdin-Project-ID: 447952\n" +"X-Crowdin-Language: zh-TW\n" +"X-Crowdin-File: /main/templates/concurrency.pot\n" +"X-Crowdin-File-ID: 200\n" +"Project-Id-Version: laravel-docs\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Language-Team: Chinese Traditional\n" +"Language: zh_TW\n" +"PO-Revision-Date: 2024-11-30 08:39\n" + +# H1 +#: ./docs/11.x/concurrency.md:1 +msgid "Concurrency" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:3 +msgid "[Introduction](#introduction)" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:4 +msgid "[Running Concurrent Tasks](#running-concurrent-tasks)" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:5 +msgid "[Deferring Concurrent Tasks](#deferring-concurrent-tasks)" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:7 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/concurrency.md:8 +msgid "Introduction" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:11 +msgid "Laravel's `Concurrency` facade is currently in beta while we gather community feedback." +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:13 +msgid "Sometimes you may need to execute several slow tasks which do not depend on one another. In many cases, significant performance improvements can be realized by executing the tasks concurrently. Laravel's `Concurrency` facade provides a simple, convenient API for executing closures concurrently." +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:15 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/11.x/concurrency.md:16 +msgid "Concurrency Compatibility" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:18 +msgid "If you upgraded to Laravel 11.x from a Laravel 10.x application, you may need to add the `ConcurrencyServiceProvider` to the `providers` array in your application's `config/app.php` configuration file:" +msgstr "" + +# CODE: php +#: ./docs/11.x/concurrency.md:20 +msgid "'providers' => ServiceProvider::defaultProviders()->merge([\n" +" /*\n" +" * Package Service Providers...\n" +" */\n" +" Illuminate\\Concurrency\\ConcurrencyServiceProvider::class, // [tl! add]\n\n" +" /*\n" +" * Application Service Providers...\n" +" */\n" +" App\\Providers\\AppServiceProvider::class,\n" +" App\\Providers\\AuthServiceProvider::class,\n" +" // App\\Providers\\BroadcastServiceProvider::class,\n" +" App\\Providers\\EventServiceProvider::class,\n" +" App\\Providers\\RouteServiceProvider::class,\n" +"])->toArray()," +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:38 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/11.x/concurrency.md:39 +msgid "How it Works" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:41 +msgid "Laravel achieves concurrency by serializing the given closures and dispatching them to a hidden Artisan CLI command, which unserializes the closures and invokes it within its own PHP process. After the closure has been invoked, the resulting value is serialized back to the parent process." +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:43 +msgid "The `Concurrency` facade supports three drivers: `process` (the default), `fork`, and `sync`." +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:45 +msgid "The `fork` driver offers improved performance compared to the default `process` driver, but it may only be used within PHP's CLI context, as PHP does not support forking during web requests. Before using the `fork` driver, you need to install the `spatie/fork` package:" +msgstr "" + +# CODE: bash +#: ./docs/11.x/concurrency.md:47 +msgid "composer require spatie/fork" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:51 +msgid "The `sync` driver is primarily useful during testing when you want to disable all concurrency and simply execute the given closures in sequence within the parent process." +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:53 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/concurrency.md:54 +msgid "Running Concurrent Tasks" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:56 +msgid "To run concurrent tasks, you may invoke the `Concurrency` facade's `run` method. The `run` method accepts an array of closures which should be executed simultaneously in child PHP processes:" +msgstr "" + +# CODE: php +#: ./docs/11.x/concurrency.md:58 +msgid "use Illuminate\\Support\\Facades\\Concurrency;\n" +"use Illuminate\\Support\\Facades\\DB;\n\n" +"[$userCount, $orderCount] = Concurrency::run([\n" +" fn () => DB::table('users')->count(),\n" +" fn () => DB::table('orders')->count(),\n" +"]);" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:68 +msgid "To use a specific driver, you may use the `driver` method:" +msgstr "" + +# CODE: php +#: ./docs/11.x/concurrency.md:70 +msgid "$results = Concurrency::driver('fork')->run(...);" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:74 +msgid "Or, to change the default concurrency driver, you should publish the `concurrency` configuration file via the `config:publish` Artisan command and update the `default` option within the file:" +msgstr "" + +# CODE: bash +#: ./docs/11.x/concurrency.md:76 +msgid "php artisan config:publish concurrency" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:80 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/concurrency.md:81 +msgid "Deferring Concurrent Tasks" +msgstr "" + +# P +#: ./docs/11.x/concurrency.md:83 +msgid "If you would like to execute an array of closures concurrently, but are not interested in the results returned by those closures, you should consider using the `defer` method. When the `defer` method is invoked, the given closures are not executed immediately. Instead, Laravel will execute the closures concurrently after the HTTP response has been sent to the user:" +msgstr "" + +# CODE: php +#: ./docs/11.x/concurrency.md:85 +msgid "use App\\Services\\Metrics;\n" +"use Illuminate\\Support\\Facades\\Concurrency;\n\n" +"Concurrency::defer([\n" +" fn () => Metrics::report('users'),\n" +" fn () => Metrics::report('orders'),\n" +"]);" +msgstr "" + diff --git a/po/zh_TW/configuration.po b/po/zh_TW/configuration.po index 57cb36f57..c13732481 100644 --- a/po/zh_TW/configuration.po +++ b/po/zh_TW/configuration.po @@ -10,581 +10,1496 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" +"PO-Revision-Date: 2024-11-30 08:38\n" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "`.env` Value" +msgstr "" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "`env()` Value" +msgstr "" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "true" +msgstr "" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "(bool) true" +msgstr "" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "(true)" +msgstr "" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "false" +msgstr "" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "(bool) false" +msgstr "" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "(false)" +msgstr "" -#: docs/10.x/configuration.md:block 1 (header) +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "empty" +msgstr "" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "(string) ''" +msgstr "" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "(empty)" +msgstr "" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "null" +msgstr "" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "(null) null" +msgstr "" + +# TD +#: ./docs/8.x/configuration.md +#: ./docs/9.x/configuration.md +#: ./docs/10.x/configuration.md +#: ./docs/11.x/configuration.md +#: ./docs/master/configuration.md +msgid "(null)" +msgstr "" + +# H1 +#: ./docs/8.x/configuration.md:1 +#: ./docs/9.x/configuration.md:1 +#: ./docs/10.x/configuration.md:1 +#: ./docs/11.x/configuration.md:1 +#: ./docs/master/configuration.md:1 msgid "Configuration" -msgstr "設定" +msgstr "" -#: docs/10.x/configuration.md:block 2 (unordered list) +# P +#: ./docs/8.x/configuration.md:3 +#: ./docs/9.x/configuration.md:3 +#: ./docs/10.x/configuration.md:3 +#: ./docs/11.x/configuration.md:3 +#: ./docs/master/configuration.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/configuration.md:block 2 (unordered list) +# P +#: ./docs/8.x/configuration.md:4 +#: ./docs/9.x/configuration.md:4 +#: ./docs/10.x/configuration.md:4 +#: ./docs/11.x/configuration.md:4 +#: ./docs/master/configuration.md:4 msgid "[Environment Configuration](#environment-configuration)" -msgstr "[環境組態](#environment-configuration)" +msgstr "" -#: docs/10.x/configuration.md:block 2 (unordered list) +# P +#: ./docs/8.x/configuration.md:5 +#: ./docs/9.x/configuration.md:5 +#: ./docs/10.x/configuration.md:5 +#: ./docs/11.x/configuration.md:5 +#: ./docs/master/configuration.md:5 msgid "[Environment Variable Types](#environment-variable-types)" -msgstr "[環境變數型別](#environment-variable-types)" +msgstr "" -#: docs/10.x/configuration.md:block 2 (unordered list) +# P +#: ./docs/8.x/configuration.md:6 +#: ./docs/9.x/configuration.md:6 +#: ./docs/10.x/configuration.md:6 +#: ./docs/11.x/configuration.md:6 +#: ./docs/master/configuration.md:6 msgid "[Retrieving Environment Configuration](#retrieving-environment-configuration)" -msgstr "[取得環境設定](#retrieving-environment-configuration)" +msgstr "" -#: docs/10.x/configuration.md:block 2 (unordered list) -msgid "[Determining The Current Environment](#determining-the-current-environment)" -msgstr "[判斷目前的環境](#determining-the-current-environment)" +# P +#: ./docs/10.x/configuration.md:7 +#: ./docs/11.x/configuration.md:7 +#: ./docs/master/configuration.md:7 +msgid "[Determining the Current Environment](#determining-the-current-environment)" +msgstr "" -#: docs/10.x/configuration.md:block 2 (unordered list) -msgid "[Encrypting Environment Files](#encrypting-environment-files)" -msgstr "[加密環境變數檔案](#encrypting-environment-files)" +# P +#: ./docs/8.x/configuration.md:7 +#: ./docs/9.x/configuration.md:7 +msgid "[Determining The Current Environment](#determining-the-current-environment)" +msgstr "" -#: docs/10.x/configuration.md:block 2 (unordered list) +# P +#: ./docs/8.x/configuration.md:8 +#: ./docs/9.x/configuration.md:9 +#: ./docs/10.x/configuration.md:9 +#: ./docs/11.x/configuration.md:9 +#: ./docs/master/configuration.md:9 msgid "[Accessing Configuration Values](#accessing-configuration-values)" -msgstr "[存取設定值](#accessing-configuration-values)" +msgstr "" -#: docs/10.x/configuration.md:block 2 (unordered list) +# P +#: ./docs/9.x/configuration.md:8 +#: ./docs/10.x/configuration.md:8 +#: ./docs/11.x/configuration.md:8 +#: ./docs/master/configuration.md:8 +msgid "[Encrypting Environment Files](#encrypting-environment-files)" +msgstr "" + +# P +#: ./docs/8.x/configuration.md:9 +#: ./docs/9.x/configuration.md:10 +#: ./docs/10.x/configuration.md:10 +#: ./docs/11.x/configuration.md:10 +#: ./docs/master/configuration.md:10 msgid "[Configuration Caching](#configuration-caching)" -msgstr "[設定快取](#configuration-caching)" +msgstr "" -#: docs/10.x/configuration.md:block 2 (unordered list) +# P +#: ./docs/8.x/configuration.md:10 +#: ./docs/9.x/configuration.md:11 +#: ./docs/10.x/configuration.md:11 +#: ./docs/11.x/configuration.md:12 +#: ./docs/master/configuration.md:12 msgid "[Debug Mode](#debug-mode)" -msgstr "[偵錯模式](#debug-mode)" +msgstr "" + +# P +#: ./docs/11.x/configuration.md:11 +#: ./docs/master/configuration.md:11 +msgid "[Configuration Publishing](#configuration-publishing)" +msgstr "" -#: docs/10.x/configuration.md:block 2 (unordered list) +# P +#: ./docs/8.x/configuration.md:11 +#: ./docs/9.x/configuration.md:12 +#: ./docs/10.x/configuration.md:12 +#: ./docs/11.x/configuration.md:13 +#: ./docs/master/configuration.md:13 msgid "[Maintenance Mode](#maintenance-mode)" -msgstr "[維護模式](#maintenance-mode)" +msgstr "" -#: docs/10.x/configuration.md:block 4 (header) +# P +#: ./docs/8.x/configuration.md:13 +#: ./docs/9.x/configuration.md:14 +#: ./docs/10.x/configuration.md:14 +#: ./docs/11.x/configuration.md:15 +#: ./docs/master/configuration.md:15 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/configuration.md:14 +#: ./docs/9.x/configuration.md:15 +#: ./docs/10.x/configuration.md:15 +#: ./docs/11.x/configuration.md:16 +#: ./docs/master/configuration.md:16 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/configuration.md:block 5 (paragraph) +# P +#: ./docs/8.x/configuration.md:16 +#: ./docs/9.x/configuration.md:17 +#: ./docs/10.x/configuration.md:17 +#: ./docs/11.x/configuration.md:18 +#: ./docs/master/configuration.md:18 msgid "All of the configuration files for the Laravel framework are stored in the `config` directory. Each option is documented, so feel free to look through the files and get familiar with the options available to you." -msgstr "在 Laravel 框架中,所有設定檔都儲存在 `config` 目錄內。各個選項都有說明文件,歡迎閱讀這些檔案並熟悉可用的選項。" +msgstr "" -#: docs/10.x/configuration.md:block 6 (paragraph) +# P +#: ./docs/8.x/configuration.md:18 +#: ./docs/9.x/configuration.md:19 +#: ./docs/10.x/configuration.md:19 +#: ./docs/11.x/configuration.md:20 +#: ./docs/master/configuration.md:20 msgid "These configuration files allow you to configure things like your database connection information, your mail server information, as well as various other core configuration values such as your application timezone and encryption key." -msgstr "這些設定檔能讓你設定一些東西,像是資料庫連線資訊、郵件伺服器設定,以及其他數種核心設定值,如網站的時區、以及加密金鑰。" - -#: docs/10.x/configuration.md:block 8 (header) -msgid "Application Overview" -msgstr "專案概覽" - -#: docs/10.x/configuration.md:block 9 (paragraph) -msgid "In a hurry? You can get a quick overview of your application's configuration, drivers, and environment via the `about` Artisan command:" -msgstr "趕時間嗎?只要使用 `about` Artisan 指令,就能快速概覽專案的設定、Driver、與環境:" - -#: docs/10.x/configuration.md:block 10 (code) -msgid "php artisan about\n" -msgstr "php artisan about\n" +msgstr "" -#: docs/10.x/configuration.md:block 11 (paragraph) -msgid "If you're only interested in a particular section of the application overview output, you may filter for that section using the `--only` option:" -msgstr "若只想檢視專案概覽輸出的特定一部分,可使用 `--only` 選項來篩選出要檢視的部分:" +# P +#: ./docs/8.x/configuration.md:20 +#: ./docs/9.x/configuration.md:36 +#: ./docs/10.x/configuration.md:42 +#: ./docs/11.x/configuration.md:43 +#: ./docs/master/configuration.md:43 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/configuration.md:21 +#: ./docs/9.x/configuration.md:37 +#: ./docs/10.x/configuration.md:43 +#: ./docs/11.x/configuration.md:44 +#: ./docs/master/configuration.md:44 +msgid "Environment Configuration" +msgstr "" -#: docs/10.x/configuration.md:block 12 (code) -msgid "php artisan about --only=environment\n" -msgstr "php artisan about --only=environment\n" +# P +#: ./docs/9.x/configuration.md:21 +#: ./docs/10.x/configuration.md:21 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/11.x/configuration.md:22 +#: ./docs/master/configuration.md:22 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/configuration.md:22 +#: ./docs/10.x/configuration.md:22 +msgid "Application Overview" +msgstr "" -#: docs/10.x/configuration.md:block 13 (paragraph) -msgid "Or, to explore a specific configuration file's values in detail, you may use the `config:show` Artisan command:" -msgstr "或者,若要瞭解特定設定檔中詳細的值,可以使用 `config:show` Artisan 指令:" +# H4 +#: ./docs/11.x/configuration.md:23 +#: ./docs/master/configuration.md:23 +msgid "The `about` Command" +msgstr "" -#: docs/10.x/configuration.md:block 14 (code) -msgid "php artisan config:show database\n" -msgstr "php artisan config:show database\n" +# P +#: ./docs/8.x/configuration.md:23 +#: ./docs/9.x/configuration.md:39 +#: ./docs/10.x/configuration.md:45 +#: ./docs/11.x/configuration.md:46 +#: ./docs/master/configuration.md:46 +msgid "It is often helpful to have different configuration values based on the environment where the application is running. For example, you may wish to use a different cache driver locally than you do on your production server." +msgstr "" -#: docs/10.x/configuration.md:block 16 (header) -msgid "Environment Configuration" -msgstr "環境組態" +# P +#: ./docs/9.x/configuration.md:24 +#: ./docs/10.x/configuration.md:24 +msgid "In a hurry? You can get a quick overview of your application's configuration, drivers, and environment via the `about` Artisan command:" +msgstr "" -#: docs/10.x/configuration.md:block 17 (paragraph) -msgid "It is often helpful to have different configuration values based on the environment where the application is running. For example, you may wish to use a different cache driver locally than you do on your production server." -msgstr "若我們能根據網站正在執行的環境不同,而載入不同的設定值,那麼會有很多好處。舉例來說,在本機與正式環境上我們可能會想使用不同的快取 Driver。" +# P +#: ./docs/11.x/configuration.md:25 +#: ./docs/master/configuration.md:25 +msgid "Laravel can display an overview of your application's configuration, drivers, and environment via the `about` Artisan command." +msgstr "" -#: docs/10.x/configuration.md:block 18 (paragraph) +# P +#: ./docs/8.x/configuration.md:25 +#: ./docs/9.x/configuration.md:41 +#: ./docs/10.x/configuration.md:47 +#: ./docs/11.x/configuration.md:48 +#: ./docs/master/configuration.md:48 msgid "To make this a cinch, Laravel utilizes the [DotEnv](https://github.com/vlucas/phpdotenv) PHP library. In a fresh Laravel installation, the root directory of your application will contain a `.env.example` file that defines many common environment variables. During the Laravel installation process, this file will automatically be copied to `.env`." -msgstr "為了輕鬆達成此目標,Laravel 使用了 [DotEnv](https://github.com/vlucas/phpdotenv) PHP 函式庫。在全新的 Laravel 安裝上,專案的根目錄中會包含一個定義了許多常見環境變數的 `.env.example` 檔案。在 Laravel 的安裝過程中,這個檔案會自動被複製為 `.env`。" +msgstr "" -#: docs/10.x/configuration.md:block 19 (paragraph) +# CODE: shell +#: ./docs/9.x/configuration.md:26 +#: ./docs/10.x/configuration.md:26 +#: ./docs/11.x/configuration.md:27 +#: ./docs/master/configuration.md:27 +msgid "php artisan about" +msgstr "" + +# P +#: ./docs/8.x/configuration.md:27 +#: ./docs/9.x/configuration.md:43 +#: ./docs/10.x/configuration.md:49 msgid "Laravel's default `.env` file contains some common configuration values that may differ based on whether your application is running locally or on a production web server. These values are then retrieved from various Laravel configuration files within the `config` directory using Laravel's `env` function." -msgstr "Laravel 的預設 `.env` 檔包含了一些可能會依據專案是在本機還是正式環境上執行而不同的常見設定值。這些值接著會在 `config` 目錄中的 Laravel 設定檔內通過 Laravel 的 `env` 函式來取用。" +msgstr "" -#: docs/10.x/configuration.md:block 20 (paragraph) +# P +#: ./docs/8.x/configuration.md:29 +#: ./docs/9.x/configuration.md:45 +#: ./docs/10.x/configuration.md:51 msgid "If you are developing with a team, you may wish to continue including a `.env.example` file with your application. By putting placeholder values in the example configuration file, other developers on your team can clearly see which environment variables are needed to run your application." -msgstr "若是與團隊協作開發,可能會想繼續將 `.env.example` 檔案包含在專案中。只要在範例設定檔中填入一些預留位置值,團隊中的其他開發人員就能清楚地知道要執行專案需要哪些環境變數。" +msgstr "" + +# P +#: ./docs/9.x/configuration.md:30 +#: ./docs/10.x/configuration.md:30 +#: ./docs/11.x/configuration.md:31 +#: ./docs/master/configuration.md:31 +msgid "If you're only interested in a particular section of the application overview output, you may filter for that section using the `--only` option:" +msgstr "" + +# P +#: ./docs/8.x/configuration.md:31 +#: ./docs/9.x/configuration.md:48 +#: ./docs/10.x/configuration.md:54 +#: ./docs/11.x/configuration.md:55 +#: ./docs/master/configuration.md:55 +msgid "Any variable in your `.env` file can be overridden by external environment variables such as server-level or system-level environment variables." +msgstr "" -#: docs/10.x/configuration.md:block 21 (quote) -msgid "**Note** Any variable in your `.env` file can be overridden by external environment variables such as server-level or system-level environment variables." -msgstr "**Note** 任何 `.env` 檔內的變數都可通過外部環境變數來複寫,如伺服器等級或是系統等級的環境變數。" +# CODE: shell +#: ./docs/9.x/configuration.md:32 +#: ./docs/10.x/configuration.md:32 +#: ./docs/11.x/configuration.md:33 +#: ./docs/master/configuration.md:33 +msgid "php artisan about --only=environment" +msgstr "" -#: docs/10.x/configuration.md:block 23 (header) +# P +#: ./docs/8.x/configuration.md:33 +#: ./docs/9.x/configuration.md:50 +#: ./docs/10.x/configuration.md:56 +#: ./docs/11.x/configuration.md:57 +#: ./docs/master/configuration.md:57 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/configuration.md:34 +#: ./docs/9.x/configuration.md:51 +#: ./docs/10.x/configuration.md:57 +#: ./docs/11.x/configuration.md:58 +#: ./docs/master/configuration.md:58 msgid "Environment File Security" -msgstr "環境檔安全性" +msgstr "" + +# P +#: ./docs/10.x/configuration.md:36 +#: ./docs/11.x/configuration.md:37 +#: ./docs/master/configuration.md:37 +msgid "Or, to explore a specific configuration file's values in detail, you may use the `config:show` Artisan command:" +msgstr "" -#: docs/10.x/configuration.md:block 24 (paragraph) +# P +#: ./docs/8.x/configuration.md:36 +#: ./docs/9.x/configuration.md:53 +#: ./docs/10.x/configuration.md:59 +#: ./docs/11.x/configuration.md:60 +#: ./docs/master/configuration.md:60 msgid "Your `.env` file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration. Furthermore, this would be a security risk in the event an intruder gains access to your source control repository, since any sensitive credentials would get exposed." -msgstr "`.env` 檔不應被簽入應用程式的版本控制中,因為每個使用應用程式的開發人員/伺服器都可能需要不同的環境組態。此外,若將 `.env` 檔簽入版本控制的話,當有入侵者取得了版本控制儲存庫的存取權限,就可能會造成安全性風險,因為其中的機敏認證資料都會被暴露。" +msgstr "" -#: docs/10.x/configuration.md:block 25 (paragraph) -msgid "However, it is possible to encrypt your environment file using Laravel's built-in [environment encryption](#encrypting-environment-files). Encrypted environment files may be placed in source control safely." -msgstr "不過,我們也可以通會使用 Laravel 內建的[環境變數檔加密](#encrypting-environment-files)來加密環境變數檔。經過加密的環境變數檔會可以被安全地放在版本控制中。" +# CODE: shell +#: ./docs/10.x/configuration.md:38 +#: ./docs/11.x/configuration.md:39 +#: ./docs/master/configuration.md:39 +msgid "php artisan config:show database" +msgstr "" -#: docs/10.x/configuration.md:block 27 (header) +# P +#: ./docs/8.x/configuration.md:38 +#: ./docs/9.x/configuration.md:57 +#: ./docs/10.x/configuration.md:63 +#: ./docs/11.x/configuration.md:64 +#: ./docs/master/configuration.md:64 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/configuration.md:39 +#: ./docs/9.x/configuration.md:58 +#: ./docs/10.x/configuration.md:64 +#: ./docs/11.x/configuration.md:65 +#: ./docs/master/configuration.md:65 msgid "Additional Environment Files" -msgstr "額外的環境檔" +msgstr "" -#: docs/10.x/configuration.md:block 28 (paragraph) -msgid "Before loading your application's environment variables, Laravel determines if an `APP_ENV` environment variable has been externally provided or if the `--env` CLI argument has been specified. If so, Laravel will attempt to load an `.env.[APP_ENV]` file if it exists. If it does not exist, the default `.env` file will be loaded." -msgstr "在載入專案的環境變數時,Laravel 會判斷是否有從外部提供 `APP_ENV` 環境變數,或是從 `--env` CLI 引數指定環境,若有從外部指定環境,則 Laravel 會嘗試載入 `.env.[APP_ENV]` 檔案(若有的話)。若該檔案不存在,則會載入 `.env` 檔。" +# P +#: ./docs/8.x/configuration.md:41 +msgid "Before loading your application's environment variables, Laravel determines if either the `APP_ENV` environment variable has been externally provided or if the `--env` CLI argument has been specified. If so, Laravel will attempt to load an `.env.[APP_ENV]` file if it exists. If it does not exist, the default `.env` file will be loaded." +msgstr "" -#: docs/10.x/configuration.md:block 30 (header) +# P +#: ./docs/8.x/configuration.md:43 +#: ./docs/9.x/configuration.md:62 +#: ./docs/10.x/configuration.md:68 +#: ./docs/11.x/configuration.md:69 +#: ./docs/master/configuration.md:69 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/configuration.md:44 +#: ./docs/9.x/configuration.md:63 +#: ./docs/10.x/configuration.md:69 +#: ./docs/11.x/configuration.md:70 +#: ./docs/master/configuration.md:70 msgid "Environment Variable Types" -msgstr "環境變數型別" +msgstr "" -#: docs/10.x/configuration.md:block 31 (paragraph) +# P +#: ./docs/8.x/configuration.md:46 +#: ./docs/9.x/configuration.md:65 +#: ./docs/10.x/configuration.md:71 +#: ./docs/11.x/configuration.md:72 +#: ./docs/master/configuration.md:72 msgid "All variables in your `.env` files are typically parsed as strings, so some reserved values have been created to allow you to return a wider range of types from the `env()` function:" -msgstr "在 `.env` 檔中的所有變數通常都會被解析為字串,因此,有一些保留值可以用來在 `env()` 函式中回傳更多類型的型別:" - -#: docs/10.x/configuration.md:block 32 (table) -msgid "`.env` Value" -msgstr "`.env` 值" - -#: docs/10.x/configuration.md:block 32 (table) -msgid "`env()` Value" -msgstr "`env()` 值" - -#: docs/10.x/configuration.md:block 32 (table) -msgid "true" -msgstr "true" - -#: docs/10.x/configuration.md:block 32 (table) -msgid "(bool) true" -msgstr "(bool) true" - -#: docs/10.x/configuration.md:block 32 (table) -msgid "(true)" -msgstr "(true)" - -#: docs/10.x/configuration.md:block 32 (table) -msgid "false" -msgstr "false" - -#: docs/10.x/configuration.md:block 32 (table) -msgid "(bool) false" -msgstr "(bool) false" - -#: docs/10.x/configuration.md:block 32 (table) -msgid "(false)" -msgstr "(false)" - -#: docs/10.x/configuration.md:block 32 (table) -msgid "empty" -msgstr "empty" - -#: docs/10.x/configuration.md:block 32 (table) -msgid "(string) ''" -msgstr "(string) ''" - -#: docs/10.x/configuration.md:block 32 (table) -msgid "(empty)" -msgstr "(空值)" +msgstr "" -#: docs/10.x/configuration.md:block 32 (table) -msgid "null" -msgstr "null" +# P +#: ./docs/11.x/configuration.md:50 +#: ./docs/master/configuration.md:50 +msgid "Laravel's default `.env` file contains some common configuration values that may differ based on whether your application is running locally or on a production web server. These values are then read by the configuration files within the `config` directory using Laravel's `env` function." +msgstr "" -#: docs/10.x/configuration.md:block 32 (table) -msgid "(null) null" -msgstr "(null) null" +# P +#: ./docs/11.x/configuration.md:52 +#: ./docs/master/configuration.md:52 +msgid "If you are developing with a team, you may wish to continue including and updating the `.env.example` file with your application. By putting placeholder values in the example configuration file, other developers on your team can clearly see which environment variables are needed to run your application." +msgstr "" -#: docs/10.x/configuration.md:block 32 (table) -msgid "(null)" -msgstr "(null)" +# P +#: ./docs/9.x/configuration.md:55 +#: ./docs/10.x/configuration.md:61 +#: ./docs/11.x/configuration.md:62 +#: ./docs/master/configuration.md:62 +msgid "However, it is possible to encrypt your environment file using Laravel's built-in [environment encryption](#encrypting-environment-files). Encrypted environment files may be placed in source control safely." +msgstr "" -#: docs/10.x/configuration.md:block 33 (paragraph) +# P +#: ./docs/8.x/configuration.md:59 +#: ./docs/9.x/configuration.md:78 +#: ./docs/10.x/configuration.md:84 +#: ./docs/11.x/configuration.md:89 +#: ./docs/master/configuration.md:85 msgid "If you need to define an environment variable with a value that contains spaces, you may do so by enclosing the value in double quotes:" -msgstr "若有需要定義包含空白的環境變數值,則需要將值以雙引號圍起來:" +msgstr "" + +# P +#: ./docs/9.x/configuration.md:60 +#: ./docs/10.x/configuration.md:66 +#: ./docs/11.x/configuration.md:67 +#: ./docs/master/configuration.md:67 +msgid "Before loading your application's environment variables, Laravel determines if an `APP_ENV` environment variable has been externally provided or if the `--env` CLI argument has been specified. If so, Laravel will attempt to load an `.env.[APP_ENV]` file if it exists. If it does not exist, the default `.env` file will be loaded." +msgstr "" -#: docs/10.x/configuration.md:block 34 (code) -msgid "APP_NAME=\"My Application\"\n" -msgstr "APP_NAME=\"My Application\"\n" +# CODE +# CODE: ini +#: ./docs/8.x/configuration.md:61 +#: ./docs/9.x/configuration.md:80 +#: ./docs/10.x/configuration.md:86 +#: ./docs/11.x/configuration.md:91 +#: ./docs/master/configuration.md:87 +msgid "APP_NAME=\"My Application\"" +msgstr "" -#: docs/10.x/configuration.md:block 36 (header) +# P +#: ./docs/8.x/configuration.md:63 +#: ./docs/9.x/configuration.md:84 +#: ./docs/10.x/configuration.md:90 +#: ./docs/11.x/configuration.md:95 +#: ./docs/master/configuration.md:91 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/configuration.md:64 +#: ./docs/9.x/configuration.md:85 +#: ./docs/10.x/configuration.md:91 +#: ./docs/11.x/configuration.md:96 +#: ./docs/master/configuration.md:92 msgid "Retrieving Environment Configuration" -msgstr "取得環境設定" +msgstr "" -#: docs/10.x/configuration.md:block 37 (paragraph) -msgid "All of the variables listed in the `.env` file will be loaded into the `$_ENV` PHP super-global when your application receives a request. However, you may use the `env` function to retrieve values from these variables in your configuration files. In fact, if you review the Laravel configuration files, you will notice many of the options are already using this function:" -msgstr "在 `.env` 檔案中列出的所有變數都會在網站接收到請求的時候被載入進 `$_ENV` PHP 超全域變數內。不過,可以使用 `env` 函式來在設定檔中取得這些變數。事實上,若閱讀 Laravel 的設定檔,就會發現其中許多選項已經使用到這個函式了:" +# P +#: ./docs/8.x/configuration.md:66 +msgid "All of the variables listed in this file will be loaded into the `$_ENV` PHP super-global when your application receives a request. However, you may use the `env` helper to retrieve values from these variables in your configuration files. In fact, if you review the Laravel configuration files, you will notice many of the options are already using this helper:" +msgstr "" -#: docs/10.x/configuration.md:block 38 (code) -msgid "'debug' => env('APP_DEBUG', false),\n" -msgstr "'debug' => env('APP_DEBUG', false),\n" +# CODE +#: ./docs/8.x/configuration.md:68 +#: ./docs/9.x/configuration.md:89 +#: ./docs/10.x/configuration.md:95 +#: ./docs/11.x/configuration.md:100 +#: ./docs/master/configuration.md:96 +msgid "'debug' => env('APP_DEBUG', false)," +msgstr "" -#: docs/10.x/configuration.md:block 39 (paragraph) +# P +#: ./docs/8.x/configuration.md:70 +#: ./docs/9.x/configuration.md:91 +#: ./docs/10.x/configuration.md:97 +#: ./docs/11.x/configuration.md:102 +#: ./docs/master/configuration.md:98 msgid "The second value passed to the `env` function is the \"default value\". This value will be returned if no environment variable exists for the given key." -msgstr "傳入 `env` 函式的第二個值為「預設值」。該值會在環境變數中沒有給定索引鍵的時候被回傳。" +msgstr "" -#: docs/10.x/configuration.md:block 41 (header) +# P +#: ./docs/8.x/configuration.md:72 +#: ./docs/9.x/configuration.md:93 +#: ./docs/10.x/configuration.md:99 +#: ./docs/11.x/configuration.md:104 +#: ./docs/master/configuration.md:100 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/configuration.md:73 +#: ./docs/9.x/configuration.md:94 msgid "Determining The Current Environment" -msgstr "判斷目前環境" +msgstr "" -#: docs/10.x/configuration.md:block 42 (paragraph) +# P +#: ./docs/8.x/configuration.md:75 +#: ./docs/9.x/configuration.md:96 +#: ./docs/10.x/configuration.md:102 +#: ./docs/11.x/configuration.md:107 +#: ./docs/master/configuration.md:103 msgid "The current application environment is determined via the `APP_ENV` variable from your `.env` file. You may access this value via the `environment` method on the `App` [facade](/docs/{{version}}/facades):" -msgstr "網站目前的環境是通過 `.env` 檔中的 `APP_ENV` 變數來判斷的。可以通過 `App` [Facade](/docs/{{version}}/facades) 上的 `environment` 方法來存取這個值:" +msgstr "" -#: docs/10.x/configuration.md:block 43 (code) +# CODE +#: ./docs/8.x/configuration.md:77 +#: ./docs/9.x/configuration.md:98 +#: ./docs/10.x/configuration.md:104 +#: ./docs/11.x/configuration.md:109 +#: ./docs/master/configuration.md:105 msgid "use Illuminate\\Support\\Facades\\App;\n\n" -"$environment = App::environment();\n" -msgstr "use Illuminate\\Support\\Facades\\App;\n\n" -"$environment = App::environment();\n" +"$environment = App::environment();" +msgstr "" -#: docs/10.x/configuration.md:block 44 (paragraph) +# P +#: ./docs/8.x/configuration.md:81 +#: ./docs/9.x/configuration.md:102 +#: ./docs/10.x/configuration.md:108 +#: ./docs/11.x/configuration.md:113 +#: ./docs/master/configuration.md:109 msgid "You may also pass arguments to the `environment` method to determine if the environment matches a given value. The method will return `true` if the environment matches any of the given values:" -msgstr "可以傳入引數給 `environment` 方法來判斷目前環境是否符合給定的值。該方法會在目前環境符合任何一個給定值的時候回傳 `true`:" +msgstr "" -#: docs/10.x/configuration.md:block 45 (code) +# CODE +#: ./docs/8.x/configuration.md:83 +#: ./docs/9.x/configuration.md:104 +#: ./docs/10.x/configuration.md:110 +#: ./docs/11.x/configuration.md:115 +#: ./docs/master/configuration.md:111 msgid "if (App::environment('local')) {\n" " // The environment is local\n" "}\n\n" "if (App::environment(['local', 'staging'])) {\n" " // The environment is either local OR staging...\n" -"}\n" -msgstr "if (App::environment('local')) {\n" -" // 目前環境為 local\n" -"}\n\n" -"if (App::environment(['local', 'staging'])) {\n" -" // 目前環境不是 local 就是 staging...\n" -"}\n" - -#: docs/10.x/configuration.md:block 46 (quote) -msgid "**Note** The current application environment detection can be overridden by defining a server-level `APP_ENV` environment variable." -msgstr "**Note** 可以通過在伺服器等級上定義 `APP_ENV` 環境變數來複寫網站偵測到的應用程式環境。" - -#: docs/10.x/configuration.md:block 48 (header) -msgid "Encrypting Environment Files" -msgstr "加密環境變數檔" - -#: docs/10.x/configuration.md:block 49 (paragraph) -msgid "Unencrypted environment files should never be stored in source control. However, Laravel allows you to encrypt your environment files so that they may safely be added to source control with the rest of your application." -msgstr "請絕對不要將未加密的環境變數檔保存在版本控制中。不過,在 Laravel 中,我們可以將環境變數檔,即可安全地將環境變數檔與專案中的其他檔案一起保存在版本控制中。" - -#: docs/10.x/configuration.md:block 51 (header) -msgid "Encryption" -msgstr "加密" - -#: docs/10.x/configuration.md:block 52 (paragraph) -msgid "To encrypt an environment file, you may use the `env:encrypt` command:" -msgstr "若要加密環境變數檔,可以使用 `env:encrypt` 指令:" - -#: docs/10.x/configuration.md:block 53 (code) -msgid "php artisan env:encrypt\n" -msgstr "php artisan env:encrypt\n" - -#: docs/10.x/configuration.md:block 54 (paragraph) -msgid "Running the `env:encrypt` command will encrypt your `.env` file and place the encrypted contents in an `.env.encrypted` file. The decryption key is presented in the output of the command and should be stored in a secure password manager. If you would like to provide your own encryption key you may use the `--key` option when invoking the command:" -msgstr "執行 `env:encrypt` 指令後,該指令會加密你的 `.env` 檔,然後將加密後的內容存放在 `.env.encrypted` 檔案中。該指令的輸出中會包含用於解密的金鑰,請將這個金鑰保存在安全的密碼管理器中。若要自行提供加密金鑰,請在呼叫該指令時提供 `--key` 選項:" - -#: docs/10.x/configuration.md:block 55 (code) -msgid "php artisan env:encrypt --key=3UVsEgGVK36XN82KKeyLFMhvosbZN1aF\n" -msgstr "php artisan env:encrypt --key=3UVsEgGVK36XN82KKeyLFMhvosbZN1aF\n" - -#: docs/10.x/configuration.md:block 56 (quote) -msgid "**Note** The length of the key provided should match the key length required by the encryption cipher being used. By default, Laravel will use the `AES-256-CBC` cipher which requires a 32 character key. You are free to use any cipher supported by Laravel's [encrypter](/docs/{{version}}/encryption) by passing the `--cipher` option when invoking the command." -msgstr "**Note** 金鑰的長度應符合所使用的加密 Cipher 的密鑰長度要求。預設情況下,Laravel 會使用 `AES-256-CBC` Cipher,該 Cipher 要求使用 32 位元的字串。你可以在呼叫該指令時傳入 `--cipher` 選項來自由選擇 Laravel [encrypter](/docs/{{version}}/encryption) 所支援的任意 Cipher。" - -#: docs/10.x/configuration.md:block 57 (paragraph) -msgid "If your application has multiple environment files, such as `.env` and `.env.staging`, you may specify the environment file that should be encrypted by providing the environment name via the `--env` option:" -msgstr "若你的專案有多個環境變數檔,如 `.env` 與 `env.stagin`,可以使用 `--env` 選項來提供要加密的環境變數檔名稱:" - -#: docs/10.x/configuration.md:block 58 (code) -msgid "php artisan env:encrypt --env=staging\n" -msgstr "php artisan env:encrypt --env=staging\n" - -#: docs/10.x/configuration.md:block 60 (header) -msgid "Decryption" -msgstr "解密" - -#: docs/10.x/configuration.md:block 61 (paragraph) -msgid "To decrypt an environment file, you may use the `env:decrypt` command. This command requires a decryption key, which Laravel will retrieve from the `LARAVEL_ENV_ENCRYPTION_KEY` environment variable:" -msgstr "若要解密環境變數檔,可使用 `env:decrypt` 選項。執行該指令需要提供解密金鑰,而 Laravel 會通過 `LARAVEL_ENV_ENCRYPTION_KEY` 環境變數來取得該金鑰:" - -#: docs/10.x/configuration.md:block 62 (code) -msgid "php artisan env:decrypt\n" -msgstr "php artisan env:decrypt\n" - -#: docs/10.x/configuration.md:block 63 (paragraph) -msgid "Or, the key may be provided directly to the command via the `--key` option:" -msgstr "或者,也可以使用 `--key` 選項來直接提供金鑰給該指令:" - -#: docs/10.x/configuration.md:block 64 (code) -msgid "php artisan env:decrypt --key=3UVsEgGVK36XN82KKeyLFMhvosbZN1aF\n" -msgstr "php artisan env:decrypt --key=3UVsEgGVK36XN82KKeyLFMhvosbZN1aF\n" - -#: docs/10.x/configuration.md:block 65 (paragraph) -msgid "When the `env:decrypt` command is invoked, Laravel will decrypt the contents of the `.env.encrypted` file and place the decrypted contents in the `.env` file." -msgstr "呼叫 `env:decrypt` 選項時,Laravel 會解密 `.env.encrypted` 檔案,並將解密後的內容放到 `.env` 檔內。" - -#: docs/10.x/configuration.md:block 66 (paragraph) -msgid "The `--cipher` option may be provided to the `env:decrypt` command in order to use a custom encryption cipher:" -msgstr "也可以提供 `--cipher` 選項給 `env:decrypt` 指令來使用自定的加密 Cipher:" - -#: docs/10.x/configuration.md:block 67 (code) -msgid "php artisan env:decrypt --key=qUWuNRdfuImXcKxZ --cipher=AES-128-CBC\n" -msgstr "php artisan env:decrypt --key=qUWuNRdfuImXcKxZ --cipher=AES-128-CBC\n" - -#: docs/10.x/configuration.md:block 68 (paragraph) -msgid "If your application has multiple environment files, such as `.env` and `.env.staging`, you may specify the environment file that should be decrypted by providing the environment name via the `--env` option:" -msgstr "若你的專案有多個環境變數檔,如 `.env` 與 `env.stagin`,可以使用 `--env` 選項來提供要解密的環境變數檔名稱:" - -#: docs/10.x/configuration.md:block 69 (code) -msgid "php artisan env:decrypt --env=staging\n" -msgstr "php artisan env:decrypt --env=staging\n" +"}" +msgstr "" -#: docs/10.x/configuration.md:block 70 (paragraph) -msgid "In order to overwrite an existing environment file, you may provide the `--force` option to the `env:decrypt` command:" -msgstr "若要複寫現有的環境變數檔,可提供 `--force` 選項給 `env:decrypt` 選項:" +# P +#: ./docs/9.x/configuration.md:87 +#: ./docs/10.x/configuration.md:93 +#: ./docs/11.x/configuration.md:98 +#: ./docs/master/configuration.md:94 +msgid "All of the variables listed in the `.env` file will be loaded into the `$_ENV` PHP super-global when your application receives a request. However, you may use the `env` function to retrieve values from these variables in your configuration files. In fact, if you review the Laravel configuration files, you will notice many of the options are already using this function:" +msgstr "" -#: docs/10.x/configuration.md:block 71 (code) -msgid "php artisan env:decrypt --force\n" -msgstr "php artisan env:decrypt --force\n" +# P +#: ./docs/8.x/configuration.md:91 +#: ./docs/9.x/configuration.md:113 +#: ./docs/10.x/configuration.md:119 +#: ./docs/11.x/configuration.md:124 +#: ./docs/master/configuration.md:120 +msgid "The current application environment detection can be overridden by defining a server-level `APP_ENV` environment variable." +msgstr "" -#: docs/10.x/configuration.md:block 73 (header) +# P +#: ./docs/8.x/configuration.md:93 +#: ./docs/9.x/configuration.md:179 +#: ./docs/10.x/configuration.md:185 +#: ./docs/11.x/configuration.md:190 +#: ./docs/master/configuration.md:186 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/configuration.md:94 +#: ./docs/9.x/configuration.md:180 +#: ./docs/10.x/configuration.md:186 +#: ./docs/11.x/configuration.md:191 +#: ./docs/master/configuration.md:187 msgid "Accessing Configuration Values" -msgstr "存取設定值" +msgstr "" -#: docs/10.x/configuration.md:block 74 (paragraph) -msgid "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:" -msgstr "可以輕鬆的在專案內的任何地方通過 `config` 全域函式來存取設定值。設定值可以通過「點」語法來存取,即包含設定檔名稱與欲存取的選項名。也可以指定設定選項不存在時要回傳的預設值:" +# P +#: ./docs/8.x/configuration.md:96 +msgid "You may easily access your configuration values using the global `config` helper 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:" +msgstr "" -#: docs/10.x/configuration.md:block 75 (code) +# CODE +#: ./docs/8.x/configuration.md:98 +#: ./docs/9.x/configuration.md:184 msgid "$value = config('app.timezone');\n\n" "// Retrieve a default value if the configuration value does not exist...\n" -"$value = config('app.timezone', 'Asia/Seoul');\n" -msgstr "$value = config('app.timezone');\n\n" -"// 若設定值不存在時,取得預設值...\n" -"$value = config('app.timezone', 'Asia/Seoul');\n" +"$value = config('app.timezone', 'Asia/Seoul');" +msgstr "" -#: docs/10.x/configuration.md:block 76 (paragraph) -msgid "To set configuration values at runtime, pass an array to the `config` function:" -msgstr "若要在執行階段修改設定值,可以傳入陣列進 `config` 函式:" +# H3 +#: ./docs/10.x/configuration.md:100 +#: ./docs/11.x/configuration.md:105 +#: ./docs/master/configuration.md:101 +msgid "Determining the Current Environment" +msgstr "" -#: docs/10.x/configuration.md:block 77 (code) -msgid "config(['app.timezone' => 'America/Chicago']);\n" -msgstr "config(['app.timezone' => 'America/Chicago']);\n" +# P +#: ./docs/8.x/configuration.md:103 +msgid "To set configuration values at runtime, pass an array to the `config` helper:" +msgstr "" + +# CODE +#: ./docs/8.x/configuration.md:105 +#: ./docs/9.x/configuration.md:191 +msgid "config(['app.timezone' => 'America/Chicago']);" +msgstr "" -#: docs/10.x/configuration.md:block 79 (header) +# P +#: ./docs/8.x/configuration.md:107 +#: ./docs/9.x/configuration.md:193 +#: ./docs/10.x/configuration.md:205 +#: ./docs/11.x/configuration.md:218 +#: ./docs/master/configuration.md:214 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/configuration.md:108 +#: ./docs/9.x/configuration.md:194 +#: ./docs/10.x/configuration.md:206 +#: ./docs/11.x/configuration.md:219 +#: ./docs/master/configuration.md:215 msgid "Configuration Caching" -msgstr "設定快取" +msgstr "" -#: docs/10.x/configuration.md:block 80 (paragraph) +# P +#: ./docs/8.x/configuration.md:110 +#: ./docs/9.x/configuration.md:196 +#: ./docs/10.x/configuration.md:208 +#: ./docs/11.x/configuration.md:221 +#: ./docs/master/configuration.md:217 msgid "To give your application a speed boost, you should cache all of your configuration files into a single file using the `config:cache` Artisan command. This will combine all of the configuration options for your application into a single file which can be quickly loaded by the framework." -msgstr "為了加速網站執行,應使用 `config:cache` Artisan 指令來將所有的設定檔快取為單一檔案。這個指令會將所有的設定選項合併為單一檔案,以讓 Laravel 可快速載入。" +msgstr "" -#: docs/10.x/configuration.md:block 81 (paragraph) +# P +#: ./docs/8.x/configuration.md:112 +#: ./docs/9.x/configuration.md:198 +#: ./docs/10.x/configuration.md:210 +#: ./docs/11.x/configuration.md:223 +#: ./docs/master/configuration.md:219 msgid "You should typically run the `php artisan config:cache` command as part of your production deployment process. The command should not be run during local development as configuration options will frequently need to be changed during the course of your application's development." -msgstr "`php artisan config:cache` 指令通常應放在部署流程中。該指令不應在本機開發時執行,因為在專案開發的時候會時常需要修改設定值。" +msgstr "" -#: docs/10.x/configuration.md:block 82 (paragraph) -msgid "Once the configuration has been cached, your application's `.env` file will not be loaded by the framework during requests or Artisan commands; therefore, the `env` function will only return external, system level environment variables." -msgstr "當設定被快取後,每次 Request 進來或執行 Artisan 指令時,Laravel 就不會再次載入專案的 `.env` 檔。因此,`env` 函式只會回傳外部、系統層級的環境變數。" +# P +#: ./docs/8.x/configuration.md:114 +#: ./docs/9.x/configuration.md:207 +#: ./docs/10.x/configuration.md:223 +#: ./docs/11.x/configuration.md:236 +#: ./docs/master/configuration.md:232 +msgid "If you execute the `config:cache` command during your deployment process, you should be sure that you are only calling the `env` function from within your configuration files. Once the configuration has been cached, the `.env` file will not be loaded; therefore, the `env` function will only return external, system level environment variables." +msgstr "" -#: docs/10.x/configuration.md:block 83 (paragraph) -msgid "For this reason, you should ensure you are only calling the `env` function from within your application's configuration (`config`) files. You can see many examples of this by examining Laravel's default configuration files. Configuration values may be accessed from anywhere in your application using the `config` function [described above](#accessing-configuration-values)." -msgstr "因此,請只在專案的設定檔 (`config`) 中呼叫 `env` 函式。你可以參考 Laravel 的預設設定檔,當中有許多的範例。在專案的任何地方,都可以使用[剛才提到的](#accessing-configuration-values) `config` 函數來取得設定值。" +# P +#: ./docs/9.x/configuration.md:115 +#: ./docs/10.x/configuration.md:121 +#: ./docs/11.x/configuration.md:126 +#: ./docs/master/configuration.md:122 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/configuration.md:116 +#: ./docs/9.x/configuration.md:209 +#: ./docs/10.x/configuration.md:225 +#: ./docs/11.x/configuration.md:251 +#: ./docs/master/configuration.md:247 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/configuration.md:116 +#: ./docs/10.x/configuration.md:122 +#: ./docs/11.x/configuration.md:127 +#: ./docs/master/configuration.md:123 +msgid "Encrypting Environment Files" +msgstr "" -#: docs/10.x/configuration.md:block 84 (paragraph) -msgid "The `config:clear` command may be used to purge the cached configuration:" -msgstr "可使用 `config:clear` 指令來移除被快取的設定。" +# H2 +#: ./docs/8.x/configuration.md:117 +#: ./docs/9.x/configuration.md:210 +#: ./docs/10.x/configuration.md:226 +#: ./docs/11.x/configuration.md:252 +#: ./docs/master/configuration.md:248 +msgid "Debug Mode" +msgstr "" -#: docs/10.x/configuration.md:block 85 (code) -msgid "php artisan config:clear\n" -msgstr "php artisan config:clear\n" +# P +#: ./docs/9.x/configuration.md:118 +#: ./docs/10.x/configuration.md:124 +#: ./docs/11.x/configuration.md:129 +#: ./docs/master/configuration.md:125 +msgid "Unencrypted environment files should never be stored in source control. However, Laravel allows you to encrypt your environment files so that they may safely be added to source control with the rest of your application." +msgstr "" -#: docs/10.x/configuration.md:block 86 (quote) -msgid "**Warning** If you execute the `config:cache` command during your deployment process, you should be sure that you are only calling the `env` function from within your configuration files. Once the configuration has been cached, the `.env` file will not be loaded; therefore, the `env` function will only return external, system level environment variables." -msgstr "**Warning** 若在部署流程中執行了 `config:cache` 指令,應確保只有在設定檔中呼叫 `env` 函式。設定檔被快取後,就不會再載入 `.env` 檔了。因此,`env` 函式只會回傳外部的、系統等級的環境變數。" +# P +#: ./docs/8.x/configuration.md:119 +#: ./docs/9.x/configuration.md:212 +#: ./docs/10.x/configuration.md:228 +#: ./docs/11.x/configuration.md:254 +#: ./docs/master/configuration.md:250 +msgid "The `debug` option in your `config/app.php` configuration file determines how much information about an error is actually displayed to the user. By default, this option is set to respect the value of the `APP_DEBUG` environment variable, which is stored in your `.env` file." +msgstr "" -#: docs/10.x/configuration.md:block 88 (header) -msgid "Debug Mode" -msgstr "偵錯模式" +# P +#: ./docs/9.x/configuration.md:120 +#: ./docs/10.x/configuration.md:126 +#: ./docs/11.x/configuration.md:131 +#: ./docs/master/configuration.md:127 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/configuration.md:121 +#: ./docs/9.x/configuration.md:214 +#: ./docs/10.x/configuration.md:231 +#: ./docs/11.x/configuration.md:257 +#: ./docs/master/configuration.md:253 +msgid "For local development, you should set the `APP_DEBUG` environment variable to `true`. **In your production environment, this value should always be `false`. If the variable is set to `true` in production, you risk exposing sensitive configuration values to your application's end users.**" +msgstr "" -#: docs/10.x/configuration.md:block 89 (paragraph) -msgid "The `debug` option in your `config/app.php` configuration file determines how much information about an error is actually displayed to the user. By default, this option is set to respect the value of the `APP_DEBUG` environment variable, which is stored in your `.env` file." -msgstr "`config/app.php` 設定檔中的 `debug` 選項用來判斷錯誤在實際顯示給使用者時要包含多少資訊。預設情況下,這個選項被設為依照 `APP_DEBUG` 環境變數值,該環境變數儲存於 `.env` 檔內。" +# H4 +#: ./docs/9.x/configuration.md:121 +#: ./docs/10.x/configuration.md:127 +#: ./docs/11.x/configuration.md:132 +#: ./docs/master/configuration.md:128 +msgid "Encryption" +msgstr "" -#: docs/10.x/configuration.md:block 90 (quote) -msgid "**Warning** For local development, you should set the `APP_DEBUG` environment variable to `true`. **In your production environment, this value should always be `false`. If the variable is set to `true` in production, you risk exposing sensitive configuration values to your application's end users.**" -msgstr "**Warning** 在本機上開發時,應將 `APP_DEBUG` 環境變數設為 `true`。 **在正式環境上,這個值一定要是 `false`。若在正式環境上將該變數設為 `true`,則會有將機敏設定值暴露給網站終端使用者的風險。**" +# P +#: ./docs/8.x/configuration.md:123 +#: ./docs/9.x/configuration.md:216 +#: ./docs/10.x/configuration.md:233 +#: ./docs/11.x/configuration.md:259 +#: ./docs/master/configuration.md:255 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/configuration.md:123 +#: ./docs/10.x/configuration.md:129 +#: ./docs/11.x/configuration.md:134 +#: ./docs/master/configuration.md:130 +msgid "To encrypt an environment file, you may use the `env:encrypt` command:" +msgstr "" -#: docs/10.x/configuration.md:block 92 (header) +# H2 +#: ./docs/8.x/configuration.md:124 +#: ./docs/9.x/configuration.md:217 +#: ./docs/10.x/configuration.md:234 +#: ./docs/11.x/configuration.md:260 +#: ./docs/master/configuration.md:256 msgid "Maintenance Mode" -msgstr "維護模式" +msgstr "" + +# CODE: shell +#: ./docs/9.x/configuration.md:125 +#: ./docs/10.x/configuration.md:131 +#: ./docs/11.x/configuration.md:136 +#: ./docs/master/configuration.md:132 +msgid "php artisan env:encrypt" +msgstr "" -#: docs/10.x/configuration.md:block 93 (paragraph) +# P +#: ./docs/8.x/configuration.md:126 +#: ./docs/9.x/configuration.md:219 +#: ./docs/10.x/configuration.md:236 +#: ./docs/11.x/configuration.md:262 +#: ./docs/master/configuration.md:258 msgid "When your application is in maintenance mode, a custom view will be displayed for all requests into your application. This makes it easy to \"disable\" your application while it is updating or when you are performing maintenance. A maintenance mode check is included in the default middleware stack for your application. If the application is in maintenance mode, a `Symfony\\Component\\HttpKernel\\Exception\\HttpException` instance will be thrown with a status code of 503." -msgstr "當網站在維護模式下時,所有連入網站的請求都會顯示一個自訂的 View。這樣一來便能在進行維護時輕鬆地「禁用」網站。維護模式的檢查包含在專案的預設 Middleware 堆疊中。若應用程式在維護模式,則會擲回 `Symfony\\Component\\HttpKernel\\Exception\\HttpException`,以及狀態碼 503。" +msgstr "" -#: docs/10.x/configuration.md:block 94 (paragraph) +# P +#: ./docs/8.x/configuration.md:128 +#: ./docs/9.x/configuration.md:221 +#: ./docs/10.x/configuration.md:238 +#: ./docs/11.x/configuration.md:264 +#: ./docs/master/configuration.md:260 msgid "To enable maintenance mode, execute the `down` Artisan command:" -msgstr "若要啟用維護模式,請執行 `down` Artisan 指令:" +msgstr "" + +# P +#: ./docs/9.x/configuration.md:129 +#: ./docs/10.x/configuration.md:135 +#: ./docs/11.x/configuration.md:140 +#: ./docs/master/configuration.md:136 +msgid "Running the `env:encrypt` command will encrypt your `.env` file and place the encrypted contents in an `.env.encrypted` file. The decryption key is presented in the output of the command and should be stored in a secure password manager. If you would like to provide your own encryption key you may use the `--key` option when invoking the command:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/configuration.md:130 +#: ./docs/9.x/configuration.md:223 +#: ./docs/10.x/configuration.md:240 +#: ./docs/11.x/configuration.md:266 +#: ./docs/master/configuration.md:262 +msgid "php artisan down" +msgstr "" -#: docs/10.x/configuration.md:block 95 (code) -msgid "php artisan down\n" -msgstr "php artisan down\n" +# CODE: shell +#: ./docs/9.x/configuration.md:131 +#: ./docs/10.x/configuration.md:137 +#: ./docs/11.x/configuration.md:142 +#: ./docs/master/configuration.md:138 +msgid "php artisan env:encrypt --key=3UVsEgGVK36XN82KKeyLFMhvosbZN1aF" +msgstr "" -#: docs/10.x/configuration.md:block 96 (paragraph) +# P +#: ./docs/8.x/configuration.md:132 +#: ./docs/9.x/configuration.md:227 +#: ./docs/10.x/configuration.md:244 +#: ./docs/11.x/configuration.md:270 +#: ./docs/master/configuration.md:266 msgid "If you would like the `Refresh` HTTP header to be sent with all maintenance mode responses, you may provide the `refresh` option when invoking the `down` command. The `Refresh` header will instruct the browser to automatically refresh the page after the specified number of seconds:" -msgstr "若想要在所有維護模式回應中傳送 `Refresh` HTTP 標頭,則請在叫用 `down` 指令時提供 `refresh` 選項。`Refresh` 表頭會告訴瀏覽器:在指定 N 秒後,重新整理頁面:" +msgstr "" -#: docs/10.x/configuration.md:block 97 (code) -msgid "php artisan down --refresh=15\n" -msgstr "php artisan down --refresh=15\n" +# CODE +# CODE: shell +#: ./docs/8.x/configuration.md:134 +#: ./docs/9.x/configuration.md:229 +#: ./docs/10.x/configuration.md:246 +#: ./docs/11.x/configuration.md:272 +#: ./docs/master/configuration.md:268 +msgid "php artisan down --refresh=15" +msgstr "" -#: docs/10.x/configuration.md:block 98 (paragraph) +# P +#: ./docs/8.x/configuration.md:136 +#: ./docs/9.x/configuration.md:233 +#: ./docs/10.x/configuration.md:250 +#: ./docs/11.x/configuration.md:276 +#: ./docs/master/configuration.md:272 msgid "You may also provide a `retry` option to the `down` command, which will be set as the `Retry-After` HTTP header's value, although browsers generally ignore this header:" -msgstr "也可以傳入一個 `retry` 選項給 `down` 指令,會用來設為 `Retry-After` HTTP 標頭的值,雖然一般的瀏覽器都會忽略這個標頭:" +msgstr "" + +# P +#: ./docs/9.x/configuration.md:136 +#: ./docs/10.x/configuration.md:142 +#: ./docs/11.x/configuration.md:147 +#: ./docs/master/configuration.md:143 +msgid "The length of the key provided should match the key length required by the encryption cipher being used. By default, Laravel will use the `AES-256-CBC` cipher which requires a 32 character key. You are free to use any cipher supported by Laravel's [encrypter](/docs/{{version}}/encryption) by passing the `--cipher` option when invoking the command." +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/configuration.md:138 +#: ./docs/9.x/configuration.md:235 +#: ./docs/10.x/configuration.md:252 +#: ./docs/11.x/configuration.md:278 +#: ./docs/master/configuration.md:274 +msgid "php artisan down --retry=60" +msgstr "" + +# P +#: ./docs/9.x/configuration.md:138 +#: ./docs/10.x/configuration.md:144 +#: ./docs/11.x/configuration.md:149 +#: ./docs/master/configuration.md:145 +msgid "If your application has multiple environment files, such as `.env` and `.env.staging`, you may specify the environment file that should be encrypted by providing the environment name via the `--env` option:" +msgstr "" -#: docs/10.x/configuration.md:block 99 (code) -msgid "php artisan down --retry=60\n" -msgstr "php artisan down --retry=60\n" +# P +#: ./docs/8.x/configuration.md:140 +#: ./docs/9.x/configuration.md:239 +#: ./docs/10.x/configuration.md:256 +#: ./docs/11.x/configuration.md:282 +#: ./docs/master/configuration.md:278 +#~ msgid "" +#~ msgstr "" + +# CODE: shell +#: ./docs/9.x/configuration.md:140 +#: ./docs/10.x/configuration.md:146 +#: ./docs/11.x/configuration.md:151 +#: ./docs/master/configuration.md:147 +msgid "php artisan env:encrypt --env=staging" +msgstr "" -#: docs/10.x/configuration.md:block 101 (header) +# H4 +#: ./docs/8.x/configuration.md:141 +#: ./docs/9.x/configuration.md:240 +#: ./docs/10.x/configuration.md:257 +#: ./docs/11.x/configuration.md:283 +#: ./docs/master/configuration.md:279 msgid "Bypassing Maintenance Mode" -msgstr "繞過維護模式" +msgstr "" -#: docs/10.x/configuration.md:block 102 (paragraph) -msgid "To allow maintenance mode to be bypassed using a secret token, you may use the `secret` option to specify a maintenance mode bypass token:" -msgstr "若要使用密鑰來繞過維護模式,可使用 `secret` 選項來指定繞過維護模式使用的 Token:" +# P +#: ./docs/8.x/configuration.md:143 +msgid "Even while in maintenance mode, you may use the `secret` option to specify a maintenance mode bypass token:" +msgstr "" -#: docs/10.x/configuration.md:block 103 (code) -msgid "php artisan down --secret=\"1630542a-246b-4b66-afa1-dd72a4c43515\"\n" -msgstr "php artisan down --secret=\"1630542a-246b-4b66-afa1-dd72a4c43515\"\n" +# P +#: ./docs/9.x/configuration.md:144 +#: ./docs/10.x/configuration.md:150 +#: ./docs/11.x/configuration.md:155 +#: ./docs/master/configuration.md:151 +#~ msgid "" +#~ msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/configuration.md:145 +#: ./docs/9.x/configuration.md:244 +#: ./docs/10.x/configuration.md:261 +#: ./docs/11.x/configuration.md:287 +#: ./docs/master/configuration.md:283 +msgid "php artisan down --secret=\"1630542a-246b-4b66-afa1-dd72a4c43515\"" +msgstr "" -#: docs/10.x/configuration.md:block 104 (paragraph) +# H4 +#: ./docs/9.x/configuration.md:145 +#: ./docs/10.x/configuration.md:151 +#: ./docs/11.x/configuration.md:156 +#: ./docs/master/configuration.md:152 +msgid "Decryption" +msgstr "" + +# P +#: ./docs/8.x/configuration.md:147 +#: ./docs/9.x/configuration.md:248 +#: ./docs/10.x/configuration.md:265 +#: ./docs/11.x/configuration.md:291 +#: ./docs/master/configuration.md:287 msgid "After placing the application in maintenance mode, you may navigate to the application URL matching this token and Laravel will issue a maintenance mode bypass cookie to your browser:" -msgstr "將應用程式放入維護模式後,可以瀏覽符合該權杖的應用程式網址,Laravel 會簽發一個繞過維護模式的 Cookie 給瀏覽器:" +msgstr "" + +# P +#: ./docs/9.x/configuration.md:147 +#: ./docs/10.x/configuration.md:153 +#: ./docs/11.x/configuration.md:158 +#: ./docs/master/configuration.md:154 +msgid "To decrypt an environment file, you may use the `env:decrypt` command. This command requires a decryption key, which Laravel will retrieve from the `LARAVEL_ENV_ENCRYPTION_KEY` environment variable:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/configuration.md:149 +#: ./docs/9.x/configuration.md:250 +#: ./docs/10.x/configuration.md:267 +#: ./docs/11.x/configuration.md:293 +#: ./docs/master/configuration.md:289 +msgid "https://example.com/1630542a-246b-4b66-afa1-dd72a4c43515" +msgstr "" -#: docs/10.x/configuration.md:block 105 (code) -msgid "https://example.com/1630542a-246b-4b66-afa1-dd72a4c43515\n" -msgstr "https://example.com/1630542a-246b-4b66-afa1-dd72a4c43515\n" +# CODE: shell +#: ./docs/9.x/configuration.md:149 +#: ./docs/10.x/configuration.md:155 +#: ./docs/11.x/configuration.md:160 +#: ./docs/master/configuration.md:156 +msgid "php artisan env:decrypt" +msgstr "" -#: docs/10.x/configuration.md:block 106 (paragraph) +# P +#: ./docs/8.x/configuration.md:151 +#: ./docs/9.x/configuration.md:254 +#: ./docs/10.x/configuration.md:277 +#: ./docs/11.x/configuration.md:303 +#: ./docs/master/configuration.md:299 msgid "When accessing this hidden route, you will then be redirected to the `/` route of the application. Once the cookie has been issued to your browser, you will be able to browse the application normally as if it was not in maintenance mode." -msgstr "在存取該隱藏路由時,會接著被重新導向至應用程式的 `/` 路由。該 Cookie 被簽發給瀏覽器後,就可以像沒有在維護模式一樣正常地瀏覽應用程式。" +msgstr "" + +# P +#: ./docs/8.x/configuration.md:153 +#: ./docs/9.x/configuration.md:257 +#: ./docs/10.x/configuration.md:280 +#: ./docs/11.x/configuration.md:306 +#: ./docs/master/configuration.md:302 +msgid "Your maintenance mode secret should typically consist of alpha-numeric characters and, optionally, dashes. You should avoid using characters that have special meaning in URLs such as `?` or `&`." +msgstr "" + +# P +#: ./docs/9.x/configuration.md:153 +#: ./docs/10.x/configuration.md:159 +#: ./docs/11.x/configuration.md:164 +#: ./docs/master/configuration.md:160 +msgid "Or, the key may be provided directly to the command via the `--key` option:" +msgstr "" -#: docs/10.x/configuration.md:block 107 (quote) -msgid "**Note** Your maintenance mode secret should typically consist of alpha-numeric characters and, optionally, dashes. You should avoid using characters that have special meaning in URLs such as `?` or `&`." -msgstr "**Note** 維護模式的密碼通常來說應該要由字母與數字字元組成,並可選地包含減號 (`-`, Dash)。應避免一些在 URL 中由特殊意義的字元,如 `?` 或 `&`。" +# P +#: ./docs/8.x/configuration.md:155 +#: ./docs/9.x/configuration.md:259 +#: ./docs/10.x/configuration.md:282 +#: ./docs/11.x/configuration.md:322 +#: ./docs/master/configuration.md:304 +#~ msgid "" +#~ msgstr "" + +# CODE: shell +#: ./docs/9.x/configuration.md:155 +#: ./docs/10.x/configuration.md:161 +#: ./docs/11.x/configuration.md:166 +#: ./docs/master/configuration.md:162 +msgid "php artisan env:decrypt --key=3UVsEgGVK36XN82KKeyLFMhvosbZN1aF" +msgstr "" -#: docs/10.x/configuration.md:block 109 (header) +# H4 +#: ./docs/8.x/configuration.md:156 +#: ./docs/9.x/configuration.md:260 msgid "Pre-Rendering The Maintenance Mode View" -msgstr "預轉譯維護模式 View" +msgstr "" -#: docs/10.x/configuration.md:block 110 (paragraph) +# P +#: ./docs/8.x/configuration.md:158 +#: ./docs/9.x/configuration.md:262 +#: ./docs/10.x/configuration.md:285 +#: ./docs/11.x/configuration.md:325 +#: ./docs/master/configuration.md:307 msgid "If you utilize the `php artisan down` command during deployment, your users may still occasionally encounter errors if they access the application while your Composer dependencies or other infrastructure components are updating. This occurs because a significant part of the Laravel framework must boot in order to determine your application is in maintenance mode and render the maintenance mode view using the templating engine." -msgstr "若在部署過程中使用了 `php artisan down` 指令,若使用者在 Composer 依賴或其他基礎設施元件更新時存取了應用程式,則可能會遇到錯誤。這是因為 Laravel 框架中重要的部分必須要先啟動才能判斷應用程式是否在維護模式下,並才能接著使用樣板引擎來轉譯維護模式的 View。" +msgstr "" + +# P +#: ./docs/9.x/configuration.md:159 +#: ./docs/10.x/configuration.md:165 +#: ./docs/11.x/configuration.md:170 +#: ./docs/master/configuration.md:166 +msgid "When the `env:decrypt` command is invoked, Laravel will decrypt the contents of the `.env.encrypted` file and place the decrypted contents in the `.env` file." +msgstr "" -#: docs/10.x/configuration.md:block 111 (paragraph) +# P +#: ./docs/8.x/configuration.md:160 +#: ./docs/9.x/configuration.md:264 +#: ./docs/10.x/configuration.md:287 +#: ./docs/11.x/configuration.md:327 +#: ./docs/master/configuration.md:309 msgid "For this reason, Laravel allows you to pre-render a maintenance mode view that will be returned at the very beginning of the request cycle. This view is rendered before any of your application's dependencies have loaded. You may pre-render a template of your choice using the `down` command's `render` option:" -msgstr "因為如此,Laravel 提供了可以預先轉譯維護模式 View 的功能,並能在整個請求週期的一開始就將其回傳。這個 View 會在任何應用程式的相依性套件載入前就預先被轉譯。可以使用 `down` 指令的 `render` 選項來預轉譯所選的樣板:" +msgstr "" + +# P +#: ./docs/9.x/configuration.md:161 +#: ./docs/10.x/configuration.md:167 +#: ./docs/11.x/configuration.md:172 +#: ./docs/master/configuration.md:168 +msgid "The `--cipher` option may be provided to the `env:decrypt` command in order to use a custom encryption cipher:" +msgstr "" -#: docs/10.x/configuration.md:block 112 (code) -msgid "php artisan down --render=\"errors::503\"\n" -msgstr "php artisan down --render=\"errors::503\"\n" +# CODE +# CODE: shell +#: ./docs/8.x/configuration.md:162 +#: ./docs/9.x/configuration.md:266 +#: ./docs/10.x/configuration.md:289 +#: ./docs/11.x/configuration.md:329 +#: ./docs/master/configuration.md:311 +msgid "php artisan down --render=\"errors::503\"" +msgstr "" -#: docs/10.x/configuration.md:block 114 (header) +# CODE: shell +#: ./docs/9.x/configuration.md:163 +#: ./docs/10.x/configuration.md:169 +#: ./docs/11.x/configuration.md:174 +#: ./docs/master/configuration.md:170 +msgid "php artisan env:decrypt --key=qUWuNRdfuImXcKxZ --cipher=AES-128-CBC" +msgstr "" + +# P +#: ./docs/8.x/configuration.md:164 +#: ./docs/9.x/configuration.md:270 +#: ./docs/10.x/configuration.md:293 +#: ./docs/11.x/configuration.md:333 +#: ./docs/master/configuration.md:315 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/configuration.md:165 +#: ./docs/9.x/configuration.md:271 +#: ./docs/10.x/configuration.md:294 +#: ./docs/11.x/configuration.md:334 +#: ./docs/master/configuration.md:316 msgid "Redirecting Maintenance Mode Requests" -msgstr "重新導向維護模式的請求" +msgstr "" -#: docs/10.x/configuration.md:block 115 (paragraph) +# P +#: ./docs/8.x/configuration.md:167 +#: ./docs/9.x/configuration.md:273 +#: ./docs/10.x/configuration.md:296 +#: ./docs/11.x/configuration.md:336 +#: ./docs/master/configuration.md:318 msgid "While in maintenance mode, Laravel will display the maintenance mode view for all application URLs the user attempts to access. If you wish, you may instruct Laravel to redirect all requests to a specific URL. This may be accomplished using the `redirect` option. For example, you may wish to redirect all requests to the `/` URI:" -msgstr "在維護模式時,不管使用者嘗試存取什麼網址,Laravel 都會顯示維護模式 View。若由需要的話,也可以讓 Laravel 將所有請求都重新導向到一個特定的 URL。可以通過使用 `redirect` 選項來完成。舉例來說,我們可能會想將所有請求都重新導向至 `/` URL:" +msgstr "" -#: docs/10.x/configuration.md:block 116 (code) -msgid "php artisan down --redirect=/\n" -msgstr "php artisan down --redirect=/\n" +# P +#: ./docs/9.x/configuration.md:167 +#: ./docs/10.x/configuration.md:173 +#: ./docs/11.x/configuration.md:178 +#: ./docs/master/configuration.md:174 +msgid "If your application has multiple environment files, such as `.env` and `.env.staging`, you may specify the environment file that should be decrypted by providing the environment name via the `--env` option:" +msgstr "" -#: docs/10.x/configuration.md:block 118 (header) +# CODE +# CODE: shell +#: ./docs/8.x/configuration.md:169 +#: ./docs/9.x/configuration.md:275 +#: ./docs/10.x/configuration.md:298 +#: ./docs/11.x/configuration.md:338 +#: ./docs/master/configuration.md:320 +msgid "php artisan down --redirect=/" +msgstr "" + +# CODE: shell +#: ./docs/9.x/configuration.md:169 +#: ./docs/10.x/configuration.md:175 +#: ./docs/11.x/configuration.md:180 +#: ./docs/master/configuration.md:176 +msgid "php artisan env:decrypt --env=staging" +msgstr "" + +# P +#: ./docs/8.x/configuration.md:171 +#: ./docs/9.x/configuration.md:279 +#: ./docs/10.x/configuration.md:302 +#: ./docs/11.x/configuration.md:342 +#: ./docs/master/configuration.md:324 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/configuration.md:172 +#: ./docs/9.x/configuration.md:280 +#: ./docs/10.x/configuration.md:303 +#: ./docs/11.x/configuration.md:343 +#: ./docs/master/configuration.md:325 msgid "Disabling Maintenance Mode" -msgstr "禁用維護模式" +msgstr "" -#: docs/10.x/configuration.md:block 119 (paragraph) +# P +#: ./docs/9.x/configuration.md:173 +#: ./docs/10.x/configuration.md:179 +#: ./docs/11.x/configuration.md:184 +#: ./docs/master/configuration.md:180 +msgid "In order to overwrite an existing environment file, you may provide the `--force` option to the `env:decrypt` command:" +msgstr "" + +# P +#: ./docs/8.x/configuration.md:174 +#: ./docs/9.x/configuration.md:282 +#: ./docs/10.x/configuration.md:305 +#: ./docs/11.x/configuration.md:345 +#: ./docs/master/configuration.md:327 msgid "To disable maintenance mode, use the `up` command:" -msgstr "若要禁用維護模式,請使用 `up` 指令:" +msgstr "" -#: docs/10.x/configuration.md:block 120 (code) -msgid "php artisan up\n" -msgstr "php artisan up\n" +# CODE: shell +#: ./docs/9.x/configuration.md:175 +#: ./docs/10.x/configuration.md:181 +#: ./docs/11.x/configuration.md:186 +#: ./docs/master/configuration.md:182 +msgid "php artisan env:decrypt --force" +msgstr "" -#: docs/10.x/configuration.md:block 121 (quote) -msgid "**Note** You may customize the default maintenance mode template by defining your own template at `resources/views/errors/503.blade.php`." -msgstr "**Note** 可以通過在 `resources/views/errors/503.blade.php` 中定義你自己的樣板來自定預設的維護模式樣板。" +# CODE +# CODE: shell +#: ./docs/8.x/configuration.md:176 +#: ./docs/9.x/configuration.md:284 +#: ./docs/10.x/configuration.md:307 +#: ./docs/11.x/configuration.md:347 +#: ./docs/master/configuration.md:329 +msgid "php artisan up" +msgstr "" -#: docs/10.x/configuration.md:block 123 (header) +# P +#: ./docs/8.x/configuration.md:178 +#: ./docs/9.x/configuration.md:289 +#: ./docs/10.x/configuration.md:312 +#: ./docs/11.x/configuration.md:352 +#: ./docs/master/configuration.md:334 +msgid "You may customize the default maintenance mode template by defining your own template at `resources/views/errors/503.blade.php`." +msgstr "" + +# P +#: ./docs/8.x/configuration.md:180 +#: ./docs/9.x/configuration.md:291 +#: ./docs/10.x/configuration.md:314 +#: ./docs/11.x/configuration.md:354 +#: ./docs/master/configuration.md:336 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/configuration.md:181 +#: ./docs/9.x/configuration.md:292 msgid "Maintenance Mode & Queues" -msgstr "維護模式與佇列" +msgstr "" + +# P +#: ./docs/9.x/configuration.md:182 +msgid "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:" +msgstr "" -#: docs/10.x/configuration.md:block 124 (paragraph) +# P +#: ./docs/8.x/configuration.md:183 +#: ./docs/9.x/configuration.md:294 +#: ./docs/10.x/configuration.md:317 +#: ./docs/11.x/configuration.md:357 +#: ./docs/master/configuration.md:339 msgid "While your application is in maintenance mode, no [queued jobs](/docs/{{version}}/queues) will be handled. The jobs will continue to be handled as normal once the application is out of maintenance mode." -msgstr "當網站在維護模式下,所有[佇列任務](/docs/{{version}}/queues)都不會被處理。當網站離開維護模式後,任務就會繼續被正常處理。" +msgstr "" -#: docs/10.x/configuration.md:block 126 (header) +# P +#: ./docs/8.x/configuration.md:185 +#: ./docs/9.x/configuration.md:296 +#: ./docs/10.x/configuration.md:319 +#: ./docs/11.x/configuration.md:359 +#: ./docs/master/configuration.md:341 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/configuration.md:186 +#: ./docs/9.x/configuration.md:297 msgid "Alternatives To Maintenance Mode" -msgstr "維護模式替代" +msgstr "" + +# P +#: ./docs/10.x/configuration.md:188 +#: ./docs/11.x/configuration.md:193 +#: ./docs/master/configuration.md:189 +msgid "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:" +msgstr "" -#: docs/10.x/configuration.md:block 127 (paragraph) +# P +#: ./docs/8.x/configuration.md:188 +#: ./docs/9.x/configuration.md:299 +#: ./docs/10.x/configuration.md:322 +#: ./docs/11.x/configuration.md:362 +#: ./docs/master/configuration.md:344 msgid "Since maintenance mode requires your application to have several seconds of downtime, consider alternatives like [Laravel Vapor](https://vapor.laravel.com) and [Envoyer](https://envoyer.io) to accomplish zero-downtime deployment with Laravel." -msgstr "由於維護模式會導致應用程式有數秒的停機時間,可考慮使用像是 [Laravel Vapor](https://vapor.laravel.com) 與 [Envoyer](https://envoyer.io) 等替代方案來在 Laravel 中達成不需停機的部署。" +msgstr "" -#: docs/8.x/configuration.md:block 13 (quote) -msgid "{tip} Any variable in your `.env` file can be overridden by external environment variables such as server-level or system-level environment variables." -msgstr "{tip} 任何 `.env` 檔內的變數都可通過外部環境變數來複寫,如伺服器等級或是系統等級的環境變數。" +# P +#: ./docs/9.x/configuration.md:189 +msgid "To set configuration values at runtime, pass an array to the `config` function:" +msgstr "" -#: docs/8.x/configuration.md:block 19 (paragraph) -msgid "Before loading your application's environment variables, Laravel determines if either the `APP_ENV` environment variable has been externally provided or if the `--env` CLI argument has been specified. If so, Laravel will attempt to load an `.env.[APP_ENV]` file if it exists. If it does not exist, the default `.env` file will be loaded." -msgstr "在載入專案的環境變數時,Laravel 會判斷是否有從外部提供 `APP_ENV` 環境變數,或是從 `--env` CLI 引數指定環境,若有從外部指定環境,則 Laravel 會嘗試載入 `.env.[APP_ENV]` 檔案(若有的話)。若該檔案不存在,則會載入 `.env` 檔。" +# CODE +#: ./docs/10.x/configuration.md:190 +#: ./docs/11.x/configuration.md:195 +#: ./docs/master/configuration.md:191 +msgid "use Illuminate\\Support\\Facades\\Config;\n\n" +"$value = Config::get('app.timezone');\n\n" +"$value = config('app.timezone');\n\n" +"// Retrieve a default value if the configuration value does not exist...\n" +"$value = config('app.timezone', 'Asia/Seoul');" +msgstr "" -#: docs/8.x/configuration.md:block 28 (paragraph) -msgid "All of the variables listed in this file will be loaded into the `$_ENV` PHP super-global when your application receives a request. However, you may use the `env` helper to retrieve values from these variables in your configuration files. In fact, if you review the Laravel configuration files, you will notice many of the options are already using this helper:" -msgstr "該檔案中列出的所有變數都會在網站接收到請求的時候被載入進 `$_ENV` PHP 超全域變數內。不過,可以使用 `env` 輔助函式來在設定檔中取得這些變數。事實上,若閱讀 Laravel 的設定檔,就會發現其中許多選項已經使用到這個輔助函式了:" +# P +#: ./docs/10.x/configuration.md:199 +#: ./docs/11.x/configuration.md:204 +#: ./docs/master/configuration.md:200 +msgid "To set configuration values at runtime, you may invoke the `Config` facade's `set` method or pass an array to the `config` function:" +msgstr "" -#: docs/8.x/configuration.md:block 37 (quote) -msgid "{tip} The current application environment detection can be overridden by defining a server-level `APP_ENV` environment variable." -msgstr "{tip} 應用程式判斷的目前環境可以通過在伺服器等級上定義 `APP_ENV` 環境變數來複寫。" +# P +#: ./docs/9.x/configuration.md:200 +#: ./docs/10.x/configuration.md:216 +#: ./docs/11.x/configuration.md:229 +#: ./docs/master/configuration.md:225 +msgid "The `config:clear` command may be used to purge the cached configuration:" +msgstr "" -#: docs/8.x/configuration.md:block 40 (paragraph) -msgid "You may easily access your configuration values using the global `config` helper 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:" -msgstr "可以輕鬆的在專案內的任何地方通過 `config` 全域輔助函式來存取設定值。設定值可以通過「點」語法來存取,即包含設定檔名稱與欲存取的選項名。也可以指定設定選項不存在時要回傳的預設值:" +# CODE +#: ./docs/10.x/configuration.md:201 +#: ./docs/11.x/configuration.md:206 +#: ./docs/master/configuration.md:202 +msgid "Config::set('app.timezone', 'America/Chicago');\n\n" +"config(['app.timezone' => 'America/Chicago']);" +msgstr "" -#: docs/8.x/configuration.md:block 42 (paragraph) -msgid "To set configuration values at runtime, pass an array to the `config` helper:" -msgstr "若要在執行階段修改設定值,可以傳入陣列進 `config` 輔助函式:" +# CODE: shell +#: ./docs/9.x/configuration.md:202 +#: ./docs/10.x/configuration.md:218 +#: ./docs/11.x/configuration.md:231 +#: ./docs/master/configuration.md:227 +msgid "php artisan config:clear" +msgstr "" -#: docs/8.x/configuration.md:block 48 (quote) -msgid "{note} If you execute the `config:cache` command during your deployment process, you should be sure that you are only calling the `env` function from within your configuration files. Once the configuration has been cached, the `.env` file will not be loaded; therefore, the `env` function will only return external, system level environment variables." -msgstr "{note} 若在部署流程中執行了 `config:cache` 指令,應確保只有在設定檔中呼叫 `env` 函式。設定檔被快取後,就不會再載入 `.env` 檔了。因此,`env` 函式只會回傳外部的、系統等級的環境變數。" +# P +#: ./docs/11.x/configuration.md:210 +#: ./docs/master/configuration.md:206 +msgid "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:" +msgstr "" -#: docs/8.x/configuration.md:block 52 (paragraph) -msgid "For local development, you should set the `APP_DEBUG` environment variable to `true`. **In your production environment, this value should always be `false`. If the variable is set to `true` in production, you risk exposing sensitive configuration values to your application's end users.**" -msgstr "在本機上開發時,應將 `APP_DEBUG` 環境變數設為 `true`。 **在正式環境上,這個值一定要是 `false`。若在正式環境上將該變數設為 `true`,則會有將機敏設定值暴露給網站終端使用者的風險。**" +# P +#: ./docs/10.x/configuration.md:212 +#: ./docs/11.x/configuration.md:225 +#: ./docs/master/configuration.md:221 +msgid "Once the configuration has been cached, your application's `.env` file will not be loaded by the framework during requests or Artisan commands; therefore, the `env` function will only return external, system level environment variables." +msgstr "" -#: docs/8.x/configuration.md:block 64 (paragraph) -msgid "Even while in maintenance mode, you may use the `secret` option to specify a maintenance mode bypass token:" -msgstr "即時在維護模式下,也可以使用 `secret` 選項來指定一個用來繞過維護模式的權杖:" +# CODE +#: ./docs/11.x/configuration.md:212 +#: ./docs/master/configuration.md:208 +msgid "Config::string('config-key');\n" +"Config::integer('config-key');\n" +"Config::float('config-key');\n" +"Config::boolean('config-key');\n" +"Config::array('config-key');" +msgstr "" + +# P +#: ./docs/10.x/configuration.md:214 +#: ./docs/11.x/configuration.md:227 +#: ./docs/master/configuration.md:223 +msgid "For this reason, you should ensure you are only calling the `env` function from within your application's configuration (`config`) files. You can see many examples of this by examining Laravel's default configuration files. Configuration values may be accessed from anywhere in your application using the `config` function [described above](#accessing-configuration-values)." +msgstr "" + +# P +#: ./docs/11.x/configuration.md:238 +#: ./docs/master/configuration.md:234 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/configuration.md:239 +#: ./docs/master/configuration.md:235 +msgid "Configuration Publishing" +msgstr "" + +# P +#: ./docs/11.x/configuration.md:241 +#: ./docs/master/configuration.md:237 +msgid "Most of Laravel's configuration files are already published in your application's `config` directory; however, certain configuration files like `cors.php` and `view.php` are not published by default, as most applications will never need to modify them." +msgstr "" + +# P +#: ./docs/9.x/configuration.md:242 +#: ./docs/10.x/configuration.md:259 +#: ./docs/11.x/configuration.md:285 +#: ./docs/master/configuration.md:281 +msgid "To allow maintenance mode to be bypassed using a secret token, you may use the `secret` option to specify a maintenance mode bypass token:" +msgstr "" + +# P +#: ./docs/11.x/configuration.md:243 +#: ./docs/master/configuration.md:239 +msgid "However, you may use the `config:publish` Artisan command to publish any configuration files that are not published by default:" +msgstr "" + +# CODE: shell +#: ./docs/11.x/configuration.md:245 +#: ./docs/master/configuration.md:241 +msgid "php artisan config:publish\n\n" +"php artisan config:publish --all" +msgstr "" + +# P +#: ./docs/10.x/configuration.md:271 +#: ./docs/11.x/configuration.md:297 +#: ./docs/master/configuration.md:293 +msgid "If you would like Laravel to generate the secret token for you, you may use the `with-secret` option. The secret will be displayed to you once the application is in maintenance mode:" +msgstr "" + +# CODE: shell +#: ./docs/10.x/configuration.md:273 +#: ./docs/11.x/configuration.md:299 +#: ./docs/master/configuration.md:295 +msgid "php artisan down --with-secret" +msgstr "" + +# H4 +#: ./docs/10.x/configuration.md:283 +#: ./docs/11.x/configuration.md:323 +#: ./docs/master/configuration.md:305 +msgid "Pre-Rendering the Maintenance Mode View" +msgstr "" + +# P +#: ./docs/11.x/configuration.md:308 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/11.x/configuration.md:309 +msgid "Maintenance Mode on Multiple Servers" +msgstr "" -#: docs/8.x/configuration.md:block 69 (quote) -msgid "{tip} Your maintenance mode secret should typically consist of alpha-numeric characters and, optionally, dashes. You should avoid using characters that have special meaning in URLs such as `?` or `&`." -msgstr "{tip} 維護模式的密碼通常來說應該要由字母與數字字元組成,並可選地包含減號 (`-`, Dash)。應避免一些在 URL 中由特殊意義的字元,如 `?` 或 `&`。" +# P +#: ./docs/11.x/configuration.md:311 +msgid "By default, Laravel determines if your application is in maintenance mode using a file-based system. This means to activate maintenance mode, the `php artisan down` command has to be executed on each server hosting your application." +msgstr "" -#: docs/8.x/configuration.md:block 83 (quote) -msgid "{tip} You may customize the default maintenance mode template by defining your own template at `resources/views/errors/503.blade.php`." -msgstr "{tip} 可以通過在 `resources/views/errors/503.blade.php` 中定義你自己的樣板來自定預設的維護模式樣板。" +# P +#: ./docs/11.x/configuration.md:313 +msgid "Alternatively, Laravel offers a cache-based method for handling maintenance mode. This method requires running the `php artisan down` command on just one server. To use this approach, modify the \"driver\" setting in the `config/app.php` file of your application to `cache`. Then, select a cache `store` that is accessible by all your servers. This ensures the maintenance mode status is consistently maintained across every server:" +msgstr "" -#: docs/master/configuration.md:block 101 (quote) -msgid "**Note** Your maintenance mode secret should typically consist of alpha-numeric characters and, optionally, dashes. You should avoid using characters that have special meaning in URLs such as `?`." -msgstr "**Note** 維護模式的密碼通常來說應該要由字母與數字字元組成,並可選地包含減號 (`-`, Dash)。應避免一些在 URL 中由特殊意義的字元,如 `?`。" +# H4 +#: ./docs/10.x/configuration.md:315 +#: ./docs/11.x/configuration.md:355 +#: ./docs/master/configuration.md:337 +msgid "Maintenance Mode and Queues" +msgstr "" + +# CODE: php +#: ./docs/11.x/configuration.md:315 +msgid "'maintenance' => [\n" +" 'driver' => 'cache',\n" +" 'store' => 'database',\n" +"]," +msgstr "" + +# H4 +#: ./docs/10.x/configuration.md:320 +#: ./docs/11.x/configuration.md:360 +#: ./docs/master/configuration.md:342 +msgid "Alternatives to Maintenance Mode" +msgstr "" diff --git a/po/zh_TW/console-tests.po b/po/zh_TW/console-tests.po index 8ff29cec8..5859977e6 100644 --- a/po/zh_TW/console-tests.po +++ b/po/zh_TW/console-tests.po @@ -10,87 +10,211 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" - -#: docs/10.x/console-tests.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H1 +#: ./docs/8.x/console-tests.md:1 +#: ./docs/9.x/console-tests.md:1 +#: ./docs/10.x/console-tests.md:1 +#: ./docs/11.x/console-tests.md:1 +#: ./docs/master/console-tests.md:1 msgid "Console Tests" -msgstr "主控台測試" +msgstr "" -#: docs/10.x/console-tests.md:block 2 (unordered list) +# P +#: ./docs/8.x/console-tests.md:3 +#: ./docs/9.x/console-tests.md:3 +#: ./docs/10.x/console-tests.md:3 +#: ./docs/11.x/console-tests.md:3 +#: ./docs/master/console-tests.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/console-tests.md:block 2 (unordered list) +# P +#: ./docs/8.x/console-tests.md:4 +#: ./docs/9.x/console-tests.md:4 +#: ./docs/10.x/console-tests.md:4 +#: ./docs/11.x/console-tests.md:4 +#: ./docs/master/console-tests.md:4 msgid "[Success / Failure Expectations](#success-failure-expectations)" -msgstr "[預期成功 / 預期失敗](#success-failure-expectations)" +msgstr "" -#: docs/10.x/console-tests.md:block 2 (unordered list) +# P +#: ./docs/8.x/console-tests.md:5 +#: ./docs/9.x/console-tests.md:5 +#: ./docs/10.x/console-tests.md:5 +#: ./docs/11.x/console-tests.md:5 +#: ./docs/master/console-tests.md:5 msgid "[Input / Output Expectations](#input-output-expectations)" -msgstr "[預期輸入 / 預期輸出](#input-output-expectations)" +msgstr "" -#: docs/10.x/console-tests.md:block 2 (unordered list) +# P +#: ./docs/10.x/console-tests.md:6 +#: ./docs/11.x/console-tests.md:6 +#: ./docs/master/console-tests.md:6 msgid "[Console Events](#console-events)" -msgstr "[Console 事件](#console-events)" +msgstr "" -#: docs/10.x/console-tests.md:block 4 (header) +# P +#: ./docs/8.x/console-tests.md:7 +#: ./docs/9.x/console-tests.md:7 +#: ./docs/10.x/console-tests.md:8 +#: ./docs/11.x/console-tests.md:8 +#: ./docs/master/console-tests.md:8 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/console-tests.md:8 +#: ./docs/9.x/console-tests.md:8 +#: ./docs/10.x/console-tests.md:9 +#: ./docs/11.x/console-tests.md:9 +#: ./docs/master/console-tests.md:9 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/console-tests.md:block 5 (paragraph) +# P +#: ./docs/8.x/console-tests.md:10 +#: ./docs/9.x/console-tests.md:10 +#: ./docs/10.x/console-tests.md:11 +#: ./docs/11.x/console-tests.md:11 +#: ./docs/master/console-tests.md:11 msgid "In addition to simplifying HTTP testing, Laravel provides a simple API for testing your application's [custom console commands](/docs/{{version}}/artisan)." -msgstr "在 Laravel 中除了能簡單地測試 HTTP 外,Laravel 還提供了一個簡單的 API 來測試專案的[自訂主控台指令](/docs/{{version}}/artisan)。" +msgstr "" -#: docs/10.x/console-tests.md:block 7 (header) +# P +#: ./docs/8.x/console-tests.md:12 +#: ./docs/9.x/console-tests.md:12 +#: ./docs/10.x/console-tests.md:13 +#: ./docs/11.x/console-tests.md:13 +#: ./docs/master/console-tests.md:13 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/console-tests.md:13 +#: ./docs/9.x/console-tests.md:13 +#: ./docs/10.x/console-tests.md:14 +#: ./docs/11.x/console-tests.md:14 +#: ./docs/master/console-tests.md:14 msgid "Success / Failure Expectations" -msgstr "預期成功 / 失敗" +msgstr "" -#: docs/10.x/console-tests.md:block 8 (paragraph) +# P +#: ./docs/8.x/console-tests.md:15 +#: ./docs/9.x/console-tests.md:15 +#: ./docs/10.x/console-tests.md:16 +#: ./docs/11.x/console-tests.md:16 +#: ./docs/master/console-tests.md:16 msgid "To get started, let's explore how to make assertions regarding an Artisan command's exit code. To accomplish this, we will use the `artisan` method to invoke an Artisan command from our test. Then, we will use the `assertExitCode` method to assert that the command completed with a given exit code:" -msgstr "若要開始,讓我們先來看看如何針對 Artisan 指令的結束代碼 (Exit Code) 作 Assertion (判斷提示)。為此,我們將使用 `artisan` 方法來在測試中叫用 Artisan 指令。接著,我們會使用 `assertExitCode` 方法來判斷該指令是否以給定的結束代碼完成:" +msgstr "" -#: docs/10.x/console-tests.md:block 9 (code) +# CODE +#: ./docs/8.x/console-tests.md:17 +#: ./docs/9.x/console-tests.md:17 msgid "/**\n" " * Test a console command.\n" +" *\n" +" * @return void\n" " */\n" -"public function test_console_command(): void\n" +"public function test_console_command()\n" "{\n" " $this->artisan('inspire')->assertExitCode(0);\n" -"}\n" -msgstr "/**\n" +"}" +msgstr "" + +# CODE +# CODE: php tab=PHPUnit +#: ./docs/10.x/console-tests.md:18 +#: ./docs/11.x/console-tests.md:24 +#: ./docs/master/console-tests.md:24 +msgid "/**\n" " * Test a console command.\n" " */\n" "public function test_console_command(): void\n" "{\n" " $this->artisan('inspire')->assertExitCode(0);\n" -"}\n" +"}" +msgstr "" + +# CODE: php tab=Pest +#: ./docs/11.x/console-tests.md:18 +#: ./docs/master/console-tests.md:18 +msgid "test('console command', function () {\n" +" $this->artisan('inspire')->assertExitCode(0);\n" +"});" +msgstr "" -#: docs/10.x/console-tests.md:block 10 (paragraph) +# P +#: ./docs/8.x/console-tests.md:27 +#: ./docs/9.x/console-tests.md:27 +#: ./docs/10.x/console-tests.md:26 +#: ./docs/11.x/console-tests.md:34 +#: ./docs/master/console-tests.md:34 msgid "You may use the `assertNotExitCode` method to assert that the command did not exit with a given exit code:" -msgstr "可以使用 `assertNotExitCode` 方法來判斷該指令是否不以給定結束代碼終止:" +msgstr "" -#: docs/10.x/console-tests.md:block 11 (code) -msgid "$this->artisan('inspire')->assertNotExitCode(1);\n" -msgstr "$this->artisan('inspire')->assertNotExitCode(1);\n" +# CODE +#: ./docs/8.x/console-tests.md:29 +#: ./docs/9.x/console-tests.md:29 +#: ./docs/10.x/console-tests.md:28 +#: ./docs/11.x/console-tests.md:36 +#: ./docs/master/console-tests.md:36 +msgid "$this->artisan('inspire')->assertNotExitCode(1);" +msgstr "" -#: docs/10.x/console-tests.md:block 12 (paragraph) +# P +#: ./docs/8.x/console-tests.md:31 +#: ./docs/9.x/console-tests.md:31 +#: ./docs/10.x/console-tests.md:30 +#: ./docs/11.x/console-tests.md:38 +#: ./docs/master/console-tests.md:38 msgid "Of course, all terminal commands typically exit with a status code of `0` when they are successful and a non-zero exit code when they are not successful. Therefore, for convenience, you may utilize the `assertSuccessful` and `assertFailed` assertions to assert that a given command exited with a successful exit code or not:" -msgstr "當然,一般來說,所有以狀態碼 `0` 結束的終端機指令通常都代表成功,而非 0 的結束代碼則代表不成功。因此,為了方便起見,我們可以使用 `assertSuccessful` 與 `assertFailed` Assertion 來判斷給定的指令是否以成功結束碼退出:" +msgstr "" -#: docs/10.x/console-tests.md:block 13 (code) +# CODE +#: ./docs/8.x/console-tests.md:33 +#: ./docs/9.x/console-tests.md:33 +#: ./docs/10.x/console-tests.md:32 +#: ./docs/11.x/console-tests.md:40 +#: ./docs/master/console-tests.md:40 msgid "$this->artisan('inspire')->assertSuccessful();\n\n" -"$this->artisan('inspire')->assertFailed();\n" -msgstr "$this->artisan('inspire')->assertSuccessful();\n\n" -"$this->artisan('inspire')->assertFailed();\n" +"$this->artisan('inspire')->assertFailed();" +msgstr "" -#: docs/10.x/console-tests.md:block 15 (header) +# P +#: ./docs/8.x/console-tests.md:37 +#: ./docs/9.x/console-tests.md:37 +#: ./docs/10.x/console-tests.md:36 +#: ./docs/11.x/console-tests.md:44 +#: ./docs/master/console-tests.md:44 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/console-tests.md:38 +#: ./docs/9.x/console-tests.md:38 +#: ./docs/10.x/console-tests.md:37 +#: ./docs/11.x/console-tests.md:45 +#: ./docs/master/console-tests.md:45 msgid "Input / Output Expectations" -msgstr "預期的輸入/輸出" +msgstr "" -#: docs/10.x/console-tests.md:block 16 (paragraph) +# P +#: ./docs/8.x/console-tests.md:40 +#: ./docs/9.x/console-tests.md:40 +#: ./docs/10.x/console-tests.md:39 +#: ./docs/11.x/console-tests.md:47 +#: ./docs/master/console-tests.md:47 msgid "Laravel allows you to easily \"mock\" user input for your console commands using the `expectsQuestion` method. In addition, you may specify the exit code and text that you expect to be output by the console command using the `assertExitCode` and `expectsOutput` methods. For example, consider the following console command:" -msgstr "Laravel 能讓你輕鬆地通過 `expectsQuestion` 方法來為主控台指令「模擬(Mock)」使用者輸入。此外,還可以通過 `assertExitCode` 與 `expectsOutput` 來指定主控台預期的結束代碼與輸出文字。舉例來說,假設有下列主控台指令:" +msgstr "" -#: docs/10.x/console-tests.md:block 17 (code) +# CODE +#: ./docs/8.x/console-tests.md:42 +#: ./docs/9.x/console-tests.md:42 +#: ./docs/10.x/console-tests.md:41 +#: ./docs/11.x/console-tests.md:49 +#: ./docs/master/console-tests.md:49 msgid "Artisan::command('question', function () {\n" " $name = $this->ask('What is your name?');\n\n" " $language = $this->choice('Which language do you prefer?', [\n" @@ -99,22 +223,25 @@ msgid "Artisan::command('question', function () {\n" " 'Python',\n" " ]);\n\n" " $this->line('Your name is '.$name.' and you prefer '.$language.'.');\n" -"});\n" -msgstr "Artisan::command('question', function () {\n" -" $name = $this->ask('What is your name?');\n\n" -" $language = $this->choice('Which language do you prefer?', [\n" -" 'PHP',\n" -" 'Ruby',\n" -" 'Python',\n" -" ]);\n\n" -" $this->line('Your name is '.$name.' and you prefer '.$language.'.');\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/console-tests.md:54 +msgid "You may test this command with the following test which utilizes the `expectsQuestion`, `expectsOutput`, `doesntExpectOutput`, and `assertExitCode` methods:" +msgstr "" -#: docs/10.x/console-tests.md:block 18 (paragraph) +# P +#: ./docs/9.x/console-tests.md:54 +#: ./docs/10.x/console-tests.md:53 +#: ./docs/master/console-tests.md:61 msgid "You may test this command with the following test which utilizes the `expectsQuestion`, `expectsOutput`, `doesntExpectOutput`, `expectsOutputToContain`, `doesntExpectOutputToContain`, and `assertExitCode` methods:" -msgstr "可以通過下列這個使用了 `expectsQuestion`, `expectsOutput`, `doesntExpectOutput`, `expectsOutputToContain`, `doesntExpectOutputToContain` 與 `assertExitCode` 方法的測試來測試該指令:" +msgstr "" -#: docs/10.x/console-tests.md:block 19 (code) +# CODE +# CODE: php tab=PHPUnit +#: ./docs/10.x/console-tests.md:55 +#: ./docs/master/console-tests.md:76 msgid "/**\n" " * Test a console command.\n" " */\n" @@ -128,11 +255,35 @@ msgid "/**\n" " ->expectsOutputToContain('Taylor Otwell')\n" " ->doesntExpectOutputToContain('you prefer Ruby')\n" " ->assertExitCode(0);\n" -"}\n" -msgstr "/**\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/console-tests.md:56 +msgid "/**\n" " * Test a console command.\n" +" *\n" +" * @return void\n" " */\n" -"public function test_console_command(): void\n" +"public function test_console_command()\n" +"{\n" +" $this->artisan('question')\n" +" ->expectsQuestion('What is your name?', 'Taylor Otwell')\n" +" ->expectsQuestion('Which language do you prefer?', 'PHP')\n" +" ->expectsOutput('Your name is Taylor Otwell and you prefer PHP.')\n" +" ->doesntExpectOutput('Your name is Taylor Otwell and you prefer Ruby.')\n" +" ->assertExitCode(0);\n" +"}" +msgstr "" + +# CODE +#: ./docs/9.x/console-tests.md:56 +msgid "/**\n" +" * Test a console command.\n" +" *\n" +" * @return void\n" +" */\n" +"public function test_console_command()\n" "{\n" " $this->artisan('question')\n" " ->expectsQuestion('What is your name?', 'Taylor Otwell')\n" @@ -142,33 +293,127 @@ msgstr "/**\n" " ->expectsOutputToContain('Taylor Otwell')\n" " ->doesntExpectOutputToContain('you prefer Ruby')\n" " ->assertExitCode(0);\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/console-tests.md:block 21 (header) +# P +#: ./docs/11.x/console-tests.md:61 +msgid "You may test this command with the following test:" +msgstr "" + +# CODE: php tab=Pest +#: ./docs/11.x/console-tests.md:63 +msgid "test('console command', function () {\n" +" $this->artisan('question')\n" +" ->expectsQuestion('What is your name?', 'Taylor Otwell')\n" +" ->expectsQuestion('Which language do you prefer?', 'PHP')\n" +" ->expectsOutput('Your name is Taylor Otwell and you prefer PHP.')\n" +" ->doesntExpectOutput('Your name is Taylor Otwell and you prefer Ruby.')\n" +" ->assertExitCode(0);\n" +"});" +msgstr "" + +# CODE: php tab=Pest +#: ./docs/master/console-tests.md:63 +msgid "test('console command', function () {\n" +" $this->artisan('question')\n" +" ->expectsQuestion('What is your name?', 'Taylor Otwell')\n" +" ->expectsQuestion('Which language do you prefer?', 'PHP')\n" +" ->expectsOutput('Your name is Taylor Otwell and you prefer PHP.')\n" +" ->doesntExpectOutput('Your name is Taylor Otwell and you prefer Ruby.')\n" +" ->expectsOutputToContain('Taylor Otwell')\n" +" ->doesntExpectOutputToContain('you prefer Ruby')\n" +" ->assertExitCode(0);\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/console-tests.md:71 +#: ./docs/9.x/console-tests.md:73 +#: ./docs/10.x/console-tests.md:70 +#: ./docs/11.x/console-tests.md:163 +#: ./docs/master/console-tests.md:93 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/console-tests.md:72 +#: ./docs/9.x/console-tests.md:74 +#: ./docs/10.x/console-tests.md:71 +#: ./docs/11.x/console-tests.md:164 +#: ./docs/master/console-tests.md:94 msgid "Confirmation Expectations" -msgstr "預期確認" +msgstr "" + +# CODE: php tab=PHPUnit +#: ./docs/11.x/console-tests.md:74 +msgid "/**\n" +" * Test a console command.\n" +" */\n" +"public function test_console_command(): void\n" +"{\n" +" $this->artisan('question')\n" +" ->expectsQuestion('What is your name?', 'Taylor Otwell')\n" +" ->expectsQuestion('Which language do you prefer?', 'PHP')\n" +" ->expectsOutput('Your name is Taylor Otwell and you prefer PHP.')\n" +" ->doesntExpectOutput('Your name is Taylor Otwell and you prefer Ruby.')\n" +" ->assertExitCode(0);\n" +"}" +msgstr "" -#: docs/10.x/console-tests.md:block 22 (paragraph) +# P +#: ./docs/8.x/console-tests.md:74 +#: ./docs/9.x/console-tests.md:76 +#: ./docs/10.x/console-tests.md:73 +#: ./docs/11.x/console-tests.md:166 +#: ./docs/master/console-tests.md:96 msgid "When writing a command which expects confirmation in the form of a \"yes\" or \"no\" answer, you may utilize the `expectsConfirmation` method:" -msgstr "當撰寫預期答案為「yes」或「no」確認的指令時,可以使用 `expectsConfirmation` 方法:" +msgstr "" -#: docs/10.x/console-tests.md:block 23 (code) +# CODE +#: ./docs/8.x/console-tests.md:76 +#: ./docs/9.x/console-tests.md:78 +#: ./docs/10.x/console-tests.md:75 +#: ./docs/11.x/console-tests.md:168 +#: ./docs/master/console-tests.md:98 msgid "$this->artisan('module:import')\n" " ->expectsConfirmation('Do you really wish to run this command?', 'no')\n" -" ->assertExitCode(1);\n" -msgstr "$this->artisan('module:import')\n" -" ->expectsConfirmation('Do you really wish to run this command?', 'no')\n" -" ->assertExitCode(1);\n" +" ->assertExitCode(1);" +msgstr "" -#: docs/10.x/console-tests.md:block 25 (header) +# P +#: ./docs/8.x/console-tests.md:80 +#: ./docs/9.x/console-tests.md:82 +#: ./docs/10.x/console-tests.md:79 +#: ./docs/11.x/console-tests.md:172 +#: ./docs/master/console-tests.md:102 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/console-tests.md:81 +#: ./docs/9.x/console-tests.md:83 +#: ./docs/10.x/console-tests.md:80 +#: ./docs/11.x/console-tests.md:173 +#: ./docs/master/console-tests.md:103 msgid "Table Expectations" -msgstr "預期表格" +msgstr "" -#: docs/10.x/console-tests.md:block 26 (paragraph) +# P +#: ./docs/8.x/console-tests.md:83 +#: ./docs/9.x/console-tests.md:85 +#: ./docs/10.x/console-tests.md:82 +#: ./docs/11.x/console-tests.md:175 +#: ./docs/master/console-tests.md:105 msgid "If your command displays a table of information using Artisan's `table` method, it can be cumbersome to write output expectations for the entire table. Instead, you may use the `expectsTable` method. This method accepts the table's headers as its first argument and the table's data as its second argument:" -msgstr "若指令使用 Artisan 的 `table` 方法來以表格顯示資訊,則要為整個表格撰寫預期的輸出可能很麻煩。因此可以改用 `expectsTable` 方法來代替。該方法接收表格的標頭作為其第一個引數,以及表格的資料作為其第二引數:" +msgstr "" -#: docs/10.x/console-tests.md:block 27 (code) +# CODE +#: ./docs/8.x/console-tests.md:85 +#: ./docs/9.x/console-tests.md:87 +#: ./docs/10.x/console-tests.md:84 +#: ./docs/11.x/console-tests.md:177 +#: ./docs/master/console-tests.md:107 msgid "$this->artisan('users:all')\n" " ->expectsTable([\n" " 'ID',\n" @@ -176,25 +421,53 @@ msgid "$this->artisan('users:all')\n" " ], [\n" " [1, 'taylor@example.com'],\n" " [2, 'abigail@example.com'],\n" -" ]);\n" -msgstr "$this->artisan('users:all')\n" -" ->expectsTable([\n" -" 'ID',\n" -" 'Email',\n" -" ], [\n" -" [1, 'taylor@example.com'],\n" -" [2, 'abigail@example.com'],\n" -" ]);\n" +" ]);" +msgstr "" + +# P +#: ./docs/11.x/console-tests.md:89 +msgid "If you are utilizing the `search` or `multisearch` functions provided by [Laravel Prompts](/docs/{{version}}/prompts), you may use the `expectsSearch` assertion to mock the user's input, search results, and selection:" +msgstr "" -#: docs/10.x/console-tests.md:block 29 (header) +# CODE: php tab=Pest +#: ./docs/11.x/console-tests.md:91 +msgid "test('console command', function () {\n" +" $this->artisan('example')\n" +" ->expectsSearch('What is your name?', search: 'Tay', answers: [\n" +" 'Taylor Otwell',\n" +" 'Taylor Swift',\n" +" 'Darian Taylor'\n" +" ], answer: 'Taylor Otwell')\n" +" ->assertExitCode(0);\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/console-tests.md:93 +#: ./docs/11.x/console-tests.md:186 +#: ./docs/master/console-tests.md:116 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/console-tests.md:94 +#: ./docs/11.x/console-tests.md:187 +#: ./docs/master/console-tests.md:117 msgid "Console Events" -msgstr "Console 事件" +msgstr "" -#: docs/10.x/console-tests.md:block 30 (paragraph) +# P +#: ./docs/10.x/console-tests.md:96 +#: ./docs/11.x/console-tests.md:189 +#: ./docs/master/console-tests.md:119 msgid "By default, the `Illuminate\\Console\\Events\\CommandStarting` and `Illuminate\\Console\\Events\\CommandFinished` events are not dispatched while running your application's tests. However, you can enable these events for a given test class by adding the `Illuminate\\Foundation\\Testing\\WithConsoleEvents` trait to the class:" -msgstr "預設情況下,在執行測試時,不會分派 `Illuminate\\Console\\Events\\CommandStarting` 與 `Illuminate\\Console\\Events\\CommandFinished` 事件。不過,只要在測試類別中加入 `Illuminate\\Foundation\\Testing\\WithConsoleEvents` Trait,就可以啟用這些測試:" +msgstr "" -#: docs/10.x/console-tests.md:block 31 (code) +# CODE +# CODE: php tab=PHPUnit +#: ./docs/10.x/console-tests.md:98 +#: ./docs/11.x/console-tests.md:201 +#: ./docs/master/console-tests.md:131 msgid "artisan('inspire')->assertExitCode(0);\n" -"}\n" -msgstr "/**\n" -" * Test a console command.\n" -" *\n" -" * @return void\n" " */\n" -"public function test_console_command()\n" +"public function test_console_command(): void\n" "{\n" -" $this->artisan('inspire')->assertExitCode(0);\n" -"}\n" +" $this->artisan('example')\n" +" ->expectsSearch('What is your name?', search: 'Tay', answers: [\n" +" 'Taylor Otwell',\n" +" 'Taylor Swift',\n" +" 'Darian Taylor'\n" +" ], answer: 'Taylor Otwell')\n" +" ->assertExitCode(0);\n" +"}" +msgstr "" -#: docs/8.x/console-tests.md:block 18 (paragraph) -msgid "You may test this command with the following test which utilizes the `expectsQuestion`, `expectsOutput`, `doesntExpectOutput`, and `assertExitCode` methods:" -msgstr "可以通過下列這個使用了 `expectsQuestion`, `expectsOutput`, `doesntExpectOutput` 與 `assertExitCode` 方法的測試來測試該指令:" +# P +#: ./docs/11.x/console-tests.md:119 +msgid "You may also assert that a console command does not generate any output using the `doesntExpectOutput` method:" +msgstr "" -#: docs/8.x/console-tests.md:block 19 (code) -msgid "/**\n" -" * Test a console command.\n" -" *\n" -" * @return void\n" -" */\n" -"public function test_console_command()\n" -"{\n" -" $this->artisan('question')\n" -" ->expectsQuestion('What is your name?', 'Taylor Otwell')\n" -" ->expectsQuestion('Which language do you prefer?', 'PHP')\n" -" ->expectsOutput('Your name is Taylor Otwell and you prefer PHP.')\n" -" ->doesntExpectOutput('Your name is Taylor Otwell and you prefer Ruby.')\n" +# CODE: php tab=Pest +#: ./docs/11.x/console-tests.md:121 +msgid "test('console command', function () {\n" +" $this->artisan('example')\n" +" ->doesntExpectOutput()\n" " ->assertExitCode(0);\n" -"}\n" -msgstr "/**\n" -" * Test a console command.\n" -" *\n" -" * @return void\n" -" */\n" -"public function test_console_command()\n" -"{\n" -" $this->artisan('question')\n" -" ->expectsQuestion('What is your name?', 'Taylor Otwell')\n" -" ->expectsQuestion('Which language do you prefer?', 'PHP')\n" -" ->expectsOutput('Your name is Taylor Otwell and you prefer PHP.')\n" -" ->doesntExpectOutput('Your name is Taylor Otwell and you prefer Ruby.')\n" -" ->assertExitCode(0);\n" -"}\n" +"});" +msgstr "" -#: docs/9.x/console-tests.md:block 19 (code) +# CODE: php tab=PHPUnit +#: ./docs/11.x/console-tests.md:129 msgid "/**\n" " * Test a console command.\n" -" *\n" -" * @return void\n" " */\n" -"public function test_console_command()\n" +"public function test_console_command(): void\n" "{\n" -" $this->artisan('question')\n" -" ->expectsQuestion('What is your name?', 'Taylor Otwell')\n" -" ->expectsQuestion('Which language do you prefer?', 'PHP')\n" -" ->expectsOutput('Your name is Taylor Otwell and you prefer PHP.')\n" -" ->doesntExpectOutput('Your name is Taylor Otwell and you prefer Ruby.')\n" -" ->expectsOutputToContain('Taylor Otwell')\n" -" ->doesntExpectOutputToContain('you prefer Ruby')\n" +" $this->artisan('example')\n" +" ->doesntExpectOutput()\n" +" ->assertExitCode(0);\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/console-tests.md:141 +msgid "The `expectsOutputToContain` and `doesntExpectOutputToContain` methods may be used to make assertions against a portion of the output:" +msgstr "" + +# CODE: php tab=Pest +#: ./docs/11.x/console-tests.md:143 +msgid "test('console command', function () {\n" +" $this->artisan('example')\n" +" ->expectsOutputToContain('Taylor')\n" " ->assertExitCode(0);\n" -"}\n" -msgstr "/**\n" +"});" +msgstr "" + +# CODE: php tab=PHPUnit +#: ./docs/11.x/console-tests.md:151 +msgid "/**\n" " * Test a console command.\n" -" *\n" -" * @return void\n" " */\n" -"public function test_console_command()\n" +"public function test_console_command(): void\n" "{\n" -" $this->artisan('question')\n" -" ->expectsQuestion('What is your name?', 'Taylor Otwell')\n" -" ->expectsQuestion('Which language do you prefer?', 'PHP')\n" -" ->expectsOutput('Your name is Taylor Otwell and you prefer PHP.')\n" -" ->doesntExpectOutput('Your name is Taylor Otwell and you prefer Ruby.')\n" -" ->expectsOutputToContain('Taylor Otwell')\n" -" ->doesntExpectOutputToContain('you prefer Ruby')\n" -" ->assertExitCode(0);\n" -"}\n" +" $this->artisan('example')\n" +" ->expectsOutputToContain('Taylor')\n" +" ->assertExitCode(0);\n" +"}" +msgstr "" + +# CODE: php tab=Pest +#: ./docs/11.x/console-tests.md:191 +#: ./docs/master/console-tests.md:121 +msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/container.md:22 +#: ./docs/9.x/container.md:22 +#: ./docs/10.x/container.md:22 +#: ./docs/11.x/container.md:24 +#: ./docs/master/container.md:22 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/container.md:block 5 (paragraph) +# P +#: ./docs/8.x/container.md:24 +#: ./docs/9.x/container.md:24 +#: ./docs/10.x/container.md:24 +#: ./docs/11.x/container.md:26 +#: ./docs/master/container.md:24 msgid "The Laravel service container is a powerful tool for managing class dependencies and performing dependency injection. Dependency injection is a fancy phrase that essentially means this: class dependencies are \"injected\" into the class via the constructor or, in some cases, \"setter\" methods." -msgstr "Laravel 的 Service Container 是用來管理類別依賴與進行依賴注入的一個有力工具。依賴注入只是個花俏的詞,基本上依賴注入就代表:類別的依賴是通過其建構函式來「注入」進類別的,或者,某些情況下是使用「Setter」方法。" +msgstr "" -#: docs/10.x/container.md:block 6 (paragraph) +# P +#: ./docs/8.x/container.md:26 +#: ./docs/9.x/container.md:26 +#: ./docs/10.x/container.md:26 +#: ./docs/11.x/container.md:28 +#: ./docs/master/container.md:26 msgid "Let's look at a simple example:" -msgstr "來看看一個簡單的例子:" +msgstr "" -#: docs/10.x/container.md:block 7 (code) +# CODE +#: ./docs/10.x/container.md:28 +#: ./docs/master/container.md:28 msgid "users->find($id);\n\n" " return view('user.profile', ['user' => $user]);\n" " }\n" -"}\n" -msgstr "users = $users;\n" +" }\n\n" " /**\n" " * Show the profile for the given user.\n" +" *\n" +" * @param int $id\n" +" * @return Response\n" " */\n" -" public function show(string $id): View\n" +" public function show($id)\n" " {\n" " $user = $this->users->find($id);\n\n" " return view('user.profile', ['user' => $user]);\n" " }\n" -"}\n" - -#: docs/10.x/container.md:block 8 (paragraph) -msgid "In this example, the `UserController` needs to retrieve users from a data source. So, we will **inject** a service that is able to retrieve users. In this context, our `UserRepository` most likely uses [Eloquent](/docs/{{version}}/eloquent) to retrieve user information from the database. However, since the repository is injected, we are able to easily swap it out with another implementation. We are also able to easily \"mock\", or create a dummy implementation of the `UserRepository` when testing our application." -msgstr "在這個例子中,`UserController` 需要從某個資料來源取得使用者。因此,我們會將一個能取得使用者的服務(Service)**注入** 進去。在這個脈絡下,`UserRepository` 通常會使用 [Eloquent](/docs/{{version}}/eloquent) 來從資料庫內取得使用者資訊。不過,由於該 Repository 是注入進去的,因此我們可以很輕鬆地將其替換成其他實作。我們也可以很輕鬆地在測試專案時「模擬 (Mock)」或是建立一個 `UserRepository` 的假實作。" - -#: docs/10.x/container.md:block 9 (paragraph) -msgid "A deep understanding of the Laravel service container is essential to building a powerful, large application, as well as for contributing to the Laravel core itself." -msgstr "要想建立強大的大型專案、或是參與貢獻 Laravel 核心,就必須要深入瞭解 Laravel 的 Service Container。" +"}" +msgstr "" -#: docs/10.x/container.md:block 11 (header) -msgid "Zero Configuration Resolution" -msgstr "不需設定的解析" +# CODE +#: ./docs/11.x/container.md:30 +msgid " $this->apple->findPodcast($id)\n" +" ]);\n" +" }\n" +"}" +msgstr "" -#: docs/10.x/container.md:block 12 (paragraph) -msgid "If a class has no dependencies or only depends on other concrete classes (not interfaces), the container does not need to be instructed on how to resolve that class. For example, you may place the following code in your `routes/web.php` file:" -msgstr "若某個類別沒有依賴,或是只依賴其他實體類別 (即非介面的依賴),就不需要告訴 Container 如何解析這個類別。舉例來說,可以在 `routes/web.php` 檔中加上下列程式碼:" +# P +#: ./docs/11.x/container.md:57 +msgid "In this example, the `PodcastController` needs to retrieve podcasts from a data source such as Apple Music. So, we will **inject** a service that is able to retrieve podcasts. Since the service is injected, we are able to easily \"mock\", or create a dummy implementation of the `AppleMusic` service when testing our application." +msgstr "" -#: docs/10.x/container.md:block 13 (code) +# CODE +#: ./docs/10.x/container.md:66 +#: ./docs/11.x/container.md:66 +#: ./docs/master/container.md:66 msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/container.md:75 +#: ./docs/9.x/container.md:75 +#: ./docs/10.x/container.md:62 +#: ./docs/11.x/container.md:62 +#: ./docs/master/container.md:62 +msgid "Zero Configuration Resolution" +msgstr "" + +# P +#: ./docs/8.x/container.md:77 +#: ./docs/9.x/container.md:77 +#: ./docs/10.x/container.md:64 +#: ./docs/11.x/container.md:64 +#: ./docs/master/container.md:64 +msgid "If a class has no dependencies or only depends on other concrete classes (not interfaces), the container does not need to be instructed on how to resolve that class. For example, you may place the following code in your `routes/web.php` file:" +msgstr "" + +# CODE +#: ./docs/8.x/container.md:79 +#: ./docs/9.x/container.md:79 +msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/container.md:95 +#: ./docs/9.x/container.md:95 msgid "When To Use The Container" -msgstr "什麼時候要使用 Container" +msgstr "" -#: docs/10.x/container.md:block 18 (paragraph) +# P +#: ./docs/8.x/container.md:97 +#: ./docs/9.x/container.md:97 +#: ./docs/10.x/container.md:84 +#: ./docs/11.x/container.md:84 +#: ./docs/master/container.md:84 msgid "Thanks to zero configuration resolution, you will often type-hint dependencies on routes, controllers, event listeners, and elsewhere without ever manually interacting with the container. For example, you might type-hint the `Illuminate\\Http\\Request` object on your route definition so that you can easily access the current request. Even though we never have to interact with the container to write this code, it is managing the injection of these dependencies behind the scenes:" -msgstr "多虧有不需設定的解析,通常只需要在路由、Controller、事件監聽程式等地方型別提示即可,不需手動與 Container 互動。舉例來說,可以在路由定義上型別提示 `Illuminate\\Http\\Request` 物件,就可輕鬆存取目前的請求。就算我們從來沒寫過與 Container 互動的程式碼,Container 依然能自動幫我們將這些依賴注入進去:" +msgstr "" -#: docs/10.x/container.md:block 19 (code) +# CODE +#: ./docs/8.x/container.md:99 +#: ./docs/9.x/container.md:99 +#: ./docs/10.x/container.md:86 +#: ./docs/11.x/container.md:86 +#: ./docs/master/container.md:86 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/', function (Request $request) {\n" " // ...\n" -"});\n" -msgstr "use Illuminate\\Http\\Request;\n\n" -"Route::get('/', function (Request $request) {\n" -" // ...\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/container.md:block 20 (paragraph) +# P +#: ./docs/8.x/container.md:105 +#: ./docs/9.x/container.md:105 +#: ./docs/10.x/container.md:92 +#: ./docs/11.x/container.md:92 +#: ./docs/master/container.md:92 msgid "In many cases, thanks to automatic dependency injection and [facades](/docs/{{version}}/facades), you can build Laravel applications without **ever** manually binding or resolving anything from the container. **So, when would you ever manually interact with the container?** Let's examine two situations." -msgstr "在許多情況下,多虧有自動依賴注入以及 [Facades](/docs/{{version}}/facades),我們 **完全** 不需要從 Container 上手動繫結或解析任何東西,就可以使用 Laravel 來進行專案開發。**那麼,什麼時候才會需要手動操作 Container 呢?** 讓我們來看看兩個情況。" +msgstr "" -#: docs/10.x/container.md:block 21 (paragraph) +# P +#: ./docs/8.x/container.md:107 +#: ./docs/9.x/container.md:107 +#: ./docs/10.x/container.md:94 +#: ./docs/11.x/container.md:94 +#: ./docs/master/container.md:94 msgid "First, if you write a class that implements an interface and you wish to type-hint that interface on a route or class constructor, you must [tell the container how to resolve that interface](#binding-interfaces-to-implementations). Secondly, if you are [writing a Laravel package](/docs/{{version}}/packages) that you plan to share with other Laravel developers, you may need to bind your package's services into the container." -msgstr "首先,若寫了一個實作介面的類別,而希望能在路由或類別建構函式上型別提示這個介面,就必須要[告訴 Container 要如何解析該介面](#binding-interfaces-to-implementations)。再來,若是在[撰寫 Laravel 套件](/docs/{{version}}/packages),並希望將該套件分享給其他 Laravel 開發者,則可能會需要將套件的服務繫結到 Container 上。" +msgstr "" + +# CODE +#: ./docs/10.x/container.md:109 +#: ./docs/11.x/container.md:109 +#: ./docs/master/container.md:109 +msgid "use App\\Services\\Transistor;\n" +"use App\\Services\\PodcastParser;\n" +"use Illuminate\\Contracts\\Foundation\\Application;\n\n" +"$this->app->bind(Transistor::class, function (Application $app) {\n" +" return new Transistor($app->make(PodcastParser::class));\n" +"});" +msgstr "" -#: docs/10.x/container.md:block 23 (header) +# P +#: ./docs/8.x/container.md:109 +#: ./docs/9.x/container.md:109 +#: ./docs/10.x/container.md:96 +#: ./docs/11.x/container.md:96 +#: ./docs/master/container.md:96 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/container.md:110 +#: ./docs/9.x/container.md:110 +#: ./docs/10.x/container.md:97 +#: ./docs/11.x/container.md:97 +#: ./docs/master/container.md:97 msgid "Binding" -msgstr "繫結 (Binding)" +msgstr "" -#: docs/10.x/container.md:block 25 (header) +# P +#: ./docs/8.x/container.md:112 +#: ./docs/9.x/container.md:112 +#: ./docs/10.x/container.md:99 +#: ./docs/11.x/container.md:99 +#: ./docs/master/container.md:99 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/container.md:113 +#: ./docs/9.x/container.md:113 +#: ./docs/10.x/container.md:100 +#: ./docs/11.x/container.md:100 +#: ./docs/master/container.md:100 msgid "Binding Basics" -msgstr "「繫結」基礎" +msgstr "" -#: docs/10.x/container.md:block 27 (header) +# P +#: ./docs/8.x/container.md:115 +#: ./docs/9.x/container.md:115 +#: ./docs/10.x/container.md:102 +#: ./docs/11.x/container.md:102 +#: ./docs/master/container.md:102 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/container.md:116 +#: ./docs/9.x/container.md:116 +#: ./docs/10.x/container.md:103 +#: ./docs/11.x/container.md:103 +#: ./docs/master/container.md:103 msgid "Simple Bindings" -msgstr "簡單繫結" +msgstr "" -#: docs/10.x/container.md:block 28 (paragraph) +# P +#: ./docs/8.x/container.md:118 +#: ./docs/9.x/container.md:118 +#: ./docs/10.x/container.md:105 +#: ./docs/11.x/container.md:105 +#: ./docs/master/container.md:105 msgid "Almost all of your service container bindings will be registered within [service providers](/docs/{{version}}/providers), so most of these examples will demonstrate using the container in that context." -msgstr "幾乎所有的服務 Container 繫結都會註冊在 [Service Provider](/docs/{{version}}/providers) 上。因此,這裡大多數的範例都會在這個脈絡下展示使用 Container。" +msgstr "" -#: docs/10.x/container.md:block 29 (paragraph) +# P +#: ./docs/8.x/container.md:120 +#: ./docs/9.x/container.md:120 +#: ./docs/10.x/container.md:107 +#: ./docs/11.x/container.md:107 +#: ./docs/master/container.md:107 msgid "Within a service provider, you always have access to the container via the `$this->app` property. We can register a binding using the `bind` method, passing the class or interface name that we wish to register along with a closure that returns an instance of the class:" -msgstr "在 Service Provider 中,總是能使用 `$this->app` 屬性來存取 Container。我們可以使用 `bind` 方法來註冊一個繫結,並將我們想註冊的類別或介面與用來回傳該類別實體的閉包一起傳入。" - -#: docs/10.x/container.md:block 30 (code) -msgid "use App\\Services\\Transistor;\n" -"use App\\Services\\PodcastParser;\n" -"use Illuminate\\Contracts\\Foundation\\Application;\n\n" -"$this->app->bind(Transistor::class, function (Application $app) {\n" -" return new Transistor($app->make(PodcastParser::class));\n" -"});\n" -msgstr "use App\\Services\\Transistor;\n" -"use App\\Services\\PodcastParser;\n" -"use Illuminate\\Contracts\\Foundation\\Application;\n\n" -"$this->app->bind(Transistor::class, function (Application $app) {\n" -" return new Transistor($app->make(PodcastParser::class));\n" -"});\n" - -#: docs/10.x/container.md:block 31 (paragraph) -msgid "Note that we receive the container itself as an argument to the resolver. We can then use the container to resolve sub-dependencies of the object we are building." -msgstr "請注意,我們會收到 Container 自己作為該解析程式的一個引數。我們可以接著使用該 Container 來解析我們正在建構的物件的其他子依賴。" - -#: docs/10.x/container.md:block 32 (paragraph) -msgid "As mentioned, you will typically be interacting with the container within service providers; however, if you would like to interact with the container outside of a service provider, you may do so via the `App` [facade](/docs/{{version}}/facades):" -msgstr "就像之前提過的,我們通常會在 Service Provider 內操作 Container。不過,若想在 Service Provider 外操作 Container,則可以使用 `App` [Facade](/docs/{{version}}/facades):" +msgstr "" -#: docs/10.x/container.md:block 33 (code) +# CODE +#: ./docs/10.x/container.md:121 +#: ./docs/11.x/container.md:121 +#: ./docs/master/container.md:121 msgid "use App\\Services\\Transistor;\n" "use Illuminate\\Contracts\\Foundation\\Application;\n" "use Illuminate\\Support\\Facades\\App;\n\n" "App::bind(Transistor::class, function (Application $app) {\n" " // ...\n" -"});\n" -msgstr "use App\\Services\\Transistor;\n" -"use Illuminate\\Contracts\\Foundation\\Application;\n" -"use Illuminate\\Support\\Facades\\App;\n\n" -"App::bind(Transistor::class, function (Application $app) {\n" -" // ...\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/container.md:block 34 (paragraph) +# CODE +#: ./docs/8.x/container.md:122 +#: ./docs/9.x/container.md:122 +msgid "use App\\Services\\Transistor;\n" +"use App\\Services\\PodcastParser;\n\n" +"$this->app->bind(Transistor::class, function ($app) {\n" +" return new Transistor($app->make(PodcastParser::class));\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/container.md:129 +#: ./docs/11.x/container.md:129 +#: ./docs/master/container.md:129 msgid "You may use the `bindIf` method to register a container binding only if a binding has not already been registered for the given type:" -msgstr "可以使用 `bindIf` 方法來只在某個繫結還未被註冊到給定型別時向 Container 註冊繫結:" +msgstr "" + +# P +#: ./docs/8.x/container.md:129 +#: ./docs/9.x/container.md:129 +#: ./docs/10.x/container.md:117 +#: ./docs/11.x/container.md:117 +#: ./docs/master/container.md:117 +msgid "Note that we receive the container itself as an argument to the resolver. We can then use the container to resolve sub-dependencies of the object we are building." +msgstr "" -#: docs/10.x/container.md:block 35 (code) +# CODE: php +#: ./docs/10.x/container.md:131 +#: ./docs/11.x/container.md:131 +#: ./docs/master/container.md:131 msgid "$this->app->bindIf(Transistor::class, function (Application $app) {\n" " return new Transistor($app->make(PodcastParser::class));\n" -"});\n" -msgstr "$this->app->bindIf(Transistor::class, function (Application $app) {\n" -" return new Transistor($app->make(PodcastParser::class));\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/container.md:block 36 (quote) -msgid "**Note** There is no need to bind classes into the container if they do not depend on any interfaces. The container does not need to be instructed on how to build these objects, since it can automatically resolve these objects using reflection." -msgstr "**Note** 若類別沒有依賴任何介面,就不需要將其繫結到 Container 上。不需要告訴 Container 如何建構這些物件,因為這些物件可以通過 Reflection 自動被解析。" +# P +#: ./docs/8.x/container.md:131 +#: ./docs/9.x/container.md:131 +#: ./docs/10.x/container.md:119 +#: ./docs/11.x/container.md:119 +#: ./docs/master/container.md:119 +msgid "As mentioned, you will typically be interacting with the container within service providers; however, if you would like to interact with the container outside of a service provider, you may do so via the `App` [facade](/docs/{{version}}/facades):" +msgstr "" -#: docs/10.x/container.md:block 38 (header) -msgid "Binding A Singleton" -msgstr "建構單例 (Singleton)" +# CODE +#: ./docs/8.x/container.md:133 +#: ./docs/9.x/container.md:133 +msgid "use App\\Services\\Transistor;\n" +"use Illuminate\\Support\\Facades\\App;\n\n" +"App::bind(Transistor::class, function ($app) {\n" +" // ...\n" +"});" +msgstr "" -#: docs/10.x/container.md:block 39 (paragraph) -msgid "The `singleton` method binds a class or interface into the container that should only be resolved one time. Once a singleton binding is resolved, the same object instance will be returned on subsequent calls into the container:" -msgstr "`singleton` 方法可將一些只需要解析一次的類別或介面繫結至 Container 內,解析完單例繫結後,接下來呼叫 Container 都會回傳相同的物件實體:" +# P +#: ./docs/8.x/container.md:140 +#: ./docs/9.x/container.md:141 +#: ./docs/10.x/container.md:138 +#: ./docs/11.x/container.md:138 +#: ./docs/master/container.md:138 +msgid "There is no need to bind classes into the container if they do not depend on any interfaces. The container does not need to be instructed on how to build these objects, since it can automatically resolve these objects using reflection." +msgstr "" + +# P +#: ./docs/8.x/container.md:142 +#: ./docs/9.x/container.md:143 +#: ./docs/10.x/container.md:140 +#: ./docs/11.x/container.md:140 +#: ./docs/master/container.md:140 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/container.md:143 +#: ./docs/9.x/container.md:144 +#: ./docs/10.x/container.md:141 +#: ./docs/11.x/container.md:141 +#: ./docs/master/container.md:141 +msgid "Binding A Singleton" +msgstr "" -#: docs/10.x/container.md:block 40 (code) +# CODE +#: ./docs/10.x/container.md:145 +#: ./docs/11.x/container.md:145 +#: ./docs/master/container.md:145 msgid "use App\\Services\\Transistor;\n" "use App\\Services\\PodcastParser;\n" "use Illuminate\\Contracts\\Foundation\\Application;\n\n" "$this->app->singleton(Transistor::class, function (Application $app) {\n" " return new Transistor($app->make(PodcastParser::class));\n" -"});\n" -msgstr "use App\\Services\\Transistor;\n" -"use App\\Services\\PodcastParser;\n" -"use Illuminate\\Contracts\\Foundation\\Application;\n\n" -"$this->app->singleton(Transistor::class, function (Application $app) {\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/container.md:145 +#: ./docs/9.x/container.md:146 +#: ./docs/10.x/container.md:143 +#: ./docs/11.x/container.md:143 +#: ./docs/master/container.md:143 +msgid "The `singleton` method binds a class or interface into the container that should only be resolved one time. Once a singleton binding is resolved, the same object instance will be returned on subsequent calls into the container:" +msgstr "" + +# CODE +#: ./docs/8.x/container.md:147 +#: ./docs/9.x/container.md:148 +msgid "use App\\Services\\Transistor;\n" +"use App\\Services\\PodcastParser;\n\n" +"$this->app->singleton(Transistor::class, function ($app) {\n" " return new Transistor($app->make(PodcastParser::class));\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/container.md:block 41 (paragraph) +# P +#: ./docs/10.x/container.md:153 +#: ./docs/11.x/container.md:153 +#: ./docs/master/container.md:153 msgid "You may use the `singletonIf` method to register a singleton container binding only if a binding has not already been registered for the given type:" -msgstr "可以使用 `singletonIf` 方法來只在某個繫結還未被註冊到給定型別時向 Container 註冊單例:" +msgstr "" -#: docs/10.x/container.md:block 42 (code) +# P +#: ./docs/8.x/container.md:154 +#: ./docs/9.x/container.md:155 +#: ./docs/10.x/container.md:161 +#: ./docs/11.x/container.md:161 +#: ./docs/master/container.md:161 +#~ msgid "" +#~ msgstr "" + +# CODE: php +#: ./docs/10.x/container.md:155 +#: ./docs/11.x/container.md:155 +#: ./docs/master/container.md:155 msgid "$this->app->singletonIf(Transistor::class, function (Application $app) {\n" " return new Transistor($app->make(PodcastParser::class));\n" -"});\n" -msgstr "$this->app->singletonIf(Transistor::class, function (Application $app) {\n" -" return new Transistor($app->make(PodcastParser::class));\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/container.md:block 44 (header) +# H4 +#: ./docs/8.x/container.md:155 +#: ./docs/9.x/container.md:156 +#: ./docs/10.x/container.md:162 +#: ./docs/11.x/container.md:162 +#: ./docs/master/container.md:162 msgid "Binding Scoped Singletons" -msgstr "繫結限定作用範圍的單例" +msgstr "" -#: docs/10.x/container.md:block 45 (paragraph) +# P +#: ./docs/8.x/container.md:157 +#: ./docs/9.x/container.md:158 +#: ./docs/10.x/container.md:164 +#: ./docs/11.x/container.md:164 +#: ./docs/master/container.md:164 msgid "The `scoped` method binds a class or interface into the container that should only be resolved one time within a given Laravel request / job lifecycle. While this method is similar to the `singleton` method, instances registered using the `scoped` method will be flushed whenever the Laravel application starts a new \"lifecycle\", such as when a [Laravel Octane](/docs/{{version}}/octane) worker processes a new request or when a Laravel [queue worker](/docs/{{version}}/queues) processes a new job:" -msgstr "`scoped` 方法用來將一些只在給定 Laravel 請求 / 任務生命週期中被解析一次的類別或介面繫結到 Container 中。雖然這個方法與 `singleton` 方法類似,不過使用 `scoped` 方法繫結的實體會在每次 Laravel 開始新「生命週期」時被清除,如:[Laravel Octane](/docs/{{version}}/octane) 背景工作角色處理新請求時,或是 Laravel [佇列背景工作角色](/docs/{{version}}/queues) 處理新任務時。" +msgstr "" -#: docs/10.x/container.md:block 46 (code) +# CODE +#: ./docs/8.x/container.md:159 +#: ./docs/9.x/container.md:160 msgid "use App\\Services\\Transistor;\n" -"use App\\Services\\PodcastParser;\n" -"use Illuminate\\Contracts\\Foundation\\Application;\n\n" -"$this->app->scoped(Transistor::class, function (Application $app) {\n" +"use App\\Services\\PodcastParser;\n\n" +"$this->app->scoped(Transistor::class, function ($app) {\n" " return new Transistor($app->make(PodcastParser::class));\n" -"});\n" -msgstr "use App\\Services\\Transistor;\n" +"});" +msgstr "" + +# CODE +#: ./docs/10.x/container.md:166 +#: ./docs/11.x/container.md:166 +#: ./docs/master/container.md:166 +msgid "use App\\Services\\Transistor;\n" "use App\\Services\\PodcastParser;\n" "use Illuminate\\Contracts\\Foundation\\Application;\n\n" "$this->app->scoped(Transistor::class, function (Application $app) {\n" " return new Transistor($app->make(PodcastParser::class));\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/container.md:block 48 (header) +# P +#: ./docs/8.x/container.md:166 +#: ./docs/9.x/container.md:167 +#: ./docs/10.x/container.md:174 +#: ./docs/11.x/container.md:180 +#: ./docs/master/container.md:174 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/container.md:167 +#: ./docs/9.x/container.md:168 +#: ./docs/10.x/container.md:175 +#: ./docs/11.x/container.md:181 +#: ./docs/master/container.md:175 msgid "Binding Instances" -msgstr "繫結實體" +msgstr "" -#: docs/10.x/container.md:block 49 (paragraph) +# P +#: ./docs/8.x/container.md:169 +#: ./docs/9.x/container.md:170 +#: ./docs/10.x/container.md:177 +#: ./docs/11.x/container.md:183 +#: ./docs/master/container.md:177 msgid "You may also bind an existing object instance into the container using the `instance` method. The given instance will always be returned on subsequent calls into the container:" -msgstr "也可以使用 `instance` 方法來將現有的物件實體繫結到 Container 上。接下來對 Container 的呼叫都會回傳給定的實體:" +msgstr "" -#: docs/10.x/container.md:block 50 (code) +# CODE +#: ./docs/8.x/container.md:171 +#: ./docs/9.x/container.md:172 +#: ./docs/10.x/container.md:179 +#: ./docs/11.x/container.md:185 +#: ./docs/master/container.md:179 msgid "use App\\Services\\Transistor;\n" "use App\\Services\\PodcastParser;\n\n" "$service = new Transistor(new PodcastParser);\n\n" -"$this->app->instance(Transistor::class, $service);\n" -msgstr "use App\\Services\\Transistor;\n" -"use App\\Services\\PodcastParser;\n\n" -"$service = new Transistor(new PodcastParser);\n\n" -"$this->app->instance(Transistor::class, $service);\n" +"$this->app->instance(Transistor::class, $service);" +msgstr "" -#: docs/10.x/container.md:block 52 (header) +# P +#: ./docs/11.x/container.md:174 +msgid "You may use the `scopedIf` method to register a scoped container binding only if a binding has not already been registered for the given type:" +msgstr "" + +# CODE +#: ./docs/11.x/container.md:176 +msgid "$this->app->scopedIf(Transistor::class, function (Application $app) {\n" +" return new Transistor($app->make(PodcastParser::class));\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/container.md:178 +#: ./docs/9.x/container.md:179 +#: ./docs/10.x/container.md:186 +#: ./docs/11.x/container.md:192 +#: ./docs/master/container.md:186 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/container.md:179 +#: ./docs/9.x/container.md:180 msgid "Binding Interfaces To Implementations" -msgstr "將介面繫結至實作" +msgstr "" -#: docs/10.x/container.md:block 53 (paragraph) +# P +#: ./docs/8.x/container.md:181 +#: ./docs/9.x/container.md:182 +#: ./docs/10.x/container.md:189 +#: ./docs/11.x/container.md:195 +#: ./docs/master/container.md:189 msgid "A very powerful feature of the service container is its ability to bind an interface to a given implementation. For example, let's assume we have an `EventPusher` interface and a `RedisEventPusher` implementation. Once we have coded our `RedisEventPusher` implementation of this interface, we can register it with the service container like so:" -msgstr "Service Container 其中一個非常強大的功能就是能將介面繫結到給定的實作上。舉例來說,假設我們有一個 `EventPusher` 介面,以及一個 `RedisEventPusher` 實作。寫好這個介面的 `RedisEventPusher` 實作程式後,我們就像這樣將其註冊到 Service Container 上:" +msgstr "" -#: docs/10.x/container.md:block 54 (code) +# CODE +#: ./docs/8.x/container.md:183 +#: ./docs/9.x/container.md:184 +#: ./docs/10.x/container.md:191 +#: ./docs/11.x/container.md:197 +#: ./docs/master/container.md:191 msgid "use App\\Contracts\\EventPusher;\n" "use App\\Services\\RedisEventPusher;\n\n" -"$this->app->bind(EventPusher::class, RedisEventPusher::class);\n" -msgstr "use App\\Contracts\\EventPusher;\n" -"use App\\Services\\RedisEventPusher;\n\n" -"$this->app->bind(EventPusher::class, RedisEventPusher::class);\n" +"$this->app->bind(EventPusher::class, RedisEventPusher::class);" +msgstr "" + +# H3 +#: ./docs/10.x/container.md:187 +#: ./docs/11.x/container.md:193 +#: ./docs/master/container.md:187 +msgid "Binding Interfaces to Implementations" +msgstr "" -#: docs/10.x/container.md:block 55 (paragraph) +# P +#: ./docs/8.x/container.md:188 +#: ./docs/9.x/container.md:189 +#: ./docs/10.x/container.md:196 +#: ./docs/11.x/container.md:202 +#: ./docs/master/container.md:196 msgid "This statement tells the container that it should inject the `RedisEventPusher` when a class needs an implementation of `EventPusher`. Now we can type-hint the `EventPusher` interface in the constructor of a class that is resolved by the container. Remember, controllers, event listeners, middleware, and various other types of classes within Laravel applications are always resolved using the container:" -msgstr "這個陳述式會告訴 Container 應在有類別需要 `EventPusher` 的實作時將 `RedisEventPusher` 注入進去。接著,我們可以在某個會被 Container 解析的類別之建構函式上型別提示 `EventPusher` 介面。請記得,Laravel 專案中的 Controller、事件監聽程式、Middleware、以及其他多種類型的類別都是使用 Container 來解析的:" +msgstr "" + +# CODE +#: ./docs/8.x/container.md:190 +#: ./docs/9.x/container.md:191 +msgid "use App\\Contracts\\EventPusher;\n\n" +"/**\n" +" * Create a new class instance.\n" +" *\n" +" * @param \\App\\Contracts\\EventPusher $pusher\n" +" * @return void\n" +" */\n" +"public function __construct(EventPusher $pusher)\n" +"{\n" +" $this->pusher = $pusher;\n" +"}" +msgstr "" -#: docs/10.x/container.md:block 56 (code) +# CODE +#: ./docs/10.x/container.md:198 +#: ./docs/master/container.md:198 msgid "use App\\Contracts\\EventPusher;\n\n" "/**\n" " * Create a new class instance.\n" " */\n" "public function __construct(\n" " protected EventPusher $pusher\n" -") {}\n" -msgstr "use App\\Contracts\\EventPusher;\n\n" +") {}" +msgstr "" + +# P +#: ./docs/8.x/container.md:203 +#: ./docs/9.x/container.md:204 +#: ./docs/10.x/container.md:207 +#: ./docs/11.x/container.md:213 +#: ./docs/master/container.md:207 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/11.x/container.md:204 +msgid "use App\\Contracts\\EventPusher;\n\n" "/**\n" " * Create a new class instance.\n" " */\n" "public function __construct(\n" -" protected EventPusher $pusher\n" -") {}\n" +" protected EventPusher $pusher,\n" +") {}" +msgstr "" -#: docs/10.x/container.md:block 58 (header) +# H3 +#: ./docs/8.x/container.md:204 +#: ./docs/9.x/container.md:205 +#: ./docs/10.x/container.md:208 +#: ./docs/11.x/container.md:214 +#: ./docs/master/container.md:208 msgid "Contextual Binding" -msgstr "基於上下文的繫結" +msgstr "" -#: docs/10.x/container.md:block 59 (paragraph) +# P +#: ./docs/8.x/container.md:206 +#: ./docs/9.x/container.md:207 +#: ./docs/10.x/container.md:210 +#: ./docs/11.x/container.md:216 +#: ./docs/master/container.md:210 msgid "Sometimes you may have two classes that utilize the same interface, but you wish to inject different implementations into each class. For example, two controllers may depend on different implementations of the `Illuminate\\Contracts\\Filesystem\\Filesystem` [contract](/docs/{{version}}/contracts). Laravel provides a simple, fluent interface for defining this behavior:" -msgstr "有時候,可能會有兩個類別使用相同的介面,但又想在各個類別上注入不同的實作。舉例來說,可能有兩個 Controller 依賴不同實作的 `Illuminate\\Contracts\\Filesystem\\Filesystem` [Contract](/docs/{{version}}/contracts)。Laravel 提供了一個簡單但流暢的介面來定義這種行為:" +msgstr "" -#: docs/10.x/container.md:block 60 (code) +# CODE +#: ./docs/8.x/container.md:208 +#: ./docs/9.x/container.md:209 +#: ./docs/10.x/container.md:212 +#: ./docs/11.x/container.md:218 +#: ./docs/master/container.md:212 msgid "use App\\Http\\Controllers\\PhotoController;\n" "use App\\Http\\Controllers\\UploadController;\n" "use App\\Http\\Controllers\\VideoController;\n" @@ -417,80 +942,173 @@ msgid "use App\\Http\\Controllers\\PhotoController;\n" " ->needs(Filesystem::class)\n" " ->give(function () {\n" " return Storage::disk('s3');\n" -" });\n" -msgstr "use App\\Http\\Controllers\\PhotoController;\n" -"use App\\Http\\Controllers\\UploadController;\n" -"use App\\Http\\Controllers\\VideoController;\n" -"use Illuminate\\Contracts\\Filesystem\\Filesystem;\n" -"use Illuminate\\Support\\Facades\\Storage;\n\n" -"$this->app->when(PhotoController::class)\n" -" ->needs(Filesystem::class)\n" -" ->give(function () {\n" -" return Storage::disk('local');\n" -" });\n\n" -"$this->app->when([VideoController::class, UploadController::class])\n" -" ->needs(Filesystem::class)\n" -" ->give(function () {\n" -" return Storage::disk('s3');\n" -" });\n" +" });" +msgstr "" -#: docs/10.x/container.md:block 62 (header) +# P +#: ./docs/8.x/container.md:226 +#: ./docs/9.x/container.md:227 +#: ./docs/10.x/container.md:230 +#: ./docs/11.x/container.md:344 +#: ./docs/master/container.md:230 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/container.md:227 +#: ./docs/9.x/container.md:228 +#: ./docs/10.x/container.md:231 +#: ./docs/11.x/container.md:345 +#: ./docs/master/container.md:231 msgid "Binding Primitives" -msgstr "繫結原生型別" +msgstr "" -#: docs/10.x/container.md:block 63 (paragraph) +# P +#: ./docs/8.x/container.md:229 +#: ./docs/9.x/container.md:230 +#: ./docs/10.x/container.md:233 +#: ./docs/11.x/container.md:347 +#: ./docs/master/container.md:233 msgid "Sometimes you may have a class that receives some injected classes, but also needs an injected primitive value such as an integer. You may easily use contextual binding to inject any value your class may need:" -msgstr "有時候可能會有類別要接收注入的類別,但同時也需要注入原生型別的值,如整數。可以輕鬆地使用基於上下文的繫結來注入任何類別所需的值:" +msgstr "" -#: docs/10.x/container.md:block 64 (code) -msgid "use App\\Http\\Controllers\\UserController;\n\n" -"$this->app->when(UserController::class)\n" +# CODE +#: ./docs/8.x/container.md:231 +msgid "$this->app->when('App\\Http\\Controllers\\UserController')\n" " ->needs('$variableName')\n" -" ->give($value);\n" -msgstr "use App\\Http\\Controllers\\UserController;\n\n" +" ->give($value);" +msgstr "" + +# CODE +#: ./docs/9.x/container.md:232 +#: ./docs/10.x/container.md:235 +#: ./docs/11.x/container.md:349 +#: ./docs/master/container.md:235 +msgid "use App\\Http\\Controllers\\UserController;\n\n" "$this->app->when(UserController::class)\n" " ->needs('$variableName')\n" -" ->give($value);\n" +" ->give($value);" +msgstr "" -#: docs/10.x/container.md:block 65 (paragraph) +# P +#: ./docs/8.x/container.md:235 +#: ./docs/9.x/container.md:238 +#: ./docs/10.x/container.md:241 +#: ./docs/11.x/container.md:355 +#: ./docs/master/container.md:241 msgid "Sometimes a class may depend on an array of [tagged](#tagging) instances. Using the `giveTagged` method, you may easily inject all of the container bindings with that tag:" -msgstr "有時候,某個類別可能會依賴一個包含[有標記](#tagging)實體的陣列。使用 `giveTagged` 方法,就可以輕鬆將所有有該標籤的 Container 繫結注入進去:" +msgstr "" -#: docs/10.x/container.md:block 66 (code) -msgid "$this->app->when(ReportAggregator::class)\n" -" ->needs('$reports')\n" -" ->giveTagged('reports');\n" -msgstr "$this->app->when(ReportAggregator::class)\n" +# P +#: ./docs/11.x/container.md:236 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/11.x/container.md:237 +msgid "Contextual Attributes" +msgstr "" + +# CODE +#: ./docs/8.x/container.md:237 +#: ./docs/9.x/container.md:240 +#: ./docs/10.x/container.md:243 +#: ./docs/11.x/container.md:357 +#: ./docs/master/container.md:243 +msgid "$this->app->when(ReportAggregator::class)\n" " ->needs('$reports')\n" -" ->giveTagged('reports');\n" +" ->giveTagged('reports');" +msgstr "" + +# P +#: ./docs/11.x/container.md:239 +msgid "Since contextual binding is often used to inject implementations of drivers or configuration values, Laravel offers a variety of contextual binding attributes that allow to inject these types of values without manually defining the contextual bindings in your service providers." +msgstr "" -#: docs/10.x/container.md:block 67 (paragraph) +# P +#: ./docs/11.x/container.md:241 +msgid "For example, the `Storage` attribute may be used to inject a specific [storage disk](/docs/{{version}}/filesystem):" +msgstr "" + +# P +#: ./docs/8.x/container.md:241 +#: ./docs/9.x/container.md:244 +#: ./docs/10.x/container.md:247 +#: ./docs/11.x/container.md:361 +#: ./docs/master/container.md:247 msgid "If you need to inject a value from one of your application's configuration files, you may use the `giveConfig` method:" -msgstr "若有需要注入來自專案設定檔的值,則可使用 `giveConfig` 方法:" +msgstr "" + +# CODE: php +#: ./docs/11.x/container.md:243 +msgid "app->when(ReportAggregator::class)\n" " ->needs('$timezone')\n" -" ->giveConfig('app.timezone');\n" -msgstr "$this->app->when(ReportAggregator::class)\n" -" ->needs('$timezone')\n" -" ->giveConfig('app.timezone');\n" +" ->giveConfig('app.timezone');" +msgstr "" -#: docs/10.x/container.md:block 70 (header) +# P +#: ./docs/8.x/container.md:247 +#: ./docs/9.x/container.md:250 +#: ./docs/10.x/container.md:253 +#: ./docs/11.x/container.md:367 +#: ./docs/master/container.md:253 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/container.md:248 +#: ./docs/9.x/container.md:251 +#: ./docs/10.x/container.md:254 +#: ./docs/11.x/container.md:368 +#: ./docs/master/container.md:254 msgid "Binding Typed Variadics" -msgstr "繫結有型別提示的 Variadic 參數" +msgstr "" -#: docs/10.x/container.md:block 71 (paragraph) +# P +#: ./docs/8.x/container.md:250 +#: ./docs/9.x/container.md:253 +#: ./docs/10.x/container.md:256 +#: ./docs/11.x/container.md:370 +#: ./docs/master/container.md:256 msgid "Occasionally, you may have a class that receives an array of typed objects using a variadic constructor argument:" -msgstr "有時候,某個類別可能會需要使用 Variadic 建構函式引數來接收一個包含型別提示物件的陣列:" +msgstr "" -#: docs/10.x/container.md:block 72 (code) +# CODE +#: ./docs/8.x/container.md:252 +#: ./docs/9.x/container.md:255 msgid "logger = $logger;\n" " $this->filters = $filters;\n" " }\n" -"}\n" -msgstr "filters = $filters;\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/container.md:block 73 (paragraph) -msgid "Using contextual binding, you may resolve this dependency by providing the `give` method with a closure that returns an array of resolved `Filter` instances:" -msgstr "若使用基於上下文的繫結,則可以提供一個閉包給 `give` 方法來解析這個依賴。該閉包應回傳解析好的 `Filter` 實體的陣列:" +# P +#: ./docs/11.x/container.md:262 +msgid "In addition to the `Storage` attribute, Laravel offers `Auth`, `Cache`, `Config`, `DB`, `Log`, `RouteParameter`, and [`Tag`](#tagging) attributes:" +msgstr "" + +# CODE: php +#: ./docs/11.x/container.md:264 +msgid "app->when(Firewall::class)\n" " ->needs(Filter::class)\n" " ->give(function (Application $app) {\n" @@ -541,192 +1206,481 @@ msgid "$this->app->when(Firewall::class)\n" " $app->make(ProfanityFilter::class),\n" " $app->make(TooLongFilter::class),\n" " ];\n" -" });\n" -msgstr "$this->app->when(Firewall::class)\n" +" });" +msgstr "" + +# P +#: ./docs/8.x/container.md:287 +#: ./docs/9.x/container.md:290 +#: ./docs/10.x/container.md:283 +#: ./docs/11.x/container.md:397 +#: ./docs/master/container.md:283 +msgid "Using contextual binding, you may resolve this dependency by providing the `give` method with a closure that returns an array of resolved `Filter` instances:" +msgstr "" + +# CODE +#: ./docs/8.x/container.md:289 +#: ./docs/9.x/container.md:292 +msgid "$this->app->when(Firewall::class)\n" " ->needs(Filter::class)\n" -" ->give(function (Application $app) {\n" +" ->give(function ($app) {\n" " return [\n" " $app->make(NullFilter::class),\n" " $app->make(ProfanityFilter::class),\n" " $app->make(TooLongFilter::class),\n" " ];\n" -" });\n" +" });" +msgstr "" + +# P +#: ./docs/11.x/container.md:299 +msgid "Furthermore, Laravel provides a `CurrentUser` attribute for injecting the currently authenticated user into a given route or class:" +msgstr "" -#: docs/10.x/container.md:block 75 (paragraph) +# P +#: ./docs/8.x/container.md:299 +#: ./docs/9.x/container.md:302 +#: ./docs/10.x/container.md:295 +#: ./docs/11.x/container.md:409 +#: ./docs/master/container.md:295 msgid "For convenience, you may also just provide an array of class names to be resolved by the container whenever `Firewall` needs `Filter` instances:" -msgstr "為了方便起見,當 `Firewall` 需要 `Filter` 實體的時候,也可以只提供一個包含要給 Container 解析的類別名稱的陣列:" +msgstr "" -#: docs/10.x/container.md:block 76 (code) +# CODE: php +#: ./docs/11.x/container.md:301 +msgid "use App\\Models\\User;\n" +"use Illuminate\\Container\\Attributes\\CurrentUser;\n\n" +"Route::get('/user', function (#[CurrentUser] User $user) {\n" +" return $user;\n" +"})->middleware('auth');" +msgstr "" + +# CODE +#: ./docs/8.x/container.md:301 +#: ./docs/9.x/container.md:304 +#: ./docs/10.x/container.md:297 +#: ./docs/11.x/container.md:411 +#: ./docs/master/container.md:297 msgid "$this->app->when(Firewall::class)\n" " ->needs(Filter::class)\n" " ->give([\n" " NullFilter::class,\n" " ProfanityFilter::class,\n" " TooLongFilter::class,\n" -" ]);\n" -msgstr "$this->app->when(Firewall::class)\n" -" ->needs(Filter::class)\n" -" ->give([\n" -" NullFilter::class,\n" -" ProfanityFilter::class,\n" -" TooLongFilter::class,\n" -" ]);\n" +" ]);" +msgstr "" -#: docs/10.x/container.md:block 78 (header) +# P +#: ./docs/8.x/container.md:309 +#: ./docs/9.x/container.md:312 +#: ./docs/10.x/container.md:305 +#: ./docs/11.x/container.md:419 +#: ./docs/master/container.md:305 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/11.x/container.md:310 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/container.md:310 +#: ./docs/9.x/container.md:313 +#: ./docs/10.x/container.md:306 +#: ./docs/11.x/container.md:420 +#: ./docs/master/container.md:306 msgid "Variadic Tag Dependencies" -msgstr "Variadic 參數的標籤依賴" +msgstr "" + +# H4 +#: ./docs/11.x/container.md:311 +msgid "Defining Custom Attributes" +msgstr "" -#: docs/10.x/container.md:block 79 (paragraph) +# P +#: ./docs/8.x/container.md:312 +#: ./docs/9.x/container.md:315 +#: ./docs/10.x/container.md:308 +#: ./docs/11.x/container.md:422 +#: ./docs/master/container.md:308 msgid "Sometimes a class may have a variadic dependency that is type-hinted as a given class (`Report ...$reports`). Using the `needs` and `giveTagged` methods, you may easily inject all of the container bindings with that [tag](#tagging) for the given dependency:" -msgstr "有時候,某個類別可能會有型別提示為給定類別的 Variadic 參數 (`Report ...$reports`)。只要使用 `needs` 與 `giveTagged` 方法,就可以輕鬆將所有該[標籤](#tagging)的 Container 繫結注入進給定依賴:" +msgstr "" -#: docs/10.x/container.md:block 80 (code) +# P +#: ./docs/11.x/container.md:313 +msgid "You can create your own contextual attributes by implementing the `Illuminate\\Contracts\\Container\\ContextualAttribute` contract. The container will call your attribute's `resolve` method, which should resolve the value that should be injected into the class utilizing the attribute. In the example below, we will re-implement Laravel's built-in `Config` attribute:" +msgstr "" + +# CODE +#: ./docs/8.x/container.md:314 +#: ./docs/9.x/container.md:317 +#: ./docs/10.x/container.md:310 +#: ./docs/11.x/container.md:424 +#: ./docs/master/container.md:310 msgid "$this->app->when(ReportAggregator::class)\n" " ->needs(Report::class)\n" -" ->giveTagged('reports');\n" -msgstr "$this->app->when(ReportAggregator::class)\n" -" ->needs(Report::class)\n" -" ->giveTagged('reports');\n" - -#: docs/10.x/container.md:block 82 (header) -msgid "Tagging" -msgstr "標籤" +" ->giveTagged('reports');" +msgstr "" -#: docs/10.x/container.md:block 83 (paragraph) -msgid "Occasionally, you may need to resolve all of a certain \"category\" of binding. For example, perhaps you are building a report analyzer that receives an array of many different `Report` interface implementations. After registering the `Report` implementations, you can assign them a tag using the `tag` method:" -msgstr "有時候,可能會需要解析特定「類別」的繫結。舉例來說,若是在製作一個報表解析程式,會接收含有不同 `Report` 介面實作的陣列。註冊好 `Report` 實作後,可以使用 `tag` 方法來標記這些實作:" +# CODE +#: ./docs/11.x/container.md:315 +msgid "make('config')->get($attribute->key, $attribute->default);\n" +" }\n" +"}" +msgstr "" -#: docs/10.x/container.md:block 84 (code) +# P +#: ./docs/8.x/container.md:318 +#: ./docs/9.x/container.md:321 +#: ./docs/10.x/container.md:314 +#: ./docs/11.x/container.md:428 +#: ./docs/master/container.md:314 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/container.md:319 +#: ./docs/11.x/container.md:433 +#: ./docs/master/container.md:319 msgid "$this->app->bind(CpuReport::class, function () {\n" " // ...\n" "});\n\n" "$this->app->bind(MemoryReport::class, function () {\n" " // ...\n" "});\n\n" -"$this->app->tag([CpuReport::class, MemoryReport::class], 'reports');\n" -msgstr "$this->app->bind(CpuReport::class, function () {\n" -" // ...\n" +"$this->app->tag([CpuReport::class, MemoryReport::class], 'reports');" +msgstr "" + +# H3 +#: ./docs/8.x/container.md:319 +#: ./docs/9.x/container.md:322 +#: ./docs/10.x/container.md:315 +#: ./docs/11.x/container.md:429 +#: ./docs/master/container.md:315 +msgid "Tagging" +msgstr "" + +# P +#: ./docs/8.x/container.md:321 +#: ./docs/9.x/container.md:324 +#: ./docs/10.x/container.md:317 +#: ./docs/11.x/container.md:431 +#: ./docs/master/container.md:317 +msgid "Occasionally, you may need to resolve all of a certain \"category\" of binding. For example, perhaps you are building a report analyzer that receives an array of many different `Report` interface implementations. After registering the `Report` implementations, you can assign them a tag using the `tag` method:" +msgstr "" + +# CODE +#: ./docs/8.x/container.md:323 +#: ./docs/9.x/container.md:326 +msgid "$this->app->bind(CpuReport::class, function () {\n" +" //\n" "});\n\n" "$this->app->bind(MemoryReport::class, function () {\n" -" // ...\n" +" //\n" "});\n\n" -"$this->app->tag([CpuReport::class, MemoryReport::class], 'reports');\n" - -#: docs/10.x/container.md:block 85 (paragraph) -msgid "Once the services have been tagged, you may easily resolve them all via the container's `tagged` method:" -msgstr "標記好服務後就可以輕鬆地通過 Container 的 `tagged` 方法來解析所有的這些服務:" +"$this->app->tag([CpuReport::class, MemoryReport::class], 'reports');" +msgstr "" -#: docs/10.x/container.md:block 86 (code) +# CODE +#: ./docs/10.x/container.md:331 +#: ./docs/11.x/container.md:445 +#: ./docs/master/container.md:331 msgid "$this->app->bind(ReportAnalyzer::class, function (Application $app) {\n" " return new ReportAnalyzer($app->tagged('reports'));\n" -"});\n" -msgstr "$this->app->bind(ReportAnalyzer::class, function (Application $app) {\n" -" return new ReportAnalyzer($app->tagged('reports'));\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/container.md:block 88 (header) -msgid "Extending Bindings" -msgstr "擴充繫結" +# P +#: ./docs/8.x/container.md:333 +#: ./docs/9.x/container.md:336 +#: ./docs/10.x/container.md:329 +#: ./docs/11.x/container.md:443 +#: ./docs/master/container.md:329 +msgid "Once the services have been tagged, you may easily resolve them all via the container's `tagged` method:" +msgstr "" -#: docs/10.x/container.md:block 89 (paragraph) -msgid "The `extend` method allows the modification of resolved services. For example, when a service is resolved, you may run additional code to decorate or configure the service. The `extend` method accepts two arguments, the service class you're extending and a closure that should return the modified service. The closure receives the service being resolved and the container instance:" -msgstr "`extend` 方法能修改解析過的服務。舉例來說,當某個服務被解析後,可以執行額外的程式碼來修改或設定這個服務。`extend` 方法接受兩個引數,第一個印數為要擴充的 Service 類別,以及一個回傳經過修改服務的閉包。該閉包會接收經過解析的服務,以及 Container 實體:" +# CODE +#: ./docs/8.x/container.md:335 +#: ./docs/9.x/container.md:338 +msgid "$this->app->bind(ReportAnalyzer::class, function ($app) {\n" +" return new ReportAnalyzer($app->tagged('reports'));\n" +"});" +msgstr "" -#: docs/10.x/container.md:block 90 (code) +# P +#: ./docs/8.x/container.md:339 +#: ./docs/9.x/container.md:342 +#: ./docs/10.x/container.md:335 +#: ./docs/11.x/container.md:449 +#: ./docs/master/container.md:335 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/container.md:340 +#: ./docs/11.x/container.md:454 +#: ./docs/master/container.md:340 msgid "$this->app->extend(Service::class, function (Service $service, Application $app) {\n" " return new DecoratedService($service);\n" -"});\n" -msgstr "$this->app->extend(Service::class, function (Service $service, Application $app) {\n" +"});" +msgstr "" + +# H3 +#: ./docs/8.x/container.md:340 +#: ./docs/9.x/container.md:343 +#: ./docs/10.x/container.md:336 +#: ./docs/11.x/container.md:450 +#: ./docs/master/container.md:336 +msgid "Extending Bindings" +msgstr "" + +# P +#: ./docs/8.x/container.md:342 +msgid "The `extend` method allows the modification of resolved services. For example, when a service is resolved, you may run additional code to decorate or configure the service. The `extend` method accepts a closure, which should return the modified service, as its only argument. The closure receives the service being resolved and the container instance:" +msgstr "" + +# CODE +#: ./docs/8.x/container.md:344 +#: ./docs/9.x/container.md:347 +msgid "$this->app->extend(Service::class, function ($service, $app) {\n" " return new DecoratedService($service);\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/9.x/container.md:345 +#: ./docs/10.x/container.md:338 +#: ./docs/11.x/container.md:452 +#: ./docs/master/container.md:338 +msgid "The `extend` method allows the modification of resolved services. For example, when a service is resolved, you may run additional code to decorate or configure the service. The `extend` method accepts two arguments, the service class you're extending and a closure that should return the modified service. The closure receives the service being resolved and the container instance:" +msgstr "" -#: docs/10.x/container.md:block 92 (header) +# P +#: ./docs/8.x/container.md:348 +#: ./docs/9.x/container.md:351 +#: ./docs/10.x/container.md:344 +#: ./docs/11.x/container.md:458 +#: ./docs/master/container.md:344 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/container.md:349 +#: ./docs/9.x/container.md:352 +#: ./docs/10.x/container.md:345 +#: ./docs/11.x/container.md:459 +#: ./docs/master/container.md:345 msgid "Resolving" -msgstr "解析" +msgstr "" -#: docs/10.x/container.md:block 94 (header) +# P +#: ./docs/8.x/container.md:351 +#: ./docs/9.x/container.md:354 +#: ./docs/10.x/container.md:347 +#: ./docs/11.x/container.md:461 +#: ./docs/master/container.md:347 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/container.md:352 +#: ./docs/9.x/container.md:355 +#: ./docs/10.x/container.md:348 +#: ./docs/11.x/container.md:462 +#: ./docs/master/container.md:348 msgid "The `make` Method" -msgstr "`make` 方法" +msgstr "" -#: docs/10.x/container.md:block 95 (paragraph) +# P +#: ./docs/8.x/container.md:354 +#: ./docs/9.x/container.md:357 +#: ./docs/10.x/container.md:350 +#: ./docs/11.x/container.md:464 +#: ./docs/master/container.md:350 msgid "You may use the `make` method to resolve a class instance from the container. The `make` method accepts the name of the class or interface you wish to resolve:" -msgstr "可以使用 `make` 方法來從 Container 中解析一個類別實體。`make` 方法接收欲解析的類別或介面名稱:" - -#: docs/10.x/container.md:block 96 (code) -msgid "use App\\Services\\Transistor;\n\n" -"$transistor = $this->app->make(Transistor::class);\n" -msgstr "use App\\Services\\Transistor;\n\n" -"$transistor = $this->app->make(Transistor::class);\n" +msgstr "" -#: docs/10.x/container.md:block 97 (paragraph) +# P +#: ./docs/10.x/container.md:356 +#: ./docs/11.x/container.md:470 +#: ./docs/master/container.md:356 msgid "If some of your class's dependencies are not resolvable via the container, you may inject them by passing them as an associative array into the `makeWith` method. For example, we may manually pass the `$id` constructor argument required by the `Transistor` service:" -msgstr "若該類別的某些依賴無法被 Container 解析,則可能需要將這些依賴以關聯式陣列傳入 `makeWith` 方法內。舉例來說,可以手動傳入 `Transistor` 服務所需要的 `$id` 建構函式引數:" +msgstr "" -#: docs/10.x/container.md:block 98 (code) +# CODE +#: ./docs/8.x/container.md:356 +#: ./docs/9.x/container.md:359 +#: ./docs/10.x/container.md:352 +#: ./docs/11.x/container.md:466 +#: ./docs/master/container.md:352 msgid "use App\\Services\\Transistor;\n\n" -"$transistor = $this->app->makeWith(Transistor::class, ['id' => 1]);\n" -msgstr "use App\\Services\\Transistor;\n\n" -"$transistor = $this->app->makeWith(Transistor::class, ['id' => 1]);\n" +"$transistor = $this->app->make(Transistor::class);" +msgstr "" -#: docs/10.x/container.md:block 99 (paragraph) +# P +#: ./docs/8.x/container.md:360 +#: ./docs/9.x/container.md:363 +msgid "If some of your class' dependencies are not resolvable via the container, you may inject them by passing them as an associative array into the `makeWith` method. For example, we may manually pass the `$id` constructor argument required by the `Transistor` service:" +msgstr "" + +# P +#: ./docs/10.x/container.md:362 +#: ./docs/11.x/container.md:476 +#: ./docs/master/container.md:362 msgid "The `bound` method may be used to determine if a class or interface has been explicitly bound in the container:" -msgstr "`bound` 方法可用來判斷某個類別或介面是否已被明顯繫結至 Container:" +msgstr "" -#: docs/10.x/container.md:block 100 (code) +# CODE +#: ./docs/8.x/container.md:362 +#: ./docs/9.x/container.md:365 +#: ./docs/10.x/container.md:358 +#: ./docs/11.x/container.md:472 +#: ./docs/master/container.md:358 +msgid "use App\\Services\\Transistor;\n\n" +"$transistor = $this->app->makeWith(Transistor::class, ['id' => 1]);" +msgstr "" + +# CODE +#: ./docs/10.x/container.md:364 +#: ./docs/11.x/container.md:478 +#: ./docs/master/container.md:364 msgid "if ($this->app->bound(Transistor::class)) {\n" " // ...\n" -"}\n" -msgstr "if ($this->app->bound(Transistor::class)) {\n" -" // ...\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/container.md:block 101 (paragraph) -msgid "If you are outside of a service provider in a location of your code that does not have access to the `$app` variable, you may use the `App` [facade](/docs/{{version}}/facades) or the `app` [helper](/docs/{{version}}/helpers#method-app) to resolve a class instance from the container:" -msgstr "若不在 Service Provider 內,而是在專案中某處無法存取 `$app` 變數的地方,可以使用 `App` [Facade](/docs/{{version}}/facades) 或 `app` [輔助函式](/docs/{{version}}/helpers#method-app) 來從 Container 內解析類別實體:" +# P +#: ./docs/8.x/container.md:366 +msgid "If you are outside of a service provider in a location of your code that does not have access to the `$app` variable, you may use the `App` [facade](/docs/{{version}}/facades) to resolve a class instance from the container:" +msgstr "" -#: docs/10.x/container.md:block 102 (code) +# CODE +#: ./docs/8.x/container.md:368 msgid "use App\\Services\\Transistor;\n" "use Illuminate\\Support\\Facades\\App;\n\n" -"$transistor = App::make(Transistor::class);\n\n" -"$transistor = app(Transistor::class);\n" -msgstr "use App\\Services\\Transistor;\n" +"$transistor = App::make(Transistor::class);" +msgstr "" + +# P +#: ./docs/9.x/container.md:369 +#: ./docs/10.x/container.md:368 +#: ./docs/11.x/container.md:482 +#: ./docs/master/container.md:368 +msgid "If you are outside of a service provider in a location of your code that does not have access to the `$app` variable, you may use the `App` [facade](/docs/{{version}}/facades) or the `app` [helper](/docs/{{version}}/helpers#method-app) to resolve a class instance from the container:" +msgstr "" + +# CODE +#: ./docs/9.x/container.md:371 +#: ./docs/10.x/container.md:370 +#: ./docs/11.x/container.md:484 +#: ./docs/master/container.md:370 +msgid "use App\\Services\\Transistor;\n" "use Illuminate\\Support\\Facades\\App;\n\n" "$transistor = App::make(Transistor::class);\n\n" -"$transistor = app(Transistor::class);\n" +"$transistor = app(Transistor::class);" +msgstr "" -#: docs/10.x/container.md:block 103 (paragraph) -msgid "If you would like to have the Laravel container instance itself injected into a class that is being resolved by the container, you may type-hint the `Illuminate\\Container\\Container` class on your class's constructor:" -msgstr "若想將 Laravel Container 實體注入值 Container 正在解析的類別,則可以在該類別的建構函式中型別提示 `Illuminate\\Container\\Container` 類別:" +# P +#: ./docs/8.x/container.md:373 +#: ./docs/9.x/container.md:378 +msgid "If you would like to have the Laravel container instance itself injected into a class that is being resolved by the container, you may type-hint the `Illuminate\\Container\\Container` class on your class' constructor:" +msgstr "" -#: docs/10.x/container.md:block 104 (code) +# CODE +#: ./docs/8.x/container.md:375 +#: ./docs/9.x/container.md:380 msgid "use Illuminate\\Container\\Container;\n\n" "/**\n" " * Create a new class instance.\n" +" *\n" +" * @param \\Illuminate\\Container\\Container $container\n" +" * @return void\n" " */\n" -"public function __construct(\n" -" protected Container $container\n" -") {}\n" -msgstr "use Illuminate\\Container\\Container;\n\n" +"public function __construct(Container $container)\n" +"{\n" +" $this->container = $container;\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/container.md:377 +#: ./docs/11.x/container.md:491 +#: ./docs/master/container.md:377 +msgid "If you would like to have the Laravel container instance itself injected into a class that is being resolved by the container, you may type-hint the `Illuminate\\Container\\Container` class on your class's constructor:" +msgstr "" + +# CODE +#: ./docs/10.x/container.md:379 +#: ./docs/master/container.md:379 +msgid "use Illuminate\\Container\\Container;\n\n" "/**\n" " * Create a new class instance.\n" " */\n" "public function __construct(\n" " protected Container $container\n" -") {}\n" +") {}" +msgstr "" -#: docs/10.x/container.md:block 106 (header) +# P +#: ./docs/8.x/container.md:388 +#: ./docs/9.x/container.md:393 +#: ./docs/10.x/container.md:388 +#: ./docs/11.x/container.md:502 +#: ./docs/master/container.md:388 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/container.md:389 +#: ./docs/9.x/container.md:394 +#: ./docs/10.x/container.md:389 +#: ./docs/11.x/container.md:503 +#: ./docs/master/container.md:389 msgid "Automatic Injection" -msgstr "自動注入" +msgstr "" -#: docs/10.x/container.md:block 107 (paragraph) +# P +#: ./docs/8.x/container.md:391 +#: ./docs/9.x/container.md:396 +#: ./docs/10.x/container.md:391 +#: ./docs/11.x/container.md:505 +#: ./docs/master/container.md:391 msgid "Alternatively, and importantly, you may type-hint the dependency in the constructor of a class that is resolved by the container, including [controllers](/docs/{{version}}/controllers), [event listeners](/docs/{{version}}/events), [middleware](/docs/{{version}}/middleware), and more. Additionally, you may type-hint dependencies in the `handle` method of [queued jobs](/docs/{{version}}/queues). In practice, this is how most of your objects should be resolved by the container." -msgstr "此外,還有一點很重要的是,也可以在會由 Container 解析的類別之建構函式內對依賴進行型別提示。這類類別包含 [Controller](/docs/{{version}}/controllers)、[事件處理程式](/docs/{{version}}/events)、[Middleware](/docs/{{version}/middleware) …等。此外,也可以在[佇列任務](/docs/{{version}}/queues)的 `handle` 方法內對依賴進行型別提示。實務上來說,這也是大多數由 Container 解析物件的方法。" +msgstr "" -#: docs/10.x/container.md:block 108 (paragraph) +# P +#: ./docs/8.x/container.md:393 +#: ./docs/9.x/container.md:398 +#: ./docs/10.x/container.md:393 +#: ./docs/master/container.md:393 msgid "For example, you may type-hint a repository defined by your application in a controller's constructor. The repository will automatically be resolved and injected into the class:" -msgstr "舉例來說,可以在某個 Controller 的建構函式內對一個 Repository 定義進行型別提示。該 Repository 會被自動解析並插入到該類別內:" +msgstr "" -#: docs/10.x/container.md:block 109 (code) +# CODE +#: ./docs/10.x/container.md:395 +#: ./docs/master/container.md:395 msgid "users->findOrFail($id);\n\n" " return $user;\n" " }\n" -"}\n" -msgstr "users = $users;\n" +" }\n\n" " /**\n" " * Show the user with the given ID.\n" +" *\n" +" * @param int $id\n" +" * @return \\Illuminate\\Http\\Response\n" " */\n" -" public function show(string $id): User\n" +" public function show($id)\n" " {\n" -" $user = $this->users->findOrFail($id);\n\n" -" return $user;\n" +" //\n" " }\n" -"}\n" - -#: docs/10.x/container.md:block 111 (header) -msgid "Method Invocation & Injection" -msgstr "方法叫用與注入" +"}" +msgstr "" -#: docs/10.x/container.md:block 112 (paragraph) -msgid "Sometimes you may wish to invoke a method on an object instance while allowing the container to automatically inject that method's dependencies. For example, given the following class:" -msgstr "有時候我們可能會想在某個物件實體上叫用一個方法,並讓 Container 自動將該方法的相依內容注入進去。舉例來說,假設有下列類別:" +# H2 +#: ./docs/10.x/container.md:423 +#: ./docs/11.x/container.md:534 +#: ./docs/master/container.md:423 +msgid "Method Invocation and Injection" +msgstr "" -#: docs/10.x/container.md:block 113 (code) +# CODE +#: ./docs/10.x/container.md:427 +#: ./docs/master/container.md:427 msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/container.md:434 +#: ./docs/9.x/container.md:439 +msgid "Method Invocation & Injection" +msgstr "" + +# P +#: ./docs/8.x/container.md:436 +#: ./docs/9.x/container.md:441 +#: ./docs/10.x/container.md:425 +#: ./docs/11.x/container.md:536 +#: ./docs/master/container.md:425 +msgid "Sometimes you may wish to invoke a method on an object instance while allowing the container to automatically inject that method's dependencies. For example, given the following class:" +msgstr "" + +# CODE +#: ./docs/8.x/container.md:438 +#: ./docs/9.x/container.md:443 +msgid "app->resolving(Transistor::class, function (Transistor $transistor, Application $app) {\n" @@ -854,527 +1852,231 @@ msgid "use App\\Services\\Transistor;\n" "});\n\n" "$this->app->resolving(function (mixed $object, Application $app) {\n" " // Called when container resolves object of any type...\n" -"});\n" -msgstr "use App\\Services\\Transistor;\n" -"use Illuminate\\Contracts\\Foundation\\Application;\n\n" -"$this->app->resolving(Transistor::class, function (Transistor $transistor, Application $app) {\n" -" // 當 Container 在解析型別為「Transistor」時會被呼叫...\n" -"});\n\n" -"$this->app->resolving(function (mixed $object, Application $app) {\n" -" // 當 Container 在解析任意型別的物件時會呼叫...\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/container.md:block 122 (paragraph) -msgid "As you can see, the object being resolved will be passed to the callback, allowing you to set any additional properties on the object before it is given to its consumer." -msgstr "如你所見,被解析的物件會被傳入該回呼內,讓你能在物件被交給要求者之前對物件設定額外的屬性。" +# CODE +#: ./docs/8.x/container.md:467 +#: ./docs/9.x/container.md:472 +#: ./docs/10.x/container.md:455 +#: ./docs/master/container.md:455 +msgid "use App\\Repositories\\UserRepository;\n" +"use Illuminate\\Support\\Facades\\App;\n\n" +"$result = App::call(function (UserRepository $repository) {\n" +" // ...\n" +"});" +msgstr "" -#: docs/10.x/container.md:block 124 (header) -msgid "PSR-11" -msgstr "PSR-11" +# P +#: ./docs/8.x/container.md:474 +#: ./docs/9.x/container.md:479 +#: ./docs/10.x/container.md:462 +#: ./docs/11.x/container.md:573 +#: ./docs/master/container.md:462 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/container.md:475 +#: ./docs/9.x/container.md:480 +#: ./docs/10.x/container.md:463 +#: ./docs/11.x/container.md:574 +#: ./docs/master/container.md:463 +msgid "Container Events" +msgstr "" -#: docs/10.x/container.md:block 125 (paragraph) -msgid "Laravel's service container implements the [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md) interface. Therefore, you may type-hint the PSR-11 container interface to obtain an instance of the Laravel container:" -msgstr "Laravel 的 Service Container 實作了 [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md) 介面。因此,可以型別提示 PSR-11 Container 介面來取得 Laravel Container 的實體:" +# P +#: ./docs/8.x/container.md:477 +#: ./docs/9.x/container.md:482 +#: ./docs/10.x/container.md:465 +#: ./docs/11.x/container.md:576 +#: ./docs/master/container.md:465 +msgid "The service container fires an event each time it resolves an object. You may listen to this event using the `resolving` method:" +msgstr "" -#: docs/10.x/container.md:block 126 (code) +# CODE +#: ./docs/8.x/container.md:479 +#: ./docs/9.x/container.md:484 +msgid "use App\\Services\\Transistor;\n\n" +"$this->app->resolving(Transistor::class, function ($transistor, $app) {\n" +" // Called when container resolves objects of type \"Transistor\"...\n" +"});\n\n" +"$this->app->resolving(function ($object, $app) {\n" +" // Called when container resolves object of any type...\n" +"});" +msgstr "" + +# CODE +#: ./docs/10.x/container.md:485 +#: ./docs/11.x/container.md:618 +#: ./docs/master/container.md:485 msgid "use App\\Services\\Transistor;\n" "use Psr\\Container\\ContainerInterface;\n\n" "Route::get('/', function (ContainerInterface $container) {\n" " $service = $container->get(Transistor::class);\n\n" " // ...\n" -"});\n" -msgstr "use App\\Services\\Transistor;\n" -"use Psr\\Container\\ContainerInterface;\n\n" -"Route::get('/', function (ContainerInterface $container) {\n" -" $service = $container->get(Transistor::class);\n\n" -" // ...\n" -"});\n" - -#: docs/10.x/container.md:block 127 (paragraph) -msgid "An exception is thrown if the given identifier can't be resolved. The exception will be an instance of `Psr\\Container\\NotFoundExceptionInterface` if the identifier was never bound. If the identifier was bound but was unable to be resolved, an instance of `Psr\\Container\\ContainerExceptionInterface` will be thrown." -msgstr "若給定的識別元無法被解析,則會擲回例外。若該識別元從未被繫結,則該例外為 `Psr\\Container\\NotFoundExceptionInterface` 的實體。若該識別元有被繫結過,但無法解析,則會擲回 `Psr\\Container\\ContainerExceptionInterface` 的實體。" - -#: docs/8.x/container.md:block 7 (code) -msgid "users = $users;\n" -" }\n\n" -" /**\n" -" * Show the profile for the given user.\n" -" *\n" -" * @param int $id\n" -" * @return Response\n" -" */\n" -" public function show($id)\n" -" {\n" -" $user = $this->users->find($id);\n\n" -" return view('user.profile', ['user' => $user]);\n" -" }\n" -"}\n" -msgstr "users = $users;\n" -" }\n\n" -" /**\n" -" * Show the profile for the given user.\n" -" *\n" -" * @param int $id\n" -" * @return Response\n" -" */\n" -" public function show($id)\n" -" {\n" -" $user = $this->users->find($id);\n\n" -" return view('user.profile', ['user' => $user]);\n" -" }\n" -"}\n" - -#: docs/8.x/container.md:block 13 (code) -msgid "app->bind(Transistor::class, function ($app) {\n" -" return new Transistor($app->make(PodcastParser::class));\n" -"});\n" -msgstr "use App\\Services\\Transistor;\n" -"use App\\Services\\PodcastParser;\n\n" -"$this->app->bind(Transistor::class, function ($app) {\n" -" return new Transistor($app->make(PodcastParser::class));\n" -"});\n" - -#: docs/8.x/container.md:block 33 (code) -msgid "use App\\Services\\Transistor;\n" -"use Illuminate\\Support\\Facades\\App;\n\n" -"App::bind(Transistor::class, function ($app) {\n" -" // ...\n" -"});\n" -msgstr "use App\\Services\\Transistor;\n" -"use Illuminate\\Support\\Facades\\App;\n\n" -"App::bind(Transistor::class, function ($app) {\n" -" // ...\n" -"});\n" - -#: docs/8.x/container.md:block 34 (quote) -msgid "{tip} There is no need to bind classes into the container if they do not depend on any interfaces. The container does not need to be instructed on how to build these objects, since it can automatically resolve these objects using reflection." -msgstr "{tip} 若類別沒有依賴任何介面,就不需要將其繫結到 Container 上。不需要告訴 Container 如何建構這些物件,因為這些物件可以通過 Reflection 自動被解析。" +"});" +msgstr "" -#: docs/8.x/container.md:block 38 (code) -msgid "use App\\Services\\Transistor;\n" -"use App\\Services\\PodcastParser;\n\n" -"$this->app->singleton(Transistor::class, function ($app) {\n" -" return new Transistor($app->make(PodcastParser::class));\n" -"});\n" -msgstr "use App\\Services\\Transistor;\n" -"use App\\Services\\PodcastParser;\n\n" -"$this->app->singleton(Transistor::class, function ($app) {\n" -" return new Transistor($app->make(PodcastParser::class));\n" -"});\n" +# P +#: ./docs/8.x/container.md:489 +#: ./docs/9.x/container.md:494 +#: ./docs/10.x/container.md:478 +#: ./docs/11.x/container.md:589 +#: ./docs/master/container.md:478 +msgid "As you can see, the object being resolved will be passed to the callback, allowing you to set any additional properties on the object before it is given to its consumer." +msgstr "" -#: docs/8.x/container.md:block 42 (code) -msgid "use App\\Services\\Transistor;\n" -"use App\\Services\\PodcastParser;\n\n" -"$this->app->scoped(Transistor::class, function ($app) {\n" -" return new Transistor($app->make(PodcastParser::class));\n" -"});\n" -msgstr "use App\\Services\\Transistor;\n" -"use App\\Services\\PodcastParser;\n\n" -"$this->app->scoped(Transistor::class, function ($app) {\n" -" return new Transistor($app->make(PodcastParser::class));\n" -"});\n" +# P +#: ./docs/8.x/container.md:491 +#: ./docs/9.x/container.md:496 +#: ./docs/10.x/container.md:480 +#: ./docs/11.x/container.md:613 +#: ./docs/master/container.md:480 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/container.md:492 +#: ./docs/9.x/container.md:497 +#: ./docs/10.x/container.md:481 +#: ./docs/11.x/container.md:614 +#: ./docs/master/container.md:481 +msgid "PSR-11" +msgstr "" -#: docs/8.x/container.md:block 52 (code) -msgid "use App\\Contracts\\EventPusher;\n\n" -"/**\n" -" * Create a new class instance.\n" -" *\n" -" * @param \\App\\Contracts\\EventPusher $pusher\n" -" * @return void\n" -" */\n" -"public function __construct(EventPusher $pusher)\n" -"{\n" -" $this->pusher = $pusher;\n" -"}\n" -msgstr "use App\\Contracts\\EventPusher;\n\n" +# CODE +#: ./docs/11.x/container.md:493 +msgid "use Illuminate\\Container\\Container;\n\n" "/**\n" " * Create a new class instance.\n" -" *\n" -" * @param \\App\\Contracts\\EventPusher $pusher\n" -" * @return void\n" " */\n" -"public function __construct(EventPusher $pusher)\n" -"{\n" -" $this->pusher = $pusher;\n" -"}\n" - -#: docs/8.x/container.md:block 60 (code) -msgid "$this->app->when('App\\Http\\Controllers\\UserController')\n" -" ->needs('$variableName')\n" -" ->give($value);\n" -msgstr "$this->app->when('App\\Http\\Controllers\\UserController')\n" -" ->needs('$variableName')\n" -" ->give($value);\n" - -#: docs/8.x/container.md:block 68 (code) -msgid "logger = $logger;\n" -" $this->filters = $filters;\n" -" }\n" -"}\n" -msgstr "logger = $logger;\n" -" $this->filters = $filters;\n" -" }\n" -"}\n" - -#: docs/8.x/container.md:block 70 (code) -msgid "$this->app->when(Firewall::class)\n" -" ->needs(Filter::class)\n" -" ->give(function ($app) {\n" -" return [\n" -" $app->make(NullFilter::class),\n" -" $app->make(ProfanityFilter::class),\n" -" $app->make(TooLongFilter::class),\n" -" ];\n" -" });\n" -msgstr "$this->app->when(Firewall::class)\n" -" ->needs(Filter::class)\n" -" ->give(function ($app) {\n" -" return [\n" -" $app->make(NullFilter::class),\n" -" $app->make(ProfanityFilter::class),\n" -" $app->make(TooLongFilter::class),\n" -" ];\n" -" });\n" - -#: docs/8.x/container.md:block 80 (code) -msgid "$this->app->bind(CpuReport::class, function () {\n" -" //\n" -"});\n\n" -"$this->app->bind(MemoryReport::class, function () {\n" -" //\n" -"});\n\n" -"$this->app->tag([CpuReport::class, MemoryReport::class], 'reports');\n" -msgstr "$this->app->bind(CpuReport::class, function () {\n" -" //\n" -"});\n\n" -"$this->app->bind(MemoryReport::class, function () {\n" -" //\n" -"});\n\n" -"$this->app->tag([CpuReport::class, MemoryReport::class], 'reports');\n" - -#: docs/8.x/container.md:block 82 (code) -msgid "$this->app->bind(ReportAnalyzer::class, function ($app) {\n" -" return new ReportAnalyzer($app->tagged('reports'));\n" -"});\n" -msgstr "$this->app->bind(ReportAnalyzer::class, function ($app) {\n" -" return new ReportAnalyzer($app->tagged('reports'));\n" -"});\n" - -#: docs/8.x/container.md:block 85 (paragraph) -msgid "The `extend` method allows the modification of resolved services. For example, when a service is resolved, you may run additional code to decorate or configure the service. The `extend` method accepts a closure, which should return the modified service, as its only argument. The closure receives the service being resolved and the container instance:" -msgstr "`extend` 方法能修改解析過的服務。舉例來說,當某個服務被解析後,可以執行額外的程式碼來修改或設定這個服務。`extend` 方法接收一個閉包,該閉包應回傳經過修改的服務,作為其唯一的引數。該閉包會接收經過解析的服務,以及 Container 實體:" - -#: docs/8.x/container.md:block 86 (code) -msgid "$this->app->extend(Service::class, function ($service, $app) {\n" -" return new DecoratedService($service);\n" -"});\n" -msgstr "$this->app->extend(Service::class, function ($service, $app) {\n" -" return new DecoratedService($service);\n" -"});\n" - -#: docs/8.x/container.md:block 93 (paragraph) -msgid "If some of your class' dependencies are not resolvable via the container, you may inject them by passing them as an associative array into the `makeWith` method. For example, we may manually pass the `$id` constructor argument required by the `Transistor` service:" -msgstr "若該類別的某些依賴無法被 Container 解析,則可能需要將這些依賴以關聯式陣列傳入 `makeWith` 方法內。舉例來說,可以手動傳入 `Transistor` 服務所需要的 `$id` 建構函式引數:" +"public function __construct(\n" +" protected Container $container,\n" +") {}" +msgstr "" -#: docs/8.x/container.md:block 95 (paragraph) -msgid "If you are outside of a service provider in a location of your code that does not have access to the `$app` variable, you may use the `App` [facade](/docs/{{version}}/facades) to resolve a class instance from the container:" -msgstr "若不在 Service Provider 內,而是在專案中的某處無法存取 `$app` 變數的地方,就可以使用 `App` [Facade](/docs/{{version}}/facades) 來從 Container 內解析類別實體:" +# P +#: ./docs/8.x/container.md:494 +#: ./docs/9.x/container.md:499 +#: ./docs/10.x/container.md:483 +#: ./docs/11.x/container.md:616 +#: ./docs/master/container.md:483 +msgid "Laravel's service container implements the [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md) interface. Therefore, you may type-hint the PSR-11 container interface to obtain an instance of the Laravel container:" +msgstr "" -#: docs/8.x/container.md:block 96 (code) +# CODE +#: ./docs/8.x/container.md:496 +#: ./docs/9.x/container.md:501 msgid "use App\\Services\\Transistor;\n" -"use Illuminate\\Support\\Facades\\App;\n\n" -"$transistor = App::make(Transistor::class);\n" -msgstr "use App\\Services\\Transistor;\n" -"use Illuminate\\Support\\Facades\\App;\n\n" -"$transistor = App::make(Transistor::class);\n" +"use Psr\\Container\\ContainerInterface;\n\n" +"Route::get('/', function (ContainerInterface $container) {\n" +" $service = $container->get(Transistor::class);\n\n" +" //\n" +"});" +msgstr "" -#: docs/8.x/container.md:block 97 (paragraph) -msgid "If you would like to have the Laravel container instance itself injected into a class that is being resolved by the container, you may type-hint the `Illuminate\\Container\\Container` class on your class' constructor:" -msgstr "若想將 Laravel Container 實體注入值 Container 正在解析的類別,則可以在該類別的建構函式中型別提示 `Illuminate\\Container\\Container` 類別:" +# P +#: ./docs/8.x/container.md:505 +#: ./docs/9.x/container.md:510 +#: ./docs/10.x/container.md:494 +#: ./docs/11.x/container.md:627 +#: ./docs/master/container.md:494 +msgid "An exception is thrown if the given identifier can't be resolved. The exception will be an instance of `Psr\\Container\\NotFoundExceptionInterface` if the identifier was never bound. If the identifier was bound but was unable to be resolved, an instance of `Psr\\Container\\ContainerExceptionInterface` will be thrown." +msgstr "" -#: docs/8.x/container.md:block 98 (code) -msgid "use Illuminate\\Container\\Container;\n\n" -"/**\n" -" * Create a new class instance.\n" -" *\n" -" * @param \\Illuminate\\Container\\Container $container\n" -" * @return void\n" -" */\n" -"public function __construct(Container $container)\n" -"{\n" -" $this->container = $container;\n" -"}\n" -msgstr "use Illuminate\\Container\\Container;\n\n" -"/**\n" -" * Create a new class instance.\n" -" *\n" -" * @param \\Illuminate\\Container\\Container $container\n" -" * @return void\n" -" */\n" -"public function __construct(Container $container)\n" -"{\n" -" $this->container = $container;\n" -"}\n" +# P +#: ./docs/11.x/container.md:507 +msgid "For example, you may type-hint a service defined by your application in a controller's constructor. The service will automatically be resolved and injected into the class:" +msgstr "" -#: docs/8.x/container.md:block 103 (code) +# CODE +#: ./docs/11.x/container.md:509 msgid "users = $users;\n" -" }\n\n" -" /**\n" -" * Show the user with the given ID.\n" -" *\n" -" * @param int $id\n" -" * @return \\Illuminate\\Http\\Response\n" -" */\n" -" public function show($id)\n" -" {\n" -" //\n" -" }\n" -"}\n" -msgstr "users = $users;\n" -" }\n\n" +" public function __construct(\n" +" protected AppleMusic $apple,\n" +" ) {}\n\n" " /**\n" -" * Show the user with the given ID.\n" -" *\n" -" * @param int $id\n" -" * @return \\Illuminate\\Http\\Response\n" +" * Show information about the given podcast.\n" " */\n" -" public function show($id)\n" +" public function show(string $id): Podcast\n" " {\n" -" //\n" +" return $this->apple->findPodcast($id);\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/8.x/container.md:block 107 (code) +# CODE +#: ./docs/11.x/container.md:538 msgid "app->resolving(Transistor::class, function ($transistor, $app) {\n" -" // Called when container resolves objects of type \"Transistor\"...\n" -"});\n\n" -"$this->app->resolving(function ($object, $app) {\n" -" // Called when container resolves object of any type...\n" -"});\n" -msgstr "use App\\Services\\Transistor;\n\n" -"$this->app->resolving(Transistor::class, function ($transistor, $app) {\n" -" // 當 Container 要解析「Transistor」物件時,會呼叫此閉包...\n" -"});\n\n" -"$this->app->resolving(function ($object, $app) {\n" -" // 當 Container 要解析任何型別的物件時,會呼叫此閉包...\n" -"});\n" +"}" +msgstr "" -#: docs/8.x/container.md:block 120 (code) -msgid "use App\\Services\\Transistor;\n" -"use Psr\\Container\\ContainerInterface;\n\n" -"Route::get('/', function (ContainerInterface $container) {\n" -" $service = $container->get(Transistor::class);\n\n" -" //\n" -"});\n" -msgstr "use App\\Services\\Transistor;\n" -"use Psr\\Container\\ContainerInterface;\n\n" -"Route::get('/', function (ContainerInterface $container) {\n" -" $service = $container->get(Transistor::class);\n\n" -" //\n" -"});\n" +# CODE +#: ./docs/11.x/container.md:559 +msgid "use App\\PodcastStats;\n" +"use Illuminate\\Support\\Facades\\App;\n\n" +"$stats = App::call([new PodcastStats, 'generate']);" +msgstr "" -#: docs/master/container.md:block 13 (code) -msgid "" +#~ msgstr "" + +# H3 +#: ./docs/11.x/container.md:592 +msgid "Rebinding" +msgstr "" + +# P +#: ./docs/11.x/container.md:594 +msgid "The `rebinding` method allows you to listen for when a service is re-bound to the container, meaning it is registered again or overridden after its initial binding. This can be useful when you need to update dependencies or modify behavior each time a specific binding is updated:" +msgstr "" + +# CODE +#: ./docs/11.x/container.md:596 +msgid "use App\\Contracts\\PodcastPublisher;\n" +"use App\\Services\\SpotifyPublisher;\n" +"use App\\Services\\TransistorPublisher;\n" +"use Illuminate\\Contracts\\Foundation\\Application;\n\n" +"$this->app->bind(PodcastPublisher::class, SpotifyPublisher::class);\n\n" +"$this->app->rebinding(\n" +" PodcastPublisher::class,\n" +" function (Application $app, PodcastPublisher $newInstance) {\n" +" //\n" +" },\n" +");\n\n" +"// New binding will trigger rebinding closure...\n" +"$this->app->bind(PodcastPublisher::class, TransistorPublisher::class);" +msgstr "" diff --git a/po/zh_TW/context.po b/po/zh_TW/context.po new file mode 100644 index 000000000..91695b575 --- /dev/null +++ b/po/zh_TW/context.po @@ -0,0 +1,628 @@ +msgid "" +msgstr "" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Crowdin-Project: laravel-docs\n" +"X-Crowdin-Project-ID: 447952\n" +"X-Crowdin-Language: zh-TW\n" +"X-Crowdin-File: /main/templates/context.pot\n" +"X-Crowdin-File-ID: 194\n" +"Project-Id-Version: laravel-docs\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Language-Team: Chinese Traditional\n" +"Language: zh_TW\n" +"PO-Revision-Date: 2024-11-30 08:39\n" + +# H1 +#: ./docs/11.x/context.md:1 +msgid "Context" +msgstr "" + +# P +#: ./docs/11.x/context.md:3 +msgid "[Introduction](#introduction)" +msgstr "" + +# P +#: ./docs/11.x/context.md:4 +msgid "[How it Works](#how-it-works)" +msgstr "" + +# P +#: ./docs/11.x/context.md:5 +msgid "[Capturing Context](#capturing-context)" +msgstr "" + +# P +#: ./docs/11.x/context.md:6 +msgid "[Stacks](#stacks)" +msgstr "" + +# P +#: ./docs/11.x/context.md:7 +msgid "[Retrieving Context](#retrieving-context)" +msgstr "" + +# P +#: ./docs/11.x/context.md:8 +msgid "[Determining Item Existence](#determining-item-existence)" +msgstr "" + +# P +#: ./docs/11.x/context.md:9 +msgid "[Removing Context](#removing-context)" +msgstr "" + +# P +#: ./docs/11.x/context.md:10 +msgid "[Hidden Context](#hidden-context)" +msgstr "" + +# P +#: ./docs/11.x/context.md:11 +msgid "[Events](#events)" +msgstr "" + +# P +#: ./docs/11.x/context.md:12 +msgid "[Dehydrating](#dehydrating)" +msgstr "" + +# P +#: ./docs/11.x/context.md:13 +msgid "[Hydrated](#hydrated)" +msgstr "" + +# P +#: ./docs/11.x/context.md:15 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/context.md:16 +msgid "Introduction" +msgstr "" + +# P +#: ./docs/11.x/context.md:18 +msgid "Laravel's \"context\" capabilities enable you to capture, retrieve, and share information throughout requests, jobs, and commands executing within your application. This captured information is also included in logs written by your application, giving you deeper insight into the surrounding code execution history that occurred before a log entry was written and allowing you to trace execution flows throughout a distributed system." +msgstr "" + +# P +#: ./docs/11.x/context.md:20 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/11.x/context.md:21 +msgid "How it Works" +msgstr "" + +# P +#: ./docs/11.x/context.md:23 +msgid "The best way to understand Laravel's context capabilities is to see it in action using the built-in logging features. To get started, you may [add information to the context](#capturing-context) using the `Context` facade. In this example, we will use a [middleware](/docs/{{version}}/middleware) to add the request URL and a unique trace ID to the context on every incoming request:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:25 +msgid "url());\n" +" Context::add('trace_id', Str::uuid()->toString());\n\n" +" return $next($request);\n" +" }\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/context.md:51 +msgid "Information added to the context is automatically appended as metadata to any [log entries](/docs/{{version}}/logging) that are written throughout the request. Appending context as metadata allows information passed to individual log entries to be differentiated from the information shared via `Context`. For example, imagine we write the following log entry:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:53 +msgid "Log::info('User authenticated.', ['auth_id' => Auth::id()]);" +msgstr "" + +# P +#: ./docs/11.x/context.md:57 +msgid "The written log will contain the `auth_id` passed to the log entry, but it will also contain the context's `url` and `trace_id` as metadata:" +msgstr "" + +# CODE +#: ./docs/11.x/context.md:59 +msgid "User authenticated. {\"auth_id\":27} {\"url\":\"https://example.com/login\",\"trace_id\":\"e04e1a11-e75c-4db3-b5b5-cfef4ef56697\"}" +msgstr "" + +# P +#: ./docs/11.x/context.md:63 +msgid "Information added to the context is also made available to jobs dispatched to the queue. For example, imagine we dispatch a `ProcessPodcast` job to the queue after adding some information to the context:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:65 +msgid "// In our middleware...\n" +"Context::add('url', $request->url());\n" +"Context::add('trace_id', Str::uuid()->toString());\n\n" +"// In our controller...\n" +"ProcessPodcast::dispatch($podcast);" +msgstr "" + +# P +#: ./docs/11.x/context.md:74 +msgid "When the job is dispatched, any information currently stored in the context is captured and shared with the job. The captured information is then hydrated back into the current context while the job is executing. So, if our job's handle method was to write to the log:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:76 +msgid "class ProcessPodcast implements ShouldQueue\n" +"{\n" +" use Queueable;\n\n" +" // ...\n\n" +" /**\n" +" * Execute the job.\n" +" */\n" +" public function handle(): void\n" +" {\n" +" Log::info('Processing podcast.', [\n" +" 'podcast_id' => $this->podcast->id,\n" +" ]);\n\n" +" // ...\n" +" }\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/context.md:97 +msgid "The resulting log entry would contain the information that was added to the context during the request that originally dispatched the job:" +msgstr "" + +# CODE +#: ./docs/11.x/context.md:99 +msgid "Processing podcast. {\"podcast_id\":95} {\"url\":\"https://example.com/login\",\"trace_id\":\"e04e1a11-e75c-4db3-b5b5-cfef4ef56697\"}" +msgstr "" + +# P +#: ./docs/11.x/context.md:103 +msgid "Although we have focused on the built-in logging related features of Laravel's context, the following documentation will illustrate how context allows you to share information across the HTTP request / queued job boundary and even how to add [hidden context data](#hidden-context) that is not written with log entries." +msgstr "" + +# P +#: ./docs/11.x/context.md:105 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/context.md:106 +msgid "Capturing Context" +msgstr "" + +# P +#: ./docs/11.x/context.md:108 +msgid "You may store information in the current context using the `Context` facade's `add` method:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:110 +msgid "use Illuminate\\Support\\Facades\\Context;\n\n" +"Context::add('key', 'value');" +msgstr "" + +# P +#: ./docs/11.x/context.md:116 +msgid "To add multiple items at once, you may pass an associative array to the `add` method:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:118 +msgid "Context::add([\n" +" 'first_key' => 'value',\n" +" 'second_key' => 'value',\n" +"]);" +msgstr "" + +# P +#: ./docs/11.x/context.md:125 +msgid "The `add` method will override any existing value that shares the same key. If you only wish to add information to the context if the key does not already exist, you may use the `addIf` method:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:127 +msgid "Context::add('key', 'first');\n\n" +"Context::get('key');\n" +"// \"first\"\n\n" +"Context::addIf('key', 'second');\n\n" +"Context::get('key');\n" +"// \"first\"" +msgstr "" + +# P +#: ./docs/11.x/context.md:139 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/11.x/context.md:140 +msgid "Conditional Context" +msgstr "" + +# P +#: ./docs/11.x/context.md:142 +msgid "The `when` method may be used to add data to the context based on a given condition. The first closure provided to the `when` method will be invoked if the given condition evaluates to `true`, while the second closure will be invoked if the condition evaluates to `false`:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:144 +msgid "use Illuminate\\Support\\Facades\\Auth;\n" +"use Illuminate\\Support\\Facades\\Context;\n\n" +"Context::when(\n" +" Auth::user()->isAdmin(),\n" +" fn ($context) => $context->add('permissions', Auth::user()->permissions),\n" +" fn ($context) => $context->add('permissions', []),\n" +");" +msgstr "" + +# P +#: ./docs/11.x/context.md:155 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/11.x/context.md:156 +msgid "Stacks" +msgstr "" + +# P +#: ./docs/11.x/context.md:158 +msgid "Context offers the ability to create \"stacks\", which are lists of data stored in the order that they were added. You can add information to a stack by invoking the `push` method:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:160 +msgid "use Illuminate\\Support\\Facades\\Context;\n\n" +"Context::push('breadcrumbs', 'first_value');\n\n" +"Context::push('breadcrumbs', 'second_value', 'third_value');\n\n" +"Context::get('breadcrumbs');\n" +"// [\n" +"// 'first_value',\n" +"// 'second_value',\n" +"// 'third_value',\n" +"// ]" +msgstr "" + +# P +#: ./docs/11.x/context.md:175 +msgid "Stacks can be useful to capture historical information about a request, such as events that are happening throughout your application. For example, you could create an event listener to push to a stack every time a query is executed, capturing the query SQL and duration as a tuple:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:177 +msgid "use Illuminate\\Support\\Facades\\Context;\n" +"use Illuminate\\Support\\Facades\\DB;\n\n" +"DB::listen(function ($event) {\n" +" Context::push('queries', [$event->time, $event->sql]);\n" +"});" +msgstr "" + +# P +#: ./docs/11.x/context.md:186 +msgid "You may determine if a value is in a stack using the `stackContains` and `hiddenStackContains` methods:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:188 +msgid "if (Context::stackContains('breadcrumbs', 'first_value')) {\n" +" //\n" +"}\n\n" +"if (Context::hiddenStackContains('secrets', 'first_value')) {\n" +" //\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/context.md:198 +msgid "The `stackContains` and `hiddenStackContains` methods also accept a closure as their second argument, allowing more control over the value comparison operation:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:200 +msgid "use Illuminate\\Support\\Facades\\Context;\n" +"use Illuminate\\Support\\Str;\n\n" +"return Context::stackContains('breadcrumbs', function ($value) {\n" +" return Str::startsWith($value, 'query_');\n" +"});" +msgstr "" + +# P +#: ./docs/11.x/context.md:209 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/context.md:210 +msgid "Retrieving Context" +msgstr "" + +# P +#: ./docs/11.x/context.md:212 +msgid "You may retrieve information from the context using the `Context` facade's `get` method:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:214 +msgid "use Illuminate\\Support\\Facades\\Context;\n\n" +"$value = Context::get('key');" +msgstr "" + +# P +#: ./docs/11.x/context.md:220 +msgid "The `only` method may be used to retrieve a subset of the information in the context:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:222 +msgid "$data = Context::only(['first_key', 'second_key']);" +msgstr "" + +# P +#: ./docs/11.x/context.md:226 +msgid "The `pull` method may be used to retrieve information from the context and immediately remove it from the context:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:228 +msgid "$value = Context::pull('key');" +msgstr "" + +# P +#: ./docs/11.x/context.md:232 +msgid "If context data is stored in a [stack](#stacks), you may pop items from the stack using the `pop` method:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:234 +msgid "Context::push('breadcrumbs', 'first_value', 'second_value');\n\n" +"Context::pop('breadcrumbs')\n" +"// second_value\n\n" +"Context::get('breadcrumbs');\n" +"// ['first_value'] " +msgstr "" + +# P +#: ./docs/11.x/context.md:244 +msgid "If you would like to retrieve all of the information stored in the context, you may invoke the `all` method:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:246 +msgid "$data = Context::all();" +msgstr "" + +# P +#: ./docs/11.x/context.md:250 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/11.x/context.md:251 +msgid "Determining Item Existence" +msgstr "" + +# P +#: ./docs/11.x/context.md:253 +msgid "You may use the `has` method to determine if the context has any value stored for the given key:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:255 +msgid "use Illuminate\\Support\\Facades\\Context;\n\n" +"if (Context::has('key')) {\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/context.md:263 +msgid "The `has` method will return `true` regardless of the value stored. So, for example, a key with a `null` value will be considered present:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:265 +msgid "Context::add('key', null);\n\n" +"Context::has('key');\n" +"// true" +msgstr "" + +# P +#: ./docs/11.x/context.md:272 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/context.md:273 +msgid "Removing Context" +msgstr "" + +# P +#: ./docs/11.x/context.md:275 +msgid "The `forget` method may be used to remove a key and its value from the current context:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:277 +msgid "use Illuminate\\Support\\Facades\\Context;\n\n" +"Context::add(['first_key' => 1, 'second_key' => 2]);\n\n" +"Context::forget('first_key');\n\n" +"Context::all();\n\n" +"// ['second_key' => 2]" +msgstr "" + +# P +#: ./docs/11.x/context.md:289 +msgid "You may forget several keys at once by providing an array to the `forget` method:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:291 +msgid "Context::forget(['first_key', 'second_key']);" +msgstr "" + +# P +#: ./docs/11.x/context.md:295 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/context.md:296 +msgid "Hidden Context" +msgstr "" + +# P +#: ./docs/11.x/context.md:298 +msgid "Context offers the ability to store \"hidden\" data. This hidden information is not appended to logs, and is not accessible via the data retrieval methods documented above. Context provides a different set of methods to interact with hidden context information:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:300 +msgid "use Illuminate\\Support\\Facades\\Context;\n\n" +"Context::addHidden('key', 'value');\n\n" +"Context::getHidden('key');\n" +"// 'value'\n\n" +"Context::get('key');\n" +"// null" +msgstr "" + +# P +#: ./docs/11.x/context.md:312 +msgid "The \"hidden\" methods mirror the functionality of the non-hidden methods documented above:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:314 +msgid "Context::addHidden(/* ... */);\n" +"Context::addHiddenIf(/* ... */);\n" +"Context::pushHidden(/* ... */);\n" +"Context::getHidden(/* ... */);\n" +"Context::pullHidden(/* ... */);\n" +"Context::popHidden(/* ... */);\n" +"Context::onlyHidden(/* ... */);\n" +"Context::allHidden(/* ... */);\n" +"Context::hasHidden(/* ... */);\n" +"Context::forgetHidden(/* ... */);" +msgstr "" + +# P +#: ./docs/11.x/context.md:327 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/context.md:328 +msgid "Events" +msgstr "" + +# P +#: ./docs/11.x/context.md:330 +msgid "Context dispatches two events that allow you to hook into the hydration and dehydration process of the context." +msgstr "" + +# P +#: ./docs/11.x/context.md:332 +msgid "To illustrate how these events may be used, imagine that in a middleware of your application you set the `app.locale` configuration value based on the incoming HTTP request's `Accept-Language` header. Context's events allow you to capture this value during the request and restore it on the queue, ensuring notifications sent on the queue have the correct `app.locale` value. We can use context's events and [hidden](#hidden-context) data to achieve this, which the following documentation will illustrate." +msgstr "" + +# P +#: ./docs/11.x/context.md:334 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/11.x/context.md:335 +msgid "Dehydrating" +msgstr "" + +# P +#: ./docs/11.x/context.md:337 +msgid "Whenever a job is dispatched to the queue the data in the context is \"dehydrated\" and captured alongside the job's payload. The `Context::dehydrating` method allows you to register a closure that will be invoked during the dehydration process. Within this closure, you may make changes to the data that will be shared with the queued job." +msgstr "" + +# P +#: ./docs/11.x/context.md:339 +msgid "Typically, you should register `dehydrating` callbacks within the `boot` method of your application's `AppServiceProvider` class:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:341 +msgid "use Illuminate\\Log\\Context\\Repository;\n" +"use Illuminate\\Support\\Facades\\Config;\n" +"use Illuminate\\Support\\Facades\\Context;\n\n" +"/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Context::dehydrating(function (Repository $context) {\n" +" $context->addHidden('locale', Config::get('app.locale'));\n" +" });\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/context.md:358 +msgid "You should not use the `Context` facade within the `dehydrating` callback, as that will change the context of the current process. Ensure you only make changes to the repository passed to the callback." +msgstr "" + +# P +#: ./docs/11.x/context.md:360 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/11.x/context.md:361 +msgid "Hydrated" +msgstr "" + +# P +#: ./docs/11.x/context.md:363 +msgid "Whenever a queued job begins executing on the queue, any context that was shared with the job will be \"hydrated\" back into the current context. The `Context::hydrated` method allows you to register a closure that will be invoked during the hydration process." +msgstr "" + +# P +#: ./docs/11.x/context.md:365 +msgid "Typically, you should register `hydrated` callbacks within the `boot` method of your application's `AppServiceProvider` class:" +msgstr "" + +# CODE: php +#: ./docs/11.x/context.md:367 +msgid "use Illuminate\\Log\\Context\\Repository;\n" +"use Illuminate\\Support\\Facades\\Config;\n" +"use Illuminate\\Support\\Facades\\Context;\n\n" +"/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Context::hydrated(function (Repository $context) {\n" +" if ($context->hasHidden('locale')) {\n" +" Config::set('app.locale', $context->getHidden('locale'));\n" +" }\n" +" });\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/context.md:386 +msgid "You should not use the `Context` facade within the `hydrated` callback and instead ensure you only make changes to the repository passed to the callback." +msgstr "" + diff --git a/po/zh_TW/contracts.po b/po/zh_TW/contracts.po index 674359b13..791efa453 100644 --- a/po/zh_TW/contracts.po +++ b/po/zh_TW/contracts.po @@ -10,633 +10,1353 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" +"PO-Revision-Date: 2024-11-30 08:38\n" -#: docs/10.x/contracts.md:block 1 (header) -msgid "Contracts" -msgstr "Contract" - -#: docs/10.x/contracts.md:block 2 (unordered list) -msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" - -#: docs/10.x/contracts.md:block 2 (unordered list) -msgid "[Contracts Vs. Facades](#contracts-vs-facades)" -msgstr "[Contract Vs. Facade](#contracts-vs-facades)" - -#: docs/10.x/contracts.md:block 2 (unordered list) -msgid "[When To Use Contracts](#when-to-use-contracts)" -msgstr "[什麼時候使用 Contract](#when-to-use-contracts)" - -#: docs/10.x/contracts.md:block 2 (unordered list) -msgid "[How To Use Contracts](#how-to-use-contracts)" -msgstr "[如何使用 Contract](#how-to-use-contracts)" - -#: docs/10.x/contracts.md:block 2 (unordered list) -msgid "[Contract Reference](#contract-reference)" -msgstr "[Contract 對照表](#contract-reference)" - -#: docs/10.x/contracts.md:block 4 (header) -msgid "Introduction" -msgstr "簡介" - -#: docs/10.x/contracts.md:block 5 (paragraph) -msgid "Laravel's \"contracts\" are a set of interfaces that define the core services provided by the framework. For example, an `Illuminate\\Contracts\\Queue\\Queue` contract defines the methods needed for queueing jobs, while the `Illuminate\\Contracts\\Mail\\Mailer` contract defines the methods needed for sending e-mail." -msgstr "Laravel 的「Contract」是一組介面,這些介面定義了框架提供的核心服務。舉例來說,`Illuminate\\Contracts\\Queue\\Queue` Contract 定義了佇列任務所需要的方法;而 `Illuminate\\Contracts\\Mail\\Mailer` Contract 則定義了寄送 E-Mail 所需要的方法。" - -#: docs/10.x/contracts.md:block 6 (paragraph) -msgid "Each contract has a corresponding implementation provided by the framework. For example, Laravel provides a queue implementation with a variety of drivers, and a mailer implementation that is powered by [Symfony Mailer](https://symfony.com/doc/6.0/mailer.html)." -msgstr "在 Laravel 中,每個 Contract 都有其相對應的實作。舉例來說,在 Laravel 中的 Queue 實作支援多種 Driver,而 Mailer 實作則由 [Symfony Mailer](https://symfony.com/doc/6.0/mailer.html/) 驅動。" - -#: docs/10.x/contracts.md:block 7 (paragraph) -msgid "All of the Laravel contracts live in [their own GitHub repository](https://github.com/illuminate/contracts). This provides a quick reference point for all available contracts, as well as a single, decoupled package that may be utilized when building packages that interact with Laravel services." -msgstr "所有的 Laravel Contract 都放在 [Contract 自己的 GitHub 儲存庫](https://github.com/illuminate/contracts)內。使用該儲存庫,就可以快速參照到所有的 Contract,並且,在製作使用到 Laravel 服務的套件時,也可以作為一個單一、解藕的套件來使用。" - -#: docs/10.x/contracts.md:block 9 (header) -msgid "Contracts Vs. Facades" -msgstr "Contract Vs. Facade" - -#: docs/10.x/contracts.md:block 10 (paragraph) -msgid "Laravel's [facades](/docs/{{version}}/facades) and helper functions provide a simple way of utilizing Laravel's services without needing to type-hint and resolve contracts out of the service container. In most cases, each facade has an equivalent contract." -msgstr "使用 Laravel 的 [Facade](/docs/{{version}}/facades) 或輔助函式,就可以在不使用型別提示,或是從 Service Container 中解析 Contract 的情況下輕鬆使用各種 Laravel 服務。在大多數的情況下,各個 Facade 都有其對應的 Contract。" - -#: docs/10.x/contracts.md:block 11 (paragraph) -msgid "Unlike facades, which do not require you to require them in your class' constructor, contracts allow you to define explicit dependencies for your classes. Some developers prefer to explicitly define their dependencies in this way and therefore prefer to use contracts, while other developers enjoy the convenience of facades. **In general, most applications can use facades without issue during development.**" -msgstr "使用 Facade 時,不需要在類別的建構函式內要求這些類別。而與 Contract 與 Facade 不同的是,Contract 可以讓你為類別顯式 (Explicitly) 定義其相依性項目。某些開發人員偏好顯式定義相依性項目,因此他們也偏好使用 Contract;而其他開發人員則比較享受 Facade 帶來的方便性。**一般來說,大多數專案在開發期間都可以使用 Facade 而不會遇到問題。**" - -#: docs/10.x/contracts.md:block 13 (header) -msgid "When To Use Contracts" -msgstr "什麼時候使用 Contract" - -#: docs/10.x/contracts.md:block 14 (paragraph) -msgid "The decision to use contracts or facades will come down to personal taste and the tastes of your development team. Both contracts and facades can be used to create robust, well-tested Laravel applications. Contracts and facades are not mutually exclusive. Some parts of your applications may use facades while others depend on contracts. As long as you are keeping your class' responsibilities focused, you will notice very few practical differences between using contracts and facades." -msgstr "要決定使用 Contract 還是 Facade,取決於個人以及開發團隊的偏好。不論使用 Contract 還是 Facade,在 Laravel 中都可獲得相同的強健性與可測試性。Contract 與 Facade 並非互斥。你可以在專案中某些部分使用 Facade、其他部分則使用 Contract。只要能保持類別的職責專一,使用 Contract 或 Facade 基本上就沒什麼差別。" - -#: docs/10.x/contracts.md:block 15 (paragraph) -msgid "In general, most applications can use facades without issue during development. If you are building a package that integrates with multiple PHP frameworks you may wish to use the `illuminate/contracts` package to define your integration with Laravel's services without the need to require Laravel's concrete implementations in your package's `composer.json` file." -msgstr "通常來說,在開發期間,使用 Facade 對於大多數的專案來說都不會遇到什麼問題。不過若你在做的是會整合多個 PHP 框架的套件,則可以使用 `illuminate/contracts` 套件來定義與 Laravel 服務的整合。不需要在套件的 `composer.json` 檔中 require 整個 Laravel 的實際 (Concrete) 實作。" - -#: docs/10.x/contracts.md:block 17 (header) -msgid "How To Use Contracts" -msgstr "如何使用 Contract" - -#: docs/10.x/contracts.md:block 18 (paragraph) -msgid "So, how do you get an implementation of a contract? It's actually quite simple." -msgstr "那麼,如何取得某個 Contract 的實作呢?其實很簡單。" - -#: docs/10.x/contracts.md:block 19 (paragraph) -msgid "Many types of classes in Laravel are resolved through the [service container](/docs/{{version}}/container), including controllers, event listeners, middleware, queued jobs, and even route closures. So, to get an implementation of a contract, you can just \"type-hint\" the interface in the constructor of the class being resolved." -msgstr "在 Laravel 中,許多類型的類別都會通過 [Service Container](/docs/{{version}}/container) 來解析。包含 Controller、Event Listener、Middleware、放入佇列的 Job、甚至是 Route 閉包。因此,若要取得一個 Contract 的實作,只需要在被解析類別的 Contractor 上對介面進行「型別提示 (Type-Hint)」即可。" - -#: docs/10.x/contracts.md:block 20 (paragraph) -msgid "For example, take a look at this event listener:" -msgstr "舉例來說,來看看這個 Event Listner:" - -#: docs/10.x/contracts.md:block 21 (code) -msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/contracts.md:10 +#: ./docs/9.x/contracts.md:10 +#: ./docs/10.x/contracts.md:10 +#: ./docs/11.x/contracts.md:10 +#: ./docs/master/contracts.md:10 +msgid "Introduction" +msgstr "" + +# P +#: ./docs/8.x/contracts.md:12 +#: ./docs/9.x/contracts.md:12 +#: ./docs/10.x/contracts.md:12 +#: ./docs/11.x/contracts.md:12 +#: ./docs/master/contracts.md:12 +msgid "Laravel's \"contracts\" are a set of interfaces that define the core services provided by the framework. For example, an `Illuminate\\Contracts\\Queue\\Queue` contract defines the methods needed for queueing jobs, while the `Illuminate\\Contracts\\Mail\\Mailer` contract defines the methods needed for sending e-mail." +msgstr "" + +# P +#: ./docs/11.x/contracts.md:14 +#: ./docs/master/contracts.md:14 +msgid "Each contract has a corresponding implementation provided by the framework. For example, Laravel provides a queue implementation with a variety of drivers, and a mailer implementation that is powered by [Symfony Mailer](https://symfony.com/doc/7.0/mailer.html)." +msgstr "" -#: docs/8.x/contracts.md:block 6 (paragraph) +# P +#: ./docs/8.x/contracts.md:14 msgid "Each contract has a corresponding implementation provided by the framework. For example, Laravel provides a queue implementation with a variety of drivers, and a mailer implementation that is powered by [SwiftMailer](https://swiftmailer.symfony.com/)." -msgstr "各個 Contract 在 Laravel 中都有相對應的實作。舉例來說,Laravel 提供中有支援各個 Driver 的佇列實作,以及一個由 [SwiftMailer](https://swiftmailer.symfony.com/) 驅動的 Mailer 實作。" +msgstr "" + +# P +#: ./docs/9.x/contracts.md:14 +#: ./docs/10.x/contracts.md:14 +msgid "Each contract has a corresponding implementation provided by the framework. For example, Laravel provides a queue implementation with a variety of drivers, and a mailer implementation that is powered by [Symfony Mailer](https://symfony.com/doc/6.0/mailer.html)." +msgstr "" + +# P +#: ./docs/8.x/contracts.md:16 +#: ./docs/9.x/contracts.md:16 +#: ./docs/10.x/contracts.md:16 +#: ./docs/11.x/contracts.md:16 +#: ./docs/master/contracts.md:16 +msgid "All of the Laravel contracts live in [their own GitHub repository](https://github.com/illuminate/contracts). This provides a quick reference point for all available contracts, as well as a single, decoupled package that may be utilized when building packages that interact with Laravel services." +msgstr "" + +# P +#: ./docs/8.x/contracts.md:18 +#: ./docs/9.x/contracts.md:18 +#: ./docs/10.x/contracts.md:18 +#: ./docs/11.x/contracts.md:18 +#: ./docs/master/contracts.md:18 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/contracts.md:19 +#: ./docs/11.x/contracts.md:19 +#: ./docs/master/contracts.md:19 +msgid "Contracts vs. Facades" +msgstr "" + +# H3 +#: ./docs/8.x/contracts.md:19 +#: ./docs/9.x/contracts.md:19 +msgid "Contracts Vs. Facades" +msgstr "" + +# P +#: ./docs/8.x/contracts.md:21 +#: ./docs/9.x/contracts.md:21 +#: ./docs/10.x/contracts.md:21 +#: ./docs/11.x/contracts.md:21 +#: ./docs/master/contracts.md:21 +msgid "Laravel's [facades](/docs/{{version}}/facades) and helper functions provide a simple way of utilizing Laravel's services without needing to type-hint and resolve contracts out of the service container. In most cases, each facade has an equivalent contract." +msgstr "" + +# P +#: ./docs/8.x/contracts.md:23 +#: ./docs/9.x/contracts.md:23 +#: ./docs/10.x/contracts.md:23 +#: ./docs/11.x/contracts.md:23 +#: ./docs/master/contracts.md:23 +msgid "Unlike facades, which do not require you to require them in your class' constructor, contracts allow you to define explicit dependencies for your classes. Some developers prefer to explicitly define their dependencies in this way and therefore prefer to use contracts, while other developers enjoy the convenience of facades. **In general, most applications can use facades without issue during development.**" +msgstr "" + +# P +#: ./docs/8.x/contracts.md:25 +#: ./docs/9.x/contracts.md:25 +#: ./docs/10.x/contracts.md:25 +#: ./docs/11.x/contracts.md:25 +#: ./docs/master/contracts.md:25 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/contracts.md:26 +#: ./docs/11.x/contracts.md:26 +#: ./docs/master/contracts.md:26 +msgid "When to Use Contracts" +msgstr "" + +# H2 +#: ./docs/8.x/contracts.md:26 +#: ./docs/9.x/contracts.md:26 +msgid "When To Use Contracts" +msgstr "" + +# P +#: ./docs/8.x/contracts.md:28 +#: ./docs/9.x/contracts.md:28 +#: ./docs/10.x/contracts.md:28 +#: ./docs/11.x/contracts.md:28 +#: ./docs/master/contracts.md:28 +msgid "The decision to use contracts or facades will come down to personal taste and the tastes of your development team. Both contracts and facades can be used to create robust, well-tested Laravel applications. Contracts and facades are not mutually exclusive. Some parts of your applications may use facades while others depend on contracts. As long as you are keeping your class' responsibilities focused, you will notice very few practical differences between using contracts and facades." +msgstr "" + +# P +#: ./docs/8.x/contracts.md:30 +#: ./docs/9.x/contracts.md:30 +#: ./docs/10.x/contracts.md:30 +#: ./docs/11.x/contracts.md:30 +#: ./docs/master/contracts.md:30 +msgid "In general, most applications can use facades without issue during development. If you are building a package that integrates with multiple PHP frameworks you may wish to use the `illuminate/contracts` package to define your integration with Laravel's services without the need to require Laravel's concrete implementations in your package's `composer.json` file." +msgstr "" + +# P +#: ./docs/8.x/contracts.md:32 +#: ./docs/9.x/contracts.md:32 +#: ./docs/10.x/contracts.md:32 +#: ./docs/11.x/contracts.md:32 +#: ./docs/master/contracts.md:32 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/contracts.md:33 +#: ./docs/11.x/contracts.md:33 +#: ./docs/master/contracts.md:33 +msgid "How to Use Contracts" +msgstr "" + +# H2 +#: ./docs/8.x/contracts.md:33 +#: ./docs/9.x/contracts.md:33 +msgid "How To Use Contracts" +msgstr "" + +# P +#: ./docs/8.x/contracts.md:35 +#: ./docs/9.x/contracts.md:35 +#: ./docs/10.x/contracts.md:35 +#: ./docs/11.x/contracts.md:35 +#: ./docs/master/contracts.md:35 +msgid "So, how do you get an implementation of a contract? It's actually quite simple." +msgstr "" + +# P +#: ./docs/8.x/contracts.md:37 +#: ./docs/9.x/contracts.md:37 +#: ./docs/10.x/contracts.md:37 +#: ./docs/11.x/contracts.md:37 +#: ./docs/master/contracts.md:37 +msgid "Many types of classes in Laravel are resolved through the [service container](/docs/{{version}}/container), including controllers, event listeners, middleware, queued jobs, and even route closures. So, to get an implementation of a contract, you can just \"type-hint\" the interface in the constructor of the class being resolved." +msgstr "" -#: docs/8.x/contracts.md:block 21 (code) +# P +#: ./docs/8.x/contracts.md:39 +#: ./docs/9.x/contracts.md:39 +#: ./docs/10.x/contracts.md:39 +#: ./docs/11.x/contracts.md:39 +#: ./docs/master/contracts.md:39 +msgid "For example, take a look at this event listener:" +msgstr "" + +# CODE +#: ./docs/10.x/contracts.md:41 +#: ./docs/11.x/contracts.md:41 +#: ./docs/master/contracts.md:41 msgid "redis = $redis;\n" -" }\n\n" +" public function __construct(\n" +" protected Factory $redis,\n" +" ) {}\n\n" " /**\n" " * Handle the event.\n" -" *\n" -" * @param \\App\\Events\\OrderWasPlaced $event\n" -" * @return void\n" " */\n" -" public function handle(OrderWasPlaced $event)\n" +" public function handle(OrderWasPlaced $event): void\n" " {\n" -" //\n" +" // ...\n" " }\n" -"}\n" -msgstr "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/contracts.md:84 +#: ./docs/9.x/contracts.md:84 +#: ./docs/10.x/contracts.md:70 +#: ./docs/11.x/contracts.md:70 +#: ./docs/master/contracts.md:70 +msgid "Contract Reference" +msgstr "" + +# P +#: ./docs/8.x/contracts.md:86 +#: ./docs/9.x/contracts.md:86 +#: ./docs/10.x/contracts.md:72 +#: ./docs/11.x/contracts.md:72 +#: ./docs/master/contracts.md:72 +msgid "This table provides a quick reference to all of the Laravel contracts and their equivalent facades:" +msgstr "" diff --git a/po/zh_TW/contributions.po b/po/zh_TW/contributions.po index 03d954e8a..d55246d31 100644 --- a/po/zh_TW/contributions.po +++ b/po/zh_TW/contributions.po @@ -10,269 +10,713 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" - -#: docs/10.x/contributions.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H1 +#: ./docs/8.x/contributions.md:1 +#: ./docs/9.x/contributions.md:1 +#: ./docs/10.x/contributions.md:1 +#: ./docs/11.x/contributions.md:1 +#: ./docs/master/contributions.md:1 msgid "Contribution Guide" -msgstr "參與貢獻指南" +msgstr "" -#: docs/10.x/contributions.md:block 2 (unordered list) +# P +#: ./docs/8.x/contributions.md:3 +#: ./docs/9.x/contributions.md:3 +#: ./docs/10.x/contributions.md:3 +#: ./docs/11.x/contributions.md:3 +#: ./docs/master/contributions.md:3 msgid "[Bug Reports](#bug-reports)" -msgstr "[Bug 回報](#bug-reports)" +msgstr "" -#: docs/10.x/contributions.md:block 2 (unordered list) +# P +#: ./docs/8.x/contributions.md:4 +#: ./docs/9.x/contributions.md:4 +#: ./docs/10.x/contributions.md:4 +#: ./docs/11.x/contributions.md:4 +#: ./docs/master/contributions.md:4 msgid "[Support Questions](#support-questions)" -msgstr "[支援提問](#support-questions)" +msgstr "" -#: docs/10.x/contributions.md:block 2 (unordered list) +# P +#: ./docs/8.x/contributions.md:5 +#: ./docs/9.x/contributions.md:5 +#: ./docs/10.x/contributions.md:5 +#: ./docs/11.x/contributions.md:5 +#: ./docs/master/contributions.md:5 msgid "[Core Development Discussion](#core-development-discussion)" -msgstr "[核心開發討論](#core-development-discussion)" +msgstr "" -#: docs/10.x/contributions.md:block 2 (unordered list) +# P +#: ./docs/8.x/contributions.md:6 +#: ./docs/9.x/contributions.md:6 +#: ./docs/10.x/contributions.md:6 +#: ./docs/11.x/contributions.md:6 +#: ./docs/master/contributions.md:6 msgid "[Which Branch?](#which-branch)" -msgstr "[要用哪個分支?](#which-branch)" +msgstr "" -#: docs/10.x/contributions.md:block 2 (unordered list) +# P +#: ./docs/8.x/contributions.md:7 +#: ./docs/9.x/contributions.md:7 +#: ./docs/10.x/contributions.md:7 +#: ./docs/11.x/contributions.md:7 +#: ./docs/master/contributions.md:7 msgid "[Compiled Assets](#compiled-assets)" -msgstr "[編譯素材](#compiled-assets)" +msgstr "" -#: docs/10.x/contributions.md:block 2 (unordered list) +# P +#: ./docs/8.x/contributions.md:8 +#: ./docs/9.x/contributions.md:8 +#: ./docs/10.x/contributions.md:8 +#: ./docs/11.x/contributions.md:8 +#: ./docs/master/contributions.md:8 msgid "[Security Vulnerabilities](#security-vulnerabilities)" -msgstr "[安全性漏洞](#security-vulnerabilities)" +msgstr "" -#: docs/10.x/contributions.md:block 2 (unordered list) +# P +#: ./docs/8.x/contributions.md:9 +#: ./docs/9.x/contributions.md:9 +#: ./docs/10.x/contributions.md:9 +#: ./docs/11.x/contributions.md:9 +#: ./docs/master/contributions.md:9 msgid "[Coding Style](#coding-style)" -msgstr "[Coding Style](#coding-style)" +msgstr "" -#: docs/10.x/contributions.md:block 2 (unordered list) +# P +#: ./docs/8.x/contributions.md:10 +#: ./docs/9.x/contributions.md:10 +#: ./docs/10.x/contributions.md:10 +#: ./docs/11.x/contributions.md:10 +#: ./docs/master/contributions.md:10 msgid "[PHPDoc](#phpdoc)" -msgstr "[PHPDoc](#phpdoc)" +msgstr "" -#: docs/10.x/contributions.md:block 2 (unordered list) +# P +#: ./docs/8.x/contributions.md:11 +#: ./docs/9.x/contributions.md:11 +#: ./docs/10.x/contributions.md:11 +#: ./docs/11.x/contributions.md:11 +#: ./docs/master/contributions.md:11 msgid "[StyleCI](#styleci)" -msgstr "[StyleCI](#styleci)" +msgstr "" -#: docs/10.x/contributions.md:block 2 (unordered list) +# P +#: ./docs/8.x/contributions.md:12 +#: ./docs/9.x/contributions.md:12 +#: ./docs/10.x/contributions.md:12 +#: ./docs/11.x/contributions.md:12 +#: ./docs/master/contributions.md:12 msgid "[Code of Conduct](#code-of-conduct)" -msgstr "[行為準則 - Code of Conduct](#code-of-conduct)" +msgstr "" -#: docs/10.x/contributions.md:block 4 (header) +# P +#: ./docs/8.x/contributions.md:14 +#: ./docs/9.x/contributions.md:14 +#: ./docs/10.x/contributions.md:14 +#: ./docs/11.x/contributions.md:14 +#: ./docs/master/contributions.md:14 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/contributions.md:15 +#: ./docs/9.x/contributions.md:15 +#: ./docs/10.x/contributions.md:15 +#: ./docs/11.x/contributions.md:15 +#: ./docs/master/contributions.md:15 msgid "Bug Reports" -msgstr "Bug 回報" +msgstr "" + +# P +#: ./docs/8.x/contributions.md:17 +msgid "To encourage active collaboration, Laravel strongly encourages pull requests, not just bug reports. \"Bug reports\" may also be sent in the form of a pull request containing a failing test. Pull requests will only be reviewed when marked as \"ready for review\" (not in the \"draft\" state) and all tests for new features are passing. Lingering, non-active pull requests left in the \"draft\" state will be closed after a few days." +msgstr "" -#: docs/10.x/contributions.md:block 5 (paragraph) +# P +#: ./docs/9.x/contributions.md:17 +#: ./docs/10.x/contributions.md:17 +#: ./docs/11.x/contributions.md:17 +#: ./docs/master/contributions.md:17 msgid "To encourage active collaboration, Laravel strongly encourages pull requests, not just bug reports. Pull requests will only be reviewed when marked as \"ready for review\" (not in the \"draft\" state) and all tests for new features are passing. Lingering, non-active pull requests left in the \"draft\" state will be closed after a few days." -msgstr "為了鼓勵活躍的社群協作,因此 Laravel 不建議只進行 Bug 回報,更強烈建議大家提供 Pull Request。Pull Request 只有在標註為「Ready for review (可供檢閱)」 (即不在「Draft (草稿)」狀態) 且新功能的所有測試例都通過時才會被檢閱。長期放置、非活躍的「Draft」 Pull Request 會在幾天內被關閉。" +msgstr "" -#: docs/10.x/contributions.md:block 6 (paragraph) +# P +#: ./docs/8.x/contributions.md:19 +#: ./docs/9.x/contributions.md:19 +#: ./docs/10.x/contributions.md:19 +#: ./docs/11.x/contributions.md:19 +#: ./docs/master/contributions.md:19 msgid "However, if you file a bug report, your issue should contain a title and a clear description of the issue. You should also include as much relevant information as possible and a code sample that demonstrates the issue. The goal of a bug report is to make it easy for yourself - and others - to replicate the bug and develop a fix." -msgstr "不過,若要提出 Bug 回報,則 Issue 內應包含標題以及對該問題的清楚敘述。也應儘可能提供相關資訊、以及能展示此問題的範例程式碼。Bug 回報的目標就是要能讓你自己 —— 以及其他人 —— 能重現此 Bug 並著手修正。" +msgstr "" -#: docs/10.x/contributions.md:block 7 (paragraph) +# P +#: ./docs/8.x/contributions.md:21 +#: ./docs/9.x/contributions.md:21 +#: ./docs/10.x/contributions.md:21 +#: ./docs/11.x/contributions.md:21 +#: ./docs/master/contributions.md:21 msgid "Remember, bug reports are created in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the bug report will automatically see any activity or that others will jump to fix it. Creating a bug report serves to help yourself and others start on the path of fixing the problem. If you want to chip in, you can help out by fixing [any bugs listed in our issue trackers](https://github.com/issues?q=is%3Aopen+is%3Aissue+label%3Abug+user%3Alaravel). You must be authenticated with GitHub to view all of Laravel's issues." -msgstr "請記得,進行 Bug 回報的目的是為了能讓其他有相同問題的人能與你一起協作來解決此問題。請不要覺得回報了 Bug 後,該 Bug 就會自動吸引到人,或是就有人自動來修正此 Bug。回報 Bug 是為了幫助你自己以及其他人能作為修正問題的出發點。若你想參與,可以協助修正[任何列在我們 Issue Tracker 上的 Bug](https://github.com/issues?q=is%3Aopen+is%3Aissue+label%3Abug+user%3Alaravel)。你必須先登入 GitHub 才能檢視所有的 Laravel Issue。" +msgstr "" -#: docs/10.x/contributions.md:block 8 (paragraph) +# P +#: ./docs/10.x/contributions.md:23 +#: ./docs/11.x/contributions.md:23 +#: ./docs/master/contributions.md:23 msgid "If you notice improper DocBlock, PHPStan, or IDE warnings while using Laravel, do not create a GitHub issue. Instead, please submit a pull request to fix the problem." -msgstr "若使用 Laravel 時注意到有關不適當的 DocBlock、PHPStan、或 IDE 警告,請不要建立新的 GitHub Issue。請建立 Pull Request 來修正此問題。" +msgstr "" -#: docs/10.x/contributions.md:block 9 (paragraph) +# P +#: ./docs/8.x/contributions.md:23 +#: ./docs/9.x/contributions.md:23 +#: ./docs/10.x/contributions.md:25 +#: ./docs/11.x/contributions.md:25 +#: ./docs/master/contributions.md:25 msgid "The Laravel source code is managed on GitHub, and there are repositories for each of the Laravel projects:" -msgstr "Laravel 的原始碼託管於 GitHub,而各個 Laravel 專案都有各自的儲存庫:" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:27 +#: ./docs/9.x/contributions.md:27 +#: ./docs/10.x/contributions.md:29 +#: ./docs/11.x/contributions.md:29 +#: ./docs/master/contributions.md:29 msgid "[Laravel Application](https://github.com/laravel/laravel)" -msgstr "[Laravel Application](https://github.com/laravel/laravel)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:28 +#: ./docs/9.x/contributions.md:28 +#: ./docs/10.x/contributions.md:30 +#: ./docs/11.x/contributions.md:30 +#: ./docs/master/contributions.md:30 msgid "[Laravel Art](https://github.com/laravel/art)" -msgstr "[Laravel Art](https://github.com/laravel/art)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:29 +#: ./docs/9.x/contributions.md:29 +#: ./docs/10.x/contributions.md:31 +#: ./docs/11.x/contributions.md:32 +#: ./docs/master/contributions.md:31 msgid "[Laravel Documentation](https://github.com/laravel/docs)" -msgstr "[Laravel 說明文件](https://github.com/laravel/docs)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:30 +#: ./docs/9.x/contributions.md:30 +#: ./docs/10.x/contributions.md:32 +#: ./docs/11.x/contributions.md:33 +#: ./docs/master/contributions.md:32 msgid "[Laravel Dusk](https://github.com/laravel/dusk)" -msgstr "[Laravel Dusk](https://github.com/laravel/dusk)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/11.x/contributions.md:31 +msgid "[Laravel Breeze](https://github.com/laravel/breeze)" +msgstr "" + +# P +#: ./docs/8.x/contributions.md:31 +#: ./docs/9.x/contributions.md:31 +#: ./docs/10.x/contributions.md:33 +#: ./docs/11.x/contributions.md:34 +#: ./docs/master/contributions.md:33 msgid "[Laravel Cashier Stripe](https://github.com/laravel/cashier)" -msgstr "[Laravel Cashier Stripe](https://github.com/laravel/cashier)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:32 +#: ./docs/9.x/contributions.md:32 +#: ./docs/10.x/contributions.md:34 +#: ./docs/11.x/contributions.md:35 +#: ./docs/master/contributions.md:34 msgid "[Laravel Cashier Paddle](https://github.com/laravel/cashier-paddle)" -msgstr "[Laravel Cashier Paddle](https://github.com/laravel/cashier-paddle)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:33 +#: ./docs/9.x/contributions.md:33 +#: ./docs/10.x/contributions.md:35 +#: ./docs/11.x/contributions.md:36 +#: ./docs/master/contributions.md:35 msgid "[Laravel Echo](https://github.com/laravel/echo)" -msgstr "[Laravel Echo](https://github.com/laravel/echo)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:34 +#: ./docs/9.x/contributions.md:34 +#: ./docs/10.x/contributions.md:36 +#: ./docs/11.x/contributions.md:37 +#: ./docs/master/contributions.md:36 msgid "[Laravel Envoy](https://github.com/laravel/envoy)" -msgstr "[Laravel Envoy](https://github.com/laravel/envoy)" - -#: docs/10.x/contributions.md:block 11 (unordered list) -msgid "[Laravel Folio](https://github.com/laravel/folio)" -msgstr "[Laravel Folio](https://github.com/laravel/folio)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:35 +#: ./docs/9.x/contributions.md:35 +#: ./docs/10.x/contributions.md:38 +#: ./docs/11.x/contributions.md:39 +#: ./docs/master/contributions.md:38 msgid "[Laravel Framework](https://github.com/laravel/framework)" -msgstr "[Laravel Framework](https://github.com/laravel/framework)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:36 +#: ./docs/9.x/contributions.md:36 +#: ./docs/10.x/contributions.md:39 +#: ./docs/master/contributions.md:39 msgid "[Laravel Homestead](https://github.com/laravel/homestead)" -msgstr "[Laravel Homestead](https://github.com/laravel/homestead)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/10.x/contributions.md:37 +#: ./docs/11.x/contributions.md:38 +#: ./docs/master/contributions.md:37 +msgid "[Laravel Folio](https://github.com/laravel/folio)" +msgstr "" + +# P +#: ./docs/8.x/contributions.md:37 +#: ./docs/9.x/contributions.md:37 +#: ./docs/10.x/contributions.md:40 +#: ./docs/master/contributions.md:40 msgid "[Laravel Homestead Build Scripts](https://github.com/laravel/settler)" -msgstr "[Laravel Homestead 的建置 Script](https://github.com/laravel/settler)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:38 +#: ./docs/9.x/contributions.md:38 +#: ./docs/10.x/contributions.md:41 +#: ./docs/11.x/contributions.md:41 +#: ./docs/master/contributions.md:41 msgid "[Laravel Horizon](https://github.com/laravel/horizon)" -msgstr "[Laravel Horizon](https://github.com/laravel/horizon)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:39 +#: ./docs/9.x/contributions.md:39 +#: ./docs/10.x/contributions.md:42 +#: ./docs/11.x/contributions.md:42 +#: ./docs/master/contributions.md:42 msgid "[Laravel Jetstream](https://github.com/laravel/jetstream)" -msgstr "[Laravel Jetstream](https://github.com/laravel/jetstream)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/11.x/contributions.md:40 +msgid "[Laravel Homestead](https://github.com/laravel/homestead) ([Build Scripts](https://github.com/laravel/settler))" +msgstr "" + +# P +#: ./docs/8.x/contributions.md:40 +#: ./docs/9.x/contributions.md:40 +#: ./docs/10.x/contributions.md:43 +#: ./docs/11.x/contributions.md:43 +#: ./docs/master/contributions.md:43 msgid "[Laravel Passport](https://github.com/laravel/passport)" -msgstr "[Laravel Passport](https://github.com/laravel/passport)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) -msgid "[Laravel Pennant](https://github.com/laravel/pennant)" -msgstr "[Laravel Pennant](https://github.com/laravel/pennant)" +# P +#: ./docs/8.x/contributions.md:41 +#: ./docs/9.x/contributions.md:42 +#: ./docs/10.x/contributions.md:47 +#: ./docs/11.x/contributions.md:48 +#: ./docs/master/contributions.md:47 +msgid "[Laravel Sail](https://github.com/laravel/sail)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/9.x/contributions.md:41 +#: ./docs/10.x/contributions.md:45 +#: ./docs/11.x/contributions.md:45 +#: ./docs/master/contributions.md:45 msgid "[Laravel Pint](https://github.com/laravel/pint)" -msgstr "[Laravel Pint](https://github.com/laravel/pint)" - -#: docs/10.x/contributions.md:block 11 (unordered list) -msgid "[Laravel Prompts](https://github.com/laravel/prompts)" -msgstr "[Laravel Prompts](https://github.com/laravel/prompts)" - -#: docs/10.x/contributions.md:block 11 (unordered list) -msgid "[Laravel Sail](https://github.com/laravel/sail)" -msgstr "[Laravel Sail](https://github.com/laravel/sail)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:42 +#: ./docs/9.x/contributions.md:43 +#: ./docs/10.x/contributions.md:48 +#: ./docs/11.x/contributions.md:49 +#: ./docs/master/contributions.md:48 msgid "[Laravel Sanctum](https://github.com/laravel/sanctum)" -msgstr "[Laravel Sanctum](https://github.com/laravel/sanctum)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:43 +#: ./docs/9.x/contributions.md:44 +#: ./docs/10.x/contributions.md:49 +#: ./docs/11.x/contributions.md:50 +#: ./docs/master/contributions.md:49 msgid "[Laravel Scout](https://github.com/laravel/scout)" -msgstr "[Laravel Scout](https://github.com/laravel/scout)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/10.x/contributions.md:44 +#: ./docs/11.x/contributions.md:44 +#: ./docs/master/contributions.md:44 +msgid "[Laravel Pennant](https://github.com/laravel/pennant)" +msgstr "" + +# P +#: ./docs/8.x/contributions.md:44 +#: ./docs/9.x/contributions.md:45 +#: ./docs/10.x/contributions.md:50 +#: ./docs/11.x/contributions.md:51 +#: ./docs/master/contributions.md:50 msgid "[Laravel Socialite](https://github.com/laravel/socialite)" -msgstr "[Laravel Socialite](https://github.com/laravel/socialite)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:45 +#: ./docs/9.x/contributions.md:46 +#: ./docs/10.x/contributions.md:51 +#: ./docs/11.x/contributions.md:52 +#: ./docs/master/contributions.md:51 msgid "[Laravel Telescope](https://github.com/laravel/telescope)" -msgstr "[Laravel Telescope](https://github.com/laravel/telescope)" +msgstr "" + +# P +#: ./docs/10.x/contributions.md:46 +#: ./docs/11.x/contributions.md:46 +#: ./docs/master/contributions.md:46 +msgid "[Laravel Prompts](https://github.com/laravel/prompts)" +msgstr "" -#: docs/10.x/contributions.md:block 11 (unordered list) +# P +#: ./docs/8.x/contributions.md:46 +#: ./docs/9.x/contributions.md:47 +#: ./docs/10.x/contributions.md:52 +#: ./docs/master/contributions.md:52 msgid "[Laravel Website](https://github.com/laravel/laravel.com-next)" -msgstr "[Laravel 網站](https://github.com/laravel/laravel.com-next)" +msgstr "" + +# P +#: ./docs/11.x/contributions.md:47 +msgid "[Laravel Reverb](https://github.com/laravel/reverb)" +msgstr "" -#: docs/10.x/contributions.md:block 14 (header) +# P +#: ./docs/8.x/contributions.md:50 +#: ./docs/9.x/contributions.md:51 +#: ./docs/10.x/contributions.md:56 +#: ./docs/11.x/contributions.md:57 +#: ./docs/master/contributions.md:56 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/contributions.md:51 +#: ./docs/9.x/contributions.md:52 +#: ./docs/10.x/contributions.md:57 +#: ./docs/11.x/contributions.md:58 +#: ./docs/master/contributions.md:57 msgid "Support Questions" -msgstr "支援提問" +msgstr "" -#: docs/10.x/contributions.md:block 15 (paragraph) +# P +#: ./docs/11.x/contributions.md:53 +msgid "[Laravel Website](https://github.com/laravel/laravel.com)" +msgstr "" + +# P +#: ./docs/8.x/contributions.md:53 +#: ./docs/9.x/contributions.md:54 +#: ./docs/10.x/contributions.md:59 +#: ./docs/11.x/contributions.md:60 +#: ./docs/master/contributions.md:59 msgid "Laravel's GitHub issue trackers are not intended to provide Laravel help or support. Instead, use one of the following channels:" -msgstr "Laravel 的 GitHub Issue Tracker 並不是用來提供 Laravel 說明或協助的。請改用下列其中一種管道:" +msgstr "" -#: docs/10.x/contributions.md:block 17 (unordered list) +# P +#: ./docs/8.x/contributions.md:57 +#: ./docs/9.x/contributions.md:58 +#: ./docs/10.x/contributions.md:63 +#: ./docs/11.x/contributions.md:64 +#: ./docs/master/contributions.md:63 msgid "[GitHub Discussions](https://github.com/laravel/framework/discussions)" -msgstr "[GitHub Discussions](https://github.com/laravel/framework/discussions)" +msgstr "" -#: docs/10.x/contributions.md:block 17 (unordered list) +# P +#: ./docs/8.x/contributions.md:58 +#: ./docs/9.x/contributions.md:59 +#: ./docs/10.x/contributions.md:64 +#: ./docs/11.x/contributions.md:65 +#: ./docs/master/contributions.md:64 msgid "[Laracasts Forums](https://laracasts.com/discuss)" -msgstr "[Laracasts 討論區](https://laracasts.com/discuss)" +msgstr "" -#: docs/10.x/contributions.md:block 17 (unordered list) +# P +#: ./docs/8.x/contributions.md:59 +#: ./docs/9.x/contributions.md:60 +#: ./docs/10.x/contributions.md:65 +#: ./docs/11.x/contributions.md:66 +#: ./docs/master/contributions.md:65 msgid "[Laravel.io Forums](https://laravel.io/forum)" -msgstr "[Laravel.io 討論區](https://laravel.io/forum)" +msgstr "" -#: docs/10.x/contributions.md:block 17 (unordered list) +# P +#: ./docs/8.x/contributions.md:60 +#: ./docs/9.x/contributions.md:61 +#: ./docs/10.x/contributions.md:66 +#: ./docs/11.x/contributions.md:67 +#: ./docs/master/contributions.md:66 msgid "[StackOverflow](https://stackoverflow.com/questions/tagged/laravel)" -msgstr "[StackOverflow](https://stackoverflow.com/questions/tagged/laravel)" +msgstr "" -#: docs/10.x/contributions.md:block 17 (unordered list) +# P +#: ./docs/8.x/contributions.md:61 +#: ./docs/9.x/contributions.md:62 +#: ./docs/10.x/contributions.md:67 +#: ./docs/11.x/contributions.md:68 +#: ./docs/master/contributions.md:67 msgid "[Discord](https://discord.gg/laravel)" -msgstr "[Discord](https://discord.gg/laravel)" +msgstr "" -#: docs/10.x/contributions.md:block 17 (unordered list) +# P +#: ./docs/8.x/contributions.md:62 +#: ./docs/9.x/contributions.md:63 +#: ./docs/10.x/contributions.md:68 +#: ./docs/11.x/contributions.md:69 +#: ./docs/master/contributions.md:68 msgid "[Larachat](https://larachat.co)" -msgstr "[Larachat](https://larachat.co)" +msgstr "" -#: docs/10.x/contributions.md:block 17 (unordered list) +# P +#: ./docs/8.x/contributions.md:63 +#: ./docs/9.x/contributions.md:64 +#: ./docs/10.x/contributions.md:69 +#: ./docs/11.x/contributions.md:70 +#: ./docs/master/contributions.md:69 msgid "[IRC](https://web.libera.chat/?nick=artisan&channels=#laravel)" -msgstr "[IRC](https://web.libera.chat/?nick=artisan&channels=#laravel)" +msgstr "" -#: docs/10.x/contributions.md:block 20 (header) +# P +#: ./docs/8.x/contributions.md:67 +#: ./docs/9.x/contributions.md:68 +#: ./docs/10.x/contributions.md:73 +#: ./docs/11.x/contributions.md:74 +#: ./docs/master/contributions.md:73 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/contributions.md:68 +#: ./docs/9.x/contributions.md:69 +#: ./docs/10.x/contributions.md:74 +#: ./docs/11.x/contributions.md:75 +#: ./docs/master/contributions.md:74 msgid "Core Development Discussion" -msgstr "核心開發討論" +msgstr "" -#: docs/10.x/contributions.md:block 21 (paragraph) +# P +#: ./docs/8.x/contributions.md:70 +#: ./docs/9.x/contributions.md:71 +#: ./docs/10.x/contributions.md:76 +#: ./docs/11.x/contributions.md:77 +#: ./docs/master/contributions.md:76 msgid "You may propose new features or improvements of existing Laravel behavior in the Laravel framework repository's [GitHub discussion board](https://github.com/laravel/framework/discussions). If you propose a new feature, please be willing to implement at least some of the code that would be needed to complete the feature." -msgstr "可以在 Laravel 框架存放庫的 [GitHub Discussion Board](https://github.com/laravel/framework/discussions) 上提議新功能或是改進現有的 Laravel 行為。若要提議新功能,請至少準備好要能實作完成此功能所需的部分程式碼。" +msgstr "" -#: docs/10.x/contributions.md:block 22 (paragraph) +# P +#: ./docs/8.x/contributions.md:72 +#: ./docs/9.x/contributions.md:73 +#: ./docs/10.x/contributions.md:78 +#: ./docs/11.x/contributions.md:79 +#: ./docs/master/contributions.md:78 msgid "Informal discussion regarding bugs, new features, and implementation of existing features takes place in the `#internals` channel of the [Laravel Discord server](https://discord.gg/laravel). Taylor Otwell, the maintainer of Laravel, is typically present in the channel on weekdays from 8am-5pm (UTC-06:00 or America/Chicago), and sporadically present in the channel at other times." -msgstr "有關 Bug、新功能、以及現有功能實作的一些比較不正式的討論,會在 [Laravel 的 Discord Server](https://discord.gg/laravel)上的 `#internals` 頻道內進行。Taylor Otwell —— Laravel 的維護人員,通常會在工作日的上午 8 時至下午 5 時 (UTC-06:00 或 America/Chicago) 或是其他不定期時間出現在此頻道內。" +msgstr "" -#: docs/10.x/contributions.md:block 24 (header) +# P +#: ./docs/8.x/contributions.md:74 +#: ./docs/9.x/contributions.md:75 +#: ./docs/10.x/contributions.md:80 +#: ./docs/11.x/contributions.md:81 +#: ./docs/master/contributions.md:80 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/contributions.md:75 +#: ./docs/9.x/contributions.md:76 +#: ./docs/10.x/contributions.md:81 +#: ./docs/11.x/contributions.md:82 +#: ./docs/master/contributions.md:81 msgid "Which Branch?" -msgstr "要用哪個分支?" +msgstr "" + +# P +#: ./docs/8.x/contributions.md:77 +msgid "**All** bug fixes should be sent to the latest stable branch. Bug fixes should **never** be sent to the `master` branch unless they fix features that exist only in the upcoming release." +msgstr "" + +# P +#: ./docs/9.x/contributions.md:78 +msgid "**All** bug fixes should be sent to the latest version that supports bug fixes (currently `9.x`). Bug fixes should **never** be sent to the `master` branch unless they fix features that exist only in the upcoming release." +msgstr "" + +# P +#: ./docs/8.x/contributions.md:79 +msgid "**Minor** features that are **fully backward compatible** with the current release may be sent to the latest stable branch." +msgstr "" -#: docs/10.x/contributions.md:block 25 (paragraph) +# P +#: ./docs/9.x/contributions.md:80 +msgid "**Minor** features that are **fully backward compatible** with the current release may be sent to the latest stable branch (currently `9.x`)." +msgstr "" + +# P +#: ./docs/8.x/contributions.md:81 +msgid "**Major** new features should always be sent to the `master` branch, which contains the upcoming release." +msgstr "" + +# P +#: ./docs/9.x/contributions.md:82 +#: ./docs/10.x/contributions.md:87 +#: ./docs/11.x/contributions.md:88 +#: ./docs/master/contributions.md:87 +msgid "**Major** new features or features with breaking changes should always be sent to the `master` branch, which contains the upcoming release." +msgstr "" + +# P +#: ./docs/10.x/contributions.md:83 msgid "**All** bug fixes should be sent to the latest version that supports bug fixes (currently `10.x`). Bug fixes should **never** be sent to the `master` branch unless they fix features that exist only in the upcoming release." -msgstr "**所有**的 Bug 修正都應送交目前有支援 Bug 修正的最新版本 (目前為 `10.x`)。Bug 修正**不該**送交至 `master` 分支,除非要修正的功能只出現在未來的版本中。" +msgstr "" -#: docs/10.x/contributions.md:block 26 (paragraph) +# P +#: ./docs/8.x/contributions.md:83 +msgid "If you are unsure if your feature qualifies as a major or minor, please ask Taylor Otwell in the `#internals` channel of the [Laravel Discord server](https://discord.gg/laravel)." +msgstr "" + +# P +#: ./docs/11.x/contributions.md:84 +#: ./docs/master/contributions.md:83 +msgid "**All** bug fixes should be sent to the latest version that supports bug fixes (currently `11.x`). Bug fixes should **never** be sent to the `master` branch unless they fix features that exist only in the upcoming release." +msgstr "" + +# P +#: ./docs/10.x/contributions.md:85 msgid "**Minor** features that are **fully backward compatible** with the current release may be sent to the latest stable branch (currently `10.x`)." -msgstr "對於目前版本有**完整向下相容性**的**次要 (Minor)** 功能,可以送交至最新的穩定分支 (目前為 `10.x`)。" +msgstr "" -#: docs/10.x/contributions.md:block 27 (paragraph) -msgid "**Major** new features or features with breaking changes should always be sent to the `master` branch, which contains the upcoming release." -msgstr "**主要 (Major)** 新功能,或是包含中斷性變更的修改,則應送交至 `master` 分支,這個分支包含了未來的版本。" +# P +#: ./docs/8.x/contributions.md:85 +#: ./docs/9.x/contributions.md:84 +#: ./docs/10.x/contributions.md:89 +#: ./docs/11.x/contributions.md:90 +#: ./docs/master/contributions.md:89 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/11.x/contributions.md:86 +#: ./docs/master/contributions.md:85 +msgid "**Minor** features that are **fully backward compatible** with the current release may be sent to the latest stable branch (currently `11.x`)." +msgstr "" -#: docs/10.x/contributions.md:block 29 (header) +# H2 +#: ./docs/8.x/contributions.md:86 +#: ./docs/9.x/contributions.md:85 +#: ./docs/10.x/contributions.md:90 +#: ./docs/11.x/contributions.md:91 +#: ./docs/master/contributions.md:90 msgid "Compiled Assets" -msgstr "編譯素材" +msgstr "" -#: docs/10.x/contributions.md:block 30 (paragraph) +# P +#: ./docs/8.x/contributions.md:88 +#: ./docs/9.x/contributions.md:87 +#: ./docs/10.x/contributions.md:92 +#: ./docs/11.x/contributions.md:93 +#: ./docs/master/contributions.md:92 msgid "If you are submitting a change that will affect a compiled file, such as most of the files in `resources/css` or `resources/js` of the `laravel/laravel` repository, do not commit the compiled files. Due to their large size, they cannot realistically be reviewed by a maintainer. This could be exploited as a way to inject malicious code into Laravel. In order to defensively prevent this, all compiled files will be generated and committed by Laravel maintainers." -msgstr "若要送交的修改會影響到經過編譯的檔案 (通常是 `laravel/laravel` 儲存庫的 `resources/css` 或 `resources/js`),請不要簽入 (Commit) 這些編譯後的檔案。由於這些檔案的大小很大,因此無法實際被維護人員審閱,進而造成能向 Laravel 插入惡意程式碼的機會。為了避免此一問題,所有經過編譯的檔案都應由 Laravel 維護人員產生並簽入。" +msgstr "" -#: docs/10.x/contributions.md:block 32 (header) +# P +#: ./docs/8.x/contributions.md:90 +#: ./docs/9.x/contributions.md:89 +#: ./docs/10.x/contributions.md:94 +#: ./docs/11.x/contributions.md:95 +#: ./docs/master/contributions.md:94 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/contributions.md:91 +#: ./docs/9.x/contributions.md:90 +#: ./docs/10.x/contributions.md:95 +#: ./docs/11.x/contributions.md:96 +#: ./docs/master/contributions.md:95 msgid "Security Vulnerabilities" -msgstr "安全性漏洞" +msgstr "" -#: docs/10.x/contributions.md:block 33 (paragraph) -msgid "If you discover a security vulnerability within Laravel, please send an email to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed." -msgstr "若在 Laravel 內發現了安全性漏洞,請傳送電子郵件給 Taylor Otwell,taylor@laravel.com。所有的安全性漏洞都會被即時處理。" +# P +#: ./docs/8.x/contributions.md:93 +#: ./docs/9.x/contributions.md:92 +#: ./docs/10.x/contributions.md:97 +#: ./docs/11.x/contributions.md:98 +#: ./docs/master/contributions.md:97 +msgid "If you discover a security vulnerability within Laravel, please send an email to Taylor Otwell at [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed." +msgstr "" -#: docs/10.x/contributions.md:block 35 (header) +# P +#: ./docs/8.x/contributions.md:95 +#: ./docs/9.x/contributions.md:94 +#: ./docs/10.x/contributions.md:99 +#: ./docs/11.x/contributions.md:100 +#: ./docs/master/contributions.md:99 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/contributions.md:96 +#: ./docs/9.x/contributions.md:95 +#: ./docs/10.x/contributions.md:100 +#: ./docs/11.x/contributions.md:101 +#: ./docs/master/contributions.md:100 msgid "Coding Style" -msgstr "編碼樣式" +msgstr "" -#: docs/10.x/contributions.md:block 36 (paragraph) +# P +#: ./docs/8.x/contributions.md:98 +#: ./docs/9.x/contributions.md:97 +#: ./docs/10.x/contributions.md:102 +#: ./docs/11.x/contributions.md:103 +#: ./docs/master/contributions.md:102 msgid "Laravel follows the [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) coding standard and the [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md) autoloading standard." -msgstr "Laravel 遵守 [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) 編碼標準以及 [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md) Autoload 標準。" +msgstr "" -#: docs/10.x/contributions.md:block 38 (header) +# P +#: ./docs/8.x/contributions.md:100 +#: ./docs/9.x/contributions.md:99 +#: ./docs/10.x/contributions.md:104 +#: ./docs/11.x/contributions.md:105 +#: ./docs/master/contributions.md:104 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/contributions.md:101 +#: ./docs/9.x/contributions.md:100 +#: ./docs/10.x/contributions.md:105 +#: ./docs/11.x/contributions.md:106 +#: ./docs/master/contributions.md:105 msgid "PHPDoc" -msgstr "PHPDoc" +msgstr "" -#: docs/10.x/contributions.md:block 39 (paragraph) +# P +#: ./docs/8.x/contributions.md:103 +#: ./docs/9.x/contributions.md:102 +#: ./docs/10.x/contributions.md:107 +#: ./docs/11.x/contributions.md:108 +#: ./docs/master/contributions.md:107 msgid "Below is an example of a valid Laravel documentation block. Note that the `@param` attribute is followed by two spaces, the argument type, two more spaces, and finally the variable name:" -msgstr "下列為一個有效的 Laravel 文件區塊範例。請注意,`@param` 屬性後有兩個空格,然後是引數型別,然後是兩個空格,最後才是變數名稱:" +msgstr "" -#: docs/10.x/contributions.md:block 40 (code) +# CODE +#: ./docs/8.x/contributions.md:105 +#: ./docs/9.x/contributions.md:104 msgid "/**\n" " * Register a binding with the container.\n" " *\n" @@ -285,9 +729,15 @@ msgid "/**\n" " */\n" "public function bind($abstract, $concrete = null, $shared = false)\n" "{\n" -" // ...\n" -"}\n" -msgstr "/**\n" +" //\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/contributions.md:109 +#: ./docs/11.x/contributions.md:110 +#: ./docs/master/contributions.md:109 +msgid "/**\n" " * Register a binding with the container.\n" " *\n" " * @param string|array $abstract\n" @@ -300,155 +750,140 @@ msgstr "/**\n" "public function bind($abstract, $concrete = null, $shared = false)\n" "{\n" " // ...\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/contributions.md:block 41 (paragraph) +# P +#: ./docs/8.x/contributions.md:120 +#: ./docs/9.x/contributions.md:119 +#: ./docs/10.x/contributions.md:148 +#: ./docs/11.x/contributions.md:149 +#: ./docs/master/contributions.md:148 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/contributions.md:121 +#: ./docs/9.x/contributions.md:120 +#: ./docs/10.x/contributions.md:149 +#: ./docs/11.x/contributions.md:150 +#: ./docs/master/contributions.md:149 +msgid "StyleCI" +msgstr "" + +# P +#: ./docs/8.x/contributions.md:123 +#: ./docs/9.x/contributions.md:122 +#: ./docs/10.x/contributions.md:151 +#: ./docs/11.x/contributions.md:152 +#: ./docs/master/contributions.md:151 +msgid "Don't worry if your code styling isn't perfect! [StyleCI](https://styleci.io/) will automatically merge any style fixes into the Laravel repository after pull requests are merged. This allows us to focus on the content of the contribution and not the code style." +msgstr "" + +# P +#: ./docs/10.x/contributions.md:124 +#: ./docs/11.x/contributions.md:125 +#: ./docs/master/contributions.md:124 msgid "When the `@param` or `@return` attributes are redundant due to the use of native types, they can be removed:" -msgstr "若 `@param` 或 `@return` 屬性所宣告的內容與原生型別重複時,可移除這些 PHPDoc 屬性:" +msgstr "" -#: docs/10.x/contributions.md:block 42 (code) +# P +#: ./docs/8.x/contributions.md:125 +#: ./docs/9.x/contributions.md:124 +#: ./docs/10.x/contributions.md:153 +#: ./docs/11.x/contributions.md:154 +#: ./docs/master/contributions.md:153 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/contributions.md:126 +#: ./docs/11.x/contributions.md:127 +#: ./docs/master/contributions.md:126 msgid "/**\n" " * Execute the job.\n" " */\n" "public function handle(AudioProcessor $processor): void\n" "{\n" " //\n" -"}\n" -msgstr "/**\n" -" * Execute the job.\n" -" */\n" -"public function handle(AudioProcessor $processor): void\n" -"{\n" -" //\n" -"}\n" - -#: docs/10.x/contributions.md:block 43 (paragraph) -msgid "However, when the native type is generic, please specify the generic type through the use of the `@param` or `@return` attributes:" -msgstr "不過,若原生型別是 ^[Generic](泛型) 時,請使用 `@param` 或 `@return` 屬性來指定 Generic 的型別:" - -#: docs/10.x/contributions.md:block 44 (code) -msgid "/**\n" -" * Get the attachments for the message.\n" -" *\n" -" * @return array\n" -" */\n" -"public function attachments(): array\n" -"{\n" -" return [\n" -" Attachment::fromStorage('/path/to/file'),\n" -" ];\n" -"}\n" -msgstr "/**\n" -" * Get the attachments for the message.\n" -" *\n" -" * @return array\n" -" */\n" -"public function attachments(): array\n" -"{\n" -" return [\n" -" Attachment::fromStorage('/path/to/file'),\n" -" ];\n" -"}\n" - -#: docs/10.x/contributions.md:block 46 (header) -msgid "StyleCI" -msgstr "StyleCI" - -#: docs/10.x/contributions.md:block 47 (paragraph) -msgid "Don't worry if your code styling isn't perfect! [StyleCI](https://styleci.io/) will automatically merge any style fixes into the Laravel repository after pull requests are merged. This allows us to focus on the content of the contribution and not the code style." -msgstr "不用擔心你的編碼風格不正確![StyleCI](https://styleci.io/) 會在 Pull Request 被 Merge 後自動合併任何的樣式修正。這樣一來我們就能專注在參與貢獻的內容而非程式碼風格。" +"}" +msgstr "" -#: docs/10.x/contributions.md:block 49 (header) +# H2 +#: ./docs/8.x/contributions.md:126 +#: ./docs/9.x/contributions.md:125 +#: ./docs/10.x/contributions.md:154 +#: ./docs/11.x/contributions.md:155 +#: ./docs/master/contributions.md:154 msgid "Code of Conduct" -msgstr "行為準則 - Code of Conduct" +msgstr "" -#: docs/10.x/contributions.md:block 50 (paragraph) -msgid "The Laravel code of conduct is derived from the Ruby code of conduct. Any violations of the code of conduct may be reported to Taylor Otwell (taylor@laravel.com):" -msgstr "Laravel 的行為準則改編自 Ruby 的 Code of Conduct。有任何違反 Code of Conduct 的行為,可以回報給 Taylor Otwell (taylor@laravel.com):" +# P +#: ./docs/8.x/contributions.md:128 +#: ./docs/9.x/contributions.md:127 +#: ./docs/10.x/contributions.md:156 +#: ./docs/11.x/contributions.md:157 +#: ./docs/master/contributions.md:156 +msgid "The Laravel code of conduct is derived from the Ruby code of conduct. Any violations of the code of conduct may be reported to Taylor Otwell ([taylor@laravel.com](mailto:taylor@laravel.com)):" +msgstr "" -#: docs/10.x/contributions.md:block 52 (unordered list) +# P +#: ./docs/8.x/contributions.md:132 +#: ./docs/9.x/contributions.md:131 +#: ./docs/10.x/contributions.md:160 +#: ./docs/11.x/contributions.md:161 +#: ./docs/master/contributions.md:160 msgid "Participants will be tolerant of opposing views." -msgstr "參與者應容忍相反的意見。 \n" -"Participants will be tolerant of opposing views." +msgstr "" -#: docs/10.x/contributions.md:block 52 (unordered list) +# P +#: ./docs/8.x/contributions.md:133 +#: ./docs/9.x/contributions.md:132 +#: ./docs/10.x/contributions.md:161 +#: ./docs/11.x/contributions.md:162 +#: ./docs/master/contributions.md:161 msgid "Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks." -msgstr "參與者必須確保所使用的話語與行為不包含人身攻擊以及詆譭個人的言論。 \n" -"Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks." +msgstr "" -#: docs/10.x/contributions.md:block 52 (unordered list) +# P +#: ./docs/10.x/contributions.md:134 +#: ./docs/11.x/contributions.md:135 +#: ./docs/master/contributions.md:134 +msgid "However, when the native type is generic, please specify the generic type through the use of the `@param` or `@return` attributes:" +msgstr "" + +# P +#: ./docs/8.x/contributions.md:134 +#: ./docs/9.x/contributions.md:133 +#: ./docs/10.x/contributions.md:162 +#: ./docs/11.x/contributions.md:163 +#: ./docs/master/contributions.md:162 msgid "When interpreting the words and actions of others, participants should always assume good intentions." -msgstr "在理解他人的文字或行為時,參與者應總是假設其為善意的。 \n" -"When interpreting the words and actions of others, participants should always assume good intentions." +msgstr "" -#: docs/10.x/contributions.md:block 52 (unordered list) +# P +#: ./docs/8.x/contributions.md:135 +#: ./docs/9.x/contributions.md:134 +#: ./docs/10.x/contributions.md:163 +#: ./docs/11.x/contributions.md:164 +#: ./docs/master/contributions.md:163 msgid "Behavior that can be reasonably considered harassment will not be tolerated." -msgstr "可被合理視為騷擾的行為不會被容忍。 \n" -"Behavior that can be reasonably considered harassment will not be tolerated." - -#: docs/8.x/contributions.md:block 5 (paragraph) -msgid "To encourage active collaboration, Laravel strongly encourages pull requests, not just bug reports. \"Bug reports\" may also be sent in the form of a pull request containing a failing test. Pull requests will only be reviewed when marked as \"ready for review\" (not in the \"draft\" state) and all tests for new features are passing. Lingering, non-active pull requests left in the \"draft\" state will be closed after a few days." -msgstr "為了鼓勵活躍的社群協作,因此 Laravel 不建議只進行 Bug 回報,更強烈建議大家提供 Pull Request。「Bug 回報」也可以通過 Pull Request 的形式來提供 —— 即建立一個包含失敗測試例的 Pull Request。Pull Request 只有在標註為「Ready for review (可供檢閱)」 (即不在「Draft (草稿)」狀態) 且新功能的所有測試例都通過時才會被檢閱。長期放置、非活躍的「Draft」 Pull Request 會在幾天內被關閉。" - -#: docs/8.x/contributions.md:block 24 (paragraph) -msgid "**All** bug fixes should be sent to the latest stable branch. Bug fixes should **never** be sent to the `master` branch unless they fix features that exist only in the upcoming release." -msgstr "**所有** 的 Bug 修正都應送交至穩定版分支。Bug 修正**不該**送交至 `master` 分支,除非要修正的功能只出現在未來的版本中。" - -#: docs/8.x/contributions.md:block 25 (paragraph) -msgid "**Minor** features that are **fully backward compatible** with the current release may be sent to the latest stable branch." -msgstr "對於目前版本有**完整向下相容性**的**次要 (Minor)** 功能,可以送交至最新的穩定分支。" - -#: docs/8.x/contributions.md:block 26 (paragraph) -msgid "**Major** new features should always be sent to the `master` branch, which contains the upcoming release." -msgstr "**主要 (Major)** 新功能則應送交至 `master` 分支,這個分支包含了未來的版本。" - -#: docs/8.x/contributions.md:block 27 (paragraph) -msgid "If you are unsure if your feature qualifies as a major or minor, please ask Taylor Otwell in the `#internals` channel of the [Laravel Discord server](https://discord.gg/laravel)." -msgstr "若你不確定你的功能是主要功能還是次要功能,請在 [Laravel 的 Discord Server](https://discord.gg/laravel) 中的 `#internals` 頻道內詢問 Taylor Otwell。" +msgstr "" -#: docs/8.x/contributions.md:block 40 (code) +# CODE +#: ./docs/10.x/contributions.md:136 +#: ./docs/11.x/contributions.md:137 +#: ./docs/master/contributions.md:136 msgid "/**\n" -" * Register a binding with the container.\n" -" *\n" -" * @param string|array $abstract\n" -" * @param \\Closure|string|null $concrete\n" -" * @param bool $shared\n" -" * @return void\n" -" *\n" -" * @throws \\Exception\n" -" */\n" -"public function bind($abstract, $concrete = null, $shared = false)\n" -"{\n" -" //\n" -"}\n" -msgstr "/**\n" -" * Register a binding with the container.\n" -" *\n" -" * @param string|array $abstract\n" -" * @param \\Closure|string|null $concrete\n" -" * @param bool $shared\n" -" * @return void\n" +" * Get the attachments for the message.\n" " *\n" -" * @throws \\Exception\n" +" * @return array\n" " */\n" -"public function bind($abstract, $concrete = null, $shared = false)\n" +"public function attachments(): array\n" "{\n" -" //\n" -"}\n" - -#: docs/9.x/contributions.md:block 24 (paragraph) -msgid "**All** bug fixes should be sent to the latest version that supports bug fixes (currently `9.x`). Bug fixes should **never** be sent to the `master` branch unless they fix features that exist only in the upcoming release." -msgstr "**所有**的 Bug 修正都應送交目前有支援 Bug 修正的最新版本 (目前為 `9.x`)。Bug 修正**不該**送交至 `master` 分支,除非要修正的功能只出現在未來的版本中。" - -#: docs/9.x/contributions.md:block 25 (paragraph) -msgid "**Minor** features that are **fully backward compatible** with the current release may be sent to the latest stable branch (currently `9.x`)." -msgstr "對於目前版本有**完整向下相容性**的**次要 (Minor)** 功能,可以送交至最新的穩定分支 (目前為 `9.x`)。" - -#: docs/master/contributions.md:block 24 (paragraph) -msgid "**All** bug fixes should be sent to the latest version that supports bug fixes (currently `11.x`). Bug fixes should **never** be sent to the `master` branch unless they fix features that exist only in the upcoming release." -msgstr "**所有**的 Bug 修正都應送交目前有支援 Bug 修正的最新版本 (目前為 `11.x`)。Bug 修正**不該**送交至 `master` 分支,除非要修正的功能只出現在未來的版本中。" - -#: docs/master/contributions.md:block 25 (paragraph) -msgid "**Minor** features that are **fully backward compatible** with the current release may be sent to the latest stable branch (currently `11.x`)." -msgstr "對於目前版本有**完整向下相容性**的**次要 (Minor)** 功能,可以送交至最新的穩定分支 (目前為 `11.x`)。" +" return [\n" +" Attachment::fromStorage('/path/to/file'),\n" +" ];\n" +"}" +msgstr "" diff --git a/po/zh_TW/controllers.po b/po/zh_TW/controllers.po index 13ea02b7b..8ee8eff64 100644 --- a/po/zh_TW/controllers.po +++ b/po/zh_TW/controllers.po @@ -10,118 +10,740 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" +"PO-Revision-Date: 2024-11-30 08:38\n" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "Verb" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "URI" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "Action" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "Route Name" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "GET" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/photos`" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "index" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.index" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/photos/create`" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "create" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.create" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "POST" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "store" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.store" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/photos/{photo}`" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "show" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.show" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/photos/{photo}/edit`" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "edit" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.edit" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "PUT/PATCH" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "update" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.update" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "DELETE" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "destroy" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.destroy" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/photos/{photo}/comments`" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.comments.index" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/photos/{photo}/comments/create`" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.comments.create" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.comments.store" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/comments/{comment}`" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "comments.show" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/comments/{comment}/edit`" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "comments.edit" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "comments.update" +msgstr "" + +# TD +#: ./docs/8.x/controllers.md +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "comments.destroy" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/profile`" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "profile.show" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/profile/edit`" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "profile.edit" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "profile.update" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/photos/{photo}/thumbnail`" +msgstr "" -#: docs/10.x/controllers.md:block 1 (header) +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.thumbnail.show" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/photos/{photo}/thumbnail/edit`" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.thumbnail.edit" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.thumbnail.update" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "`/photos/{photo}/thumbnail/create`" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.thumbnail.create" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.thumbnail.store" +msgstr "" + +# TD +#: ./docs/9.x/controllers.md +#: ./docs/10.x/controllers.md +#: ./docs/11.x/controllers.md +#: ./docs/master/controllers.md +msgid "photos.thumbnail.destroy" +msgstr "" + +# H1 +#: ./docs/8.x/controllers.md:1 +#: ./docs/9.x/controllers.md:1 +#: ./docs/10.x/controllers.md:1 +#: ./docs/11.x/controllers.md:1 +#: ./docs/master/controllers.md:1 msgid "Controllers" -msgstr "控制器 - Controller" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:3 +#: ./docs/9.x/controllers.md:3 +#: ./docs/10.x/controllers.md:3 +#: ./docs/11.x/controllers.md:3 +#: ./docs/master/controllers.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:4 +#: ./docs/9.x/controllers.md:4 +#: ./docs/10.x/controllers.md:4 +#: ./docs/11.x/controllers.md:4 +#: ./docs/master/controllers.md:4 msgid "[Writing Controllers](#writing-controllers)" -msgstr "[撰寫 Controller](#writing-controllers)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:5 +#: ./docs/9.x/controllers.md:5 +#: ./docs/10.x/controllers.md:5 +#: ./docs/11.x/controllers.md:5 +#: ./docs/master/controllers.md:5 msgid "[Basic Controllers](#basic-controllers)" -msgstr "[「Controller」基礎](#basic-controllers)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:6 +#: ./docs/9.x/controllers.md:6 +#: ./docs/10.x/controllers.md:6 +#: ./docs/11.x/controllers.md:6 +#: ./docs/master/controllers.md:6 msgid "[Single Action Controllers](#single-action-controllers)" -msgstr "[單一動作的 Controller](#single-action-controllers)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:7 +#: ./docs/9.x/controllers.md:7 +#: ./docs/10.x/controllers.md:7 +#: ./docs/11.x/controllers.md:7 +#: ./docs/master/controllers.md:7 msgid "[Controller Middleware](#controller-middleware)" -msgstr "[Controller Middleware](#controller-middleware)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:8 +#: ./docs/9.x/controllers.md:8 +#: ./docs/10.x/controllers.md:8 +#: ./docs/11.x/controllers.md:8 +#: ./docs/master/controllers.md:8 msgid "[Resource Controllers](#resource-controllers)" -msgstr "[Resource Controller](#resource-controllers)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:9 +#: ./docs/9.x/controllers.md:9 +#: ./docs/10.x/controllers.md:9 +#: ./docs/11.x/controllers.md:9 +#: ./docs/master/controllers.md:9 msgid "[Partial Resource Routes](#restful-partial-resource-routes)" -msgstr "[部分的 Resource Route](#restful-partial-resource-routes)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:10 +#: ./docs/9.x/controllers.md:10 +#: ./docs/10.x/controllers.md:10 +#: ./docs/11.x/controllers.md:10 +#: ./docs/master/controllers.md:10 msgid "[Nested Resources](#restful-nested-resources)" -msgstr "[巢狀 Resource](#restful-nested-resources)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:11 +#: ./docs/9.x/controllers.md:11 +#: ./docs/10.x/controllers.md:11 +#: ./docs/11.x/controllers.md:11 +#: ./docs/master/controllers.md:11 msgid "[Naming Resource Routes](#restful-naming-resource-routes)" -msgstr "[命名 Resource Route](#restful-naming-resource-routes)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:12 +#: ./docs/9.x/controllers.md:12 +#: ./docs/10.x/controllers.md:12 +#: ./docs/11.x/controllers.md:12 +#: ./docs/master/controllers.md:12 msgid "[Naming Resource Route Parameters](#restful-naming-resource-route-parameters)" -msgstr "[命名 Resource Route 的參數](#restful-naming-resource-route-parameters)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:13 +#: ./docs/9.x/controllers.md:13 +#: ./docs/10.x/controllers.md:13 +#: ./docs/11.x/controllers.md:13 +#: ./docs/master/controllers.md:13 msgid "[Scoping Resource Routes](#restful-scoping-resource-routes)" -msgstr "[限制範圍的 Resource Route](#restful-scoping-resource-routes)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:14 +#: ./docs/9.x/controllers.md:14 +#: ./docs/10.x/controllers.md:14 +#: ./docs/11.x/controllers.md:14 +#: ./docs/master/controllers.md:14 msgid "[Localizing Resource URIs](#restful-localizing-resource-uris)" -msgstr "[本土化 Resource URI](#restful-localizing-resource-uris)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/8.x/controllers.md:15 +#: ./docs/9.x/controllers.md:15 +#: ./docs/10.x/controllers.md:15 +#: ./docs/11.x/controllers.md:15 +#: ./docs/master/controllers.md:15 msgid "[Supplementing Resource Controllers](#restful-supplementing-resource-controllers)" -msgstr "[補充 Resource Controller](#restful-supplementing-resource-controllers)" +msgstr "" + +# P +#: ./docs/8.x/controllers.md:16 +#: ./docs/9.x/controllers.md:17 +msgid "[Dependency Injection & Controllers](#dependency-injection-and-controllers)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) +# P +#: ./docs/9.x/controllers.md:16 +#: ./docs/10.x/controllers.md:16 +#: ./docs/11.x/controllers.md:16 +#: ./docs/master/controllers.md:16 msgid "[Singleton Resource Controllers](#singleton-resource-controllers)" -msgstr "[單例的 Resource Controller](#singleton-resource-controllers)" +msgstr "" -#: docs/10.x/controllers.md:block 2 (unordered list) -msgid "[Dependency Injection & Controllers](#dependency-injection-and-controllers)" -msgstr "[相依性插入與 Controller](#dependency-injection-and-controllers)" +# P +#: ./docs/10.x/controllers.md:17 +#: ./docs/11.x/controllers.md:17 +#: ./docs/master/controllers.md:17 +msgid "[Dependency Injection and Controllers](#dependency-injection-and-controllers)" +msgstr "" -#: docs/10.x/controllers.md:block 4 (header) +# P +#: ./docs/8.x/controllers.md:18 +#: ./docs/9.x/controllers.md:19 +#: ./docs/10.x/controllers.md:19 +#: ./docs/11.x/controllers.md:19 +#: ./docs/master/controllers.md:19 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/controllers.md:19 +#: ./docs/9.x/controllers.md:20 +#: ./docs/10.x/controllers.md:20 +#: ./docs/11.x/controllers.md:20 +#: ./docs/master/controllers.md:20 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/controllers.md:block 5 (paragraph) +# P +#: ./docs/8.x/controllers.md:21 +#: ./docs/9.x/controllers.md:22 +#: ./docs/10.x/controllers.md:22 +#: ./docs/11.x/controllers.md:22 +#: ./docs/master/controllers.md:22 msgid "Instead of defining all of your request handling logic as closures in your route files, you may wish to organize this behavior using \"controller\" classes. Controllers can group related request handling logic into a single class. For example, a `UserController` class might handle all incoming requests related to users, including showing, creating, updating, and deleting users. By default, controllers are stored in the `app/Http/Controllers` directory." -msgstr "比起在路由檔案中使用閉包來定義所有的請求處理邏輯,你可能會想使用「Controller」類別來管理這個行為。Controller 可以將相關的請求處理邏輯放在單一類別內。舉例來說,`UserController` 類別可以處理所有有關使用者的連入請求,包含顯示、建立、更新與刪除使用者。預設情況下,Controller 存放在 `app/Http/Controllers` 目錄下。" +msgstr "" -#: docs/10.x/controllers.md:block 7 (header) +# P +#: ./docs/8.x/controllers.md:23 +#: ./docs/9.x/controllers.md:24 +#: ./docs/10.x/controllers.md:24 +#: ./docs/11.x/controllers.md:24 +#: ./docs/master/controllers.md:24 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/controllers.md:24 +#: ./docs/9.x/controllers.md:25 +#: ./docs/10.x/controllers.md:25 +#: ./docs/11.x/controllers.md:25 +#: ./docs/master/controllers.md:25 msgid "Writing Controllers" -msgstr "撰寫 Controller" +msgstr "" -#: docs/10.x/controllers.md:block 9 (header) +# P +#: ./docs/8.x/controllers.md:26 +#: ./docs/9.x/controllers.md:27 +#: ./docs/10.x/controllers.md:27 +#: ./docs/11.x/controllers.md:27 +#: ./docs/master/controllers.md:27 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/controllers.md:27 +#: ./docs/9.x/controllers.md:28 +#: ./docs/10.x/controllers.md:28 +#: ./docs/11.x/controllers.md:28 +#: ./docs/master/controllers.md:28 msgid "Basic Controllers" -msgstr "基礎 Controller" +msgstr "" -#: docs/10.x/controllers.md:block 10 (paragraph) +# P +#: ./docs/8.x/controllers.md:29 +#: ./docs/9.x/controllers.md:30 +msgid "Let's take a look at an example of a basic controller. Note that the controller extends the base controller class included with Laravel: `App\\Http\\Controllers\\Controller`:" +msgstr "" + +# P +#: ./docs/10.x/controllers.md:30 +#: ./docs/11.x/controllers.md:30 +#: ./docs/master/controllers.md:30 msgid "To quickly generate a new controller, you may run the `make:controller` Artisan command. By default, all of the controllers for your application are stored in the `app/Http/Controllers` directory:" -msgstr "若要快速產生新的 Controller,可以執行 `make:controller` Artisan 指令。預設情況下,專案中所有的 Controller 都保存在 `app/Http/Controllers` 目錄:" +msgstr "" -#: docs/10.x/controllers.md:block 11 (code) -msgid "php artisan make:controller UserController\n" -msgstr "php artisan make:controller UserController\n" +# CODE +#: ./docs/8.x/controllers.md:31 +msgid " User::findOrFail($id)\n" +" ]);\n" +" }\n" +"}" +msgstr "" -#: docs/10.x/controllers.md:block 12 (paragraph) -msgid "Let's take a look at an example of a basic controller. A controller may have any number of public methods which will respond to incoming HTTP requests:" -msgstr "來看一個基本的 Controller 例子。一個 Controller 可以包含任意數量的 Public 方法,這些 Public 方法會用來回應連入的 HTTP Request:" +# CODE: shell +#: ./docs/10.x/controllers.md:32 +#: ./docs/11.x/controllers.md:32 +#: ./docs/master/controllers.md:32 +msgid "php artisan make:controller UserController" +msgstr "" -#: docs/10.x/controllers.md:block 13 (code) +# CODE +#: ./docs/9.x/controllers.md:32 msgid " User::findOrFail($id)\n" " ]);\n" " }\n" -"}\n" -msgstr " User::findOrFail($id)\n" " ]);\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/controllers.md:block 14 (paragraph) -msgid "Once you have written a controller class and method, you may define a route to the controller method like so:" -msgstr "寫好 Controller 類別與方法後,就可以像這樣定義一個 Route 至該 Controller 方法:" +# P +#: ./docs/8.x/controllers.md:54 +#: ./docs/9.x/controllers.md:54 +msgid "You can define a route to this controller method like so:" +msgstr "" -#: docs/10.x/controllers.md:block 15 (code) +# CODE +#: ./docs/8.x/controllers.md:56 +#: ./docs/9.x/controllers.md:56 +#: ./docs/10.x/controllers.md:60 +#: ./docs/11.x/controllers.md:60 +#: ./docs/master/controllers.md:60 msgid "use App\\Http\\Controllers\\UserController;\n\n" -"Route::get('/user/{id}', [UserController::class, 'show']);\n" -msgstr "use App\\Http\\Controllers\\UserController;\n\n" -"Route::get('/user/{id}', [UserController::class, 'show']);\n" +"Route::get('/user/{id}', [UserController::class, 'show']);" +msgstr "" -#: docs/10.x/controllers.md:block 16 (paragraph) +# P +#: ./docs/10.x/controllers.md:58 +#: ./docs/11.x/controllers.md:58 +#: ./docs/master/controllers.md:58 +msgid "Once you have written a controller class and method, you may define a route to the controller method like so:" +msgstr "" + +# P +#: ./docs/8.x/controllers.md:60 +#: ./docs/9.x/controllers.md:60 +#: ./docs/10.x/controllers.md:64 +#: ./docs/11.x/controllers.md:64 +#: ./docs/master/controllers.md:64 msgid "When an incoming request matches the specified route URI, the `show` method on the `App\\Http\\Controllers\\UserController` class will be invoked and the route parameters will be passed to the method." -msgstr "當有連入請求符合這個路由 URI 時,將叫用 `App\\Http\\Controllers\\UserController` 類別的 `show` 方法,且 route 參數會被傳入這個方法內。" +msgstr "" -#: docs/10.x/controllers.md:block 17 (quote) -msgid "**Note** Controllers are not **required** to extend a base class. However, you will not have access to convenient features such as the `middleware` and `authorize` methods." -msgstr "**Note** Controller 並**不一定**要有繼承基礎類別。不過,若不繼承基礎 Controller 的話將無法使用一些如 `middleware` 或 `authorize` 方法等方便的功能。" +# P +#: ./docs/8.x/controllers.md:62 +#: ./docs/9.x/controllers.md:63 +#: ./docs/10.x/controllers.md:67 +msgid "Controllers are not **required** to extend a base class. However, you will not have access to convenient features such as the `middleware` and `authorize` methods." +msgstr "" -#: docs/10.x/controllers.md:block 19 (header) +# P +#: ./docs/8.x/controllers.md:64 +#: ./docs/9.x/controllers.md:65 +#: ./docs/10.x/controllers.md:69 +#: ./docs/11.x/controllers.md:69 +#: ./docs/master/controllers.md:69 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/controllers.md:65 +#: ./docs/9.x/controllers.md:66 +#: ./docs/10.x/controllers.md:70 +#: ./docs/11.x/controllers.md:70 +#: ./docs/master/controllers.md:70 msgid "Single Action Controllers" -msgstr "單一動作的 Controller" +msgstr "" + +# P +#: ./docs/11.x/controllers.md:67 +#: ./docs/master/controllers.md:67 +msgid "Controllers are not **required** to extend a base class. However, it is sometimes convenient to extend a base controller class that contains methods that should be shared across all of your controllers." +msgstr "" -#: docs/10.x/controllers.md:block 20 (paragraph) +# P +#: ./docs/8.x/controllers.md:67 +#: ./docs/9.x/controllers.md:68 +#: ./docs/10.x/controllers.md:72 +#: ./docs/11.x/controllers.md:72 +#: ./docs/master/controllers.md:72 msgid "If a controller action is particularly complex, you might find it convenient to dedicate an entire controller class to that single action. To accomplish this, you may define a single `__invoke` method within the controller:" -msgstr "若某個 Controller 動作特別複雜,則可以將這個動作放到獨立的 Controller 類別。為此,可在該 Controller 內定義一個單一的 `__invoke` 方法:" +msgstr "" + +# CODE +#: ./docs/8.x/controllers.md:69 +msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/controllers.md:102 +#: ./docs/9.x/controllers.md:105 +#: ./docs/10.x/controllers.md:105 +#: ./docs/11.x/controllers.md:105 +#: ./docs/master/controllers.md:105 msgid "Controller Middleware" -msgstr "Controller Middleware" +msgstr "" -#: docs/10.x/controllers.md:block 29 (paragraph) +# P +#: ./docs/8.x/controllers.md:104 +#: ./docs/9.x/controllers.md:107 +#: ./docs/10.x/controllers.md:107 +#: ./docs/11.x/controllers.md:107 +#: ./docs/master/controllers.md:107 msgid "[Middleware](/docs/{{version}}/middleware) may be assigned to the controller's routes in your route files:" -msgstr "可在路由檔案中指派 [Middleware](/docs/{{version}}/middleware) 給 Controller 的路由:" +msgstr "" -#: docs/10.x/controllers.md:block 30 (code) -msgid "Route::get('profile', [UserController::class, 'show'])->middleware('auth');\n" -msgstr "Route::get('profile', [UserController::class, 'show'])->middleware('auth');\n" +# CODE +#: ./docs/8.x/controllers.md:106 +#: ./docs/9.x/controllers.md:109 +#: ./docs/10.x/controllers.md:109 +#: ./docs/master/controllers.md:109 +msgid "Route::get('profile', [UserController::class, 'show'])->middleware('auth');" +msgstr "" -#: docs/10.x/controllers.md:block 31 (paragraph) +# P +#: ./docs/8.x/controllers.md:108 +#: ./docs/9.x/controllers.md:111 +#: ./docs/10.x/controllers.md:111 msgid "Or, you may find it convenient to specify middleware within your controller's constructor. Using the `middleware` method within your controller's constructor, you can assign middleware to the controller's actions:" -msgstr "或者,你可能會覺得在 Controller 的建構函式內指定 Middleware 比較方便。在 Controller 的建構函式內使用 `middleware` 方法,就能指派 Middleware 給該 Controller 的動作:" +msgstr "" + +# CODE +#: ./docs/11.x/controllers.md:109 +msgid "Route::get('/profile', [UserController::class, 'show'])->middleware('auth');" +msgstr "" -#: docs/10.x/controllers.md:block 32 (code) +# CODE +#: ./docs/8.x/controllers.md:110 +#: ./docs/9.x/controllers.md:113 msgid "class UserController extends Controller\n" "{\n" " /**\n" " * Instantiate a new controller instance.\n" +" *\n" +" * @return void\n" " */\n" " public function __construct()\n" " {\n" @@ -240,8 +1000,18 @@ msgid "class UserController extends Controller\n" " $this->middleware('log')->only('index');\n" " $this->middleware('subscribed')->except('store');\n" " }\n" -"}\n" -msgstr "class UserController extends Controller\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/controllers.md:111 +#: ./docs/master/controllers.md:111 +msgid "Or, you may find it convenient to specify middleware within your controller class. To do so, your controller should implement the `HasMiddleware` interface, which dictates that the controller should have a static `middleware` method. From this method, you may return an array of middleware that should be applied to the controller's actions:" +msgstr "" + +# CODE +#: ./docs/10.x/controllers.md:113 +msgid "class UserController extends Controller\n" "{\n" " /**\n" " * Instantiate a new controller instance.\n" @@ -252,497 +1022,875 @@ msgstr "class UserController extends Controller\n" " $this->middleware('log')->only('index');\n" " $this->middleware('subscribed')->except('store');\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/controllers.md:block 33 (paragraph) +# CODE +#: ./docs/11.x/controllers.md:113 +#: ./docs/master/controllers.md:113 +msgid "middleware(function (Request $request, Closure $next) {\n" +# CODE +#: ./docs/8.x/controllers.md:127 +#: ./docs/9.x/controllers.md:130 +msgid "$this->middleware(function ($request, $next) {\n" " return $next($request);\n" -"});\n" -msgstr "use Closure;\n" +"});" +msgstr "" + +# CODE +#: ./docs/10.x/controllers.md:128 +msgid "use Closure;\n" "use Illuminate\\Http\\Request;\n\n" "$this->middleware(function (Request $request, Closure $next) {\n" " return $next($request);\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/controllers.md:block 36 (header) +# P +#: ./docs/8.x/controllers.md:131 +#: ./docs/9.x/controllers.md:134 +#: ./docs/10.x/controllers.md:135 +#: ./docs/11.x/controllers.md:155 +#: ./docs/master/controllers.md:155 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/controllers.md:132 +#: ./docs/9.x/controllers.md:135 +#: ./docs/10.x/controllers.md:136 +#: ./docs/11.x/controllers.md:156 +#: ./docs/master/controllers.md:156 msgid "Resource Controllers" -msgstr "資源 Controller" +msgstr "" -#: docs/10.x/controllers.md:block 37 (paragraph) +# P +#: ./docs/8.x/controllers.md:134 +#: ./docs/9.x/controllers.md:137 +#: ./docs/10.x/controllers.md:138 +#: ./docs/11.x/controllers.md:158 +#: ./docs/master/controllers.md:158 msgid "If you think of each Eloquent model in your application as a \"resource\", it is typical to perform the same sets of actions against each resource in your application. For example, imagine your application contains a `Photo` model and a `Movie` model. It is likely that users can create, read, update, or delete these resources." -msgstr "若將專案內的各個 Eloquent Model 當作是「資源」,則我們通常會在專案中對各個資源進行同一系列的動作。舉例來說,假設專案中有個 `Photo` Model 與 `Movie` Model。則使用者應該可以建立 (Create)、檢視 (Read)、更新 (Update)、或刪除 (Delete) 這些資源。" +msgstr "" -#: docs/10.x/controllers.md:block 38 (paragraph) +# P +#: ./docs/8.x/controllers.md:136 +#: ./docs/9.x/controllers.md:139 +#: ./docs/10.x/controllers.md:140 +#: ./docs/11.x/controllers.md:160 +#: ./docs/master/controllers.md:160 msgid "Because of this common use case, Laravel resource routing assigns the typical create, read, update, and delete (\"CRUD\") routes to a controller with a single line of code. To get started, we can use the `make:controller` Artisan command's `--resource` option to quickly create a controller to handle these actions:" -msgstr "由於這個常見的使用情況,Laravel 資源路由可將常見的建立 (Create)、讀取 (Read)、更新 (Update) 與刪除 (Delete) (即「CRUD」) 通過單行程式碼來指派路由。要開始建立資源路由,可使用 `make:controller` Artisan 指令的 `--resource` 選項來快速建立處理這些動作的 Controller:" +msgstr "" + +# P +#: ./docs/11.x/controllers.md:138 +#: ./docs/master/controllers.md:138 +msgid "You may also define controller middleware as closures, which provides a convenient way to define an inline middleware without writing an entire middleware class:" +msgstr "" -#: docs/10.x/controllers.md:block 39 (code) -msgid "php artisan make:controller PhotoController --resource\n" -msgstr "php artisan make:controller PhotoController --resource\n" +# CODE +# CODE: shell +#: ./docs/8.x/controllers.md:138 +#: ./docs/9.x/controllers.md:141 +#: ./docs/10.x/controllers.md:142 +#: ./docs/11.x/controllers.md:162 +#: ./docs/master/controllers.md:162 +msgid "php artisan make:controller PhotoController --resource" +msgstr "" + +# CODE +#: ./docs/11.x/controllers.md:140 +#: ./docs/master/controllers.md:140 +msgid "use Closure;\n" +"use Illuminate\\Http\\Request;\n\n" +"/**\n" +" * Get the middleware that should be assigned to the controller.\n" +" */\n" +"public static function middleware(): array\n" +"{\n" +" return [\n" +" function (Request $request, Closure $next) {\n" +" return $next($request);\n" +" },\n" +" ];\n" +"}" +msgstr "" -#: docs/10.x/controllers.md:block 40 (paragraph) +# P +#: ./docs/8.x/controllers.md:140 +#: ./docs/9.x/controllers.md:145 +#: ./docs/10.x/controllers.md:146 +#: ./docs/11.x/controllers.md:166 +#: ./docs/master/controllers.md:166 msgid "This command will generate a controller at `app/Http/Controllers/PhotoController.php`. The controller will contain a method for each of the available resource operations. Next, you may register a resource route that points to the controller:" -msgstr "這個指令會在 `app/Http/Controllers/PhotoController.php` 下產生一個 Controller。該 Controller 會包含用於各個可用資源操作的方法。接著,可以註冊一個指向該 Controller 的資源路由:" +msgstr "" -#: docs/10.x/controllers.md:block 41 (code) +# CODE +#: ./docs/8.x/controllers.md:142 +#: ./docs/9.x/controllers.md:147 +#: ./docs/10.x/controllers.md:148 +#: ./docs/11.x/controllers.md:168 +#: ./docs/master/controllers.md:168 msgid "use App\\Http\\Controllers\\PhotoController;\n\n" -"Route::resource('photos', PhotoController::class);\n" -msgstr "use App\\Http\\Controllers\\PhotoController;\n\n" -"Route::resource('photos', PhotoController::class);\n" +"Route::resource('photos', PhotoController::class);" +msgstr "" -#: docs/10.x/controllers.md:block 42 (paragraph) +# P +#: ./docs/8.x/controllers.md:146 +#: ./docs/9.x/controllers.md:151 +#: ./docs/10.x/controllers.md:152 +#: ./docs/11.x/controllers.md:172 +#: ./docs/master/controllers.md:172 msgid "This single route declaration creates multiple routes to handle a variety of actions on the resource. The generated controller will already have methods stubbed for each of these actions. Remember, you can always get a quick overview of your application's routes by running the `route:list` Artisan command." -msgstr "這一個路由定義會建立多個路由來處理對該資源的數種動作。剛才產生的 Controller 已經預先有了用於這幾個動作的方法了。請記得,你可以隨時通過執行 `route:list` Artisan 指令來快速檢視專案的路由。" +msgstr "" -#: docs/10.x/controllers.md:block 43 (paragraph) +# P +#: ./docs/8.x/controllers.md:148 +#: ./docs/9.x/controllers.md:153 +#: ./docs/10.x/controllers.md:154 +#: ./docs/11.x/controllers.md:174 +#: ./docs/master/controllers.md:174 msgid "You may even register many resource controllers at once by passing an array to the `resources` method:" -msgstr "也可以通過傳入陣列給 `resources` 方法來一次註冊多個資源 Controller:" +msgstr "" -#: docs/10.x/controllers.md:block 44 (code) +# CODE +#: ./docs/8.x/controllers.md:150 +#: ./docs/9.x/controllers.md:155 +#: ./docs/10.x/controllers.md:156 +#: ./docs/11.x/controllers.md:176 +#: ./docs/master/controllers.md:176 msgid "Route::resources([\n" " 'photos' => PhotoController::class,\n" " 'posts' => PostController::class,\n" -"]);\n" -msgstr "Route::resources([\n" -" 'photos' => PhotoController::class,\n" -" 'posts' => PostController::class,\n" -"]);\n" - -#: docs/10.x/controllers.md:block 46 (header) -msgid "Actions Handled By Resource Controller" -msgstr "由資源 Controller 處理的動作" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "Verb" -msgstr "動詞" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "URI" -msgstr "URI" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "Action" -msgstr "動作" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "Route Name" -msgstr "Route 名稱" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "GET" -msgstr "GET" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "`/photos`" -msgstr "`/photos`" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "index" -msgstr "index" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "photos.index" -msgstr "photos.index" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "`/photos/create`" -msgstr "`/photos/create`" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "create" -msgstr "create" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "photos.create" -msgstr "photos.create" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "POST" -msgstr "POST" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "store" -msgstr "store" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "photos.store" -msgstr "photos.store" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "`/photos/{photo}`" -msgstr "`/photos/{photo}`" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "show" -msgstr "show" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "photos.show" -msgstr "photos.show" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "`/photos/{photo}/edit`" -msgstr "`/photos/{photo}/edit`" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "edit" -msgstr "edit" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "photos.edit" -msgstr "photos.edit" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "PUT/PATCH" -msgstr "PUT/PATCH" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "update" -msgstr "update" - -#: docs/10.x/controllers.md:block 47 (table) -msgid "photos.update" -msgstr "photos.update" +"]);" +msgstr "" -#: docs/10.x/controllers.md:block 47 (table) -msgid "DELETE" -msgstr "DELETE" +# P +#: ./docs/8.x/controllers.md:155 +#: ./docs/9.x/controllers.md:160 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/controllers.md:block 47 (table) -msgid "destroy" -msgstr "destroy" +# H4 +#: ./docs/8.x/controllers.md:156 +#: ./docs/9.x/controllers.md:161 +msgid "Actions Handled By Resource Controller" +msgstr "" -#: docs/10.x/controllers.md:block 47 (table) -msgid "photos.destroy" -msgstr "photos.destroy" +# P +#: ./docs/10.x/controllers.md:161 +#: ./docs/11.x/controllers.md:181 +#: ./docs/master/controllers.md:181 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/controllers.md:162 +#: ./docs/11.x/controllers.md:182 +#: ./docs/master/controllers.md:182 +msgid "Actions Handled by Resource Controllers" +msgstr "" -#: docs/10.x/controllers.md:block 49 (header) +# P +#: ./docs/8.x/controllers.md:168 +#: ./docs/9.x/controllers.md:173 +#: ./docs/10.x/controllers.md:174 +#: ./docs/11.x/controllers.md:198 +#: ./docs/master/controllers.md:194 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/controllers.md:169 +#: ./docs/9.x/controllers.md:174 +#: ./docs/10.x/controllers.md:175 +#: ./docs/11.x/controllers.md:199 +#: ./docs/master/controllers.md:195 msgid "Customizing Missing Model Behavior" -msgstr "自訂找不到 Model 的行為" +msgstr "" -#: docs/10.x/controllers.md:block 50 (paragraph) +# P +#: ./docs/8.x/controllers.md:171 +#: ./docs/9.x/controllers.md:176 +#: ./docs/10.x/controllers.md:177 +#: ./docs/master/controllers.md:197 msgid "Typically, a 404 HTTP response will be generated if an implicitly bound resource model is not found. However, you may customize this behavior by calling the `missing` method when defining your resource route. The `missing` method accepts a closure that will be invoked if an implicitly bound model can not be found for any of the resource's routes:" -msgstr "通常來說,若找不到隱式繫結的資源 Model 時會產生一個 404 HTTP 回應。不過,可以在定義資源路由時通過呼叫 `missing` 方法來自訂這個行為。`missing` 方法接受一個閉包,該閉包會在任何資源的路由上找不到隱式繫結的 Model 時被叫用:" +msgstr "" -#: docs/10.x/controllers.md:block 51 (code) +# CODE +#: ./docs/8.x/controllers.md:173 +#: ./docs/9.x/controllers.md:178 +#: ./docs/10.x/controllers.md:179 +#: ./docs/11.x/controllers.md:203 +#: ./docs/master/controllers.md:199 msgid "use App\\Http\\Controllers\\PhotoController;\n" "use Illuminate\\Http\\Request;\n" "use Illuminate\\Support\\Facades\\Redirect;\n\n" "Route::resource('photos', PhotoController::class)\n" " ->missing(function (Request $request) {\n" " return Redirect::route('photos.index');\n" -" });\n" -msgstr "use App\\Http\\Controllers\\PhotoController;\n" -"use Illuminate\\Http\\Request;\n" -"use Illuminate\\Support\\Facades\\Redirect;\n\n" -"Route::resource('photos', PhotoController::class)\n" -" ->missing(function (Request $request) {\n" -" return Redirect::route('photos.index');\n" -" });\n" - -#: docs/10.x/controllers.md:block 53 (header) -msgid "Soft Deleted Models" -msgstr "軟刪除的 Model" - -#: docs/10.x/controllers.md:block 54 (paragraph) -msgid "Typically, implicit model binding will not retrieve models that have been [soft deleted](/docs/{{version}}/eloquent#soft-deleting), and will instead return a 404 HTTP response. However, you can instruct the framework to allow soft deleted models by invoking the `withTrashed` method when defining your resource route:" -msgstr "一般來說,隱式型別繫結不會取得被[軟刪除](/docs/{{version}}/eloquent#soft-deleting)的 Model,而會回傳 404 HTTP Response。不過,我們也可以在定義 Route 時呼叫 `withTrashed` 方法來讓 Laravel 取得這些已刪除的 Model:" - -#: docs/10.x/controllers.md:block 55 (code) -msgid "use App\\Http\\Controllers\\PhotoController;\n\n" -"Route::resource('photos', PhotoController::class)->withTrashed();\n" -msgstr "use App\\Http\\Controllers\\PhotoController;\n\n" -"Route::resource('photos', PhotoController::class)->withTrashed();\n" - -#: docs/10.x/controllers.md:block 56 (paragraph) -msgid "Calling `withTrashed` with no arguments will allow soft deleted models for the `show`, `edit`, and `update` resource routes. You may specify a subset of these routes by passing an array to the `withTrashed` method:" -msgstr "在呼叫 `withTrashed` 時若不提供屬性,則可讓 `show`、`edit`、與 `update` Resource Route 存取軟刪除的 Model。可以傳入一組陣列給 `withTrashed` 方法來指定只使用這些 Route 中的一部分:" - -#: docs/10.x/controllers.md:block 57 (code) -msgid "Route::resource('photos', PhotoController::class)->withTrashed(['show']);\n" -msgstr "Route::resource('photos', PhotoController::class)->withTrashed(['show']);\n" +" });" +msgstr "" -#: docs/10.x/controllers.md:block 59 (header) +# P +#: ./docs/8.x/controllers.md:182 +#: ./docs/9.x/controllers.md:200 +#: ./docs/10.x/controllers.md:201 +#: ./docs/11.x/controllers.md:225 +#: ./docs/master/controllers.md:221 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/controllers.md:183 +#: ./docs/9.x/controllers.md:201 msgid "Specifying The Resource Model" -msgstr "指定資源 Model" +msgstr "" -#: docs/10.x/controllers.md:block 60 (paragraph) +# P +#: ./docs/8.x/controllers.md:185 +#: ./docs/9.x/controllers.md:203 +#: ./docs/10.x/controllers.md:204 +#: ./docs/11.x/controllers.md:228 +#: ./docs/master/controllers.md:224 msgid "If you are using [route model binding](/docs/{{version}}/routing#route-model-binding) and would like the resource controller's methods to type-hint a model instance, you may use the `--model` option when generating the controller:" -msgstr "若使用了[路由 Model 繫結](/docs/{{version}}/routing#route-model-binding),且想型別提示資源 Controller 的方法,可以在產生 Controller 時使用 `--model` 選項:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/controllers.md:187 +#: ./docs/9.x/controllers.md:205 +#: ./docs/10.x/controllers.md:206 +#: ./docs/11.x/controllers.md:230 +#: ./docs/master/controllers.md:226 +msgid "php artisan make:controller PhotoController --model=Photo --resource" +msgstr "" -#: docs/10.x/controllers.md:block 61 (code) -msgid "php artisan make:controller PhotoController --model=Photo --resource\n" -msgstr "php artisan make:controller PhotoController --model=Photo --resource\n" +# P +#: ./docs/9.x/controllers.md:187 +#: ./docs/10.x/controllers.md:188 +#: ./docs/11.x/controllers.md:212 +#: ./docs/master/controllers.md:208 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/controllers.md:188 +#: ./docs/10.x/controllers.md:189 +#: ./docs/11.x/controllers.md:213 +#: ./docs/master/controllers.md:209 +msgid "Soft Deleted Models" +msgstr "" -#: docs/10.x/controllers.md:block 63 (header) +# P +#: ./docs/8.x/controllers.md:189 +#: ./docs/9.x/controllers.md:209 +#: ./docs/10.x/controllers.md:210 +#: ./docs/11.x/controllers.md:234 +#: ./docs/master/controllers.md:230 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/controllers.md:190 +#: ./docs/9.x/controllers.md:210 +#: ./docs/10.x/controllers.md:211 +#: ./docs/11.x/controllers.md:235 +#: ./docs/master/controllers.md:231 msgid "Generating Form Requests" -msgstr "產生 Form Request" +msgstr "" -#: docs/10.x/controllers.md:block 64 (paragraph) +# P +#: ./docs/9.x/controllers.md:190 +#: ./docs/10.x/controllers.md:191 +#: ./docs/11.x/controllers.md:215 +#: ./docs/master/controllers.md:211 +msgid "Typically, implicit model binding will not retrieve models that have been [soft deleted](/docs/{{version}}/eloquent#soft-deleting), and will instead return a 404 HTTP response. However, you can instruct the framework to allow soft deleted models by invoking the `withTrashed` method when defining your resource route:" +msgstr "" + +# P +#: ./docs/8.x/controllers.md:192 +#: ./docs/9.x/controllers.md:212 +#: ./docs/10.x/controllers.md:213 +#: ./docs/11.x/controllers.md:237 +#: ./docs/master/controllers.md:233 msgid "You may provide the `--requests` option when generating a resource controller to instruct Artisan to generate [form request classes](/docs/{{version}}/validation#form-request-validation) for the controller's storage and update methods:" -msgstr "可以在產生資源 Controller 時提供 `--requests` 選項來告訴 Artisan 要產生用於 Controller 中 storage 與 update 方法的 [Form Request 類別](/docs/{{version}}/validation#form-request-validation):" +msgstr "" -#: docs/10.x/controllers.md:block 65 (code) -msgid "php artisan make:controller PhotoController --model=Photo --resource --requests\n" -msgstr "php artisan make:controller PhotoController --model=Photo --resource --requests\n" +# CODE +#: ./docs/9.x/controllers.md:192 +#: ./docs/10.x/controllers.md:193 +#: ./docs/11.x/controllers.md:217 +#: ./docs/master/controllers.md:213 +msgid "use App\\Http\\Controllers\\PhotoController;\n\n" +"Route::resource('photos', PhotoController::class)->withTrashed();" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/controllers.md:194 +#: ./docs/9.x/controllers.md:214 +#: ./docs/10.x/controllers.md:215 +#: ./docs/11.x/controllers.md:239 +#: ./docs/master/controllers.md:235 +msgid "php artisan make:controller PhotoController --model=Photo --resource --requests" +msgstr "" -#: docs/10.x/controllers.md:block 67 (header) +# P +#: ./docs/8.x/controllers.md:196 +#: ./docs/9.x/controllers.md:218 +#: ./docs/10.x/controllers.md:219 +#: ./docs/11.x/controllers.md:243 +#: ./docs/master/controllers.md:239 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/controllers.md:196 +#: ./docs/10.x/controllers.md:197 +#: ./docs/11.x/controllers.md:221 +#: ./docs/master/controllers.md:217 +msgid "Calling `withTrashed` with no arguments will allow soft deleted models for the `show`, `edit`, and `update` resource routes. You may specify a subset of these routes by passing an array to the `withTrashed` method:" +msgstr "" + +# H3 +#: ./docs/8.x/controllers.md:197 +#: ./docs/9.x/controllers.md:219 +#: ./docs/10.x/controllers.md:220 +#: ./docs/11.x/controllers.md:244 +#: ./docs/master/controllers.md:240 msgid "Partial Resource Routes" -msgstr "部分資源路由" +msgstr "" -#: docs/10.x/controllers.md:block 68 (paragraph) +# CODE +#: ./docs/9.x/controllers.md:198 +#: ./docs/10.x/controllers.md:199 +#: ./docs/11.x/controllers.md:223 +#: ./docs/master/controllers.md:219 +msgid "Route::resource('photos', PhotoController::class)->withTrashed(['show']);" +msgstr "" + +# P +#: ./docs/8.x/controllers.md:199 +#: ./docs/9.x/controllers.md:221 +#: ./docs/10.x/controllers.md:222 +#: ./docs/11.x/controllers.md:246 +#: ./docs/master/controllers.md:242 msgid "When declaring a resource route, you may specify a subset of actions the controller should handle instead of the full set of default actions:" -msgstr "宣告資源路由時,比起宣告全部的預設動作,也可以只宣告該 Controller 要處理的一部分動作:" +msgstr "" + +# P +#: ./docs/11.x/controllers.md:201 +msgid "Typically, a 404 HTTP response will be generated if an implicitly bound resource model is not found. However, you may customize this behavior by calling the `missing` method when defining your resource route. The `missing` method accepts a closure that will be invoked if an implicitly bound model cannot be found for any of the resource's routes:" +msgstr "" -#: docs/10.x/controllers.md:block 69 (code) +# CODE +#: ./docs/8.x/controllers.md:201 +#: ./docs/9.x/controllers.md:223 +#: ./docs/10.x/controllers.md:224 +#: ./docs/11.x/controllers.md:248 +#: ./docs/master/controllers.md:244 msgid "use App\\Http\\Controllers\\PhotoController;\n\n" "Route::resource('photos', PhotoController::class)->only([\n" " 'index', 'show'\n" "]);\n\n" "Route::resource('photos', PhotoController::class)->except([\n" " 'create', 'store', 'update', 'destroy'\n" -"]);\n" -msgstr "use App\\Http\\Controllers\\PhotoController;\n\n" -"Route::resource('photos', PhotoController::class)->only([\n" -" 'index', 'show'\n" -"]);\n\n" -"Route::resource('photos', PhotoController::class)->except([\n" -" 'create', 'store', 'update', 'destroy'\n" -"]);\n" +"]);" +msgstr "" + +# H4 +#: ./docs/10.x/controllers.md:202 +#: ./docs/11.x/controllers.md:226 +#: ./docs/master/controllers.md:222 +msgid "Specifying the Resource Model" +msgstr "" -#: docs/10.x/controllers.md:block 71 (header) +# P +#: ./docs/8.x/controllers.md:211 +#: ./docs/9.x/controllers.md:233 +#: ./docs/10.x/controllers.md:234 +#: ./docs/11.x/controllers.md:258 +#: ./docs/master/controllers.md:254 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/controllers.md:212 +#: ./docs/9.x/controllers.md:234 +#: ./docs/10.x/controllers.md:235 +#: ./docs/11.x/controllers.md:259 +#: ./docs/master/controllers.md:255 msgid "API Resource Routes" -msgstr "API 資源路由" +msgstr "" -#: docs/10.x/controllers.md:block 72 (paragraph) +# P +#: ./docs/8.x/controllers.md:214 +#: ./docs/9.x/controllers.md:236 +#: ./docs/10.x/controllers.md:237 +#: ./docs/11.x/controllers.md:261 +#: ./docs/master/controllers.md:257 msgid "When declaring resource routes that will be consumed by APIs, you will commonly want to exclude routes that present HTML templates such as `create` and `edit`. For convenience, you may use the `apiResource` method to automatically exclude these two routes:" -msgstr "在會被 API 使用的資源路由時,我們通常會想排除用來顯示 HTML 樣板的路由,如 `create` 與 `edit`。為了方便起見,可以使用 `apiResource` 方法來自動排除這兩個路由:" +msgstr "" -#: docs/10.x/controllers.md:block 73 (code) +# CODE +#: ./docs/8.x/controllers.md:216 +#: ./docs/9.x/controllers.md:238 +#: ./docs/10.x/controllers.md:239 +#: ./docs/11.x/controllers.md:263 +#: ./docs/master/controllers.md:259 msgid "use App\\Http\\Controllers\\PhotoController;\n\n" -"Route::apiResource('photos', PhotoController::class);\n" -msgstr "use App\\Http\\Controllers\\PhotoController;\n\n" -"Route::apiResource('photos', PhotoController::class);\n" +"Route::apiResource('photos', PhotoController::class);" +msgstr "" -#: docs/10.x/controllers.md:block 74 (paragraph) +# P +#: ./docs/8.x/controllers.md:220 +#: ./docs/9.x/controllers.md:242 +#: ./docs/10.x/controllers.md:243 +#: ./docs/11.x/controllers.md:267 +#: ./docs/master/controllers.md:263 msgid "You may register many API resource controllers at once by passing an array to the `apiResources` method:" -msgstr "也可以通過傳入陣列給 `apiResources` 方法來一次註冊多個 API 資源 Controller:" +msgstr "" -#: docs/10.x/controllers.md:block 75 (code) +# CODE +#: ./docs/8.x/controllers.md:222 +#: ./docs/9.x/controllers.md:244 +#: ./docs/10.x/controllers.md:245 +#: ./docs/11.x/controllers.md:269 +#: ./docs/master/controllers.md:265 msgid "use App\\Http\\Controllers\\PhotoController;\n" "use App\\Http\\Controllers\\PostController;\n\n" "Route::apiResources([\n" " 'photos' => PhotoController::class,\n" " 'posts' => PostController::class,\n" -"]);\n" -msgstr "use App\\Http\\Controllers\\PhotoController;\n" -"use App\\Http\\Controllers\\PostController;\n\n" -"Route::apiResources([\n" -" 'photos' => PhotoController::class,\n" -" 'posts' => PostController::class,\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/controllers.md:block 76 (paragraph) +# P +#: ./docs/8.x/controllers.md:230 +#: ./docs/9.x/controllers.md:252 +#: ./docs/10.x/controllers.md:253 +#: ./docs/11.x/controllers.md:277 +#: ./docs/master/controllers.md:273 msgid "To quickly generate an API resource controller that does not include the `create` or `edit` methods, use the `--api` switch when executing the `make:controller` command:" -msgstr "若要快速建立不包含 `create` 或 `edit` 方法的 API 資源路由,請在執行 `make:contorller` 指令時使用 `--api` 開關:" +msgstr "" -#: docs/10.x/controllers.md:block 77 (code) -msgid "php artisan make:controller PhotoController --api\n" -msgstr "php artisan make:controller PhotoController --api\n" +# CODE +# CODE: shell +#: ./docs/8.x/controllers.md:232 +#: ./docs/9.x/controllers.md:254 +#: ./docs/10.x/controllers.md:255 +#: ./docs/11.x/controllers.md:279 +#: ./docs/master/controllers.md:275 +msgid "php artisan make:controller PhotoController --api" +msgstr "" -#: docs/10.x/controllers.md:block 79 (header) +# P +#: ./docs/8.x/controllers.md:234 +#: ./docs/9.x/controllers.md:258 +#: ./docs/10.x/controllers.md:259 +#: ./docs/11.x/controllers.md:283 +#: ./docs/master/controllers.md:279 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/controllers.md:235 +#: ./docs/9.x/controllers.md:259 +#: ./docs/10.x/controllers.md:260 +#: ./docs/11.x/controllers.md:284 +#: ./docs/master/controllers.md:280 msgid "Nested Resources" -msgstr "巢狀資源" +msgstr "" -#: docs/10.x/controllers.md:block 80 (paragraph) +# P +#: ./docs/8.x/controllers.md:237 +#: ./docs/9.x/controllers.md:261 +#: ./docs/10.x/controllers.md:262 +#: ./docs/11.x/controllers.md:286 +#: ./docs/master/controllers.md:282 msgid "Sometimes you may need to define routes to a nested resource. For example, a photo resource may have multiple comments that may be attached to the photo. To nest the resource controllers, you may use \"dot\" notation in your route declaration:" -msgstr "有時候我們會需要為巢狀資源定義路由。舉例來說,某個照片資源可能會有多個附加到該照片的留言。要巢狀嵌套資源 Controller,我們可以在路由定義上使用「點」標記法:" +msgstr "" -#: docs/10.x/controllers.md:block 81 (code) +# CODE +#: ./docs/8.x/controllers.md:239 +#: ./docs/9.x/controllers.md:263 +#: ./docs/10.x/controllers.md:264 +#: ./docs/11.x/controllers.md:288 +#: ./docs/master/controllers.md:284 msgid "use App\\Http\\Controllers\\PhotoCommentController;\n\n" -"Route::resource('photos.comments', PhotoCommentController::class);\n" -msgstr "use App\\Http\\Controllers\\PhotoCommentController;\n\n" -"Route::resource('photos.comments', PhotoCommentController::class);\n" +"Route::resource('photos.comments', PhotoCommentController::class);" +msgstr "" -#: docs/10.x/controllers.md:block 82 (paragraph) +# P +#: ./docs/8.x/controllers.md:243 +#: ./docs/9.x/controllers.md:267 +#: ./docs/10.x/controllers.md:268 +#: ./docs/11.x/controllers.md:292 +#: ./docs/master/controllers.md:288 msgid "This route will register a nested resource that may be accessed with URIs like the following:" -msgstr "該路由會註冊一個巢狀資源,可使用像這樣的 URI 來存取:" +msgstr "" -#: docs/10.x/controllers.md:block 83 (code) -msgid "/photos/{photo}/comments/{comment}\n" -msgstr "/photos/{photo}/comments/{comment}\n" +# CODE +#: ./docs/8.x/controllers.md:245 +#: ./docs/9.x/controllers.md:269 +#: ./docs/10.x/controllers.md:270 +#: ./docs/11.x/controllers.md:294 +#: ./docs/master/controllers.md:290 +msgid "/photos/{photo}/comments/{comment}" +msgstr "" -#: docs/10.x/controllers.md:block 85 (header) +# P +#: ./docs/8.x/controllers.md:247 +#: ./docs/9.x/controllers.md:271 +#: ./docs/10.x/controllers.md:272 +#: ./docs/11.x/controllers.md:296 +#: ./docs/master/controllers.md:292 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/controllers.md:248 +#: ./docs/9.x/controllers.md:272 +#: ./docs/10.x/controllers.md:273 +#: ./docs/11.x/controllers.md:297 +#: ./docs/master/controllers.md:293 msgid "Scoping Nested Resources" -msgstr "限定範圍的巢狀資源" +msgstr "" -#: docs/10.x/controllers.md:block 86 (paragraph) +# P +#: ./docs/8.x/controllers.md:250 +#: ./docs/9.x/controllers.md:274 +#: ./docs/10.x/controllers.md:275 +#: ./docs/11.x/controllers.md:299 +#: ./docs/master/controllers.md:295 msgid "Laravel's [implicit model binding](/docs/{{version}}/routing#implicit-model-binding-scoping) feature can automatically scope nested bindings such that the resolved child model is confirmed to belong to the parent model. By using the `scoped` method when defining your nested resource, you may enable automatic scoping as well as instruct Laravel which field the child resource should be retrieved by. For more information on how to accomplish this, please see the documentation on [scoping resource routes](#restful-scoping-resource-routes)." -msgstr "Laravel 的[隱式 Model 繫結](/docs/{{version}}/routing#implicit-model-binding-scoping)功能可自動限制巢狀繫結的範圍,讓要被解析的子 Model 可被限制在屬於其上層 Model。只要在定義巢狀資源時使用 `scoped` 方法,就可以開啟自動範圍限制,並告訴 Laravel 應使用子資源的哪個欄位來取得。更多有關此的資訊,請參考[限制資源路由的範圍](#restful-scoping-resource-routes)的說明文件。" +msgstr "" -#: docs/10.x/controllers.md:block 88 (header) +# P +#: ./docs/8.x/controllers.md:252 +#: ./docs/9.x/controllers.md:276 +#: ./docs/10.x/controllers.md:277 +#: ./docs/11.x/controllers.md:301 +#: ./docs/master/controllers.md:297 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/controllers.md:253 +#: ./docs/9.x/controllers.md:277 +#: ./docs/10.x/controllers.md:278 +#: ./docs/11.x/controllers.md:302 +#: ./docs/master/controllers.md:298 msgid "Shallow Nesting" -msgstr "淺層巢狀" +msgstr "" -#: docs/10.x/controllers.md:block 89 (paragraph) +# P +#: ./docs/8.x/controllers.md:255 +#: ./docs/9.x/controllers.md:279 +#: ./docs/10.x/controllers.md:280 +#: ./docs/11.x/controllers.md:304 +#: ./docs/master/controllers.md:300 msgid "Often, it is not entirely necessary to have both the parent and the child IDs within a URI since the child ID is already a unique identifier. When using unique identifiers such as auto-incrementing primary keys to identify your models in URI segments, you may choose to use \"shallow nesting\":" -msgstr "通常,在 URI 中並不需要同時擁有上層 Model 與子 Model 的 ID,因為子 ID 已經是唯一的識別子了。若要在使用唯一如自動遞增的主鍵這樣的識別子來在 URI 區段中識別 Model,可使用「淺層巢狀 (Shallow Nesting)」:" +msgstr "" -#: docs/10.x/controllers.md:block 90 (code) +# CODE +#: ./docs/8.x/controllers.md:257 +#: ./docs/9.x/controllers.md:281 +#: ./docs/10.x/controllers.md:282 +#: ./docs/11.x/controllers.md:306 +#: ./docs/master/controllers.md:302 msgid "use App\\Http\\Controllers\\CommentController;\n\n" -"Route::resource('photos.comments', CommentController::class)->shallow();\n" -msgstr "use App\\Http\\Controllers\\CommentController;\n\n" -"Route::resource('photos.comments', CommentController::class)->shallow();\n" +"Route::resource('photos.comments', CommentController::class)->shallow();" +msgstr "" -#: docs/10.x/controllers.md:block 91 (paragraph) +# P +#: ./docs/8.x/controllers.md:261 +#: ./docs/9.x/controllers.md:285 +#: ./docs/10.x/controllers.md:286 +#: ./docs/11.x/controllers.md:310 +#: ./docs/master/controllers.md:306 msgid "This route definition will define the following routes:" -msgstr "這個路由定義會定義下列路由:" - -#: docs/10.x/controllers.md:block 92 (table) -msgid "`/photos/{photo}/comments`" -msgstr "`/photos/{photo}/comments`" - -#: docs/10.x/controllers.md:block 92 (table) -msgid "photos.comments.index" -msgstr "photos.comments.index" - -#: docs/10.x/controllers.md:block 92 (table) -msgid "`/photos/{photo}/comments/create`" -msgstr "`/photos/{photo}/comments/create`" - -#: docs/10.x/controllers.md:block 92 (table) -msgid "photos.comments.create" -msgstr "photos.comments.create" - -#: docs/10.x/controllers.md:block 92 (table) -msgid "photos.comments.store" -msgstr "photos.comments.store" - -#: docs/10.x/controllers.md:block 92 (table) -msgid "`/comments/{comment}`" -msgstr "`/comments/{comment}`" - -#: docs/10.x/controllers.md:block 92 (table) -msgid "comments.show" -msgstr "comments.show" - -#: docs/10.x/controllers.md:block 92 (table) -msgid "`/comments/{comment}/edit`" -msgstr "`/comments/{comment}/edit`" - -#: docs/10.x/controllers.md:block 92 (table) -msgid "comments.edit" -msgstr "comments.edit" - -#: docs/10.x/controllers.md:block 92 (table) -msgid "comments.update" -msgstr "comments.update" - -#: docs/10.x/controllers.md:block 92 (table) -msgid "comments.destroy" -msgstr "comments.destroy" +msgstr "" -#: docs/10.x/controllers.md:block 94 (header) +# P +#: ./docs/8.x/controllers.md:273 +#: ./docs/9.x/controllers.md:297 +#: ./docs/10.x/controllers.md:298 +#: ./docs/11.x/controllers.md:326 +#: ./docs/master/controllers.md:318 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/controllers.md:274 +#: ./docs/9.x/controllers.md:298 +#: ./docs/10.x/controllers.md:299 +#: ./docs/11.x/controllers.md:327 +#: ./docs/master/controllers.md:319 msgid "Naming Resource Routes" -msgstr "命名資源路由" +msgstr "" -#: docs/10.x/controllers.md:block 95 (paragraph) +# P +#: ./docs/8.x/controllers.md:276 +#: ./docs/9.x/controllers.md:300 +#: ./docs/10.x/controllers.md:301 +#: ./docs/11.x/controllers.md:329 +#: ./docs/master/controllers.md:321 msgid "By default, all resource controller actions have a route name; however, you can override these names by passing a `names` array with your desired route names:" -msgstr "預設情況下,所有的資源 Controller 動作都有對應的路由名稱。不過,可以通過將包含欲使用的路由名稱的陣列傳入 `names` 來複寫這些名稱:" +msgstr "" -#: docs/10.x/controllers.md:block 96 (code) +# CODE +#: ./docs/8.x/controllers.md:278 +#: ./docs/9.x/controllers.md:302 +#: ./docs/10.x/controllers.md:303 +#: ./docs/11.x/controllers.md:331 +#: ./docs/master/controllers.md:323 msgid "use App\\Http\\Controllers\\PhotoController;\n\n" "Route::resource('photos', PhotoController::class)->names([\n" " 'create' => 'photos.build'\n" -"]);\n" -msgstr "use App\\Http\\Controllers\\PhotoController;\n\n" -"Route::resource('photos', PhotoController::class)->names([\n" -" 'create' => 'photos.build'\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/controllers.md:block 98 (header) +# P +#: ./docs/8.x/controllers.md:284 +#: ./docs/9.x/controllers.md:308 +#: ./docs/10.x/controllers.md:309 +#: ./docs/11.x/controllers.md:337 +#: ./docs/master/controllers.md:329 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/controllers.md:285 +#: ./docs/9.x/controllers.md:309 +#: ./docs/10.x/controllers.md:310 +#: ./docs/11.x/controllers.md:338 +#: ./docs/master/controllers.md:330 msgid "Naming Resource Route Parameters" -msgstr "命名資源路由參數" +msgstr "" -#: docs/10.x/controllers.md:block 99 (paragraph) +# P +#: ./docs/8.x/controllers.md:287 +#: ./docs/9.x/controllers.md:311 +#: ./docs/10.x/controllers.md:312 +#: ./docs/11.x/controllers.md:340 +#: ./docs/master/controllers.md:332 msgid "By default, `Route::resource` will create the route parameters for your resource routes based on the \"singularized\" version of the resource name. You can easily override this on a per resource basis using the `parameters` method. The array passed into the `parameters` method should be an associative array of resource names and parameter names:" -msgstr "預設情況下,`Route::resource` 會為依照「單數化 (Singularized)」的資源名稱來為資源路由建立路由參數。可以輕鬆地通過 `parameters` 方法來對個別資源複寫資源名稱。傳入 `parameters` 的陣列應為一個包含資源名稱與參數名稱的關聯式陣列:" +msgstr "" -#: docs/10.x/controllers.md:block 100 (code) +# CODE +#: ./docs/8.x/controllers.md:289 +#: ./docs/9.x/controllers.md:313 +#: ./docs/10.x/controllers.md:314 +#: ./docs/11.x/controllers.md:342 +#: ./docs/master/controllers.md:334 msgid "use App\\Http\\Controllers\\AdminUserController;\n\n" "Route::resource('users', AdminUserController::class)->parameters([\n" " 'users' => 'admin_user'\n" -"]);\n" -msgstr "use App\\Http\\Controllers\\AdminUserController;\n\n" -"Route::resource('users', AdminUserController::class)->parameters([\n" -" 'users' => 'admin_user'\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/controllers.md:block 101 (paragraph) +# P +#: ./docs/8.x/controllers.md:295 +#: ./docs/9.x/controllers.md:319 +#: ./docs/10.x/controllers.md:320 +#: ./docs/11.x/controllers.md:348 +#: ./docs/master/controllers.md:340 msgid "The example above generates the following URI for the resource's `show` route:" -msgstr " 上述範例會為資源的 `show` 路由產生下列 URI:" +msgstr "" -#: docs/10.x/controllers.md:block 102 (code) -msgid "/users/{admin_user}\n" -msgstr "/users/{admin_user}\n" +# CODE +#: ./docs/8.x/controllers.md:297 +#: ./docs/9.x/controllers.md:321 +#: ./docs/10.x/controllers.md:322 +#: ./docs/11.x/controllers.md:350 +#: ./docs/master/controllers.md:342 +msgid "/users/{admin_user}" +msgstr "" -#: docs/10.x/controllers.md:block 104 (header) +# P +#: ./docs/8.x/controllers.md:299 +#: ./docs/9.x/controllers.md:323 +#: ./docs/10.x/controllers.md:324 +#: ./docs/11.x/controllers.md:352 +#: ./docs/master/controllers.md:344 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/controllers.md:300 +#: ./docs/9.x/controllers.md:324 +#: ./docs/10.x/controllers.md:325 +#: ./docs/11.x/controllers.md:353 +#: ./docs/master/controllers.md:345 msgid "Scoping Resource Routes" -msgstr "限制資源路由的範圍" +msgstr "" -#: docs/10.x/controllers.md:block 105 (paragraph) +# P +#: ./docs/8.x/controllers.md:302 +#: ./docs/9.x/controllers.md:326 +#: ./docs/10.x/controllers.md:327 +#: ./docs/11.x/controllers.md:355 +#: ./docs/master/controllers.md:347 msgid "Laravel's [scoped implicit model binding](/docs/{{version}}/routing#implicit-model-binding-scoping) feature can automatically scope nested bindings such that the resolved child model is confirmed to belong to the parent model. By using the `scoped` method when defining your nested resource, you may enable automatic scoping as well as instruct Laravel which field the child resource should be retrieved by:" -msgstr "Laravel 的[限定範圍的隱式 Model 繫結](/docs/{{version}}/routing#implicit-model-binding-scoping)功能可自動限制巢狀繫結的範圍,讓要被解析的子 Model 可被限制在屬於其上層 Model。只要在定義巢狀資源時使用 `scoped` 方法,就可以開啟自動範圍限制,並告訴 Laravel 應使用子資源的哪個欄位來取得:" +msgstr "" -#: docs/10.x/controllers.md:block 106 (code) +# CODE +#: ./docs/8.x/controllers.md:304 +#: ./docs/9.x/controllers.md:328 +#: ./docs/10.x/controllers.md:329 +#: ./docs/11.x/controllers.md:357 +#: ./docs/master/controllers.md:349 msgid "use App\\Http\\Controllers\\PhotoCommentController;\n\n" "Route::resource('photos.comments', PhotoCommentController::class)->scoped([\n" " 'comment' => 'slug',\n" -"]);\n" -msgstr "use App\\Http\\Controllers\\PhotoCommentController;\n\n" -"Route::resource('photos.comments', PhotoCommentController::class)->scoped([\n" -" 'comment' => 'slug',\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/controllers.md:block 107 (paragraph) +# P +#: ./docs/8.x/controllers.md:310 +#: ./docs/9.x/controllers.md:334 +#: ./docs/10.x/controllers.md:335 +#: ./docs/11.x/controllers.md:363 +#: ./docs/master/controllers.md:355 msgid "This route will register a scoped nested resource that may be accessed with URIs like the following:" -msgstr "該路由會註冊一個限定範圍的巢狀資源,可使用像這樣的 URI 來存取:" +msgstr "" -#: docs/10.x/controllers.md:block 108 (code) -msgid "/photos/{photo}/comments/{comment:slug}\n" -msgstr "/photos/{photo}/comments/{comment:slug}\n" +# CODE +#: ./docs/8.x/controllers.md:312 +#: ./docs/9.x/controllers.md:336 +#: ./docs/10.x/controllers.md:337 +#: ./docs/11.x/controllers.md:365 +#: ./docs/master/controllers.md:357 +msgid "/photos/{photo}/comments/{comment:slug}" +msgstr "" -#: docs/10.x/controllers.md:block 109 (paragraph) +# P +#: ./docs/8.x/controllers.md:314 +#: ./docs/9.x/controllers.md:338 +#: ./docs/10.x/controllers.md:339 +#: ./docs/11.x/controllers.md:367 +#: ./docs/master/controllers.md:359 msgid "When using a custom keyed implicit binding as a nested route parameter, Laravel will automatically scope the query to retrieve the nested model by its parent using conventions to guess the relationship name on the parent. In this case, it will be assumed that the `Photo` model has a relationship named `comments` (the plural of the route parameter name) which can be used to retrieve the `Comment` model." -msgstr "當使用自訂鍵值的隱式繫結作為巢狀路由參數時,Laravel 會自動以慣例推測其上層 Model 上的關聯名稱來將限制巢狀 Model 的查詢範圍。在這個例子中,Laravel 會假設 `Photo` Model 有個名為 `comments` 的關聯 (即路由參數名稱的複數形),該關聯將用於取得 `Comment` Model。" +msgstr "" -#: docs/10.x/controllers.md:block 111 (header) +# P +#: ./docs/8.x/controllers.md:316 +#: ./docs/9.x/controllers.md:340 +#: ./docs/10.x/controllers.md:341 +#: ./docs/11.x/controllers.md:369 +#: ./docs/master/controllers.md:361 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/controllers.md:317 +#: ./docs/9.x/controllers.md:341 +#: ./docs/10.x/controllers.md:342 +#: ./docs/11.x/controllers.md:370 +#: ./docs/master/controllers.md:362 msgid "Localizing Resource URIs" -msgstr "本地化資源 URI" +msgstr "" -#: docs/10.x/controllers.md:block 112 (paragraph) -msgid "By default, `Route::resource` will create resource URIs using English verbs and plural rules. If you need to localize the `create` and `edit` action verbs, you may use the `Route::resourceVerbs` method. This may be done at the beginning of the `boot` method within your application's `App\\Providers\\RouteServiceProvider`:" -msgstr "預設情況下,`Route::resource` 會使用英語的動詞與複數規則來建立資源 URI。若有需要本地化 `create` 與 `action` 動作的動詞,可以使用 `Route::resourceVerbs` 方法。這可以放在專案的 `App\\Providers\\RouteServiceProvider` 中之 `boot` 方法開頭。" +# P +#: ./docs/8.x/controllers.md:319 +msgid "By default, `Route::resource` will create resource URIs using English verbs. If you need to localize the `create` and `edit` action verbs, you may use the `Route::resourceVerbs` method. This may be done at the beginning of the `boot` method within your application's `App\\Providers\\RouteServiceProvider`:" +msgstr "" -#: docs/10.x/controllers.md:block 113 (code) +# CODE +#: ./docs/8.x/controllers.md:321 +#: ./docs/9.x/controllers.md:345 msgid "/**\n" " * Define your route model bindings, pattern filters, etc.\n" +" *\n" +" * @return void\n" " */\n" -"public function boot(): void\n" +"public function boot()\n" "{\n" " Route::resourceVerbs([\n" " 'create' => 'crear',\n" " 'edit' => 'editar',\n" " ]);\n\n" " // ...\n" -"}\n" -msgstr "/**\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/controllers.md:336 +msgid "Once the verbs have been customized, a resource route registration such as `Route::resource('fotos', PhotoController::class)` will produce the following URIs:" +msgstr "" + +# CODE +#: ./docs/8.x/controllers.md:338 +msgid "/fotos/crear\n\n" +"/fotos/{foto}/editar" +msgstr "" + +# P +#: ./docs/8.x/controllers.md:342 +#: ./docs/9.x/controllers.md:366 +#: ./docs/10.x/controllers.md:365 +#: ./docs/11.x/controllers.md:391 +#: ./docs/master/controllers.md:383 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/controllers.md:343 +#: ./docs/9.x/controllers.md:367 +#: ./docs/10.x/controllers.md:366 +#: ./docs/11.x/controllers.md:392 +#: ./docs/master/controllers.md:384 +msgid "Supplementing Resource Controllers" +msgstr "" + +# P +#: ./docs/9.x/controllers.md:343 +#: ./docs/10.x/controllers.md:344 +msgid "By default, `Route::resource` will create resource URIs using English verbs and plural rules. If you need to localize the `create` and `edit` action verbs, you may use the `Route::resourceVerbs` method. This may be done at the beginning of the `boot` method within your application's `App\\Providers\\RouteServiceProvider`:" +msgstr "" + +# P +#: ./docs/8.x/controllers.md:345 +#: ./docs/9.x/controllers.md:369 +#: ./docs/10.x/controllers.md:368 +#: ./docs/11.x/controllers.md:394 +#: ./docs/master/controllers.md:386 +msgid "If you need to add additional routes to a resource controller beyond the default set of resource routes, you should define those routes before your call to the `Route::resource` method; otherwise, the routes defined by the `resource` method may unintentionally take precedence over your supplemental routes:" +msgstr "" + +# CODE +#: ./docs/10.x/controllers.md:346 +msgid "/**\n" " * Define your route model bindings, pattern filters, etc.\n" " */\n" "public function boot(): void\n" @@ -752,471 +1900,82 @@ msgstr "/**\n" " 'edit' => 'editar',\n" " ]);\n\n" " // ...\n" -"}\n" - -#: docs/10.x/controllers.md:block 114 (paragraph) -msgid "Laravel's pluralizer supports [several different languages which you may configure based on your needs](/docs/{{version}}/localization#pluralization-language). Once the verbs and pluralization language have been customized, a resource route registration such as `Route::resource('publicacion', PublicacionController::class)` will produce the following URIs:" -msgstr "Laravel 的複數化程式 (Pluralizer) 可以[按照需求設定支援不同的語言](/docs/{{version}}/localization#pluralization-language)。自訂好動詞與複數化語言後,如 `Route::resource('publicacion', PublicacionController::class)` 這樣的 Resource Route 就會產生下列 URI:" - -#: docs/10.x/controllers.md:block 115 (code) -msgid "/publicacion/crear\n\n" -"/publicacion/{publicaciones}/editar\n" -msgstr "/publicacion/crear\n\n" -"/publicacion/{publicaciones}/editar\n" - -#: docs/10.x/controllers.md:block 117 (header) -msgid "Supplementing Resource Controllers" -msgstr "補充資源 Controller" - -#: docs/10.x/controllers.md:block 118 (paragraph) -msgid "If you need to add additional routes to a resource controller beyond the default set of resource routes, you should define those routes before your call to the `Route::resource` method; otherwise, the routes defined by the `resource` method may unintentionally take precedence over your supplemental routes:" -msgstr "若有需要為某個資源 Controller 增加除了預設資源路由以外的額外路由,則應在呼叫 `Route::resource` 方法前先定義這些路由。否則,又 `resource` 方法定義的路由可能會不可預期地取代所擴充的路由:" +"}" +msgstr "" -#: docs/10.x/controllers.md:block 119 (code) +# CODE +#: ./docs/8.x/controllers.md:347 +#: ./docs/9.x/controllers.md:371 +#: ./docs/10.x/controllers.md:370 +#: ./docs/11.x/controllers.md:396 +#: ./docs/master/controllers.md:388 msgid "use App\\Http\\Controller\\PhotoController;\n\n" "Route::get('/photos/popular', [PhotoController::class, 'popular']);\n" -"Route::resource('photos', PhotoController::class);\n" -msgstr "use App\\Http\\Controller\\PhotoController;\n\n" -"Route::get('/photos/popular', [PhotoController::class, 'popular']);\n" -"Route::resource('photos', PhotoController::class);\n" - -#: docs/10.x/controllers.md:block 120 (quote) -msgid "**Note** Remember to keep your controllers focused. If you find yourself routinely needing methods outside of the typical set of resource actions, consider splitting your controller into two, smaller controllers." -msgstr "**Note** 請記得要保持 Controller 的功能專一。若發現常常需要使用除了一般資源動作以外的方法,請考慮將 Controller 拆分成兩個、更小的 Controller。" - -#: docs/10.x/controllers.md:block 122 (header) -msgid "Singleton Resource Controllers" -msgstr "單例 Resource Controller" - -#: docs/10.x/controllers.md:block 123 (paragraph) -msgid "Sometimes, your application will have resources that may only have a single instance. For example, a user's \"profile\" can be edited or updated, but a user may not have more than one \"profile\". Likewise, an image may have a single \"thumbnail\". These resources are called \"singleton resources\", meaning one and only one instance of the resource may exist. In these scenarios, you may register a \"singleton\" resource controller:" -msgstr "有時候,專案中可能會有只有一個實體的資源。舉例來說,我們可以編輯或更新使用者的「個人檔案 (Profile)」,而每個使用者通常都不會有超過一個的「個人檔案」。類似的,一張圖片可能也只有一個「縮圖」。這些資源就叫做「單例資源」,意思是,這些資源只會有一個實體。在這些情況下,我們可以註冊一個「單例」的 Resource Controller:" - -#: docs/10.x/controllers.md:block 124 (code) -msgid "use App\\Http\\Controllers\\ProfileController;\n" -"use Illuminate\\Support\\Facades\\Route;\n\n" -"Route::singleton('profile', ProfileController::class);\n" -msgstr "use App\\Http\\Controllers\\ProfileController;\n" -"use Illuminate\\Support\\Facades\\Route;\n\n" -"Route::singleton('profile', ProfileController::class);\n" - -#: docs/10.x/controllers.md:block 125 (paragraph) -msgid "The singleton resource definition above will register the following routes. As you can see, \"creation\" routes are not registered for singleton resources, and the registered routes do not accept an identifier since only one instance of the resource may exist:" -msgstr "上面的單例 Resource 定義會註冊下列 Route。就像這樣,單例 Resource 不會註冊「建立」Route,而該程式碼註冊的 Route 也不接受識別子 (Identifier),因為這些資源只會有一個實體:" - -#: docs/10.x/controllers.md:block 126 (table) -msgid "`/profile`" -msgstr "`/profile`" - -#: docs/10.x/controllers.md:block 126 (table) -msgid "profile.show" -msgstr "profile.show" - -#: docs/10.x/controllers.md:block 126 (table) -msgid "`/profile/edit`" -msgstr "`/profile/edit`" - -#: docs/10.x/controllers.md:block 126 (table) -msgid "profile.edit" -msgstr "profile.edit" - -#: docs/10.x/controllers.md:block 126 (table) -msgid "profile.update" -msgstr "profile.update" - -#: docs/10.x/controllers.md:block 127 (paragraph) -msgid "Singleton resources may also be nested within a standard resource:" -msgstr "單例資源也可以被巢狀包含在標準的資源中:" - -#: docs/10.x/controllers.md:block 128 (code) -msgid "Route::singleton('photos.thumbnail', ThumbnailController::class);\n" -msgstr "Route::singleton('photos.thumbnail', ThumbnailController::class);\n" - -#: docs/10.x/controllers.md:block 129 (paragraph) -msgid "In this example, the `photos` resource would receive all of the [standard resource routes](#actions-handled-by-resource-controller); however, the `thumbnail` resource would be a singleton resource with the following routes:" -msgstr "在此範例中,`photos` 資源會擁有所有的[標準 Resource Route](#actions-handled-by-resource-controller)。不過,`thumbnail` 資源會是一個單例資源,並擁有下列 Route:" - -#: docs/10.x/controllers.md:block 130 (table) -msgid "`/photos/{photo}/thumbnail`" -msgstr "`/photos/{photo}/thumbnail`" - -#: docs/10.x/controllers.md:block 130 (table) -msgid "photos.thumbnail.show" -msgstr "photos.thumbnail.show" - -#: docs/10.x/controllers.md:block 130 (table) -msgid "`/photos/{photo}/thumbnail/edit`" -msgstr "`/photos/{photo}/thumbnail/edit`" - -#: docs/10.x/controllers.md:block 130 (table) -msgid "photos.thumbnail.edit" -msgstr "photos.thumbnail.edit" - -#: docs/10.x/controllers.md:block 130 (table) -msgid "photos.thumbnail.update" -msgstr "photos.thumbnail.update" - -#: docs/10.x/controllers.md:block 132 (header) -msgid "Creatable Singleton Resources" -msgstr "可建立的單例資源" - -#: docs/10.x/controllers.md:block 133 (paragraph) -msgid "Occasionally, you may want to define creation and storage routes for a singleton resource. To accomplish this, you may invoke the `creatable` method when registering the singleton resource route:" -msgstr "有時候,我們會需要為某個單例資源定義建立與保存的 Route。這時,我們可以在註冊單例資源 Route 時呼叫 `creatable` 方法:" - -#: docs/10.x/controllers.md:block 134 (code) -msgid "Route::singleton('photos.thumbnail', ThumbnailController::class)->creatable();\n" -msgstr "Route::singleton('photos.thumbnail', ThumbnailController::class)->creatable();\n" - -#: docs/10.x/controllers.md:block 135 (paragraph) -msgid "In this example, the following routes will be registered. As you can see, a `DELETE` route will also be registered for creatable singleton resources:" -msgstr "在此範例中,會註冊下列 Route。如下所示,在可被建立的單例資源中,也會一併建立 `DELETE` Route:" - -#: docs/10.x/controllers.md:block 136 (table) -msgid "`/photos/{photo}/thumbnail/create`" -msgstr "`/photos/{photo}/thumbnail/create`" - -#: docs/10.x/controllers.md:block 136 (table) -msgid "photos.thumbnail.create" -msgstr "photos.thumbnail.create" - -#: docs/10.x/controllers.md:block 136 (table) -msgid "photos.thumbnail.store" -msgstr "photos.thumbnail.store" - -#: docs/10.x/controllers.md:block 136 (table) -msgid "photos.thumbnail.destroy" -msgstr "photos.thumbnail.destroy" - -#: docs/10.x/controllers.md:block 137 (paragraph) -msgid "If you would like Laravel to register the `DELETE` route for a singleton resource but not register the creation or storage routes, you may utilize the `destroyable` method:" -msgstr "若想讓 Laravel 為單例資源註冊 `DELETE` Route,但又不想註冊建立與保存的 Route,可使用 `destroyable` 方法:" - -#: docs/10.x/controllers.md:block 138 (code) -msgid "Route::singleton(...)->destroyable();\n" -msgstr "Route::singleton(...)->destroyable();\n" - -#: docs/10.x/controllers.md:block 140 (header) -msgid "API Singleton Resources" -msgstr "API 的單例資源" - -#: docs/10.x/controllers.md:block 141 (paragraph) -msgid "The `apiSingleton` method may be used to register a singleton resource that will be manipulated via an API, thus rendering the `create` and `edit` routes unnecessary:" -msgstr "`apiSingleton` 方法可用來註冊通過 API 操作的單例資源。因此,這些資源不需要 `create` 與 `edit` Route:" - -#: docs/10.x/controllers.md:block 142 (code) -msgid "Route::apiSingleton('profile', ProfileController::class);\n" -msgstr "Route::apiSingleton('profile', ProfileController::class);\n" - -#: docs/10.x/controllers.md:block 143 (paragraph) -msgid "Of course, API singleton resources may also be `creatable`, which will register `store` and `destroy` routes for the resource:" -msgstr "檔案,API 的單例資源也可以被設為 `creatable`,也就是可為該資源註冊 `store` 與 `destroy` Route:" - -#: docs/10.x/controllers.md:block 144 (code) -msgid "Route::apiSingleton('photos.thumbnail', ProfileController::class)->creatable();\n" -msgstr "Route::apiSingleton('photos.thumbnail', ProfileController::class)->creatable();\n" - -#: docs/10.x/controllers.md:block 146 (header) -msgid "Dependency Injection & Controllers" -msgstr "依賴注入與 Controller" - -#: docs/10.x/controllers.md:block 148 (header) -msgid "Constructor Injection" -msgstr "建構函式注入" - -#: docs/10.x/controllers.md:block 149 (paragraph) -msgid "The Laravel [service container](/docs/{{version}}/container) is used to resolve all Laravel controllers. As a result, you are able to type-hint any dependencies your controller may need in its constructor. The declared dependencies will automatically be resolved and injected into the controller instance:" -msgstr "Laravel 的 [Service Container](/docs/{{version}}/container) 會被用來解析所有的 Laravel Controller。因此,可以在 Controller 的建構函式內型別提示所有 Controller 所需要的依賴。所宣告的依賴會被自動解析並插入到 Controller 實體上:" - -#: docs/10.x/controllers.md:block 150 (code) -msgid "name;\n\n" -" // Store the user...\n\n" -" return redirect('/users');\n" -" }\n" -"}\n" -msgstr "name;\n\n" -" // 保存使用者...\n\n" -" return redirect('/users');\n" -" }\n" -"}\n" - -#: docs/10.x/controllers.md:block 155 (paragraph) -msgid "If your controller method is also expecting input from a route parameter, list your route arguments after your other dependencies. For example, if your route is defined like so:" -msgstr "若 Controller 方法也預期會從路由參數取得輸入,則請將路由引數放在其他依賴之後。舉例來說,若路由是像這樣定義:" - -#: docs/10.x/controllers.md:block 156 (code) -msgid "use App\\Http\\Controllers\\UserController;\n\n" -"Route::put('/user/{id}', [UserController::class, 'update']);\n" -msgstr "use App\\Http\\Controllers\\UserController;\n\n" -"Route::put('/user/{id}', [UserController::class, 'update']);\n" - -#: docs/10.x/controllers.md:block 157 (paragraph) -msgid "You may still type-hint the `Illuminate\\Http\\Request` and access your `id` parameter by defining your controller method as follows:" -msgstr "還是可以像這樣定義 Controller 方法來型別提示 `Illuminate\\Http\\Request` 並取得 `id` 參數:" - -#: docs/10.x/controllers.md:block 158 (code) -msgid " User::findOrFail($id)\n" -" ]);\n" -" }\n" -"}\n" -msgstr " User::findOrFail($id)\n" -" ]);\n" -" }\n" -"}\n" - -#: docs/8.x/controllers.md:block 12 (paragraph) -msgid "You can define a route to this controller method like so:" -msgstr "可以像這樣定義連結到這個 Controller 的路由:" - -#: docs/8.x/controllers.md:block 15 (quote) -msgid "{tip} Controllers are not **required** to extend a base class. However, you will not have access to convenient features such as the `middleware` and `authorize` methods." -msgstr "{tip} Controller 並**不一定**要有繼承基礎類別。不過,若不繼承基礎 Controller 的話將無法使用一些如 `middleware` 或 `authorize` 方法等方便的功能。" - -#: docs/8.x/controllers.md:block 19 (code) -msgid "middleware('auth');\n" -" $this->middleware('log')->only('index');\n" -" $this->middleware('subscribed')->except('store');\n" -" }\n" -"}\n" -msgstr "class UserController extends Controller\n" -"{\n" -" /**\n" -" * Instantiate a new controller instance.\n" -" *\n" -" * @return void\n" -" */\n" -" public function __construct()\n" -" {\n" -" $this->middleware('auth');\n" -" $this->middleware('log')->only('index');\n" -" $this->middleware('subscribed')->except('store');\n" -" }\n" -"}\n" - -#: docs/8.x/controllers.md:block 32 (code) -msgid "$this->middleware(function ($request, $next) {\n" -" return $next($request);\n" -"});\n" -msgstr "$this->middleware(function ($request, $next) {\n" -" return $next($request);\n" -"});\n" - -#: docs/8.x/controllers.md:block 104 (paragraph) -msgid "By default, `Route::resource` will create resource URIs using English verbs. If you need to localize the `create` and `edit` action verbs, you may use the `Route::resourceVerbs` method. This may be done at the beginning of the `boot` method within your application's `App\\Providers\\RouteServiceProvider`:" -msgstr "預設情況下,`Route::resource` 會使用英語的動詞來建立資源 URI。若有需要本地化 `create` 與 `action` 動作的動詞,可以使用 `Route::resourceVerbs` 方法。這可以放在專案的 `App\\Providers\\RouteServiceProvider` 中之 `boot` 方法開頭。" - -#: docs/8.x/controllers.md:block 105 (code) -msgid "/**\n" -" * Define your route model bindings, pattern filters, etc.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Route::resourceVerbs([\n" -" 'create' => 'crear',\n" -" 'edit' => 'editar',\n" -" ]);\n\n" -" // ...\n" -"}\n" -msgstr "/**\n" -" * Define your route model bindings, pattern filters, etc.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Route::resourceVerbs([\n" -" 'create' => 'crear',\n" -" 'edit' => 'editar',\n" -" ]);\n\n" -" // ...\n" -"}\n" +"Route::resource('photos', PhotoController::class);" +msgstr "" -#: docs/8.x/controllers.md:block 106 (paragraph) -msgid "Once the verbs have been customized, a resource route registration such as `Route::resource('fotos', PhotoController::class)` will produce the following URIs:" -msgstr "自訂完動詞後,使用如 `Route::resource('fotos', PhotoController::class)` 註冊的資源路由就會產生下列 URI:" +# P +#: ./docs/8.x/controllers.md:352 +#: ./docs/9.x/controllers.md:377 +#: ./docs/10.x/controllers.md:376 +#: ./docs/11.x/controllers.md:402 +#: ./docs/master/controllers.md:394 +msgid "Remember to keep your controllers focused. If you find yourself routinely needing methods outside of the typical set of resource actions, consider splitting your controller into two, smaller controllers." +msgstr "" -#: docs/8.x/controllers.md:block 107 (code) -msgid "/fotos/crear\n\n" -"/fotos/{foto}/editar\n" -msgstr "/fotos/crear\n\n" -"/fotos/{foto}/editar\n" +# P +#: ./docs/8.x/controllers.md:354 +#: ./docs/9.x/controllers.md:454 +#: ./docs/10.x/controllers.md:453 +#: ./docs/11.x/controllers.md:491 +#: ./docs/master/controllers.md:471 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/controllers.md:355 +#: ./docs/9.x/controllers.md:455 +msgid "Dependency Injection & Controllers" +msgstr "" + +# P +#: ./docs/8.x/controllers.md:357 +#: ./docs/9.x/controllers.md:457 +#: ./docs/10.x/controllers.md:456 +#: ./docs/11.x/controllers.md:494 +#: ./docs/master/controllers.md:474 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/controllers.md:358 +#: ./docs/9.x/controllers.md:458 +#: ./docs/10.x/controllers.md:457 +#: ./docs/11.x/controllers.md:495 +#: ./docs/master/controllers.md:475 +msgid "Constructor Injection" +msgstr "" + +# P +#: ./docs/8.x/controllers.md:360 +#: ./docs/9.x/controllers.md:460 +#: ./docs/10.x/controllers.md:459 +#: ./docs/11.x/controllers.md:497 +#: ./docs/master/controllers.md:477 +msgid "The Laravel [service container](/docs/{{version}}/container) is used to resolve all Laravel controllers. As a result, you are able to type-hint any dependencies your controller may need in its constructor. The declared dependencies will automatically be resolved and injected into the controller instance:" +msgstr "" -#: docs/8.x/controllers.md:block 112 (quote) -msgid "{tip} Remember to keep your controllers focused. If you find yourself routinely needing methods outside of the typical set of resource actions, consider splitting your controller into two, smaller controllers." -msgstr "{tip} 請記得要保持 Controller 的功能專一。若發現常常需要使用除了一般資源動作以外的方法,請考慮將 Controller 拆分成兩個、更小的 Controller。" +# P +#: ./docs/9.x/controllers.md:360 +#: ./docs/10.x/controllers.md:359 +#: ./docs/11.x/controllers.md:385 +#: ./docs/master/controllers.md:377 +msgid "Laravel's pluralizer supports [several different languages which you may configure based on your needs](/docs/{{version}}/localization#pluralization-language). Once the verbs and pluralization language have been customized, a resource route registration such as `Route::resource('publicacion', PublicacionController::class)` will produce the following URIs:" +msgstr "" -#: docs/8.x/controllers.md:block 118 (code) +# CODE +#: ./docs/8.x/controllers.md:362 +#: ./docs/9.x/controllers.md:462 msgid "users = $users;\n" " }\n" -"}\n" -msgstr "users = $users;\n" -" }\n" -"}\n" +" Route::resourceVerbs([\n" +" 'create' => 'crear',\n" +" 'edit' => 'editar',\n" +" ]);\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/controllers.md:379 +#: ./docs/10.x/controllers.md:378 +#: ./docs/11.x/controllers.md:404 +#: ./docs/master/controllers.md:396 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/controllers.md:380 +#: ./docs/10.x/controllers.md:379 +#: ./docs/11.x/controllers.md:405 +#: ./docs/master/controllers.md:397 +msgid "Singleton Resource Controllers" +msgstr "" + +# P +#: ./docs/9.x/controllers.md:382 +#: ./docs/10.x/controllers.md:381 +#: ./docs/11.x/controllers.md:407 +#: ./docs/master/controllers.md:399 +msgid "Sometimes, your application will have resources that may only have a single instance. For example, a user's \"profile\" can be edited or updated, but a user may not have more than one \"profile\". Likewise, an image may have a single \"thumbnail\". These resources are called \"singleton resources\", meaning one and only one instance of the resource may exist. In these scenarios, you may register a \"singleton\" resource controller:" +msgstr "" + +# CODE: php +#: ./docs/9.x/controllers.md:384 +#: ./docs/10.x/controllers.md:383 +#: ./docs/11.x/controllers.md:409 +#: ./docs/master/controllers.md:401 +msgid "use App\\Http\\Controllers\\ProfileController;\n" +"use Illuminate\\Support\\Facades\\Route;\n\n" +"Route::singleton('profile', ProfileController::class);" +msgstr "" + +# P +#: ./docs/8.x/controllers.md:387 +#: ./docs/9.x/controllers.md:487 +#: ./docs/10.x/controllers.md:477 +#: ./docs/11.x/controllers.md:515 +#: ./docs/master/controllers.md:495 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/controllers.md:388 +#: ./docs/9.x/controllers.md:488 +#: ./docs/10.x/controllers.md:478 +#: ./docs/11.x/controllers.md:516 +#: ./docs/master/controllers.md:496 +msgid "Method Injection" +msgstr "" + +# P +#: ./docs/8.x/controllers.md:390 +#: ./docs/9.x/controllers.md:490 +#: ./docs/10.x/controllers.md:480 +#: ./docs/11.x/controllers.md:518 +#: ./docs/master/controllers.md:498 +msgid "In addition to constructor injection, you may also type-hint dependencies on your controller's methods. A common use-case for method injection is injecting the `Illuminate\\Http\\Request` instance into your controller methods:" +msgstr "" + +# P +#: ./docs/9.x/controllers.md:391 +#: ./docs/10.x/controllers.md:390 +#: ./docs/11.x/controllers.md:416 +#: ./docs/master/controllers.md:408 +msgid "The singleton resource definition above will register the following routes. As you can see, \"creation\" routes are not registered for singleton resources, and the registered routes do not accept an identifier since only one instance of the resource may exist:" +msgstr "" -#: docs/8.x/controllers.md:block 122 (code) +# CODE +#: ./docs/8.x/controllers.md:392 +#: ./docs/9.x/controllers.md:492 msgid "name;\n\n" " //\n" " }\n" -"}\n" -msgstr "name;\n\n" -" //\n" -" }\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/controllers.md:399 +#: ./docs/10.x/controllers.md:398 +#: ./docs/11.x/controllers.md:428 +#: ./docs/master/controllers.md:416 +msgid "Singleton resources may also be nested within a standard resource:" +msgstr "" + +# CODE: php +#: ./docs/9.x/controllers.md:401 +#: ./docs/10.x/controllers.md:400 +#: ./docs/11.x/controllers.md:430 +#: ./docs/master/controllers.md:418 +msgid "Route::singleton('photos.thumbnail', ThumbnailController::class);" +msgstr "" + +# P +#: ./docs/9.x/controllers.md:405 +#: ./docs/10.x/controllers.md:404 +#: ./docs/master/controllers.md:422 +msgid "In this example, the `photos` resource would receive all of the [standard resource routes](#actions-handled-by-resource-controller); however, the `thumbnail` resource would be a singleton resource with the following routes:" +msgstr "" + +# P +#: ./docs/9.x/controllers.md:413 +#: ./docs/10.x/controllers.md:412 +#: ./docs/11.x/controllers.md:446 +#: ./docs/master/controllers.md:430 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/controllers.md:414 +#: ./docs/9.x/controllers.md:514 +#: ./docs/10.x/controllers.md:504 +#: ./docs/11.x/controllers.md:542 +#: ./docs/master/controllers.md:522 +msgid "If your controller method is also expecting input from a route parameter, list your route arguments after your other dependencies. For example, if your route is defined like so:" +msgstr "" + +# H4 +#: ./docs/9.x/controllers.md:414 +#: ./docs/10.x/controllers.md:413 +#: ./docs/11.x/controllers.md:447 +#: ./docs/master/controllers.md:431 +msgid "Creatable Singleton Resources" +msgstr "" + +# CODE +#: ./docs/8.x/controllers.md:416 +#: ./docs/9.x/controllers.md:516 +#: ./docs/10.x/controllers.md:506 +#: ./docs/11.x/controllers.md:544 +#: ./docs/master/controllers.md:524 +msgid "use App\\Http\\Controllers\\UserController;\n\n" +"Route::put('/user/{id}', [UserController::class, 'update']);" +msgstr "" + +# P +#: ./docs/9.x/controllers.md:416 +#: ./docs/10.x/controllers.md:415 +#: ./docs/11.x/controllers.md:449 +#: ./docs/master/controllers.md:433 +msgid "Occasionally, you may want to define creation and storage routes for a singleton resource. To accomplish this, you may invoke the `creatable` method when registering the singleton resource route:" +msgstr "" + +# CODE: php +#: ./docs/9.x/controllers.md:418 +#: ./docs/10.x/controllers.md:417 +#: ./docs/11.x/controllers.md:451 +#: ./docs/master/controllers.md:435 +msgid "Route::singleton('photos.thumbnail', ThumbnailController::class)->creatable();" +msgstr "" + +# P +#: ./docs/8.x/controllers.md:420 +#: ./docs/9.x/controllers.md:520 +#: ./docs/10.x/controllers.md:510 +#: ./docs/11.x/controllers.md:548 +#: ./docs/master/controllers.md:528 +msgid "You may still type-hint the `Illuminate\\Http\\Request` and access your `id` parameter by defining your controller method as follows:" +msgstr "" -#: docs/8.x/controllers.md:block 126 (code) +# CODE +#: ./docs/8.x/controllers.md:422 +#: ./docs/9.x/controllers.md:522 msgid " User::findOrFail($id)\n" -" ]);\n" -" }\n" -"}\n" -msgstr " User::findOrFail($id)\n" -" ]);\n" -" }\n" -"}\n" +# P +#: ./docs/9.x/controllers.md:422 +#: ./docs/10.x/controllers.md:421 +#: ./docs/11.x/controllers.md:455 +#: ./docs/master/controllers.md:439 +msgid "In this example, the following routes will be registered. As you can see, a `DELETE` route will also be registered for creatable singleton resources:" +msgstr "" -#: docs/9.x/controllers.md:block 19 (code) -msgid "noContent();\n" -" }\n" -"}\n" -msgstr "noContent();\n" -" }\n" -"}\n" +# P +#: ./docs/11.x/controllers.md:434 +msgid "In this example, the `photos` resource would receive all of the [standard resource routes](#actions-handled-by-resource-controllers); however, the `thumbnail` resource would be a singleton resource with the following routes:" +msgstr "" + +# CODE: php +#: ./docs/9.x/controllers.md:435 +#: ./docs/10.x/controllers.md:434 +#: ./docs/11.x/controllers.md:472 +#: ./docs/master/controllers.md:452 +msgid "Route::singleton(...)->destroyable();" +msgstr "" + +# P +#: ./docs/9.x/controllers.md:439 +#: ./docs/10.x/controllers.md:438 +#: ./docs/11.x/controllers.md:476 +#: ./docs/master/controllers.md:456 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/controllers.md:440 +#: ./docs/10.x/controllers.md:439 +#: ./docs/11.x/controllers.md:477 +#: ./docs/master/controllers.md:457 +msgid "API Singleton Resources" +msgstr "" + +# P +#: ./docs/9.x/controllers.md:442 +#: ./docs/10.x/controllers.md:441 +#: ./docs/11.x/controllers.md:479 +#: ./docs/master/controllers.md:459 +msgid "The `apiSingleton` method may be used to register a singleton resource that will be manipulated via an API, thus rendering the `create` and `edit` routes unnecessary:" +msgstr "" + +# CODE: php +#: ./docs/9.x/controllers.md:444 +#: ./docs/10.x/controllers.md:443 +#: ./docs/11.x/controllers.md:481 +#: ./docs/master/controllers.md:461 +msgid "Route::apiSingleton('profile', ProfileController::class);" +msgstr "" + +# P +#: ./docs/9.x/controllers.md:448 +#: ./docs/10.x/controllers.md:447 +#: ./docs/11.x/controllers.md:485 +#: ./docs/master/controllers.md:465 +msgid "Of course, API singleton resources may also be `creatable`, which will register `store` and `destroy` routes for the resource:" +msgstr "" + +# CODE: php +#: ./docs/9.x/controllers.md:450 +#: ./docs/10.x/controllers.md:449 +#: ./docs/11.x/controllers.md:487 +#: ./docs/master/controllers.md:467 +msgid "Route::apiSingleton('photos.thumbnail', ProfileController::class)->creatable();" +msgstr "" -#: docs/master/controllers.md:block 152 (code) +# H2 +#: ./docs/10.x/controllers.md:454 +#: ./docs/11.x/controllers.md:492 +#: ./docs/master/controllers.md:472 +msgid "Dependency Injection and Controllers" +msgstr "" + +# CODE +#: ./docs/10.x/controllers.md:461 +#: ./docs/11.x/controllers.md:499 +#: ./docs/master/controllers.md:479 msgid "name;\n\n" -" // ...\n\n" -" return response()->noContent();\n" -" }\n" -"}\n" -msgstr "name;\n\n" -" // ...\n\n" -" return response()->noContent();\n" +" // Store the user...\n\n" +" return redirect('/users');\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/master/controllers.md:block 156 (code) +# CODE +#: ./docs/10.x/controllers.md:512 +#: ./docs/11.x/controllers.md:550 +#: ./docs/master/controllers.md:530 msgid "noContent();\n" -" }\n" -"}\n" -msgstr "noContent();\n" +" // Update the user...\n\n" +" return redirect('/users');\n" " }\n" -"}\n" +"}" +msgstr "" diff --git a/po/zh_TW/csrf.po b/po/zh_TW/csrf.po index df7e8cf20..8495e5746 100644 --- a/po/zh_TW/csrf.po +++ b/po/zh_TW/csrf.po @@ -10,141 +10,317 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2023-02-11 10:27\n" - -#: docs/10.x/csrf.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H1 +#: ./docs/8.x/csrf.md:1 +#: ./docs/9.x/csrf.md:1 +#: ./docs/10.x/csrf.md:1 +#: ./docs/11.x/csrf.md:1 +#: ./docs/master/csrf.md:1 msgid "CSRF Protection" -msgstr "CSRF 保護" +msgstr "" -#: docs/10.x/csrf.md:block 2 (unordered list) +# P +#: ./docs/8.x/csrf.md:3 +#: ./docs/9.x/csrf.md:3 +#: ./docs/10.x/csrf.md:3 +#: ./docs/11.x/csrf.md:3 +#: ./docs/master/csrf.md:3 msgid "[Introduction](#csrf-introduction)" -msgstr "[簡介](#csrf-introduction)" +msgstr "" -#: docs/10.x/csrf.md:block 2 (unordered list) +# P +#: ./docs/8.x/csrf.md:4 +#: ./docs/9.x/csrf.md:4 +#: ./docs/10.x/csrf.md:4 +#: ./docs/11.x/csrf.md:4 +#: ./docs/master/csrf.md:4 msgid "[Preventing CSRF Requests](#preventing-csrf-requests)" -msgstr "[預防 CSRF Request](#preventing-csrf-requests)" +msgstr "" -#: docs/10.x/csrf.md:block 2 (unordered list) +# P +#: ./docs/8.x/csrf.md:5 +#: ./docs/9.x/csrf.md:5 +#: ./docs/10.x/csrf.md:5 +#: ./docs/11.x/csrf.md:5 +#: ./docs/master/csrf.md:5 msgid "[Excluding URIs](#csrf-excluding-uris)" -msgstr "[排除 URI](#csrf-excluding-uris)" +msgstr "" -#: docs/10.x/csrf.md:block 2 (unordered list) +# P +#: ./docs/8.x/csrf.md:6 +#: ./docs/9.x/csrf.md:6 +#: ./docs/10.x/csrf.md:6 +#: ./docs/11.x/csrf.md:6 +#: ./docs/master/csrf.md:6 msgid "[X-CSRF-Token](#csrf-x-csrf-token)" -msgstr "[X-CSRF-Token](#csrf-x-csrf-token)" +msgstr "" -#: docs/10.x/csrf.md:block 2 (unordered list) +# P +#: ./docs/8.x/csrf.md:7 +#: ./docs/9.x/csrf.md:7 +#: ./docs/10.x/csrf.md:7 +#: ./docs/11.x/csrf.md:7 +#: ./docs/master/csrf.md:7 msgid "[X-XSRF-Token](#csrf-x-xsrf-token)" -msgstr "[X-XSRF-Token](#csrf-x-xsrf-token)" +msgstr "" -#: docs/10.x/csrf.md:block 4 (header) +# P +#: ./docs/8.x/csrf.md:9 +#: ./docs/9.x/csrf.md:9 +#: ./docs/10.x/csrf.md:9 +#: ./docs/11.x/csrf.md:9 +#: ./docs/master/csrf.md:9 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/csrf.md:10 +#: ./docs/9.x/csrf.md:10 +#: ./docs/10.x/csrf.md:10 +#: ./docs/11.x/csrf.md:10 +#: ./docs/master/csrf.md:10 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/csrf.md:block 5 (paragraph) +# P +#: ./docs/8.x/csrf.md:12 +#: ./docs/9.x/csrf.md:12 +#: ./docs/10.x/csrf.md:12 +#: ./docs/11.x/csrf.md:12 +#: ./docs/master/csrf.md:12 msgid "Cross-site request forgeries are a type of malicious exploit whereby unauthorized commands are performed on behalf of an authenticated user. Thankfully, Laravel makes it easy to protect your application from [cross-site request forgery](https://en.wikipedia.org/wiki/Cross-site_request_forgery) (CSRF) attacks." -msgstr "CSRF (跨網站要求偽造,Cross-site Request Forgery) 是一種在通過登入使用者來進行未授權操作的惡意入侵方式。還好,Laravel 能讓你輕鬆保護網站免於遭受 [CSRF](https://zh.wikipedia.org/zh-tw/%E8%B7%A8%E7%AB%99%E8%AF%B7%E6%B1%82%E4%BC%AA%E9%80%A0) 攻擊。" +msgstr "" + +# P +#: ./docs/8.x/csrf.md:14 +#: ./docs/9.x/csrf.md:14 +#: ./docs/10.x/csrf.md:14 +#: ./docs/11.x/csrf.md:14 +#: ./docs/master/csrf.md:14 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/csrf.md:15 +#: ./docs/11.x/csrf.md:15 +#: ./docs/master/csrf.md:15 +msgid "An Explanation of the Vulnerability" +msgstr "" -#: docs/10.x/csrf.md:block 7 (header) +# H4 +#: ./docs/8.x/csrf.md:15 +#: ./docs/9.x/csrf.md:15 msgid "An Explanation Of The Vulnerability" -msgstr "CSRF 弱點說明" +msgstr "" -#: docs/10.x/csrf.md:block 8 (paragraph) +# P +#: ./docs/8.x/csrf.md:17 +#: ./docs/9.x/csrf.md:17 +#: ./docs/10.x/csrf.md:17 +#: ./docs/11.x/csrf.md:17 +#: ./docs/master/csrf.md:17 msgid "In case you're not familiar with cross-site request forgeries, let's discuss an example of how this vulnerability can be exploited. Imagine your application has a `/user/email` route that accepts a `POST` request to change the authenticated user's email address. Most likely, this route expects an `email` input field to contain the email address the user would like to begin using." -msgstr "為避免讀者不熟悉 CSRF,我們來討論有關如何入侵該弱點的範例。假設專案中有個 `/user/email` 路由接受 `POST` 請求來修改登入使用者的 E-Mail 位址。顯然,這個路由預期有個 `email` 輸入欄位,其中包含了該使用者要使用的 E-Mail 位址。" +msgstr "" -#: docs/10.x/csrf.md:block 9 (paragraph) +# P +#: ./docs/8.x/csrf.md:19 +#: ./docs/9.x/csrf.md:19 +#: ./docs/10.x/csrf.md:19 +#: ./docs/11.x/csrf.md:19 +#: ./docs/master/csrf.md:19 msgid "Without CSRF protection, a malicious website could create an HTML form that points to your application's `/user/email` route and submits the malicious user's own email address:" -msgstr "若沒有 CSRF 保護,某個惡意網站可以建立一個 HTML 表單指向網站的 `/user/email` 路由,並送出假的使用者 E-Mail 位址:" +msgstr "" -#: docs/10.x/csrf.md:block 10 (code) +# CODE +# CODE: blade +#: ./docs/8.x/csrf.md:21 +#: ./docs/9.x/csrf.md:21 +#: ./docs/10.x/csrf.md:21 +#: ./docs/11.x/csrf.md:21 +#: ./docs/master/csrf.md:21 msgid "
    \n" " \n" "
    \n\n" "\n" -msgstr "
    \n" -" \n" -"
    \n\n" -"\n" +"" +msgstr "" -#: docs/10.x/csrf.md:block 11 (paragraph) +# P +#: ./docs/8.x/csrf.md:29 +#: ./docs/9.x/csrf.md:31 +#: ./docs/10.x/csrf.md:31 +#: ./docs/11.x/csrf.md:31 +#: ./docs/master/csrf.md:31 msgid "If the malicious website automatically submits the form when the page is loaded, the malicious user only needs to lure an unsuspecting user of your application to visit their website and their email address will be changed in your application." -msgstr " 若這個惡意網站在頁面載入後自動送出該表單,則惡意使用者只需要誘拐某個不經意的使用者瀏覽惡意網站,該使用者的 E-Mail 位址就會被修改。" +msgstr "" -#: docs/10.x/csrf.md:block 12 (paragraph) +# P +#: ./docs/8.x/csrf.md:31 +#: ./docs/9.x/csrf.md:33 +#: ./docs/10.x/csrf.md:33 +#: ./docs/11.x/csrf.md:33 +#: ./docs/master/csrf.md:33 msgid "To prevent this vulnerability, we need to inspect every incoming `POST`, `PUT`, `PATCH`, or `DELETE` request for a secret session value that the malicious application is unable to access." -msgstr "為了防止此一弱點,我們需要在所有連入的 `POST`, `PUT`, `PATCH` 或 `DELETE` 請求上檢查某個私密 Session 值,該 Session 值必須是惡意網站無法存取的。" +msgstr "" -#: docs/10.x/csrf.md:block 14 (header) +# P +#: ./docs/8.x/csrf.md:33 +#: ./docs/9.x/csrf.md:35 +#: ./docs/10.x/csrf.md:35 +#: ./docs/11.x/csrf.md:35 +#: ./docs/master/csrf.md:35 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/csrf.md:34 +#: ./docs/9.x/csrf.md:36 +#: ./docs/10.x/csrf.md:36 +#: ./docs/11.x/csrf.md:36 +#: ./docs/master/csrf.md:36 msgid "Preventing CSRF Requests" -msgstr "防止 CSRF 請求" +msgstr "" -#: docs/10.x/csrf.md:block 15 (paragraph) +# P +#: ./docs/8.x/csrf.md:36 +#: ./docs/9.x/csrf.md:38 +#: ./docs/10.x/csrf.md:38 +#: ./docs/11.x/csrf.md:38 +#: ./docs/master/csrf.md:38 msgid "Laravel automatically generates a CSRF \"token\" for each active [user session](/docs/{{version}}/session) managed by the application. This token is used to verify that the authenticated user is the person actually making the requests to the application. Since this token is stored in the user's session and changes each time the session is regenerated, a malicious application is unable to access it." -msgstr "Laravel 會自動為每個有效的[使用者 Session](/docs/{{version}}/session) 產生一個由網站管理的 CSRF「權杖 (Token)」。該權杖會用來認證正在登入的使用者是否真的是實際發起該請求的使用者。由於該權杖儲存於使用者 Session 內,且會在每次 Session 重新產生的時候更改,因此惡意網站無法存取該權杖。" +msgstr "" -#: docs/10.x/csrf.md:block 16 (paragraph) +# P +#: ./docs/8.x/csrf.md:38 +#: ./docs/9.x/csrf.md:40 +#: ./docs/10.x/csrf.md:40 +#: ./docs/11.x/csrf.md:40 +#: ./docs/master/csrf.md:40 msgid "The current session's CSRF token can be accessed via the request's session or via the `csrf_token` helper function:" -msgstr "可以通過請求的 Session 或是 `csrf_token` 輔助函式存取目前 Session 的 CSRF 權杖:" +msgstr "" -#: docs/10.x/csrf.md:block 17 (code) +# CODE +#: ./docs/8.x/csrf.md:40 +#: ./docs/9.x/csrf.md:42 +#: ./docs/10.x/csrf.md:42 +#: ./docs/11.x/csrf.md:42 +#: ./docs/master/csrf.md:42 msgid "use Illuminate\\Http\\Request;\n\n" "Route::get('/token', function (Request $request) {\n" " $token = $request->session()->token();\n\n" " $token = csrf_token();\n\n" " // ...\n" -"});\n" -msgstr "use Illuminate\\Http\\Request;\n\n" -"Route::get('/token', function (Request $request) {\n" -" $token = $request->session()->token();\n\n" -" $token = csrf_token();\n\n" -" // ...\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/csrf.md:block 18 (paragraph) +# P +#: ./docs/8.x/csrf.md:50 +#: ./docs/9.x/csrf.md:52 +#: ./docs/10.x/csrf.md:52 +#: ./docs/11.x/csrf.md:52 +#: ./docs/master/csrf.md:52 msgid "Anytime you define a \"POST\", \"PUT\", \"PATCH\", or \"DELETE\" HTML form in your application, you should include a hidden CSRF `_token` field in the form so that the CSRF protection middleware can validate the request. For convenience, you may use the `@csrf` Blade directive to generate the hidden token input field:" -msgstr "定義 \"POST\", \"PUT\", \"PATCH\", 或是 \"DELETE\" 的 HTML 表單時,應在表單內包含一個隱藏的 CSRF `_token` 欄位以讓 CSRF 保護 Middleware 認證該請求。為了方便起見,可以使用 `@csrf` Blade 指示詞來產生這個隱藏的權杖輸入欄位:" +msgstr "" -#: docs/10.x/csrf.md:block 19 (code) +# CODE +# CODE: blade +#: ./docs/8.x/csrf.md:52 +#: ./docs/9.x/csrf.md:54 +#: ./docs/10.x/csrf.md:54 +#: ./docs/11.x/csrf.md:54 +#: ./docs/master/csrf.md:54 msgid "
    \n" " @csrf\n\n" " \n" " \n" -"
    \n" -msgstr "
    \n" -" @csrf\n\n" -" \n" -" \n" -"
    \n" +"" +msgstr "" -#: docs/10.x/csrf.md:block 20 (paragraph) +# P +#: ./docs/8.x/csrf.md:59 +#: ./docs/9.x/csrf.md:63 +#: ./docs/10.x/csrf.md:63 msgid "The `App\\Http\\Middleware\\VerifyCsrfToken` [middleware](/docs/{{version}}/middleware), which is included in the `web` middleware group by default, will automatically verify that the token in the request input matches the token stored in the session. When these two tokens match, we know that the authenticated user is the one initiating the request." -msgstr "預設包含在 `web` Middleware 群組內的 `App\\Http\\Middleware\\VerifyCsrfToken` [Middleware](/docs/{{version}}/middleware) 會自動認證請求內的這個權杖是否符合儲存在 Session 內的權杖。若這兩個權杖相符,則我們就知道是登入使用者執行該請求的。" +msgstr "" -#: docs/10.x/csrf.md:block 22 (header) +# P +#: ./docs/8.x/csrf.md:61 +#: ./docs/9.x/csrf.md:65 +#: ./docs/10.x/csrf.md:65 +#: ./docs/11.x/csrf.md:65 +#: ./docs/master/csrf.md:65 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/csrf.md:62 +#: ./docs/9.x/csrf.md:66 +#: ./docs/10.x/csrf.md:66 +#: ./docs/11.x/csrf.md:66 +#: ./docs/master/csrf.md:66 msgid "CSRF Tokens & SPAs" -msgstr "CSRF 權杖與 SPA" +msgstr "" -#: docs/10.x/csrf.md:block 23 (paragraph) -msgid "If you are building a SPA that is utilizing Laravel as an API backend, you should consult the [Laravel Sanctum documentation](/docs/{{version}}/sanctum) for information on authenticating with your API and protecting against CSRF vulnerabilities." -msgstr "若正在建立使用 Laravel 作為 API 後端的 SPA,則可以考慮參考 [Laravel Sanctum 說明文件](/docs/{{version}}/sanctum)瞭解有關使用 API 認證與保護 CSRF 弱點的資訊。" +# P +#: ./docs/11.x/csrf.md:63 +#: ./docs/master/csrf.md:63 +msgid "The `Illuminate\\Foundation\\Http\\Middleware\\ValidateCsrfToken` [middleware](/docs/{{version}}/middleware), which is included in the `web` middleware group by default, will automatically verify that the token in the request input matches the token stored in the session. When these two tokens match, we know that the authenticated user is the one initiating the request." +msgstr "" -#: docs/10.x/csrf.md:block 25 (header) +# P +#: ./docs/8.x/csrf.md:64 +#: ./docs/11.x/csrf.md:68 +msgid "If you are building an SPA that is utilizing Laravel as an API backend, you should consult the [Laravel Sanctum documentation](/docs/{{version}}/sanctum) for information on authenticating with your API and protecting against CSRF vulnerabilities." +msgstr "" + +# P +#: ./docs/8.x/csrf.md:66 +#: ./docs/9.x/csrf.md:70 +#: ./docs/10.x/csrf.md:70 +#: ./docs/11.x/csrf.md:70 +#: ./docs/master/csrf.md:70 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/csrf.md:67 +#: ./docs/9.x/csrf.md:71 +#: ./docs/10.x/csrf.md:71 +#: ./docs/11.x/csrf.md:71 +#: ./docs/master/csrf.md:71 msgid "Excluding URIs From CSRF Protection" -msgstr "自 CSRF 保護內排除 URI" +msgstr "" -#: docs/10.x/csrf.md:block 26 (paragraph) +# P +#: ./docs/9.x/csrf.md:68 +#: ./docs/10.x/csrf.md:68 +#: ./docs/master/csrf.md:68 +msgid "If you are building a SPA that is utilizing Laravel as an API backend, you should consult the [Laravel Sanctum documentation](/docs/{{version}}/sanctum) for information on authenticating with your API and protecting against CSRF vulnerabilities." +msgstr "" + +# P +#: ./docs/8.x/csrf.md:69 +#: ./docs/9.x/csrf.md:73 +#: ./docs/10.x/csrf.md:73 +#: ./docs/11.x/csrf.md:73 +#: ./docs/master/csrf.md:73 msgid "Sometimes you may wish to exclude a set of URIs from CSRF protection. For example, if you are using [Stripe](https://stripe.com) to process payments and are utilizing their webhook system, you will need to exclude your Stripe webhook handler route from CSRF protection since Stripe will not know what CSRF token to send to your routes." -msgstr "有時候,我們可能會想從 CSRF 保護內排除一些 URI。舉例來說,若正在使用 [Stripe](https://stripe.com) 來處理付款,並使用 Stripe 的 Webhook 系統,則需要將 Stripe Webhook 處理程式的路由從 CSRF 保護內排除,因為 Stripe 並不會知道要傳送什麼 CSRF 權杖給你的路由。" +msgstr "" -#: docs/10.x/csrf.md:block 27 (paragraph) +# P +#: ./docs/8.x/csrf.md:71 +#: ./docs/9.x/csrf.md:75 +#: ./docs/10.x/csrf.md:75 msgid "Typically, you should place these kinds of routes outside of the `web` middleware group that the `App\\Providers\\RouteServiceProvider` applies to all routes in the `routes/web.php` file. However, you may also exclude the routes by adding their URIs to the `$except` property of the `VerifyCsrfToken` middleware:" -msgstr "通常來說,應將這類路由放在 `web` Middleware 群組外。`App\\Providers\\RouteServiceProvider` 會將所有 `routes/web.php` 內的路由都套用到 `web` Middleware 群組內。不過,也可以通過將這些要排除的 URI 新增到 `VerifyCsrfToken` Middleware 內的 `$except` 屬性來排除這些路由:" +msgstr "" -#: docs/10.x/csrf.md:block 28 (code) +# CODE +#: ./docs/8.x/csrf.md:73 +#: ./docs/9.x/csrf.md:77 +#: ./docs/10.x/csrf.md:77 msgid "withMiddleware(function (Middleware $middleware) {\n" +" $middleware->validateCsrfTokens(except: [\n" " 'stripe/*',\n" " 'http://example.com/foo/bar',\n" " 'http://example.com/foo/*',\n" -" ];\n" -"}\n" +" ]);\n" +"})" +msgstr "" -#: docs/10.x/csrf.md:block 29 (quote) -msgid "**Note** For convenience, the CSRF middleware is automatically disabled for all routes when [running tests](/docs/{{version}}/testing)." -msgstr "**Note** 為了方便起見,在[執行測試](/docs/{{version}}/testing)時會自動禁用所有路由的 CSRF Middleware。" +# P +#: ./docs/11.x/csrf.md:91 +#: ./docs/master/csrf.md:91 +msgid "In addition to checking for the CSRF token as a POST parameter, the `Illuminate\\Foundation\\Http\\Middleware\\ValidateCsrfToken` middleware, which is included in the `web` middleware group by default, will also check for the `X-CSRF-TOKEN` request header. You could, for example, store the token in an HTML `meta` tag:" +msgstr "" -#: docs/10.x/csrf.md:block 31 (header) +# P +#: ./docs/8.x/csrf.md:93 +#: ./docs/9.x/csrf.md:98 +#: ./docs/10.x/csrf.md:98 +#: ./docs/11.x/csrf.md:86 +#: ./docs/master/csrf.md:86 +msgid "For convenience, the CSRF middleware is automatically disabled for all routes when [running tests](/docs/{{version}}/testing)." +msgstr "" + +# P +#: ./docs/8.x/csrf.md:95 +#: ./docs/9.x/csrf.md:100 +#: ./docs/10.x/csrf.md:100 +#: ./docs/11.x/csrf.md:88 +#: ./docs/master/csrf.md:88 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/csrf.md:96 +#: ./docs/9.x/csrf.md:101 +#: ./docs/10.x/csrf.md:101 +#: ./docs/11.x/csrf.md:89 +#: ./docs/master/csrf.md:89 msgid "X-CSRF-TOKEN" -msgstr "X-CSRF-TOKEN" +msgstr "" -#: docs/10.x/csrf.md:block 32 (paragraph) +# P +#: ./docs/8.x/csrf.md:98 +#: ./docs/9.x/csrf.md:103 +#: ./docs/10.x/csrf.md:103 msgid "In addition to checking for the CSRF token as a POST parameter, the `App\\Http\\Middleware\\VerifyCsrfToken` middleware will also check for the `X-CSRF-TOKEN` request header. You could, for example, store the token in an HTML `meta` tag:" -msgstr "除了使用 POST 參數來檢查 CSRF 權杖外,`App\\Http\\Middleware\\VerifyCsrfToken` Middleware 也會檢查 `X-CSRF-TOKEN` 請求標頭。舉例來說,我們可以將該權杖儲存於 HTML `meta` 標籤內:" +msgstr "" -#: docs/10.x/csrf.md:block 33 (code) -msgid "\n" -msgstr "\n" +# CODE +# CODE: blade +#: ./docs/8.x/csrf.md:100 +#: ./docs/9.x/csrf.md:105 +#: ./docs/10.x/csrf.md:105 +#: ./docs/11.x/csrf.md:93 +#: ./docs/master/csrf.md:93 +msgid "" +msgstr "" -#: docs/10.x/csrf.md:block 34 (paragraph) +# P +#: ./docs/8.x/csrf.md:102 +#: ./docs/9.x/csrf.md:109 +#: ./docs/10.x/csrf.md:109 +#: ./docs/11.x/csrf.md:97 +#: ./docs/master/csrf.md:97 msgid "Then, you can instruct a library like jQuery to automatically add the token to all request headers. This provides simple, convenient CSRF protection for your AJAX based applications using legacy JavaScript technology:" -msgstr "然後,可以讓如 jQuery 之類的函式庫自動將這個權杖加到所有請求標頭上。這樣就可為一些使用老舊 JavaScript 技術的 AJAX 程式提供簡單方便的 CSRF 保護:" +msgstr "" -#: docs/10.x/csrf.md:block 35 (code) +# CODE +# CODE: js +#: ./docs/8.x/csrf.md:104 +#: ./docs/9.x/csrf.md:111 +#: ./docs/10.x/csrf.md:111 +#: ./docs/11.x/csrf.md:99 +#: ./docs/master/csrf.md:99 msgid "$.ajaxSetup({\n" " headers: {\n" " 'X-CSRF-TOKEN': $('meta[name=\"csrf-token\"]').attr('content')\n" " }\n" -"});\n" -msgstr "$.ajaxSetup({\n" -" headers: {\n" -" 'X-CSRF-TOKEN': $('meta[name=\"csrf-token\"]').attr('content')\n" -" }\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/csrf.md:block 37 (header) +# P +#: ./docs/8.x/csrf.md:110 +#: ./docs/9.x/csrf.md:119 +#: ./docs/10.x/csrf.md:119 +#: ./docs/11.x/csrf.md:107 +#: ./docs/master/csrf.md:107 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/csrf.md:111 +#: ./docs/9.x/csrf.md:120 +#: ./docs/10.x/csrf.md:120 +#: ./docs/11.x/csrf.md:108 +#: ./docs/master/csrf.md:108 msgid "X-XSRF-TOKEN" -msgstr "X-XSRF-TOKEN" +msgstr "" -#: docs/10.x/csrf.md:block 38 (paragraph) +# P +#: ./docs/8.x/csrf.md:113 +#: ./docs/9.x/csrf.md:122 +#: ./docs/10.x/csrf.md:122 +#: ./docs/11.x/csrf.md:110 +#: ./docs/master/csrf.md:110 msgid "Laravel stores the current CSRF token in an encrypted `XSRF-TOKEN` cookie that is included with each response generated by the framework. You can use the cookie value to set the `X-XSRF-TOKEN` request header." -msgstr "Laravel 將目前的 CSRF 權杖儲存為加密的 `XSRF-TOKEN` Cookie,會被包含在所有又框架產生的回應內。可以使用這個 Cookie 值來設定 `X-XSRF-TOKEN` 請求標頭。" +msgstr "" -#: docs/10.x/csrf.md:block 39 (paragraph) +# P +#: ./docs/8.x/csrf.md:115 +#: ./docs/9.x/csrf.md:124 +#: ./docs/10.x/csrf.md:124 +#: ./docs/11.x/csrf.md:112 +#: ./docs/master/csrf.md:112 msgid "This cookie is primarily sent as a developer convenience since some JavaScript frameworks and libraries, like Angular and Axios, automatically place its value in the `X-XSRF-TOKEN` header on same-origin requests." -msgstr "由於一些 JavaScript 框架如 Angular 與 Axios 會自動在同源請求時將該 Cookie 的值放在 `X-XSRF-TOKEN` 標頭內,該 Cookie 就是為了提供開發者方便而傳送的。" - -#: docs/10.x/csrf.md:block 40 (quote) -msgid "**Note** By default, the `resources/js/bootstrap.js` file includes the Axios HTTP library which will automatically send the `X-XSRF-TOKEN` header for you." -msgstr "**Note** 預設情況下,`resources/js/bootstrap.js` 檔案已包含了 Axios HTTP 函式庫,該函式庫會自動為你傳送 `X-XSRF-TOKEN` 標頭。" - -#: docs/8.x/csrf.md:block 23 (paragraph) -msgid "If you are building an SPA that is utilizing Laravel as an API backend, you should consult the [Laravel Sanctum documentation](/docs/{{version}}/sanctum) for information on authenticating with your API and protecting against CSRF vulnerabilities." -msgstr "若正在建立使用 Laravel 作為 API 後端的 SPA,則可以考慮參考 [Laravel Sanctum 說明文件](/docs/{{version}}/sanctum)瞭解有關使用 API 認證與保護 CSRF 弱點的資訊。" - -#: docs/8.x/csrf.md:block 29 (quote) -msgid "{tip} For convenience, the CSRF middleware is automatically disabled for all routes when [running tests](/docs/{{version}}/testing)." -msgstr "{tip} 為了方便起見,在[執行測試](/docs/{{version}}/testing)時會自動禁用所有路由的 CSRF Middleware。" +msgstr "" -#: docs/8.x/csrf.md:block 40 (quote) -msgid "{tip} By default, the `resources/js/bootstrap.js` file includes the Axios HTTP library which will automatically send the `X-XSRF-TOKEN` header for you." -msgstr "{tip} 預設情況下,`resources/js/bootstrap.js` 檔案已包含了 Axios HTTP 函式庫,該函式庫會自動為你傳送 `X-XSRF-TOKEN` 標頭。" +# P +#: ./docs/8.x/csrf.md:117 +#: ./docs/9.x/csrf.md:127 +#: ./docs/10.x/csrf.md:127 +#: ./docs/11.x/csrf.md:115 +#: ./docs/master/csrf.md:115 +msgid "By default, the `resources/js/bootstrap.js` file includes the Axios HTTP library which will automatically send the `X-XSRF-TOKEN` header for you." +msgstr "" diff --git a/po/zh_TW/database-testing.po b/po/zh_TW/database-testing.po index 1cdca3e05..d88e31509 100644 --- a/po/zh_TW/database-testing.po +++ b/po/zh_TW/database-testing.po @@ -10,49 +10,129 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" - -#: docs/10.x/database-testing.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H1 +#: ./docs/8.x/database-testing.md:1 +#: ./docs/9.x/database-testing.md:1 +#: ./docs/10.x/database-testing.md:1 +#: ./docs/11.x/database-testing.md:1 +#: ./docs/master/database-testing.md:1 msgid "Database Testing" -msgstr "資料庫測試" +msgstr "" -#: docs/10.x/database-testing.md:block 2 (unordered list) +# P +#: ./docs/8.x/database-testing.md:3 +#: ./docs/9.x/database-testing.md:3 +#: ./docs/10.x/database-testing.md:3 +#: ./docs/11.x/database-testing.md:3 +#: ./docs/master/database-testing.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" + +# P +#: ./docs/10.x/database-testing.md:4 +#: ./docs/11.x/database-testing.md:4 +#: ./docs/master/database-testing.md:4 +msgid "[Resetting the Database After Each Test](#resetting-the-database-after-each-test)" +msgstr "" -#: docs/10.x/database-testing.md:block 2 (unordered list) +# P +#: ./docs/8.x/database-testing.md:4 +#: ./docs/9.x/database-testing.md:4 msgid "[Resetting The Database After Each Test](#resetting-the-database-after-each-test)" -msgstr "[在每個測試之後重設資料庫](#resetting-the-database-after-each-test)" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:5 +msgid "[Defining Model Factories](#defining-model-factories)" +msgstr "" -#: docs/10.x/database-testing.md:block 2 (unordered list) +# P +#: ./docs/9.x/database-testing.md:5 +#: ./docs/10.x/database-testing.md:5 +#: ./docs/11.x/database-testing.md:5 +#: ./docs/master/database-testing.md:5 msgid "[Model Factories](#model-factories)" -msgstr "[Model Factory](#model-factories)" +msgstr "" -#: docs/10.x/database-testing.md:block 2 (unordered list) -msgid "[Running Seeders](#running-seeders)" -msgstr "[執行 Seeder](#running-seeders)" +# P +#: ./docs/8.x/database-testing.md:6 +msgid "[Concept Overview](#concept-overview)" +msgstr "" -#: docs/10.x/database-testing.md:block 2 (unordered list) -msgid "[Available Assertions](#available-assertions)" -msgstr "[可用的 Assertion](#available-assertions)" +# P +#: ./docs/8.x/database-testing.md:7 +msgid "[Generating Factories](#generating-factories)" +msgstr "" -#: docs/10.x/database-testing.md:block 4 (header) -msgid "Introduction" -msgstr "簡介" +# P +#: ./docs/8.x/database-testing.md:8 +msgid "[Factory States](#factory-states)" +msgstr "" -#: docs/10.x/database-testing.md:block 5 (paragraph) -msgid "Laravel provides a variety of helpful tools and assertions to make it easier to test your database driven applications. In addition, Laravel model factories and seeders make it painless to create test database records using your application's Eloquent models and relationships. We'll discuss all of these powerful features in the following documentation." -msgstr "Laravel 提供了數種實用工具與 Assertion (判斷提示) 讓你能更輕鬆地測試由資料庫驅動的網站。此外,通過 Laravel 的 Model Factory 與 Seeder,也能輕鬆地使用專案的 Eloquent Model 與 Eloquent 關聯來測試資料庫。我們會在接下來的說明文件內討論這些強大的工具。" +# P +#: ./docs/8.x/database-testing.md:9 +msgid "[Factory Callbacks](#factory-callbacks)" +msgstr "" -#: docs/10.x/database-testing.md:block 7 (header) -msgid "Resetting The Database After Each Test" -msgstr "在每個測試後重設資料庫" +# P +#: ./docs/8.x/database-testing.md:10 +msgid "[Creating Models Using Factories](#creating-models-using-factories)" +msgstr "" -#: docs/10.x/database-testing.md:block 8 (paragraph) -msgid "Before proceeding much further, let's discuss how to reset your database after each of your tests so that data from a previous test does not interfere with subsequent tests. Laravel's included `Illuminate\\Foundation\\Testing\\RefreshDatabase` trait will take care of this for you. Simply use the trait on your test class:" -msgstr "在進一步繼續之前,我們先來討論如何在每個測試前重設資料庫,這樣一來前一個測試的資料就不會影響到接下來的測試。Laravel 內含了 `Illuminate\\Foundation\\Testing\\RefreshDatabase` Trait,會處理這樣的重設。只需要在測試類別內 use 這個 Trait 即可:" +# P +#: ./docs/8.x/database-testing.md:11 +msgid "[Instantiating Models](#instantiating-models)" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:12 +msgid "[Persisting Models](#persisting-models)" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:13 +msgid "[Sequences](#sequences)" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:14 +msgid "[Factory Relationships](#factory-relationships)" +msgstr "" + +# H3 +#: ./docs/10.x/database-testing.md:15 +#: ./docs/11.x/database-testing.md:15 +#: ./docs/master/database-testing.md:15 +msgid "Resetting the Database After Each Test" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:15 +msgid "[Has Many Relationships](#has-many-relationships)" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:16 +msgid "[Belongs To Relationships](#belongs-to-relationships)" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:17 +msgid "[Many To Many Relationships](#many-to-many-relationships)" +msgstr "" -#: docs/10.x/database-testing.md:block 9 (code) +# P +#: ./docs/8.x/database-testing.md:18 +msgid "[Polymorphic Relationships](#polymorphic-relationships)" +msgstr "" + +# CODE +# CODE: php tab=PHPUnit +#: ./docs/10.x/database-testing.md:19 +#: ./docs/11.x/database-testing.md:33 +#: ./docs/master/database-testing.md:33 msgid "get('/');\n\n" " // ...\n" " }\n" -"}\n" -msgstr "get('/');\n\n" +" // ...\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:19 +msgid "[Defining Relationships Within Factories](#defining-relationships-within-factories)" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:20 +#: ./docs/9.x/database-testing.md:6 +#: ./docs/10.x/database-testing.md:6 +#: ./docs/11.x/database-testing.md:6 +#: ./docs/master/database-testing.md:6 +msgid "[Running Seeders](#running-seeders)" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:21 +#: ./docs/9.x/database-testing.md:7 +#: ./docs/10.x/database-testing.md:7 +#: ./docs/11.x/database-testing.md:7 +#: ./docs/master/database-testing.md:7 +msgid "[Available Assertions](#available-assertions)" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:23 +#: ./docs/9.x/database-testing.md:9 +#: ./docs/10.x/database-testing.md:9 +#: ./docs/11.x/database-testing.md:9 +#: ./docs/master/database-testing.md:9 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/database-testing.md:24 +#: ./docs/9.x/database-testing.md:10 +#: ./docs/10.x/database-testing.md:10 +#: ./docs/11.x/database-testing.md:10 +#: ./docs/master/database-testing.md:10 +msgid "Introduction" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:26 +#: ./docs/9.x/database-testing.md:12 +#: ./docs/10.x/database-testing.md:12 +#: ./docs/11.x/database-testing.md:12 +#: ./docs/master/database-testing.md:12 +msgid "Laravel provides a variety of helpful tools and assertions to make it easier to test your database driven applications. In addition, Laravel model factories and seeders make it painless to create test database records using your application's Eloquent models and relationships. We'll discuss all of these powerful features in the following documentation." +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:28 +#: ./docs/9.x/database-testing.md:14 +#: ./docs/10.x/database-testing.md:14 +#: ./docs/11.x/database-testing.md:14 +#: ./docs/master/database-testing.md:14 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/database-testing.md:29 +#: ./docs/9.x/database-testing.md:15 +msgid "Resetting The Database After Each Test" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:31 +#: ./docs/9.x/database-testing.md:17 +#: ./docs/10.x/database-testing.md:17 +#: ./docs/11.x/database-testing.md:17 +#: ./docs/master/database-testing.md:17 +msgid "Before proceeding much further, let's discuss how to reset your database after each of your tests so that data from a previous test does not interfere with subsequent tests. Laravel's included `Illuminate\\Foundation\\Testing\\RefreshDatabase` trait will take care of this for you. Simply use the trait on your test class:" +msgstr "" + +# CODE +#: ./docs/8.x/database-testing.md:33 +#: ./docs/9.x/database-testing.md:19 +msgid "get('/');\n\n" " // ...\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/database-testing.md:block 10 (paragraph) +# P +#: ./docs/9.x/database-testing.md:44 +#: ./docs/10.x/database-testing.md:41 +#: ./docs/11.x/database-testing.md:57 +#: ./docs/master/database-testing.md:57 msgid "The `Illuminate\\Foundation\\Testing\\RefreshDatabase` trait does not migrate your database if your schema is up to date. Instead, it will only execute the test within a database transaction. Therefore, any records added to the database by test cases that do not use this trait may still exist in the database." -msgstr "當資料庫架構 (Schema) 已是最新的時候, `Illuminate\\Foundation\\Testing\\RefreshDatabase` Trait 將不會執行資料庫遷移 (Migration),只會在資料庫 Transaction 中執行測試。因此,在未使用該 Trait 中的測試例中,若有新增紀錄,將會保留在資料庫中。" +msgstr "" -#: docs/10.x/database-testing.md:block 11 (paragraph) +# P +#: ./docs/9.x/database-testing.md:46 +#: ./docs/10.x/database-testing.md:43 +#: ./docs/11.x/database-testing.md:59 +#: ./docs/master/database-testing.md:59 msgid "If you would like to totally reset the database, you may use the `Illuminate\\Foundation\\Testing\\DatabaseMigrations` or `Illuminate\\Foundation\\Testing\\DatabaseTruncation` traits instead. However, both of these options are significantly slower than the `RefreshDatabase` trait." -msgstr "若想完整重設資料庫,請改用 `Illuminate\\Foundation\\Testing\\DatabaseMigrations` 或 `Illuminate\\Foundation\\Testing\\DatabaseTruncation` Trait。不過,這兩種方式都會比 `RefreshDatabase` Trait 慢很多。" +msgstr "" -#: docs/10.x/database-testing.md:block 13 (header) +# P +#: ./docs/9.x/database-testing.md:48 +#: ./docs/10.x/database-testing.md:45 +#: ./docs/11.x/database-testing.md:61 +#: ./docs/master/database-testing.md:61 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/database-testing.md:49 +#: ./docs/10.x/database-testing.md:46 +#: ./docs/11.x/database-testing.md:62 +#: ./docs/master/database-testing.md:62 msgid "Model Factories" -msgstr "Model Factory" +msgstr "" -#: docs/10.x/database-testing.md:block 14 (paragraph) +# P +#: ./docs/9.x/database-testing.md:51 +#: ./docs/10.x/database-testing.md:48 +#: ./docs/11.x/database-testing.md:64 +#: ./docs/master/database-testing.md:64 msgid "When testing, you may need to insert a few records into your database before executing your test. Instead of manually specifying the value of each column when you create this test data, Laravel allows you to define a set of default attributes for each of your [Eloquent models](/docs/{{version}}/eloquent) using [model factories](/docs/{{version}}/eloquent-factories)." -msgstr "在測試時,我們可能會需要在執行測試前先插入一些資料到資料庫內。比起在建立這個測試資料時手動指定各個欄位的值,在 Laravel 中,我們可以使用 [Model Factory]((/docs/{{version}}/eloquent-factories) 來為各個 [Eloquent Model](/docs/{{version}}/eloquent) 定義一系列的預設屬性。" - -#: docs/10.x/database-testing.md:block 15 (paragraph) -msgid "To learn more about creating and utilizing model factories to create models, please consult the complete [model factory documentation](/docs/{{version}}/eloquent-factories). Once you have defined a model factory, you may utilize the factory within your test to create models:" -msgstr "若要瞭解更多有關建立 Model Factory,或是使用 Model Factory 來建立 Model 的資訊,請參考完整的 [Model Factory 說明文件](/docs/{{version}}/eloquent-factories)。定義好 Model Factory 後,就可以在測試中使用 Factory 來建立 Model:" +msgstr "" -#: docs/10.x/database-testing.md:block 16 (code) +# CODE +# CODE: php tab=PHPUnit +#: ./docs/10.x/database-testing.md:52 +#: ./docs/11.x/database-testing.md:78 +#: ./docs/master/database-testing.md:78 msgid "use App\\Models\\User;\n\n" "public function test_models_can_be_instantiated(): void\n" "{\n" " $user = User::factory()->create();\n\n" " // ...\n" -"}\n" -msgstr "use App\\Models\\User;\n\n" -"public function test_models_can_be_instantiated(): void\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/database-testing.md:53 +#: ./docs/10.x/database-testing.md:50 +#: ./docs/11.x/database-testing.md:66 +#: ./docs/master/database-testing.md:66 +msgid "To learn more about creating and utilizing model factories to create models, please consult the complete [model factory documentation](/docs/{{version}}/eloquent-factories). Once you have defined a model factory, you may utilize the factory within your test to create models:" +msgstr "" + +# CODE +#: ./docs/9.x/database-testing.md:55 +msgid "use App\\Models\\User;\n\n" +"public function test_models_can_be_instantiated()\n" "{\n" " $user = User::factory()->create();\n\n" " // ...\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/database-testing.md:block 18 (header) -msgid "Running Seeders" -msgstr "執行 Seeder" +# P +#: ./docs/8.x/database-testing.md:58 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/database-testing.md:block 19 (paragraph) -msgid "If you would like to use [database seeders](/docs/{{version}}/seeding) to populate your database during a feature test, you may invoke the `seed` method. By default, the `seed` method will execute the `DatabaseSeeder`, which should execute all of your other seeders. Alternatively, you pass a specific seeder class name to the `seed` method:" -msgstr "若想使用[資料庫 Seeder](/docs/{{version}}/seeding) 來在功能測試時修改資料庫,則可以叫用 `seed` 方法。預設情況下,`seed` 方法會執行 `DatabaseSeeder`,該 Seeder 應用來執行所有其他的 Seeder。或者,也可以傳入指定的 Seeder 類別名稱給 `seed` 方法:" +# H2 +#: ./docs/8.x/database-testing.md:59 +msgid "Defining Model Factories" +msgstr "" -#: docs/10.x/database-testing.md:block 20 (code) +# P +#: ./docs/8.x/database-testing.md:61 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/database-testing.md:62 +msgid "Concept Overview" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:64 +msgid "First, let's talk about Eloquent model factories. When testing, you may need to insert a few records into your database before executing your test. Instead of manually specifying the value of each column when you create this test data, Laravel allows you to define a set of default attributes for each of your [Eloquent models](/docs/{{version}}/eloquent) using model factories." +msgstr "" + +# CODE +# CODE: php tab=PHPUnit +#: ./docs/10.x/database-testing.md:66 +#: ./docs/11.x/database-testing.md:121 +#: ./docs/master/database-testing.md:121 msgid "create();\n\n" +" // ...\n" +"});" +msgstr "" + +# CODE +#: ./docs/8.x/database-testing.md:68 +msgid "namespace Database\\Factories;\n\n" +"use Illuminate\\Database\\Eloquent\\Factories\\Factory;\n" +"use Illuminate\\Support\\Str;\n\n" +"class UserFactory extends Factory\n" "{\n" -" use RefreshDatabase;\n\n" " /**\n" -" * Test creating a new order.\n" +" * Define the model's default state.\n" +" *\n" +" * @return array\n" " */\n" -" public function test_orders_can_be_created(): void\n" +" public function definition()\n" " {\n" -" // 執行 DatabaseSeeder...\n" -" $this->seed();\n\n" -" // 執行特定的 Seeder...\n" -" $this->seed(OrderStatusSeeder::class);\n\n" -" // ...\n\n" -" // 執行一組特定 Seeder 的陣列...\n" -" $this->seed([\n" -" OrderStatusSeeder::class,\n" -" TransactionStatusSeeder::class,\n" -" // ...\n" -" ]);\n" +" return [\n" +" 'name' => $this->faker->name(),\n" +" 'email' => $this->faker->unique()->safeEmail(),\n" +" 'email_verified_at' => now(),\n" +" 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password\n" +" 'remember_token' => Str::random(10),\n" +" ];\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/database-testing.md:block 21 (paragraph) -msgid "Alternatively, you may instruct Laravel to automatically seed the database before each test that uses the `RefreshDatabase` trait. You may accomplish this by defining a `$seed` property on your base test class:" -msgstr "或者,也可以使用 `RefreshDatabase` Trait 來讓 Laravel 在每次測試前都自動執行資料庫 Seed。可以通過在基礎測試類別上定義 `$seed` 屬性來完成:" +# P +#: ./docs/8.x/database-testing.md:92 +msgid "As you can see, in their most basic form, factories are classes that extend Laravel's base factory class and define `definition` method. The `definition` method returns the default set of attribute values that should be applied when creating a model using the factory." +msgstr "" -#: docs/10.x/database-testing.md:block 22 (code) +# CODE: php tab=Pest +#: ./docs/11.x/database-testing.md:94 +#: ./docs/master/database-testing.md:94 msgid "seed();\n\n" +" // Run a specific seeder...\n" +" $this->seed(OrderStatusSeeder::class);\n\n" +" // ...\n\n" +" // Run an array of specific seeders...\n" +" $this->seed([\n" +" OrderStatusSeeder::class,\n" +" TransactionStatusSeeder::class,\n" +" // ...\n" +" ]);\n" +"});" +msgstr "" -#: docs/10.x/database-testing.md:block 23 (paragraph) -msgid "When the `$seed` property is `true`, the test will run the `Database\\Seeders\\DatabaseSeeder` class before each test that uses the `RefreshDatabase` trait. However, you may specify a specific seeder that should be executed by defining a `$seeder` property on your test class:" -msgstr "當 `$seed` 屬性為 `true` 時,各個使用了 `RefreshDatabase` Trait 的測試都會在開始前先執行 `Database\\Seeders\\DatabaseSeeder` 類別。不過,也可以通過在測試類別內定義 `$seeder` 屬性來指定要執行的 Seeder。" +# P +#: ./docs/8.x/database-testing.md:94 +msgid "Via the `faker` property, factories have access to the [Faker](https://github.com/FakerPHP/Faker) PHP library, which allows you to conveniently generate various kinds of random data for testing." +msgstr "" -#: docs/10.x/database-testing.md:block 24 (code) -msgid "use Database\\Seeders\\OrderStatusSeeder;\n\n" -"/**\n" -" * Run a specific seeder before each test.\n" -" *\n" -" * @var string\n" -" */\n" -"protected $seeder = OrderStatusSeeder::class;\n" -msgstr "use Database\\Seeders\\OrderStatusSeeder;\n\n" -"/**\n" -" * Run a specific seeder before each test.\n" -" *\n" -" * @var string\n" -" */\n" -"protected $seeder = OrderStatusSeeder::class;\n" +# P +#: ./docs/8.x/database-testing.md:96 +msgid "You can set your application's Faker locale by adding a `faker_locale` option to your `config/app.php` configuration file." +msgstr "" -#: docs/10.x/database-testing.md:block 26 (header) -msgid "Available Assertions" -msgstr "可用的 Assertion" +# P +#: ./docs/8.x/database-testing.md:98 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/database-testing.md:block 27 (paragraph) -msgid "Laravel provides several database assertions for your [PHPUnit](https://phpunit.de/) feature tests. We'll discuss each of these assertions below." -msgstr "Laravel 為 [PHPUnit] 功能測試提供了多個資料庫 Assertion。我們會在下方討論逐個討論這些 Assertion。" +# H3 +#: ./docs/8.x/database-testing.md:99 +msgid "Generating Factories" +msgstr "" -#: docs/10.x/database-testing.md:block 29 (header) -msgid "assertDatabaseCount" -msgstr "assertDatabaseCount" +# P +#: ./docs/8.x/database-testing.md:101 +msgid "To create a factory, execute the `make:factory` [Artisan command](/docs/{{version}}/artisan):" +msgstr "" -#: docs/10.x/database-testing.md:block 30 (paragraph) -msgid "Assert that a table in the database contains the given number of records:" -msgstr "判斷資料庫中的某個資料表是否包含給定數量的記錄:" +# CODE +#: ./docs/8.x/database-testing.md:103 +msgid "php artisan make:factory PostFactory" +msgstr "" -#: docs/10.x/database-testing.md:block 31 (code) -msgid "$this->assertDatabaseCount('users', 5);\n" -msgstr "$this->assertDatabaseCount('users', 5);\n" +# P +#: ./docs/8.x/database-testing.md:105 +msgid "The new factory class will be placed in your `database/factories` directory." +msgstr "" -#: docs/10.x/database-testing.md:block 33 (header) -msgid "assertDatabaseHas" -msgstr "assertDatabaseHas" +# P +#: ./docs/8.x/database-testing.md:107 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/database-testing.md:block 34 (paragraph) -msgid "Assert that a table in the database contains records matching the given key / value query constraints:" -msgstr "判斷資料庫中的某個資料表包含符合給定索引鍵/值查詢條件的記錄:" +# H4 +#: ./docs/8.x/database-testing.md:108 +msgid "Model & Factory Discovery Conventions" +msgstr "" -#: docs/10.x/database-testing.md:block 35 (code) -msgid "$this->assertDatabaseHas('users', [\n" -" 'email' => 'sally@example.com',\n" -"]);\n" -msgstr "$this->assertDatabaseHas('users', [\n" -" 'email' => 'sally@example.com',\n" -"]);\n" +# P +#: ./docs/8.x/database-testing.md:110 +msgid "Once you have defined your factories, you may use the static `factory` method provided to your models by the `Illuminate\\Database\\Eloquent\\Factories\\HasFactory` trait in order to instantiate a factory instance for that model." +msgstr "" -#: docs/10.x/database-testing.md:block 37 (header) -msgid "assertDatabaseMissing" -msgstr "assertDatabaseMissing" +# P +#: ./docs/8.x/database-testing.md:112 +msgid "The `HasFactory` trait's `factory` method will use conventions to determine the proper factory for the model the trait is assigned to. Specifically, the method will look for a factory in the `Database\\Factories` namespace that has a class name matching the model name and is suffixed with `Factory`. If these conventions do not apply to your particular application or factory, you may overwrite the `newFactory` method on your model to return an instance of the model's corresponding factory directly:" +msgstr "" -#: docs/10.x/database-testing.md:block 38 (paragraph) -msgid "Assert that a table in the database does not contain records matching the given key / value query constraints:" -msgstr "判斷資料庫中的某個資料表是否不包含符合給定索引鍵/值查詢條件的記錄:" +# CODE +#: ./docs/8.x/database-testing.md:114 +msgid "use Database\\Factories\\Administration\\FlightFactory;\n\n" +"/**\n" +" * Create a new factory instance for the model.\n" +" *\n" +" * @return \\Illuminate\\Database\\Eloquent\\Factories\\Factory\n" +" */\n" +"protected static function newFactory()\n" +"{\n" +" return FlightFactory::new();\n" +"}" +msgstr "" -#: docs/10.x/database-testing.md:block 39 (code) -msgid "$this->assertDatabaseMissing('users', [\n" -" 'email' => 'sally@example.com',\n" -"]);\n" -msgstr "$this->assertDatabaseMissing('users', [\n" -" 'email' => 'sally@example.com',\n" -"]);\n" +# P +#: ./docs/8.x/database-testing.md:126 +msgid "Next, define a `model` property on the corresponding factory:" +msgstr "" -#: docs/10.x/database-testing.md:block 41 (header) -msgid "assertSoftDeleted" -msgstr "assertSoftDeleted" +# CODE +#: ./docs/8.x/database-testing.md:128 +msgid "use App\\Administration\\Flight;\n" +"use Illuminate\\Database\\Eloquent\\Factories\\Factory;\n\n" +"class FlightFactory extends Factory\n" +"{\n" +" /**\n" +" * The name of the factory's corresponding model.\n" +" *\n" +" * @var string\n" +" */\n" +" protected $model = Flight::class;\n" +"}" +msgstr "" -#: docs/10.x/database-testing.md:block 42 (paragraph) -msgid "The `assertSoftDeleted` method may be used to assert a given Eloquent model has been \"soft deleted\":" -msgstr "`assertSoftDeleted` 方法可用來判斷給定 Eloquent Model 是否已「軟刪除 (Soft Delete)」:" +# P +#: ./docs/8.x/database-testing.md:141 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/database-testing.md:block 43 (code) -msgid "$this->assertSoftDeleted($user);\n" -msgstr "$this->assertSoftDeleted($user);\n" +# H3 +#: ./docs/8.x/database-testing.md:142 +msgid "Factory States" +msgstr "" -#: docs/10.x/database-testing.md:block 45 (header) -msgid "assertNotSoftDeleted" -msgstr "assertNotSoftDeleted" +# P +#: ./docs/8.x/database-testing.md:144 +msgid "State manipulation methods allow you to define discrete modifications that can be applied to your model factories in any combination. For example, your `Database\\Factories\\UserFactory` factory might contain a `suspended` state method that modifies one of its default attribute values." +msgstr "" -#: docs/10.x/database-testing.md:block 46 (paragraph) -msgid "The `assertNotSoftDeleted` method may be used to assert a given Eloquent model hasn't been \"soft deleted\":" -msgstr "`assertNotSoftDeleted` 方法可用來判斷給定 Eloquent Model 是否未被「軟刪除 (Soft Delete)」:" - -#: docs/10.x/database-testing.md:block 47 (code) -msgid "$this->assertNotSoftDeleted($user);\n" -msgstr "$this->assertNotSoftDeleted($user);\n" - -#: docs/10.x/database-testing.md:block 49 (header) -msgid "assertModelExists" -msgstr "assertModelExists" - -#: docs/10.x/database-testing.md:block 50 (paragraph) -msgid "Assert that a given model exists in the database:" -msgstr "判斷給定 Model 存在資料庫中:" - -#: docs/10.x/database-testing.md:block 51 (code) -msgid "use App\\Models\\User;\n\n" -"$user = User::factory()->create();\n\n" -"$this->assertModelExists($user);\n" -msgstr "use App\\Models\\User;\n\n" -"$user = User::factory()->create();\n\n" -"$this->assertModelExists($user);\n" - -#: docs/10.x/database-testing.md:block 53 (header) -msgid "assertModelMissing" -msgstr "assertModelMissing" - -#: docs/10.x/database-testing.md:block 54 (paragraph) -msgid "Assert that a given model does not exist in the database:" -msgstr "判斷給定 Model 不存在資料庫中:" - -#: docs/10.x/database-testing.md:block 55 (code) -msgid "use App\\Models\\User;\n\n" -"$user = User::factory()->create();\n\n" -"$user->delete();\n\n" -"$this->assertModelMissing($user);\n" -msgstr "use App\\Models\\User;\n\n" -"$user = User::factory()->create();\n\n" -"$user->delete();\n\n" -"$this->assertModelMissing($user);\n" - -#: docs/10.x/database-testing.md:block 57 (header) -msgid "expectsDatabaseQueryCount" -msgstr "expectsDatabaseQueryCount" - -#: docs/10.x/database-testing.md:block 58 (paragraph) -msgid "The `expectsDatabaseQueryCount` method may be invoked at the beginning of your test to specify the total number of database queries that you expect to be run during the test. If the actual number of executed queries does not exactly match this expectation, the test will fail:" -msgstr "可以在測試的最開始呼叫 `expectsDatabaseQueryCount` 方法來指定在執行此測試的期間預期執行多少筆資料庫查詢。若實際執行的查詢數不符合該預期,測試就會失敗:" - -#: docs/10.x/database-testing.md:block 59 (code) -msgid "$this->expectsDatabaseQueryCount(5);\n\n" -"// Test...\n" -msgstr "$this->expectsDatabaseQueryCount(5);\n\n" -"// 測試...\n" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Defining Model Factories](#defining-model-factories)" -msgstr "[定義 Model Factory](#defining-model-factories)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Concept Overview](#concept-overview)" -msgstr "[概念概覽](#concept-overview)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Generating Factories](#generating-factories)" -msgstr "[產生 Factory](#generating-factories)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Factory States](#factory-states)" -msgstr "[Factory 狀態](#factory-states)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Factory Callbacks](#factory-callbacks)" -msgstr "[Factory 回呼](#factory-callbacks)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Creating Models Using Factories](#creating-models-using-factories)" -msgstr "[使用 Factory 建立 Model](#creating-models-using-factories)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Instantiating Models](#instantiating-models)" -msgstr "[初始化 Model](#instantiating-models)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Persisting Models](#persisting-models)" -msgstr "[保存 Model](#persisting-models)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Sequences](#sequences)" -msgstr "[序列](#sequences)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Factory Relationships](#factory-relationships)" -msgstr "[Factory 關聯](#factory-relationships)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Has Many Relationships](#has-many-relationships)" -msgstr "[HasMany 關聯](#has-many-relationships)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Belongs To Relationships](#belongs-to-relationships)" -msgstr "[BelongsTo 關聯](#belongs-to-relationships)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Many To Many Relationships](#many-to-many-relationships)" -msgstr "[多對多關聯](#many-to-many-relationships)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Polymorphic Relationships](#polymorphic-relationships)" -msgstr "[多型關聯](#polymorphic-relationships)" - -#: docs/8.x/database-testing.md:block 2 (unordered list) -msgid "[Defining Relationships Within Factories](#defining-relationships-within-factories)" -msgstr "[在 Factory 內定義關聯](#defining-relationships-within-factories)" - -#: docs/8.x/database-testing.md:block 9 (code) -msgid "get('/');\n\n" -" // ...\n" -" }\n" -"}\n" -msgstr "get('/');\n\n" -" // ...\n" -" }\n" -"}\n" - -#: docs/8.x/database-testing.md:block 11 (header) -msgid "Defining Model Factories" -msgstr "定義 Model Factory" - -#: docs/8.x/database-testing.md:block 13 (header) -msgid "Concept Overview" -msgstr "概念概覽" - -#: docs/8.x/database-testing.md:block 14 (paragraph) -msgid "First, let's talk about Eloquent model factories. When testing, you may need to insert a few records into your database before executing your test. Instead of manually specifying the value of each column when you create this test data, Laravel allows you to define a set of default attributes for each of your [Eloquent models](/docs/{{version}}/eloquent) using model factories." -msgstr "首先,來討論有關 Eloquent Model Factory。在測試時,我們可能會需要在執行測試前先插入一些資料到資料庫內。比起在建立這個測試資料時手動指定各個欄位的值,Laravel 中可以使用 Model Factory 來為各個 [Eloquent Model](/docs/{{version}}/eloquent) 定義一系列的預設屬性。" - -#: docs/8.x/database-testing.md:block 15 (paragraph) -msgid "To see an example of how to write a factory, take a look at the `database/factories/UserFactory.php` file in your application. This factory is included with all new Laravel applications and contains the following factory definition:" -msgstr "若要看看如何撰寫 Factory 的範例,請參考專案中的 `database/factories/UserFactory.php`。該 Factory 包含在所有的 Laravel 新專案內,裡面有下列 Factory 定義:" - -#: docs/8.x/database-testing.md:block 16 (code) -msgid "namespace Database\\Factories;\n\n" -"use Illuminate\\Database\\Eloquent\\Factories\\Factory;\n" -"use Illuminate\\Support\\Str;\n\n" -"class UserFactory extends Factory\n" -"{\n" -" /**\n" -" * Define the model's default state.\n" -" *\n" -" * @return array\n" -" */\n" -" public function definition()\n" -" {\n" -" return [\n" -" 'name' => $this->faker->name(),\n" -" 'email' => $this->faker->unique()->safeEmail(),\n" -" 'email_verified_at' => now(),\n" -" 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password\n" -" 'remember_token' => Str::random(10),\n" -" ];\n" -" }\n" -"}\n" -msgstr "namespace Database\\Factories;\n\n" -"use Illuminate\\Database\\Eloquent\\Factories\\Factory;\n" -"use Illuminate\\Support\\Str;\n\n" -"class UserFactory extends Factory\n" -"{\n" -" /**\n" -" * Define the model's default state.\n" -" *\n" -" * @return array\n" -" */\n" -" public function definition()\n" -" {\n" -" return [\n" -" 'name' => $this->faker->name(),\n" -" 'email' => $this->faker->unique()->safeEmail(),\n" -" 'email_verified_at' => now(),\n" -" 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password\n" -" 'remember_token' => Str::random(10),\n" -" ];\n" -" }\n" -"}\n" - -#: docs/8.x/database-testing.md:block 17 (paragraph) -msgid "As you can see, in their most basic form, factories are classes that extend Laravel's base factory class and define `definition` method. The `definition` method returns the default set of attribute values that should be applied when creating a model using the factory." -msgstr "如上所示,最基礎的 Factory 格式就像這樣,只需繼承 Laravel 的基礎 Factory 類別並定義一個 `definition` 方法。`definition` 方法應回傳一組預設的屬性值,會在使用 Factory 建立 Model 時被套用到該 Model 上。" - -#: docs/8.x/database-testing.md:block 18 (paragraph) -msgid "Via the `faker` property, factories have access to the [Faker](https://github.com/FakerPHP/Faker) PHP library, which allows you to conveniently generate various kinds of random data for testing." -msgstr "通過 `faker` 屬性,Factory 就可以存取 [Faker](https://github.com/FakerPHP/Faker) PHP 函式庫。該函式庫可用來方便地產生各種類型的隨機資料以進行測試。" - -#: docs/8.x/database-testing.md:block 19 (quote) -msgid "{tip} You can set your application's Faker locale by adding a `faker_locale` option to your `config/app.php` configuration file." -msgstr "{tip} 可以通過在 `config/app.php` 設定檔中加上 `faker_locale` 選項來設定應用程式的 Faker 語系設定。" - -#: docs/8.x/database-testing.md:block 21 (header) -msgid "Generating Factories" -msgstr "產生 Factory" - -#: docs/8.x/database-testing.md:block 22 (paragraph) -msgid "To create a factory, execute the `make:factory` [Artisan command](/docs/{{version}}/artisan):" -msgstr "若要建立 Factory,請執行 `make:factory` [Artisan 指令](/docs/{{version}}/artisan):" - -#: docs/8.x/database-testing.md:block 23 (code) -msgid "php artisan make:factory PostFactory\n" -msgstr "php artisan make:factory PostFactory\n" - -#: docs/8.x/database-testing.md:block 24 (paragraph) -msgid "The new factory class will be placed in your `database/factories` directory." -msgstr "新的 Factory 類別會被放在 `database/factories` 目錄內。" - -#: docs/8.x/database-testing.md:block 26 (header) -msgid "Model & Factory Discovery Conventions" -msgstr "Model 於 Factory 的自動偵測慣例" - -#: docs/8.x/database-testing.md:block 27 (paragraph) -msgid "Once you have defined your factories, you may use the static `factory` method provided to your models by the `Illuminate\\Database\\Eloquent\\Factories\\HasFactory` trait in order to instantiate a factory instance for that model." -msgstr "定義好 Factory 後,就可以使用 `Illuminate\\Database\\Eloquent\\Factories\\HasFactory` Trait 提供給 Model 的靜態 `factory` 方法來為該 Model 初始化一個 Factory 實體。" - -#: docs/8.x/database-testing.md:block 28 (paragraph) -msgid "The `HasFactory` trait's `factory` method will use conventions to determine the proper factory for the model the trait is assigned to. Specifically, the method will look for a factory in the `Database\\Factories` namespace that has a class name matching the model name and is suffixed with `Factory`. If these conventions do not apply to your particular application or factory, you may overwrite the `newFactory` method on your model to return an instance of the model's corresponding factory directly:" -msgstr "`HasFactory` Trait 的 `factory` 方法會使用慣例來判斷適合用於該 Model 的 Factory。更準確來講,該方法會在 `Database\\Factories` 命名空間下尋找符合該 Model 名稱並以 `Factory` 結尾的類別。若這些慣例不適合用在你正在寫的專案或 Factory,則可以在 Model 上複寫 `newFactory` 方法來直接回傳與該 Model 對應的 Factory 實體:" - -#: docs/8.x/database-testing.md:block 29 (code) -msgid "use Database\\Factories\\Administration\\FlightFactory;\n\n" -"/**\n" -" * Create a new factory instance for the model.\n" -" *\n" -" * @return \\Illuminate\\Database\\Eloquent\\Factories\\Factory\n" -" */\n" -"protected static function newFactory()\n" -"{\n" -" return FlightFactory::new();\n" -"}\n" -msgstr "use Database\\Factories\\Administration\\FlightFactory;\n\n" -"/**\n" -" * Create a new factory instance for the model.\n" -" *\n" -" * @return \\Illuminate\\Database\\Eloquent\\Factories\\Factory\n" -" */\n" -"protected static function newFactory()\n" -"{\n" -" return FlightFactory::new();\n" -"}\n" - -#: docs/8.x/database-testing.md:block 30 (paragraph) -msgid "Next, define a `model` property on the corresponding factory:" -msgstr "接著,在對應的 Factory 上定義一個 `model` 屬性:" - -#: docs/8.x/database-testing.md:block 31 (code) -msgid "use App\\Administration\\Flight;\n" -"use Illuminate\\Database\\Eloquent\\Factories\\Factory;\n\n" -"class FlightFactory extends Factory\n" -"{\n" -" /**\n" -" * The name of the factory's corresponding model.\n" -" *\n" -" * @var string\n" -" */\n" -" protected $model = Flight::class;\n" -"}\n" -msgstr "use App\\Administration\\Flight;\n" -"use Illuminate\\Database\\Eloquent\\Factories\\Factory;\n\n" -"class FlightFactory extends Factory\n" -"{\n" -" /**\n" -" * The name of the factory's corresponding model.\n" -" *\n" -" * @var string\n" -" */\n" -" protected $model = Flight::class;\n" -"}\n" - -#: docs/8.x/database-testing.md:block 33 (header) -msgid "Factory States" -msgstr "Factory State" - -#: docs/8.x/database-testing.md:block 34 (paragraph) -msgid "State manipulation methods allow you to define discrete modifications that can be applied to your model factories in any combination. For example, your `Database\\Factories\\UserFactory` factory might contain a `suspended` state method that modifies one of its default attribute values." -msgstr "State 操作方法可定義一些個別的修改,並可任意組合套用到 Model Factory 上。舉例來說,`Database\\Factories\\UserFactory` Factory 可包含一個 `suspended` (已停用) State 方法,用來修改該 Model Factory 的預設屬性值。" - -#: docs/8.x/database-testing.md:block 35 (paragraph) +# P +#: ./docs/8.x/database-testing.md:146 msgid "State transformation methods typically call the `state` method provided by Laravel's base factory class. The `state` method accepts a closure which will receive the array of raw attributes defined for the factory and should return an array of attributes to modify:" -msgstr "State 變換方法通常是呼叫 Laravel 基礎 Factory 類別所提供的 `state` 方法。這個 `state` 方法接受一個閉包,該閉包會收到一組陣列,陣列內包含了由這個 Factory 所定義的原始屬性。該閉包應回傳一組陣列,期中包含要修改的屬性:" +msgstr "" -#: docs/8.x/database-testing.md:block 36 (code) +# CODE +#: ./docs/8.x/database-testing.md:148 msgid "/**\n" " * Indicate that the user is suspended.\n" " *\n" @@ -635,30 +582,43 @@ msgid "/**\n" " 'account_status' => 'suspended',\n" " ];\n" " });\n" -"}\n" -msgstr "/**\n" -" * Indicate that the user is suspended.\n" -" *\n" -" * @return \\Illuminate\\Database\\Eloquent\\Factories\\Factory\n" -" */\n" -"public function suspended()\n" +"}" +msgstr "" + +# CODE +#: ./docs/11.x/database-testing.md:160 +#: ./docs/master/database-testing.md:160 +msgid "state(function (array $attributes) {\n" -" return [\n" -" 'account_status' => 'suspended',\n" -" ];\n" -" });\n" -"}\n" +" /**\n" +" * Indicates whether the default seeder should run before each test.\n" +" *\n" +" * @var bool\n" +" */\n" +" protected $seed = true;\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:162 +#~ msgid "" +#~ msgstr "" -#: docs/8.x/database-testing.md:block 38 (header) +# H3 +#: ./docs/8.x/database-testing.md:163 msgid "Factory Callbacks" -msgstr "Factory 回呼" +msgstr "" -#: docs/8.x/database-testing.md:block 39 (paragraph) +# P +#: ./docs/8.x/database-testing.md:165 msgid "Factory callbacks are registered using the `afterMaking` and `afterCreating` methods and allow you to perform additional tasks after making or creating a model. You should register these callbacks by defining a `configure` method on your factory class. This method will be automatically called by Laravel when the factory is instantiated:" -msgstr "Factory 回呼使用 `afterMaking` 與 `afterCreating` 方法來註冊,能讓你在產生或建立 Model 時執行額外的任務。要註冊這些回呼,應在 Factory 類別上定義一個 `configure` 方法。Laravel 會在 Factory 初始化後自動呼叫這個方法:" +msgstr "" -#: docs/8.x/database-testing.md:block 40 (code) +# CODE +#: ./docs/8.x/database-testing.md:167 msgid "namespace Database\\Factories;\n\n" "use App\\Models\\User;\n" "use Illuminate\\Database\\Eloquent\\Factories\\Factory;\n" @@ -679,116 +639,229 @@ msgid "namespace Database\\Factories;\n\n" " });\n" " }\n\n" " // ...\n" -"}\n" -msgstr "namespace Database\\Factories;\n\n" -"use App\\Models\\User;\n" -"use Illuminate\\Database\\Eloquent\\Factories\\Factory;\n" -"use Illuminate\\Support\\Str;\n\n" -"class UserFactory extends Factory\n" -"{\n" -" /**\n" -" * Configure the model factory.\n" -" *\n" -" * @return $this\n" -" */\n" -" public function configure()\n" -" {\n" -" return $this->afterMaking(function (User $user) {\n" -" //\n" -" })->afterCreating(function (User $user) {\n" -" //\n" -" });\n" -" }\n\n" -" // ...\n" -"}\n" +"}" +msgstr "" + +# H4 +#: ./docs/9.x/database-testing.md:169 +#: ./docs/10.x/database-testing.md:163 +#: ./docs/11.x/database-testing.md:225 +#: ./docs/master/database-testing.md:218 +msgid "assertSoftDeleted" +msgstr "" + +# P +#: ./docs/9.x/database-testing.md:175 +#: ./docs/10.x/database-testing.md:169 +#: ./docs/11.x/database-testing.md:231 +#: ./docs/master/database-testing.md:224 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/database-testing.md:176 +#: ./docs/10.x/database-testing.md:170 +#: ./docs/11.x/database-testing.md:232 +#: ./docs/master/database-testing.md:225 +msgid "assertNotSoftDeleted" +msgstr "" + +# P +#: ./docs/9.x/database-testing.md:178 +#: ./docs/10.x/database-testing.md:172 +#: ./docs/11.x/database-testing.md:234 +#: ./docs/master/database-testing.md:227 +msgid "The `assertNotSoftDeleted` method may be used to assert a given Eloquent model hasn't been \"soft deleted\":" +msgstr "" + +# CODE +#: ./docs/9.x/database-testing.md:180 +#: ./docs/10.x/database-testing.md:174 +#: ./docs/11.x/database-testing.md:236 +#: ./docs/master/database-testing.md:229 +msgid "$this->assertNotSoftDeleted($user);" +msgstr "" -#: docs/8.x/database-testing.md:block 42 (header) +# P +#: ./docs/11.x/database-testing.md:190 +#: ./docs/master/database-testing.md:190 +msgid "Laravel provides several database assertions for your [Pest](https://pestphp.com) or [PHPUnit](https://phpunit.de) feature tests. We'll discuss each of these assertions below." +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:192 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/database-testing.md:193 msgid "Creating Models Using Factories" -msgstr "使用 Factory 來建立 Model" +msgstr "" -#: docs/8.x/database-testing.md:block 44 (header) +# P +#: ./docs/8.x/database-testing.md:195 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/database-testing.md:196 msgid "Instantiating Models" -msgstr "產生 Model" +msgstr "" -#: docs/8.x/database-testing.md:block 45 (paragraph) +# P +#: ./docs/8.x/database-testing.md:198 msgid "Once you have defined your factories, you may use the static `factory` method provided to your models by the `Illuminate\\Database\\Eloquent\\Factories\\HasFactory` trait in order to instantiate a factory instance for that model. Let's take a look at a few examples of creating models. First, we'll use the `make` method to create models without persisting them to the database:" -msgstr "定義好 Factory 後,就可以使用 `Illuminate\\Database\\Eloquent\\Factories\\HasFactory` trait 提供給 Model 的 `factory` 靜態方法來產生用於該 Model 的 Factory 實體。來看看一些建立 Model 的範例。首先,我們先使用 `make` 方法來在不儲存進資料庫的情況下建立 Model:" +msgstr "" -#: docs/8.x/database-testing.md:block 46 (code) +# P +#: ./docs/11.x/database-testing.md:199 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/11.x/database-testing.md:200 +msgid "assertDatabaseEmpty" +msgstr "" + +# CODE +#: ./docs/8.x/database-testing.md:200 msgid "use App\\Models\\User;\n\n" "public function test_models_can_be_instantiated()\n" "{\n" " $user = User::factory()->make();\n\n" " // Use model in tests...\n" -"}\n" -msgstr "use App\\Models\\User;\n\n" -"public function test_models_can_be_instantiated()\n" -"{\n" -" $user = User::factory()->make();\n\n" -" // Use model in tests...\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/database-testing.md:202 +msgid "Assert that a table in the database contains no records:" +msgstr "" + +# CODE +#: ./docs/11.x/database-testing.md:204 +msgid "$this->assertDatabaseEmpty('users');" +msgstr "" + +# P +#: ./docs/9.x/database-testing.md:206 +#: ./docs/10.x/database-testing.md:200 +#: ./docs/11.x/database-testing.md:262 +#: ./docs/master/database-testing.md:255 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/database-testing.md:207 +#: ./docs/10.x/database-testing.md:201 +#: ./docs/11.x/database-testing.md:263 +#: ./docs/master/database-testing.md:256 +msgid "expectsDatabaseQueryCount" +msgstr "" -#: docs/8.x/database-testing.md:block 47 (paragraph) +# P +#: ./docs/8.x/database-testing.md:209 msgid "You may create a collection of many models using the `count` method:" -msgstr "可以使用 `count` 方法來建立包含多個 Model 的 Collection:" +msgstr "" -#: docs/8.x/database-testing.md:block 48 (code) -msgid "$users = User::factory()->count(3)->make();\n" -msgstr "$users = User::factory()->count(3)->make();\n" +# P +#: ./docs/9.x/database-testing.md:209 +#: ./docs/10.x/database-testing.md:203 +#: ./docs/11.x/database-testing.md:265 +#: ./docs/master/database-testing.md:258 +msgid "The `expectsDatabaseQueryCount` method may be invoked at the beginning of your test to specify the total number of database queries that you expect to be run during the test. If the actual number of executed queries does not exactly match this expectation, the test will fail:" +msgstr "" + +# CODE +#: ./docs/8.x/database-testing.md:211 +msgid "$users = User::factory()->count(3)->make();" +msgstr "" -#: docs/8.x/database-testing.md:block 50 (header) +# CODE +#: ./docs/9.x/database-testing.md:211 +#: ./docs/10.x/database-testing.md:205 +#: ./docs/11.x/database-testing.md:267 +#: ./docs/master/database-testing.md:260 +msgid "$this->expectsDatabaseQueryCount(5);\n\n" +"// Test..." +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:213 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database-testing.md:214 msgid "Applying States" -msgstr "套用 State" +msgstr "" -#: docs/8.x/database-testing.md:block 51 (paragraph) +# P +#: ./docs/8.x/database-testing.md:216 msgid "You may also apply any of your [states](#factory-states) to the models. If you would like to apply multiple state transformations to the models, you may simply call the state transformation methods directly:" -msgstr "也可以將 [State](#factory-states) 套用至 Model 上。若想套用多個 State 變換到 Model 上,只需要直接呼叫 State 變換方法即可:" +msgstr "" -#: docs/8.x/database-testing.md:block 52 (code) -msgid "$users = User::factory()->count(5)->suspended()->make();\n" -msgstr "$users = User::factory()->count(5)->suspended()->make();\n" +# CODE +#: ./docs/8.x/database-testing.md:218 +msgid "$users = User::factory()->count(5)->suspended()->make();" +msgstr "" -#: docs/8.x/database-testing.md:block 54 (header) +# P +#: ./docs/8.x/database-testing.md:220 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database-testing.md:221 msgid "Overriding Attributes" -msgstr "複寫屬性" +msgstr "" -#: docs/8.x/database-testing.md:block 55 (paragraph) +# P +#: ./docs/8.x/database-testing.md:223 msgid "If you would like to override some of the default values of your models, you may pass an array of values to the `make` method. Only the specified attributes will be replaced while the rest of the attributes remain set to their default values as specified by the factory:" -msgstr "若想複寫 Model 上的一些預設值,可以傳入陣列到 `make` 方法上。只要指定要取代的屬性即可,剩下的屬性會保持 Factory 所指定的預設值:" +msgstr "" -#: docs/8.x/database-testing.md:block 56 (code) +# CODE +#: ./docs/8.x/database-testing.md:225 msgid "$user = User::factory()->make([\n" " 'name' => 'Abigail Otwell',\n" -"]);\n" -msgstr "$user = User::factory()->make([\n" -" 'name' => 'Abigail Otwell',\n" -"]);\n" +"]);" +msgstr "" -#: docs/8.x/database-testing.md:block 57 (paragraph) +# P +#: ./docs/8.x/database-testing.md:229 msgid "Alternatively, the `state` method may be called directly on the factory instance to perform an inline state transformation:" -msgstr "或者,也可以直接在 Factory 實體上呼叫 `state` 方法來內嵌 State 變換:" +msgstr "" -#: docs/8.x/database-testing.md:block 58 (code) +# CODE +#: ./docs/8.x/database-testing.md:231 msgid "$user = User::factory()->state([\n" " 'name' => 'Abigail Otwell',\n" -"])->make();\n" -msgstr "$user = User::factory()->state([\n" -" 'name' => 'Abigail Otwell',\n" -"])->make();\n" +"])->make();" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:235 +msgid "[Mass assignment protection](/docs/{{version}}/eloquent#mass-assignment) is automatically disabled when creating models using factories." +msgstr "" -#: docs/8.x/database-testing.md:block 59 (quote) -msgid "{tip} [Mass assignment protection](/docs/{{version}}/eloquent#mass-assignment) is automatically disabled when creating models using factories." -msgstr "{tip} [大量賦值保護](/docs/{{version}}/eloquent#mass-assignment) 會在使用 Factory 建立 Model 時自動禁用。" +# P +#: ./docs/8.x/database-testing.md:237 +#~ msgid "" +#~ msgstr "" -#: docs/8.x/database-testing.md:block 61 (header) +# H3 +#: ./docs/8.x/database-testing.md:238 msgid "Persisting Models" -msgstr "持續性 Model" +msgstr "" -#: docs/8.x/database-testing.md:block 62 (paragraph) +# P +#: ./docs/8.x/database-testing.md:240 msgid "The `create` method instantiates model instances and persists them to the database using Eloquent's `save` method:" -msgstr "`create` 方法會產生 Model 實體並使用 Eloquent 的 `save` 方法來將其永久保存於資料庫內:" +msgstr "" -#: docs/8.x/database-testing.md:block 63 (code) +# CODE +#: ./docs/8.x/database-testing.md:242 msgid "use App\\Models\\User;\n\n" "public function test_models_can_be_persisted()\n" "{\n" @@ -797,38 +870,38 @@ msgid "use App\\Models\\User;\n\n" " // Create three App\\Models\\User instances...\n" " $users = User::factory()->count(3)->create();\n\n" " // Use model in tests...\n" -"}\n" -msgstr "use App\\Models\\User;\n\n" -"public function test_models_can_be_persisted()\n" -"{\n" -" // 建立單一 App\\Models\\User 實體...\n" -" $user = User::factory()->create();\n\n" -" // 建立三個 App\\Models\\User 實體...\n" -" $users = User::factory()->count(3)->create();\n\n" -" // 在測試中使用 Model...\n" -"}\n" +"}" +msgstr "" -#: docs/8.x/database-testing.md:block 64 (paragraph) +# P +#: ./docs/8.x/database-testing.md:255 msgid "You may override the factory's default model attributes by passing an array of attributes to the `create` method:" -msgstr "可以通過將一組屬性陣列傳入 `create` 方法來複寫該 Factory 的預設 Model 屬性:" +msgstr "" -#: docs/8.x/database-testing.md:block 65 (code) +# CODE +#: ./docs/8.x/database-testing.md:257 msgid "$user = User::factory()->create([\n" " 'name' => 'Abigail',\n" -"]);\n" -msgstr "$user = User::factory()->create([\n" -" 'name' => 'Abigail',\n" -"]);\n" +"]);" +msgstr "" -#: docs/8.x/database-testing.md:block 67 (header) +# P +#: ./docs/8.x/database-testing.md:261 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/database-testing.md:262 msgid "Sequences" -msgstr "Sequence (序列)" +msgstr "" -#: docs/8.x/database-testing.md:block 68 (paragraph) +# P +#: ./docs/8.x/database-testing.md:264 msgid "Sometimes you may wish to alternate the value of a given model attribute for each created model. You may accomplish this by defining a state transformation as a sequence. For example, you may wish to alternate the value of an `admin` column between `Y` and `N` for each created user:" -msgstr "有時候,我們可能會需要為每個建立的 Model 更改某個特定的屬性。可以通過將 State 變換定義為序列來達成。舉例來說,我們可能會想為每個建立的使用者設定 `admin` 欄位的值為 `Y` 或 `N`:" +msgstr "" -#: docs/8.x/database-testing.md:block 69 (code) +# CODE +#: ./docs/8.x/database-testing.md:266 msgid "use App\\Models\\User;\n" "use Illuminate\\Database\\Eloquent\\Factories\\Sequence;\n\n" "$users = User::factory()\n" @@ -837,94 +910,95 @@ msgid "use App\\Models\\User;\n" " ['admin' => 'Y'],\n" " ['admin' => 'N'],\n" " ))\n" -" ->create();\n" -msgstr "use App\\Models\\User;\n" -"use Illuminate\\Database\\Eloquent\\Factories\\Sequence;\n\n" -"$users = User::factory()\n" -" ->count(10)\n" -" ->state(new Sequence(\n" -" ['admin' => 'Y'],\n" -" ['admin' => 'N'],\n" -" ))\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 70 (paragraph) +# P +#: ./docs/8.x/database-testing.md:277 msgid "In this example, five users will be created with an `admin` value of `Y` and five users will be created with an `admin` value of `N`." -msgstr "在上面的範例中,有五個使用者會以 `admin` 值 `Y` 建立,另外五個使用者將以 `admin` 值 `N` 建立。" +msgstr "" -#: docs/8.x/database-testing.md:block 71 (paragraph) +# P +#: ./docs/8.x/database-testing.md:279 msgid "If necessary, you may include a closure as a sequence value. The closure will be invoked each time the sequence needs a new value:" -msgstr "若有需要,也可以提供閉包作為序列的值。該閉包會在每次序列需要新值是被叫用:" +msgstr "" -#: docs/8.x/database-testing.md:block 72 (code) +# CODE +#: ./docs/8.x/database-testing.md:281 msgid "$users = User::factory()\n" " ->count(10)\n" " ->state(new Sequence(\n" " fn ($sequence) => ['role' => UserRoles::all()->random()],\n" " ))\n" -" ->create();\n" -msgstr "$users = User::factory()\n" -" ->count(10)\n" -" ->state(new Sequence(\n" -" fn ($sequence) => ['role' => UserRoles::all()->random()],\n" -" ))\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 73 (paragraph) +# P +#: ./docs/8.x/database-testing.md:288 msgid "Within a sequence closure, you may access the `$index` or `$count` properties on the sequence instance that is injected into the closure. The `$index` property contains the number of iterations through the sequence that have occurred thus far, while the `$count` property contains the total number of times the sequence will be invoked:" -msgstr "在 Sequence 閉包中,可以在注入到閉包中的 Sequence 實體上存取 `$index` 與 `$count` 屬性。`$index` 屬性包含了該 Sequence 到目前為止所進行的迭代數,而 `$count` 屬性則代表了該 Sequence 總過將被叫用幾次:" +msgstr "" -#: docs/8.x/database-testing.md:block 74 (code) +# CODE +#: ./docs/8.x/database-testing.md:290 msgid "$users = User::factory()\n" " ->count(10)\n" " ->sequence(fn ($sequence) => ['name' => 'Name '.$sequence->index])\n" -" ->create();\n" -msgstr "$users = User::factory()\n" -" ->count(10)\n" -" ->sequence(fn ($sequence) => ['name' => 'Name '.$sequence->index])\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 76 (header) +# P +#: ./docs/8.x/database-testing.md:295 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/database-testing.md:296 msgid "Factory Relationships" -msgstr "Factory 關聯" +msgstr "" -#: docs/8.x/database-testing.md:block 78 (header) +# P +#: ./docs/8.x/database-testing.md:298 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/database-testing.md:299 msgid "Has Many Relationships" -msgstr "Has Many 關聯" +msgstr "" -#: docs/8.x/database-testing.md:block 79 (paragraph) +# P +#: ./docs/8.x/database-testing.md:301 msgid "Next, let's explore building Eloquent model relationships using Laravel's fluent factory methods. First, let's assume our application has an `App\\Models\\User` model and an `App\\Models\\Post` model. Also, let's assume that the `User` model defines a `hasMany` relationship with `Post`. We can create a user that has three posts using the `has` method provided by the Laravel's factories. The `has` method accepts a factory instance:" -msgstr "接著,來看看如何使用 Laravel 中流利的 Factory 方法建立 Eloquent Model 關聯。首先,假設專案中有個 `App\\Models\\User` Model 以及 `App\\Models\\Post` Model。然後,假設 `User` Model 中定義了對 `Post` 的 `hasMany` 關聯。我們可以使用 Laravel Factory 提供的 `has` 方法來建立一個有三篇貼文的使用者。這個 `has` 方法接受一個 Factory 實體:" +msgstr "" -#: docs/8.x/database-testing.md:block 80 (code) +# CODE +#: ./docs/8.x/database-testing.md:303 msgid "use App\\Models\\Post;\n" "use App\\Models\\User;\n\n" "$user = User::factory()\n" " ->has(Post::factory()->count(3))\n" -" ->create();\n" -msgstr "use App\\Models\\Post;\n" -"use App\\Models\\User;\n\n" -"$user = User::factory()\n" -" ->has(Post::factory()->count(3))\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 81 (paragraph) +# P +#: ./docs/8.x/database-testing.md:310 msgid "By convention, when passing a `Post` model to the `has` method, Laravel will assume that the `User` model must have a `posts` method that defines the relationship. If necessary, you may explicitly specify the name of the relationship that you would like to manipulate:" -msgstr "依照慣例,當傳入 `Post` Model 給 `has` 方法時,Laravel 會假設 `User` Model 中有定義這個關聯的 `posts` 方法。若有需要,可以明顯指定要操作的關聯名稱:" +msgstr "" -#: docs/8.x/database-testing.md:block 82 (code) +# CODE +#: ./docs/8.x/database-testing.md:312 msgid "$user = User::factory()\n" " ->has(Post::factory()->count(3), 'posts')\n" -" ->create();\n" -msgstr "$user = User::factory()\n" -" ->has(Post::factory()->count(3), 'posts')\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 83 (paragraph) +# P +#: ./docs/8.x/database-testing.md:316 msgid "Of course, you may perform state manipulations on the related models. In addition, you may pass a closure based state transformation if your state change requires access to the parent model:" -msgstr "當然,也可以在關聯 Model 上進行 State 操作。此外,若 State 更改需要存取上層 Model,也可以傳入基於閉包的 State 變換:" +msgstr "" -#: docs/8.x/database-testing.md:block 84 (code) +# CODE +#: ./docs/8.x/database-testing.md:318 msgid "$user = User::factory()\n" " ->has(\n" " Post::factory()\n" @@ -933,74 +1007,78 @@ msgid "$user = User::factory()\n" " return ['user_type' => $user->type];\n" " })\n" " )\n" -" ->create();\n" -msgstr "$user = User::factory()\n" -" ->has(\n" -" Post::factory()\n" -" ->count(3)\n" -" ->state(function (array $attributes, User $user) {\n" -" return ['user_type' => $user->type];\n" -" })\n" -" )\n" -" ->create();\n" +" ->create();" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:328 +#~ msgid "" +#~ msgstr "" -#: docs/8.x/database-testing.md:block 86 (header) +# H4 +#: ./docs/8.x/database-testing.md:329 +#: ./docs/8.x/database-testing.md:378 +#: ./docs/8.x/database-testing.md:439 msgid "Using Magic Methods" -msgstr "使用魔術方法" +msgstr "" -#: docs/8.x/database-testing.md:block 87 (paragraph) +# P +#: ./docs/8.x/database-testing.md:331 msgid "For convenience, you may use Laravel's magic factory relationship methods to build relationships. For example, the following example will use convention to determine that the related models should be created via a `posts` relationship method on the `User` model:" -msgstr "為了方便起見,可以使用 Laravel 的魔術 Factory 關聯方法來建立關聯。舉例來說,下列範例會使用慣例來判斷應通過 `User` Model 上的 `posts` 關聯方法來建立關聯 Model:" +msgstr "" -#: docs/8.x/database-testing.md:block 88 (code) +# CODE +#: ./docs/8.x/database-testing.md:333 msgid "$user = User::factory()\n" " ->hasPosts(3)\n" -" ->create();\n" -msgstr "$user = User::factory()\n" -" ->hasPosts(3)\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 89 (paragraph) +# P +#: ./docs/8.x/database-testing.md:337 msgid "When using magic methods to create factory relationships, you may pass an array of attributes to override on the related models:" -msgstr "在使用魔術方法建立 Factory 關聯時,可以傳入包含屬性的陣列來在關聯 Model 上複寫:" +msgstr "" -#: docs/8.x/database-testing.md:block 90 (code) +# CODE +#: ./docs/8.x/database-testing.md:339 msgid "$user = User::factory()\n" " ->hasPosts(3, [\n" " 'published' => false,\n" " ])\n" -" ->create();\n" -msgstr "$user = User::factory()\n" -" ->hasPosts(3, [\n" -" 'published' => false,\n" -" ])\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 91 (paragraph) +# P +#: ./docs/8.x/database-testing.md:345 msgid "You may provide a closure based state transformation if your state change requires access to the parent model:" -msgstr "若 State 更改需要存取上層 Model,可以提供一個基於閉包的 State 變換:" +msgstr "" -#: docs/8.x/database-testing.md:block 92 (code) +# CODE +#: ./docs/8.x/database-testing.md:347 msgid "$user = User::factory()\n" " ->hasPosts(3, function (array $attributes, User $user) {\n" " return ['user_type' => $user->type];\n" " })\n" -" ->create();\n" -msgstr "$user = User::factory()\n" -" ->hasPosts(3, function (array $attributes, User $user) {\n" -" return ['user_type' => $user->type];\n" -" })\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 94 (header) +# P +#: ./docs/8.x/database-testing.md:353 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/database-testing.md:354 msgid "Belongs To Relationships" -msgstr "Belongs To 關聯" +msgstr "" -#: docs/8.x/database-testing.md:block 95 (paragraph) +# P +#: ./docs/8.x/database-testing.md:356 msgid "Now that we have explored how to build \"has many\" relationships using factories, let's explore the inverse of the relationship. The `for` method may be used to define the parent model that factory created models belong to. For example, we can create three `App\\Models\\Post` model instances that belong to a single user:" -msgstr "我們已經瞭解如何使用 Factory 來建立「Has Many」關聯了,接著來看看這種關聯的想法。使用 `for` 方法可以用來定義使用 Factory 建立的 Model 所隸屬 (Belong To) 的上層 Model。舉例來說,我們可以建立三個隸屬於單一使用者的 `App\\Models\\Post` Model 實體:" +msgstr "" -#: docs/8.x/database-testing.md:block 96 (code) +# CODE +#: ./docs/8.x/database-testing.md:358 msgid "use App\\Models\\Post;\n" "use App\\Models\\User;\n\n" "$posts = Post::factory()\n" @@ -1008,79 +1086,84 @@ msgid "use App\\Models\\Post;\n" " ->for(User::factory()->state([\n" " 'name' => 'Jessica Archer',\n" " ]))\n" -" ->create();\n" -msgstr "use App\\Models\\Post;\n" -"use App\\Models\\User;\n\n" -"$posts = Post::factory()\n" -" ->count(3)\n" -" ->for(User::factory()->state([\n" -" 'name' => 'Jessica Archer',\n" -" ]))\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 97 (paragraph) +# P +#: ./docs/8.x/database-testing.md:368 msgid "If you already have a parent model instance that should be associated with the models you are creating, you may pass the model instance to the `for` method:" -msgstr "若已經有應與這些正在建立的 Model 關聯的上層 Model 實體,可以將該 Model 實體傳入 `for` 方法:" +msgstr "" -#: docs/8.x/database-testing.md:block 98 (code) +# CODE +#: ./docs/8.x/database-testing.md:370 msgid "$user = User::factory()->create();\n\n" "$posts = Post::factory()\n" " ->count(3)\n" " ->for($user)\n" -" ->create();\n" -msgstr "$user = User::factory()->create();\n\n" -"$posts = Post::factory()\n" -" ->count(3)\n" -" ->for($user)\n" -" ->create();\n" +" ->create();" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:377 +#~ msgid "" +#~ msgstr "" -#: docs/8.x/database-testing.md:block 101 (paragraph) +# P +#: ./docs/8.x/database-testing.md:380 msgid "For convenience, you may use Laravel's magic factory relationship methods to define \"belongs to\" relationships. For example, the following example will use convention to determine that the three posts should belong to the `user` relationship on the `Post` model:" -msgstr "為了方便起見,可以使用 Laravel 的魔術 Factory 關聯方法來定義「Belongs To」關聯。舉例來說,下列範例會使用慣例來判斷應使用 `Post` Model 上的 `user` 關聯方法來設定這三個貼文應隸屬於哪裡:" +msgstr "" -#: docs/8.x/database-testing.md:block 102 (code) +# CODE +#: ./docs/8.x/database-testing.md:382 msgid "$posts = Post::factory()\n" " ->count(3)\n" " ->forUser([\n" " 'name' => 'Jessica Archer',\n" " ])\n" -" ->create();\n" -msgstr "$posts = Post::factory()\n" -" ->count(3)\n" -" ->forUser([\n" -" 'name' => 'Jessica Archer',\n" -" ])\n" -" ->create();\n" +" ->create();" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:389 +#~ msgid "" +#~ msgstr "" -#: docs/8.x/database-testing.md:block 104 (header) +# H3 +#: ./docs/8.x/database-testing.md:390 msgid "Many To Many Relationships" -msgstr "Many To Many 關聯" +msgstr "" -#: docs/8.x/database-testing.md:block 105 (paragraph) +# P +#: ./docs/8.x/database-testing.md:392 msgid "Like [has many relationships](#has-many-relationships), \"many to many\" relationships may be created using the `has` method:" -msgstr "與 [Has Many 關聯](#has-many-relationships),「Many to Many」關聯也可以通過 `has` 方法建立:" +msgstr "" -#: docs/8.x/database-testing.md:block 106 (code) +# CODE +#: ./docs/8.x/database-testing.md:394 msgid "use App\\Models\\Role;\n" "use App\\Models\\User;\n\n" "$user = User::factory()\n" " ->has(Role::factory()->count(3))\n" -" ->create();\n" -msgstr "use App\\Models\\Role;\n" -"use App\\Models\\User;\n\n" -"$user = User::factory()\n" -" ->has(Role::factory()->count(3))\n" -" ->create();\n" +" ->create();" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:401 +#~ msgid "" +#~ msgstr "" -#: docs/8.x/database-testing.md:block 108 (header) +# H4 +#: ./docs/8.x/database-testing.md:402 msgid "Pivot Table Attributes" -msgstr "Pivot 表屬性" +msgstr "" -#: docs/8.x/database-testing.md:block 109 (paragraph) +# P +#: ./docs/8.x/database-testing.md:404 msgid "If you need to define attributes that should be set on the pivot / intermediate table linking the models, you may use the `hasAttached` method. This method accepts an array of pivot table attribute names and values as its second argument:" -msgstr "若有需要為這些 Model 定義關聯 Pivot/中介資料表上的屬性,則可使用 `hasAttached` 方法。這個方法接受一個陣列,其中包含 Pivot 資料表上的屬性名稱,第二個引數則為其值:" +msgstr "" -#: docs/8.x/database-testing.md:block 110 (code) +# CODE +#: ./docs/8.x/database-testing.md:406 msgid "use App\\Models\\Role;\n" "use App\\Models\\User;\n\n" "$user = User::factory()\n" @@ -1088,21 +1171,16 @@ msgid "use App\\Models\\Role;\n" " Role::factory()->count(3),\n" " ['active' => true]\n" " )\n" -" ->create();\n" -msgstr "use App\\Models\\Role;\n" -"use App\\Models\\User;\n\n" -"$user = User::factory()\n" -" ->hasAttached(\n" -" Role::factory()->count(3),\n" -" ['active' => true]\n" -" )\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 111 (paragraph) +# P +#: ./docs/8.x/database-testing.md:416 msgid "You may provide a closure based state transformation if your state change requires access to the related model:" -msgstr "若 State 更改需要存取關聯 Model,可以提供一個基於閉包的 State 變換:" +msgstr "" -#: docs/8.x/database-testing.md:block 112 (code) +# CODE +#: ./docs/8.x/database-testing.md:418 msgid "$user = User::factory()\n" " ->hasAttached(\n" " Role::factory()\n" @@ -1112,89 +1190,102 @@ msgid "$user = User::factory()\n" " }),\n" " ['active' => true]\n" " )\n" -" ->create();\n" -msgstr "$user = User::factory()\n" -" ->hasAttached(\n" -" Role::factory()\n" -" ->count(3)\n" -" ->state(function (array $attributes, User $user) {\n" -" return ['name' => $user->name.' Role'];\n" -" }),\n" -" ['active' => true]\n" -" )\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 113 (paragraph) +# P +#: ./docs/8.x/database-testing.md:429 msgid "If you already have model instances that you would like to be attached to the models you are creating, you may pass the model instances to the `hasAttached` method. In this example, the same three roles will be attached to all three users:" -msgstr "若已有 Model 實體想讓正在建立的 Model 附加,可以將該 Model 實體傳入 `hasAttached` 方法。在此範例中,會將三個相同的角色附加給三個使用者:" +msgstr "" -#: docs/8.x/database-testing.md:block 114 (code) +# CODE +#: ./docs/8.x/database-testing.md:431 msgid "$roles = Role::factory()->count(3)->create();\n\n" "$user = User::factory()\n" " ->count(3)\n" " ->hasAttached($roles, ['active' => true])\n" -" ->create();\n" -msgstr "$roles = Role::factory()->count(3)->create();\n\n" -"$user = User::factory()\n" -" ->count(3)\n" -" ->hasAttached($roles, ['active' => true])\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 117 (paragraph) +# P +#: ./docs/8.x/database-testing.md:438 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/database-testing.md:441 msgid "For convenience, you may use Laravel's magic factory relationship methods to define many to many relationships. For example, the following example will use convention to determine that the related models should be created via a `roles` relationship method on the `User` model:" -msgstr "為了方便起見,可以使用 Laravel 的魔術 Factory 關聯方法來定義 Many to Many 關聯。舉例來說,下列範例會使用慣例來判斷應通過 `User` Model 上的 `roles` 關聯方法來建立關聯 Model:" +msgstr "" -#: docs/8.x/database-testing.md:block 118 (code) +# CODE +#: ./docs/8.x/database-testing.md:443 msgid "$user = User::factory()\n" " ->hasRoles(1, [\n" " 'name' => 'Editor'\n" " ])\n" -" ->create();\n" -msgstr "$user = User::factory()\n" -" ->hasRoles(1, [\n" -" 'name' => 'Editor'\n" -" ])\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 120 (header) +# P +#: ./docs/8.x/database-testing.md:449 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/database-testing.md:450 msgid "Polymorphic Relationships" -msgstr "Polymorphic (多型) 關聯" +msgstr "" -#: docs/8.x/database-testing.md:block 121 (paragraph) +# P +#: ./docs/8.x/database-testing.md:452 msgid "[Polymorphic relationships](/docs/{{version}}/eloquent-relationships#polymorphic-relationships) may also be created using factories. Polymorphic \"morph many\" relationships are created in the same way as typical \"has many\" relationships. For example, if a `App\\Models\\Post` model has a `morphMany` relationship with a `App\\Models\\Comment` model:" -msgstr "[Polymorphic (多型) 關聯](/docs/{{version}}/eloquent-relationships#polymorphic-relationships) 也可以使用 Factory 來建立。Polymorphic 的「Morph Many」關聯使用與一般的「Has Many」關聯相同的方法來建立。舉例來說,若 `App\\Models\\Post` Model 有與 `App\\Models\\Comment` Model 的 `morphMany` 關聯:" +msgstr "" -#: docs/8.x/database-testing.md:block 122 (code) +# CODE +#: ./docs/8.x/database-testing.md:454 msgid "use App\\Models\\Post;\n\n" -"$post = Post::factory()->hasComments(3)->create();\n" -msgstr "use App\\Models\\Post;\n\n" -"$post = Post::factory()->hasComments(3)->create();\n" +"$post = Post::factory()->hasComments(3)->create();" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:458 +#~ msgid "" +#~ msgstr "" -#: docs/8.x/database-testing.md:block 124 (header) +# H4 +#: ./docs/8.x/database-testing.md:459 msgid "Morph To Relationships" -msgstr "Morph To 關聯" +msgstr "" -#: docs/8.x/database-testing.md:block 125 (paragraph) +# P +#: ./docs/8.x/database-testing.md:461 msgid "Magic methods may not be used to create `morphTo` relationships. Instead, the `for` method must be used directly and the name of the relationship must be explicitly provided. For example, imagine that the `Comment` model has a `commentable` method that defines a `morphTo` relationship. In this situation, we may create three comments that belong to a single post by using the `for` method directly:" -msgstr "在建立 `morphTo` 關聯時無法使用魔法方法。必須直接使用 `for` 方法,並明顯提供該關聯的名稱。舉例來說,假設 `Comment` Model 有個 `commantable` 方法,該方法定義了 `morphTo` 關聯。在這種情況下,我們可以直接使用 `for` 方法來建立三個隸屬於單一貼文的留言:" +msgstr "" -#: docs/8.x/database-testing.md:block 126 (code) +# CODE +#: ./docs/8.x/database-testing.md:463 msgid "$comments = Comment::factory()->count(3)->for(\n" " Post::factory(), 'commentable'\n" -")->create();\n" -msgstr "$comments = Comment::factory()->count(3)->for(\n" -" Post::factory(), 'commentable'\n" -")->create();\n" +")->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 128 (header) +# P +#: ./docs/8.x/database-testing.md:467 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database-testing.md:468 msgid "Polymorphic Many To Many Relationships" -msgstr "Polymorphic (多型) Many to Many 關聯" +msgstr "" -#: docs/8.x/database-testing.md:block 129 (paragraph) +# P +#: ./docs/8.x/database-testing.md:470 msgid "Polymorphic \"many to many\" (`morphToMany` / `morphedByMany`) relationships may be created just like non-polymorphic \"many to many\" relationships:" -msgstr "Polymorphic (多型)「Many to Many」(`morphyToMany` / `morphedByMany`) 關聯可以像非 Polymorphic「Many to Many」關聯一樣建立:" +msgstr "" -#: docs/8.x/database-testing.md:block 130 (code) +# CODE +#: ./docs/8.x/database-testing.md:472 msgid "use App\\Models\\Tag;\n" "use App\\Models\\Video;\n\n" "$videos = Video::factory()\n" @@ -1202,37 +1293,38 @@ msgid "use App\\Models\\Tag;\n" " Tag::factory()->count(3),\n" " ['public' => true]\n" " )\n" -" ->create();\n" -msgstr "use App\\Models\\Tag;\n" -"use App\\Models\\Video;\n\n" -"$videos = Video::factory()\n" -" ->hasAttached(\n" -" Tag::factory()->count(3),\n" -" ['public' => true]\n" -" )\n" -" ->create();\n" +" ->create();" +msgstr "" -#: docs/8.x/database-testing.md:block 131 (paragraph) +# P +#: ./docs/8.x/database-testing.md:482 msgid "Of course, the magic `has` method may also be used to create polymorphic \"many to many\" relationships:" -msgstr "當然,也可以使用 `has` 魔法方法來建立 Polymorphic「Many to Many」關聯:" +msgstr "" -#: docs/8.x/database-testing.md:block 132 (code) +# CODE +#: ./docs/8.x/database-testing.md:484 msgid "$videos = Video::factory()\n" " ->hasTags(3, ['public' => true])\n" -" ->create();\n" -msgstr "$videos = Video::factory()\n" -" ->hasTags(3, ['public' => true])\n" -" ->create();\n" +" ->create();" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:488 +#~ msgid "" +#~ msgstr "" -#: docs/8.x/database-testing.md:block 134 (header) +# H3 +#: ./docs/8.x/database-testing.md:489 msgid "Defining Relationships Within Factories" -msgstr "在 Factory 中定義關聯" +msgstr "" -#: docs/8.x/database-testing.md:block 135 (paragraph) +# P +#: ./docs/8.x/database-testing.md:491 msgid "To define a relationship within your model factory, you will typically assign a new factory instance to the foreign key of the relationship. This is normally done for the \"inverse\" relationships such as `belongsTo` and `morphTo` relationships. For example, if you would like to create a new user when creating a post, you may do the following:" -msgstr "若要在 Model Factory 中定義關聯,則通常需要為該關聯的外部索引鍵 (Foreign Key) 指定新的 Factory 實體。一般是使用「相反」的關聯來處理,如 `belongsTo` 與 `morphTo` 關聯。舉例來說,若想在建立貼文時建立新使用者,可以像這樣:" +msgstr "" -#: docs/8.x/database-testing.md:block 136 (code) +# CODE +#: ./docs/8.x/database-testing.md:493 msgid "use App\\Models\\User;\n\n" "/**\n" " * Define the model's default state.\n" @@ -1246,27 +1338,16 @@ msgid "use App\\Models\\User;\n\n" " 'title' => $this->faker->title(),\n" " 'content' => $this->faker->paragraph(),\n" " ];\n" -"}\n" -msgstr "use App\\Models\\User;\n\n" -"/**\n" -" * Define the model's default state.\n" -" *\n" -" * @return array\n" -" */\n" -"public function definition()\n" -"{\n" -" return [\n" -" 'user_id' => User::factory(),\n" -" 'title' => $this->faker->title(),\n" -" 'content' => $this->faker->paragraph(),\n" -" ];\n" -"}\n" +"}" +msgstr "" -#: docs/8.x/database-testing.md:block 137 (paragraph) +# P +#: ./docs/8.x/database-testing.md:509 msgid "If the relationship's columns depend on the factory that defines it you may assign a closure to an attribute. The closure will receive the factory's evaluated attribute array:" -msgstr "若該關聯的欄位仰賴定義其的 Factory,則可以在屬性中放入閉包。該閉包會收到該 Factory 取值結果的屬性陣列:" +msgstr "" -#: docs/8.x/database-testing.md:block 138 (code) +# CODE +#: ./docs/8.x/database-testing.md:511 msgid "/**\n" " * Define the model's default state.\n" " *\n" @@ -1282,25 +1363,39 @@ msgid "/**\n" " 'title' => $this->faker->title(),\n" " 'content' => $this->faker->paragraph(),\n" " ];\n" -"}\n" -msgstr "/**\n" -" * Define the model's default state.\n" -" *\n" -" * @return array\n" -" */\n" -"public function definition()\n" -"{\n" -" return [\n" -" 'user_id' => User::factory(),\n" -" 'user_type' => function (array $attributes) {\n" -" return User::find($attributes['user_id'])->type;\n" -" },\n" -" 'title' => $this->faker->title(),\n" -" 'content' => $this->faker->paragraph(),\n" -" ];\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:528 +#: ./docs/9.x/database-testing.md:64 +#: ./docs/10.x/database-testing.md:61 +#: ./docs/11.x/database-testing.md:89 +#: ./docs/master/database-testing.md:89 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/database-testing.md:529 +#: ./docs/9.x/database-testing.md:65 +#: ./docs/10.x/database-testing.md:62 +#: ./docs/11.x/database-testing.md:90 +#: ./docs/master/database-testing.md:90 +msgid "Running Seeders" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:531 +#: ./docs/9.x/database-testing.md:67 +#: ./docs/10.x/database-testing.md:64 +#: ./docs/11.x/database-testing.md:92 +#: ./docs/master/database-testing.md:92 +msgid "If you would like to use [database seeders](/docs/{{version}}/seeding) to populate your database during a feature test, you may invoke the `seed` method. By default, the `seed` method will execute the `DatabaseSeeder`, which should execute all of your other seeders. Alternatively, you pass a specific seeder class name to the `seed` method:" +msgstr "" -#: docs/8.x/database-testing.md:block 142 (code) +# CODE +#: ./docs/8.x/database-testing.md:533 +#: ./docs/9.x/database-testing.md:69 msgid "seed();\n\n" -" // Run a specific seeder...\n" -" $this->seed(OrderStatusSeeder::class);\n\n" -" // ...\n\n" -" // Run an array of specific seeders...\n" -" $this->seed([\n" -" OrderStatusSeeder::class,\n" -" TransactionStatusSeeder::class,\n" -" // ...\n" -" ]);\n" -" }\n" -"}\n" +" protected $seed = true;\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:591 +#: ./docs/9.x/database-testing.md:127 +#: ./docs/10.x/database-testing.md:121 +#: ./docs/11.x/database-testing.md:176 +#: ./docs/master/database-testing.md:176 +msgid "When the `$seed` property is `true`, the test will run the `Database\\Seeders\\DatabaseSeeder` class before each test that uses the `RefreshDatabase` trait. However, you may specify a specific seeder that should be executed by defining a `$seeder` property on your test class:" +msgstr "" + +# CODE +#: ./docs/8.x/database-testing.md:593 +#: ./docs/9.x/database-testing.md:129 +#: ./docs/10.x/database-testing.md:123 +#: ./docs/11.x/database-testing.md:178 +#: ./docs/master/database-testing.md:178 +msgid "use Database\\Seeders\\OrderStatusSeeder;\n\n" +"/**\n" +" * Run a specific seeder before each test.\n" +" *\n" +" * @var string\n" +" */\n" +"protected $seeder = OrderStatusSeeder::class;" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:602 +#: ./docs/9.x/database-testing.md:138 +#: ./docs/10.x/database-testing.md:132 +#: ./docs/11.x/database-testing.md:187 +#: ./docs/master/database-testing.md:187 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/database-testing.md:603 +#: ./docs/9.x/database-testing.md:139 +#: ./docs/10.x/database-testing.md:133 +#: ./docs/11.x/database-testing.md:188 +#: ./docs/master/database-testing.md:188 +msgid "Available Assertions" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:605 +#: ./docs/9.x/database-testing.md:141 +#: ./docs/10.x/database-testing.md:135 +msgid "Laravel provides several database assertions for your [PHPUnit](https://phpunit.de/) feature tests. We'll discuss each of these assertions below." +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:607 +#: ./docs/9.x/database-testing.md:143 +#: ./docs/10.x/database-testing.md:137 +#: ./docs/11.x/database-testing.md:192 +#: ./docs/master/database-testing.md:192 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database-testing.md:608 +#: ./docs/9.x/database-testing.md:144 +#: ./docs/10.x/database-testing.md:138 +#: ./docs/11.x/database-testing.md:193 +#: ./docs/master/database-testing.md:193 +msgid "assertDatabaseCount" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:610 +#: ./docs/9.x/database-testing.md:146 +#: ./docs/10.x/database-testing.md:140 +#: ./docs/11.x/database-testing.md:195 +#: ./docs/master/database-testing.md:195 +msgid "Assert that a table in the database contains the given number of records:" +msgstr "" + +# CODE +#: ./docs/8.x/database-testing.md:612 +#: ./docs/9.x/database-testing.md:148 +#: ./docs/10.x/database-testing.md:142 +#: ./docs/11.x/database-testing.md:197 +#: ./docs/master/database-testing.md:197 +msgid "$this->assertDatabaseCount('users', 5);" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:614 +#: ./docs/9.x/database-testing.md:150 +#: ./docs/10.x/database-testing.md:144 +#: ./docs/11.x/database-testing.md:206 +#: ./docs/master/database-testing.md:199 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database-testing.md:615 +#: ./docs/9.x/database-testing.md:151 +#: ./docs/10.x/database-testing.md:145 +#: ./docs/11.x/database-testing.md:207 +#: ./docs/master/database-testing.md:200 +msgid "assertDatabaseHas" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:617 +#: ./docs/9.x/database-testing.md:153 +#: ./docs/10.x/database-testing.md:147 +#: ./docs/11.x/database-testing.md:209 +#: ./docs/master/database-testing.md:202 +msgid "Assert that a table in the database contains records matching the given key / value query constraints:" +msgstr "" + +# CODE +#: ./docs/8.x/database-testing.md:619 +#: ./docs/9.x/database-testing.md:155 +#: ./docs/10.x/database-testing.md:149 +#: ./docs/11.x/database-testing.md:211 +#: ./docs/master/database-testing.md:204 +msgid "$this->assertDatabaseHas('users', [\n" +" 'email' => 'sally@example.com',\n" +"]);" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:623 +#: ./docs/9.x/database-testing.md:159 +#: ./docs/10.x/database-testing.md:153 +#: ./docs/11.x/database-testing.md:215 +#: ./docs/master/database-testing.md:208 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database-testing.md:624 +#: ./docs/9.x/database-testing.md:160 +#: ./docs/10.x/database-testing.md:154 +#: ./docs/11.x/database-testing.md:216 +#: ./docs/master/database-testing.md:209 +msgid "assertDatabaseMissing" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:626 +#: ./docs/9.x/database-testing.md:162 +#: ./docs/10.x/database-testing.md:156 +#: ./docs/11.x/database-testing.md:218 +#: ./docs/master/database-testing.md:211 +msgid "Assert that a table in the database does not contain records matching the given key / value query constraints:" +msgstr "" -#: docs/8.x/database-testing.md:block 163 (header) +# CODE +#: ./docs/8.x/database-testing.md:628 +#: ./docs/9.x/database-testing.md:164 +#: ./docs/10.x/database-testing.md:158 +#: ./docs/11.x/database-testing.md:220 +#: ./docs/master/database-testing.md:213 +msgid "$this->assertDatabaseMissing('users', [\n" +" 'email' => 'sally@example.com',\n" +"]);" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:632 +#: ./docs/9.x/database-testing.md:168 +#: ./docs/10.x/database-testing.md:162 +#: ./docs/11.x/database-testing.md:224 +#: ./docs/master/database-testing.md:217 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database-testing.md:633 msgid "assertDeleted" -msgstr "assertDeleted" +msgstr "" -#: docs/8.x/database-testing.md:block 164 (paragraph) +# P +#: ./docs/8.x/database-testing.md:635 msgid "The `assertDeleted` asserts that a given Eloquent model has been deleted from the database:" -msgstr "`assertDeleted` 判斷給定的 Eloquent Model 是否已從資料庫內刪除:" +msgstr "" -#: docs/8.x/database-testing.md:block 165 (code) +# CODE +#: ./docs/8.x/database-testing.md:637 msgid "use App\\Models\\User;\n\n" "$user = User::find(1);\n\n" "$user->delete();\n\n" -"$this->assertDeleted($user);\n" -msgstr "use App\\Models\\User;\n\n" -"$user = User::find(1);\n\n" -"$user->delete();\n\n" -"$this->assertDeleted($user);\n" +"$this->assertDeleted($user);" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:645 +#: ./docs/9.x/database-testing.md:171 +#: ./docs/10.x/database-testing.md:165 +#: ./docs/11.x/database-testing.md:227 +#: ./docs/master/database-testing.md:220 +msgid "The `assertSoftDeleted` method may be used to assert a given Eloquent model has been \"soft deleted\":" +msgstr "" + +# CODE +#: ./docs/8.x/database-testing.md:647 +#: ./docs/9.x/database-testing.md:173 +#: ./docs/10.x/database-testing.md:167 +#: ./docs/11.x/database-testing.md:229 +#: ./docs/master/database-testing.md:222 +msgid "$this->assertSoftDeleted($user);" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:649 +#: ./docs/9.x/database-testing.md:182 +#: ./docs/10.x/database-testing.md:176 +#: ./docs/11.x/database-testing.md:238 +#: ./docs/master/database-testing.md:231 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database-testing.md:650 +#: ./docs/9.x/database-testing.md:183 +#: ./docs/10.x/database-testing.md:177 +#: ./docs/11.x/database-testing.md:239 +#: ./docs/master/database-testing.md:232 +msgid "assertModelExists" +msgstr "" + +# P +#: ./docs/8.x/database-testing.md:652 +#: ./docs/9.x/database-testing.md:185 +#: ./docs/10.x/database-testing.md:179 +#: ./docs/11.x/database-testing.md:241 +#: ./docs/master/database-testing.md:234 +msgid "Assert that a given model exists in the database:" +msgstr "" -#: docs/9.x/database-testing.md:block 16 (code) +# CODE +#: ./docs/8.x/database-testing.md:654 +#: ./docs/9.x/database-testing.md:187 +#: ./docs/10.x/database-testing.md:181 +#: ./docs/11.x/database-testing.md:243 +#: ./docs/master/database-testing.md:236 msgid "use App\\Models\\User;\n\n" -"public function test_models_can_be_instantiated()\n" -"{\n" -" $user = User::factory()->create();\n\n" -" // ...\n" -"}\n" -msgstr "use App\\Models\\User;\n\n" -"public function test_models_can_be_instantiated()\n" -"{\n" -" $user = User::factory()->create();\n\n" -" // ...\n" -"}\n" +"$user = User::factory()->create();\n\n" +"$this->assertModelExists($user);" +msgstr "" -#: docs/master/database-testing.md:block 9 (code) -msgid "get('/');\n\n" -" // ...\n" -" }\n" -"}\n" -msgstr "get('/');\n\n" -" // ...\n" -" }\n" -"}\n" +# P +#: ./docs/8.x/database-testing.md:660 +#: ./docs/9.x/database-testing.md:193 +#: ./docs/10.x/database-testing.md:187 +#: ./docs/11.x/database-testing.md:249 +#: ./docs/master/database-testing.md:242 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database-testing.md:661 +#: ./docs/9.x/database-testing.md:194 +#: ./docs/10.x/database-testing.md:188 +#: ./docs/11.x/database-testing.md:250 +#: ./docs/master/database-testing.md:243 +msgid "assertModelMissing" +msgstr "" -#: docs/master/database-testing.md:block 20 (code) -msgid "seed();\n\n" -" // Run a specific seeder...\n" -" $this->seed(OrderStatusSeeder::class);\n\n" -" // ...\n\n" -" // Run an array of specific seeders...\n" -" $this->seed([\n" -" OrderStatusSeeder::class,\n" -" TransactionStatusSeeder::class,\n" -" // ...\n" -" ]);\n" -" }\n" -"}\n" -msgstr "seed();\n\n" -" // 執行特定的 Seeder...\n" -" $this->seed(OrderStatusSeeder::class);\n\n" -" // ...\n\n" -" // 執行一組陣列中所指定的 Seeder...\n" -" $this->seed([\n" -" OrderStatusSeeder::class,\n" -" TransactionStatusSeeder::class,\n" -" // ...\n" -" ]);\n" -" }\n" -"}\n" +# P +#: ./docs/8.x/database-testing.md:663 +#: ./docs/9.x/database-testing.md:196 +#: ./docs/10.x/database-testing.md:190 +#: ./docs/11.x/database-testing.md:252 +#: ./docs/master/database-testing.md:245 +msgid "Assert that a given model does not exist in the database:" +msgstr "" + +# CODE +#: ./docs/8.x/database-testing.md:665 +#: ./docs/9.x/database-testing.md:198 +#: ./docs/10.x/database-testing.md:192 +#: ./docs/11.x/database-testing.md:254 +#: ./docs/master/database-testing.md:247 +msgid "use App\\Models\\User;\n\n" +"$user = User::factory()->create();\n\n" +"$user->delete();\n\n" +"$this->assertModelMissing($user);" +msgstr "" diff --git a/po/zh_TW/database.po b/po/zh_TW/database.po index d737072f3..28efe66b1 100644 --- a/po/zh_TW/database.po +++ b/po/zh_TW/database.po @@ -10,168 +10,468 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:17\n" - -#: docs/10.x/database.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H1 +#: ./docs/8.x/database.md:1 +#: ./docs/9.x/database.md:1 +#: ./docs/10.x/database.md:1 +#: ./docs/11.x/database.md:1 +#: ./docs/master/database.md:1 msgid "Database: Getting Started" -msgstr "資料庫:入門" +msgstr "" -#: docs/10.x/database.md:block 2 (unordered list) +# P +#: ./docs/8.x/database.md:3 +#: ./docs/9.x/database.md:3 +#: ./docs/10.x/database.md:3 +#: ./docs/11.x/database.md:3 +#: ./docs/master/database.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/database.md:block 2 (unordered list) +# P +#: ./docs/8.x/database.md:4 +#: ./docs/9.x/database.md:4 +#: ./docs/10.x/database.md:4 +#: ./docs/11.x/database.md:4 +#: ./docs/master/database.md:4 msgid "[Configuration](#configuration)" -msgstr "[設定](#configuration)" +msgstr "" -#: docs/10.x/database.md:block 2 (unordered list) +# P +#: ./docs/10.x/database.md:5 +#: ./docs/11.x/database.md:5 +#: ./docs/master/database.md:5 +msgid "[Read and Write Connections](#read-and-write-connections)" +msgstr "" + +# P +#: ./docs/8.x/database.md:5 +#: ./docs/9.x/database.md:5 msgid "[Read & Write Connections](#read-and-write-connections)" -msgstr "[讀寫連線](#read-and-write-connections)" +msgstr "" -#: docs/10.x/database.md:block 2 (unordered list) +# P +#: ./docs/8.x/database.md:6 +#: ./docs/9.x/database.md:6 +#: ./docs/10.x/database.md:6 +#: ./docs/11.x/database.md:6 +#: ./docs/master/database.md:6 msgid "[Running SQL Queries](#running-queries)" -msgstr "[執行 SQL 查詢](#running-queries)" +msgstr "" -#: docs/10.x/database.md:block 2 (unordered list) +# P +#: ./docs/8.x/database.md:7 +#: ./docs/9.x/database.md:7 +#: ./docs/10.x/database.md:7 +#: ./docs/11.x/database.md:7 +#: ./docs/master/database.md:7 msgid "[Using Multiple Database Connections](#using-multiple-database-connections)" -msgstr "[使用多個資料庫連線](#using-multiple-database-connections)" +msgstr "" -#: docs/10.x/database.md:block 2 (unordered list) -msgid "[Listening For Query Events](#listening-for-query-events)" -msgstr "[監聽查詢事件](#listening-for-query-events)" +# P +#: ./docs/10.x/database.md:8 +#: ./docs/11.x/database.md:8 +#: ./docs/master/database.md:8 +msgid "[Listening for Query Events](#listening-for-query-events)" +msgstr "" -#: docs/10.x/database.md:block 2 (unordered list) -msgid "[Monitoring Cumulative Query Time](#monitoring-cumulative-query-time)" -msgstr "[監控積累的查詢時間](#monitoring-cumulative-query-time)" +# P +#: ./docs/8.x/database.md:8 +#: ./docs/9.x/database.md:8 +msgid "[Listening For Query Events](#listening-for-query-events)" +msgstr "" -#: docs/10.x/database.md:block 2 (unordered list) +# P +#: ./docs/8.x/database.md:9 +#: ./docs/9.x/database.md:10 +#: ./docs/10.x/database.md:10 +#: ./docs/11.x/database.md:10 +#: ./docs/master/database.md:10 msgid "[Database Transactions](#database-transactions)" -msgstr "[資料庫 Transaction](#database-transactions)" +msgstr "" + +# P +#: ./docs/9.x/database.md:9 +#: ./docs/10.x/database.md:9 +#: ./docs/11.x/database.md:9 +#: ./docs/master/database.md:9 +msgid "[Monitoring Cumulative Query Time](#monitoring-cumulative-query-time)" +msgstr "" -#: docs/10.x/database.md:block 2 (unordered list) +# P +#: ./docs/8.x/database.md:10 +#: ./docs/9.x/database.md:11 msgid "[Connecting To The Database CLI](#connecting-to-the-database-cli)" -msgstr "[連線至資料庫 CLI](#connecting-to-the-database-cli)" +msgstr "" -#: docs/10.x/database.md:block 2 (unordered list) -msgid "[Inspecting Your Databases](#inspecting-your-databases)" -msgstr "[檢視資料庫](#inspecting-your-databases)" +# P +#: ./docs/10.x/database.md:11 +#: ./docs/11.x/database.md:11 +#: ./docs/master/database.md:11 +msgid "[Connecting to the Database CLI](#connecting-to-the-database-cli)" +msgstr "" -#: docs/10.x/database.md:block 2 (unordered list) -msgid "[Monitoring Your Databases](#monitoring-your-databases)" -msgstr "[監控資料庫](#monitoring-your-databases)" +# P +#: ./docs/8.x/database.md:12 +#: ./docs/9.x/database.md:15 +#: ./docs/10.x/database.md:15 +#: ./docs/11.x/database.md:15 +#: ./docs/master/database.md:15 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/database.md:12 +#: ./docs/10.x/database.md:12 +#: ./docs/11.x/database.md:12 +#: ./docs/master/database.md:12 +msgid "[Inspecting Your Databases](#inspecting-your-databases)" +msgstr "" -#: docs/10.x/database.md:block 4 (header) +# H2 +#: ./docs/8.x/database.md:13 +#: ./docs/9.x/database.md:16 +#: ./docs/10.x/database.md:16 +#: ./docs/11.x/database.md:16 +#: ./docs/master/database.md:16 msgid "Introduction" -msgstr "簡介" +msgstr "" + +# P +#: ./docs/9.x/database.md:13 +#: ./docs/10.x/database.md:13 +#: ./docs/11.x/database.md:13 +#: ./docs/master/database.md:13 +msgid "[Monitoring Your Databases](#monitoring-your-databases)" +msgstr "" -#: docs/10.x/database.md:block 5 (paragraph) +# P +#: ./docs/8.x/database.md:15 +#: ./docs/9.x/database.md:18 +#: ./docs/10.x/database.md:18 +#: ./docs/11.x/database.md:18 +#: ./docs/master/database.md:18 msgid "Almost every modern web application interacts with a database. Laravel makes interacting with databases extremely simple across a variety of supported databases using raw SQL, a [fluent query builder](/docs/{{version}}/queries), and the [Eloquent ORM](/docs/{{version}}/eloquent). Currently, Laravel provides first-party support for five databases:" -msgstr "幾乎所有的現代網站都會與資料庫互動。比起直接使用原始 SQL,Laravel 通過[流暢的 Query Builder](/docs/{{version}}/queries)、[Eloquent ORM](/docs/{{version}}/eloquent) 等功能大大簡化了與多種支援資料庫互動的過程。目前,Laravel 對 5 種資料庫提供了第一方支援:" +msgstr "" -#: docs/10.x/database.md:block 7 (unordered list) -msgid "MariaDB 10.10+ ([Version Policy](https://mariadb.org/about/#maintenance-policy))" -msgstr "MariaDB 10.10+ ([版本政策](https://mariadb.org/about/#maintenance-policy))" +# P +#: ./docs/8.x/database.md:19 +msgid "MariaDB 10.2+ ([Version Policy](https://mariadb.org/about/#maintenance-policy))" +msgstr "" -#: docs/10.x/database.md:block 7 (unordered list) +# P +#: ./docs/8.x/database.md:20 +#: ./docs/9.x/database.md:23 +#: ./docs/10.x/database.md:23 +#: ./docs/11.x/database.md:23 +#: ./docs/master/database.md:23 msgid "MySQL 5.7+ ([Version Policy](https://en.wikipedia.org/wiki/MySQL#Release_history))" -msgstr "MySQL 5.7+ ([版本政策](https://en.wikipedia.org/wiki/MySQL#Release_history))" +msgstr "" -#: docs/10.x/database.md:block 7 (unordered list) -msgid "PostgreSQL 11.0+ ([Version Policy](https://www.postgresql.org/support/versioning/))" -msgstr "PostgreSQL 11.0+ ([版本政策](https://www.postgresql.org/support/versioning/))" +# P +#: ./docs/8.x/database.md:21 +msgid "PostgreSQL 9.6+ ([Version Policy](https://www.postgresql.org/support/versioning/))" +msgstr "" -#: docs/10.x/database.md:block 7 (unordered list) +# P +#: ./docs/10.x/database.md:22 +msgid "MariaDB 10.10+ ([Version Policy](https://mariadb.org/about/#maintenance-policy))" +msgstr "" + +# P +#: ./docs/8.x/database.md:22 +#: ./docs/9.x/database.md:25 +#: ./docs/10.x/database.md:25 msgid "SQLite 3.8.8+" -msgstr "SQLite 3.8.8+" +msgstr "" -#: docs/10.x/database.md:block 7 (unordered list) +# P +#: ./docs/9.x/database.md:22 +#: ./docs/11.x/database.md:22 +#: ./docs/master/database.md:22 +msgid "MariaDB 10.3+ ([Version Policy](https://mariadb.org/about/#maintenance-policy))" +msgstr "" + +# P +#: ./docs/8.x/database.md:23 +#: ./docs/9.x/database.md:26 +#: ./docs/10.x/database.md:26 +#: ./docs/11.x/database.md:26 +#: ./docs/master/database.md:26 msgid "SQL Server 2017+ ([Version Policy](https://docs.microsoft.com/en-us/lifecycle/products/?products=sql-server))" -msgstr "SQL Server 2017+ ([版本政策](https://docs.microsoft.com/en-us/lifecycle/products/?products=sql-server))" +msgstr "" + +# P +#: ./docs/10.x/database.md:24 +msgid "PostgreSQL 11.0+ ([Version Policy](https://www.postgresql.org/support/versioning/))" +msgstr "" + +# P +#: ./docs/9.x/database.md:24 +#: ./docs/11.x/database.md:24 +#: ./docs/master/database.md:24 +msgid "PostgreSQL 10.0+ ([Version Policy](https://www.postgresql.org/support/versioning/))" +msgstr "" + +# P +#: ./docs/11.x/database.md:25 +msgid "SQLite 3.26.0+" +msgstr "" -#: docs/10.x/database.md:block 10 (header) +# P +#: ./docs/master/database.md:25 +msgid "SQLite 3.35.0+" +msgstr "" + +# P +#: ./docs/8.x/database.md:27 +#: ./docs/9.x/database.md:30 +#: ./docs/10.x/database.md:30 +#: ./docs/11.x/database.md:32 +#: ./docs/master/database.md:30 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/database.md:28 +#: ./docs/9.x/database.md:31 +#: ./docs/10.x/database.md:31 +#: ./docs/11.x/database.md:33 +#: ./docs/master/database.md:31 msgid "Configuration" -msgstr "設定" +msgstr "" -#: docs/10.x/database.md:block 11 (paragraph) +# P +#: ./docs/11.x/database.md:30 +msgid "Additionally, MongoDB is supported via the `mongodb/laravel-mongodb` package, which is officially maintained by MongoDB. Check out the [Laravel MongoDB](https://www.mongodb.com/docs/drivers/php/laravel-mongodb/) documentation for more information." +msgstr "" + +# P +#: ./docs/8.x/database.md:30 +#: ./docs/9.x/database.md:33 +#: ./docs/10.x/database.md:33 +#: ./docs/11.x/database.md:35 +#: ./docs/master/database.md:33 msgid "The configuration for Laravel's database services is located in your application's `config/database.php` configuration file. In this file, you may define all of your database connections, as well as specify which connection should be used by default. Most of the configuration options within this file are driven by the values of your application's environment variables. Examples for most of Laravel's supported database systems are provided in this file." -msgstr "用於 Laravel 資料庫服務的設定檔位於專案的 `config/database.php` 設定檔中。可以這個設定檔中定義所有的資料庫連線,並可指定預設要使用哪個連線。該檔案中的大多數的設定選項都使用專案的環境變數。該檔案內含有 Laravel 所支援的大多數資料庫系統的設定範例。" +msgstr "" -#: docs/10.x/database.md:block 12 (paragraph) +# P +#: ./docs/8.x/database.md:32 +#: ./docs/9.x/database.md:35 +#: ./docs/10.x/database.md:35 +#: ./docs/11.x/database.md:37 +#: ./docs/master/database.md:35 msgid "By default, Laravel's sample [environment configuration](/docs/{{version}}/configuration#environment-configuration) is ready to use with [Laravel Sail](/docs/{{version}}/sail), which is a Docker configuration for developing Laravel applications on your local machine. However, you are free to modify your database configuration as needed for your local database." -msgstr "預設情況下,Laravel 的範例[環境設定](/docs/{{version}}/configuration#environment-configuration)已準備好與 [Laravel Sail](/docs/{{version}}/sail) 一起使用。Laravel Sail 是一個 Docker 設定,用於在本機上開發 Laravel 專案。不過,可以隨意依據本機資料庫的需求來更改資料庫設定。" +msgstr "" -#: docs/10.x/database.md:block 14 (header) +# P +#: ./docs/8.x/database.md:34 +#: ./docs/9.x/database.md:37 +#: ./docs/10.x/database.md:37 +#: ./docs/11.x/database.md:39 +#: ./docs/master/database.md:37 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:35 +#: ./docs/9.x/database.md:38 +#: ./docs/10.x/database.md:38 +#: ./docs/11.x/database.md:40 +#: ./docs/master/database.md:38 msgid "SQLite Configuration" -msgstr "SQLite 設定" +msgstr "" -#: docs/10.x/database.md:block 15 (paragraph) +# P +#: ./docs/8.x/database.md:37 +#: ./docs/9.x/database.md:40 +#: ./docs/10.x/database.md:40 +#: ./docs/11.x/database.md:42 +#: ./docs/master/database.md:40 msgid "SQLite databases are contained within a single file on your filesystem. You can create a new SQLite database using the `touch` command in your terminal: `touch database/database.sqlite`. After the database has been created, you may easily configure your environment variables to point to this database by placing the absolute path to the database in the `DB_DATABASE` environment variable:" -msgstr "SQLite 資料庫包含在檔案系統上的單一檔案。可以在終端機內使用 `touch` 指令來建立一個新的 SQLite 資料庫:`touch database/database.sqlite`。建立好該資料庫後,只需要輕鬆地將使用絕對路徑來將 `DB_DATABASE` 環境變數指向該資料庫即可:" +msgstr "" -#: docs/10.x/database.md:block 16 (code) +# CODE +# CODE: ini +#: ./docs/8.x/database.md:39 +#: ./docs/9.x/database.md:42 +#: ./docs/10.x/database.md:42 +#: ./docs/11.x/database.md:44 +#: ./docs/master/database.md:42 msgid "DB_CONNECTION=sqlite\n" -"DB_DATABASE=/absolute/path/to/database.sqlite\n" -msgstr "DB_CONNECTION=sqlite\n" -"DB_DATABASE=/absolute/path/to/database.sqlite\n" +"DB_DATABASE=/absolute/path/to/database.sqlite" +msgstr "" -#: docs/10.x/database.md:block 17 (paragraph) +# P +#: ./docs/8.x/database.md:42 +#: ./docs/9.x/database.md:47 +#: ./docs/10.x/database.md:47 msgid "To enable foreign key constraints for SQLite connections, you should set the `DB_FOREIGN_KEYS` environment variable to `true`:" -msgstr "若要在 SQLite 連線上啟用外部索引鍵條件約束 (Foreign Key Constraint),則應將 `DB_FOREIGN_KEYS` 環境變數設為 `true`:" +msgstr "" -#: docs/10.x/database.md:block 18 (code) -msgid "DB_FOREIGN_KEYS=true\n" -msgstr "DB_FOREIGN_KEYS=true\n" +# CODE +# CODE: ini +#: ./docs/8.x/database.md:44 +#: ./docs/9.x/database.md:49 +#: ./docs/10.x/database.md:49 +msgid "DB_FOREIGN_KEYS=true" +msgstr "" -#: docs/10.x/database.md:block 20 (header) +# P +#: ./docs/8.x/database.md:46 +#: ./docs/9.x/database.md:53 +#: ./docs/10.x/database.md:53 +#: ./docs/11.x/database.md:58 +#: ./docs/master/database.md:56 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:47 +#: ./docs/9.x/database.md:54 +#: ./docs/10.x/database.md:54 +#: ./docs/11.x/database.md:59 +#: ./docs/master/database.md:57 msgid "Microsoft SQL Server Configuration" -msgstr "Microsoft SQL Server 設定" +msgstr "" + +# P +#: ./docs/11.x/database.md:49 +#: ./docs/master/database.md:47 +msgid "By default, foreign key constraints are enabled for SQLite connections. If you would like to disable them, you should set the `DB_FOREIGN_KEYS` environment variable to `false`:" +msgstr "" -#: docs/10.x/database.md:block 21 (paragraph) +# P +#: ./docs/8.x/database.md:49 +#: ./docs/9.x/database.md:56 +#: ./docs/10.x/database.md:56 +#: ./docs/11.x/database.md:61 +#: ./docs/master/database.md:59 msgid "To use a Microsoft SQL Server database, you should ensure that you have the `sqlsrv` and `pdo_sqlsrv` PHP extensions installed as well as any dependencies they may require such as the Microsoft SQL ODBC driver." -msgstr "若要使用 Microsoft SQL Server 資料庫,則應確保有安裝 `sqlsrv` 與 `pdo_sqlsrv` PHP 擴充套件,以及任何可能需要的相依性,如 Microsoft SQL ODBC 驅動器。" +msgstr "" + +# CODE: ini +#: ./docs/11.x/database.md:51 +#: ./docs/master/database.md:49 +msgid "DB_FOREIGN_KEYS=false" +msgstr "" -#: docs/10.x/database.md:block 23 (header) +# P +#: ./docs/8.x/database.md:51 +#: ./docs/9.x/database.md:58 +#: ./docs/10.x/database.md:58 +#: ./docs/11.x/database.md:63 +#: ./docs/master/database.md:61 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:52 +#: ./docs/9.x/database.md:59 +#: ./docs/10.x/database.md:59 +#: ./docs/11.x/database.md:64 +#: ./docs/master/database.md:62 msgid "Configuration Using URLs" -msgstr "使用 URL 來進行設定" +msgstr "" -#: docs/10.x/database.md:block 24 (paragraph) +# P +#: ./docs/8.x/database.md:54 +#: ./docs/9.x/database.md:61 +#: ./docs/10.x/database.md:61 +#: ./docs/11.x/database.md:66 +#: ./docs/master/database.md:64 msgid "Typically, database connections are configured using multiple configuration values such as `host`, `database`, `username`, `password`, etc. Each of these configuration values has its own corresponding environment variable. This means that when configuring your database connection information on a production server, you need to manage several environment variables." -msgstr "一般來說,資料庫的連線是通過多個設定值來設定的,如 `host`, `database`, `username`, `password`…等。這幾個設定值都有其對應的環境變數。這表示在正式環境伺服器上設定資料庫連線資訊時,需要處理多個環境變數。" +msgstr "" + +# P +#: ./docs/11.x/database.md:56 +#: ./docs/master/database.md:54 +msgid "If you use the [Laravel installer](/docs/{{version}}/installation#creating-a-laravel-project) to create your Laravel application and select SQLite as your database, Laravel will automatically create a `database/database.sqlite` file and run the default [database migrations](/docs/{{version}}/migrations) for you." +msgstr "" -#: docs/10.x/database.md:block 25 (paragraph) +# P +#: ./docs/8.x/database.md:56 +#: ./docs/9.x/database.md:63 +#: ./docs/10.x/database.md:63 +#: ./docs/11.x/database.md:68 +#: ./docs/master/database.md:66 msgid "Some managed database providers such as AWS and Heroku provide a single database \"URL\" that contains all of the connection information for the database in a single string. An example database URL may look something like the following:" -msgstr "像 AWS 或 Heroku 等受管理的資料庫提供商會提供單一的資料庫「URL」,該 URL 在單一字串內包含了所有用於該資料庫的連線資訊。一下為這種 URL 的範例:" +msgstr "" -#: docs/10.x/database.md:block 26 (code) -msgid "mysql://root:password@127.0.0.1/forge?charset=UTF-8\n" -msgstr "mysql://root:password@127.0.0.1/forge?charset=UTF-8\n" +# CODE: html +#: ./docs/8.x/database.md:58 +#: ./docs/9.x/database.md:65 +#: ./docs/10.x/database.md:65 +#: ./docs/11.x/database.md:70 +#: ./docs/master/database.md:68 +msgid "mysql://root:password@127.0.0.1/forge?charset=UTF-8" +msgstr "" -#: docs/10.x/database.md:block 27 (paragraph) +# P +#: ./docs/8.x/database.md:62 +#: ./docs/9.x/database.md:69 +#: ./docs/10.x/database.md:69 +#: ./docs/11.x/database.md:74 +#: ./docs/master/database.md:72 msgid "These URLs typically follow a standard schema convention:" -msgstr "這些 URL 通常遵守一種標準的結構描述規範:" +msgstr "" -#: docs/10.x/database.md:block 28 (code) -msgid "driver://username:password@host:port/database?options\n" -msgstr "driver://username:password@host:port/database?options\n" -"驅動器://使用者名稱:密碼@主機:連接埠/資料庫?選項\n" +# CODE: html +#: ./docs/8.x/database.md:64 +#: ./docs/9.x/database.md:71 +#: ./docs/10.x/database.md:71 +#: ./docs/11.x/database.md:76 +#: ./docs/master/database.md:74 +msgid "driver://username:password@host:port/database?options" +msgstr "" -#: docs/10.x/database.md:block 29 (paragraph) +# P +#: ./docs/8.x/database.md:68 +#: ./docs/9.x/database.md:75 +#: ./docs/10.x/database.md:75 +#: ./docs/master/database.md:78 msgid "For convenience, Laravel supports these URLs as an alternative to configuring your database with multiple configuration options. If the `url` (or corresponding `DATABASE_URL` environment variable) configuration option is present, it will be used to extract the database connection and credential information." -msgstr "為了方便起見,Laravel 也支援這些 URL 作為設定多個設定選項的替代。若有提供 `url` 設定選項 (或相應的 `DATABASE_URL` 環境變數),則會使用該值來拆出資料庫連線與金鑰資訊。" +msgstr "" -#: docs/10.x/database.md:block 31 (header) +# P +#: ./docs/8.x/database.md:70 +#: ./docs/9.x/database.md:77 +#: ./docs/10.x/database.md:77 +#: ./docs/11.x/database.md:82 +#: ./docs/master/database.md:80 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/database.md:71 +#: ./docs/9.x/database.md:78 msgid "Read & Write Connections" -msgstr "讀、寫連線" +msgstr "" -#: docs/10.x/database.md:block 32 (paragraph) +# P +#: ./docs/8.x/database.md:73 +#: ./docs/9.x/database.md:80 +#: ./docs/10.x/database.md:80 +#: ./docs/11.x/database.md:85 +#: ./docs/master/database.md:83 msgid "Sometimes you may wish to use one database connection for SELECT statements, and another for INSERT, UPDATE, and DELETE statements. Laravel makes this a breeze, and the proper connections will always be used whether you are using raw queries, the query builder, or the Eloquent ORM." -msgstr "有時候,我們可能會像在 SELECT 陳述式上使用某個資料庫連線,並在 INSERT, UPDATE, DELETE 陳述式上使用另一個資料庫連線。在 Laravel 中要達成這種目標非常容易,而且不管是使用原始查詢、Query Builder、或是 Eloquent ORM,都能判斷使用適合的連線。" +msgstr "" -#: docs/10.x/database.md:block 33 (paragraph) +# P +#: ./docs/8.x/database.md:75 +#: ./docs/9.x/database.md:82 +#: ./docs/10.x/database.md:82 +#: ./docs/11.x/database.md:87 +#: ./docs/master/database.md:85 msgid "To see how read / write connections should be configured, let's look at this example:" -msgstr "要瞭解如何設定讀、寫連線,來看看這個範例:" +msgstr "" -#: docs/10.x/database.md:block 34 (code) +# CODE +#: ./docs/8.x/database.md:77 +#: ./docs/9.x/database.md:84 +#: ./docs/10.x/database.md:84 msgid "'mysql' => [\n" " 'read' => [\n" " 'host' => [\n" @@ -192,8 +492,24 @@ msgid "'mysql' => [\n" " 'charset' => 'utf8mb4',\n" " 'collation' => 'utf8mb4_unicode_ci',\n" " 'prefix' => '',\n" -"],\n" -msgstr "'mysql' => [\n" +"]," +msgstr "" + +# H3 +#: ./docs/10.x/database.md:78 +#: ./docs/11.x/database.md:83 +#: ./docs/master/database.md:81 +msgid "Read and Write Connections" +msgstr "" + +# P +#: ./docs/11.x/database.md:80 +msgid "For convenience, Laravel supports these URLs as an alternative to configuring your database with multiple configuration options. If the `url` (or corresponding `DB_URL` environment variable) configuration option is present, it will be used to extract the database connection and credential information." +msgstr "" + +# CODE +#: ./docs/master/database.md:87 +msgid "'mysql' => [\n" " 'read' => [\n" " 'host' => [\n" " '192.168.1.1',\n" @@ -205,66 +521,184 @@ msgstr "'mysql' => [\n" " '196.168.1.3',\n" " ],\n" " ],\n" -" 'sticky' => true,\n" -" 'driver' => 'mysql',\n" -" 'database' => 'database',\n" -" 'username' => 'root',\n" -" 'password' => '',\n" -" 'charset' => 'utf8mb4',\n" -" 'collation' => 'utf8mb4_unicode_ci',\n" +" 'sticky' => true,\n\n" +" 'database' => env('DB_DATABASE', 'laravel'),\n" +" 'username' => env('DB_USERNAME', 'root'),\n" +" 'password' => env('DB_PASSWORD', ''),\n" +" 'unix_socket' => env('DB_SOCKET', ''),\n" +" 'charset' => env('DB_CHARSET', 'utf8mb4'),\n" +" 'collation' => env('DB_COLLATION', 'utf8mb4_0900_ai_ci'),\n" +" 'prefix' => '',\n" +" 'prefix_indexes' => true,\n" +" 'strict' => true,\n" +" 'engine' => null,\n" +" 'options' => extension_loaded('pdo_mysql') ? array_filter([\n" +" PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),\n" +" ]) : [],\n" +"]," +msgstr "" + +# CODE +#: ./docs/11.x/database.md:89 +msgid "'mysql' => [\n" +" 'read' => [\n" +" 'host' => [\n" +" '192.168.1.1',\n" +" '196.168.1.2',\n" +" ],\n" +" ],\n" +" 'write' => [\n" +" 'host' => [\n" +" '196.168.1.3',\n" +" ],\n" +" ],\n" +" 'sticky' => true,\n\n" +" 'database' => env('DB_DATABASE', 'laravel'),\n" +" 'username' => env('DB_USERNAME', 'root'),\n" +" 'password' => env('DB_PASSWORD', ''),\n" +" 'unix_socket' => env('DB_SOCKET', ''),\n" +" 'charset' => env('DB_CHARSET', 'utf8mb4'),\n" +" 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),\n" " 'prefix' => '',\n" -"],\n" +" 'prefix_indexes' => true,\n" +" 'strict' => true,\n" +" 'engine' => null,\n" +" 'options' => extension_loaded('pdo_mysql') ? array_filter([\n" +" PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),\n" +" ]) : [],\n" +"]," +msgstr "" -#: docs/10.x/database.md:block 35 (paragraph) +# P +#: ./docs/8.x/database.md:99 +#: ./docs/9.x/database.md:106 +#: ./docs/10.x/database.md:106 +#: ./docs/11.x/database.md:118 +#: ./docs/master/database.md:116 msgid "Note that three keys have been added to the configuration array: `read`, `write` and `sticky`. The `read` and `write` keys have array values containing a single key: `host`. The rest of the database options for the `read` and `write` connections will be merged from the main `mysql` configuration array." -msgstr "請注意,在設定陣列中加入了三個新的鍵值:`read`, `write`, `stick`。`read` 與 `write` 索引鍵為一個陣列,包含單一索引鍵:`host`。其他用於 `read` 與 `write` 連線的資料庫選項會從主要的 `mysql` 設定陣列合併過來:" +msgstr "" -#: docs/10.x/database.md:block 36 (paragraph) +# P +#: ./docs/8.x/database.md:101 +#: ./docs/9.x/database.md:108 +#: ./docs/10.x/database.md:108 +#: ./docs/11.x/database.md:120 +#: ./docs/master/database.md:118 msgid "You only need to place items in the `read` and `write` arrays if you wish to override the values from the main `mysql` array. So, in this case, `192.168.1.1` will be used as the host for the \"read\" connection, while `192.168.1.3` will be used for the \"write\" connection. The database credentials, prefix, character set, and all other options in the main `mysql` array will be shared across both connections. When multiple values exist in the `host` configuration array, a database host will be randomly chosen for each request." -msgstr "只需要將 `mysql` 陣列中所需要複寫的值放到 `read` 與 `write` 陣列中即可。因此,在這個例子中,「read」連線的主機會是 `192.168.1.1` ,而「write」連線則會使用 `192.168.1.3`。資料庫認證、前置詞、字元集、以及其他主要 `mysql` 陣列中的選項都將在這兩個連線間共用。當 `host` 設定陣列中有多個值時,每個請求都會隨機選擇一個資料庫主機。" +msgstr "" -#: docs/10.x/database.md:block 38 (header) +# P +#: ./docs/8.x/database.md:103 +#: ./docs/9.x/database.md:110 +#: ./docs/10.x/database.md:110 +#: ./docs/11.x/database.md:122 +#: ./docs/master/database.md:120 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:104 +#: ./docs/9.x/database.md:111 +#: ./docs/10.x/database.md:111 +#: ./docs/11.x/database.md:123 +#: ./docs/master/database.md:121 msgid "The `sticky` Option" -msgstr "`sticky` 選項" +msgstr "" -#: docs/10.x/database.md:block 39 (paragraph) +# P +#: ./docs/8.x/database.md:106 +#: ./docs/9.x/database.md:113 +#: ./docs/10.x/database.md:113 +#: ./docs/11.x/database.md:125 +#: ./docs/master/database.md:123 msgid "The `sticky` option is an *optional* value that can be used to allow the immediate reading of records that have been written to the database during the current request cycle. If the `sticky` option is enabled and a \"write\" operation has been performed against the database during the current request cycle, any further \"read\" operations will use the \"write\" connection. This ensures that any data written during the request cycle can be immediately read back from the database during that same request. It is up to you to decide if this is the desired behavior for your application." -msgstr "`sticky` 選項是一個 **可選** 的值。該選項可用於設定在同一個請求生命週期中,當資料寫入資料庫後馬上讀取該記錄。若有啟用 `sticky` 選項,且有在目前請求生命週期內進行「寫入」操作,接下來的「讀取」操作都會使用「write」連線。這樣一來可以確保在該請求生命週期內寫入的資料能壩上在該請求內從資料庫內讀取回來。開發人員可以自行決定這種行為是否適用與你的專案。" +msgstr "" -#: docs/10.x/database.md:block 41 (header) +# P +#: ./docs/8.x/database.md:108 +#: ./docs/9.x/database.md:115 +#: ./docs/10.x/database.md:115 +#: ./docs/11.x/database.md:127 +#: ./docs/master/database.md:125 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/database.md:109 +#: ./docs/9.x/database.md:116 +#: ./docs/10.x/database.md:116 +#: ./docs/11.x/database.md:128 +#: ./docs/master/database.md:126 msgid "Running SQL Queries" -msgstr "執行 SQL 查詢" +msgstr "" -#: docs/10.x/database.md:block 42 (paragraph) +# P +#: ./docs/8.x/database.md:111 +#: ./docs/9.x/database.md:118 +#: ./docs/10.x/database.md:118 +#: ./docs/11.x/database.md:130 +#: ./docs/master/database.md:128 msgid "Once you have configured your database connection, you may run queries using the `DB` facade. The `DB` facade provides methods for each type of query: `select`, `update`, `insert`, `delete`, and `statement`." -msgstr "設定好資料庫連線後,就可以使用 `DB` Facade 來執行查詢。`DB` Facade 提供了用於各類查詢的方法:`select`, `update`, `insert`, `delete` 與 `statement`。" +msgstr "" -#: docs/10.x/database.md:block 44 (header) +# P +#: ./docs/8.x/database.md:113 +#: ./docs/9.x/database.md:120 +#: ./docs/10.x/database.md:120 +#: ./docs/11.x/database.md:132 +#: ./docs/master/database.md:130 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:114 +#: ./docs/9.x/database.md:121 msgid "Running A Select Query" -msgstr "執行 SELECT 查詢" +msgstr "" -#: docs/10.x/database.md:block 45 (paragraph) +# P +#: ./docs/8.x/database.md:116 +#: ./docs/9.x/database.md:123 +#: ./docs/10.x/database.md:123 +#: ./docs/11.x/database.md:135 +#: ./docs/master/database.md:133 msgid "To run a basic SELECT query, you may use the `select` method on the `DB` facade:" -msgstr "若要執行標準的 SELECT 查詢,可以使用 `DB` Facade 上的 `select` 方法:" +msgstr "" -#: docs/10.x/database.md:block 46 (code) +# CODE +#: ./docs/8.x/database.md:118 +#: ./docs/9.x/database.md:125 msgid " $users]);\n" " }\n" -"}\n" -msgstr " $users]);\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/database.md:block 47 (paragraph) +# P +#: ./docs/8.x/database.md:140 +#: ./docs/9.x/database.md:147 +#: ./docs/10.x/database.md:146 +#: ./docs/11.x/database.md:158 +#: ./docs/master/database.md:156 msgid "The first argument passed to the `select` method is the SQL query, while the second argument is any parameter bindings that need to be bound to the query. Typically, these are the values of the `where` clause constraints. Parameter binding provides protection against SQL injection." -msgstr "傳入 `select` 的第一個引數是 SQL 查詢,而第二個引數則是需要繫結到該查詢上的參數繫結。通常來說,這些繫結值就是 `where` 子句限制式的值。使用參數繫結即可避免 SQL 注入攻擊。" +msgstr "" -#: docs/10.x/database.md:block 48 (paragraph) +# P +#: ./docs/8.x/database.md:142 +#: ./docs/9.x/database.md:149 +#: ./docs/10.x/database.md:148 +#: ./docs/11.x/database.md:160 +#: ./docs/master/database.md:158 msgid "The `select` method will always return an `array` of results. Each result within the array will be a PHP `stdClass` object representing a record from the database:" -msgstr "`select` 方法只會回傳 `array` 作為其結果。在陣列中的各個結果都會是 PHP 的 `stdClass`,代表資料庫內的記錄:" +msgstr "" -#: docs/10.x/database.md:block 49 (code) +# CODE +#: ./docs/8.x/database.md:144 +#: ./docs/9.x/database.md:151 +#: ./docs/10.x/database.md:150 +#: ./docs/11.x/database.md:162 +#: ./docs/master/database.md:160 msgid "use Illuminate\\Support\\Facades\\DB;\n\n" "$users = DB::select('select * from users');\n\n" "foreach ($users as $user) {\n" " echo $user->name;\n" -"}\n" -msgstr "use Illuminate\\Support\\Facades\\DB;\n\n" -"$users = DB::select('select * from users');\n\n" -"foreach ($users as $user) {\n" -" echo $user->name;\n" -"}\n" - -#: docs/10.x/database.md:block 51 (header) -msgid "Selecting Scalar Values" -msgstr "Select ^[純量](Scalar)值" - -#: docs/10.x/database.md:block 52 (paragraph) -msgid "Sometimes your database query may result in a single, scalar value. Instead of being required to retrieve the query's scalar result from a record object, Laravel allows you to retrieve this value directly using the `scalar` method:" -msgstr "有時候,有些資料庫查詢只會回傳一個單一、^[純量](Scalar)的值。在 Laravel 中,我們不一定要從資料物件中取出該查詢的純量值,而可以使用 `scalar` 方法來直接取得這個值:" - -#: docs/10.x/database.md:block 53 (code) -msgid "$burgers = DB::scalar(\n" -" \"select count(case when food = 'burger' then 1 end) as burgers from menu\"\n" -");\n" -msgstr "$burgers = DB::scalar(\n" -" \"select count(case when food = 'burger' then 1 end) as burgers from menu\"\n" -");\n" - -#: docs/10.x/database.md:block 55 (header) -msgid "Selecting Multiple Result Sets" -msgstr "選擇多個結果集合" - -#: docs/10.x/database.md:block 56 (paragraph) -msgid "If your application calls stored procedures that return multiple result sets, you may use the `selectResultSets` method to retrieve all of the result sets returned by the stored procedure:" -msgstr "若程式呼叫了會回傳多個結果集合的 ^[Stored Procedure](預存程序),則可使用 `selectResultSets` 方法來取得該 Stored Procudure 所回傳的所有結果集合:" - -#: docs/10.x/database.md:block 57 (code) -msgid "[$options, $notifications] = DB::selectResultSets(\n" -" \"CALL get_user_options_and_notifications(?)\", $request->user()->id\n" -");\n" -msgstr "[$options, $notifications] = DB::selectResultSets(\n" -" \"CALL get_user_options_and_notifications(?)\", $request->user()->id\n" -");\n" +"}" +msgstr "" -#: docs/10.x/database.md:block 59 (header) +# P +#: ./docs/8.x/database.md:152 +#: ./docs/9.x/database.md:168 +#: ./docs/10.x/database.md:176 +#: ./docs/11.x/database.md:188 +#: ./docs/master/database.md:186 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:153 +#: ./docs/9.x/database.md:169 +#: ./docs/10.x/database.md:177 +#: ./docs/11.x/database.md:189 +#: ./docs/master/database.md:187 msgid "Using Named Bindings" -msgstr "使用命名繫結" +msgstr "" -#: docs/10.x/database.md:block 60 (paragraph) +# P +#: ./docs/8.x/database.md:155 +#: ./docs/9.x/database.md:171 +#: ./docs/10.x/database.md:179 +#: ./docs/11.x/database.md:191 +#: ./docs/master/database.md:189 msgid "Instead of using `?` to represent your parameter bindings, you may execute a query using named bindings:" -msgstr "比起使用 `?` 來表示參數繫結,也可以使用命名繫結來執行查詢:" +msgstr "" -#: docs/10.x/database.md:block 61 (code) -msgid "$results = DB::select('select * from users where id = :id', ['id' => 1]);\n" -msgstr "$results = DB::select('select * from users where id = :id', ['id' => 1]);\n" +# CODE +#: ./docs/8.x/database.md:157 +#: ./docs/9.x/database.md:173 +#: ./docs/10.x/database.md:181 +#: ./docs/11.x/database.md:193 +#: ./docs/master/database.md:191 +msgid "$results = DB::select('select * from users where id = :id', ['id' => 1]);" +msgstr "" -#: docs/10.x/database.md:block 63 (header) +# P +#: ./docs/8.x/database.md:159 +#: ./docs/9.x/database.md:175 +#: ./docs/10.x/database.md:183 +#: ./docs/11.x/database.md:195 +#: ./docs/master/database.md:193 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/database.md:159 +#: ./docs/10.x/database.md:158 +#: ./docs/11.x/database.md:170 +#: ./docs/master/database.md:168 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:160 +#: ./docs/9.x/database.md:176 msgid "Running An Insert Statement" -msgstr "執行 INSERT 陳述式" +msgstr "" -#: docs/10.x/database.md:block 64 (paragraph) +# H4 +#: ./docs/9.x/database.md:160 +#: ./docs/10.x/database.md:159 +#: ./docs/11.x/database.md:171 +#: ./docs/master/database.md:169 +msgid "Selecting Scalar Values" +msgstr "" + +# P +#: ./docs/8.x/database.md:162 +#: ./docs/9.x/database.md:178 +#: ./docs/10.x/database.md:186 +#: ./docs/11.x/database.md:198 +#: ./docs/master/database.md:196 msgid "To execute an `insert` statement, you may use the `insert` method on the `DB` facade. Like `select`, this method accepts the SQL query as its first argument and bindings as its second argument:" -msgstr "若要執行 `insert` 陳述式,可以使用 `DB` Facade 上的 `insert` 方法。與 `select` 方法類似,這個方法接受 SQL 查詢作為其第一個引數,而繫結則為其第二個引數:" +msgstr "" -#: docs/10.x/database.md:block 65 (code) +# P +#: ./docs/9.x/database.md:162 +#: ./docs/10.x/database.md:161 +#: ./docs/11.x/database.md:173 +#: ./docs/master/database.md:171 +msgid "Sometimes your database query may result in a single, scalar value. Instead of being required to retrieve the query's scalar result from a record object, Laravel allows you to retrieve this value directly using the `scalar` method:" +msgstr "" + +# CODE +#: ./docs/8.x/database.md:164 +#: ./docs/9.x/database.md:180 +#: ./docs/10.x/database.md:188 +#: ./docs/11.x/database.md:200 +#: ./docs/master/database.md:198 msgid "use Illuminate\\Support\\Facades\\DB;\n\n" -"DB::insert('insert into users (id, name) values (?, ?)', [1, 'Marc']);\n" -msgstr "use Illuminate\\Support\\Facades\\DB;\n\n" -"DB::insert('insert into users (id, name) values (?, ?)', [1, 'Marc']);\n" +"DB::insert('insert into users (id, name) values (?, ?)', [1, 'Marc']);" +msgstr "" -#: docs/10.x/database.md:block 67 (header) +# CODE +#: ./docs/9.x/database.md:164 +#: ./docs/10.x/database.md:163 +#: ./docs/11.x/database.md:175 +#: ./docs/master/database.md:173 +msgid "$burgers = DB::scalar(\n" +" \"select count(case when food = 'burger' then 1 end) as burgers from menu\"\n" +");" +msgstr "" + +# P +#: ./docs/10.x/database.md:167 +#: ./docs/11.x/database.md:179 +#: ./docs/master/database.md:177 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/database.md:168 +#: ./docs/11.x/database.md:180 +#: ./docs/master/database.md:178 +msgid "Selecting Multiple Result Sets" +msgstr "" + +# P +#: ./docs/8.x/database.md:168 +#: ./docs/9.x/database.md:184 +#: ./docs/10.x/database.md:192 +#: ./docs/11.x/database.md:204 +#: ./docs/master/database.md:202 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:169 +#: ./docs/9.x/database.md:185 msgid "Running An Update Statement" -msgstr "執行 UPDATE 陳述式" +msgstr "" -#: docs/10.x/database.md:block 68 (paragraph) +# P +#: ./docs/10.x/database.md:170 +#: ./docs/11.x/database.md:182 +#: ./docs/master/database.md:180 +msgid "If your application calls stored procedures that return multiple result sets, you may use the `selectResultSets` method to retrieve all of the result sets returned by the stored procedure:" +msgstr "" + +# P +#: ./docs/8.x/database.md:171 +#: ./docs/9.x/database.md:187 +#: ./docs/10.x/database.md:195 +#: ./docs/11.x/database.md:207 +#: ./docs/master/database.md:205 msgid "The `update` method should be used to update existing records in the database. The number of rows affected by the statement is returned by the method:" -msgstr "`update` 陳述式應用來更新資料庫中的現有資料。該方法將回傳受該陳述式所影響的行數:" +msgstr "" + +# CODE +#: ./docs/10.x/database.md:172 +#: ./docs/11.x/database.md:184 +#: ./docs/master/database.md:182 +msgid "[$options, $notifications] = DB::selectResultSets(\n" +" \"CALL get_user_options_and_notifications(?)\", $request->user()->id\n" +");" +msgstr "" -#: docs/10.x/database.md:block 69 (code) +# CODE +#: ./docs/8.x/database.md:173 +#: ./docs/9.x/database.md:189 +#: ./docs/10.x/database.md:197 +#: ./docs/11.x/database.md:209 +#: ./docs/master/database.md:207 msgid "use Illuminate\\Support\\Facades\\DB;\n\n" "$affected = DB::update(\n" " 'update users set votes = 100 where name = ?',\n" " ['Anita']\n" -");\n" -msgstr "use Illuminate\\Support\\Facades\\DB;\n\n" -"$affected = DB::update(\n" -" 'update users set votes = 100 where name = ?',\n" -" ['Anita']\n" -");\n" +");" +msgstr "" -#: docs/10.x/database.md:block 71 (header) +# P +#: ./docs/8.x/database.md:180 +#: ./docs/9.x/database.md:196 +#: ./docs/10.x/database.md:204 +#: ./docs/11.x/database.md:216 +#: ./docs/master/database.md:214 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:181 +#: ./docs/9.x/database.md:197 msgid "Running A Delete Statement" -msgstr "執行 DELETE 陳述式" +msgstr "" -#: docs/10.x/database.md:block 72 (paragraph) +# P +#: ./docs/8.x/database.md:183 +#: ./docs/9.x/database.md:199 +#: ./docs/10.x/database.md:207 +#: ./docs/11.x/database.md:219 +#: ./docs/master/database.md:217 msgid "The `delete` method should be used to delete records from the database. Like `update`, the number of rows affected will be returned by the method:" -msgstr "`delete` 方法應用於從資料庫內刪除陣列。與 `update` 類似,該方法會回傳受影響的行數:" +msgstr "" + +# H4 +#: ./docs/10.x/database.md:184 +#: ./docs/11.x/database.md:196 +#: ./docs/master/database.md:194 +msgid "Running an Insert Statement" +msgstr "" -#: docs/10.x/database.md:block 73 (code) +# CODE +#: ./docs/8.x/database.md:185 +#: ./docs/9.x/database.md:201 +#: ./docs/10.x/database.md:209 +#: ./docs/11.x/database.md:221 +#: ./docs/master/database.md:219 msgid "use Illuminate\\Support\\Facades\\DB;\n\n" -"$deleted = DB::delete('delete from users');\n" -msgstr "use Illuminate\\Support\\Facades\\DB;\n\n" -"$deleted = DB::delete('delete from users');\n" +"$deleted = DB::delete('delete from users');" +msgstr "" -#: docs/10.x/database.md:block 75 (header) +# P +#: ./docs/8.x/database.md:189 +#: ./docs/9.x/database.md:205 +#: ./docs/10.x/database.md:213 +#: ./docs/11.x/database.md:225 +#: ./docs/master/database.md:223 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:190 +#: ./docs/9.x/database.md:206 msgid "Running A General Statement" -msgstr "執行一般陳述式" +msgstr "" -#: docs/10.x/database.md:block 76 (paragraph) +# P +#: ./docs/8.x/database.md:192 +#: ./docs/9.x/database.md:208 +#: ./docs/10.x/database.md:216 +#: ./docs/11.x/database.md:228 +#: ./docs/master/database.md:226 msgid "Some database statements do not return any value. For these types of operations, you may use the `statement` method on the `DB` facade:" -msgstr "有的資料庫陳述式並不會回傳任何值。對於這類操作,可以使用 `DB` Facade 上的 `statement` 方法:" +msgstr "" + +# H4 +#: ./docs/10.x/database.md:193 +#: ./docs/11.x/database.md:205 +#: ./docs/master/database.md:203 +msgid "Running an Update Statement" +msgstr "" -#: docs/10.x/database.md:block 77 (code) -msgid "DB::statement('drop table users');\n" -msgstr "DB::statement('drop table users');\n" +# CODE +#: ./docs/8.x/database.md:194 +#: ./docs/9.x/database.md:210 +#: ./docs/10.x/database.md:218 +#: ./docs/11.x/database.md:230 +#: ./docs/master/database.md:228 +msgid "DB::statement('drop table users');" +msgstr "" -#: docs/10.x/database.md:block 79 (header) +# P +#: ./docs/8.x/database.md:196 +#: ./docs/9.x/database.md:212 +#: ./docs/10.x/database.md:220 +#: ./docs/11.x/database.md:232 +#: ./docs/master/database.md:230 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:197 +#: ./docs/9.x/database.md:213 msgid "Running An Unprepared Statement" -msgstr "執行非預先準備的陳述式" +msgstr "" -#: docs/10.x/database.md:block 80 (paragraph) +# P +#: ./docs/8.x/database.md:199 +#: ./docs/9.x/database.md:215 +#: ./docs/10.x/database.md:223 +#: ./docs/11.x/database.md:235 +#: ./docs/master/database.md:233 msgid "Sometimes you may want to execute an SQL statement without binding any values. You may use the `DB` facade's `unprepared` method to accomplish this:" -msgstr "有的時候,我們可能會想在不繫結任何值的情況下執行 SQL 陳述式。可以使用 `DB` Facade 的 `unprepared` 方法來達成:" +msgstr "" -#: docs/10.x/database.md:block 81 (code) -msgid "DB::unprepared('update users set votes = 100 where name = \"Dries\"');\n" -msgstr "DB::unprepared('update users set votes = 100 where name = \"Dries\"');\n" +# CODE +#: ./docs/8.x/database.md:201 +#: ./docs/9.x/database.md:217 +#: ./docs/10.x/database.md:225 +#: ./docs/11.x/database.md:237 +#: ./docs/master/database.md:235 +msgid "DB::unprepared('update users set votes = 100 where name = \"Dries\"');" +msgstr "" + +# P +#: ./docs/8.x/database.md:203 +#: ./docs/9.x/database.md:220 +#: ./docs/10.x/database.md:228 +#: ./docs/11.x/database.md:240 +#: ./docs/master/database.md:238 +msgid "Since unprepared statements do not bind parameters, they may be vulnerable to SQL injection. You should never allow user controlled values within an unprepared statement." +msgstr "" -#: docs/10.x/database.md:block 82 (quote) -msgid "**Warning** Since unprepared statements do not bind parameters, they may be vulnerable to SQL injection. You should never allow user controlled values within an unprepared statement." -msgstr "**Warning** 由於未預先準備的陳述式並不繫結參數,因此這些查詢可能容易遭受 SQL 注入攻擊。在未預先準備的陳述式中,不應包含使用者可控制的值。" +# H4 +#: ./docs/10.x/database.md:205 +#: ./docs/11.x/database.md:217 +#: ./docs/master/database.md:215 +msgid "Running a Delete Statement" +msgstr "" -#: docs/10.x/database.md:block 84 (header) +# P +#: ./docs/8.x/database.md:205 +#: ./docs/9.x/database.md:222 +#: ./docs/10.x/database.md:230 +#: ./docs/11.x/database.md:242 +#: ./docs/master/database.md:240 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:206 +#: ./docs/9.x/database.md:223 +#: ./docs/10.x/database.md:231 +#: ./docs/11.x/database.md:243 +#: ./docs/master/database.md:241 msgid "Implicit Commits" -msgstr "隱式 Commit" +msgstr "" -#: docs/10.x/database.md:block 85 (paragraph) +# P +#: ./docs/8.x/database.md:208 +#: ./docs/9.x/database.md:225 +#: ./docs/10.x/database.md:233 +#: ./docs/11.x/database.md:245 +#: ./docs/master/database.md:243 msgid "When using the `DB` facade's `statement` and `unprepared` methods within transactions you must be careful to avoid statements that cause [implicit commits](https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html). These statements will cause the database engine to indirectly commit the entire transaction, leaving Laravel unaware of the database's transaction level. An example of such a statement is creating a database table:" -msgstr "在 Transaction 內使用 `DB` Facade 的 `statement` 與 `unprepared` 方法時,應特別小心,以避免會導致[隱式 Commit](https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html) 的陳述式。這些陳述式會導致資料庫引擎間接地 Commit 整個 Transaction,並讓 Laravel 無從得知資料庫的 Transaction 等級。建立資料庫表就是這種陳述式的一個例子:" +msgstr "" -#: docs/10.x/database.md:block 86 (code) -msgid "DB::unprepared('create table a (col varchar(1) null)');\n" -msgstr "DB::unprepared('create table a (col varchar(1) null)');\n" +# CODE +#: ./docs/8.x/database.md:210 +#: ./docs/9.x/database.md:227 +#: ./docs/10.x/database.md:235 +#: ./docs/11.x/database.md:247 +#: ./docs/master/database.md:245 +msgid "DB::unprepared('create table a (col varchar(1) null)');" +msgstr "" -#: docs/10.x/database.md:block 87 (paragraph) +# P +#: ./docs/8.x/database.md:212 +#: ./docs/9.x/database.md:229 +#: ./docs/10.x/database.md:237 +#: ./docs/11.x/database.md:249 +#: ./docs/master/database.md:247 msgid "Please refer to the MySQL manual for [a list of all statements](https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html) that trigger implicit commits." -msgstr "有關會觸發隱式 Commit 的[這類陳述式的清單](https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html),請參考 MySQL 操作手冊。" +msgstr "" -#: docs/10.x/database.md:block 89 (header) +# H4 +#: ./docs/10.x/database.md:214 +#: ./docs/11.x/database.md:226 +#: ./docs/master/database.md:224 +msgid "Running a General Statement" +msgstr "" + +# P +#: ./docs/8.x/database.md:214 +#: ./docs/9.x/database.md:231 +#: ./docs/10.x/database.md:239 +#: ./docs/11.x/database.md:251 +#: ./docs/master/database.md:249 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/database.md:215 +#: ./docs/9.x/database.md:232 +#: ./docs/10.x/database.md:240 +#: ./docs/11.x/database.md:252 +#: ./docs/master/database.md:250 msgid "Using Multiple Database Connections" -msgstr "使用多個資料庫連線" +msgstr "" -#: docs/10.x/database.md:block 90 (paragraph) +# P +#: ./docs/8.x/database.md:217 +#: ./docs/9.x/database.md:234 +#: ./docs/10.x/database.md:242 +#: ./docs/11.x/database.md:254 +#: ./docs/master/database.md:252 msgid "If your application defines multiple connections in your `config/database.php` configuration file, you may access each connection via the `connection` method provided by the `DB` facade. The connection name passed to the `connection` method should correspond to one of the connections listed in your `config/database.php` configuration file or configured at runtime using the `config` helper:" -msgstr "若 `config/database.php` 設定檔中有有定義多個連線,則可以通過 `DB` Facade 的 `connection` 方法來存取各個連線。傳入 `connection` 方法內的連線名稱應對應到 `config/database.php` 設定檔內所列出的其中一個連線名稱,或是在執行階段使用 `config` 輔助函式所設定的連線:" +msgstr "" -#: docs/10.x/database.md:block 91 (code) +# CODE +#: ./docs/8.x/database.md:219 msgid "use Illuminate\\Support\\Facades\\DB;\n\n" -"$users = DB::connection('sqlite')->select(/* ... */);\n" -msgstr "use Illuminate\\Support\\Facades\\DB;\n\n" -"$users = DB::connection('sqlite')->select(/* ... */);\n" +"$users = DB::connection('sqlite')->select(...);" +msgstr "" + +# H4 +#: ./docs/10.x/database.md:221 +#: ./docs/11.x/database.md:233 +#: ./docs/master/database.md:231 +msgid "Running an Unprepared Statement" +msgstr "" -#: docs/10.x/database.md:block 92 (paragraph) +# P +#: ./docs/8.x/database.md:223 +#: ./docs/9.x/database.md:240 +#: ./docs/10.x/database.md:248 +#: ./docs/11.x/database.md:260 +#: ./docs/master/database.md:258 msgid "You may access the raw, underlying PDO instance of a connection using the `getPdo` method on a connection instance:" -msgstr "也可以通過連線實體上的 `getPdo` 方法來存取原始、底層的 PDO 實體:" +msgstr "" -#: docs/10.x/database.md:block 93 (code) -msgid "$pdo = DB::connection()->getPdo();\n" -msgstr "$pdo = DB::connection()->getPdo();\n" +# CODE +#: ./docs/8.x/database.md:225 +#: ./docs/9.x/database.md:242 +#: ./docs/10.x/database.md:250 +#: ./docs/11.x/database.md:262 +#: ./docs/master/database.md:260 +msgid "$pdo = DB::connection()->getPdo();" +msgstr "" -#: docs/10.x/database.md:block 95 (header) +# P +#: ./docs/8.x/database.md:227 +#: ./docs/9.x/database.md:244 +#: ./docs/10.x/database.md:252 +#: ./docs/11.x/database.md:264 +#: ./docs/master/database.md:262 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/database.md:228 +#: ./docs/9.x/database.md:245 msgid "Listening For Query Events" -msgstr "監聽查詢事件" +msgstr "" -#: docs/10.x/database.md:block 96 (paragraph) +# P +#: ./docs/8.x/database.md:230 +#: ./docs/9.x/database.md:247 +#: ./docs/10.x/database.md:255 +#: ./docs/11.x/database.md:267 +#: ./docs/master/database.md:265 msgid "If you would like to specify a closure that is invoked for each SQL query executed by your application, you may use the `DB` facade's `listen` method. This method can be useful for logging queries or debugging. You may register your query listener closure in the `boot` method of a [service provider](/docs/{{version}}/providers):" -msgstr "若想讓網站在每次執行 SQL 查詢時叫用某個閉包,可以使用 `DB` Facade 的 `listen` 方法。該方法適用於記錄查詢或偵錯。可以在 [Service Provider](/docs/{{version}}/providers) 內的 `boot` 方法中註冊查詢的監聽程式閉包:" +msgstr "" -#: docs/10.x/database.md:block 97 (code) +# CODE +#: ./docs/8.x/database.md:232 +#: ./docs/9.x/database.md:249 msgid "sql;\n" " // $query->bindings;\n" " // $query->time;\n" " });\n" " }\n" -"}\n" -msgstr "select(/* ... */);" +msgstr "" + +# H3 +#: ./docs/10.x/database.md:253 +#: ./docs/11.x/database.md:265 +#: ./docs/master/database.md:263 +msgid "Listening for Query Events" +msgstr "" + +# CODE +#: ./docs/10.x/database.md:257 +#: ./docs/master/database.md:267 +msgid "time;\n" " });\n" " }\n" -"}\n" - -#: docs/10.x/database.md:block 99 (header) -msgid "Monitoring Cumulative Query Time" -msgstr "監控積累的查詢時間" +"}" +msgstr "" -#: docs/10.x/database.md:block 100 (paragraph) -msgid "A common performance bottleneck of modern web applications is the amount of time they spend querying databases. Thankfully, Laravel can invoke a closure or callback of your choice when it spends too much time querying the database during a single request. To get started, provide a query time threshold (in milliseconds) and closure to the `whenQueryingForLongerThan` method. You may invoke this method in the `boot` method of a [service provider](/docs/{{version}}/providers):" -msgstr "在現代網頁 App 中常見的效能瓶頸就是在查詢資料庫所花費的時間上。幸好,Laravel 可以在程式在單一 Request 中查詢資料庫花費太多時間時,叫用指定的閉包或回呼。若要開始監控積累的查詢時間,請向 `whenQueryingForLongerThan` 方法提供一個查詢時間的閥值 (單位為毫秒),以及一個閉包。可以在某個 [Service Provider](/docs/{{version}}/providers) 中叫用此方法:" +# P +#: ./docs/8.x/database.md:266 +#: ./docs/9.x/database.md:322 +#: ./docs/10.x/database.md:323 +#: ./docs/11.x/database.md:336 +#: ./docs/master/database.md:333 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/database.md:267 +#: ./docs/9.x/database.md:323 +#: ./docs/10.x/database.md:324 +#: ./docs/11.x/database.md:337 +#: ./docs/master/database.md:334 +msgid "Database Transactions" +msgstr "" -#: docs/10.x/database.md:block 101 (code) +# CODE +#: ./docs/11.x/database.md:269 msgid "sql;\n" +" // $query->bindings;\n" +" // $query->time;\n" +" // $query->toRawSql();\n" +" });\n" +" }\n" +"}" +msgstr "" + +# P +#: ./docs/8.x/database.md:269 +#: ./docs/9.x/database.md:325 +#: ./docs/10.x/database.md:326 +#: ./docs/11.x/database.md:339 +#: ./docs/master/database.md:336 +msgid "You may use the `transaction` method provided by the `DB` facade to run a set of operations within a database transaction. If an exception is thrown within the transaction closure, the transaction will automatically be rolled back and the exception is re-thrown. If the closure executes successfully, the transaction will automatically be committed. You don't need to worry about manually rolling back or committing while using the `transaction` method:" +msgstr "" + +# CODE +#: ./docs/8.x/database.md:271 +#: ./docs/9.x/database.md:327 +#: ./docs/10.x/database.md:328 +#: ./docs/11.x/database.md:341 +#: ./docs/master/database.md:338 +msgid "use Illuminate\\Support\\Facades\\DB;\n\n" +"DB::transaction(function () {\n" +" DB::update('update users set votes = 1');\n\n" +" DB::delete('delete from posts');\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/database.md:279 +#: ./docs/9.x/database.md:335 +#: ./docs/10.x/database.md:336 +#: ./docs/11.x/database.md:349 +#: ./docs/master/database.md:346 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/database.md:280 +#: ./docs/9.x/database.md:336 +#: ./docs/10.x/database.md:337 +#: ./docs/11.x/database.md:350 +#: ./docs/master/database.md:347 +msgid "Handling Deadlocks" +msgstr "" + +# P +#: ./docs/8.x/database.md:282 +#: ./docs/9.x/database.md:338 +#: ./docs/10.x/database.md:339 +#: ./docs/11.x/database.md:352 +#: ./docs/master/database.md:349 +msgid "The `transaction` method accepts an optional second argument which defines the number of times a transaction should be retried when a deadlock occurs. Once these attempts have been exhausted, an exception will be thrown:" +msgstr "" + +# P +#: ./docs/9.x/database.md:283 +#: ./docs/10.x/database.md:288 +#: ./docs/11.x/database.md:301 +#: ./docs/master/database.md:298 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/8.x/database.md:284 +#: ./docs/9.x/database.md:340 +#: ./docs/10.x/database.md:341 +#: ./docs/11.x/database.md:354 +#: ./docs/master/database.md:351 +msgid "use Illuminate\\Support\\Facades\\DB;\n\n" +"DB::transaction(function () {\n" +" DB::update('update users set votes = 1');\n\n" +" DB::delete('delete from posts');\n" +"}, 5);" +msgstr "" + +# H3 +#: ./docs/9.x/database.md:284 +#: ./docs/10.x/database.md:289 +#: ./docs/11.x/database.md:302 +#: ./docs/master/database.md:299 +msgid "Monitoring Cumulative Query Time" +msgstr "" + +# P +#: ./docs/9.x/database.md:286 +#: ./docs/10.x/database.md:291 +#: ./docs/11.x/database.md:304 +#: ./docs/master/database.md:301 +msgid "A common performance bottleneck of modern web applications is the amount of time they spend querying databases. Thankfully, Laravel can invoke a closure or callback of your choice when it spends too much time querying the database during a single request. To get started, provide a query time threshold (in milliseconds) and closure to the `whenQueryingForLongerThan` method. You may invoke this method in the `boot` method of a [service provider](/docs/{{version}}/providers):" +msgstr "" + +# CODE +#: ./docs/9.x/database.md:288 +msgid "" +#~ msgstr "" + +# CODE +#: ./docs/10.x/database.md:293 +#: ./docs/11.x/database.md:306 +#: ./docs/master/database.md:303 +msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/database.md:312 +#: ./docs/9.x/database.md:369 msgid "Connecting To The Database CLI" -msgstr "連線到資料庫 CLI" +msgstr "" -#: docs/10.x/database.md:block 121 (paragraph) +# P +#: ./docs/8.x/database.md:314 +#: ./docs/9.x/database.md:371 +#: ./docs/10.x/database.md:372 +#: ./docs/11.x/database.md:385 +#: ./docs/master/database.md:382 msgid "If you would like to connect to your database's CLI, you may use the `db` Artisan command:" -msgstr "若想連線到資料庫的 CLI,可以使用 `db` Artisan 指令:" +msgstr "" -#: docs/10.x/database.md:block 122 (code) -msgid "php artisan db\n" -msgstr "php artisan db\n" +# CODE +# CODE: shell +#: ./docs/8.x/database.md:316 +#: ./docs/9.x/database.md:373 +#: ./docs/10.x/database.md:374 +#: ./docs/11.x/database.md:387 +#: ./docs/master/database.md:384 +msgid "php artisan db" +msgstr "" -#: docs/10.x/database.md:block 123 (paragraph) +# P +#: ./docs/8.x/database.md:318 +#: ./docs/9.x/database.md:377 +#: ./docs/10.x/database.md:378 +#: ./docs/11.x/database.md:391 +#: ./docs/master/database.md:388 msgid "If needed, you may specify a database connection name to connect to a database connection that is not the default connection:" -msgstr "若有需要,可以指定資料庫連線名稱來連先到非預設連線的資料庫連線:" +msgstr "" -#: docs/10.x/database.md:block 124 (code) -msgid "php artisan db mysql\n" -msgstr "php artisan db mysql\n" +# CODE +# CODE: shell +#: ./docs/8.x/database.md:320 +#: ./docs/9.x/database.md:379 +#: ./docs/10.x/database.md:380 +#: ./docs/11.x/database.md:393 +#: ./docs/master/database.md:390 +msgid "php artisan db mysql" +msgstr "" + +# H2 +#: ./docs/10.x/database.md:370 +#: ./docs/11.x/database.md:383 +#: ./docs/master/database.md:380 +msgid "Connecting to the Database CLI" +msgstr "" -#: docs/10.x/database.md:block 126 (header) +# P +#: ./docs/9.x/database.md:383 +#: ./docs/10.x/database.md:384 +#: ./docs/11.x/database.md:397 +#: ./docs/master/database.md:394 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/database.md:384 +#: ./docs/10.x/database.md:385 +#: ./docs/11.x/database.md:398 +#: ./docs/master/database.md:395 msgid "Inspecting Your Databases" -msgstr "檢視資料庫" +msgstr "" -#: docs/10.x/database.md:block 127 (paragraph) +# P +#: ./docs/9.x/database.md:386 +#: ./docs/10.x/database.md:387 +#: ./docs/11.x/database.md:400 +#: ./docs/master/database.md:397 msgid "Using the `db:show` and `db:table` Artisan commands, you can get valuable insight into your database and its associated tables. To see an overview of your database, including its size, type, number of open connections, and a summary of its tables, you may use the `db:show` command:" -msgstr "使用 `db:show` 與 `db:table` Artisan 指令,即可檢視有關資料庫與其關聯的資料表的各種實用資料。若要檢視資料庫的概覽,如資料庫大小、型別、開啟中的連線數、資料表概覽等,可使用 `db:show` 指令:" +msgstr "" -#: docs/10.x/database.md:block 128 (code) -msgid "php artisan db:show\n" -msgstr "php artisan db:show\n" +# CODE: shell +#: ./docs/9.x/database.md:388 +#: ./docs/10.x/database.md:389 +#: ./docs/11.x/database.md:402 +#: ./docs/master/database.md:399 +msgid "php artisan db:show" +msgstr "" -#: docs/10.x/database.md:block 129 (paragraph) +# P +#: ./docs/9.x/database.md:392 +#: ./docs/10.x/database.md:393 +#: ./docs/11.x/database.md:406 +#: ./docs/master/database.md:403 msgid "You may specify which database connection should be inspected by providing the database connection name to the command via the `--database` option:" -msgstr "也可以提供 `--database` 選項來提供要檢視的資料庫連線名稱:" +msgstr "" -#: docs/10.x/database.md:block 130 (code) -msgid "php artisan db:show --database=pgsql\n" -msgstr "php artisan db:show --database=pgsql\n" +# CODE: shell +#: ./docs/9.x/database.md:394 +#: ./docs/10.x/database.md:395 +#: ./docs/11.x/database.md:408 +#: ./docs/master/database.md:405 +msgid "php artisan db:show --database=pgsql" +msgstr "" -#: docs/10.x/database.md:block 131 (paragraph) +# P +#: ./docs/9.x/database.md:398 +#: ./docs/10.x/database.md:399 +#: ./docs/11.x/database.md:412 +#: ./docs/master/database.md:409 msgid "If you would like to include table row counts and database view details within the output of the command, you may provide the `--counts` and `--views` options, respectively. On large databases, retrieving row counts and view details can be slow:" -msgstr "若要在該指令的輸出中包含資料表的行數統計與資料庫 View 的詳情,可提供 `--counts` 與 `--views`,這兩個指令分別對應了此二功能。在大型資料庫中,取得行數與 View 的詳情可能較慢:" +msgstr "" -#: docs/10.x/database.md:block 132 (code) -msgid "php artisan db:show --counts --views\n" -msgstr "php artisan db:show --counts --views\n" +# CODE: shell +#: ./docs/9.x/database.md:400 +#: ./docs/10.x/database.md:401 +#: ./docs/11.x/database.md:414 +#: ./docs/master/database.md:411 +msgid "php artisan db:show --counts --views" +msgstr "" -#: docs/10.x/database.md:block 134 (header) +# P +#: ./docs/9.x/database.md:404 +#: ./docs/10.x/database.md:405 +#: ./docs/11.x/database.md:432 +#: ./docs/master/database.md:429 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/database.md:405 +#: ./docs/10.x/database.md:406 +#: ./docs/11.x/database.md:433 +#: ./docs/master/database.md:430 msgid "Table Overview" -msgstr "資料表概覽" +msgstr "" -#: docs/10.x/database.md:block 135 (paragraph) +# P +#: ./docs/9.x/database.md:407 +#: ./docs/10.x/database.md:408 +#: ./docs/11.x/database.md:435 +#: ./docs/master/database.md:432 msgid "If you would like to get an overview of an individual table within your database, you may execute the `db:table` Artisan command. This command provides a general overview of a database table, including its columns, types, attributes, keys, and indexes:" -msgstr "若想取得資料庫中個別資料表的概覽,可執行 `db:table` Artisan 指令。該指令會為某個資料庫資料表提供一般性的概覽,包含其欄位、型別、屬性、索引鍵、與索引等:" +msgstr "" -#: docs/10.x/database.md:block 136 (code) -msgid "php artisan db:table users\n" -msgstr "php artisan db:table users\n" +# CODE: shell +#: ./docs/9.x/database.md:409 +#: ./docs/10.x/database.md:410 +#: ./docs/11.x/database.md:437 +#: ./docs/master/database.md:434 +msgid "php artisan db:table users" +msgstr "" -#: docs/10.x/database.md:block 138 (header) +# P +#: ./docs/9.x/database.md:413 +#: ./docs/10.x/database.md:414 +#: ./docs/11.x/database.md:441 +#: ./docs/master/database.md:438 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/database.md:414 +#: ./docs/10.x/database.md:415 +#: ./docs/11.x/database.md:442 +#: ./docs/master/database.md:439 msgid "Monitoring Your Databases" -msgstr "監控資料庫" +msgstr "" -#: docs/10.x/database.md:block 139 (paragraph) +# P +#: ./docs/9.x/database.md:416 +#: ./docs/10.x/database.md:417 +#: ./docs/11.x/database.md:444 +#: ./docs/master/database.md:441 msgid "Using the `db:monitor` Artisan command, you can instruct Laravel to dispatch an `Illuminate\\Database\\Events\\DatabaseBusy` event if your database is managing more than a specified number of open connections." -msgstr "使用 `db:monitor` Artisan 指令,當資料庫中處理了超過特定數量的連線時,Laravel 就會分派一個 `Illuminate\\Database\\Events\\DatabaseBusy` 事件。" +msgstr "" -#: docs/10.x/database.md:block 140 (paragraph) +# P +#: ./docs/11.x/database.md:418 +#: ./docs/master/database.md:415 +msgid "In addition, you may use the following `Schema` methods to inspect your database:" +msgstr "" + +# P +#: ./docs/9.x/database.md:418 +#: ./docs/10.x/database.md:419 +#: ./docs/11.x/database.md:446 +#: ./docs/master/database.md:443 msgid "To get started, you should schedule the `db:monitor` command to [run every minute](/docs/{{version}}/scheduling). The command accepts the names of the database connection configurations that you wish to monitor as well as the maximum number of open connections that should be tolerated before dispatching an event:" -msgstr "若要開始監控資料庫,可設定排程,[每分鐘](/docs/{{version}}/scheduling)都執行一次 `db:monitor` 指令。可傳入要監控的資料庫連線名稱給該指令,或是分派 Event 前可允許的最大開放連線數:" +msgstr "" + +# CODE +#: ./docs/11.x/database.md:420 +#: ./docs/master/database.md:417 +msgid "use Illuminate\\Support\\Facades\\Schema;\n\n" +"$tables = Schema::getTables();\n" +"$views = Schema::getViews();\n" +"$columns = Schema::getColumns('users');\n" +"$indexes = Schema::getIndexes('users');\n" +"$foreignKeys = Schema::getForeignKeys('users');" +msgstr "" -#: docs/10.x/database.md:block 141 (code) -msgid "php artisan db:monitor --databases=mysql,pgsql --max=100\n" -msgstr "php artisan db:monitor --databases=mysql,pgsql --max=100\n" +# CODE: shell +#: ./docs/9.x/database.md:420 +#: ./docs/10.x/database.md:421 +#: ./docs/11.x/database.md:448 +#: ./docs/master/database.md:445 +msgid "php artisan db:monitor --databases=mysql,pgsql --max=100" +msgstr "" -#: docs/10.x/database.md:block 142 (paragraph) +# P +#: ./docs/9.x/database.md:424 +#: ./docs/10.x/database.md:425 msgid "Scheduling this command alone is not enough to trigger a notification alerting you of the number of open connections. When the command encounters a database that has an open connection count that exceeds your threshold, a `DatabaseBusy` event will be dispatched. You should listen for this event within your application's `EventServiceProvider` in order to send a notification to you or your development team:" -msgstr "若只排程執行該指令,檔開放連線數過高時仍然不會觸發通知來提醒你。當該指令偵測到資料庫的開放連線數超過指定的閥值時,會分派一個 `DatabaseBusy` 事件。我們需要在專案的 `EventServiceProvider` 內監聽該事件,才能將通知傳送給你,或是你的開發團隊:" +msgstr "" -#: docs/10.x/database.md:block 143 (code) +# CODE: php +#: ./docs/9.x/database.md:426 msgid "use App\\Notifications\\DatabaseApproachingMaxConnections;\n" "use Illuminate\\Database\\Events\\DatabaseBusy;\n" "use Illuminate\\Support\\Facades\\Event;\n" "use Illuminate\\Support\\Facades\\Notification;\n\n" "/**\n" " * Register any other events for your application.\n" +" *\n" +" * @return void\n" " */\n" -"public function boot(): void\n" +"public function boot()\n" "{\n" " Event::listen(function (DatabaseBusy $event) {\n" " Notification::route('mail', 'dev@example.com')\n" @@ -752,8 +1783,12 @@ msgid "use App\\Notifications\\DatabaseApproachingMaxConnections;\n" " $event->connections\n" " ));\n" " });\n" -"}\n" -msgstr "use App\\Notifications\\DatabaseApproachingMaxConnections;\n" +"}" +msgstr "" + +# CODE: php +#: ./docs/10.x/database.md:427 +msgid "use App\\Notifications\\DatabaseApproachingMaxConnections;\n" "use Illuminate\\Database\\Events\\DatabaseBusy;\n" "use Illuminate\\Support\\Facades\\Event;\n" "use Illuminate\\Support\\Facades\\Notification;\n\n" @@ -769,224 +1804,38 @@ msgstr "use App\\Notifications\\DatabaseApproachingMaxConnections;\n" " $event->connections\n" " ));\n" " });\n" -"}\n" - -#: docs/8.x/database.md:block 7 (unordered list) -msgid "MariaDB 10.2+ ([Version Policy](https://mariadb.org/about/#maintenance-policy))" -msgstr "MariaDB 10.2+ ([版本政策](https://mariadb.org/about/#maintenance-policy))" - -#: docs/8.x/database.md:block 7 (unordered list) -msgid "PostgreSQL 9.6+ ([Version Policy](https://www.postgresql.org/support/versioning/))" -msgstr "PostgreSQL 9.6+ ([版本政策](https://www.postgresql.org/support/versioning/))" - -#: docs/8.x/database.md:block 46 (code) -msgid " $users]);\n" -" }\n" -"}\n" -msgstr " $users]);\n" -" }\n" -"}\n" - -#: docs/8.x/database.md:block 74 (quote) -msgid "{note} Since unprepared statements do not bind parameters, they may be vulnerable to SQL injection. You should never allow user controlled values within an unprepared statement." -msgstr "{note} 由於未預先準備的陳述式並不繫結參數,因此這些查詢可能容易遭受 SQL 注入攻擊。在未預先準備的陳述式中,不應包含使用者可控制的值。" - -#: docs/8.x/database.md:block 83 (code) -msgid "use Illuminate\\Support\\Facades\\DB;\n\n" -"$users = DB::connection('sqlite')->select(...);\n" -msgstr "use Illuminate\\Support\\Facades\\DB;\n\n" -"$users = DB::connection('sqlite')->select(...);\n" - -#: docs/8.x/database.md:block 89 (code) -msgid "sql;\n" -" // $query->bindings;\n" -" // $query->time;\n" -" });\n" -" }\n" -"}\n" -msgstr "sql;\n" -" // $query->bindings;\n" -" // $query->time;\n" -" });\n" -" }\n" -"}\n" - -#: docs/8.x/database.md:block 106 (quote) -msgid "{tip} The `DB` facade's transaction methods control the transactions for both the [query builder](/docs/{{version}}/queries) and [Eloquent ORM](/docs/{{version}}/eloquent)." -msgstr "{tip} `DB` Facade 的 Transaction 方法會同時控制到 [Query Builder](/docs/{{version}}/queries) 與 [Eloquent ORM](/docs/{{version}}/eloquent)。" +"}" +msgstr "" -#: docs/9.x/database.md:block 7 (unordered list) -msgid "MariaDB 10.3+ ([Version Policy](https://mariadb.org/about/#maintenance-policy))" -msgstr "MariaDB 10.3+ ([版本政策](https://mariadb.org/about/#maintenance-policy))" +# P +#: ./docs/11.x/database.md:428 +#: ./docs/master/database.md:425 +msgid "If you would like to inspect a database connection that is not your application's default connection, you may use the `connection` method:" +msgstr "" -#: docs/9.x/database.md:block 7 (unordered list) -msgid "PostgreSQL 10.0+ ([Version Policy](https://www.postgresql.org/support/versioning/))" -msgstr "PostgreSQL 10.0+ ([版本政策](https://www.postgresql.org/support/versioning/))" +# CODE +#: ./docs/11.x/database.md:430 +#: ./docs/master/database.md:427 +msgid "$columns = Schema::connection('sqlite')->getColumns('users');" +msgstr "" -#: docs/9.x/database.md:block 97 (code) -msgid "notify(new DatabaseApproachingMaxConnections(\n" -" $event->connectionName,\n" -" $event->connections\n" -" ));\n" -" });\n" -"}\n" -msgstr "use App\\Notifications\\DatabaseApproachingMaxConnections;\n" -"use Illuminate\\Database\\Events\\DatabaseBusy;\n" -"use Illuminate\\Support\\Facades\\Event;\n" -"use Illuminate\\Support\\Facades\\Notification;\n\n" -"/**\n" -" * Register any other events for your application.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" +"public function boot(): void\n" "{\n" " Event::listen(function (DatabaseBusy $event) {\n" " Notification::route('mail', 'dev@example.com')\n" @@ -995,21 +1844,6 @@ msgstr "use App\\Notifications\\DatabaseApproachingMaxConnections;\n" " $event->connections\n" " ));\n" " });\n" -"}\n" - -#: docs/master/database.md:block 7 (unordered list) -msgid "MariaDB 10.11+ ([Version Policy](https://mariadb.org/about/#maintenance-policy))" -msgstr "MariaDB 10.11+ ([版本政策](https://mariadb.org/about/#maintenance-policy))" - -#: docs/master/database.md:block 7 (unordered list) -msgid "MySQL 8.0+ ([Version Policy](https://en.wikipedia.org/wiki/MySQL#Release_history))" -msgstr "MySQL 8.0+ ([版本政策](https://en.wikipedia.org/wiki/MySQL#Release_history))" - -#: docs/master/database.md:block 7 (unordered list) -msgid "PostgreSQL 12.0+ ([Version Policy](https://www.postgresql.org/support/versioning/))" -msgstr "PostgreSQL 12.0+ ([版本政策](https://www.postgresql.org/support/versioning/))" - -#: docs/master/database.md:block 7 (unordered list) -msgid "SQLite 3.35.0+" -msgstr "SQLite 3.35.0+" +"}" +msgstr "" diff --git a/po/zh_TW/deployment.po b/po/zh_TW/deployment.po index 1b72b2905..3257b6b38 100644 --- a/po/zh_TW/deployment.po +++ b/po/zh_TW/deployment.po @@ -10,149 +10,405 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:18\n" - -#: docs/10.x/deployment.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H1 +#: ./docs/8.x/deployment.md:1 +#: ./docs/9.x/deployment.md:1 +#: ./docs/10.x/deployment.md:1 +#: ./docs/11.x/deployment.md:1 +#: ./docs/master/deployment.md:1 msgid "Deployment" -msgstr "部署" +msgstr "" -#: docs/10.x/deployment.md:block 2 (unordered list) +# P +#: ./docs/8.x/deployment.md:3 +#: ./docs/9.x/deployment.md:3 +#: ./docs/10.x/deployment.md:3 +#: ./docs/11.x/deployment.md:3 +#: ./docs/master/deployment.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/deployment.md:block 2 (unordered list) +# P +#: ./docs/8.x/deployment.md:4 +#: ./docs/9.x/deployment.md:4 +#: ./docs/10.x/deployment.md:4 +#: ./docs/11.x/deployment.md:4 +#: ./docs/master/deployment.md:4 msgid "[Server Requirements](#server-requirements)" -msgstr "[伺服器需求](#server-requirements)" +msgstr "" -#: docs/10.x/deployment.md:block 2 (unordered list) +# P +#: ./docs/8.x/deployment.md:5 +#: ./docs/9.x/deployment.md:5 +#: ./docs/10.x/deployment.md:5 +#: ./docs/11.x/deployment.md:5 +#: ./docs/master/deployment.md:5 msgid "[Server Configuration](#server-configuration)" -msgstr "[伺服器設定](#server-configuration)" +msgstr "" -#: docs/10.x/deployment.md:block 2 (unordered list) +# P +#: ./docs/8.x/deployment.md:6 +#: ./docs/9.x/deployment.md:6 +#: ./docs/10.x/deployment.md:6 +#: ./docs/11.x/deployment.md:6 +#: ./docs/master/deployment.md:6 msgid "[Nginx](#nginx)" -msgstr "[Nginx](#nginx)" +msgstr "" -#: docs/10.x/deployment.md:block 2 (unordered list) +# P +#: ./docs/11.x/deployment.md:7 +msgid "[FrankenPHP](#frankenphp)" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:7 +#: ./docs/9.x/deployment.md:7 +#: ./docs/10.x/deployment.md:7 +#: ./docs/11.x/deployment.md:9 +#: ./docs/master/deployment.md:7 msgid "[Optimization](#optimization)" -msgstr "[最佳化](#optimization)" +msgstr "" + +# P +#: ./docs/11.x/deployment.md:8 +msgid "[Directory Permissions](#directory-permissions)" +msgstr "" -#: docs/10.x/deployment.md:block 2 (unordered list) +# P +#: ./docs/8.x/deployment.md:8 +#: ./docs/9.x/deployment.md:8 +#: ./docs/10.x/deployment.md:8 msgid "[Autoloader Optimization](#autoloader-optimization)" -msgstr "[Autoloader 的最佳化](#autoloader-optimization)" +msgstr "" -#: docs/10.x/deployment.md:block 2 (unordered list) +# P +#: ./docs/10.x/deployment.md:9 +#: ./docs/11.x/deployment.md:10 +#: ./docs/master/deployment.md:8 msgid "[Caching Configuration](#optimizing-configuration-loading)" -msgstr "[快取設定檔](#optimizing-configuration-loading)" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:9 +#: ./docs/9.x/deployment.md:9 +msgid "[Optimizing Configuration Loading](#optimizing-configuration-loading)" +msgstr "" -#: docs/10.x/deployment.md:block 2 (unordered list) +# P +#: ./docs/10.x/deployment.md:10 +#: ./docs/11.x/deployment.md:11 +#: ./docs/master/deployment.md:9 msgid "[Caching Events](#caching-events)" -msgstr "[快取 Event](#caching-events)" +msgstr "" -#: docs/10.x/deployment.md:block 2 (unordered list) +# P +#: ./docs/8.x/deployment.md:10 +#: ./docs/9.x/deployment.md:10 +msgid "[Optimizing Route Loading](#optimizing-route-loading)" +msgstr "" + +# P +#: ./docs/10.x/deployment.md:11 +#: ./docs/11.x/deployment.md:12 +#: ./docs/master/deployment.md:10 msgid "[Caching Routes](#optimizing-route-loading)" -msgstr "[快取 Route](#optimizing-route-loading)" +msgstr "" -#: docs/10.x/deployment.md:block 2 (unordered list) +# P +#: ./docs/8.x/deployment.md:11 +#: ./docs/9.x/deployment.md:11 +msgid "[Optimizing View Loading](#optimizing-view-loading)" +msgstr "" + +# P +#: ./docs/10.x/deployment.md:12 +#: ./docs/11.x/deployment.md:13 +#: ./docs/master/deployment.md:11 msgid "[Caching Views](#optimizing-view-loading)" -msgstr "[快取 View](#optimizing-view-loading)" +msgstr "" -#: docs/10.x/deployment.md:block 2 (unordered list) +# P +#: ./docs/8.x/deployment.md:12 +#: ./docs/9.x/deployment.md:12 +#: ./docs/10.x/deployment.md:13 +#: ./docs/11.x/deployment.md:14 +#: ./docs/master/deployment.md:12 msgid "[Debug Mode](#debug-mode)" -msgstr "[偵錯模式](#debug-mode)" +msgstr "" -#: docs/10.x/deployment.md:block 2 (unordered list) +# P +#: ./docs/8.x/deployment.md:13 +#: ./docs/9.x/deployment.md:13 +msgid "[Deploying With Forge / Vapor](#deploying-with-forge-or-vapor)" +msgstr "" + +# P +#: ./docs/10.x/deployment.md:14 +#: ./docs/11.x/deployment.md:16 +#: ./docs/master/deployment.md:14 msgid "[Easy Deployment With Forge / Vapor](#deploying-with-forge-or-vapor)" -msgstr "[使用 Forge 或 Vapor 來輕鬆部署](#deploying-with-forge-or-vapor)" +msgstr "" + +# P +#: ./docs/11.x/deployment.md:15 +#: ./docs/master/deployment.md:13 +msgid "[The Health Route](#the-health-route)" +msgstr "" -#: docs/10.x/deployment.md:block 4 (header) +# P +#: ./docs/8.x/deployment.md:15 +#: ./docs/9.x/deployment.md:15 +#: ./docs/10.x/deployment.md:16 +#: ./docs/11.x/deployment.md:18 +#: ./docs/master/deployment.md:16 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/deployment.md:16 +#: ./docs/9.x/deployment.md:16 +#: ./docs/10.x/deployment.md:17 +#: ./docs/11.x/deployment.md:19 +#: ./docs/master/deployment.md:17 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/deployment.md:block 5 (paragraph) +# P +#: ./docs/8.x/deployment.md:18 +#: ./docs/9.x/deployment.md:18 +#: ./docs/10.x/deployment.md:19 +#: ./docs/11.x/deployment.md:21 +#: ./docs/master/deployment.md:19 msgid "When you're ready to deploy your Laravel application to production, there are some important things you can do to make sure your application is running as efficiently as possible. In this document, we'll cover some great starting points for making sure your Laravel application is deployed properly." -msgstr "準備好將 Laravel 專案部署到正式環境時,還有一些影響網站效能的重點要注意。在本文中,我們會討論一些正確部署 Laravel 專案的要點。" +msgstr "" -#: docs/10.x/deployment.md:block 7 (header) +# P +#: ./docs/8.x/deployment.md:20 +#: ./docs/9.x/deployment.md:20 +#: ./docs/10.x/deployment.md:21 +#: ./docs/11.x/deployment.md:23 +#: ./docs/master/deployment.md:21 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/deployment.md:21 +#: ./docs/9.x/deployment.md:21 +#: ./docs/10.x/deployment.md:22 +#: ./docs/11.x/deployment.md:24 +#: ./docs/master/deployment.md:22 msgid "Server Requirements" -msgstr "伺服器需求" +msgstr "" -#: docs/10.x/deployment.md:block 8 (paragraph) +# P +#: ./docs/8.x/deployment.md:23 +#: ./docs/9.x/deployment.md:23 +#: ./docs/10.x/deployment.md:24 +#: ./docs/11.x/deployment.md:26 +#: ./docs/master/deployment.md:24 msgid "The Laravel framework has a few system requirements. You should ensure that your web server has the following minimum PHP version and extensions:" -msgstr "Laravel Framework 有一些系統需求。請確保網頁伺服器有達到下列最小 PHP 版本需求與擴充套件需求:" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:27 +msgid "PHP >= 7.3" +msgstr "" + +# P +#: ./docs/9.x/deployment.md:27 +msgid "PHP >= 8.0" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) +# P +#: ./docs/10.x/deployment.md:28 msgid "PHP >= 8.1" -msgstr "PHP >= 8.1" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:28 +msgid "BCMath PHP Extension" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) +# P +#: ./docs/8.x/deployment.md:29 +#: ./docs/9.x/deployment.md:28 +#: ./docs/10.x/deployment.md:29 +#: ./docs/11.x/deployment.md:31 +#: ./docs/master/deployment.md:29 msgid "Ctype PHP Extension" -msgstr "Ctype PHP 擴充套件" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) +# P +#: ./docs/9.x/deployment.md:29 +#: ./docs/10.x/deployment.md:30 +#: ./docs/11.x/deployment.md:32 +#: ./docs/master/deployment.md:30 msgid "cURL PHP Extension" -msgstr "cURL PHP 擴充套件" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) -msgid "DOM PHP Extension" -msgstr "DOM PHP Extension" +# P +#: ./docs/11.x/deployment.md:30 +#: ./docs/master/deployment.md:28 +msgid "PHP >= 8.2" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) +# P +#: ./docs/8.x/deployment.md:30 +#: ./docs/9.x/deployment.md:31 +#: ./docs/10.x/deployment.md:32 +#: ./docs/11.x/deployment.md:34 +#: ./docs/master/deployment.md:32 msgid "Fileinfo PHP Extension" -msgstr "Fileinfo PHP 擴充套件" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) -msgid "Filter PHP Extension" -msgstr "Filter PHP 擴充套件" +# P +#: ./docs/9.x/deployment.md:30 +#: ./docs/10.x/deployment.md:31 +#: ./docs/11.x/deployment.md:33 +#: ./docs/master/deployment.md:31 +msgid "DOM PHP Extension" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) -msgid "Hash PHP Extension" -msgstr "Hash PHP 擴充套件" +# P +#: ./docs/8.x/deployment.md:31 +msgid "JSON PHP Extension" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) +# P +#: ./docs/8.x/deployment.md:32 +#: ./docs/9.x/deployment.md:34 +#: ./docs/10.x/deployment.md:35 +#: ./docs/11.x/deployment.md:37 +#: ./docs/master/deployment.md:35 msgid "Mbstring PHP Extension" -msgstr "Mbstring PHP 擴充套件" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) +# P +#: ./docs/9.x/deployment.md:32 +#: ./docs/10.x/deployment.md:33 +#: ./docs/11.x/deployment.md:35 +#: ./docs/master/deployment.md:33 +msgid "Filter PHP Extension" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:33 +#: ./docs/9.x/deployment.md:35 +#: ./docs/10.x/deployment.md:36 +#: ./docs/11.x/deployment.md:38 +#: ./docs/master/deployment.md:36 msgid "OpenSSL PHP Extension" -msgstr "OpenSSL PHP 擴充套件" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) -msgid "PCRE PHP Extension" -msgstr "PCRE PHP Extension" +# P +#: ./docs/9.x/deployment.md:33 +#: ./docs/10.x/deployment.md:34 +#: ./docs/11.x/deployment.md:36 +#: ./docs/master/deployment.md:34 +msgid "Hash PHP Extension" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) +# P +#: ./docs/8.x/deployment.md:34 +#: ./docs/9.x/deployment.md:37 +#: ./docs/10.x/deployment.md:38 +#: ./docs/11.x/deployment.md:40 +#: ./docs/master/deployment.md:38 msgid "PDO PHP Extension" -msgstr "PDO PHP 擴充套件" - -#: docs/10.x/deployment.md:block 10 (unordered list) -msgid "Session PHP Extension" -msgstr "Session PHP 擴充套件" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) +# P +#: ./docs/8.x/deployment.md:35 +#: ./docs/9.x/deployment.md:39 +#: ./docs/10.x/deployment.md:40 +#: ./docs/11.x/deployment.md:42 +#: ./docs/master/deployment.md:40 msgid "Tokenizer PHP Extension" -msgstr "Tokenizer PHP 擴充套件" +msgstr "" -#: docs/10.x/deployment.md:block 10 (unordered list) +# P +#: ./docs/8.x/deployment.md:36 +#: ./docs/9.x/deployment.md:40 +#: ./docs/10.x/deployment.md:41 +#: ./docs/11.x/deployment.md:43 +#: ./docs/master/deployment.md:41 msgid "XML PHP Extension" -msgstr "XML PHP 擴充套件" +msgstr "" -#: docs/10.x/deployment.md:block 13 (header) +# P +#: ./docs/9.x/deployment.md:36 +#: ./docs/10.x/deployment.md:37 +#: ./docs/11.x/deployment.md:39 +#: ./docs/master/deployment.md:37 +msgid "PCRE PHP Extension" +msgstr "" + +# P +#: ./docs/9.x/deployment.md:38 +#: ./docs/10.x/deployment.md:39 +#: ./docs/11.x/deployment.md:41 +#: ./docs/master/deployment.md:39 +msgid "Session PHP Extension" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:40 +#: ./docs/9.x/deployment.md:44 +#: ./docs/10.x/deployment.md:45 +#: ./docs/11.x/deployment.md:47 +#: ./docs/master/deployment.md:45 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/deployment.md:41 +#: ./docs/9.x/deployment.md:45 +#: ./docs/10.x/deployment.md:46 +#: ./docs/11.x/deployment.md:48 +#: ./docs/master/deployment.md:46 msgid "Server Configuration" -msgstr "伺服器設定" +msgstr "" -#: docs/10.x/deployment.md:block 15 (header) +# P +#: ./docs/8.x/deployment.md:43 +#: ./docs/9.x/deployment.md:47 +#: ./docs/10.x/deployment.md:48 +#: ./docs/11.x/deployment.md:50 +#: ./docs/master/deployment.md:48 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/deployment.md:44 +#: ./docs/9.x/deployment.md:48 +#: ./docs/10.x/deployment.md:49 +#: ./docs/11.x/deployment.md:51 +#: ./docs/master/deployment.md:49 msgid "Nginx" -msgstr "Nginx" +msgstr "" -#: docs/10.x/deployment.md:block 16 (paragraph) +# P +#: ./docs/8.x/deployment.md:46 +#: ./docs/9.x/deployment.md:50 +#: ./docs/10.x/deployment.md:51 +#: ./docs/11.x/deployment.md:53 +#: ./docs/master/deployment.md:51 msgid "If you are deploying your application to a server that is running Nginx, you may use the following configuration file as a starting point for configuring your web server. Most likely, this file will need to be customized depending on your server's configuration. **If you would like assistance in managing your server, consider using a first-party Laravel server management and deployment service such as [Laravel Forge](https://forge.laravel.com).**" -msgstr "若將專案部署到執行 Nginx 的伺服器上,則應使用下列設定檔來開始設定網頁伺服器。當然,還需要根據伺服器來調整該檔案中的設定。**若需要協助管理伺服器,請參考使用 Laravel 官方的伺服器管理與部署服務,如 [Laravel Forge](https://forge.laravel.com)。**" +msgstr "" -#: docs/10.x/deployment.md:block 17 (paragraph) +# P +#: ./docs/8.x/deployment.md:48 +#: ./docs/9.x/deployment.md:52 +#: ./docs/10.x/deployment.md:53 +#: ./docs/11.x/deployment.md:55 +#: ./docs/master/deployment.md:53 msgid "Please ensure, like the configuration below, your web server directs all requests to your application's `public/index.php` file. You should never attempt to move the `index.php` file to your project's root, as serving the application from the project root will expose many sensitive configuration files to the public Internet:" -msgstr "像下列設定檔一樣,請確保網頁伺服器有將所有連入網站的請求重新導向到 `public/index.php` 檔案上。請絕對不要嘗試將 `index.php` 檔案移到專案根目錄上,因為以專案根目錄來開放網站可能導致一些機敏設定檔被暴露到公開的網際網路上:" +msgstr "" -#: docs/10.x/deployment.md:block 18 (code) +# CODE +#: ./docs/8.x/deployment.md:50 msgid "server {\n" " listen 80;\n" " listen [::]:80;\n" @@ -169,15 +425,19 @@ msgid "server {\n" " location = /robots.txt { access_log off; log_not_found off; }\n\n" " error_page 404 /index.php;\n\n" " location ~ \\.php$ {\n" -" fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;\n" +" fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;\n" " fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;\n" " include fastcgi_params;\n" " }\n\n" " location ~ /\\.(?!well-known).* {\n" " deny all;\n" " }\n" -"}\n" -msgstr "server {\n" +"}" +msgstr "" + +# CODE: nginx +#: ./docs/9.x/deployment.md:54 +msgid "server {\n" " listen 80;\n" " listen [::]:80;\n" " server_name example.com;\n" @@ -193,168 +453,19 @@ msgstr "server {\n" " location = /robots.txt { access_log off; log_not_found off; }\n\n" " error_page 404 /index.php;\n\n" " location ~ \\.php$ {\n" -" fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;\n" +" fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;\n" " fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;\n" " include fastcgi_params;\n" " }\n\n" " location ~ /\\.(?!well-known).* {\n" " deny all;\n" " }\n" -"}\n" - -#: docs/10.x/deployment.md:block 20 (header) -msgid "Optimization" -msgstr "最佳化" - -#: docs/10.x/deployment.md:block 22 (header) -msgid "Autoloader Optimization" -msgstr "Autoloader 最佳化" - -#: docs/10.x/deployment.md:block 23 (paragraph) -msgid "When deploying to production, make sure that you are optimizing Composer's class autoloader map so Composer can quickly find the proper file to load for a given class:" -msgstr "部署到正式環境時,請確定有最佳化 Composer 的類別 Autoloader 映射,以讓 Composer 可快速找到某個類別對應的檔案:" - -#: docs/10.x/deployment.md:block 24 (code) -msgid "composer install --optimize-autoloader --no-dev\n" -msgstr "composer install --optimize-autoloader --no-dev\n" - -#: docs/10.x/deployment.md:block 25 (quote) -msgid "**Note** In addition to optimizing the autoloader, you should always be sure to include a `composer.lock` file in your project's source control repository. Your project's dependencies can be installed much faster when a `composer.lock` file is present." -msgstr "**Note** 除了最佳化 Autoloader 外,也應確保有將 `composer.lock` 檔案加到專案的版本控制儲存庫內。當有 `composer.lock` 檔時,專案的相依性套件可以安裝得更快。" - -#: docs/10.x/deployment.md:block 27 (header) -msgid "Caching Configuration" -msgstr "快取設定檔" - -#: docs/10.x/deployment.md:block 28 (paragraph) -msgid "When deploying your application to production, you should make sure that you run the `config:cache` Artisan command during your deployment process:" -msgstr "在將專案部署到正式環境時,請確保部署流程中有執行 `config:cache` Artisan 指令:" - -#: docs/10.x/deployment.md:block 29 (code) -msgid "php artisan config:cache\n" -msgstr "php artisan config:cache\n" - -#: docs/10.x/deployment.md:block 30 (paragraph) -msgid "This command will combine all of Laravel's configuration files into a single, cached file, which greatly reduces the number of trips the framework must make to the filesystem when loading your configuration values." -msgstr "該指令會將所有的 Laravel 設定檔合併為單一、經過快取的檔案。使用快取檔通常可以減少一些框架在載入設定值時讀取檔案系統的次數。" - -#: docs/10.x/deployment.md:block 31 (quote) -msgid "**Warning** If you execute the `config:cache` command during your deployment process, you should be sure that you are only calling the `env` function from within your configuration files. Once the configuration has been cached, the `.env` file will not be loaded and all calls to the `env` function for `.env` variables will return `null`." -msgstr "**Warning** 若在部署流程中執行了 `config:cache` 指令,應確保只有在設定檔中呼叫 `env` 函式。設定檔被快取後,就不會再載入 `.env` 檔了。所有 `env` 函式查詢 `.env` 變數的呼叫都會回傳 `null`。" - -#: docs/10.x/deployment.md:block 33 (header) -msgid "Caching Events" -msgstr "快取 Event" - -#: docs/10.x/deployment.md:block 34 (paragraph) -msgid "If your application is utilizing [event discovery](/docs/{{version}}/events#event-discovery), you should cache your application's event to listener mappings during your deployment process. This can be accomplished by invoking the `event:cache` Artisan command during deployment:" -msgstr "若你的專案使用 [Event Discovery](/docs/{{version}}/events#event-discovery),則應在部署流程中快取專案的 Event 與 Listener 的映射。只要在部署時呼叫 `event:cache` Artisan 指令即可快取 Event:" - -#: docs/10.x/deployment.md:block 35 (code) -msgid "php artisan event:cache\n" -msgstr "php artisan event:cache\n" - -#: docs/10.x/deployment.md:block 37 (header) -msgid "Caching Routes" -msgstr "快取 Route" - -#: docs/10.x/deployment.md:block 38 (paragraph) -msgid "If you are building a large application with many routes, you should make sure that you are running the `route:cache` Artisan command during your deployment process:" -msgstr "若正在建立有許多路由的大型專案,請確保在部署過程中有執行 `route:cache` Artisan 指令:" - -#: docs/10.x/deployment.md:block 39 (code) -msgid "php artisan route:cache\n" -msgstr "php artisan route:cache\n" - -#: docs/10.x/deployment.md:block 40 (paragraph) -msgid "This command reduces all of your route registrations into a single method call within a cached file, improving the performance of route registration when registering hundreds of routes." -msgstr "該指令可將所有的路由註冊減少為快取檔案內的單一方法呼叫,在註冊上百個路由時,可藉此提升路由註冊的效能。" - -#: docs/10.x/deployment.md:block 42 (header) -msgid "Caching Views" -msgstr "快取 View" - -#: docs/10.x/deployment.md:block 43 (paragraph) -msgid "When deploying your application to production, you should make sure that you run the `view:cache` Artisan command during your deployment process:" -msgstr "在將專案部署到正式環境時,請確保有在部署流程內執行 `view:cache` Artisan 指令:" - -#: docs/10.x/deployment.md:block 44 (code) -msgid "php artisan view:cache\n" -msgstr "php artisan view:cache\n" - -#: docs/10.x/deployment.md:block 45 (paragraph) -msgid "This command precompiles all your Blade views so they are not compiled on demand, improving the performance of each request that returns a view." -msgstr "該指令會預先編譯所有的 Blade View,這樣一來這些 View 就不會只在有需要的時候才進行編譯,可藉此提升每個有回傳 View 的請求效能。" - -#: docs/10.x/deployment.md:block 47 (header) -msgid "Debug Mode" -msgstr "偵錯模式" - -#: docs/10.x/deployment.md:block 48 (paragraph) -msgid "The debug option in your config/app.php configuration file determines how much information about an error is actually displayed to the user. By default, this option is set to respect the value of the `APP_DEBUG` environment variable, which is stored in your application's `.env` file." -msgstr "config/app.php 設定檔中的 debug 選項用來判斷錯誤在實際顯示給使用者時要包含多少資訊。預設情況下,這個選項被設為依照 `APP_DEBUG` 環境變數值,該環境變數儲存於專案的 `.env` 檔內。" - -#: docs/10.x/deployment.md:block 49 (quote) -msgid "**Warning** **In your production environment, this value should always be `false`. If the `APP_DEBUG` variable is set to `true` in production, you risk exposing sensitive configuration values to your application's end users.**" -msgstr "**Warning** **在正式環境上,這個值一定要是 `false`。若在正式環境上將 `APP_DEBUG` 變數設為 `true`,則會有將機敏設定值暴露給應用程式終端使用者的風險。**" - -#: docs/10.x/deployment.md:block 51 (header) -msgid "Easy Deployment With Forge / Vapor" -msgstr "使用 Forge 或 Vapor 來輕鬆部署" - -#: docs/10.x/deployment.md:block 53 (header) -msgid "Laravel Forge" -msgstr "Laravel Forge" - -#: docs/10.x/deployment.md:block 54 (paragraph) -msgid "If you aren't quite ready to manage your own server configuration or aren't comfortable configuring all of the various services needed to run a robust Laravel application, [Laravel Forge](https://forge.laravel.com) is a wonderful alternative." -msgstr "若你還未準備好自行管理伺服器設定,或不擅長設定各種執行大型 Laravel 專案所需要的設定,則 [Laravel Forge](https://forge.laravel.com) 是一個不錯的選擇。" - -#: docs/10.x/deployment.md:block 55 (paragraph) -msgid "Laravel Forge can create servers on various infrastructure providers such as DigitalOcean, Linode, AWS, and more. In addition, Forge installs and manages all of the tools needed to build robust Laravel applications, such as Nginx, MySQL, Redis, Memcached, Beanstalk, and more." -msgstr "Laravel Forge 可以在如 DigitalOcean, Linode, AWS… 等各種基礎建設提供商上建立伺服器。此外,Forge 還可以負責安裝並管理各種執行大型 Laravel 專案所需的工具,如 Nginx, MySQL, Redis, Memcached, Beanstalk… 等。" - -#: docs/10.x/deployment.md:block 56 (quote) -msgid "**Note** Want a full guide to deploying with Laravel Forge? Check out the [Laravel Bootcamp](https://bootcamp.laravel.com/deploying) and the Forge [video series available on Laracasts](https://laracasts.com/series/learn-laravel-forge-2022-edition)." -msgstr "**Note** 需要一篇使用 Laravel Forge 來部署網站的完整教學嗎?請參考 [Laravel Bootcamp (英語)](https://bootcamp.laravel.com/deploying) 以及 [Laracasts 上的 Forge 影片系列 (英語)](https://laracasts.com/series/learn-laravel-forge-2022-edition)。" - -#: docs/10.x/deployment.md:block 58 (header) -msgid "Laravel Vapor" -msgstr "Laravel Vapor" - -#: docs/10.x/deployment.md:block 59 (paragraph) -msgid "If you would like a totally serverless, auto-scaling deployment platform tuned for Laravel, check out [Laravel Vapor](https://vapor.laravel.com). Laravel Vapor is a serverless deployment platform for Laravel, powered by AWS. Launch your Laravel infrastructure on Vapor and fall in love with the scalable simplicity of serverless. Laravel Vapor is fine-tuned by Laravel's creators to work seamlessly with the framework so you can keep writing your Laravel applications exactly like you're used to." -msgstr "若想試試完全為 Laravel 最佳化、Auto-Scaling 的 Serverless 部署平台,請參考看看 [Laravel Vapor](https://vapor.laravel.com)。Laravel Vapor 是一個為 Laravel 設計的 Serverless 部署平台,由 AWS 驅動。使用 Vapor 來發佈你的 Laravel 基礎建設,你會愛上 Serverless 這種能簡單擴充的架構。Laravel Vapor 已由 Laravel 的作者們精心最佳化,以讓 Vapor 能完美配合 Laravel 使用,並讓你能像往常在 Laravel 專案開發就好。" - -#: docs/8.x/deployment.md:block 2 (unordered list) -msgid "[Optimizing Configuration Loading](#optimizing-configuration-loading)" -msgstr "[最佳化設定檔的載入](#optimizing-configuration-loading)" - -#: docs/8.x/deployment.md:block 2 (unordered list) -msgid "[Optimizing Route Loading](#optimizing-route-loading)" -msgstr "[最佳化 Route 的載入](#optimizing-route-loading)" - -#: docs/8.x/deployment.md:block 2 (unordered list) -msgid "[Optimizing View Loading](#optimizing-view-loading)" -msgstr "[最佳化 View 的載入](#optimizing-view-loading)" - -#: docs/8.x/deployment.md:block 2 (unordered list) -msgid "[Deploying With Forge / Vapor](#deploying-with-forge-or-vapor)" -msgstr "[使用 Forge 或 Vapor 部署](#deploying-with-forge-or-vapor)" - -#: docs/8.x/deployment.md:block 10 (unordered list) -msgid "PHP >= 7.3" -msgstr "PHP >= 7.3" - -#: docs/8.x/deployment.md:block 10 (unordered list) -msgid "BCMath PHP Extension" -msgstr "BCMath PHP 擴充套件" - -#: docs/8.x/deployment.md:block 10 (unordered list) -msgid "JSON PHP Extension" -msgstr "JSON PHP 擴充套件" +"}" +msgstr "" -#: docs/8.x/deployment.md:block 18 (code) +# CODE: nginx +#: ./docs/10.x/deployment.md:55 +#: ./docs/master/deployment.md:55 msgid "server {\n" " listen 80;\n" " listen [::]:80;\n" @@ -371,15 +482,19 @@ msgid "server {\n" " location = /robots.txt { access_log off; log_not_found off; }\n\n" " error_page 404 /index.php;\n\n" " location ~ \\.php$ {\n" -" fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;\n" +" fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;\n" " fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;\n" " include fastcgi_params;\n" " }\n\n" " location ~ /\\.(?!well-known).* {\n" " deny all;\n" " }\n" -"}\n" -msgstr "server {\n" +"}" +msgstr "" + +# CODE: nginx +#: ./docs/11.x/deployment.md:57 +msgid "server {\n" " listen 80;\n" " listen [::]:80;\n" " server_name example.com;\n" @@ -395,98 +510,511 @@ msgstr "server {\n" " location = /robots.txt { access_log off; log_not_found off; }\n\n" " error_page 404 /index.php;\n\n" " location ~ \\.php$ {\n" -" fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;\n" +" fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;\n" " fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;\n" " include fastcgi_params;\n" +" fastcgi_hide_header X-Powered-By;\n" " }\n\n" " location ~ /\\.(?!well-known).* {\n" " deny all;\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/8.x/deployment.md:block 25 (quote) -msgid "{tip} In addition to optimizing the autoloader, you should always be sure to include a `composer.lock` file in your project's source control repository. Your project's dependencies can be installed much faster when a `composer.lock` file is present." -msgstr "{tip} 除了最佳化 Autoloader 外,也應確保有將 `composer.lock` 檔案加到專案的版本控制儲存庫內。當有 `composer.lock` 檔時,專案的相依性套件可以安裝得更快。" +# P +#: ./docs/8.x/deployment.md:83 +#: ./docs/9.x/deployment.md:89 +#: ./docs/10.x/deployment.md:90 +#: ./docs/11.x/deployment.md:109 +#: ./docs/master/deployment.md:90 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/deployment.md:84 +#: ./docs/9.x/deployment.md:90 +#: ./docs/10.x/deployment.md:91 +#: ./docs/11.x/deployment.md:110 +#: ./docs/master/deployment.md:91 +msgid "Optimization" +msgstr "" -#: docs/8.x/deployment.md:block 27 (header) +# P +#: ./docs/8.x/deployment.md:86 +#: ./docs/9.x/deployment.md:92 +#: ./docs/10.x/deployment.md:93 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/deployment.md:87 +#: ./docs/9.x/deployment.md:93 +#: ./docs/10.x/deployment.md:94 +msgid "Autoloader Optimization" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:89 +#: ./docs/9.x/deployment.md:95 +#: ./docs/10.x/deployment.md:96 +msgid "When deploying to production, make sure that you are optimizing Composer's class autoloader map so Composer can quickly find the proper file to load for a given class:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/deployment.md:91 +#: ./docs/9.x/deployment.md:97 +#: ./docs/10.x/deployment.md:98 +msgid "composer install --optimize-autoloader --no-dev" +msgstr "" + +# P +#: ./docs/11.x/deployment.md:93 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/deployment.md:93 +#: ./docs/9.x/deployment.md:102 +#: ./docs/10.x/deployment.md:103 +msgid "In addition to optimizing the autoloader, you should always be sure to include a `composer.lock` file in your project's source control repository. Your project's dependencies can be installed much faster when a `composer.lock` file is present." +msgstr "" + +# H3 +#: ./docs/11.x/deployment.md:94 +msgid "FrankenPHP" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:95 +#: ./docs/9.x/deployment.md:104 +#: ./docs/10.x/deployment.md:105 +#: ./docs/11.x/deployment.md:126 +#: ./docs/master/deployment.md:107 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/11.x/deployment.md:96 +msgid "[FrankenPHP](https://frankenphp.dev/) may also be used to serve your Laravel applications. FrankenPHP is a modern PHP application server written in Go. To serve a Laravel PHP application using FrankenPHP, you may simply invoke its `php-server` command:" +msgstr "" + +# H3 +#: ./docs/8.x/deployment.md:96 +#: ./docs/9.x/deployment.md:105 msgid "Optimizing Configuration Loading" -msgstr "最佳化設定檔的載入" +msgstr "" + +# CODE: shell +#: ./docs/11.x/deployment.md:98 +msgid "frankenphp php-server -r public/" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:98 +#: ./docs/9.x/deployment.md:107 +#: ./docs/10.x/deployment.md:108 +#: ./docs/11.x/deployment.md:129 +#: ./docs/master/deployment.md:110 +msgid "When deploying your application to production, you should make sure that you run the `config:cache` Artisan command during your deployment process:" +msgstr "" + +# P +#: ./docs/master/deployment.md:99 +msgid "The `optimize:clear` method may be used to remove all of the cache files generated by the `optimize` command:" +msgstr "" -#: docs/8.x/deployment.md:block 31 (quote) -msgid "{note} If you execute the `config:cache` command during your deployment process, you should be sure that you are only calling the `env` function from within your configuration files. Once the configuration has been cached, the `.env` file will not be loaded and all calls to the `env` function for `.env` variables will return `null`." -msgstr "{note} 若在部署流程中執行了 `config:cache` 指令,應確保只有在設定檔中呼叫 `env` 函式。設定檔被快取後,就不會再載入 `.env` 檔了。所有 `env` 函式查詢 `.env` 變數的呼叫都會回傳 `null`。" +# CODE +# CODE: shell +#: ./docs/8.x/deployment.md:100 +#: ./docs/9.x/deployment.md:109 +#: ./docs/10.x/deployment.md:110 +#: ./docs/11.x/deployment.md:131 +#: ./docs/master/deployment.md:112 +msgid "php artisan config:cache" +msgstr "" + +# P +#: ./docs/11.x/deployment.md:102 +msgid "To take advantage of more powerful features supported by FrankenPHP, such as its [Laravel Octane](/docs/{{version}}/octane) integration, HTTP/3, modern compression, or the ability to package Laravel applications as standalone binaries, please consult FrankenPHP's [Laravel documentation](https://frankenphp.dev/docs/laravel/)." +msgstr "" + +# P +#: ./docs/8.x/deployment.md:102 +#: ./docs/9.x/deployment.md:113 +#: ./docs/10.x/deployment.md:114 +#: ./docs/11.x/deployment.md:135 +#: ./docs/master/deployment.md:116 +msgid "This command will combine all of Laravel's configuration files into a single, cached file, which greatly reduces the number of trips the framework must make to the filesystem when loading your configuration values." +msgstr "" -#: docs/8.x/deployment.md:block 33 (header) +# P +#: ./docs/11.x/deployment.md:104 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/deployment.md:104 +#: ./docs/9.x/deployment.md:116 +#: ./docs/10.x/deployment.md:117 +#: ./docs/11.x/deployment.md:138 +#: ./docs/master/deployment.md:119 +msgid "If you execute the `config:cache` command during your deployment process, you should be sure that you are only calling the `env` function from within your configuration files. Once the configuration has been cached, the `.env` file will not be loaded and all calls to the `env` function for `.env` variables will return `null`." +msgstr "" + +# H3 +#: ./docs/11.x/deployment.md:105 +msgid "Directory Permissions" +msgstr "" + +# H3 +#: ./docs/10.x/deployment.md:106 +#: ./docs/11.x/deployment.md:127 +#: ./docs/master/deployment.md:108 +msgid "Caching Configuration" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:106 +#: ./docs/9.x/deployment.md:118 +#: ./docs/10.x/deployment.md:128 +#: ./docs/11.x/deployment.md:149 +#: ./docs/master/deployment.md:130 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/11.x/deployment.md:107 +msgid "Laravel will need to write to the `bootstrap/cache` and `storage` directories, so you should ensure the web server process owner has permission to write to these directories." +msgstr "" + +# H3 +#: ./docs/8.x/deployment.md:107 +#: ./docs/9.x/deployment.md:119 msgid "Optimizing Route Loading" -msgstr "最佳化路由載入" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:109 +#: ./docs/9.x/deployment.md:121 +#: ./docs/10.x/deployment.md:131 +#: ./docs/11.x/deployment.md:152 +#: ./docs/master/deployment.md:133 +msgid "If you are building a large application with many routes, you should make sure that you are running the `route:cache` Artisan command during your deployment process:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/deployment.md:111 +#: ./docs/9.x/deployment.md:123 +#: ./docs/10.x/deployment.md:133 +#: ./docs/11.x/deployment.md:154 +#: ./docs/master/deployment.md:135 +msgid "php artisan route:cache" +msgstr "" -#: docs/8.x/deployment.md:block 38 (header) +# P +#: ./docs/11.x/deployment.md:112 +#: ./docs/master/deployment.md:93 +msgid "When deploying your application to production, there are a variety of files that should be cached, including your configuration, events, routes, and views. Laravel provides a single, convenient `optimize` Artisan command that will cache all of these files. This command should typically be invoked as part of your application's deployment process:" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:113 +#: ./docs/9.x/deployment.md:127 +#: ./docs/10.x/deployment.md:137 +#: ./docs/11.x/deployment.md:158 +#: ./docs/master/deployment.md:139 +msgid "This command reduces all of your route registrations into a single method call within a cached file, improving the performance of route registration when registering hundreds of routes." +msgstr "" + +# CODE: shell +#: ./docs/11.x/deployment.md:114 +#: ./docs/master/deployment.md:95 +msgid "php artisan optimize" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:115 +#: ./docs/9.x/deployment.md:129 +#: ./docs/10.x/deployment.md:139 +#: ./docs/11.x/deployment.md:160 +#: ./docs/master/deployment.md:141 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/deployment.md:116 +#: ./docs/9.x/deployment.md:130 msgid "Optimizing View Loading" -msgstr "最佳化 View 載入" +msgstr "" -#: docs/8.x/deployment.md:block 44 (paragraph) +# P +#: ./docs/11.x/deployment.md:118 +msgid "The `optimize:clear` method may be used to remove all of the cache files generated by the `optimize` command as well as all keys in the default cache driver:" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:118 +#: ./docs/9.x/deployment.md:132 +#: ./docs/10.x/deployment.md:142 +#: ./docs/11.x/deployment.md:163 +#: ./docs/master/deployment.md:144 +msgid "When deploying your application to production, you should make sure that you run the `view:cache` Artisan command during your deployment process:" +msgstr "" + +# P +#: ./docs/10.x/deployment.md:119 +#: ./docs/11.x/deployment.md:140 +#: ./docs/master/deployment.md:121 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/deployment.md:120 +#: ./docs/11.x/deployment.md:141 +#: ./docs/master/deployment.md:122 +msgid "Caching Events" +msgstr "" + +# CODE: shell +#: ./docs/11.x/deployment.md:120 +#: ./docs/master/deployment.md:101 +msgid "php artisan optimize:clear" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/deployment.md:120 +#: ./docs/9.x/deployment.md:134 +#: ./docs/10.x/deployment.md:144 +#: ./docs/11.x/deployment.md:165 +#: ./docs/master/deployment.md:146 +msgid "php artisan view:cache" +msgstr "" + +# P +#: ./docs/10.x/deployment.md:122 +msgid "If your application is utilizing [event discovery](/docs/{{version}}/events#event-discovery), you should cache your application's event to listener mappings during your deployment process. This can be accomplished by invoking the `event:cache` Artisan command during deployment:" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:122 +#: ./docs/9.x/deployment.md:138 +#: ./docs/10.x/deployment.md:148 +#: ./docs/11.x/deployment.md:169 +#: ./docs/master/deployment.md:150 +msgid "This command precompiles all your Blade views so they are not compiled on demand, improving the performance of each request that returns a view." +msgstr "" + +# CODE: shell +#: ./docs/10.x/deployment.md:124 +#: ./docs/11.x/deployment.md:145 +#: ./docs/master/deployment.md:126 +msgid "php artisan event:cache" +msgstr "" + +# P +#: ./docs/11.x/deployment.md:124 +#: ./docs/master/deployment.md:105 +msgid "In the following documentation, we will discuss each of the granular optimization commands that are executed by the `optimize` command." +msgstr "" + +# P +#: ./docs/8.x/deployment.md:124 +#: ./docs/9.x/deployment.md:140 +#: ./docs/10.x/deployment.md:150 +#: ./docs/11.x/deployment.md:171 +#: ./docs/master/deployment.md:152 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/deployment.md:125 +#: ./docs/9.x/deployment.md:141 +#: ./docs/10.x/deployment.md:151 +#: ./docs/11.x/deployment.md:172 +#: ./docs/master/deployment.md:153 +msgid "Debug Mode" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:127 msgid "The debug option in your config/app.php configuration file determines how much information about an error is actually displayed to the user. By default, this option is set to respect the value of the APP_DEBUG environment variable, which is stored in your .env file." -msgstr "config/app.php 設定檔中的 debug 選項用來判斷錯誤在實際顯示給使用者時要包含多少資訊。預設情況下,這個選項被設為依照 APP_DEBUG 環境變數值,該環境變數儲存於 `.env` 檔內。" +msgstr "" + +# H3 +#: ./docs/10.x/deployment.md:129 +#: ./docs/11.x/deployment.md:150 +#: ./docs/master/deployment.md:131 +msgid "Caching Routes" +msgstr "" -#: docs/8.x/deployment.md:block 45 (paragraph) +# P +#: ./docs/8.x/deployment.md:129 +#: ./docs/9.x/deployment.md:145 +#: ./docs/10.x/deployment.md:156 +#: ./docs/11.x/deployment.md:177 +#: ./docs/master/deployment.md:158 msgid "**In your production environment, this value should always be `false`. If the `APP_DEBUG` variable is set to `true` in production, you risk exposing sensitive configuration values to your application's end users.**" -msgstr "**在正式環境上,這個值一定要是 `false`。若在正式環境上將 `APP_DEBUG` 變數設為 `true`,則會有將機敏設定值暴露給應用程式終端使用者的風險。**" +msgstr "" -#: docs/8.x/deployment.md:block 47 (header) +# P +#: ./docs/8.x/deployment.md:131 +#: ./docs/9.x/deployment.md:147 +#: ./docs/10.x/deployment.md:158 +#: ./docs/11.x/deployment.md:195 +#: ./docs/master/deployment.md:176 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/deployment.md:132 +#: ./docs/9.x/deployment.md:148 msgid "Deploying With Forge / Vapor" -msgstr "使用 Forge /Vapor 來部署" +msgstr "" -#: docs/9.x/deployment.md:block 10 (unordered list) -msgid "PHP >= 8.0" -msgstr "PHP >= 8.0" +# P +#: ./docs/8.x/deployment.md:134 +#: ./docs/9.x/deployment.md:150 +#: ./docs/10.x/deployment.md:161 +#: ./docs/11.x/deployment.md:198 +#: ./docs/master/deployment.md:179 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/deployment.md:135 +#: ./docs/9.x/deployment.md:151 +#: ./docs/10.x/deployment.md:162 +#: ./docs/11.x/deployment.md:199 +#: ./docs/master/deployment.md:180 +msgid "Laravel Forge" +msgstr "" -#: docs/9.x/deployment.md:block 18 (code) -msgid "server {\n" -" listen 80;\n" -" listen [::]:80;\n" -" server_name example.com;\n" -" root /srv/example.com/public;\n\n" -" add_header X-Frame-Options \"SAMEORIGIN\";\n" -" add_header X-Content-Type-Options \"nosniff\";\n\n" -" index index.php;\n\n" -" charset utf-8;\n\n" -" location / {\n" -" try_files $uri $uri/ /index.php?$query_string;\n" -" }\n\n" -" location = /favicon.ico { access_log off; log_not_found off; }\n" -" location = /robots.txt { access_log off; log_not_found off; }\n\n" -" error_page 404 /index.php;\n\n" -" location ~ \\.php$ {\n" -" fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;\n" -" fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;\n" -" include fastcgi_params;\n" -" }\n\n" -" location ~ /\\.(?!well-known).* {\n" -" deny all;\n" -" }\n" -"}\n" -msgstr "server {\n" -" listen 80;\n" -" listen [::]:80;\n" -" server_name example.com;\n" -" root /srv/example.com/public;\n\n" -" add_header X-Frame-Options \"SAMEORIGIN\";\n" -" add_header X-Content-Type-Options \"nosniff\";\n\n" -" index index.php;\n\n" -" charset utf-8;\n\n" -" location / {\n" -" try_files $uri $uri/ /index.php?$query_string;\n" -" }\n\n" -" location = /favicon.ico { access_log off; log_not_found off; }\n" -" location = /robots.txt { access_log off; log_not_found off; }\n\n" -" error_page 404 /index.php;\n\n" -" location ~ \\.php$ {\n" -" fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;\n" -" fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;\n" -" include fastcgi_params;\n" -" }\n\n" -" location ~ /\\.(?!well-known).* {\n" -" deny all;\n" -" }\n" -"}\n" +# P +#: ./docs/8.x/deployment.md:137 +#: ./docs/9.x/deployment.md:153 +#: ./docs/10.x/deployment.md:164 +#: ./docs/11.x/deployment.md:201 +#: ./docs/master/deployment.md:182 +msgid "If you aren't quite ready to manage your own server configuration or aren't comfortable configuring all of the various services needed to run a robust Laravel application, [Laravel Forge](https://forge.laravel.com) is a wonderful alternative." +msgstr "" + +# P +#: ./docs/8.x/deployment.md:139 +#: ./docs/9.x/deployment.md:155 +#: ./docs/10.x/deployment.md:166 +#: ./docs/11.x/deployment.md:203 +#: ./docs/master/deployment.md:184 +msgid "Laravel Forge can create servers on various infrastructure providers such as DigitalOcean, Linode, AWS, and more. In addition, Forge installs and manages all of the tools needed to build robust Laravel applications, such as Nginx, MySQL, Redis, Memcached, Beanstalk, and more." +msgstr "" + +# H3 +#: ./docs/10.x/deployment.md:140 +#: ./docs/11.x/deployment.md:161 +#: ./docs/master/deployment.md:142 +msgid "Caching Views" +msgstr "" + +# P +#: ./docs/8.x/deployment.md:141 +#: ./docs/9.x/deployment.md:160 +#: ./docs/10.x/deployment.md:171 +#: ./docs/11.x/deployment.md:208 +#: ./docs/master/deployment.md:189 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/deployment.md:142 +#: ./docs/9.x/deployment.md:161 +#: ./docs/10.x/deployment.md:172 +#: ./docs/11.x/deployment.md:209 +#: ./docs/master/deployment.md:190 +msgid "Laravel Vapor" +msgstr "" + +# P +#: ./docs/11.x/deployment.md:143 +#: ./docs/master/deployment.md:124 +msgid "You should cache your application's auto-discovered event to listener mappings during your deployment process. This can be accomplished by invoking the `event:cache` Artisan command during deployment:" +msgstr "" + +# P +#: ./docs/9.x/deployment.md:143 +#: ./docs/10.x/deployment.md:153 +msgid "The debug option in your config/app.php configuration file determines how much information about an error is actually displayed to the user. By default, this option is set to respect the value of the `APP_DEBUG` environment variable, which is stored in your application's `.env` file." +msgstr "" + +# P +#: ./docs/8.x/deployment.md:144 +#: ./docs/9.x/deployment.md:163 +#: ./docs/10.x/deployment.md:174 +#: ./docs/11.x/deployment.md:211 +#: ./docs/master/deployment.md:192 +msgid "If you would like a totally serverless, auto-scaling deployment platform tuned for Laravel, check out [Laravel Vapor](https://vapor.laravel.com). Laravel Vapor is a serverless deployment platform for Laravel, powered by AWS. Launch your Laravel infrastructure on Vapor and fall in love with the scalable simplicity of serverless. Laravel Vapor is fine-tuned by Laravel's creators to work seamlessly with the framework so you can keep writing your Laravel applications exactly like you're used to." +msgstr "" + +# P +#: ./docs/9.x/deployment.md:158 +#: ./docs/10.x/deployment.md:169 +#: ./docs/11.x/deployment.md:206 +#: ./docs/master/deployment.md:187 +msgid "Want a full guide to deploying with Laravel Forge? Check out the [Laravel Bootcamp](https://bootcamp.laravel.com/deploying) and the Forge [video series available on Laracasts](https://laracasts.com/series/learn-laravel-forge-2022-edition)." +msgstr "" + +# H2 +#: ./docs/10.x/deployment.md:159 +#: ./docs/11.x/deployment.md:196 +#: ./docs/master/deployment.md:177 +msgid "Easy Deployment With Forge / Vapor" +msgstr "" + +# P +#: ./docs/11.x/deployment.md:174 +#: ./docs/master/deployment.md:155 +msgid "The debug option in your `config/app.php` configuration file determines how much information about an error is actually displayed to the user. By default, this option is set to respect the value of the `APP_DEBUG` environment variable, which is stored in your application's `.env` file." +msgstr "" + +# P +#: ./docs/11.x/deployment.md:179 +#: ./docs/master/deployment.md:160 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/deployment.md:180 +#: ./docs/master/deployment.md:161 +msgid "The Health Route" +msgstr "" + +# P +#: ./docs/11.x/deployment.md:182 +#: ./docs/master/deployment.md:163 +msgid "Laravel includes a built-in health check route that can be used to monitor the status of your application. In production, this route may be used to report the status of your application to an uptime monitor, load balancer, or orchestration system such as Kubernetes." +msgstr "" + +# P +#: ./docs/11.x/deployment.md:184 +#: ./docs/master/deployment.md:165 +msgid "By default, the health check route is served at `/up` and will return a 200 HTTP response if the application has booted without exceptions. Otherwise, a 500 HTTP response will be returned. You may configure the URI for this route in your application's `bootstrap/app` file:" +msgstr "" + +# CODE +#: ./docs/11.x/deployment.md:186 +#: ./docs/master/deployment.md:167 +msgid "->withRouting(\n" +" web: __DIR__.'/../routes/web.php',\n" +" commands: __DIR__.'/../routes/console.php',\n" +" health: '/up', // [tl! remove]\n" +" health: '/status', // [tl! add]\n" +")" +msgstr "" + +# P +#: ./docs/11.x/deployment.md:193 +#: ./docs/master/deployment.md:174 +msgid "When HTTP requests are made to this route, Laravel will also dispatch a `Illuminate\\Foundation\\Events\\DiagnosingHealth` event, allowing you to perform additional health checks relevant to your application. Within a [listener](/docs/{{version}}/events) for this event, you may check your application's database or cache status. If you detect a problem with your application, you may simply throw an exception from the listener." +msgstr "" diff --git a/po/zh_TW/documentation.po b/po/zh_TW/documentation.po index 1e3258a3d..0ae137d29 100644 --- a/po/zh_TW/documentation.po +++ b/po/zh_TW/documentation.po @@ -10,437 +10,974 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:18\n" - -#: docs/10.x/documentation.md:block 1 (unordered list) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H2 +#: ./docs/8.x/documentation.md:1 +#: ./docs/9.x/documentation.md:1 +#: ./docs/10.x/documentation.md:1 +#: ./docs/11.x/documentation.md:1 +#: ./docs/master/documentation.md:1 msgid "Prologue" -msgstr "​前言" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:2 +#: ./docs/9.x/documentation.md:2 +#: ./docs/10.x/documentation.md:2 +#: ./docs/11.x/documentation.md:2 +#: ./docs/master/documentation.md:2 msgid "[Release Notes](/docs/{{version}}/releases)" -msgstr "[版本資訊](/docs/{{version}}/releases)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:3 +#: ./docs/9.x/documentation.md:3 +#: ./docs/10.x/documentation.md:3 +#: ./docs/11.x/documentation.md:3 +#: ./docs/master/documentation.md:3 msgid "[Upgrade Guide](/docs/{{version}}/upgrade)" -msgstr "[升級指南](/docs/{{version}}/upgrade)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:4 +#: ./docs/9.x/documentation.md:4 +#: ./docs/10.x/documentation.md:4 +#: ./docs/11.x/documentation.md:4 +#: ./docs/master/documentation.md:4 msgid "[Contribution Guide](/docs/{{version}}/contributions)" -msgstr "[參與貢獻指南](/docs/{{version}}/contributions)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# H2 +#: ./docs/8.x/documentation.md:5 +#: ./docs/9.x/documentation.md:5 +#: ./docs/10.x/documentation.md:5 +#: ./docs/11.x/documentation.md:5 +#: ./docs/master/documentation.md:5 msgid "Getting Started" -msgstr "入門" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:6 +#: ./docs/9.x/documentation.md:6 +#: ./docs/10.x/documentation.md:6 +#: ./docs/11.x/documentation.md:6 +#: ./docs/master/documentation.md:6 msgid "[Installation](/docs/{{version}}/installation)" -msgstr "[安裝](/docs/{{version}}/installation)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:7 +#: ./docs/9.x/documentation.md:7 +#: ./docs/10.x/documentation.md:7 +#: ./docs/11.x/documentation.md:7 +#: ./docs/master/documentation.md:7 msgid "[Configuration](/docs/{{version}}/configuration)" -msgstr "[設定](/docs/{{version}}/configuration)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:8 +#: ./docs/9.x/documentation.md:8 +#: ./docs/10.x/documentation.md:8 +#: ./docs/11.x/documentation.md:8 +#: ./docs/master/documentation.md:8 msgid "[Directory Structure](/docs/{{version}}/structure)" -msgstr "[目錄架構](/docs/{{version}}/structure)" - -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Frontend](/docs/{{version}}/frontend)" -msgstr "[前端](/docs/{{version}}/frontend)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:9 +#: ./docs/9.x/documentation.md:10 +#: ./docs/10.x/documentation.md:10 +#: ./docs/11.x/documentation.md:10 +#: ./docs/master/documentation.md:10 msgid "[Starter Kits](/docs/{{version}}/starter-kits)" -msgstr "[入門套件](/docs/{{version}}/starter-kits)" +msgstr "" + +# P +#: ./docs/9.x/documentation.md:9 +#: ./docs/10.x/documentation.md:9 +#: ./docs/11.x/documentation.md:9 +#: ./docs/master/documentation.md:9 +msgid "[Frontend](/docs/{{version}}/frontend)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:10 +#: ./docs/9.x/documentation.md:11 +#: ./docs/10.x/documentation.md:11 +#: ./docs/11.x/documentation.md:11 +#: ./docs/master/documentation.md:11 msgid "[Deployment](/docs/{{version}}/deployment)" -msgstr "[部署](/docs/{{version}}/deployment)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# H2 +#: ./docs/8.x/documentation.md:11 +#: ./docs/9.x/documentation.md:12 +#: ./docs/10.x/documentation.md:12 +#: ./docs/11.x/documentation.md:12 +#: ./docs/master/documentation.md:12 msgid "Architecture Concepts" -msgstr "架構概念" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:12 +#: ./docs/9.x/documentation.md:13 +#: ./docs/10.x/documentation.md:13 +#: ./docs/11.x/documentation.md:13 +#: ./docs/master/documentation.md:13 msgid "[Request Lifecycle](/docs/{{version}}/lifecycle)" -msgstr "[Request 的生命週期](/docs/{{version}}/lifecycle)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:13 +#: ./docs/9.x/documentation.md:14 +#: ./docs/10.x/documentation.md:14 +#: ./docs/11.x/documentation.md:14 +#: ./docs/master/documentation.md:14 msgid "[Service Container](/docs/{{version}}/container)" -msgstr "[Service Container](/docs/{{version}}/container)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:14 +#: ./docs/9.x/documentation.md:15 +#: ./docs/10.x/documentation.md:15 +#: ./docs/11.x/documentation.md:15 +#: ./docs/master/documentation.md:15 msgid "[Service Providers](/docs/{{version}}/providers)" -msgstr "[Service Provider](/docs/{{version}}/providers)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:15 +#: ./docs/9.x/documentation.md:16 +#: ./docs/10.x/documentation.md:16 +#: ./docs/11.x/documentation.md:16 +#: ./docs/master/documentation.md:16 msgid "[Facades](/docs/{{version}}/facades)" -msgstr "[Facade](/docs/{{version}}/facades)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# H2 +#: ./docs/8.x/documentation.md:16 +#: ./docs/9.x/documentation.md:17 +#: ./docs/10.x/documentation.md:17 +#: ./docs/11.x/documentation.md:17 +#: ./docs/master/documentation.md:17 msgid "The Basics" -msgstr "基礎" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:17 +#: ./docs/9.x/documentation.md:18 +#: ./docs/10.x/documentation.md:18 +#: ./docs/11.x/documentation.md:18 +#: ./docs/master/documentation.md:18 msgid "[Routing](/docs/{{version}}/routing)" -msgstr "[路由](/docs/{{version}}/routing)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:18 +#: ./docs/9.x/documentation.md:19 +#: ./docs/10.x/documentation.md:19 +#: ./docs/11.x/documentation.md:19 +#: ./docs/master/documentation.md:19 msgid "[Middleware](/docs/{{version}}/middleware)" -msgstr "[Middleware](/docs/{{version}}/middleware)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:19 +#: ./docs/9.x/documentation.md:20 +#: ./docs/10.x/documentation.md:20 +#: ./docs/11.x/documentation.md:20 +#: ./docs/master/documentation.md:20 msgid "[CSRF Protection](/docs/{{version}}/csrf)" -msgstr "[CSRF 保護](/docs/{{version}}/csrf)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:20 +#: ./docs/9.x/documentation.md:21 +#: ./docs/10.x/documentation.md:21 +#: ./docs/11.x/documentation.md:21 +#: ./docs/master/documentation.md:21 msgid "[Controllers](/docs/{{version}}/controllers)" -msgstr "[Controller](/docs/{{version}}/controllers)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:21 +#: ./docs/9.x/documentation.md:22 +#: ./docs/10.x/documentation.md:22 +#: ./docs/11.x/documentation.md:22 +#: ./docs/master/documentation.md:22 msgid "[Requests](/docs/{{version}}/requests)" -msgstr "[Request](/docs/{{version}}/requests)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:22 +#: ./docs/9.x/documentation.md:23 +#: ./docs/10.x/documentation.md:23 +#: ./docs/11.x/documentation.md:23 +#: ./docs/master/documentation.md:23 msgid "[Responses](/docs/{{version}}/responses)" -msgstr "[Response](/docs/{{version}}/responses)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:23 +#: ./docs/9.x/documentation.md:24 +#: ./docs/10.x/documentation.md:24 +#: ./docs/11.x/documentation.md:24 +#: ./docs/master/documentation.md:24 msgid "[Views](/docs/{{version}}/views)" -msgstr "[View](/docs/{{version}}/views)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:24 +#: ./docs/9.x/documentation.md:25 +#: ./docs/10.x/documentation.md:25 +#: ./docs/11.x/documentation.md:25 +#: ./docs/master/documentation.md:25 msgid "[Blade Templates](/docs/{{version}}/blade)" -msgstr "[Blade 樣板](/docs/{{version}}/blade)" - -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Asset Bundling](/docs/{{version}}/vite)" -msgstr "[打包素材](/docs/{{version}}/vite)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:25 +#: ./docs/9.x/documentation.md:27 +#: ./docs/10.x/documentation.md:27 +#: ./docs/11.x/documentation.md:27 +#: ./docs/master/documentation.md:27 msgid "[URL Generation](/docs/{{version}}/urls)" -msgstr "[產生 URL](/docs/{{version}}/urls)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:26 +#: ./docs/9.x/documentation.md:28 +#: ./docs/10.x/documentation.md:28 +#: ./docs/11.x/documentation.md:28 +#: ./docs/master/documentation.md:28 msgid "[Session](/docs/{{version}}/session)" -msgstr "[Session](/docs/{{version}}/session)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/9.x/documentation.md:26 +#: ./docs/10.x/documentation.md:26 +#: ./docs/11.x/documentation.md:26 +#: ./docs/master/documentation.md:26 +msgid "[Asset Bundling](/docs/{{version}}/vite)" +msgstr "" + +# P +#: ./docs/8.x/documentation.md:27 +#: ./docs/9.x/documentation.md:29 +#: ./docs/10.x/documentation.md:29 +#: ./docs/11.x/documentation.md:29 +#: ./docs/master/documentation.md:29 msgid "[Validation](/docs/{{version}}/validation)" -msgstr "[表單驗證](/docs/{{version}}/validation)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:28 +#: ./docs/9.x/documentation.md:30 +#: ./docs/10.x/documentation.md:30 +#: ./docs/11.x/documentation.md:30 +#: ./docs/master/documentation.md:30 msgid "[Error Handling](/docs/{{version}}/errors)" -msgstr "[錯誤處理](/docs/{{version}}/errors)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:29 +#: ./docs/9.x/documentation.md:31 +#: ./docs/10.x/documentation.md:31 +#: ./docs/11.x/documentation.md:31 +#: ./docs/master/documentation.md:31 msgid "[Logging](/docs/{{version}}/logging)" -msgstr "[日誌](/docs/{{version}}/logging)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# H2 +#: ./docs/8.x/documentation.md:30 +#: ./docs/9.x/documentation.md:32 +#: ./docs/10.x/documentation.md:32 +#: ./docs/11.x/documentation.md:32 +#: ./docs/master/documentation.md:32 msgid "Digging Deeper" -msgstr "深入探討" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:31 +#: ./docs/9.x/documentation.md:33 +#: ./docs/10.x/documentation.md:33 +#: ./docs/11.x/documentation.md:33 +#: ./docs/master/documentation.md:33 msgid "[Artisan Console](/docs/{{version}}/artisan)" -msgstr "[Artisan 主控台](/docs/{{version}}/artisan)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:32 +#: ./docs/9.x/documentation.md:34 +#: ./docs/10.x/documentation.md:34 +#: ./docs/11.x/documentation.md:34 +#: ./docs/master/documentation.md:34 msgid "[Broadcasting](/docs/{{version}}/broadcasting)" -msgstr "[Broadcast](/docs/{{version}}/broadcasting)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:33 +#: ./docs/9.x/documentation.md:35 +#: ./docs/10.x/documentation.md:35 +#: ./docs/11.x/documentation.md:35 +#: ./docs/master/documentation.md:35 msgid "[Cache](/docs/{{version}}/cache)" -msgstr "[快取](/docs/{{version}}/cache)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:34 +#: ./docs/9.x/documentation.md:36 +#: ./docs/10.x/documentation.md:36 +#: ./docs/11.x/documentation.md:36 +#: ./docs/master/documentation.md:36 msgid "[Collections](/docs/{{version}}/collections)" -msgstr "[Collection](/docs/{{version}}/collections)" +msgstr "" + +# P +#: ./docs/8.x/documentation.md:35 +msgid "[Compiling Assets](/docs/{{version}}/mix)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:36 +#: ./docs/9.x/documentation.md:37 +#: ./docs/10.x/documentation.md:37 +#: ./docs/11.x/documentation.md:39 +#: ./docs/master/documentation.md:37 msgid "[Contracts](/docs/{{version}}/contracts)" -msgstr "[Contract](/docs/{{version}}/contracts)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/11.x/documentation.md:37 +msgid "[Concurrency](/docs/{{version}}/concurrency)" +msgstr "" + +# P +#: ./docs/8.x/documentation.md:37 +#: ./docs/9.x/documentation.md:38 +#: ./docs/10.x/documentation.md:38 +#: ./docs/11.x/documentation.md:40 +#: ./docs/master/documentation.md:38 msgid "[Events](/docs/{{version}}/events)" -msgstr "[Event](/docs/{{version}}/events)" +msgstr "" + +# P +#: ./docs/11.x/documentation.md:38 +msgid "[Context](/docs/{{version}}/context)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:38 +#: ./docs/9.x/documentation.md:39 +#: ./docs/10.x/documentation.md:39 +#: ./docs/11.x/documentation.md:41 +#: ./docs/master/documentation.md:39 msgid "[File Storage](/docs/{{version}}/filesystem)" -msgstr "[檔案儲存](/docs/{{version}}/filesystem)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:39 +#: ./docs/9.x/documentation.md:40 +#: ./docs/10.x/documentation.md:40 +#: ./docs/11.x/documentation.md:42 +#: ./docs/master/documentation.md:40 msgid "[Helpers](/docs/{{version}}/helpers)" -msgstr "[輔助函式](/docs/{{version}}/helpers)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:40 +#: ./docs/9.x/documentation.md:41 +#: ./docs/10.x/documentation.md:41 +#: ./docs/11.x/documentation.md:43 +#: ./docs/master/documentation.md:41 msgid "[HTTP Client](/docs/{{version}}/http-client)" -msgstr "[HTTP 用戶端](/docs/{{version}}/http-client)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:41 +#: ./docs/9.x/documentation.md:42 +#: ./docs/10.x/documentation.md:42 +#: ./docs/11.x/documentation.md:44 +#: ./docs/master/documentation.md:42 msgid "[Localization](/docs/{{version}}/localization)" -msgstr "[本土化](/docs/{{version}}/localization)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:42 +#: ./docs/9.x/documentation.md:43 +#: ./docs/10.x/documentation.md:43 +#: ./docs/11.x/documentation.md:45 +#: ./docs/master/documentation.md:43 msgid "[Mail](/docs/{{version}}/mail)" -msgstr "[郵件](/docs/{{version}}/mail)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:43 +#: ./docs/9.x/documentation.md:44 +#: ./docs/10.x/documentation.md:44 +#: ./docs/11.x/documentation.md:46 +#: ./docs/master/documentation.md:44 msgid "[Notifications](/docs/{{version}}/notifications)" -msgstr "[通知](/docs/{{version}}/notifications)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:44 +#: ./docs/9.x/documentation.md:45 +#: ./docs/10.x/documentation.md:45 +#: ./docs/11.x/documentation.md:47 +#: ./docs/master/documentation.md:45 msgid "[Package Development](/docs/{{version}}/packages)" -msgstr "[套件開發](/docs/{{version}}/packages)" - -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Processes](/docs/{{version}}/processes)" -msgstr "[Processes](/docs/{{version}}/processes)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:45 +#: ./docs/9.x/documentation.md:46 +#: ./docs/10.x/documentation.md:47 +#: ./docs/11.x/documentation.md:49 +#: ./docs/master/documentation.md:47 msgid "[Queues](/docs/{{version}}/queues)" -msgstr "[佇列](/docs/{{version}}/queues)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Rate Limiting](/docs/{{version}}/rate-limiting)" -msgstr "[頻率限制](/docs/{{version}}/rate-limiting)" +# P +#: ./docs/10.x/documentation.md:46 +#: ./docs/11.x/documentation.md:48 +#: ./docs/master/documentation.md:46 +msgid "[Processes](/docs/{{version}}/processes)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Strings](/docs/{{version}}/strings)" -msgstr "[Strings](/docs/{{version}}/strings)" +# P +#: ./docs/8.x/documentation.md:46 +#: ./docs/9.x/documentation.md:47 +#: ./docs/10.x/documentation.md:48 +#: ./docs/11.x/documentation.md:50 +#: ./docs/master/documentation.md:48 +msgid "[Rate Limiting](/docs/{{version}}/rate-limiting)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:47 +#: ./docs/9.x/documentation.md:48 +#: ./docs/10.x/documentation.md:50 +#: ./docs/11.x/documentation.md:52 +#: ./docs/master/documentation.md:50 msgid "[Task Scheduling](/docs/{{version}}/scheduling)" -msgstr "[任務排程](/docs/{{version}}/scheduling)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# H2 +#: ./docs/8.x/documentation.md:48 +#: ./docs/9.x/documentation.md:49 +#: ./docs/10.x/documentation.md:51 +#: ./docs/11.x/documentation.md:53 +#: ./docs/master/documentation.md:51 msgid "Security" -msgstr "安全性" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/10.x/documentation.md:49 +#: ./docs/11.x/documentation.md:51 +#: ./docs/master/documentation.md:49 +msgid "[Strings](/docs/{{version}}/strings)" +msgstr "" + +# P +#: ./docs/8.x/documentation.md:49 +#: ./docs/9.x/documentation.md:50 +#: ./docs/10.x/documentation.md:52 +#: ./docs/11.x/documentation.md:54 +#: ./docs/master/documentation.md:52 msgid "[Authentication](/docs/{{version}}/authentication)" -msgstr "[身份驗證](/docs/{{version}}/authentication)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:50 +#: ./docs/9.x/documentation.md:51 +#: ./docs/10.x/documentation.md:53 +#: ./docs/11.x/documentation.md:55 +#: ./docs/master/documentation.md:53 msgid "[Authorization](/docs/{{version}}/authorization)" -msgstr "[授權](/docs/{{version}}/authorization)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:51 +#: ./docs/9.x/documentation.md:52 +#: ./docs/10.x/documentation.md:54 +#: ./docs/11.x/documentation.md:56 +#: ./docs/master/documentation.md:54 msgid "[Email Verification](/docs/{{version}}/verification)" -msgstr "[E-Mail 驗證](/docs/{{version}}/verification)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:52 +#: ./docs/9.x/documentation.md:53 +#: ./docs/10.x/documentation.md:55 +#: ./docs/11.x/documentation.md:57 +#: ./docs/master/documentation.md:55 msgid "[Encryption](/docs/{{version}}/encryption)" -msgstr "[加密](/docs/{{version}}/encryption)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:53 +#: ./docs/9.x/documentation.md:54 +#: ./docs/10.x/documentation.md:56 +#: ./docs/11.x/documentation.md:58 +#: ./docs/master/documentation.md:56 msgid "[Hashing](/docs/{{version}}/hashing)" -msgstr "[雜湊](/docs/{{version}}/hashing)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:54 +#: ./docs/9.x/documentation.md:55 +#: ./docs/10.x/documentation.md:57 +#: ./docs/11.x/documentation.md:59 +#: ./docs/master/documentation.md:57 msgid "[Password Reset](/docs/{{version}}/passwords)" -msgstr "[重設密碼](/docs/{{version}}/passwords)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# H2 +#: ./docs/8.x/documentation.md:55 +#: ./docs/9.x/documentation.md:56 +#: ./docs/10.x/documentation.md:58 +#: ./docs/11.x/documentation.md:60 +#: ./docs/master/documentation.md:58 msgid "Database" -msgstr "資料庫" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:56 +#: ./docs/9.x/documentation.md:57 +#: ./docs/10.x/documentation.md:59 +#: ./docs/11.x/documentation.md:61 +#: ./docs/master/documentation.md:59 msgid "[Getting Started](/docs/{{version}}/database)" -msgstr "[入門](/docs/{{version}}/database)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:57 +#: ./docs/9.x/documentation.md:58 +#: ./docs/10.x/documentation.md:60 +#: ./docs/11.x/documentation.md:62 +#: ./docs/master/documentation.md:60 msgid "[Query Builder](/docs/{{version}}/queries)" -msgstr "[Query Builder](/docs/{{version}}/queries)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:58 +#: ./docs/9.x/documentation.md:59 +#: ./docs/10.x/documentation.md:61 +#: ./docs/11.x/documentation.md:63 +#: ./docs/master/documentation.md:61 msgid "[Pagination](/docs/{{version}}/pagination)" -msgstr "[分頁](/docs/{{version}}/pagination)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:59 +#: ./docs/9.x/documentation.md:60 +#: ./docs/10.x/documentation.md:62 +#: ./docs/11.x/documentation.md:64 +#: ./docs/master/documentation.md:62 msgid "[Migrations](/docs/{{version}}/migrations)" -msgstr "[Migration](/docs/{{version}}/migrations)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:60 +#: ./docs/9.x/documentation.md:61 +#: ./docs/10.x/documentation.md:63 +#: ./docs/11.x/documentation.md:65 +#: ./docs/master/documentation.md:63 msgid "[Seeding](/docs/{{version}}/seeding)" -msgstr "[Seed](/docs/{{version}}/seeding)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:61 +#: ./docs/9.x/documentation.md:62 +#: ./docs/10.x/documentation.md:64 +#: ./docs/11.x/documentation.md:66 +#: ./docs/master/documentation.md:64 msgid "[Redis](/docs/{{version}}/redis)" -msgstr "[Redis](/docs/{{version}}/redis)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# H2 +#: ./docs/8.x/documentation.md:62 +#: ./docs/9.x/documentation.md:63 +#: ./docs/10.x/documentation.md:65 +#: ./docs/11.x/documentation.md:68 +#: ./docs/master/documentation.md:65 msgid "Eloquent ORM" -msgstr "Eloquent ORM" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:63 +#: ./docs/9.x/documentation.md:64 +#: ./docs/10.x/documentation.md:66 +#: ./docs/11.x/documentation.md:69 +#: ./docs/master/documentation.md:66 msgid "[Getting Started](/docs/{{version}}/eloquent)" -msgstr "[入門](/docs/{{version}}/eloquent)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:64 +#: ./docs/9.x/documentation.md:65 +#: ./docs/10.x/documentation.md:67 +#: ./docs/11.x/documentation.md:70 +#: ./docs/master/documentation.md:67 msgid "[Relationships](/docs/{{version}}/eloquent-relationships)" -msgstr "[關聯](/docs/{{version}}/eloquent-relationships)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:65 +#: ./docs/9.x/documentation.md:66 +#: ./docs/10.x/documentation.md:68 +#: ./docs/11.x/documentation.md:71 +#: ./docs/master/documentation.md:68 msgid "[Collections](/docs/{{version}}/eloquent-collections)" -msgstr "[Collection](/docs/{{version}}/eloquent-collections)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:66 +#: ./docs/9.x/documentation.md:67 +#: ./docs/10.x/documentation.md:69 +#: ./docs/11.x/documentation.md:72 +#: ./docs/master/documentation.md:69 msgid "[Mutators / Casts](/docs/{{version}}/eloquent-mutators)" -msgstr "[Mutator 與 Cast](/docs/{{version}}/eloquent-mutators)" +msgstr "" + +# P +#: ./docs/11.x/documentation.md:67 +msgid "[MongoDB](/docs/{{version}}/mongodb)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:67 +#: ./docs/9.x/documentation.md:68 +#: ./docs/10.x/documentation.md:70 +#: ./docs/11.x/documentation.md:73 +#: ./docs/master/documentation.md:70 msgid "[API Resources](/docs/{{version}}/eloquent-resources)" -msgstr "[API Resource](/docs/{{version}}/eloquent-resources)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:68 +#: ./docs/9.x/documentation.md:69 +#: ./docs/10.x/documentation.md:71 +#: ./docs/11.x/documentation.md:74 +#: ./docs/master/documentation.md:71 msgid "[Serialization](/docs/{{version}}/eloquent-serialization)" -msgstr "[序列化](/docs/{{version}}/eloquent-serialization)" - -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Factories](/docs/{{version}}/eloquent-factories)" -msgstr "[Factory](/docs/{{version}}/eloquent-factories)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# H2 +#: ./docs/8.x/documentation.md:69 +#: ./docs/9.x/documentation.md:71 +#: ./docs/10.x/documentation.md:73 +#: ./docs/11.x/documentation.md:76 +#: ./docs/master/documentation.md:73 msgid "Testing" -msgstr "測試" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:70 +#: ./docs/9.x/documentation.md:72 +#: ./docs/10.x/documentation.md:74 +#: ./docs/11.x/documentation.md:77 +#: ./docs/master/documentation.md:74 msgid "[Getting Started](/docs/{{version}}/testing)" -msgstr "[入門](/docs/{{version}}/testing)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/9.x/documentation.md:70 +#: ./docs/10.x/documentation.md:72 +#: ./docs/11.x/documentation.md:75 +#: ./docs/master/documentation.md:72 +msgid "[Factories](/docs/{{version}}/eloquent-factories)" +msgstr "" + +# P +#: ./docs/8.x/documentation.md:71 +#: ./docs/9.x/documentation.md:73 +#: ./docs/10.x/documentation.md:75 +#: ./docs/11.x/documentation.md:78 +#: ./docs/master/documentation.md:75 msgid "[HTTP Tests](/docs/{{version}}/http-tests)" -msgstr "[HTTP 測試](/docs/{{version}}/http-tests)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:72 +#: ./docs/9.x/documentation.md:74 +#: ./docs/10.x/documentation.md:76 +#: ./docs/11.x/documentation.md:79 +#: ./docs/master/documentation.md:76 msgid "[Console Tests](/docs/{{version}}/console-tests)" -msgstr "[主控台測試](/docs/{{version}}/console-tests)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:73 +#: ./docs/9.x/documentation.md:75 +#: ./docs/10.x/documentation.md:77 +#: ./docs/11.x/documentation.md:80 +#: ./docs/master/documentation.md:77 msgid "[Browser Tests](/docs/{{version}}/dusk)" -msgstr "[瀏覽器測試](/docs/{{version}}/dusk)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:74 +#: ./docs/9.x/documentation.md:76 +#: ./docs/10.x/documentation.md:78 +#: ./docs/11.x/documentation.md:81 +#: ./docs/master/documentation.md:78 msgid "[Database](/docs/{{version}}/database-testing)" -msgstr "[資料庫](/docs/{{version}}/database-testing)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:75 +#: ./docs/9.x/documentation.md:77 +#: ./docs/10.x/documentation.md:79 +#: ./docs/11.x/documentation.md:82 +#: ./docs/master/documentation.md:79 msgid "[Mocking](/docs/{{version}}/mocking)" -msgstr "[Mock](/docs/{{version}}/mocking)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# H2 +#: ./docs/8.x/documentation.md:76 +#: ./docs/9.x/documentation.md:78 +#: ./docs/10.x/documentation.md:80 +#: ./docs/11.x/documentation.md:83 +#: ./docs/master/documentation.md:80 msgid "Packages" -msgstr "套件" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:77 +#: ./docs/9.x/documentation.md:79 +#: ./docs/10.x/documentation.md:81 +#: ./docs/11.x/documentation.md:84 +#: ./docs/master/documentation.md:81 msgid "[Breeze](/docs/{{version}}/starter-kits#laravel-breeze)" -msgstr "[Breeze](/docs/{{version}}/starter-kits#laravel-breeze)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:78 +#: ./docs/9.x/documentation.md:80 +#: ./docs/10.x/documentation.md:82 +#: ./docs/11.x/documentation.md:85 +#: ./docs/master/documentation.md:82 msgid "[Cashier (Stripe)](/docs/{{version}}/billing)" -msgstr "[Cashier (Stripe)](/docs/{{version}}/billing)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:79 +#: ./docs/9.x/documentation.md:81 +#: ./docs/10.x/documentation.md:83 +#: ./docs/11.x/documentation.md:86 +#: ./docs/master/documentation.md:83 msgid "[Cashier (Paddle)](/docs/{{version}}/cashier-paddle)" -msgstr "[Cashier (Paddle)](/docs/{{version}}/cashier-paddle)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:80 +#: ./docs/9.x/documentation.md:82 +#: ./docs/10.x/documentation.md:84 +#: ./docs/11.x/documentation.md:87 +#: ./docs/master/documentation.md:84 msgid "[Dusk](/docs/{{version}}/dusk)" -msgstr "[Dusk](/docs/{{version}}/dusk)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:81 +#: ./docs/9.x/documentation.md:83 +#: ./docs/10.x/documentation.md:85 +#: ./docs/11.x/documentation.md:88 +#: ./docs/master/documentation.md:85 msgid "[Envoy](/docs/{{version}}/envoy)" -msgstr "[Envoy](/docs/{{version}}/envoy)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:82 +#: ./docs/9.x/documentation.md:84 +#: ./docs/10.x/documentation.md:86 +#: ./docs/11.x/documentation.md:89 +#: ./docs/master/documentation.md:86 msgid "[Fortify](/docs/{{version}}/fortify)" -msgstr "[Fortify](/docs/{{version}}/fortify)" - -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Folio](/docs/{{version}}/folio)" -msgstr "[Folio](/docs/{{version}}/folio)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:83 +#: ./docs/9.x/documentation.md:85 +#: ./docs/10.x/documentation.md:88 +#: ./docs/11.x/documentation.md:91 +#: ./docs/master/documentation.md:88 msgid "[Homestead](/docs/{{version}}/homestead)" -msgstr "[Homestead](/docs/{{version}}/homestead)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:84 +#: ./docs/9.x/documentation.md:86 +#: ./docs/10.x/documentation.md:89 +#: ./docs/11.x/documentation.md:92 +#: ./docs/master/documentation.md:89 msgid "[Horizon](/docs/{{version}}/horizon)" -msgstr "[Horizon](/docs/{{version}}/horizon)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:85 +#: ./docs/9.x/documentation.md:87 +#: ./docs/10.x/documentation.md:90 +#: ./docs/11.x/documentation.md:93 +#: ./docs/master/documentation.md:90 msgid "[Jetstream](https://jetstream.laravel.com)" -msgstr "[Jetstream](https://jetstream.laravel.com)" - -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Mix](/docs/{{version}}/mix)" -msgstr "[Mix](/docs/{{version}}/mix)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:86 +#: ./docs/9.x/documentation.md:89 +#: ./docs/10.x/documentation.md:92 +#: ./docs/11.x/documentation.md:95 +#: ./docs/master/documentation.md:92 msgid "[Octane](/docs/{{version}}/octane)" -msgstr "[Octane](/docs/{{version}}/octane)" - -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Passport](/docs/{{version}}/passport)" -msgstr "[Passport](/docs/{{version}}/passport)" - -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Pennant](/docs/{{version}}/pennant)" -msgstr "[Pennant](/docs/{{version}}/pennant)" - -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Pint](/docs/{{version}}/pint)" -msgstr "[Pint](/docs/{{version}}/pint)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Precognition](/docs/{{version}}/precognition)" -msgstr "[Precognition](/docs/{{version}}/precognition)" +# P +#: ./docs/10.x/documentation.md:87 +#: ./docs/11.x/documentation.md:90 +#: ./docs/master/documentation.md:87 +msgid "[Folio](/docs/{{version}}/folio)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[Prompts](/docs/{{version}}/prompts)" -msgstr "[Prompts](/docs/{{version}}/prompts)" +# P +#: ./docs/8.x/documentation.md:87 +#: ./docs/9.x/documentation.md:90 +#: ./docs/10.x/documentation.md:93 +#: ./docs/11.x/documentation.md:96 +#: ./docs/master/documentation.md:93 +msgid "[Passport](/docs/{{version}}/passport)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:88 +#: ./docs/9.x/documentation.md:92 +#: ./docs/10.x/documentation.md:100 +#: ./docs/11.x/documentation.md:103 +#: ./docs/master/documentation.md:100 msgid "[Sail](/docs/{{version}}/sail)" -msgstr "[Sail](/docs/{{version}}/sail)" +msgstr "" + +# P +#: ./docs/9.x/documentation.md:88 +#: ./docs/10.x/documentation.md:91 +#: ./docs/11.x/documentation.md:94 +#: ./docs/master/documentation.md:91 +msgid "[Mix](/docs/{{version}}/mix)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:89 +#: ./docs/9.x/documentation.md:93 +#: ./docs/10.x/documentation.md:101 +#: ./docs/11.x/documentation.md:104 +#: ./docs/master/documentation.md:101 msgid "[Sanctum](/docs/{{version}}/sanctum)" -msgstr "[Sanctum](/docs/{{version}}/sanctum)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:90 +#: ./docs/9.x/documentation.md:94 +#: ./docs/10.x/documentation.md:102 +#: ./docs/11.x/documentation.md:105 +#: ./docs/master/documentation.md:102 msgid "[Scout](/docs/{{version}}/scout)" -msgstr "[Scout](/docs/{{version}}/scout)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:91 +#: ./docs/9.x/documentation.md:95 +#: ./docs/10.x/documentation.md:103 +#: ./docs/11.x/documentation.md:106 +#: ./docs/master/documentation.md:103 msgid "[Socialite](/docs/{{version}}/socialite)" -msgstr "[Socialite](/docs/{{version}}/socialite)" +msgstr "" + +# P +#: ./docs/9.x/documentation.md:91 +#: ./docs/10.x/documentation.md:95 +#: ./docs/11.x/documentation.md:98 +#: ./docs/master/documentation.md:95 +msgid "[Pint](/docs/{{version}}/pint)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:92 +#: ./docs/9.x/documentation.md:96 +#: ./docs/10.x/documentation.md:104 +#: ./docs/11.x/documentation.md:107 +#: ./docs/master/documentation.md:104 msgid "[Telescope](/docs/{{version}}/telescope)" -msgstr "[Telescope](/docs/{{version}}/telescope)" +msgstr "" -#: docs/10.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:93 +#: ./docs/9.x/documentation.md:97 +#: ./docs/10.x/documentation.md:105 +#: ./docs/11.x/documentation.md:108 +#: ./docs/master/documentation.md:105 msgid "[Valet](/docs/{{version}}/valet)" -msgstr "[Valet](/docs/{{version}}/valet)" - -#: docs/10.x/documentation.md:block 1 (unordered list) -msgid "[API Documentation](/api/10.x)" -msgstr "[API 說明文件](/api/10.x)" +msgstr "" -#: docs/8.x/documentation.md:block 1 (unordered list) -msgid "[Compiling Assets](/docs/{{version}}/mix)" -msgstr "[編譯資源](/docs/{{version}}/mix)" +# P +#: ./docs/10.x/documentation.md:94 +#: ./docs/11.x/documentation.md:97 +#: ./docs/master/documentation.md:94 +msgid "[Pennant](/docs/{{version}}/pennant)" +msgstr "" -#: docs/8.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/8.x/documentation.md:94 msgid "[API Documentation](/api/8.x)" -msgstr "[API 說明文件](/api/8.x)" +msgstr "" -#: docs/9.x/documentation.md:block 1 (unordered list) +# P +#: ./docs/10.x/documentation.md:96 +#: ./docs/11.x/documentation.md:99 +#: ./docs/master/documentation.md:96 +msgid "[Precognition](/docs/{{version}}/precognition)" +msgstr "" + +# P +#: ./docs/10.x/documentation.md:97 +#: ./docs/11.x/documentation.md:100 +#: ./docs/master/documentation.md:97 +msgid "[Prompts](/docs/{{version}}/prompts)" +msgstr "" + +# P +#: ./docs/10.x/documentation.md:98 +#: ./docs/11.x/documentation.md:101 +#: ./docs/master/documentation.md:98 +msgid "[Pulse](/docs/{{version}}/pulse)" +msgstr "" + +# P +#: ./docs/9.x/documentation.md:98 msgid "[API Documentation](/api/9.x)" -msgstr "[API 說明文件](/api/9.x)" +msgstr "" + +# P +#: ./docs/10.x/documentation.md:99 +#: ./docs/11.x/documentation.md:102 +#: ./docs/master/documentation.md:99 +msgid "[Reverb](/docs/{{version}}/reverb)" +msgstr "" + +# P +#: ./docs/10.x/documentation.md:106 +msgid "[API Documentation](/api/10.x)" +msgstr "" -#: docs/master/documentation.md:block 1 (unordered list) +# P +#: ./docs/master/documentation.md:106 msgid "[API Documentation](/api/master)" -msgstr "[API 說明文件](/api/master)" +msgstr "" + +# P +#: ./docs/11.x/documentation.md:109 +msgid "[API Documentation](/api/11.x)" +msgstr "" diff --git a/po/zh_TW/dusk.po b/po/zh_TW/dusk.po index 1ca5d5141..79ee35122 100644 --- a/po/zh_TW/dusk.po +++ b/po/zh_TW/dusk.po @@ -10,257 +10,646 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:18\n" - -#: docs/10.x/dusk.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:38\n" + +# H1 +#: ./docs/8.x/dusk.md:1 +#: ./docs/9.x/dusk.md:1 +#: ./docs/10.x/dusk.md:1 +#: ./docs/11.x/dusk.md:1 +#: ./docs/master/dusk.md:1 msgid "Laravel Dusk" -msgstr "Laravel Dusk" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:3 +#: ./docs/9.x/dusk.md:3 +#: ./docs/10.x/dusk.md:3 +#: ./docs/11.x/dusk.md:3 +#: ./docs/master/dusk.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:4 +#: ./docs/9.x/dusk.md:4 +#: ./docs/10.x/dusk.md:4 +#: ./docs/11.x/dusk.md:4 +#: ./docs/master/dusk.md:4 msgid "[Installation](#installation)" -msgstr "[安裝](#installation)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:5 +#: ./docs/9.x/dusk.md:5 +#: ./docs/10.x/dusk.md:5 +#: ./docs/11.x/dusk.md:5 +#: ./docs/master/dusk.md:5 msgid "[Managing ChromeDriver Installations](#managing-chromedriver-installations)" -msgstr "[安裝 ChromeDriver](#managing-chromedriver-installations)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:6 +#: ./docs/9.x/dusk.md:6 +#: ./docs/10.x/dusk.md:6 +#: ./docs/11.x/dusk.md:6 +#: ./docs/master/dusk.md:6 msgid "[Using Other Browsers](#using-other-browsers)" -msgstr "[使用其他瀏覽器](#using-other-browsers)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:7 +#: ./docs/9.x/dusk.md:7 +#: ./docs/10.x/dusk.md:7 +#: ./docs/11.x/dusk.md:7 +#: ./docs/master/dusk.md:7 msgid "[Getting Started](#getting-started)" -msgstr "[入門](#getting-started)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:8 +#: ./docs/9.x/dusk.md:8 +#: ./docs/10.x/dusk.md:8 +#: ./docs/11.x/dusk.md:8 +#: ./docs/master/dusk.md:8 msgid "[Generating Tests](#generating-tests)" -msgstr "[產生測試](#generating-tests)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/10.x/dusk.md:9 +#: ./docs/11.x/dusk.md:9 +#: ./docs/master/dusk.md:9 +msgid "[Resetting the Database After Each Test](#resetting-the-database-after-each-test)" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:9 +msgid "[Database Migrations](#migrations)" +msgstr "" + +# P +#: ./docs/9.x/dusk.md:9 msgid "[Resetting The Database After Each Test](#resetting-the-database-after-each-test)" -msgstr "[在每個測試之後重設資料庫](#resetting-the-database-after-each-test)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:10 +#: ./docs/9.x/dusk.md:10 +#: ./docs/10.x/dusk.md:10 +#: ./docs/11.x/dusk.md:10 +#: ./docs/master/dusk.md:10 msgid "[Running Tests](#running-tests)" -msgstr "[執行測試](#running-tests)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:11 +#: ./docs/9.x/dusk.md:11 +#: ./docs/10.x/dusk.md:11 +#: ./docs/11.x/dusk.md:11 +#: ./docs/master/dusk.md:11 msgid "[Environment Handling](#environment-handling)" -msgstr "[處理環境](#environment-handling)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:12 +#: ./docs/9.x/dusk.md:12 +#: ./docs/10.x/dusk.md:12 +#: ./docs/11.x/dusk.md:12 +#: ./docs/master/dusk.md:12 msgid "[Browser Basics](#browser-basics)" -msgstr "[「Browser」基礎](#browser-basics)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:13 +#: ./docs/9.x/dusk.md:13 +#: ./docs/10.x/dusk.md:13 +#: ./docs/11.x/dusk.md:13 +#: ./docs/master/dusk.md:13 msgid "[Creating Browsers](#creating-browsers)" -msgstr "[建立 Browser](#creating-browsers)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:14 +#: ./docs/9.x/dusk.md:14 +#: ./docs/10.x/dusk.md:14 +#: ./docs/11.x/dusk.md:14 +#: ./docs/master/dusk.md:14 msgid "[Navigation](#navigation)" -msgstr "[瀏覽](#navigation)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:15 +#: ./docs/9.x/dusk.md:15 +#: ./docs/10.x/dusk.md:15 +#: ./docs/11.x/dusk.md:15 +#: ./docs/master/dusk.md:15 msgid "[Resizing Browser Windows](#resizing-browser-windows)" -msgstr "[縮放 Browser 視窗](#resizing-browser-windows)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:16 +#: ./docs/9.x/dusk.md:16 +#: ./docs/10.x/dusk.md:16 +#: ./docs/11.x/dusk.md:16 +#: ./docs/master/dusk.md:16 msgid "[Browser Macros](#browser-macros)" -msgstr "[Browser Macro](#browser-macros)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:17 +#: ./docs/9.x/dusk.md:17 +#: ./docs/10.x/dusk.md:17 +#: ./docs/11.x/dusk.md:17 +#: ./docs/master/dusk.md:17 msgid "[Authentication](#authentication)" -msgstr "[身份認證](#authentication)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:18 +#: ./docs/9.x/dusk.md:18 +#: ./docs/10.x/dusk.md:18 +#: ./docs/11.x/dusk.md:18 +#: ./docs/master/dusk.md:18 msgid "[Cookies](#cookies)" -msgstr "[Cookie](#cookies)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:19 +#: ./docs/9.x/dusk.md:19 +#: ./docs/10.x/dusk.md:19 +#: ./docs/11.x/dusk.md:19 +#: ./docs/master/dusk.md:19 msgid "[Executing JavaScript](#executing-javascript)" -msgstr "[執行 JavaScript](#executing-javascript)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/10.x/dusk.md:20 +#: ./docs/11.x/dusk.md:20 +#: ./docs/master/dusk.md:20 +msgid "[Taking a Screenshot](#taking-a-screenshot)" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:20 +#: ./docs/9.x/dusk.md:20 msgid "[Taking A Screenshot](#taking-a-screenshot)" -msgstr "[截圖](#taking-a-screenshot)" +msgstr "" + +# P +#: ./docs/10.x/dusk.md:21 +#: ./docs/11.x/dusk.md:21 +#: ./docs/master/dusk.md:21 +msgid "[Storing Console Output to Disk](#storing-console-output-to-disk)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:21 +#: ./docs/9.x/dusk.md:21 msgid "[Storing Console Output To Disk](#storing-console-output-to-disk)" -msgstr "[將主控台 (Console) 輸出保存至 Disk](#storing-console-output-to-disk)" +msgstr "" + +# P +#: ./docs/10.x/dusk.md:22 +#: ./docs/11.x/dusk.md:22 +#: ./docs/master/dusk.md:22 +msgid "[Storing Page Source to Disk](#storing-page-source-to-disk)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:22 +#: ./docs/9.x/dusk.md:22 msgid "[Storing Page Source To Disk](#storing-page-source-to-disk)" -msgstr "[將頁面原始碼保存至 Disk](#storing-page-source-to-disk)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:23 +#: ./docs/9.x/dusk.md:23 +#: ./docs/10.x/dusk.md:23 +#: ./docs/11.x/dusk.md:23 +#: ./docs/master/dusk.md:23 msgid "[Interacting With Elements](#interacting-with-elements)" -msgstr "[與元素互動](#interacting-with-elements)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:24 +#: ./docs/9.x/dusk.md:24 +#: ./docs/10.x/dusk.md:24 +#: ./docs/11.x/dusk.md:24 +#: ./docs/master/dusk.md:24 msgid "[Dusk Selectors](#dusk-selectors)" -msgstr "[Dusk 選擇器](#dusk-selectors)" +msgstr "" + +# P +#: ./docs/10.x/dusk.md:25 +#: ./docs/11.x/dusk.md:25 +#: ./docs/master/dusk.md:25 +msgid "[Text, Values, and Attributes](#text-values-and-attributes)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:25 +#: ./docs/9.x/dusk.md:25 msgid "[Text, Values, & Attributes](#text-values-and-attributes)" -msgstr "[文字、值、屬性](#text-values-and-attributes)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:26 +#: ./docs/9.x/dusk.md:26 +#: ./docs/10.x/dusk.md:26 +#: ./docs/11.x/dusk.md:26 +#: ./docs/master/dusk.md:26 msgid "[Interacting With Forms](#interacting-with-forms)" -msgstr "[處理表單](#interacting-with-forms)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:27 +#: ./docs/9.x/dusk.md:27 +#: ./docs/10.x/dusk.md:27 +#: ./docs/11.x/dusk.md:27 +#: ./docs/master/dusk.md:27 msgid "[Attaching Files](#attaching-files)" -msgstr "[附加檔案](#attaching-files)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:28 +#: ./docs/9.x/dusk.md:28 +#: ./docs/10.x/dusk.md:28 +#: ./docs/11.x/dusk.md:28 +#: ./docs/master/dusk.md:28 msgid "[Pressing Buttons](#pressing-buttons)" -msgstr "[按下按鈕](#pressing-buttons)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:29 +#: ./docs/9.x/dusk.md:29 +#: ./docs/10.x/dusk.md:29 +#: ./docs/11.x/dusk.md:29 +#: ./docs/master/dusk.md:29 msgid "[Clicking Links](#clicking-links)" -msgstr "[點擊連結](#clicking-links)" +msgstr "" + +# P +#: ./docs/10.x/dusk.md:30 +#: ./docs/11.x/dusk.md:30 +#: ./docs/master/dusk.md:30 +msgid "[Using the Keyboard](#using-the-keyboard)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:30 +#: ./docs/9.x/dusk.md:30 msgid "[Using The Keyboard](#using-the-keyboard)" -msgstr "[使用鍵盤](#using-the-keyboard)" +msgstr "" + +# P +#: ./docs/10.x/dusk.md:31 +#: ./docs/11.x/dusk.md:31 +#: ./docs/master/dusk.md:31 +msgid "[Using the Mouse](#using-the-mouse)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:31 +#: ./docs/9.x/dusk.md:31 msgid "[Using The Mouse](#using-the-mouse)" -msgstr "[使用滑鼠](#using-the-mouse)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:32 +#: ./docs/9.x/dusk.md:32 +#: ./docs/10.x/dusk.md:32 +#: ./docs/11.x/dusk.md:32 +#: ./docs/master/dusk.md:32 msgid "[JavaScript Dialogs](#javascript-dialogs)" -msgstr "[JavaScript 對話方塊](#javascript-dialogs)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/10.x/dusk.md:33 +#: ./docs/11.x/dusk.md:33 +#: ./docs/master/dusk.md:33 msgid "[Interacting With Inline Frames](#interacting-with-iframes)" -msgstr "[處理 IFrame](#interacting-with-iframes)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:33 +#: ./docs/9.x/dusk.md:33 +#: ./docs/10.x/dusk.md:34 +#: ./docs/11.x/dusk.md:34 +#: ./docs/master/dusk.md:34 msgid "[Scoping Selectors](#scoping-selectors)" -msgstr "[限制範圍的選擇器](#scoping-selectors)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:34 +#: ./docs/9.x/dusk.md:34 msgid "[Waiting For Elements](#waiting-for-elements)" -msgstr "[等待元素](#waiting-for-elements)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/10.x/dusk.md:35 +#: ./docs/11.x/dusk.md:35 +#: ./docs/master/dusk.md:35 +msgid "[Waiting for Elements](#waiting-for-elements)" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:35 +#: ./docs/9.x/dusk.md:35 msgid "[Scrolling An Element Into View](#scrolling-an-element-into-view)" -msgstr "[滾動頁面以將元素放入顯式區域](#scrolling-an-element-into-view)" +msgstr "" + +# P +#: ./docs/10.x/dusk.md:36 +#: ./docs/11.x/dusk.md:36 +#: ./docs/master/dusk.md:36 +msgid "[Scrolling an Element Into View](#scrolling-an-element-into-view)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:36 +#: ./docs/9.x/dusk.md:36 +#: ./docs/10.x/dusk.md:37 +#: ./docs/11.x/dusk.md:37 +#: ./docs/master/dusk.md:37 msgid "[Available Assertions](#available-assertions)" -msgstr "[可用的 Assertion](#available-assertions)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:37 +#: ./docs/9.x/dusk.md:37 +#: ./docs/10.x/dusk.md:38 +#: ./docs/11.x/dusk.md:38 +#: ./docs/master/dusk.md:38 msgid "[Pages](#pages)" -msgstr "[Page](#pages)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:38 +#: ./docs/9.x/dusk.md:38 +#: ./docs/10.x/dusk.md:39 +#: ./docs/11.x/dusk.md:39 +#: ./docs/master/dusk.md:39 msgid "[Generating Pages](#generating-pages)" -msgstr "[產生 Page](#generating-pages)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:39 +#: ./docs/9.x/dusk.md:39 +#: ./docs/10.x/dusk.md:40 +#: ./docs/11.x/dusk.md:40 +#: ./docs/master/dusk.md:40 msgid "[Configuring Pages](#configuring-pages)" -msgstr "[設定 Page](#configuring-pages)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:40 +#: ./docs/9.x/dusk.md:40 msgid "[Navigating To Pages](#navigating-to-pages)" -msgstr "[前往 Page](#navigating-to-pages)" +msgstr "" + +# P +#: ./docs/10.x/dusk.md:41 +#: ./docs/11.x/dusk.md:41 +#: ./docs/master/dusk.md:41 +msgid "[Navigating to Pages](#navigating-to-pages)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:41 +#: ./docs/9.x/dusk.md:41 +#: ./docs/10.x/dusk.md:42 +#: ./docs/11.x/dusk.md:42 +#: ./docs/master/dusk.md:42 msgid "[Shorthand Selectors](#shorthand-selectors)" -msgstr "[選擇器簡寫](#shorthand-selectors)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:42 +#: ./docs/9.x/dusk.md:42 +#: ./docs/10.x/dusk.md:43 +#: ./docs/11.x/dusk.md:43 +#: ./docs/master/dusk.md:43 msgid "[Page Methods](#page-methods)" -msgstr "[Page 方法](#page-methods)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:43 +#: ./docs/9.x/dusk.md:43 +#: ./docs/10.x/dusk.md:44 +#: ./docs/11.x/dusk.md:44 +#: ./docs/master/dusk.md:44 msgid "[Components](#components)" -msgstr "[Component (元件)](#components)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:44 +#: ./docs/9.x/dusk.md:44 +#: ./docs/10.x/dusk.md:45 +#: ./docs/11.x/dusk.md:45 +#: ./docs/master/dusk.md:45 msgid "[Generating Components](#generating-components)" -msgstr "[產生 Component](#generating-components)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:45 +#: ./docs/9.x/dusk.md:45 +#: ./docs/10.x/dusk.md:46 +#: ./docs/11.x/dusk.md:46 +#: ./docs/master/dusk.md:46 msgid "[Using Components](#using-components)" -msgstr "[使用 Component](#using-components)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:46 +#: ./docs/9.x/dusk.md:46 +#: ./docs/10.x/dusk.md:47 +#: ./docs/11.x/dusk.md:47 +#: ./docs/master/dusk.md:47 msgid "[Continuous Integration](#continuous-integration)" -msgstr "[持續整合 (Continuous Integration)](#continuous-integration)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:47 +#: ./docs/9.x/dusk.md:47 +#: ./docs/10.x/dusk.md:48 +#: ./docs/11.x/dusk.md:48 +#: ./docs/master/dusk.md:48 msgid "[Heroku CI](#running-tests-on-heroku-ci)" -msgstr "[Heroku CI](#running-tests-on-heroku-ci)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:48 +#: ./docs/9.x/dusk.md:48 +#: ./docs/10.x/dusk.md:49 +#: ./docs/11.x/dusk.md:49 +#: ./docs/master/dusk.md:49 msgid "[Travis CI](#running-tests-on-travis-ci)" -msgstr "[Travis CI](#running-tests-on-travis-ci)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/8.x/dusk.md:49 +#: ./docs/9.x/dusk.md:49 +#: ./docs/10.x/dusk.md:50 +#: ./docs/11.x/dusk.md:50 +#: ./docs/master/dusk.md:50 msgid "[GitHub Actions](#running-tests-on-github-actions)" -msgstr "[GitHub Actions](#running-tests-on-github-actions)" +msgstr "" -#: docs/10.x/dusk.md:block 2 (unordered list) +# P +#: ./docs/10.x/dusk.md:51 +#: ./docs/11.x/dusk.md:51 +#: ./docs/master/dusk.md:51 msgid "[Chipper CI](#running-tests-on-chipper-ci)" -msgstr "[Chipper CI](#running-tests-on-chipper-ci)" +msgstr "" -#: docs/10.x/dusk.md:block 4 (header) +# P +#: ./docs/8.x/dusk.md:51 +#: ./docs/9.x/dusk.md:51 +#: ./docs/10.x/dusk.md:53 +#: ./docs/11.x/dusk.md:53 +#: ./docs/master/dusk.md:53 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/dusk.md:52 +#: ./docs/9.x/dusk.md:52 +#: ./docs/10.x/dusk.md:54 +#: ./docs/11.x/dusk.md:54 +#: ./docs/master/dusk.md:54 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/dusk.md:block 5 (paragraph) +# P +#: ./docs/8.x/dusk.md:54 +#: ./docs/9.x/dusk.md:54 +#: ./docs/10.x/dusk.md:56 +#: ./docs/11.x/dusk.md:56 +#: ./docs/master/dusk.md:56 msgid "[Laravel Dusk](https://github.com/laravel/dusk) provides an expressive, easy-to-use browser automation and testing API. By default, Dusk does not require you to install JDK or Selenium on your local computer. Instead, Dusk uses a standalone [ChromeDriver](https://sites.google.com/chromium.org/driver) installation. However, you are free to utilize any other Selenium compatible driver you wish." -msgstr "[Laravel Dusk](https://github.com/laravel/dusk) 提供了一個豐富、簡單易用的瀏覽器自動化與測試 API。預設情況下,使用 Dusk 不需要額外在本機電腦上安裝 JDK 或 Slenium。Dusk 會使用獨立的 [ChromeDriver](https://sites.google.com/chromium.org/driver) 安裝。不過,也可以自由使用其他 Selenium 相容的驅動器。" +msgstr "" -#: docs/10.x/dusk.md:block 7 (header) +# P +#: ./docs/8.x/dusk.md:56 +#: ./docs/9.x/dusk.md:56 +#: ./docs/10.x/dusk.md:58 +#: ./docs/11.x/dusk.md:58 +#: ./docs/master/dusk.md:58 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/dusk.md:57 +#: ./docs/9.x/dusk.md:57 +#: ./docs/10.x/dusk.md:59 +#: ./docs/11.x/dusk.md:59 +#: ./docs/master/dusk.md:59 msgid "Installation" -msgstr "安裝" +msgstr "" -#: docs/10.x/dusk.md:block 8 (paragraph) +# P +#: ./docs/8.x/dusk.md:59 +#: ./docs/9.x/dusk.md:59 +#: ./docs/10.x/dusk.md:61 +#: ./docs/11.x/dusk.md:61 +#: ./docs/master/dusk.md:61 msgid "To get started, you should install [Google Chrome](https://www.google.com/chrome) and add the `laravel/dusk` Composer dependency to your project:" -msgstr "要開始使用 Dusk,請先安裝 [Google Chrome](https://www.google.com/chrome),並將 `laravel/dusk` Composer 相依性套件加到專案中:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/dusk.md:61 +#: ./docs/9.x/dusk.md:61 +msgid "composer require --dev laravel/dusk" +msgstr "" -#: docs/10.x/dusk.md:block 9 (code) -msgid "composer require --dev laravel/dusk\n" -msgstr "composer require --dev laravel/dusk\n" +# CODE: shell +#: ./docs/10.x/dusk.md:63 +#: ./docs/11.x/dusk.md:63 +#: ./docs/master/dusk.md:63 +msgid "composer require laravel/dusk --dev" +msgstr "" -#: docs/10.x/dusk.md:block 10 (quote) -msgid "**Warning** If you are manually registering Dusk's service provider, you should **never** register it in your production environment, as doing so could lead to arbitrary users being able to authenticate with your application." -msgstr "**Warning** 若要手動註冊 Dusk 的 Service Provider,請**不要**在正式環境內加上該 Provider,因為這麼會讓所有人都能任意登入任何使用者。" +# P +#: ./docs/8.x/dusk.md:63 +#: ./docs/9.x/dusk.md:66 +#: ./docs/10.x/dusk.md:68 +#: ./docs/11.x/dusk.md:68 +#: ./docs/master/dusk.md:68 +msgid "If you are manually registering Dusk's service provider, you should **never** register it in your production environment, as doing so could lead to arbitrary users being able to authenticate with your application." +msgstr "" -#: docs/10.x/dusk.md:block 11 (paragraph) -msgid "After installing the Dusk package, execute the `dusk:install` Artisan command. The `dusk:install` command will create a `tests/Browser` directory, an example Dusk test, and install the Chrome Driver binary for your operating system:" -msgstr "安裝好 Dusk 套件後,請執行 `dusk:install` Artisan 指令。`dusk:install` 指令會建立 `tests/Browser` 目錄、一個 Dusk 範例測試、並安裝適用於你的作業系統的 Chrome Driver 二進位執行檔:" +# P +#: ./docs/8.x/dusk.md:65 +msgid "After installing the Dusk package, execute the `dusk:install` Artisan command. The `dusk:install` command will create a `tests/Browser` directory and an example Dusk test:" +msgstr "" + +# CODE +# CODE: shell +#: ./docs/8.x/dusk.md:67 +#: ./docs/9.x/dusk.md:70 +#: ./docs/10.x/dusk.md:72 +#: ./docs/11.x/dusk.md:72 +#: ./docs/master/dusk.md:72 +msgid "php artisan dusk:install" +msgstr "" -#: docs/10.x/dusk.md:block 12 (code) -msgid "php artisan dusk:install\n" -msgstr "php artisan dusk:install\n" +# P +#: ./docs/9.x/dusk.md:68 +#: ./docs/10.x/dusk.md:70 +#: ./docs/11.x/dusk.md:70 +#: ./docs/master/dusk.md:70 +msgid "After installing the Dusk package, execute the `dusk:install` Artisan command. The `dusk:install` command will create a `tests/Browser` directory, an example Dusk test, and install the Chrome Driver binary for your operating system:" +msgstr "" -#: docs/10.x/dusk.md:block 13 (paragraph) +# P +#: ./docs/8.x/dusk.md:69 +#: ./docs/9.x/dusk.md:74 +#: ./docs/10.x/dusk.md:76 +#: ./docs/11.x/dusk.md:76 +#: ./docs/master/dusk.md:76 msgid "Next, set the `APP_URL` environment variable in your application's `.env` file. This value should match the URL you use to access your application in a browser." -msgstr "接著,請在專案的 `.env` 檔內設定 `APP_URL` 環境變數。該變數應符合要在瀏覽器內存取專案的 URL。" +msgstr "" -#: docs/10.x/dusk.md:block 14 (quote) -msgid "**Note** If you are using [Laravel Sail](/docs/{{version}}/sail) to manage your local development environment, please also consult the Sail documentation on [configuring and running Dusk tests](/docs/{{version}}/sail#laravel-dusk)." -msgstr "**Note** 若使用 [Laravel Sail](/docs/{{version}}/sail) 來管理本機開發環境,也請一併參考 Sail 說明文件中有關[設定與執行 Dusk 測試](/docs/{{version}}/sail#laravel-dusk)的部分。" +# P +#: ./docs/8.x/dusk.md:71 +#: ./docs/9.x/dusk.md:77 +#: ./docs/10.x/dusk.md:79 +#: ./docs/11.x/dusk.md:79 +#: ./docs/master/dusk.md:79 +msgid "If you are using [Laravel Sail](/docs/{{version}}/sail) to manage your local development environment, please also consult the Sail documentation on [configuring and running Dusk tests](/docs/{{version}}/sail#laravel-dusk)." +msgstr "" -#: docs/10.x/dusk.md:block 16 (header) +# P +#: ./docs/8.x/dusk.md:73 +#: ./docs/9.x/dusk.md:79 +#: ./docs/10.x/dusk.md:81 +#: ./docs/11.x/dusk.md:81 +#: ./docs/master/dusk.md:81 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:74 +#: ./docs/9.x/dusk.md:80 +#: ./docs/10.x/dusk.md:82 +#: ./docs/11.x/dusk.md:82 +#: ./docs/master/dusk.md:82 msgid "Managing ChromeDriver Installations" -msgstr "管理 ChromeDriver 安裝" +msgstr "" -#: docs/10.x/dusk.md:block 17 (paragraph) -msgid "If you would like to install a different version of ChromeDriver than what is installed by Laravel Dusk via the `dusk:install` command, you may use the `dusk:chrome-driver` command:" -msgstr "若要安裝與 `dusk:install` 指令所安裝不同的 ChromeDriver 版本,可使用 `dusk:chrome-driver` 指令:" +# P +#: ./docs/8.x/dusk.md:76 +msgid "If you would like to install a different version of ChromeDriver than what is included with Laravel Dusk, you may use the `dusk:chrome-driver` command:" +msgstr "" -#: docs/10.x/dusk.md:block 18 (code) +# CODE +# CODE: shell +#: ./docs/8.x/dusk.md:78 +#: ./docs/9.x/dusk.md:84 +#: ./docs/10.x/dusk.md:86 +#: ./docs/11.x/dusk.md:86 +#: ./docs/master/dusk.md:86 msgid "# Install the latest version of ChromeDriver for your OS...\n" "php artisan dusk:chrome-driver\n\n" "# Install a given version of ChromeDriver for your OS...\n" @@ -268,43 +657,87 @@ msgid "# Install the latest version of ChromeDriver for your OS...\n" "# Install a given version of ChromeDriver for all supported OSs...\n" "php artisan dusk:chrome-driver --all\n\n" "# Install the version of ChromeDriver that matches the detected version of Chrome / Chromium for your OS...\n" -"php artisan dusk:chrome-driver --detect\n" -msgstr "# 為你的作業系統安裝最新版的 ChromeDriver...\n" -"php artisan dusk:chrome-driver\n\n" -"# 為你的作業系統安裝給定版本的 ChromeDriver...\n" -"php artisan dusk:chrome-driver 86\n\n" -"# 為所有支援的作業系統安裝最新版的 ChromeDriver...\n" -"php artisan dusk:chrome-driver --all\n\n" -"# 為你的作業系統安裝符合偵測到的 Chrome / Chromium 版本之 ChromeDriver 版本...\n" -"php artisan dusk:chrome-driver --detect\n" +"php artisan dusk:chrome-driver --detect" +msgstr "" + +# P +#: ./docs/9.x/dusk.md:82 +#: ./docs/10.x/dusk.md:84 +#: ./docs/11.x/dusk.md:84 +#: ./docs/master/dusk.md:84 +msgid "If you would like to install a different version of ChromeDriver than what is installed by Laravel Dusk via the `dusk:install` command, you may use the `dusk:chrome-driver` command:" +msgstr "" -#: docs/10.x/dusk.md:block 19 (quote) -msgid "**Warning** Dusk requires the `chromedriver` binaries to be executable. If you're having problems running Dusk, you should ensure the binaries are executable using the following command: `chmod -R 0755 vendor/laravel/dusk/bin/`." -msgstr "**Warning** 要使用 Dusk,`chromedriver` 二進位執行檔必須可執行。若無法執行 Dusk,請通過下列指令確保該二進位執行檔可執行:`chmod -R 0755 vendor/laravel/dusk/bin/`。" +# P +#: ./docs/8.x/dusk.md:90 +#: ./docs/9.x/dusk.md:99 +#: ./docs/10.x/dusk.md:101 +#: ./docs/11.x/dusk.md:101 +#: ./docs/master/dusk.md:101 +msgid "Dusk requires the `chromedriver` binaries to be executable. If you're having problems running Dusk, you should ensure the binaries are executable using the following command: `chmod -R 0755 vendor/laravel/dusk/bin/`." +msgstr "" -#: docs/10.x/dusk.md:block 21 (header) +# P +#: ./docs/8.x/dusk.md:92 +#: ./docs/9.x/dusk.md:101 +#: ./docs/10.x/dusk.md:103 +#: ./docs/11.x/dusk.md:103 +#: ./docs/master/dusk.md:103 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:93 +#: ./docs/9.x/dusk.md:102 +#: ./docs/10.x/dusk.md:104 +#: ./docs/11.x/dusk.md:104 +#: ./docs/master/dusk.md:104 msgid "Using Other Browsers" -msgstr "使用其他瀏覽器" +msgstr "" -#: docs/10.x/dusk.md:block 22 (paragraph) +# P +#: ./docs/8.x/dusk.md:95 +#: ./docs/9.x/dusk.md:104 +#: ./docs/10.x/dusk.md:106 +#: ./docs/11.x/dusk.md:106 +#: ./docs/master/dusk.md:106 msgid "By default, Dusk uses Google Chrome and a standalone [ChromeDriver](https://sites.google.com/chromium.org/driver) installation to run your browser tests. However, you may start your own Selenium server and run your tests against any browser you wish." -msgstr "預設情況下,Dusk 會使用 Google Chrome 以及一個獨立的 [ChromeDriver](https://sites.google.com/chromium.org/driver) 安裝來執行瀏覽器測試。不過,可以自行開啟 Selenium 伺服器,並使用任何瀏覽器來執行測試。" +msgstr "" -#: docs/10.x/dusk.md:block 23 (paragraph) +# P +#: ./docs/8.x/dusk.md:97 +#: ./docs/9.x/dusk.md:106 +#: ./docs/10.x/dusk.md:108 +#: ./docs/11.x/dusk.md:108 +#: ./docs/master/dusk.md:108 msgid "To get started, open your `tests/DuskTestCase.php` file, which is the base Dusk test case for your application. Within this file, you can remove the call to the `startChromeDriver` method. This will stop Dusk from automatically starting the ChromeDriver:" -msgstr "要開始使用其他瀏覽器,請開啟 `tests/DuskTestCase.php` 檔。這個檔案是專案中所有 Dusk 測試的基礎測試類別。若在該檔案內移除 `startChromeDriver` 方法的呼叫,就可以讓 Dusk 不要自動開啟 ChromeDriver:" +msgstr "" -#: docs/10.x/dusk.md:block 24 (code) +# CODE +#: ./docs/8.x/dusk.md:99 +#: ./docs/8.x/dusk.md:177 +#: ./docs/9.x/dusk.md:108 +#: ./docs/9.x/dusk.md:253 msgid "/**\n" " * Prepare for Dusk test execution.\n" " *\n" " * @beforeClass\n" +" * @return void\n" " */\n" -"public static function prepare(): void\n" +"public static function prepare()\n" "{\n" " // static::startChromeDriver();\n" -"}\n" -msgstr "/**\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:110 +#: ./docs/10.x/dusk.md:272 +#: ./docs/11.x/dusk.md:110 +#: ./docs/11.x/dusk.md:298 +#: ./docs/master/dusk.md:110 +#: ./docs/master/dusk.md:298 +msgid "/**\n" " * Prepare for Dusk test execution.\n" " *\n" " * @beforeClass\n" @@ -312,24 +745,39 @@ msgstr "/**\n" "public static function prepare(): void\n" "{\n" " // static::startChromeDriver();\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/dusk.md:block 25 (paragraph) +# P +#: ./docs/8.x/dusk.md:110 +#: ./docs/9.x/dusk.md:119 +#: ./docs/10.x/dusk.md:120 +#: ./docs/11.x/dusk.md:120 +#: ./docs/master/dusk.md:120 msgid "Next, you may modify the `driver` method to connect to the URL and port of your choice. In addition, you may modify the \"desired capabilities\" that should be passed to the WebDriver:" -msgstr "接著,可以修改 `driver` 方法來連先到所選的 URL 與連結埠。另外,也可以修改應傳給 WebDriver 的「Desired Capabilities (所需功能)」:" +msgstr "" -#: docs/10.x/dusk.md:block 26 (code) -msgid "use Facebook\\WebDriver\\Remote\\RemoteWebDriver;\n\n" -"/**\n" +# CODE +#: ./docs/8.x/dusk.md:112 +#: ./docs/9.x/dusk.md:121 +msgid "/**\n" " * Create the RemoteWebDriver instance.\n" +" *\n" +" * @return \\Facebook\\WebDriver\\Remote\\RemoteWebDriver\n" " */\n" -"protected function driver(): RemoteWebDriver\n" +"protected function driver()\n" "{\n" " return RemoteWebDriver::create(\n" " 'http://localhost:4444/wd/hub', DesiredCapabilities::phantomjs()\n" " );\n" -"}\n" -msgstr "use Facebook\\WebDriver\\Remote\\RemoteWebDriver;\n\n" +"}" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:122 +#: ./docs/11.x/dusk.md:122 +#: ./docs/master/dusk.md:122 +msgid "use Facebook\\WebDriver\\Remote\\RemoteWebDriver;\n\n" "/**\n" " * Create the RemoteWebDriver instance.\n" " */\n" @@ -338,41 +786,83 @@ msgstr "use Facebook\\WebDriver\\Remote\\RemoteWebDriver;\n\n" " return RemoteWebDriver::create(\n" " 'http://localhost:4444/wd/hub', DesiredCapabilities::phantomjs()\n" " );\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/dusk.md:block 28 (header) +# P +#: ./docs/8.x/dusk.md:124 +#: ./docs/9.x/dusk.md:133 +#: ./docs/10.x/dusk.md:134 +#: ./docs/11.x/dusk.md:134 +#: ./docs/master/dusk.md:134 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/dusk.md:125 +#: ./docs/9.x/dusk.md:134 +#: ./docs/10.x/dusk.md:135 +#: ./docs/11.x/dusk.md:135 +#: ./docs/master/dusk.md:135 msgid "Getting Started" -msgstr "入門" +msgstr "" -#: docs/10.x/dusk.md:block 30 (header) +# P +#: ./docs/8.x/dusk.md:127 +#: ./docs/9.x/dusk.md:136 +#: ./docs/10.x/dusk.md:137 +#: ./docs/11.x/dusk.md:137 +#: ./docs/master/dusk.md:137 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:128 +#: ./docs/9.x/dusk.md:137 +#: ./docs/10.x/dusk.md:138 +#: ./docs/11.x/dusk.md:138 +#: ./docs/master/dusk.md:138 msgid "Generating Tests" -msgstr "產生測試" +msgstr "" -#: docs/10.x/dusk.md:block 31 (paragraph) +# P +#: ./docs/8.x/dusk.md:130 +#: ./docs/9.x/dusk.md:139 +#: ./docs/10.x/dusk.md:140 +#: ./docs/11.x/dusk.md:140 +#: ./docs/master/dusk.md:140 msgid "To generate a Dusk test, use the `dusk:make` Artisan command. The generated test will be placed in the `tests/Browser` directory:" -msgstr "若要產生 Dusk 測試,請使用 `dusk:make` Artisan 指令。產生的測試將放置於 `tests/Browser` 目錄內:" - -#: docs/10.x/dusk.md:block 32 (code) -msgid "php artisan dusk:make LoginTest\n" -msgstr "php artisan dusk:make LoginTest\n" +msgstr "" -#: docs/10.x/dusk.md:block 34 (header) -msgid "Resetting The Database After Each Test" -msgstr "在每個測試後重設資料庫" +# CODE +# CODE: shell +#: ./docs/8.x/dusk.md:132 +#: ./docs/9.x/dusk.md:141 +#: ./docs/10.x/dusk.md:142 +#: ./docs/11.x/dusk.md:142 +#: ./docs/master/dusk.md:142 +msgid "php artisan dusk:make LoginTest" +msgstr "" -#: docs/10.x/dusk.md:block 35 (paragraph) -msgid "Most of the tests you write will interact with pages that retrieve data from your application's database; however, your Dusk tests should never use the `RefreshDatabase` trait. The `RefreshDatabase` trait leverages database transactions which will not be applicable or available across HTTP requests. Instead, you have two options: the `DatabaseMigrations` trait and the `DatabaseTruncation` trait." -msgstr "我們要寫的測試大部分都會使用到一些會從資料庫中取得資料的頁面。不過,Dusk 測試不應該使用 `RefreshDatabase` Trait。`RefreshDatabase` Trait 使用的是資料庫 Transaction,而在多個 HTTP 間是沒辦法使用 Trasaction 的。因此,有兩個替代方案:`DatabaseMigrations` Trait 與 `DatabaseTruncation` Trait。" +# P +#: ./docs/8.x/dusk.md:134 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/dusk.md:block 37 (header) -msgid "Using Database Migrations" -msgstr "使用資料庫 Migration" +# H3 +#: ./docs/8.x/dusk.md:135 +msgid "Database Migrations" +msgstr "" -#: docs/10.x/dusk.md:block 38 (paragraph) -msgid "The `DatabaseMigrations` trait will run your database migrations before each test. However, dropping and re-creating your database tables for each test is typically slower than truncating the tables:" -msgstr "`DatabaseMigrations` Trait 會在每個測試前執行資料庫 Migration。不過,在各個測試前 Drop 資料表再重建一次通常會比 ^[Trauncate](截斷) 資料表來得慢:" +# P +#: ./docs/8.x/dusk.md:137 +msgid "Most of the tests you write will interact with pages that retrieve data from your application's database; however, your Dusk tests should never use the `RefreshDatabase `trait. The `RefreshDatabase` trait leverages database transactions which will not be applicable or available across HTTP requests. Instead, use the `DatabaseMigrations` trait, which re-migrates the database for each test:" +msgstr "" -#: docs/10.x/dusk.md:block 39 (code) +# CODE +#: ./docs/8.x/dusk.md:139 +#: ./docs/9.x/dusk.md:155 +#: ./docs/10.x/dusk.md:156 msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/dusk.md:146 +msgid "Resetting The Database After Each Test" +msgstr "" + +# H3 +#: ./docs/10.x/dusk.md:147 +#: ./docs/11.x/dusk.md:147 +#: ./docs/master/dusk.md:147 +msgid "Resetting the Database After Each Test" +msgstr "" + +# P +#: ./docs/9.x/dusk.md:148 +#: ./docs/10.x/dusk.md:149 +#: ./docs/11.x/dusk.md:149 +#: ./docs/master/dusk.md:149 +msgid "Most of the tests you write will interact with pages that retrieve data from your application's database; however, your Dusk tests should never use the `RefreshDatabase` trait. The `RefreshDatabase` trait leverages database transactions which will not be applicable or available across HTTP requests. Instead, you have two options: the `DatabaseMigrations` trait and the `DatabaseTruncation` trait." +msgstr "" + +# P +#: ./docs/9.x/dusk.md:150 +#: ./docs/10.x/dusk.md:151 +#: ./docs/11.x/dusk.md:151 +#: ./docs/master/dusk.md:151 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/dusk.md:151 +#: ./docs/10.x/dusk.md:152 +#: ./docs/11.x/dusk.md:152 +#: ./docs/master/dusk.md:152 +msgid "Using Database Migrations" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:153 +#: ./docs/9.x/dusk.md:170 +#: ./docs/10.x/dusk.md:171 +#: ./docs/11.x/dusk.md:185 +#: ./docs/master/dusk.md:185 +msgid "SQLite in-memory databases may not be used when executing Dusk tests. Since the browser executes within its own process, it will not be able to access the in-memory databases of other processes." +msgstr "" + +# P +#: ./docs/9.x/dusk.md:153 +#: ./docs/10.x/dusk.md:154 +#: ./docs/11.x/dusk.md:154 +#: ./docs/master/dusk.md:154 +msgid "The `DatabaseMigrations` trait will run your database migrations before each test. However, dropping and re-creating your database tables for each test is typically slower than truncating the tables:" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:155 +#: ./docs/9.x/dusk.md:224 +#: ./docs/10.x/dusk.md:243 +#: ./docs/11.x/dusk.md:269 +#: ./docs/master/dusk.md:269 +#~ msgid "" +#~ msgstr "" + +# CODE: php tab=Pest +#: ./docs/11.x/dusk.md:156 +#: ./docs/master/dusk.md:156 +msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/dusk.md:172 +#: ./docs/10.x/dusk.md:173 +#: ./docs/11.x/dusk.md:187 +#: ./docs/master/dusk.md:187 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:173 +#: ./docs/9.x/dusk.md:249 +#: ./docs/10.x/dusk.md:268 +#: ./docs/11.x/dusk.md:294 +#: ./docs/master/dusk.md:294 +msgid "Manually Starting ChromeDriver" +msgstr "" -#: docs/10.x/dusk.md:block 42 (header) +# H4 +#: ./docs/9.x/dusk.md:173 +#: ./docs/10.x/dusk.md:174 +#: ./docs/11.x/dusk.md:188 +#: ./docs/master/dusk.md:188 msgid "Using Database Truncation" -msgstr "使用資料庫 Truncation" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:175 +#: ./docs/9.x/dusk.md:251 +#: ./docs/10.x/dusk.md:270 +#: ./docs/11.x/dusk.md:296 +#: ./docs/master/dusk.md:296 +msgid "By default, Dusk will automatically attempt to start ChromeDriver. If this does not work for your particular system, you may manually start ChromeDriver before running the `dusk` command. If you choose to start ChromeDriver manually, you should comment out the following line of your `tests/DuskTestCase.php` file:" +msgstr "" -#: docs/10.x/dusk.md:block 43 (paragraph) +# P +#: ./docs/9.x/dusk.md:175 +#: ./docs/10.x/dusk.md:176 msgid "Before using the `DatabaseTruncation` trait, you must install the `doctrine/dbal` package using the Composer package manager:" -msgstr "使用 `DatabaseTruncation` Trait 前,需要先使用 Composer 套件管理員安裝 `doctrine/dbal` 套件:" +msgstr "" -#: docs/10.x/dusk.md:block 44 (code) -msgid "composer require --dev doctrine/dbal\n" -msgstr "composer require --dev doctrine/dbal\n" +# CODE: shell +#: ./docs/9.x/dusk.md:177 +#: ./docs/10.x/dusk.md:178 +msgid "composer require --dev doctrine/dbal" +msgstr "" -#: docs/10.x/dusk.md:block 45 (paragraph) +# P +#: ./docs/9.x/dusk.md:181 +#: ./docs/10.x/dusk.md:182 +#: ./docs/11.x/dusk.md:190 +#: ./docs/master/dusk.md:190 msgid "The `DatabaseTruncation` trait will migrate your database on the first test in order to ensure your database tables have been properly created. However, on subsequent tests, the database's tables will simply be truncated - providing a speed boost over re-running all of your database migrations:" -msgstr "`DatabaseTruncation` Trait 會在第一個測試前執行資料庫 Migration,以確保資料庫資料表有被正確建立。接著,在之後的測試中,資料庫的資料表只會被 Truncate,這樣一來比起重新執行所有 Migration 來說會快很多:" +msgstr "" -#: docs/10.x/dusk.md:block 46 (code) +# CODE +#: ./docs/9.x/dusk.md:183 +#: ./docs/10.x/dusk.md:184 msgid "" +#~ msgstr "" + +# CODE: php tab=PHPUnit +#: ./docs/11.x/dusk.md:203 +#: ./docs/master/dusk.md:203 +msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/dusk.md:210 +#: ./docs/9.x/dusk.md:286 +#: ./docs/10.x/dusk.md:304 +#: ./docs/11.x/dusk.md:330 +#: ./docs/master/dusk.md:330 +msgid "Browser Basics" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:212 +#: ./docs/9.x/dusk.md:288 +#: ./docs/10.x/dusk.md:306 +#: ./docs/11.x/dusk.md:332 +#: ./docs/master/dusk.md:332 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:213 +#: ./docs/9.x/dusk.md:289 +#: ./docs/10.x/dusk.md:307 +#: ./docs/11.x/dusk.md:333 +#: ./docs/master/dusk.md:333 +msgid "Creating Browsers" +msgstr "" -#: docs/10.x/dusk.md:block 51 (paragraph) +# P +#: ./docs/8.x/dusk.md:215 +#: ./docs/9.x/dusk.md:291 +#: ./docs/10.x/dusk.md:309 +#: ./docs/11.x/dusk.md:335 +#: ./docs/master/dusk.md:335 +msgid "To get started, let's write a test that verifies we can log into our application. After generating a test, we can modify it to navigate to the login page, enter some credentials, and click the \"Login\" button. To create a browser instance, you may call the `browse` method from within your Dusk test:" +msgstr "" + +# P +#: ./docs/9.x/dusk.md:215 +#: ./docs/10.x/dusk.md:216 +#: ./docs/11.x/dusk.md:242 +#: ./docs/master/dusk.md:242 msgid "To specify the database connections that should have their tables truncated, you may define a `$connectionsToTruncate` property on your test class:" -msgstr "若要指定要 Truncate 資料表的資料庫連線,可在測試類別上定義 `$connectionsToTruncate` 屬性:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:217 +#: ./docs/9.x/dusk.md:293 +msgid "create([\n" +" 'email' => 'taylor@laravel.com',\n" +" ]);\n\n" +" $this->browse(function ($browser) use ($user) {\n" +" $browser->visit('/login')\n" +" ->type('email', $user->email)\n" +" ->type('password', 'password')\n" +" ->press('Login')\n" +" ->assertPathIs('/home');\n" +" });\n" +" }\n" +"}" +msgstr "" -#: docs/10.x/dusk.md:block 52 (code) +# CODE +#: ./docs/9.x/dusk.md:217 +#: ./docs/10.x/dusk.md:218 +#: ./docs/11.x/dusk.md:244 +#: ./docs/master/dusk.md:244 msgid "/**\n" " * Indicates which connections should have their tables truncated.\n" " *\n" " * @var array\n" " */\n" -"protected $connectionsToTruncate = ['mysql'];\n" -msgstr "/**\n" -" * Indicates which connections should have their tables truncated.\n" -" *\n" -" * @var array\n" -" */\n" -"protected $connectionsToTruncate = ['mysql'];\n" +"protected $connectionsToTruncate = ['mysql'];" +msgstr "" + +# P +#: ./docs/11.x/dusk.md:224 +#: ./docs/master/dusk.md:224 +msgid "If you are using Pest, you should define properties or methods on the base `DuskTestCase` class or on any class your test file extends." +msgstr "" -#: docs/10.x/dusk.md:block 53 (paragraph) +# P +#: ./docs/10.x/dusk.md:225 +#: ./docs/11.x/dusk.md:251 +#: ./docs/master/dusk.md:251 msgid "If you would like to execute code before or after database truncation is performed, you may define `beforeTruncatingDatabase` or `afterTruncatingDatabase` methods on your test class:" -msgstr "若想在資料庫修剪 (Truncation) 進行前後執行程式碼,可在測試類別中定義 `beforeTruncatingDatabase` 或 `afterTruncatingDatabase` 方法:" +msgstr "" -#: docs/10.x/dusk.md:block 54 (code) +# CODE +#: ./docs/10.x/dusk.md:227 +#: ./docs/11.x/dusk.md:253 +#: ./docs/master/dusk.md:253 msgid "/**\n" " * Perform any work that should take place before the database has started truncating.\n" " */\n" @@ -508,67 +1377,129 @@ msgid "/**\n" "protected function afterTruncatingDatabase(): void\n" "{\n" " //\n" -"}\n" -msgstr "/**\n" -" * Perform any work that should take place before the database has started truncating.\n" -" */\n" -"protected function beforeTruncatingDatabase(): void\n" -"{\n" -" //\n" -"}\n\n" -"/**\n" -" * Perform any work that should take place after the database has finished truncating.\n" -" */\n" -"protected function afterTruncatingDatabase(): void\n" -"{\n" -" //\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/dusk.md:block 56 (header) -msgid "Running Tests" -msgstr "執行測試" +# P +#: ./docs/9.x/dusk.md:239 +msgid "The `dusk` command accepts any argument that is normally accepted by the PHPUnit test runner, such as allowing you to only run the tests for a given [group](https://phpunit.readthedocs.io/en/9.5/annotations.html#group):" +msgstr "" -#: docs/10.x/dusk.md:block 57 (paragraph) -msgid "To run your browser tests, execute the `dusk` Artisan command:" -msgstr "若要執行瀏覽器測試,請執行 `dusk` Artisan 指令:" +# P +#: ./docs/8.x/dusk.md:251 +#: ./docs/9.x/dusk.md:327 +#: ./docs/10.x/dusk.md:344 +#: ./docs/11.x/dusk.md:395 +#: ./docs/master/dusk.md:395 +msgid "As you can see in the example above, the `browse` method accepts a closure. A browser instance will automatically be passed to this closure by Dusk and is the main object used to interact with and make assertions against your application." +msgstr "" -#: docs/10.x/dusk.md:block 58 (code) -msgid "php artisan dusk\n" -msgstr "php artisan dusk\n" +# P +#: ./docs/8.x/dusk.md:253 +#: ./docs/9.x/dusk.md:329 +#: ./docs/10.x/dusk.md:346 +#: ./docs/11.x/dusk.md:397 +#: ./docs/master/dusk.md:397 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:254 +#: ./docs/9.x/dusk.md:330 +#: ./docs/10.x/dusk.md:347 +#: ./docs/11.x/dusk.md:398 +#: ./docs/master/dusk.md:398 +msgid "Creating Multiple Browsers" +msgstr "" -#: docs/10.x/dusk.md:block 59 (paragraph) -msgid "If you had test failures the last time you ran the `dusk` command, you may save time by re-running the failing tests first using the `dusk:fails` command:" -msgstr "若在上次執行 `dusk` 指令時有測試失敗了,則可以通過 `dusk:fails` 指令來先重新執行失敗的測試以節省時間:" +# P +#: ./docs/8.x/dusk.md:256 +#: ./docs/9.x/dusk.md:332 +#: ./docs/10.x/dusk.md:349 +#: ./docs/11.x/dusk.md:400 +#: ./docs/master/dusk.md:400 +msgid "Sometimes you may need multiple browsers in order to properly carry out a test. For example, multiple browsers may be needed to test a chat screen that interacts with websockets. To create multiple browsers, simply add more browser arguments to the signature of the closure given to the `browse` method:" +msgstr "" -#: docs/10.x/dusk.md:block 60 (code) -msgid "php artisan dusk:fails\n" -msgstr "php artisan dusk:fails\n" +# P +#: ./docs/10.x/dusk.md:258 +msgid "The `dusk` command accepts any argument that is normally accepted by the PHPUnit test runner, such as allowing you to only run the tests for a given [group](https://docs.phpunit.de/en/10.5/annotations.html#group):" +msgstr "" -#: docs/10.x/dusk.md:block 61 (paragraph) -msgid "The `dusk` command accepts any argument that is normally accepted by the PHPUnit test runner, such as allowing you to only run the tests for a given [group](https://phpunit.readthedocs.io/en/10.1/annotations.html#group):" -msgstr "`dusk` 指令接受所有一般 PHPUnit 測試執行程式所接受的引數,如可以只執行特定[群組](https://phpunit.readthedocs.io/en/10.1/annotations.html#group)內的測試:" +# CODE +#: ./docs/8.x/dusk.md:258 +#: ./docs/9.x/dusk.md:334 +msgid "$this->browse(function ($first, $second) {\n" +" $first->loginAs(User::find(1))\n" +" ->visit('/home')\n" +" ->waitForText('Message');\n\n" +" $second->loginAs(User::find(2))\n" +" ->visit('/home')\n" +" ->waitForText('Message')\n" +" ->type('message', 'Hey Taylor')\n" +" ->press('Send');\n\n" +" $first->waitForText('Hey Taylor')\n" +" ->assertSee('Jeffrey Way');\n" +"});" +msgstr "" -#: docs/10.x/dusk.md:block 62 (code) -msgid "php artisan dusk --group=foo\n" -msgstr "php artisan dusk --group=foo\n" +# P +#: ./docs/8.x/dusk.md:273 +#: ./docs/9.x/dusk.md:349 +#: ./docs/10.x/dusk.md:366 +#: ./docs/11.x/dusk.md:417 +#: ./docs/master/dusk.md:417 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:274 +#: ./docs/9.x/dusk.md:350 +#: ./docs/10.x/dusk.md:367 +#: ./docs/11.x/dusk.md:418 +#: ./docs/master/dusk.md:418 +msgid "Navigation" +msgstr "" -#: docs/10.x/dusk.md:block 63 (quote) -msgid "**Note** If you are using [Laravel Sail](/docs/{{version}}/sail) to manage your local development environment, please consult the Sail documentation on [configuring and running Dusk tests](/docs/{{version}}/sail#laravel-dusk)." -msgstr "**Note** 若使用 [Laravel Sail](/docs/{{version}}/sail) 來管理本機開發環境,請參考 Sail 說明文件中有關[設定與執行 Dusk 測試](/docs/{{version}}/sail#laravel-dusk)的部分。" +# P +#: ./docs/8.x/dusk.md:276 +#: ./docs/9.x/dusk.md:352 +#: ./docs/10.x/dusk.md:369 +#: ./docs/11.x/dusk.md:420 +#: ./docs/master/dusk.md:420 +msgid "The `visit` method may be used to navigate to a given URI within your application:" +msgstr "" -#: docs/10.x/dusk.md:block 65 (header) -msgid "Manually Starting ChromeDriver" -msgstr "手動啟動 ChromeDriver" +# CODE +#: ./docs/8.x/dusk.md:278 +#: ./docs/9.x/dusk.md:354 +#: ./docs/10.x/dusk.md:371 +#: ./docs/11.x/dusk.md:422 +#: ./docs/master/dusk.md:422 +msgid "$browser->visit('/login');" +msgstr "" -#: docs/10.x/dusk.md:block 66 (paragraph) -msgid "By default, Dusk will automatically attempt to start ChromeDriver. If this does not work for your particular system, you may manually start ChromeDriver before running the `dusk` command. If you choose to start ChromeDriver manually, you should comment out the following line of your `tests/DuskTestCase.php` file:" -msgstr "預設情況下,Dusk 會自動嘗試開啟 ChromeDriver。若你所使用的系統無法自動開啟 ChromeDriver,則可以在執行 `dusk` 指令前手動啟動 ChromeDriver。若想手動啟動 ChromeDriver,則應先在 `test/DuskTestCase.php` 檔中將下列部分註解掉:" +# P +#: ./docs/8.x/dusk.md:280 +#: ./docs/9.x/dusk.md:356 +#: ./docs/10.x/dusk.md:373 +#: ./docs/11.x/dusk.md:424 +#: ./docs/master/dusk.md:424 +msgid "You may use the `visitRoute` method to navigate to a [named route](/docs/{{version}}/routing#named-routes):" +msgstr "" -#: docs/10.x/dusk.md:block 68 (paragraph) -msgid "In addition, if you start ChromeDriver on a port other than 9515, you should modify the `driver` method of the same class to reflect the correct port:" -msgstr "此外,若在 9515 連結埠以外的其他連結埠上開啟 ChromeDriver,則應在相同類別內修改 `driver` 方法以修改為相應的連結埠:" +# CODE +#: ./docs/8.x/dusk.md:282 +#: ./docs/9.x/dusk.md:358 +#: ./docs/10.x/dusk.md:375 +#: ./docs/master/dusk.md:426 +msgid "$browser->visitRoute('login');" +msgstr "" -#: docs/10.x/dusk.md:block 69 (code) +# CODE +#: ./docs/10.x/dusk.md:284 +#: ./docs/11.x/dusk.md:310 +#: ./docs/master/dusk.md:310 msgid "use Facebook\\WebDriver\\Remote\\RemoteWebDriver;\n\n" "/**\n" " * Create the RemoteWebDriver instance.\n" @@ -578,43 +1509,135 @@ msgid "use Facebook\\WebDriver\\Remote\\RemoteWebDriver;\n\n" " return RemoteWebDriver::create(\n" " 'http://localhost:9515', DesiredCapabilities::chrome()\n" " );\n" -"}\n" -msgstr "use Facebook\\WebDriver\\Remote\\RemoteWebDriver;\n\n" -"/**\n" -" * Create the RemoteWebDriver instance.\n" -" */\n" -"protected function driver(): RemoteWebDriver\n" -"{\n" -" return RemoteWebDriver::create(\n" -" 'http://localhost:9515', DesiredCapabilities::chrome()\n" -" );\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/dusk.md:block 71 (header) -msgid "Environment Handling" -msgstr "處理環境" +# P +#: ./docs/11.x/dusk.md:284 +#: ./docs/master/dusk.md:284 +msgid "The `dusk` command accepts any argument that is normally accepted by the Pest / PHPUnit test runner, such as allowing you to only run the tests for a given [group](https://docs.phpunit.de/en/10.5/annotations.html#group):" +msgstr "" -#: docs/10.x/dusk.md:block 72 (paragraph) -msgid "To force Dusk to use its own environment file when running tests, create a `.env.dusk.{environment}` file in the root of your project. For example, if you will be initiating the `dusk` command from your `local` environment, you should create a `.env.dusk.local` file." -msgstr "若要在執行測試時強制讓 Dusk 使用自己的環境檔,請在專案根目錄下建立一個 `.env.dusk.{environment}` 檔案。舉例來說,若會在 `local` 環境下執行 `dusk`,請建立 `.env.dusk.local` 檔案。" +# P +#: ./docs/8.x/dusk.md:284 +#: ./docs/9.x/dusk.md:360 +#: ./docs/10.x/dusk.md:377 +#: ./docs/11.x/dusk.md:428 +#: ./docs/master/dusk.md:428 +msgid "You may navigate \"back\" and \"forward\" using the `back` and `forward` methods:" +msgstr "" -#: docs/10.x/dusk.md:block 73 (paragraph) -msgid "When running tests, Dusk will back-up your `.env` file and rename your Dusk environment to `.env`. Once the tests have completed, your `.env` file will be restored." -msgstr "執行測試時,Dusk 會備份 `.env` 檔,並將 Dusk 環境檔重新命名為 `.env`。測試完成後,會恢復原本的 `.env` 檔。" +# CODE +#: ./docs/8.x/dusk.md:286 +#: ./docs/9.x/dusk.md:362 +#: ./docs/10.x/dusk.md:379 +#: ./docs/11.x/dusk.md:430 +#: ./docs/master/dusk.md:430 +msgid "$browser->back();\n\n" +"$browser->forward();" +msgstr "" -#: docs/10.x/dusk.md:block 75 (header) -msgid "Browser Basics" -msgstr "「瀏覽器」基礎" +# P +#: ./docs/8.x/dusk.md:290 +#: ./docs/9.x/dusk.md:366 +#: ./docs/10.x/dusk.md:383 +#: ./docs/11.x/dusk.md:434 +#: ./docs/master/dusk.md:434 +msgid "You may use the `refresh` method to refresh the page:" +msgstr "" -#: docs/10.x/dusk.md:block 77 (header) -msgid "Creating Browsers" -msgstr "建立瀏覽器" +# CODE +#: ./docs/8.x/dusk.md:292 +#: ./docs/9.x/dusk.md:368 +#: ./docs/10.x/dusk.md:385 +#: ./docs/11.x/dusk.md:436 +#: ./docs/master/dusk.md:436 +msgid "$browser->refresh();" +msgstr "" -#: docs/10.x/dusk.md:block 78 (paragraph) -msgid "To get started, let's write a test that verifies we can log into our application. After generating a test, we can modify it to navigate to the login page, enter some credentials, and click the \"Login\" button. To create a browser instance, you may call the `browse` method from within your Dusk test:" -msgstr "要開始使用瀏覽器,我們先來建立一個用來認證能否登入網站的測試。產生測試後,我們就可以修改該測試、前往登入頁、輸入帳號密碼、並點擊「登入」按鈕。要建立瀏覽器實體,可在 Dusk 測試內呼叫 `browser` 方法:" +# P +#: ./docs/8.x/dusk.md:294 +#: ./docs/9.x/dusk.md:370 +#: ./docs/10.x/dusk.md:387 +#: ./docs/11.x/dusk.md:438 +#: ./docs/master/dusk.md:438 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:295 +#: ./docs/9.x/dusk.md:371 +#: ./docs/10.x/dusk.md:388 +#: ./docs/11.x/dusk.md:439 +#: ./docs/master/dusk.md:439 +msgid "Resizing Browser Windows" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:297 +#: ./docs/9.x/dusk.md:373 +#: ./docs/10.x/dusk.md:390 +#: ./docs/11.x/dusk.md:441 +#: ./docs/master/dusk.md:441 +msgid "You may use the `resize` method to adjust the size of the browser window:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:299 +#: ./docs/9.x/dusk.md:375 +#: ./docs/10.x/dusk.md:392 +#: ./docs/11.x/dusk.md:443 +#: ./docs/master/dusk.md:443 +msgid "$browser->resize(1920, 1080);" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:301 +#: ./docs/9.x/dusk.md:377 +#: ./docs/10.x/dusk.md:394 +#: ./docs/11.x/dusk.md:445 +#: ./docs/master/dusk.md:445 +msgid "The `maximize` method may be used to maximize the browser window:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:303 +#: ./docs/9.x/dusk.md:379 +#: ./docs/10.x/dusk.md:396 +#: ./docs/11.x/dusk.md:447 +#: ./docs/master/dusk.md:447 +msgid "$browser->maximize();" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:305 +#: ./docs/9.x/dusk.md:381 +#: ./docs/10.x/dusk.md:398 +#: ./docs/11.x/dusk.md:449 +#: ./docs/master/dusk.md:449 +msgid "The `fitContent` method will resize the browser window to match the size of its content:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:307 +#: ./docs/9.x/dusk.md:383 +#: ./docs/10.x/dusk.md:400 +#: ./docs/11.x/dusk.md:451 +#: ./docs/master/dusk.md:451 +msgid "$browser->fitContent();" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:309 +#: ./docs/9.x/dusk.md:385 +#: ./docs/10.x/dusk.md:402 +#: ./docs/11.x/dusk.md:453 +#: ./docs/master/dusk.md:453 +msgid "When a test fails, Dusk will automatically resize the browser to fit the content prior to taking a screenshot. You may disable this feature by calling the `disableFitOnFailure` method within your test:" +msgstr "" -#: docs/10.x/dusk.md:block 79 (code) +# CODE +#: ./docs/10.x/dusk.md:311 msgid "assertPathIs('/home');\n" " });\n" " }\n" -"}\n" -msgstr "disableFitOnFailure();" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:313 +#: ./docs/9.x/dusk.md:389 +#: ./docs/10.x/dusk.md:406 +#: ./docs/11.x/dusk.md:457 +#: ./docs/master/dusk.md:457 +msgid "You may use the `move` method to move the browser window to a different position on your screen:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:315 +#: ./docs/9.x/dusk.md:391 +#: ./docs/10.x/dusk.md:408 +#: ./docs/11.x/dusk.md:459 +#: ./docs/master/dusk.md:459 +msgid "$browser->move($x = 100, $y = 100);" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:317 +#: ./docs/9.x/dusk.md:393 +#: ./docs/10.x/dusk.md:410 +#: ./docs/11.x/dusk.md:461 +#: ./docs/master/dusk.md:461 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:318 +#: ./docs/9.x/dusk.md:394 +#: ./docs/10.x/dusk.md:411 +#: ./docs/11.x/dusk.md:462 +#: ./docs/master/dusk.md:462 +msgid "Browser Macros" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:320 +#: ./docs/9.x/dusk.md:396 +#: ./docs/10.x/dusk.md:413 +#: ./docs/11.x/dusk.md:464 +#: ./docs/master/dusk.md:464 +msgid "If you would like to define a custom browser method that you can re-use in a variety of your tests, you may use the `macro` method on the `Browser` class. Typically, you should call this method from a [service provider's](/docs/{{version}}/providers) `boot` method:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:322 +#: ./docs/9.x/dusk.md:398 +msgid "script(\"$('html, body').animate({ scrollTop: $('$element').offset().top }, 0);\");\n\n" +" return $this;\n" +" });\n" +" }\n" +"}" +msgstr "" + +# CODE: php tab=Pest +#: ./docs/11.x/dusk.md:337 +#: ./docs/master/dusk.md:337 +msgid "create([\n" +" 'email' => 'taylor@laravel.com',\n" +" ]);\n\n" +" $this->browse(function (Browser $browser) use ($user) {\n" +" $browser->visit('/login')\n" +" ->type('email', $user->email)\n" +" ->type('password', 'password')\n" +" ->press('Login')\n" +" ->assertPathIs('/home');\n" +" });\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:346 +#: ./docs/9.x/dusk.md:422 +#: ./docs/10.x/dusk.md:437 +#: ./docs/11.x/dusk.md:488 +#: ./docs/master/dusk.md:488 +msgid "The `macro` function accepts a name as its first argument, and a closure as its second. The macro's closure will be executed when calling the macro as a method on a `Browser` instance:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:348 +#: ./docs/9.x/dusk.md:424 +msgid "$this->browse(function ($browser) use ($user) {\n" +" $browser->visit('/pay')\n" +" ->scrollToElement('#credit-card-details')\n" +" ->assertSee('Enter Credit Card Details');\n" +"});" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:351 +#: ./docs/11.x/dusk.md:402 +#: ./docs/master/dusk.md:402 +msgid "$this->browse(function (Browser $first, Browser $second) {\n" +" $first->loginAs(User::find(1))\n" +" ->visit('/home')\n" +" ->waitForText('Message');\n\n" +" $second->loginAs(User::find(2))\n" +" ->visit('/home')\n" +" ->waitForText('Message')\n" +" ->type('message', 'Hey Taylor')\n" +" ->press('Send');\n\n" +" $first->waitForText('Hey Taylor')\n" +" ->assertSee('Jeffrey Way');\n" +"});" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:354 +#: ./docs/9.x/dusk.md:430 +#: ./docs/10.x/dusk.md:445 +#: ./docs/11.x/dusk.md:496 +#: ./docs/master/dusk.md:496 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:355 +#: ./docs/9.x/dusk.md:431 +#: ./docs/10.x/dusk.md:446 +#: ./docs/11.x/dusk.md:497 +#: ./docs/master/dusk.md:497 +msgid "Authentication" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:357 +#: ./docs/9.x/dusk.md:433 +#: ./docs/10.x/dusk.md:448 +#: ./docs/11.x/dusk.md:499 +#: ./docs/master/dusk.md:499 +msgid "Often, you will be testing pages that require authentication. You can use Dusk's `loginAs` method in order to avoid interacting with your application's login screen during every test. The `loginAs` method accepts a primary key associated with your authenticatable model or an authenticatable model instance:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:359 +#: ./docs/9.x/dusk.md:435 +msgid "use App\\Models\\User;\n\n" +"$this->browse(function ($browser) {\n" +" $browser->loginAs(User::find(1))\n" +" ->visit('/home');\n" +"});" +msgstr "" + +# CODE: php tab=PHPUnit +#: ./docs/11.x/dusk.md:361 +#: ./docs/master/dusk.md:361 +msgid "assertPathIs('/home');\n" " });\n" " }\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/dusk.md:block 80 (paragraph) -msgid "As you can see in the example above, the `browse` method accepts a closure. A browser instance will automatically be passed to this closure by Dusk and is the main object used to interact with and make assertions against your application." -msgstr "如上所見,`browser` 方法接受一個閉包。Dusk 會自動將瀏覽器實體傳入該閉包內,瀏覽器實體是用來與網站互動以及用來進行 Assertion 的主要物件。" +# P +#: ./docs/8.x/dusk.md:366 +#: ./docs/9.x/dusk.md:443 +#: ./docs/10.x/dusk.md:459 +#: ./docs/11.x/dusk.md:510 +#: ./docs/master/dusk.md:510 +msgid "After using the `loginAs` method, the user session will be maintained for all tests within the file." +msgstr "" -#: docs/10.x/dusk.md:block 82 (header) -msgid "Creating Multiple Browsers" -msgstr "建立多個瀏覽器" +# P +#: ./docs/8.x/dusk.md:368 +#: ./docs/9.x/dusk.md:445 +#: ./docs/10.x/dusk.md:461 +#: ./docs/11.x/dusk.md:512 +#: ./docs/master/dusk.md:512 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:369 +#: ./docs/9.x/dusk.md:446 +#: ./docs/10.x/dusk.md:462 +#: ./docs/11.x/dusk.md:513 +#: ./docs/master/dusk.md:513 +msgid "Cookies" +msgstr "" -#: docs/10.x/dusk.md:block 83 (paragraph) -msgid "Sometimes you may need multiple browsers in order to properly carry out a test. For example, multiple browsers may be needed to test a chat screen that interacts with websockets. To create multiple browsers, simply add more browser arguments to the signature of the closure given to the `browse` method:" -msgstr "有時候,我們需要建立多個瀏覽器來正確地進行測試。舉例來說,在測試與 WebSocket 互動的聊天畫面時可能會需要多個瀏覽器。若要建立多個瀏覽器,只需要將多個瀏覽器引數加到提供給 `browser` 方法的閉包上即可:" +# P +#: ./docs/8.x/dusk.md:371 +#: ./docs/9.x/dusk.md:448 +#: ./docs/10.x/dusk.md:464 +#: ./docs/11.x/dusk.md:515 +#: ./docs/master/dusk.md:515 +msgid "You may use the `cookie` method to get or set an encrypted cookie's value. By default, all of the cookies created by Laravel are encrypted:" +msgstr "" -#: docs/10.x/dusk.md:block 84 (code) -msgid "$this->browse(function (Browser $first, Browser $second) {\n" -" $first->loginAs(User::find(1))\n" -" ->visit('/home')\n" -" ->waitForText('Message');\n\n" -" $second->loginAs(User::find(2))\n" -" ->visit('/home')\n" -" ->waitForText('Message')\n" -" ->type('message', 'Hey Taylor')\n" -" ->press('Send');\n\n" -" $first->waitForText('Hey Taylor')\n" -" ->assertSee('Jeffrey Way');\n" -"});\n" -msgstr "$this->browse(function (Browser $first, Browser $second) {\n" -" $first->loginAs(User::find(1))\n" -" ->visit('/home')\n" -" ->waitForText('Message');\n\n" -" $second->loginAs(User::find(2))\n" -" ->visit('/home')\n" -" ->waitForText('Message')\n" -" ->type('message', 'Hey Taylor')\n" -" ->press('Send');\n\n" -" $first->waitForText('Hey Taylor')\n" -" ->assertSee('Jeffrey Way');\n" -"});\n" +# CODE +#: ./docs/8.x/dusk.md:373 +#: ./docs/9.x/dusk.md:450 +#: ./docs/10.x/dusk.md:466 +#: ./docs/11.x/dusk.md:517 +#: ./docs/master/dusk.md:517 +msgid "$browser->cookie('name');\n\n" +"$browser->cookie('name', 'Taylor');" +msgstr "" -#: docs/10.x/dusk.md:block 86 (header) -msgid "Navigation" -msgstr "導航" +# P +#: ./docs/8.x/dusk.md:377 +#: ./docs/9.x/dusk.md:454 +#: ./docs/10.x/dusk.md:470 +#: ./docs/11.x/dusk.md:521 +#: ./docs/master/dusk.md:521 +msgid "You may use the `plainCookie` method to get or set an unencrypted cookie's value:" +msgstr "" -#: docs/10.x/dusk.md:block 87 (paragraph) -msgid "The `visit` method may be used to navigate to a given URI within your application:" -msgstr "`visit` 方法可用來在網站內導航到特定的 URI 上:" +# CODE +#: ./docs/8.x/dusk.md:379 +#: ./docs/9.x/dusk.md:456 +#: ./docs/10.x/dusk.md:472 +#: ./docs/11.x/dusk.md:523 +#: ./docs/master/dusk.md:523 +msgid "$browser->plainCookie('name');\n\n" +"$browser->plainCookie('name', 'Taylor');" +msgstr "" -#: docs/10.x/dusk.md:block 88 (code) -msgid "$browser->visit('/login');\n" -msgstr "$browser->visit('/login');\n" - -#: docs/10.x/dusk.md:block 89 (paragraph) -msgid "You may use the `visitRoute` method to navigate to a [named route](/docs/{{version}}/routing#named-routes):" -msgstr "可以使用 `visitRoute` 方法來導航到[命名路由](/docs/{{version}}/routing#named-routes):" - -#: docs/10.x/dusk.md:block 90 (code) -msgid "$browser->visitRoute('login');\n" -msgstr "$browser->visitRoute('login');\n" - -#: docs/10.x/dusk.md:block 91 (paragraph) -msgid "You may navigate \"back\" and \"forward\" using the `back` and `forward` methods:" -msgstr "可以使用 `back` 與 `forward` 方法來導航到「上一頁」與「下一頁」:" - -#: docs/10.x/dusk.md:block 92 (code) -msgid "$browser->back();\n\n" -"$browser->forward();\n" -msgstr "$browser->back();\n\n" -"$browser->forward();\n" - -#: docs/10.x/dusk.md:block 93 (paragraph) -msgid "You may use the `refresh` method to refresh the page:" -msgstr "可以使用 `refresh` 方法來重新整理頁面:" - -#: docs/10.x/dusk.md:block 94 (code) -msgid "$browser->refresh();\n" -msgstr "$browser->refresh();\n" - -#: docs/10.x/dusk.md:block 96 (header) -msgid "Resizing Browser Windows" -msgstr "縮放瀏覽器視窗" - -#: docs/10.x/dusk.md:block 97 (paragraph) -msgid "You may use the `resize` method to adjust the size of the browser window:" -msgstr "可以使用 `resize` 方法來調整瀏覽器視窗的大小:" - -#: docs/10.x/dusk.md:block 98 (code) -msgid "$browser->resize(1920, 1080);\n" -msgstr "$browser->resize(1920, 1080);\n" +# P +#: ./docs/8.x/dusk.md:383 +#: ./docs/9.x/dusk.md:460 +#: ./docs/10.x/dusk.md:476 +#: ./docs/11.x/dusk.md:527 +#: ./docs/master/dusk.md:527 +msgid "You may use the `deleteCookie` method to delete the given cookie:" +msgstr "" -#: docs/10.x/dusk.md:block 99 (paragraph) -msgid "The `maximize` method may be used to maximize the browser window:" -msgstr "`maximize` 方法可用來最大化瀏覽器視窗:" +# CODE +#: ./docs/8.x/dusk.md:385 +#: ./docs/9.x/dusk.md:462 +#: ./docs/10.x/dusk.md:478 +#: ./docs/11.x/dusk.md:529 +#: ./docs/master/dusk.md:529 +msgid "$browser->deleteCookie('name');" +msgstr "" -#: docs/10.x/dusk.md:block 100 (code) -msgid "$browser->maximize();\n" -msgstr "$browser->maximize();\n" +# P +#: ./docs/8.x/dusk.md:387 +#: ./docs/9.x/dusk.md:464 +#: ./docs/10.x/dusk.md:480 +#: ./docs/11.x/dusk.md:531 +#: ./docs/master/dusk.md:531 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:388 +#: ./docs/9.x/dusk.md:465 +#: ./docs/10.x/dusk.md:481 +#: ./docs/11.x/dusk.md:532 +#: ./docs/master/dusk.md:532 +msgid "Executing JavaScript" +msgstr "" -#: docs/10.x/dusk.md:block 101 (paragraph) -msgid "The `fitContent` method will resize the browser window to match the size of its content:" -msgstr "`fitContent` 方法會將瀏覽器視窗縮放到符合其內容的大小:" +# P +#: ./docs/8.x/dusk.md:390 +#: ./docs/9.x/dusk.md:467 +#: ./docs/10.x/dusk.md:483 +#: ./docs/11.x/dusk.md:534 +#: ./docs/master/dusk.md:534 +msgid "You may use the `script` method to execute arbitrary JavaScript statements within the browser:" +msgstr "" -#: docs/10.x/dusk.md:block 102 (code) -msgid "$browser->fitContent();\n" -msgstr "$browser->fitContent();\n" +# CODE +#: ./docs/8.x/dusk.md:392 +#: ./docs/9.x/dusk.md:469 +#: ./docs/10.x/dusk.md:485 +#: ./docs/11.x/dusk.md:536 +#: ./docs/master/dusk.md:536 +msgid "$browser->script('document.documentElement.scrollTop = 0');\n\n" +"$browser->script([\n" +" 'document.body.scrollTop = 0',\n" +" 'document.documentElement.scrollTop = 0',\n" +"]);\n\n" +"$output = $browser->script('return window.location.pathname');" +msgstr "" -#: docs/10.x/dusk.md:block 103 (paragraph) -msgid "When a test fails, Dusk will automatically resize the browser to fit the content prior to taking a screenshot. You may disable this feature by calling the `disableFitOnFailure` method within your test:" -msgstr "當測試失敗時,Dusk 會自動縮放瀏覽器視窗來符合其內容,以進行截圖。可以通過在測試內呼叫 `disableFitOnFailure` 方法來禁用此功能:" +# P +#: ./docs/8.x/dusk.md:401 +#: ./docs/9.x/dusk.md:478 +#: ./docs/10.x/dusk.md:494 +#: ./docs/11.x/dusk.md:545 +#: ./docs/master/dusk.md:545 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:402 +#: ./docs/9.x/dusk.md:479 +msgid "Taking A Screenshot" +msgstr "" -#: docs/10.x/dusk.md:block 104 (code) -msgid "$browser->disableFitOnFailure();\n" -msgstr "$browser->disableFitOnFailure();\n" +# P +#: ./docs/8.x/dusk.md:404 +#: ./docs/9.x/dusk.md:481 +#: ./docs/10.x/dusk.md:497 +#: ./docs/11.x/dusk.md:548 +#: ./docs/master/dusk.md:548 +msgid "You may use the `screenshot` method to take a screenshot and store it with the given filename. All screenshots will be stored within the `tests/Browser/screenshots` directory:" +msgstr "" -#: docs/10.x/dusk.md:block 105 (paragraph) -msgid "You may use the `move` method to move the browser window to a different position on your screen:" -msgstr "可以使用 `move` 方法來將瀏覽器視窗移動到畫面上的不同位置:" +# CODE +#: ./docs/8.x/dusk.md:406 +#: ./docs/9.x/dusk.md:483 +#: ./docs/10.x/dusk.md:499 +#: ./docs/11.x/dusk.md:550 +#: ./docs/master/dusk.md:550 +msgid "$browser->screenshot('filename');" +msgstr "" -#: docs/10.x/dusk.md:block 106 (code) -msgid "$browser->move($x = 100, $y = 100);\n" -msgstr "$browser->move($x = 100, $y = 100);\n" +# P +#: ./docs/8.x/dusk.md:408 +#: ./docs/9.x/dusk.md:489 +#: ./docs/10.x/dusk.md:505 +#: ./docs/11.x/dusk.md:560 +#: ./docs/master/dusk.md:556 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:409 +#: ./docs/9.x/dusk.md:490 +msgid "Storing Console Output To Disk" +msgstr "" -#: docs/10.x/dusk.md:block 108 (header) -msgid "Browser Macros" -msgstr "瀏覽器 Macro" +# P +#: ./docs/8.x/dusk.md:411 +#: ./docs/9.x/dusk.md:492 +#: ./docs/10.x/dusk.md:508 +#: ./docs/11.x/dusk.md:563 +#: ./docs/master/dusk.md:559 +msgid "You may use the `storeConsoleLog` method to write the current browser's console output to disk with the given filename. Console output will be stored within the `tests/Browser/console` directory:" +msgstr "" -#: docs/10.x/dusk.md:block 109 (paragraph) -msgid "If you would like to define a custom browser method that you can re-use in a variety of your tests, you may use the `macro` method on the `Browser` class. Typically, you should call this method from a [service provider's](/docs/{{version}}/providers) `boot` method:" -msgstr "若想定義可在各個測試內重複使用的自訂瀏覽器方法,可使用 `Browser` 類別上的 `macro` 方法。通常來說,該方法應在某個 [Service Provider](/docs/{{version}}/providers) 的 `boot` 方法內呼叫:" +# CODE +#: ./docs/8.x/dusk.md:413 +#: ./docs/9.x/dusk.md:494 +#: ./docs/10.x/dusk.md:510 +#: ./docs/11.x/dusk.md:565 +#: ./docs/master/dusk.md:561 +msgid "$browser->storeConsoleLog('filename');" +msgstr "" -#: docs/10.x/dusk.md:block 110 (code) +# CODE +#: ./docs/10.x/dusk.md:415 +#: ./docs/11.x/dusk.md:466 +#: ./docs/master/dusk.md:466 msgid "script(\"$('html, body').animate({ scrollTop: $('$element').offset().top }, 0);\");\n\n" -" return $this;\n" -" });\n" -" }\n" -"}\n" - -#: docs/10.x/dusk.md:block 111 (paragraph) -msgid "The `macro` function accepts a name as its first argument, and a closure as its second. The macro's closure will be executed when calling the macro as a method on a `Browser` instance:" -msgstr "`macro` 方法接受一個名稱作為其第一個引數,以及閉包作為其第二個引數。當在 `Browser` 實體上以方法呼叫該 Macro 時,會執行該 Macro 的閉包:" - -#: docs/10.x/dusk.md:block 112 (code) -msgid "$this->browse(function (Browser $browser) use ($user) {\n" -" $browser->visit('/pay')\n" -" ->scrollToElement('#credit-card-details')\n" -" ->assertSee('Enter Credit Card Details');\n" -"});\n" -msgstr "$this->browse(function (Browser $browser) use ($user) {\n" -" $browser->visit('/pay')\n" -" ->scrollToElement('#credit-card-details')\n" -" ->assertSee('Enter Credit Card Details');\n" -"});\n" - -#: docs/10.x/dusk.md:block 114 (header) -msgid "Authentication" -msgstr "登入認證" - -#: docs/10.x/dusk.md:block 115 (paragraph) -msgid "Often, you will be testing pages that require authentication. You can use Dusk's `loginAs` method in order to avoid interacting with your application's login screen during every test. The `loginAs` method accepts a primary key associated with your authenticatable model or an authenticatable model instance:" -msgstr "一般來說,我們會需要測試需要登入的頁面。可以使用 Dusk 的 `loginAs` 方法來避免每個測試都需要處理網站的登入畫面。`loginAs` 方法接受 Authenticatable Model 所關聯的主索引鍵,或是 Authenticatable Model 實體:" - -#: docs/10.x/dusk.md:block 116 (code) -msgid "use App\\Models\\User;\n" -"use Laravel\\Dusk\\Browser;\n\n" -"$this->browse(function (Browser $browser) {\n" -" $browser->loginAs(User::find(1))\n" -" ->visit('/home');\n" -"});\n" -msgstr "use App\\Models\\User;\n" -"use Laravel\\Dusk\\Browser;\n\n" -"$this->browse(function (Browser $browser) {\n" -" $browser->loginAs(User::find(1))\n" -" ->visit('/home');\n" -"});\n" - -#: docs/10.x/dusk.md:block 117 (quote) -msgid "**Warning** After using the `loginAs` method, the user session will be maintained for all tests within the file." -msgstr "**Warning** 使用 `loginAs` 方法後,在該檔案內所有的測試都將使用該使用者 Session。" - -#: docs/10.x/dusk.md:block 119 (header) -msgid "Cookies" -msgstr "Cookie" - -#: docs/10.x/dusk.md:block 120 (paragraph) -msgid "You may use the `cookie` method to get or set an encrypted cookie's value. By default, all of the cookies created by Laravel are encrypted:" -msgstr "可以使用 `cookie` 方法來取得或設定加密的 Cookie 值。預設情況下,Laravel 所建立的所有 Cookie 都是經過加密的:" - -#: docs/10.x/dusk.md:block 121 (code) -msgid "$browser->cookie('name');\n\n" -"$browser->cookie('name', 'Taylor');\n" -msgstr "$browser->cookie('name');\n\n" -"$browser->cookie('name', 'Taylor');\n" - -#: docs/10.x/dusk.md:block 122 (paragraph) -msgid "You may use the `plainCookie` method to get or set an unencrypted cookie's value:" -msgstr "可以使用 `plainCookie` 方法來取得或設定未加密的 Cookie 值:" - -#: docs/10.x/dusk.md:block 123 (code) -msgid "$browser->plainCookie('name');\n\n" -"$browser->plainCookie('name', 'Taylor');\n" -msgstr "$browser->plainCookie('name');\n\n" -"$browser->plainCookie('name', 'Taylor');\n" - -#: docs/10.x/dusk.md:block 124 (paragraph) -msgid "You may use the `deleteCookie` method to delete the given cookie:" -msgstr "可以使用 `deleteCookie` 方法來刪除給定的 Cookie:" - -#: docs/10.x/dusk.md:block 125 (code) -msgid "$browser->deleteCookie('name');\n" -msgstr "$browser->deleteCookie('name');\n" - -#: docs/10.x/dusk.md:block 127 (header) -msgid "Executing JavaScript" -msgstr "執行 JavaScript" - -#: docs/10.x/dusk.md:block 128 (paragraph) -msgid "You may use the `script` method to execute arbitrary JavaScript statements within the browser:" -msgstr "可以使用 `script` 方法來在瀏覽器內執行任意的 JavaScript 陳述式:" - -#: docs/10.x/dusk.md:block 129 (code) -msgid "$browser->script('document.documentElement.scrollTop = 0');\n\n" -"$browser->script([\n" -" 'document.body.scrollTop = 0',\n" -" 'document.documentElement.scrollTop = 0',\n" -"]);\n\n" -"$output = $browser->script('return window.location.pathname');\n" -msgstr "$browser->script('document.documentElement.scrollTop = 0');\n\n" -"$browser->script([\n" -" 'document.body.scrollTop = 0',\n" -" 'document.documentElement.scrollTop = 0',\n" -"]);\n\n" -"$output = $browser->script('return window.location.pathname');\n" - -#: docs/10.x/dusk.md:block 131 (header) -msgid "Taking A Screenshot" -msgstr "截圖" - -#: docs/10.x/dusk.md:block 132 (paragraph) -msgid "You may use the `screenshot` method to take a screenshot and store it with the given filename. All screenshots will be stored within the `tests/Browser/screenshots` directory:" -msgstr "可以使用 `screenshot` 方法來截圖,並將截圖保存為給定的檔案名稱。所有的截圖都會保存在 `tests/Browser/screenshots` 目錄內:" - -#: docs/10.x/dusk.md:block 133 (code) -msgid "$browser->screenshot('filename');\n" -msgstr "$browser->screenshot('filename');\n" - -#: docs/10.x/dusk.md:block 134 (paragraph) -msgid "The `responsiveScreenshots` method may be used to take a series of screenshots at various breakpoints:" -msgstr "`responsiveScreenshots` 方法可用來在各個 ^[Breakpoint](斷點) 上截取一系列的截圖:" - -#: docs/10.x/dusk.md:block 135 (code) -msgid "$browser->responsiveScreenshots('filename');\n" -msgstr "$browser->responsiveScreenshots('filename');\n" - -#: docs/10.x/dusk.md:block 137 (header) -msgid "Storing Console Output To Disk" -msgstr "將主控台輸出保存至磁碟" - -#: docs/10.x/dusk.md:block 138 (paragraph) -msgid "You may use the `storeConsoleLog` method to write the current browser's console output to disk with the given filename. Console output will be stored within the `tests/Browser/console` directory:" -msgstr "可以使用 `storeConsoleLog` 方法來將目前瀏覽器的主控台輸出以給定的檔案名稱寫入到磁碟內。主控台輸出會保存在 `tests/Browser/console` 目錄內:" - -#: docs/10.x/dusk.md:block 139 (code) -msgid "$browser->storeConsoleLog('filename');\n" -msgstr "$browser->storeConsoleLog('filename');\n" +"}" +msgstr "" -#: docs/10.x/dusk.md:block 141 (header) +# P +#: ./docs/8.x/dusk.md:415 +#: ./docs/9.x/dusk.md:496 +#: ./docs/10.x/dusk.md:512 +#: ./docs/11.x/dusk.md:567 +#: ./docs/master/dusk.md:563 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:416 +#: ./docs/9.x/dusk.md:497 msgid "Storing Page Source To Disk" -msgstr "將頁面原始碼儲存至磁碟" +msgstr "" -#: docs/10.x/dusk.md:block 142 (paragraph) +# P +#: ./docs/8.x/dusk.md:418 +#: ./docs/9.x/dusk.md:499 +#: ./docs/10.x/dusk.md:515 +#: ./docs/11.x/dusk.md:570 +#: ./docs/master/dusk.md:566 msgid "You may use the `storeSource` method to write the current page's source to disk with the given filename. The page source will be stored within the `tests/Browser/source` directory:" -msgstr "可以使用 `storeSource` 方法來將目前頁面的原始碼以給定的檔案名稱寫入到磁碟內。頁面原始碼會保存在 `tests/Browser/source` 目錄內:" +msgstr "" -#: docs/10.x/dusk.md:block 143 (code) -msgid "$browser->storeSource('filename');\n" -msgstr "$browser->storeSource('filename');\n" +# CODE +#: ./docs/8.x/dusk.md:420 +#: ./docs/9.x/dusk.md:501 +#: ./docs/10.x/dusk.md:517 +#: ./docs/11.x/dusk.md:572 +#: ./docs/master/dusk.md:568 +msgid "$browser->storeSource('filename');" +msgstr "" -#: docs/10.x/dusk.md:block 145 (header) +# P +#: ./docs/8.x/dusk.md:422 +#: ./docs/9.x/dusk.md:503 +#: ./docs/10.x/dusk.md:519 +#: ./docs/11.x/dusk.md:574 +#: ./docs/master/dusk.md:570 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/dusk.md:423 +#: ./docs/9.x/dusk.md:504 +#: ./docs/10.x/dusk.md:520 +#: ./docs/11.x/dusk.md:575 +#: ./docs/master/dusk.md:571 msgid "Interacting With Elements" -msgstr "與元素互動" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:425 +#: ./docs/9.x/dusk.md:506 +#: ./docs/10.x/dusk.md:522 +#: ./docs/11.x/dusk.md:577 +#: ./docs/master/dusk.md:573 +#~ msgid "" +#~ msgstr "" + +# CODE +#: ./docs/11.x/dusk.md:426 +msgid "$browser->visitRoute($routeName, $parameters);" +msgstr "" -#: docs/10.x/dusk.md:block 147 (header) +# H3 +#: ./docs/8.x/dusk.md:426 +#: ./docs/9.x/dusk.md:507 +#: ./docs/10.x/dusk.md:523 +#: ./docs/11.x/dusk.md:578 +#: ./docs/master/dusk.md:574 msgid "Dusk Selectors" -msgstr "Dusk 選擇器" +msgstr "" -#: docs/10.x/dusk.md:block 148 (paragraph) +# P +#: ./docs/8.x/dusk.md:428 +#: ./docs/9.x/dusk.md:509 +#: ./docs/10.x/dusk.md:525 +#: ./docs/11.x/dusk.md:580 +#: ./docs/master/dusk.md:576 msgid "Choosing good CSS selectors for interacting with elements is one of the hardest parts of writing Dusk tests. Over time, frontend changes can cause CSS selectors like the following to break your tests:" -msgstr "在撰寫 Dusk 測試時,選擇一個好的 CSS 選擇器來與元素互動是最難的一部分。日子一天天過去,當前端有更改時,若有像下列這樣的 CSS 選擇器就有可能讓測試失敗:" +msgstr "" -#: docs/10.x/dusk.md:block 149 (code) +# CODE +#: ./docs/8.x/dusk.md:430 +#: ./docs/9.x/dusk.md:511 +#: ./docs/10.x/dusk.md:527 +#: ./docs/11.x/dusk.md:582 +#: ./docs/master/dusk.md:578 msgid "// HTML...\n\n" "\n\n" "// Test...\n\n" -"$browser->click('.login-page .container div > button');\n" -msgstr "// HTML...\n\n" -"\n\n" -"// 測試...\n\n" -"$browser->click('.login-page .container div > button');\n" +"$browser->click('.login-page .container div > button');" +msgstr "" -#: docs/10.x/dusk.md:block 150 (paragraph) +# P +#: ./docs/8.x/dusk.md:438 +#: ./docs/9.x/dusk.md:519 +#: ./docs/10.x/dusk.md:535 +#: ./docs/11.x/dusk.md:590 +#: ./docs/master/dusk.md:586 msgid "Dusk selectors allow you to focus on writing effective tests rather than remembering CSS selectors. To define a selector, add a `dusk` attribute to your HTML element. Then, when interacting with a Dusk browser, prefix the selector with `@` to manipulate the attached element within your test:" -msgstr "使用 Dusk 選擇器,就能讓開發人員更專注於撰寫有效的測試,而不是記住 CSS 選擇器。若要定義選擇請,請在 HTML 元素內加上 `dusk` 屬性。接著,當與 Dusk 瀏覽器互動時,請在該選擇器前方加上 `@` 來在測試內操作該元素:" +msgstr "" -#: docs/10.x/dusk.md:block 151 (code) +# CODE +#: ./docs/10.x/dusk.md:439 +#: ./docs/11.x/dusk.md:490 +#: ./docs/master/dusk.md:490 +msgid "$this->browse(function (Browser $browser) use ($user) {\n" +" $browser->visit('/pay')\n" +" ->scrollToElement('#credit-card-details')\n" +" ->assertSee('Enter Credit Card Details');\n" +"});" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:440 +#: ./docs/9.x/dusk.md:521 +#: ./docs/10.x/dusk.md:537 +#: ./docs/11.x/dusk.md:592 +#: ./docs/master/dusk.md:588 msgid "// HTML...\n\n" "\n\n" "// Test...\n\n" -"$browser->click('@login-button');\n" -msgstr "// HTML...\n\n" -"\n\n" -"// 測試...\n\n" -"$browser->click('@login-button');\n" - -#: docs/10.x/dusk.md:block 152 (paragraph) -msgid "If desired, you may customize the HTML attribute that the Dusk selector utilizes via the `selectorHtmlAttribute` method. Typically, this method should be called from the `boot` method of your application's `AppServiceProvider`:" -msgstr "若有需要,可以使用 `selectorHtmlAttribute` 方法來自定 Dusk Selector 使用的 HTML 屬性。一般來說,應在專案中 `AppServiceProvider` 內 `boot` 方法中呼叫該方法:" - -#: docs/10.x/dusk.md:block 153 (code) -msgid "use Laravel\\Dusk\\Dusk;\n\n" -"Dusk::selectorHtmlAttribute('data-dusk');\n" -msgstr "use Laravel\\Dusk\\Dusk;\n\n" -"Dusk::selectorHtmlAttribute('data-dusk');\n" +"$browser->click('@login-button');" +msgstr "" -#: docs/10.x/dusk.md:block 155 (header) +# P +#: ./docs/8.x/dusk.md:448 +#: ./docs/9.x/dusk.md:529 +#: ./docs/10.x/dusk.md:551 +#: ./docs/11.x/dusk.md:606 +#: ./docs/master/dusk.md:602 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:449 +#: ./docs/9.x/dusk.md:530 msgid "Text, Values, & Attributes" -msgstr "文字、值、與屬性" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:450 +#: ./docs/11.x/dusk.md:501 +#: ./docs/master/dusk.md:501 +msgid "use App\\Models\\User;\n" +"use Laravel\\Dusk\\Browser;\n\n" +"$this->browse(function (Browser $browser) {\n" +" $browser->loginAs(User::find(1))\n" +" ->visit('/home');\n" +"});" +msgstr "" -#: docs/10.x/dusk.md:block 157 (header) +# P +#: ./docs/8.x/dusk.md:451 +#: ./docs/9.x/dusk.md:532 +#: ./docs/10.x/dusk.md:554 +#: ./docs/11.x/dusk.md:609 +#: ./docs/master/dusk.md:605 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:452 +#: ./docs/9.x/dusk.md:533 msgid "Retrieving & Setting Values" -msgstr "取得與設定值" +msgstr "" -#: docs/10.x/dusk.md:block 158 (paragraph) +# P +#: ./docs/8.x/dusk.md:454 +#: ./docs/9.x/dusk.md:535 +#: ./docs/10.x/dusk.md:557 +#: ./docs/11.x/dusk.md:612 +#: ./docs/master/dusk.md:608 msgid "Dusk provides several methods for interacting with the current value, display text, and attributes of elements on the page. For example, to get the \"value\" of an element that matches a given CSS or Dusk selector, use the `value` method:" -msgstr "Dusk 內提供了數種可與目前頁面上元素的值、顯示文字、與屬性互動的方法。舉例來說,若要在某個符合給定 CSS 或 Dusk 選擇器的元素上取得該元素的「值 (Value)」,可使用 `value` 方法:" +msgstr "" -#: docs/10.x/dusk.md:block 159 (code) +# CODE +#: ./docs/8.x/dusk.md:456 +#: ./docs/9.x/dusk.md:537 +#: ./docs/10.x/dusk.md:559 +#: ./docs/11.x/dusk.md:614 +#: ./docs/master/dusk.md:610 msgid "// Retrieve the value...\n" "$value = $browser->value('selector');\n\n" "// Set the value...\n" -"$browser->value('selector', 'value');\n" -msgstr "// 取值...\n" -"$value = $browser->value('selector');\n\n" -"// 賦值...\n" -"$browser->value('selector', 'value');\n" +"$browser->value('selector', 'value');" +msgstr "" -#: docs/10.x/dusk.md:block 160 (paragraph) +# P +#: ./docs/8.x/dusk.md:462 +#: ./docs/9.x/dusk.md:543 +#: ./docs/10.x/dusk.md:565 +#: ./docs/11.x/dusk.md:620 +#: ./docs/master/dusk.md:616 msgid "You may use the `inputValue` method to get the \"value\" of an input element that has a given field name:" -msgstr "可以使用 `inputValue` 方法來取得某個給定欄位名稱之 input 元素的「值 (Value)」:" +msgstr "" -#: docs/10.x/dusk.md:block 161 (code) -msgid "$value = $browser->inputValue('field');\n" -msgstr "$value = $browser->inputValue('field');\n" +# CODE +#: ./docs/8.x/dusk.md:464 +#: ./docs/9.x/dusk.md:545 +#: ./docs/10.x/dusk.md:567 +#: ./docs/11.x/dusk.md:622 +#: ./docs/master/dusk.md:618 +msgid "$value = $browser->inputValue('field');" +msgstr "" -#: docs/10.x/dusk.md:block 163 (header) +# P +#: ./docs/8.x/dusk.md:466 +#: ./docs/9.x/dusk.md:547 +#: ./docs/10.x/dusk.md:569 +#: ./docs/11.x/dusk.md:624 +#: ./docs/master/dusk.md:620 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:467 +#: ./docs/9.x/dusk.md:548 +#: ./docs/10.x/dusk.md:570 +#: ./docs/11.x/dusk.md:625 +#: ./docs/master/dusk.md:621 msgid "Retrieving Text" -msgstr "取得文字" +msgstr "" -#: docs/10.x/dusk.md:block 164 (paragraph) +# P +#: ./docs/8.x/dusk.md:469 +#: ./docs/9.x/dusk.md:550 +#: ./docs/10.x/dusk.md:572 +#: ./docs/11.x/dusk.md:627 +#: ./docs/master/dusk.md:623 msgid "The `text` method may be used to retrieve the display text of an element that matches the given selector:" -msgstr "可使用 `text` 方法來取得符合給定選擇器之元素的顯示文字:" +msgstr "" -#: docs/10.x/dusk.md:block 165 (code) -msgid "$text = $browser->text('selector');\n" -msgstr "$text = $browser->text('selector');\n" +# CODE +#: ./docs/8.x/dusk.md:471 +#: ./docs/9.x/dusk.md:552 +#: ./docs/10.x/dusk.md:574 +#: ./docs/11.x/dusk.md:629 +#: ./docs/master/dusk.md:625 +msgid "$text = $browser->text('selector');" +msgstr "" -#: docs/10.x/dusk.md:block 167 (header) +# P +#: ./docs/8.x/dusk.md:473 +#: ./docs/9.x/dusk.md:554 +#: ./docs/10.x/dusk.md:576 +#: ./docs/11.x/dusk.md:631 +#: ./docs/master/dusk.md:627 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:474 +#: ./docs/9.x/dusk.md:555 +#: ./docs/10.x/dusk.md:577 +#: ./docs/11.x/dusk.md:632 +#: ./docs/master/dusk.md:628 msgid "Retrieving Attributes" -msgstr "取得屬性" +msgstr "" -#: docs/10.x/dusk.md:block 168 (paragraph) +# P +#: ./docs/8.x/dusk.md:476 +#: ./docs/9.x/dusk.md:557 +#: ./docs/10.x/dusk.md:579 +#: ./docs/11.x/dusk.md:634 +#: ./docs/master/dusk.md:630 msgid "Finally, the `attribute` method may be used to retrieve the value of an attribute of an element matching the given selector:" -msgstr "最後,可使用 `attribute` 方法來取得符合給定選擇器之元素的屬性值:" +msgstr "" -#: docs/10.x/dusk.md:block 169 (code) -msgid "$attribute = $browser->attribute('selector', 'value');\n" -msgstr "$attribute = $browser->attribute('selector', 'value');\n" +# CODE +#: ./docs/8.x/dusk.md:478 +#: ./docs/9.x/dusk.md:559 +#: ./docs/10.x/dusk.md:581 +#: ./docs/11.x/dusk.md:636 +#: ./docs/master/dusk.md:632 +msgid "$attribute = $browser->attribute('selector', 'value');" +msgstr "" -#: docs/10.x/dusk.md:block 171 (header) +# P +#: ./docs/8.x/dusk.md:480 +#: ./docs/9.x/dusk.md:561 +#: ./docs/10.x/dusk.md:583 +#: ./docs/11.x/dusk.md:638 +#: ./docs/master/dusk.md:634 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:481 +#: ./docs/9.x/dusk.md:562 +#: ./docs/10.x/dusk.md:584 +#: ./docs/11.x/dusk.md:639 +#: ./docs/master/dusk.md:635 msgid "Interacting With Forms" -msgstr "與表單互動" +msgstr "" -#: docs/10.x/dusk.md:block 173 (header) +# P +#: ./docs/8.x/dusk.md:483 +#: ./docs/9.x/dusk.md:564 +#: ./docs/10.x/dusk.md:586 +#: ./docs/11.x/dusk.md:641 +#: ./docs/master/dusk.md:637 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:484 +#: ./docs/9.x/dusk.md:565 +#: ./docs/10.x/dusk.md:587 +#: ./docs/11.x/dusk.md:642 +#: ./docs/master/dusk.md:638 msgid "Typing Values" -msgstr "鍵入值" +msgstr "" + +# P +#: ./docs/9.x/dusk.md:485 +#: ./docs/10.x/dusk.md:501 +#: ./docs/11.x/dusk.md:552 +#: ./docs/master/dusk.md:552 +msgid "The `responsiveScreenshots` method may be used to take a series of screenshots at various breakpoints:" +msgstr "" -#: docs/10.x/dusk.md:block 174 (paragraph) +# P +#: ./docs/8.x/dusk.md:486 +#: ./docs/9.x/dusk.md:567 +#: ./docs/10.x/dusk.md:589 +#: ./docs/11.x/dusk.md:644 +#: ./docs/master/dusk.md:640 msgid "Dusk provides a variety of methods for interacting with forms and input elements. First, let's take a look at an example of typing text into an input field:" -msgstr "Dusk 提供了多種與表單以及 Input 元素互動的方法。首先,來看看一個在 Input 欄位內鍵入文字的例子:" +msgstr "" + +# CODE +#: ./docs/9.x/dusk.md:487 +#: ./docs/10.x/dusk.md:503 +#: ./docs/11.x/dusk.md:554 +#: ./docs/master/dusk.md:554 +msgid "$browser->responsiveScreenshots('filename');" +msgstr "" -#: docs/10.x/dusk.md:block 175 (code) -msgid "$browser->type('email', 'taylor@laravel.com');\n" -msgstr "$browser->type('email', 'taylor@laravel.com');\n" +# CODE +#: ./docs/8.x/dusk.md:488 +#: ./docs/9.x/dusk.md:569 +#: ./docs/10.x/dusk.md:591 +#: ./docs/11.x/dusk.md:646 +#: ./docs/master/dusk.md:642 +msgid "$browser->type('email', 'taylor@laravel.com');" +msgstr "" -#: docs/10.x/dusk.md:block 176 (paragraph) +# P +#: ./docs/8.x/dusk.md:490 +#: ./docs/9.x/dusk.md:571 +#: ./docs/10.x/dusk.md:593 +#: ./docs/11.x/dusk.md:648 +#: ./docs/master/dusk.md:644 msgid "Note that, although the method accepts one if necessary, we are not required to pass a CSS selector into the `type` method. If a CSS selector is not provided, Dusk will search for an `input` or `textarea` field with the given `name` attribute." -msgstr "請注意這裡,雖然可將 CSS 選擇器傳入 `type` 方法,但並不需特別傳入。若未提供 CSS 選擇器,則 Dusk 會搜尋符合給定 `name` 屬性的 `input` 或 `textarea` 欄位。" +msgstr "" -#: docs/10.x/dusk.md:block 177 (paragraph) +# P +#: ./docs/8.x/dusk.md:492 +#: ./docs/9.x/dusk.md:573 +#: ./docs/10.x/dusk.md:595 +#: ./docs/11.x/dusk.md:650 +#: ./docs/master/dusk.md:646 msgid "To append text to a field without clearing its content, you may use the `append` method:" -msgstr "若要在不將其原本內容清除的情況下將文字附加在最後面,可以使用 `append` 方法:" +msgstr "" -#: docs/10.x/dusk.md:block 178 (code) +# CODE +#: ./docs/8.x/dusk.md:494 +#: ./docs/9.x/dusk.md:575 +#: ./docs/10.x/dusk.md:597 +#: ./docs/11.x/dusk.md:652 +#: ./docs/master/dusk.md:648 msgid "$browser->type('tags', 'foo')\n" -" ->append('tags', ', bar, baz');\n" -msgstr "$browser->type('tags', 'foo')\n" -" ->append('tags', ', bar, baz');\n" +" ->append('tags', ', bar, baz');" +msgstr "" -#: docs/10.x/dusk.md:block 179 (paragraph) +# H3 +#: ./docs/10.x/dusk.md:495 +#: ./docs/11.x/dusk.md:546 +#: ./docs/master/dusk.md:546 +msgid "Taking a Screenshot" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:497 +#: ./docs/9.x/dusk.md:578 +#: ./docs/10.x/dusk.md:600 +#: ./docs/11.x/dusk.md:655 +#: ./docs/master/dusk.md:651 msgid "You may clear the value of an input using the `clear` method:" -msgstr "可以使用 `clear` 方法來清除某個 Input 的值:" +msgstr "" -#: docs/10.x/dusk.md:block 180 (code) -msgid "$browser->clear('email');\n" -msgstr "$browser->clear('email');\n" +# CODE +#: ./docs/8.x/dusk.md:499 +#: ./docs/9.x/dusk.md:580 +#: ./docs/10.x/dusk.md:602 +#: ./docs/11.x/dusk.md:657 +#: ./docs/master/dusk.md:653 +msgid "$browser->clear('email');" +msgstr "" -#: docs/10.x/dusk.md:block 181 (paragraph) +# P +#: ./docs/8.x/dusk.md:501 +#: ./docs/9.x/dusk.md:582 +#: ./docs/10.x/dusk.md:604 +#: ./docs/11.x/dusk.md:659 +#: ./docs/master/dusk.md:655 msgid "You can instruct Dusk to type slowly using the `typeSlowly` method. By default, Dusk will pause for 100 milliseconds between key presses. To customize the amount of time between key presses, you may pass the appropriate number of milliseconds as the third argument to the method:" -msgstr "可以使用 `typeSlowly` 方法來讓 Dusk 輸入得慢一點。預設情況下,Dusk 會在每個按鍵間暫停 100 毫秒。若要自訂按鍵按下間的時間,可將適當的毫秒數作為第三個引數傳給該方法:" +msgstr "" -#: docs/10.x/dusk.md:block 182 (code) +# CODE +#: ./docs/8.x/dusk.md:503 +#: ./docs/9.x/dusk.md:584 +#: ./docs/10.x/dusk.md:606 +#: ./docs/11.x/dusk.md:661 +#: ./docs/master/dusk.md:657 msgid "$browser->typeSlowly('mobile', '+1 (202) 555-5555');\n\n" -"$browser->typeSlowly('mobile', '+1 (202) 555-5555', 300);\n" -msgstr "$browser->typeSlowly('mobile', '+1 (202) 555-5555');\n\n" -"$browser->typeSlowly('mobile', '+1 (202) 555-5555', 300);\n" +"$browser->typeSlowly('mobile', '+1 (202) 555-5555', 300);" +msgstr "" + +# H3 +#: ./docs/10.x/dusk.md:506 +#: ./docs/11.x/dusk.md:561 +#: ./docs/master/dusk.md:557 +msgid "Storing Console Output to Disk" +msgstr "" -#: docs/10.x/dusk.md:block 183 (paragraph) +# P +#: ./docs/8.x/dusk.md:507 +#: ./docs/9.x/dusk.md:588 +#: ./docs/10.x/dusk.md:610 +#: ./docs/11.x/dusk.md:665 +#: ./docs/master/dusk.md:661 msgid "You may use the `appendSlowly` method to append text slowly:" -msgstr "可以使用 `appendSlowly` 方法來慢慢地將文字附加到最後:" +msgstr "" -#: docs/10.x/dusk.md:block 184 (code) +# CODE +#: ./docs/8.x/dusk.md:509 +#: ./docs/9.x/dusk.md:590 +#: ./docs/10.x/dusk.md:612 +#: ./docs/11.x/dusk.md:667 +#: ./docs/master/dusk.md:663 msgid "$browser->type('tags', 'foo')\n" -" ->appendSlowly('tags', ', bar, baz');\n" -msgstr "$browser->type('tags', 'foo')\n" -" ->appendSlowly('tags', ', bar, baz');\n" +" ->appendSlowly('tags', ', bar, baz');" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:512 +#: ./docs/9.x/dusk.md:593 +#: ./docs/10.x/dusk.md:615 +#: ./docs/11.x/dusk.md:670 +#: ./docs/master/dusk.md:666 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/dusk.md:513 +#: ./docs/11.x/dusk.md:568 +#: ./docs/master/dusk.md:564 +msgid "Storing Page Source to Disk" +msgstr "" -#: docs/10.x/dusk.md:block 186 (header) +# H4 +#: ./docs/8.x/dusk.md:513 +#: ./docs/9.x/dusk.md:594 +#: ./docs/10.x/dusk.md:616 +#: ./docs/11.x/dusk.md:671 +#: ./docs/master/dusk.md:667 msgid "Dropdowns" -msgstr "下拉選單" +msgstr "" -#: docs/10.x/dusk.md:block 187 (paragraph) +# P +#: ./docs/8.x/dusk.md:515 +#: ./docs/9.x/dusk.md:596 +#: ./docs/10.x/dusk.md:618 +#: ./docs/11.x/dusk.md:673 +#: ./docs/master/dusk.md:669 msgid "To select a value available on a `select` element, you may use the `select` method. Like the `type` method, the `select` method does not require a full CSS selector. When passing a value to the `select` method, you should pass the underlying option value instead of the display text:" -msgstr "若要在 `select` 元素上選擇可用的值,可使用 `select` 方法。與 `type` 方法類似,`select` 方法並不要求要提供完整的 CSS 選擇器。將值傳給 `select` 方法時,應傳入底層的選項值而非顯示的文字:" +msgstr "" -#: docs/10.x/dusk.md:block 188 (code) -msgid "$browser->select('size', 'Large');\n" -msgstr "$browser->select('size', 'Large');\n" +# CODE +#: ./docs/8.x/dusk.md:517 +#: ./docs/9.x/dusk.md:598 +#: ./docs/10.x/dusk.md:620 +#: ./docs/11.x/dusk.md:675 +#: ./docs/master/dusk.md:671 +msgid "$browser->select('size', 'Large');" +msgstr "" -#: docs/10.x/dusk.md:block 189 (paragraph) +# P +#: ./docs/8.x/dusk.md:519 +#: ./docs/9.x/dusk.md:600 +#: ./docs/10.x/dusk.md:622 +#: ./docs/11.x/dusk.md:677 +#: ./docs/master/dusk.md:673 msgid "You may select a random option by omitting the second argument:" -msgstr "也可以通過省略第二個引數來隨機選擇選項:" +msgstr "" -#: docs/10.x/dusk.md:block 190 (code) -msgid "$browser->select('size');\n" -msgstr "$browser->select('size');\n" +# CODE +#: ./docs/8.x/dusk.md:521 +#: ./docs/9.x/dusk.md:602 +#: ./docs/10.x/dusk.md:624 +#: ./docs/11.x/dusk.md:679 +#: ./docs/master/dusk.md:675 +msgid "$browser->select('size');" +msgstr "" -#: docs/10.x/dusk.md:block 191 (paragraph) +# P +#: ./docs/8.x/dusk.md:523 +#: ./docs/9.x/dusk.md:604 +#: ./docs/10.x/dusk.md:626 +#: ./docs/11.x/dusk.md:681 +#: ./docs/master/dusk.md:677 msgid "By providing an array as the second argument to the `select` method, you can instruct the method to select multiple options:" -msgstr "在 `select` 方法的第二個引數中使用陣列,就可以選擇多個選項:" +msgstr "" -#: docs/10.x/dusk.md:block 192 (code) -msgid "$browser->select('categories', ['Art', 'Music']);\n" -msgstr "$browser->select('categories', ['Art', 'Music']);\n" +# CODE +#: ./docs/8.x/dusk.md:525 +#: ./docs/9.x/dusk.md:606 +#: ./docs/10.x/dusk.md:628 +#: ./docs/11.x/dusk.md:683 +#: ./docs/master/dusk.md:679 +msgid "$browser->select('categories', ['Art', 'Music']);" +msgstr "" -#: docs/10.x/dusk.md:block 194 (header) +# P +#: ./docs/8.x/dusk.md:527 +#: ./docs/9.x/dusk.md:608 +#: ./docs/10.x/dusk.md:630 +#: ./docs/11.x/dusk.md:685 +#: ./docs/master/dusk.md:681 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:528 +#: ./docs/9.x/dusk.md:609 +#: ./docs/10.x/dusk.md:631 +#: ./docs/11.x/dusk.md:686 +#: ./docs/master/dusk.md:682 msgid "Checkboxes" -msgstr "多選框" +msgstr "" -#: docs/10.x/dusk.md:block 195 (paragraph) +# P +#: ./docs/8.x/dusk.md:530 +#: ./docs/9.x/dusk.md:611 +#: ./docs/10.x/dusk.md:633 +#: ./docs/11.x/dusk.md:688 +#: ./docs/master/dusk.md:684 msgid "To \"check\" a checkbox input, you may use the `check` method. Like many other input related methods, a full CSS selector is not required. If a CSS selector match can't be found, Dusk will search for a checkbox with a matching `name` attribute:" -msgstr "若要「勾選」多選框,可使用 `check` 方法。與其他 Input 有關的方法類似,並不需要傳入完整的 CSS 選擇器。若找不到對應的 CSS 選擇器,Dusk 會自動搜尋符合 `name` 屬性的多選框:" +msgstr "" -#: docs/10.x/dusk.md:block 196 (code) -msgid "$browser->check('terms');\n" -msgstr "$browser->check('terms');\n" +# CODE +#: ./docs/8.x/dusk.md:532 +#: ./docs/9.x/dusk.md:613 +#: ./docs/10.x/dusk.md:635 +#: ./docs/11.x/dusk.md:690 +#: ./docs/master/dusk.md:686 +msgid "$browser->check('terms');" +msgstr "" -#: docs/10.x/dusk.md:block 197 (paragraph) +# P +#: ./docs/8.x/dusk.md:534 +#: ./docs/9.x/dusk.md:615 +#: ./docs/10.x/dusk.md:637 +#: ./docs/11.x/dusk.md:692 +#: ./docs/master/dusk.md:688 msgid "The `uncheck` method may be used to \"uncheck\" a checkbox input:" -msgstr "可使用 `uncheck` 方法來「取消勾選」多選框:" +msgstr "" -#: docs/10.x/dusk.md:block 198 (code) -msgid "$browser->uncheck('terms');\n" -msgstr "$browser->uncheck('terms');\n" +# CODE +#: ./docs/8.x/dusk.md:536 +#: ./docs/9.x/dusk.md:617 +#: ./docs/10.x/dusk.md:639 +#: ./docs/11.x/dusk.md:694 +#: ./docs/master/dusk.md:690 +msgid "$browser->uncheck('terms');" +msgstr "" -#: docs/10.x/dusk.md:block 200 (header) +# P +#: ./docs/8.x/dusk.md:538 +#: ./docs/9.x/dusk.md:619 +#: ./docs/10.x/dusk.md:641 +#: ./docs/11.x/dusk.md:696 +#: ./docs/master/dusk.md:692 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:539 +#: ./docs/9.x/dusk.md:620 +#: ./docs/10.x/dusk.md:642 +#: ./docs/11.x/dusk.md:697 +#: ./docs/master/dusk.md:693 msgid "Radio Buttons" -msgstr "單選框" +msgstr "" -#: docs/10.x/dusk.md:block 201 (paragraph) +# P +#: ./docs/8.x/dusk.md:541 +#: ./docs/9.x/dusk.md:622 +#: ./docs/10.x/dusk.md:644 +#: ./docs/11.x/dusk.md:699 +#: ./docs/master/dusk.md:695 msgid "To \"select\" a `radio` input option, you may use the `radio` method. Like many other input related methods, a full CSS selector is not required. If a CSS selector match can't be found, Dusk will search for a `radio` input with matching `name` and `value` attributes:" -msgstr "若要「勾選」`radio` 單選框,可使用 `check` 方法。與其他 Input 有關的方法類似,並不需要傳入完整的 CSS 選擇器。若找不到對應的 CSS 選擇器,Dusk 會自動搜尋符合 `name` 屬性的 `radio` 單選框:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:543 +#: ./docs/9.x/dusk.md:624 +#: ./docs/10.x/dusk.md:646 +#: ./docs/11.x/dusk.md:701 +#: ./docs/master/dusk.md:697 +msgid "$browser->radio('size', 'large');" +msgstr "" -#: docs/10.x/dusk.md:block 202 (code) -msgid "$browser->radio('size', 'large');\n" -msgstr "$browser->radio('size', 'large');\n" +# P +#: ./docs/10.x/dusk.md:545 +#: ./docs/11.x/dusk.md:600 +#: ./docs/master/dusk.md:596 +msgid "If desired, you may customize the HTML attribute that the Dusk selector utilizes via the `selectorHtmlAttribute` method. Typically, this method should be called from the `boot` method of your application's `AppServiceProvider`:" +msgstr "" -#: docs/10.x/dusk.md:block 204 (header) +# P +#: ./docs/8.x/dusk.md:545 +#: ./docs/9.x/dusk.md:626 +#: ./docs/10.x/dusk.md:648 +#: ./docs/11.x/dusk.md:703 +#: ./docs/master/dusk.md:699 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:546 +#: ./docs/9.x/dusk.md:627 +#: ./docs/10.x/dusk.md:649 +#: ./docs/11.x/dusk.md:704 +#: ./docs/master/dusk.md:700 msgid "Attaching Files" -msgstr "附加檔案" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:547 +#: ./docs/11.x/dusk.md:602 +#: ./docs/master/dusk.md:598 +msgid "use Laravel\\Dusk\\Dusk;\n\n" +"Dusk::selectorHtmlAttribute('data-dusk');" +msgstr "" -#: docs/10.x/dusk.md:block 205 (paragraph) +# P +#: ./docs/8.x/dusk.md:548 +#: ./docs/9.x/dusk.md:629 +#: ./docs/10.x/dusk.md:651 +#: ./docs/11.x/dusk.md:706 +#: ./docs/master/dusk.md:702 msgid "The `attach` method may be used to attach a file to a `file` input element. Like many other input related methods, a full CSS selector is not required. If a CSS selector match can't be found, Dusk will search for a `file` input with a matching `name` attribute:" -msgstr "可使用 `attach` 方法來將檔案附加到 `file` Input 元素上。與其他 Input 有關的方法類似,並不需要傳入完整的 CSS 選擇器。若找不到對應的 CSS 選擇器,Dusk 會自動搜尋符合 `name` 屬性的 `file` Input:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:550 +#: ./docs/9.x/dusk.md:631 +#: ./docs/10.x/dusk.md:653 +#: ./docs/11.x/dusk.md:708 +#: ./docs/master/dusk.md:704 +msgid "$browser->attach('photo', __DIR__.'/photos/mountains.png');" +msgstr "" + +# H3 +#: ./docs/10.x/dusk.md:552 +#: ./docs/11.x/dusk.md:607 +#: ./docs/master/dusk.md:603 +msgid "Text, Values, and Attributes" +msgstr "" -#: docs/10.x/dusk.md:block 206 (code) -msgid "$browser->attach('photo', __DIR__.'/photos/mountains.png');\n" -msgstr "$browser->attach('photo', __DIR__.'/photos/mountains.png');\n" +# P +#: ./docs/8.x/dusk.md:552 +#: ./docs/9.x/dusk.md:634 +#: ./docs/10.x/dusk.md:656 +#: ./docs/11.x/dusk.md:711 +#: ./docs/master/dusk.md:707 +msgid "The attach function requires the `Zip` PHP extension to be installed and enabled on your server." +msgstr "" -#: docs/10.x/dusk.md:block 207 (quote) -msgid "**Warning** The attach function requires the `Zip` PHP extension to be installed and enabled on your server." -msgstr "**Warning** 要使用 attach 函式,伺服器上必須有安裝 `Zip` PHP 擴充套件並已啟用。" +# P +#: ./docs/8.x/dusk.md:554 +#: ./docs/9.x/dusk.md:636 +#: ./docs/10.x/dusk.md:658 +#: ./docs/11.x/dusk.md:713 +#: ./docs/master/dusk.md:709 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/dusk.md:555 +#: ./docs/11.x/dusk.md:610 +#: ./docs/master/dusk.md:606 +msgid "Retrieving and Setting Values" +msgstr "" -#: docs/10.x/dusk.md:block 209 (header) +# H3 +#: ./docs/8.x/dusk.md:555 +#: ./docs/9.x/dusk.md:637 +#: ./docs/10.x/dusk.md:659 +#: ./docs/11.x/dusk.md:714 +#: ./docs/master/dusk.md:710 msgid "Pressing Buttons" -msgstr "按下按鈕" +msgstr "" -#: docs/10.x/dusk.md:block 210 (paragraph) -msgid "The `press` method may be used to click a button element on the page. The argument given to the `press` method may be either the display text of the button or a CSS / Dusk selector:" -msgstr "`press` 方法可用來點擊頁面上的按鈕元素。傳給 `press` 方法的引數可以是按鈕的顯示文字,也可以是 CSS / Dusk 選擇器:" +# P +#: ./docs/11.x/dusk.md:556 +msgid "The `screenshotElement` method may be used to take a screenshot of a specific element on the page:" +msgstr "" -#: docs/10.x/dusk.md:block 211 (code) -msgid "$browser->press('Login');\n" -msgstr "$browser->press('Login');\n" +# P +#: ./docs/8.x/dusk.md:557 +msgid "The `press` method may be used to click a button element on the page. The first argument given to the `press` method may be either the display text of the button or a CSS / Dusk selector:" +msgstr "" -#: docs/10.x/dusk.md:block 212 (paragraph) -msgid "When submitting forms, many applications disable the form's submission button after it is pressed and then re-enable the button when the form submission's HTTP request is complete. To press a button and wait for the button to be re-enabled, you may use the `pressAndWaitFor` method:" -msgstr "在送出表單時,許多網站會在按鈕按下的時候禁用表單的送出按鈕,並在表單送出的 HTTP 請求完成後重新啟用該按鈕。若要按下按鈕並等待該按鈕重新啟用,可使用 `pressAndWaitFor` 方法:" +# CODE +#: ./docs/11.x/dusk.md:558 +msgid "$browser->screenshotElement('#selector', 'filename');" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:559 +#: ./docs/9.x/dusk.md:641 +#: ./docs/10.x/dusk.md:663 +#: ./docs/11.x/dusk.md:718 +#: ./docs/master/dusk.md:714 +msgid "$browser->press('Login');" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:561 +msgid "When submitting forms, many application's disable the form's submission button after it is pressed and then re-enable the button when the form submission's HTTP request is complete. To press a button and wait for the button to be re-enabled, you may use the `pressAndWaitFor` method:" +msgstr "" -#: docs/10.x/dusk.md:block 213 (code) +# CODE +#: ./docs/8.x/dusk.md:563 +#: ./docs/9.x/dusk.md:645 +#: ./docs/10.x/dusk.md:667 +#: ./docs/11.x/dusk.md:722 +#: ./docs/master/dusk.md:718 msgid "// Press the button and wait a maximum of 5 seconds for it to be enabled...\n" "$browser->pressAndWaitFor('Save');\n\n" "// Press the button and wait a maximum of 1 second for it to be enabled...\n" -"$browser->pressAndWaitFor('Save', 1);\n" -msgstr "// 按下按鈕,並等待該按鈕啟用,最多 5 秒...\n" -"$browser->pressAndWaitFor('Save');\n\n" -"// 按下按鈕,並等待該按鈕啟用,最多 1 秒...\n" -"$browser->pressAndWaitFor('Save', 1);\n" +"$browser->pressAndWaitFor('Save', 1);" +msgstr "" -#: docs/10.x/dusk.md:block 215 (header) +# P +#: ./docs/8.x/dusk.md:569 +#: ./docs/9.x/dusk.md:651 +#: ./docs/10.x/dusk.md:673 +#: ./docs/11.x/dusk.md:728 +#: ./docs/master/dusk.md:724 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:570 +#: ./docs/9.x/dusk.md:652 +#: ./docs/10.x/dusk.md:674 +#: ./docs/11.x/dusk.md:729 +#: ./docs/master/dusk.md:725 msgid "Clicking Links" -msgstr "點擊連結" +msgstr "" -#: docs/10.x/dusk.md:block 216 (paragraph) +# P +#: ./docs/8.x/dusk.md:572 +#: ./docs/9.x/dusk.md:654 +#: ./docs/10.x/dusk.md:676 +#: ./docs/11.x/dusk.md:731 +#: ./docs/master/dusk.md:727 msgid "To click a link, you may use the `clickLink` method on the browser instance. The `clickLink` method will click the link that has the given display text:" -msgstr "若要點擊連結,可使用瀏覽器實體上的 `clickLink` 方法。`clickLink` 方法會點擊有給定顯示文字的連結:" +msgstr "" -#: docs/10.x/dusk.md:block 217 (code) -msgid "$browser->clickLink($linkText);\n" -msgstr "$browser->clickLink($linkText);\n" +# CODE +#: ./docs/8.x/dusk.md:574 +#: ./docs/9.x/dusk.md:656 +#: ./docs/10.x/dusk.md:678 +#: ./docs/11.x/dusk.md:733 +#: ./docs/master/dusk.md:729 +msgid "$browser->clickLink($linkText);" +msgstr "" -#: docs/10.x/dusk.md:block 218 (paragraph) +# P +#: ./docs/8.x/dusk.md:576 +#: ./docs/9.x/dusk.md:658 +#: ./docs/10.x/dusk.md:680 +#: ./docs/11.x/dusk.md:735 +#: ./docs/master/dusk.md:731 msgid "You may use the `seeLink` method to determine if a link with the given display text is visible on the page:" -msgstr "可使用 `seeLink` 方法來判斷給定的顯示文字是否在頁面上可見:" +msgstr "" -#: docs/10.x/dusk.md:block 219 (code) +# CODE +#: ./docs/8.x/dusk.md:578 +#: ./docs/9.x/dusk.md:660 +#: ./docs/10.x/dusk.md:682 +#: ./docs/11.x/dusk.md:737 +#: ./docs/master/dusk.md:733 msgid "if ($browser->seeLink($linkText)) {\n" " // ...\n" -"}\n" -msgstr "if ($browser->seeLink($linkText)) {\n" -" // ...\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/dusk.md:block 220 (quote) -msgid "**Warning** These methods interact with jQuery. If jQuery is not available on the page, Dusk will automatically inject it into the page so it is available for the test's duration." -msgstr "**Warning** 該方法需要與 jQuery 互動。若頁面上沒有 jQuery 可用,則 Dusk 會自動將 jQuery 插入到頁面上以在測試期間使用。" +# P +#: ./docs/8.x/dusk.md:582 +#: ./docs/9.x/dusk.md:665 +#: ./docs/10.x/dusk.md:687 +#: ./docs/11.x/dusk.md:742 +#: ./docs/master/dusk.md:738 +msgid "These methods interact with jQuery. If jQuery is not available on the page, Dusk will automatically inject it into the page so it is available for the test's duration." +msgstr "" -#: docs/10.x/dusk.md:block 222 (header) +# P +#: ./docs/8.x/dusk.md:584 +#: ./docs/9.x/dusk.md:667 +#: ./docs/10.x/dusk.md:689 +#: ./docs/11.x/dusk.md:744 +#: ./docs/master/dusk.md:740 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:585 +#: ./docs/9.x/dusk.md:668 msgid "Using The Keyboard" -msgstr "使用鍵盤" +msgstr "" -#: docs/10.x/dusk.md:block 223 (paragraph) +# P +#: ./docs/8.x/dusk.md:587 +#: ./docs/9.x/dusk.md:670 +#: ./docs/10.x/dusk.md:692 +#: ./docs/11.x/dusk.md:747 +#: ./docs/master/dusk.md:743 msgid "The `keys` method allows you to provide more complex input sequences to a given element than normally allowed by the `type` method. For example, you may instruct Dusk to hold modifier keys while entering values. In this example, the `shift` key will be held while `taylor` is entered into the element matching the given selector. After `taylor` is typed, `swift` will be typed without any modifier keys:" -msgstr "比起使用一般的 `type` 方法,`keys` 方法提供了可對給定元素進行一系列更複雜輸入的能力。舉例來說,可以讓 Dusk 在輸入數值的時候按著某個輔助按鍵。在這個範例中,於符合給定選擇器的元素內輸入 `taylor` 文字時,會按著 `Shift` 鍵。輸入完 `taylor` 後,`swift` 會在不按下任何輔助按鍵的情況下輸入:" +msgstr "" -#: docs/10.x/dusk.md:block 224 (code) -msgid "$browser->keys('selector', ['{shift}', 'taylor'], 'swift');\n" -msgstr "$browser->keys('selector', ['{shift}', 'taylor'], 'swift');\n" +# CODE +#: ./docs/8.x/dusk.md:589 +#: ./docs/9.x/dusk.md:672 +#: ./docs/10.x/dusk.md:694 +#: ./docs/11.x/dusk.md:749 +#: ./docs/master/dusk.md:745 +msgid "$browser->keys('selector', ['{shift}', 'taylor'], 'swift');" +msgstr "" -#: docs/10.x/dusk.md:block 225 (paragraph) +# P +#: ./docs/8.x/dusk.md:591 +#: ./docs/9.x/dusk.md:674 +#: ./docs/10.x/dusk.md:696 +#: ./docs/11.x/dusk.md:751 +#: ./docs/master/dusk.md:747 msgid "Another valuable use case for the `keys` method is sending a \"keyboard shortcut\" combination to the primary CSS selector for your application:" -msgstr "`keys` 方法的另一個實用用途是給主要 CSS 選擇器傳送一組「鍵盤快捷鍵」:" +msgstr "" -#: docs/10.x/dusk.md:block 226 (code) -msgid "$browser->keys('.app', ['{command}', 'j']);\n" -msgstr "$browser->keys('.app', ['{command}', 'j']);\n" +# CODE +#: ./docs/8.x/dusk.md:593 +#: ./docs/9.x/dusk.md:676 +#: ./docs/10.x/dusk.md:698 +#: ./docs/11.x/dusk.md:753 +#: ./docs/master/dusk.md:749 +msgid "$browser->keys('.app', ['{command}', 'j']);" +msgstr "" -#: docs/10.x/dusk.md:block 227 (quote) -msgid "**Note** All modifier keys such as `{command}` are wrapped in `{}` characters, and match the constants defined in the `Facebook\\WebDriver\\WebDriverKeys` class, which can be [found on GitHub](https://github.com/php-webdriver/php-webdriver/blob/master/lib/WebDriverKeys.php)." -msgstr "**Note** 所有的輔助按鍵,如 `{command}` 都以 `{}` 字元來進行包裝,且符合 `Facebook\\WebDriver\\WebDriverKeys` 中所定義的常數值。可[在 GitHub 上找到](https://github.com/php-webdriver/php-webdriver/blob/master/lib/WebDriverKeys.php)這些常數值。" +# P +#: ./docs/8.x/dusk.md:595 +#: ./docs/9.x/dusk.md:679 +#: ./docs/10.x/dusk.md:701 +#: ./docs/11.x/dusk.md:756 +#: ./docs/master/dusk.md:752 +msgid "All modifier keys such as `{command}` are wrapped in `{}` characters, and match the constants defined in the `Facebook\\WebDriver\\WebDriverKeys` class, which can be [found on GitHub](https://github.com/php-webdriver/php-webdriver/blob/master/lib/WebDriverKeys.php)." +msgstr "" -#: docs/10.x/dusk.md:block 229 (header) -msgid "Fluent Keyboard Interactions" -msgstr "流暢地使用鍵盤" +# P +#: ./docs/8.x/dusk.md:597 +#: ./docs/9.x/dusk.md:681 +#: ./docs/10.x/dusk.md:763 +#: ./docs/11.x/dusk.md:818 +#: ./docs/master/dusk.md:814 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:598 +#: ./docs/9.x/dusk.md:682 +msgid "Using The Mouse" +msgstr "" -#: docs/10.x/dusk.md:block 230 (paragraph) -msgid "Dusk also provides a `withKeyboard` method, allowing you to fluently perform complex keyboard interactions via the `Laravel\\Dusk\\Keyboard` class. The `Keyboard` class provides `press`, `release`, `type`, and `pause` methods:" -msgstr "Dusk 還提供了一個 `withKeyboard` 方法,讓你能使用 `Laravel\\Dusk\\Keyboard` 類別來流暢地進行複雜的鍵盤動作。`Keyboard` 類別提供了 `press`, `release`, `type` 與 `pause` 方法:" +# P +#: ./docs/8.x/dusk.md:600 +#: ./docs/9.x/dusk.md:684 +#: ./docs/10.x/dusk.md:766 +#: ./docs/11.x/dusk.md:821 +#: ./docs/master/dusk.md:817 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:601 +#: ./docs/9.x/dusk.md:685 +msgid "Clicking On Elements" +msgstr "" -#: docs/10.x/dusk.md:block 231 (code) -msgid "use Laravel\\Dusk\\Keyboard;\n\n" -"$browser->withKeyboard(function (Keyboard $keyboard) {\n" -" $keyboard->press('c')\n" -" ->pause(1000)\n" -" ->release('c')\n" -" ->type(['c', 'e', 'o']);\n" -"});\n" -msgstr "use Laravel\\Dusk\\Keyboard;\n\n" -"$browser->withKeyboard(function (Keyboard $keyboard) {\n" -" $keyboard->press('c')\n" -" ->pause(1000)\n" -" ->release('c')\n" -" ->type(['c', 'e', 'o']);\n" -"});\n" - -#: docs/10.x/dusk.md:block 233 (header) -msgid "Keyboard Macros" -msgstr "鍵盤巨集" - -#: docs/10.x/dusk.md:block 234 (paragraph) -msgid "If you would like to define custom keyboard interactions that you can easily re-use throughout your test suite, you may use the `macro` method provided by the `Keyboard` class. Typically, you should call this method from a [service provider's](/docs/{{version}}/providers) `boot` method:" -msgstr "若想定義可在各個測試內重複使用的自訂鍵盤動作,可使用 `Keyboard` 類別上的 `macro` 方法。一半來說,該方法應在某個 [Service Provider](/docs/{{version}}/providers) 的 `boot` 方法內呼叫:" - -#: docs/10.x/dusk.md:block 235 (code) -msgid "type([\n" -" OperatingSystem::onMac() ? WebDriverKeys::META : WebDriverKeys::CONTROL, 'c',\n" -" ]);\n\n" -" return $this;\n" -" });\n\n" -" Keyboard::macro('paste', function (string $element = null) {\n" -" $this->type([\n" -" OperatingSystem::onMac() ? WebDriverKeys::META : WebDriverKeys::CONTROL, 'v',\n" -" ]);\n\n" -" return $this;\n" -" });\n" -" }\n" -"}\n" -msgstr "type([\n" -" OperatingSystem::onMac() ? WebDriverKeys::META : WebDriverKeys::CONTROL, 'c',\n" -" ]);\n\n" -" return $this;\n" -" });\n\n" -" Keyboard::macro('paste', function (string $element = null) {\n" -" $this->type([\n" -" OperatingSystem::onMac() ? WebDriverKeys::META : WebDriverKeys::CONTROL, 'v',\n" -" ]);\n\n" -" return $this;\n" -" });\n" -" }\n" -"}\n" - -#: docs/10.x/dusk.md:block 236 (paragraph) -msgid "The `macro` function accepts a name as its first argument and a closure as its second. The macro's closure will be executed when calling the macro as a method on a `Keyboard` instance:" -msgstr "`macro` 方法接受一個名稱作為其第一個引數,以及閉包作為其第二個引數。當在 `Keyboard` 實體上以方法呼叫該 Macro 時,會執行該 Macro 的閉包:" - -#: docs/10.x/dusk.md:block 237 (code) -msgid "$browser->click('@textarea')\n" -" ->withKeyboard(fn (Keyboard $keyboard) => $keyboard->copy())\n" -" ->click('@another-textarea')\n" -" ->withKeyboard(fn (Keyboard $keyboard) => $keyboard->paste());\n" -msgstr "$browser->click('@textarea')\n" -" ->withKeyboard(fn (Keyboard $keyboard) => $keyboard->copy())\n" -" ->click('@another-textarea')\n" -" ->withKeyboard(fn (Keyboard $keyboard) => $keyboard->paste());\n" - -#: docs/10.x/dusk.md:block 239 (header) -msgid "Using The Mouse" -msgstr "使用滑鼠" - -#: docs/10.x/dusk.md:block 241 (header) -msgid "Clicking On Elements" -msgstr "點擊元素" - -#: docs/10.x/dusk.md:block 242 (paragraph) +# P +#: ./docs/8.x/dusk.md:603 +#: ./docs/9.x/dusk.md:687 +#: ./docs/10.x/dusk.md:769 +#: ./docs/11.x/dusk.md:824 +#: ./docs/master/dusk.md:820 msgid "The `click` method may be used to click on an element matching the given CSS or Dusk selector:" -msgstr "可使用 `click` 方法來點擊符合給定 CSS 或 Dusk 選擇器的元素:" +msgstr "" -#: docs/10.x/dusk.md:block 243 (code) -msgid "$browser->click('.selector');\n" -msgstr "$browser->click('.selector');\n" +# CODE +#: ./docs/8.x/dusk.md:605 +#: ./docs/9.x/dusk.md:689 +#: ./docs/10.x/dusk.md:771 +#: ./docs/11.x/dusk.md:826 +#: ./docs/master/dusk.md:822 +msgid "$browser->click('.selector');" +msgstr "" -#: docs/10.x/dusk.md:block 244 (paragraph) +# P +#: ./docs/8.x/dusk.md:607 +#: ./docs/9.x/dusk.md:691 +#: ./docs/10.x/dusk.md:773 +#: ./docs/11.x/dusk.md:828 +#: ./docs/master/dusk.md:824 msgid "The `clickAtXPath` method may be used to click on an element matching the given XPath expression:" -msgstr "可使用 `clickAtXPath` 方法來點擊符合給定 XPath 運算式的元素:" +msgstr "" -#: docs/10.x/dusk.md:block 245 (code) -msgid "$browser->clickAtXPath('//div[@class = \"selector\"]');\n" -msgstr "$browser->clickAtXPath('//div[@class = \"selector\"]');\n" +# CODE +#: ./docs/8.x/dusk.md:609 +#: ./docs/9.x/dusk.md:693 +#: ./docs/10.x/dusk.md:775 +#: ./docs/11.x/dusk.md:830 +#: ./docs/master/dusk.md:826 +msgid "$browser->clickAtXPath('//div[@class = \"selector\"]');" +msgstr "" -#: docs/10.x/dusk.md:block 246 (paragraph) +# P +#: ./docs/8.x/dusk.md:611 +#: ./docs/9.x/dusk.md:695 +#: ./docs/10.x/dusk.md:777 +#: ./docs/11.x/dusk.md:832 +#: ./docs/master/dusk.md:828 msgid "The `clickAtPoint` method may be used to click on the topmost element at a given pair of coordinates relative to the viewable area of the browser:" -msgstr "可使用 `clickAtPoint` 方法來點擊在相對於瀏覽器檢視區域上,符合給定座標點上最上層的元素:" +msgstr "" -#: docs/10.x/dusk.md:block 247 (code) -msgid "$browser->clickAtPoint($x = 0, $y = 0);\n" -msgstr "$browser->clickAtPoint($x = 0, $y = 0);\n" +# CODE +#: ./docs/8.x/dusk.md:613 +#: ./docs/9.x/dusk.md:697 +#: ./docs/10.x/dusk.md:779 +#: ./docs/11.x/dusk.md:834 +#: ./docs/master/dusk.md:830 +msgid "$browser->clickAtPoint($x = 0, $y = 0);" +msgstr "" -#: docs/10.x/dusk.md:block 248 (paragraph) +# P +#: ./docs/8.x/dusk.md:615 +#: ./docs/9.x/dusk.md:699 +#: ./docs/10.x/dusk.md:781 +#: ./docs/11.x/dusk.md:836 +#: ./docs/master/dusk.md:832 msgid "The `doubleClick` method may be used to simulate the double click of a mouse:" -msgstr "可使用 `doubleClick` 方法來模擬使用滑鼠點兩下:" +msgstr "" -#: docs/10.x/dusk.md:block 249 (code) -msgid "$browser->doubleClick();\n" -msgstr "$browser->doubleClick();\n" +# CODE +#: ./docs/8.x/dusk.md:617 +#: ./docs/9.x/dusk.md:701 +msgid "$browser->doubleClick();" +msgstr "" -#: docs/10.x/dusk.md:block 250 (paragraph) +# P +#: ./docs/8.x/dusk.md:619 +#: ./docs/9.x/dusk.md:703 +#: ./docs/10.x/dusk.md:787 +#: ./docs/11.x/dusk.md:842 +#: ./docs/master/dusk.md:838 msgid "The `rightClick` method may be used to simulate the right click of a mouse:" -msgstr "可使用 `rightClick` 方法來模擬按滑鼠右鍵:" +msgstr "" -#: docs/10.x/dusk.md:block 251 (code) +# CODE +#: ./docs/8.x/dusk.md:621 +#: ./docs/9.x/dusk.md:705 +#: ./docs/10.x/dusk.md:789 +#: ./docs/11.x/dusk.md:844 +#: ./docs/master/dusk.md:840 msgid "$browser->rightClick();\n\n" -"$browser->rightClick('.selector');\n" -msgstr "$browser->rightClick();\n\n" -"$browser->rightClick('.selector');\n" +"$browser->rightClick('.selector');" +msgstr "" -#: docs/10.x/dusk.md:block 252 (paragraph) +# P +#: ./docs/8.x/dusk.md:625 +#: ./docs/9.x/dusk.md:709 +#: ./docs/10.x/dusk.md:793 +#: ./docs/11.x/dusk.md:848 +#: ./docs/master/dusk.md:844 msgid "The `clickAndHold` method may be used to simulate a mouse button being clicked and held down. A subsequent call to the `releaseMouse` method will undo this behavior and release the mouse button:" -msgstr "可使用 `clickAndHold` 方法來模擬按下滑鼠按鈕並保持按下。若接著呼叫 `releaseMouse` 方法,則會取消這個行為並放開滑鼠按鈕:" +msgstr "" -#: docs/10.x/dusk.md:block 253 (code) +# CODE +#: ./docs/8.x/dusk.md:627 +#: ./docs/9.x/dusk.md:711 msgid "$browser->clickAndHold()\n" " ->pause(1000)\n" -" ->releaseMouse();\n" -msgstr "$browser->clickAndHold()\n" -" ->pause(1000)\n" -" ->releaseMouse();\n" - -#: docs/10.x/dusk.md:block 254 (paragraph) -msgid "The `controlClick` method may be used to simulate the `ctrl+click` event within the browser:" -msgstr "`controlClick` 方法可用來在瀏覽器上模擬 `ctrl+click` 事件:" - -#: docs/10.x/dusk.md:block 255 (code) -msgid "$browser->controlClick();\n" -msgstr "$browser->controlClick();\n" +" ->releaseMouse();" +msgstr "" -#: docs/10.x/dusk.md:block 257 (header) +# P +#: ./docs/8.x/dusk.md:631 +#: ./docs/9.x/dusk.md:715 +#: ./docs/10.x/dusk.md:807 +#: ./docs/11.x/dusk.md:862 +#: ./docs/master/dusk.md:858 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:632 +#: ./docs/9.x/dusk.md:716 +#: ./docs/10.x/dusk.md:808 +#: ./docs/11.x/dusk.md:863 +#: ./docs/master/dusk.md:859 msgid "Mouseover" -msgstr "滑鼠移至上方" +msgstr "" -#: docs/10.x/dusk.md:block 258 (paragraph) +# P +#: ./docs/8.x/dusk.md:634 +#: ./docs/9.x/dusk.md:718 +#: ./docs/10.x/dusk.md:810 +#: ./docs/11.x/dusk.md:865 +#: ./docs/master/dusk.md:861 msgid "The `mouseover` method may be used when you need to move the mouse over an element matching the given CSS or Dusk selector:" -msgstr "當需要將滑鼠移至符合給定 CSS 或 Dusk 選擇器的元素上時,可使用 `mouseover` 方法:" +msgstr "" -#: docs/10.x/dusk.md:block 259 (code) -msgid "$browser->mouseover('.selector');\n" -msgstr "$browser->mouseover('.selector');\n" +# CODE +#: ./docs/8.x/dusk.md:636 +#: ./docs/9.x/dusk.md:720 +#: ./docs/10.x/dusk.md:812 +#: ./docs/11.x/dusk.md:867 +#: ./docs/master/dusk.md:863 +msgid "$browser->mouseover('.selector');" +msgstr "" -#: docs/10.x/dusk.md:block 261 (header) +# P +#: ./docs/8.x/dusk.md:638 +#: ./docs/9.x/dusk.md:722 +#: ./docs/10.x/dusk.md:814 +#: ./docs/11.x/dusk.md:869 +#: ./docs/master/dusk.md:865 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:639 +#: ./docs/9.x/dusk.md:723 msgid "Drag & Drop" -msgstr "拖放" +msgstr "" + +# P +#: ./docs/9.x/dusk.md:639 +#: ./docs/10.x/dusk.md:661 +#: ./docs/11.x/dusk.md:716 +#: ./docs/master/dusk.md:712 +msgid "The `press` method may be used to click a button element on the page. The argument given to the `press` method may be either the display text of the button or a CSS / Dusk selector:" +msgstr "" -#: docs/10.x/dusk.md:block 262 (paragraph) +# P +#: ./docs/8.x/dusk.md:641 +#: ./docs/9.x/dusk.md:725 +#: ./docs/10.x/dusk.md:817 +#: ./docs/11.x/dusk.md:872 +#: ./docs/master/dusk.md:868 msgid "The `drag` method may be used to drag an element matching the given selector to another element:" -msgstr "可使用 `drag` 方法來將符合給定選擇器元素拖曳至另一個元素上:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:643 +#: ./docs/9.x/dusk.md:727 +#: ./docs/10.x/dusk.md:819 +#: ./docs/11.x/dusk.md:874 +#: ./docs/master/dusk.md:870 +msgid "$browser->drag('.from-selector', '.to-selector');" +msgstr "" -#: docs/10.x/dusk.md:block 263 (code) -msgid "$browser->drag('.from-selector', '.to-selector');\n" -msgstr "$browser->drag('.from-selector', '.to-selector');\n" +# P +#: ./docs/9.x/dusk.md:643 +#: ./docs/10.x/dusk.md:665 +#: ./docs/11.x/dusk.md:720 +#: ./docs/master/dusk.md:716 +msgid "When submitting forms, many applications disable the form's submission button after it is pressed and then re-enable the button when the form submission's HTTP request is complete. To press a button and wait for the button to be re-enabled, you may use the `pressAndWaitFor` method:" +msgstr "" -#: docs/10.x/dusk.md:block 264 (paragraph) +# P +#: ./docs/8.x/dusk.md:645 +#: ./docs/9.x/dusk.md:729 +#: ./docs/10.x/dusk.md:821 +#: ./docs/11.x/dusk.md:876 +#: ./docs/master/dusk.md:872 msgid "Or, you may drag an element in a single direction:" -msgstr "或者,也可以將某個元素在單一方向上拖曳:" +msgstr "" -#: docs/10.x/dusk.md:block 265 (code) +# CODE +#: ./docs/8.x/dusk.md:647 +#: ./docs/9.x/dusk.md:731 +#: ./docs/10.x/dusk.md:823 +#: ./docs/11.x/dusk.md:878 +#: ./docs/master/dusk.md:874 msgid "$browser->dragLeft('.selector', $pixels = 10);\n" "$browser->dragRight('.selector', $pixels = 10);\n" "$browser->dragUp('.selector', $pixels = 10);\n" -"$browser->dragDown('.selector', $pixels = 10);\n" -msgstr "$browser->dragLeft('.selector', $pixels = 10);\n" -"$browser->dragRight('.selector', $pixels = 10);\n" -"$browser->dragUp('.selector', $pixels = 10);\n" -"$browser->dragDown('.selector', $pixels = 10);\n" +"$browser->dragDown('.selector', $pixels = 10);" +msgstr "" -#: docs/10.x/dusk.md:block 266 (paragraph) +# P +#: ./docs/8.x/dusk.md:652 +#: ./docs/9.x/dusk.md:736 +#: ./docs/10.x/dusk.md:828 +#: ./docs/11.x/dusk.md:883 +#: ./docs/master/dusk.md:879 msgid "Finally, you may drag an element by a given offset:" -msgstr "最後,可以依照給定偏移值來拖曳元素:" +msgstr "" -#: docs/10.x/dusk.md:block 267 (code) -msgid "$browser->dragOffset('.selector', $x = 10, $y = 10);\n" -msgstr "$browser->dragOffset('.selector', $x = 10, $y = 10);\n" +# CODE +#: ./docs/8.x/dusk.md:654 +#: ./docs/9.x/dusk.md:738 +#: ./docs/10.x/dusk.md:830 +#: ./docs/11.x/dusk.md:885 +#: ./docs/master/dusk.md:881 +msgid "$browser->dragOffset('.selector', $x = 10, $y = 10);" +msgstr "" -#: docs/10.x/dusk.md:block 269 (header) +# P +#: ./docs/8.x/dusk.md:656 +#: ./docs/9.x/dusk.md:740 +#: ./docs/10.x/dusk.md:832 +#: ./docs/11.x/dusk.md:887 +#: ./docs/master/dusk.md:883 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:657 +#: ./docs/9.x/dusk.md:741 +#: ./docs/10.x/dusk.md:833 +#: ./docs/11.x/dusk.md:888 +#: ./docs/master/dusk.md:884 msgid "JavaScript Dialogs" -msgstr "JavaScript 對話方塊" +msgstr "" -#: docs/10.x/dusk.md:block 270 (paragraph) +# P +#: ./docs/8.x/dusk.md:659 +#: ./docs/9.x/dusk.md:743 +#: ./docs/10.x/dusk.md:835 +#: ./docs/11.x/dusk.md:890 +#: ./docs/master/dusk.md:886 msgid "Dusk provides various methods to interact with JavaScript Dialogs. For example, you may use the `waitForDialog` method to wait for a JavaScript dialog to appear. This method accepts an optional argument indicating how many seconds to wait for the dialog to appear:" -msgstr "Dusk 提供了多種與 JavaScript 對話方塊互動的方法。舉例來說,可以使用 `waitForDialog` 方法來等待 JavaScript 對話方塊出現。該方法可接收一個可選的引數來判斷要等幾秒讓該對話方塊顯示出來:" +msgstr "" -#: docs/10.x/dusk.md:block 271 (code) -msgid "$browser->waitForDialog($seconds = null);\n" -msgstr "$browser->waitForDialog($seconds = null);\n" +# CODE +#: ./docs/8.x/dusk.md:661 +#: ./docs/9.x/dusk.md:745 +#: ./docs/10.x/dusk.md:837 +#: ./docs/11.x/dusk.md:892 +#: ./docs/master/dusk.md:888 +msgid "$browser->waitForDialog($seconds = null);" +msgstr "" -#: docs/10.x/dusk.md:block 272 (paragraph) +# P +#: ./docs/8.x/dusk.md:663 +#: ./docs/9.x/dusk.md:747 +#: ./docs/10.x/dusk.md:839 +#: ./docs/11.x/dusk.md:894 +#: ./docs/master/dusk.md:890 msgid "The `assertDialogOpened` method may be used to assert that a dialog has been displayed and contains the given message:" -msgstr "可使用 `assertDialogOpened` 方法來判斷某個對話方塊是否已顯示,且包含給定的訊息:" +msgstr "" -#: docs/10.x/dusk.md:block 273 (code) -msgid "$browser->assertDialogOpened('Dialog message');\n" -msgstr "$browser->assertDialogOpened('Dialog message');\n" +# CODE +#: ./docs/8.x/dusk.md:665 +#: ./docs/9.x/dusk.md:749 +#: ./docs/10.x/dusk.md:841 +#: ./docs/11.x/dusk.md:896 +#: ./docs/master/dusk.md:892 +msgid "$browser->assertDialogOpened('Dialog message');" +msgstr "" -#: docs/10.x/dusk.md:block 274 (paragraph) +# P +#: ./docs/8.x/dusk.md:667 +#: ./docs/9.x/dusk.md:751 +#: ./docs/10.x/dusk.md:843 +#: ./docs/11.x/dusk.md:898 +#: ./docs/master/dusk.md:894 msgid "If the JavaScript dialog contains a prompt, you may use the `typeInDialog` method to type a value into the prompt:" -msgstr "若該 JavaScript 對話方塊包含輸入提示,可使用 `typeInDialog` 方法來在該提示中輸入數值:" +msgstr "" -#: docs/10.x/dusk.md:block 275 (code) -msgid "$browser->typeInDialog('Hello World');\n" -msgstr "$browser->typeInDialog('Hello World');\n" +# CODE +#: ./docs/8.x/dusk.md:669 +#: ./docs/9.x/dusk.md:753 +#: ./docs/10.x/dusk.md:845 +#: ./docs/11.x/dusk.md:900 +#: ./docs/master/dusk.md:896 +msgid "$browser->typeInDialog('Hello World');" +msgstr "" -#: docs/10.x/dusk.md:block 276 (paragraph) +# P +#: ./docs/8.x/dusk.md:671 +#: ./docs/9.x/dusk.md:755 +#: ./docs/10.x/dusk.md:847 +#: ./docs/11.x/dusk.md:902 +#: ./docs/master/dusk.md:898 msgid "To close an open JavaScript dialog by clicking the \"OK\" button, you may invoke the `acceptDialog` method:" -msgstr "若要點擊「確定」按鈕來關閉開啟的 JavaScript 對話方塊,可以叫用 `acceptDialog` 方法:" +msgstr "" -#: docs/10.x/dusk.md:block 277 (code) -msgid "$browser->acceptDialog();\n" -msgstr "$browser->acceptDialog();\n" +# CODE +#: ./docs/8.x/dusk.md:673 +#: ./docs/9.x/dusk.md:757 +#: ./docs/10.x/dusk.md:849 +#: ./docs/11.x/dusk.md:904 +#: ./docs/master/dusk.md:900 +msgid "$browser->acceptDialog();" +msgstr "" -#: docs/10.x/dusk.md:block 278 (paragraph) +# P +#: ./docs/8.x/dusk.md:675 +#: ./docs/9.x/dusk.md:759 +#: ./docs/10.x/dusk.md:851 +#: ./docs/11.x/dusk.md:906 +#: ./docs/master/dusk.md:902 msgid "To close an open JavaScript dialog by clicking the \"Cancel\" button, you may invoke the `dismissDialog` method:" -msgstr "若要點擊「取消」按鈕來關閉開啟的 JavaScript 對話方塊,可以叫用 `dismissDialog` 方法:" - -#: docs/10.x/dusk.md:block 279 (code) -msgid "$browser->dismissDialog();\n" -msgstr "$browser->dismissDialog();\n" - -#: docs/10.x/dusk.md:block 281 (header) -msgid "Interacting With Inline Frames" -msgstr "處理 IFrame" - -#: docs/10.x/dusk.md:block 282 (paragraph) -msgid "If you need to interact with elements within an iframe, you may use the `withinFrame` method. All element interactions that take place within the closure provided to the `withinFrame` method will be scoped to the context of the specified iframe:" -msgstr "若有需要操作 iframe 中的元素,可以使用 `withinFrame` 方法。在提供給 `withinFrame` 方法的 Closure 中,所有的元素互動都會被限制在指定 iframe 的範圍內:" +msgstr "" -#: docs/10.x/dusk.md:block 283 (code) -msgid "$browser->withinFrame('#credit-card-details', function ($browser) {\n" -" $browser->type('input[name=\"cardnumber\"]', '4242424242424242')\n" -" ->type('input[name=\"exp-date\"]', '12/24')\n" -" ->type('input[name=\"cvc\"]', '123');\n" -" })->press('Pay');\n" -"});\n" -msgstr "$browser->withinFrame('#credit-card-details', function ($browser) {\n" -" $browser->type('input[name=\"cardnumber\"]', '4242424242424242')\n" -" ->type('input[name=\"exp-date\"]', '12/24')\n" -" ->type('input[name=\"cvc\"]', '123');\n" -" })->press('Pay');\n" -"});\n" +# CODE +#: ./docs/8.x/dusk.md:677 +#: ./docs/9.x/dusk.md:761 +#: ./docs/10.x/dusk.md:853 +#: ./docs/11.x/dusk.md:908 +#: ./docs/master/dusk.md:904 +msgid "$browser->dismissDialog();" +msgstr "" -#: docs/10.x/dusk.md:block 285 (header) +# P +#: ./docs/8.x/dusk.md:679 +#: ./docs/9.x/dusk.md:763 +#: ./docs/10.x/dusk.md:867 +#: ./docs/11.x/dusk.md:922 +#: ./docs/master/dusk.md:918 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:680 +#: ./docs/9.x/dusk.md:764 +#: ./docs/10.x/dusk.md:868 +#: ./docs/11.x/dusk.md:923 +#: ./docs/master/dusk.md:919 msgid "Scoping Selectors" -msgstr "區域性選擇器" +msgstr "" -#: docs/10.x/dusk.md:block 286 (paragraph) +# P +#: ./docs/8.x/dusk.md:682 +#: ./docs/9.x/dusk.md:766 +#: ./docs/10.x/dusk.md:870 +#: ./docs/11.x/dusk.md:925 +#: ./docs/master/dusk.md:921 msgid "Sometimes you may wish to perform several operations while scoping all of the operations within a given selector. For example, you may wish to assert that some text exists only within a table and then click a button within that table. You may use the `with` method to accomplish this. All operations performed within the closure given to the `with` method will be scoped to the original selector:" -msgstr "有的時候,我們可能會想把多個操作限制到某個特定選擇器裡面。舉例來說,我們在判斷某段文字是否有出現時,可能只想在某個表格內檢查,並在檢查完畢後接著在該表格內點擊某個按鈕。可以使用 `with` 方法來達成。在提供給 `with` 方法的閉包內所進行的操作都會被限制在某個選擇器之內:" +msgstr "" -#: docs/10.x/dusk.md:block 287 (code) -msgid "$browser->with('.table', function (Browser $table) {\n" -" $table->assertSee('Hello World')\n" -" ->clickLink('Delete');\n" -"});\n" -msgstr "$browser->with('.table', function (Browser $table) {\n" +# CODE +#: ./docs/8.x/dusk.md:684 +#: ./docs/9.x/dusk.md:768 +msgid "$browser->with('.table', function ($table) {\n" " $table->assertSee('Hello World')\n" " ->clickLink('Delete');\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/dusk.md:block 288 (paragraph) +# P +#: ./docs/8.x/dusk.md:689 +#: ./docs/9.x/dusk.md:773 +#: ./docs/10.x/dusk.md:877 +#: ./docs/11.x/dusk.md:932 +#: ./docs/master/dusk.md:928 msgid "You may occasionally need to execute assertions outside of the current scope. You may use the `elsewhere` and `elsewhereWhenAvailable` methods to accomplish this:" -msgstr "某些時候,我們可能需要在目前的 Scope 外執行 Assertion。可以使用 `elsewhere` 與 `elsewhereWhenAvailable` 方法來進行:" +msgstr "" -#: docs/10.x/dusk.md:block 289 (code) -msgid " $browser->with('.table', function (Browser $table) {\n" +# H3 +#: ./docs/10.x/dusk.md:690 +#: ./docs/11.x/dusk.md:745 +#: ./docs/master/dusk.md:741 +msgid "Using the Keyboard" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:691 +#: ./docs/9.x/dusk.md:775 +msgid " $browser->with('.table', function ($table) {\n" " // Current scope is `body .table`...\n\n" -" $browser->elsewhere('.page-title', function (Browser $title) {\n" +" $browser->elsewhere('.page-title', function ($title) {\n" " // Current scope is `body .page-title`...\n" " $title->assertSee('Hello World');\n" " });\n\n" -" $browser->elsewhereWhenAvailable('.page-title', function (Browser $title) {\n" +" $browser->elsewhereWhenAvailable('.page-title', function ($title) {\n" " // Current scope is `body .page-title`...\n" " $title->assertSee('Hello World');\n" " });\n" -" });\n" -msgstr " $browser->with('.table', function (Browser $table) {\n" -" // 目前範圍為 `body .table`...\n\n" -" $browser->elsewhere('.page-title', function (Browser $title) {\n" -" // 目前範圍為 `body .page-title`...\n" -" $title->assertSee('Hello World');\n" -" });\n\n" -" $browser->elsewhereWhenAvailable('.page-title', function (Browser $title) {\n" -" // 目前範圍為 `body .page-title`...\n" -" $title->assertSee('Hello World');\n" -" });\n" -" });\n" +" });" +msgstr "" -#: docs/10.x/dusk.md:block 291 (header) +# P +#: ./docs/10.x/dusk.md:703 +#: ./docs/11.x/dusk.md:758 +#: ./docs/master/dusk.md:754 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/dusk.md:704 +#: ./docs/11.x/dusk.md:759 +#: ./docs/master/dusk.md:755 +msgid "Fluent Keyboard Interactions" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:705 +#: ./docs/9.x/dusk.md:789 +#: ./docs/10.x/dusk.md:893 +#: ./docs/11.x/dusk.md:948 +#: ./docs/master/dusk.md:944 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/dusk.md:706 +#: ./docs/11.x/dusk.md:761 +#: ./docs/master/dusk.md:757 +msgid "Dusk also provides a `withKeyboard` method, allowing you to fluently perform complex keyboard interactions via the `Laravel\\Dusk\\Keyboard` class. The `Keyboard` class provides `press`, `release`, `type`, and `pause` methods:" +msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:706 +#: ./docs/9.x/dusk.md:790 msgid "Waiting For Elements" -msgstr "等待元素" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:708 +#: ./docs/11.x/dusk.md:763 +#: ./docs/master/dusk.md:759 +msgid "use Laravel\\Dusk\\Keyboard;\n\n" +"$browser->withKeyboard(function (Keyboard $keyboard) {\n" +" $keyboard->press('c')\n" +" ->pause(1000)\n" +" ->release('c')\n" +" ->type(['c', 'e', 'o']);\n" +"});" +msgstr "" -#: docs/10.x/dusk.md:block 292 (paragraph) +# P +#: ./docs/8.x/dusk.md:708 +#: ./docs/9.x/dusk.md:792 +#: ./docs/10.x/dusk.md:896 +#: ./docs/11.x/dusk.md:951 +#: ./docs/master/dusk.md:947 msgid "When testing applications that use JavaScript extensively, it often becomes necessary to \"wait\" for certain elements or data to be available before proceeding with a test. Dusk makes this a cinch. Using a variety of methods, you may wait for elements to become visible on the page or even wait until a given JavaScript expression evaluates to `true`." -msgstr "在測試使用了大量 JavaScript 的網站時,常常會需要「等待」特定元素或資料出現後才能繼續進行測試。在 Dusk 中可以輕鬆做到。只需要使用幾個方法,就可以等待元素顯示在頁面上,或是等待某個給定的 JavaScript 運算式取值變為 `true`。" +msgstr "" -#: docs/10.x/dusk.md:block 294 (header) +# P +#: ./docs/8.x/dusk.md:710 +#: ./docs/9.x/dusk.md:794 +#: ./docs/10.x/dusk.md:898 +#: ./docs/11.x/dusk.md:953 +#: ./docs/master/dusk.md:949 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:711 +#: ./docs/9.x/dusk.md:795 +#: ./docs/10.x/dusk.md:899 +#: ./docs/11.x/dusk.md:954 +#: ./docs/master/dusk.md:950 msgid "Waiting" -msgstr "等待" +msgstr "" -#: docs/10.x/dusk.md:block 295 (paragraph) +# P +#: ./docs/8.x/dusk.md:713 +#: ./docs/9.x/dusk.md:797 +#: ./docs/10.x/dusk.md:901 +#: ./docs/11.x/dusk.md:956 +#: ./docs/master/dusk.md:952 msgid "If you just need to pause the test for a given number of milliseconds, use the `pause` method:" -msgstr "若只是需要將測試暫停幾毫秒,可使用 `pause` 方法:" - -#: docs/10.x/dusk.md:block 296 (code) -msgid "$browser->pause(1000);\n" -msgstr "$browser->pause(1000);\n" - -#: docs/10.x/dusk.md:block 297 (paragraph) -msgid "If you need to pause the test only if a given condition is `true`, use the `pauseIf` method:" -msgstr "若只想在某個給定條件為 `true` 時暫停測試,可使用 `pauseIf` 方法:" - -#: docs/10.x/dusk.md:block 298 (code) -msgid "$browser->pauseIf(App::environment('production'), 1000);\n" -msgstr "$browser->pauseIf(App::environment('production'), 1000);\n" +msgstr "" -#: docs/10.x/dusk.md:block 299 (paragraph) -msgid "Likewise, if you need to pause the test unless a given condition is `true`, you may use the `pauseUnless` method:" -msgstr "類似的,若只想在某個給定條件不為 `true` 時暫停測試,可使用 `pauseUnless` 方法:" +# CODE +#: ./docs/8.x/dusk.md:715 +#: ./docs/9.x/dusk.md:799 +#: ./docs/10.x/dusk.md:903 +#: ./docs/11.x/dusk.md:958 +#: ./docs/master/dusk.md:954 +msgid "$browser->pause(1000);" +msgstr "" -#: docs/10.x/dusk.md:block 300 (code) -msgid "$browser->pauseUnless(App::environment('testing'), 1000);\n" -msgstr "$browser->pauseUnless(App::environment('testing'), 1000);\n" +# P +#: ./docs/10.x/dusk.md:717 +#: ./docs/11.x/dusk.md:772 +#: ./docs/master/dusk.md:768 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/dusk.md:717 +#: ./docs/9.x/dusk.md:809 +#: ./docs/10.x/dusk.md:913 +#: ./docs/11.x/dusk.md:968 +#: ./docs/master/dusk.md:964 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/dusk.md:718 +#: ./docs/11.x/dusk.md:773 +#: ./docs/master/dusk.md:769 +msgid "Keyboard Macros" +msgstr "" -#: docs/10.x/dusk.md:block 302 (header) +# H4 +#: ./docs/8.x/dusk.md:718 +#: ./docs/9.x/dusk.md:810 msgid "Waiting For Selectors" -msgstr "等待選擇器" +msgstr "" + +# P +#: ./docs/10.x/dusk.md:720 +#: ./docs/11.x/dusk.md:775 +#: ./docs/master/dusk.md:771 +msgid "If you would like to define custom keyboard interactions that you can easily re-use throughout your test suite, you may use the `macro` method provided by the `Keyboard` class. Typically, you should call this method from a [service provider's](/docs/{{version}}/providers) `boot` method:" +msgstr "" -#: docs/10.x/dusk.md:block 303 (paragraph) +# P +#: ./docs/8.x/dusk.md:720 +#: ./docs/9.x/dusk.md:812 +#: ./docs/10.x/dusk.md:916 +#: ./docs/11.x/dusk.md:971 +#: ./docs/master/dusk.md:967 msgid "The `waitFor` method may be used to pause the execution of the test until the element matching the given CSS or Dusk selector is displayed on the page. By default, this will pause the test for a maximum of five seconds before throwing an exception. If necessary, you may pass a custom timeout threshold as the second argument to the method:" -msgstr "`waitFor` 方法可用來暫停執行測試,並等到符合給定 CSS 或 Dusk 選擇器的元素顯示在頁面上。預設情況下,該方法會最多會暫停測試五秒,超過則會擲回例外。若有需要,可以將自訂的逾時閥值傳入為該方法的第二個引數:" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:722 +#: ./docs/11.x/dusk.md:777 +#: ./docs/master/dusk.md:773 +msgid "type([\n" +" OperatingSystem::onMac() ? WebDriverKeys::META : WebDriverKeys::CONTROL, 'c',\n" +" ]);\n\n" +" return $this;\n" +" });\n\n" +" Keyboard::macro('paste', function (string $element = null) {\n" +" $this->type([\n" +" OperatingSystem::onMac() ? WebDriverKeys::META : WebDriverKeys::CONTROL, 'v',\n" +" ]);\n\n" +" return $this;\n" +" });\n" +" }\n" +"}" +msgstr "" -#: docs/10.x/dusk.md:block 304 (code) +# CODE +#: ./docs/8.x/dusk.md:722 +#: ./docs/9.x/dusk.md:814 +#: ./docs/10.x/dusk.md:918 +#: ./docs/11.x/dusk.md:973 +#: ./docs/master/dusk.md:969 msgid "// Wait a maximum of five seconds for the selector...\n" "$browser->waitFor('.selector');\n\n" "// Wait a maximum of one second for the selector...\n" -"$browser->waitFor('.selector', 1);\n" -msgstr "// 等待選擇器最多 5 秒...\n" -"$browser->waitFor('.selector');\n\n" -"// 等待選擇器最多 1 秒...\n" -"$browser->waitFor('.selector', 1);\n" +"$browser->waitFor('.selector', 1);" +msgstr "" -#: docs/10.x/dusk.md:block 305 (paragraph) +# P +#: ./docs/8.x/dusk.md:728 +#: ./docs/9.x/dusk.md:820 +#: ./docs/10.x/dusk.md:924 +#: ./docs/11.x/dusk.md:979 +#: ./docs/master/dusk.md:975 msgid "You may also wait until the element matching the given selector contains the given text:" -msgstr "也可以等待某個符合給定選擇器的元素出現給定文字:" +msgstr "" -#: docs/10.x/dusk.md:block 306 (code) +# CODE +#: ./docs/8.x/dusk.md:730 +#: ./docs/9.x/dusk.md:822 +#: ./docs/10.x/dusk.md:926 +#: ./docs/11.x/dusk.md:981 +#: ./docs/master/dusk.md:977 msgid "// Wait a maximum of five seconds for the selector to contain the given text...\n" "$browser->waitForTextIn('.selector', 'Hello World');\n\n" "// Wait a maximum of one second for the selector to contain the given text...\n" -"$browser->waitForTextIn('.selector', 'Hello World', 1);\n" -msgstr "// 等待選擇器中包含給定文字最多 5 秒...\n" -"$browser->waitForTextIn('.selector', 'Hello World');\n\n" -"// 等待選擇器中包含給定文字最多 1 秒...\n" -"$browser->waitForTextIn('.selector', 'Hello World', 1);\n" +"$browser->waitForTextIn('.selector', 'Hello World', 1);" +msgstr "" -#: docs/10.x/dusk.md:block 307 (paragraph) +# P +#: ./docs/8.x/dusk.md:736 +#: ./docs/9.x/dusk.md:828 +#: ./docs/10.x/dusk.md:932 +#: ./docs/11.x/dusk.md:987 +#: ./docs/master/dusk.md:983 msgid "You may also wait until the element matching the given selector is missing from the page:" -msgstr "也可以等待某個符合給定選擇器的元素消失在頁面上:" +msgstr "" -#: docs/10.x/dusk.md:block 308 (code) +# CODE +#: ./docs/8.x/dusk.md:738 +#: ./docs/9.x/dusk.md:830 +#: ./docs/10.x/dusk.md:934 +#: ./docs/11.x/dusk.md:989 +#: ./docs/master/dusk.md:985 msgid "// Wait a maximum of five seconds until the selector is missing...\n" "$browser->waitUntilMissing('.selector');\n\n" "// Wait a maximum of one second until the selector is missing...\n" -"$browser->waitUntilMissing('.selector', 1);\n" -msgstr "// 等待選擇器不存在,最多 5 秒...\n" -"$browser->waitUntilMissing('.selector');\n\n" -"// 等待選擇器不存在,最多 1 秒...\n" -"$browser->waitUntilMissing('.selector', 1);\n" +"$browser->waitUntilMissing('.selector', 1);" +msgstr "" -#: docs/10.x/dusk.md:block 309 (paragraph) +# P +#: ./docs/8.x/dusk.md:744 +#: ./docs/9.x/dusk.md:836 +#: ./docs/10.x/dusk.md:940 +#: ./docs/11.x/dusk.md:995 +#: ./docs/master/dusk.md:991 msgid "Or, you may wait until the element matching the given selector is enabled or disabled:" -msgstr "或者,也可以等待給定的選擇器為 Enabled 或 Disabled:" +msgstr "" -#: docs/10.x/dusk.md:block 310 (code) +# CODE +#: ./docs/8.x/dusk.md:746 +#: ./docs/9.x/dusk.md:838 +#: ./docs/10.x/dusk.md:942 +#: ./docs/11.x/dusk.md:997 +#: ./docs/master/dusk.md:993 msgid "// Wait a maximum of five seconds until the selector is enabled...\n" "$browser->waitUntilEnabled('.selector');\n\n" "// Wait a maximum of one second until the selector is enabled...\n" @@ -1710,1161 +3643,3779 @@ msgid "// Wait a maximum of five seconds until the selector is enabled...\n" "// Wait a maximum of five seconds until the selector is disabled...\n" "$browser->waitUntilDisabled('.selector');\n\n" "// Wait a maximum of one second until the selector is disabled...\n" -"$browser->waitUntilDisabled('.selector', 1);\n" -msgstr "// 等待選擇器啟用,最多 5 秒...\n" -"$browser->waitUntilEnabled('.selector');\n\n" -"// 等待選擇器啟用,最多 1 秒...\n" -"$browser->waitUntilEnabled('.selector', 1);\n\n" -"// 等待選擇器禁用,最多 5 秒...\n" -"$browser->waitUntilDisabled('.selector');\n\n" -"// 等待選擇器禁用,最多 1 秒...\n" -"$browser->waitUntilDisabled('.selector', 1);\n" +"$browser->waitUntilDisabled('.selector', 1);" +msgstr "" + +# P +#: ./docs/10.x/dusk.md:756 +#: ./docs/11.x/dusk.md:811 +#: ./docs/master/dusk.md:807 +msgid "The `macro` function accepts a name as its first argument and a closure as its second. The macro's closure will be executed when calling the macro as a method on a `Keyboard` instance:" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:758 +#: ./docs/11.x/dusk.md:813 +#: ./docs/master/dusk.md:809 +msgid "$browser->click('@textarea')\n" +" ->withKeyboard(fn (Keyboard $keyboard) => $keyboard->copy())\n" +" ->click('@another-textarea')\n" +" ->withKeyboard(fn (Keyboard $keyboard) => $keyboard->paste());" +msgstr "" -#: docs/10.x/dusk.md:block 312 (header) +# P +#: ./docs/8.x/dusk.md:758 +#: ./docs/9.x/dusk.md:850 +#: ./docs/10.x/dusk.md:954 +#: ./docs/11.x/dusk.md:1009 +#: ./docs/master/dusk.md:1005 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:759 +#: ./docs/9.x/dusk.md:851 +#: ./docs/10.x/dusk.md:955 +#: ./docs/11.x/dusk.md:1010 +#: ./docs/master/dusk.md:1006 msgid "Scoping Selectors When Available" -msgstr "可用時進入選擇器的 Scope" +msgstr "" -#: docs/10.x/dusk.md:block 313 (paragraph) +# P +#: ./docs/8.x/dusk.md:761 +#: ./docs/9.x/dusk.md:853 +#: ./docs/10.x/dusk.md:957 +#: ./docs/11.x/dusk.md:1012 +#: ./docs/master/dusk.md:1008 msgid "Occasionally, you may wish to wait for an element to appear that matches a given selector and then interact with the element. For example, you may wish to wait until a modal window is available and then press the \"OK\" button within the modal. The `whenAvailable` method may be used to accomplish this. All element operations performed within the given closure will be scoped to the original selector:" -msgstr "有時候我們可能會想等待符合給定選擇器的元素出現在頁面上後再接著與該元素互動。舉例來說,我們可能會想等待某個 Modal 視窗出現,然後在該 Modal 內點擊「OK」按鈕。可以使用 `whenAvailable` 方法來完成。在給定閉包內進行的所有元素操作都會被限制在原始選擇器的作用範圍內:" +msgstr "" -#: docs/10.x/dusk.md:block 314 (code) -msgid "$browser->whenAvailable('.modal', function (Browser $modal) {\n" -" $modal->assertSee('Hello World')\n" -" ->press('OK');\n" -"});\n" -msgstr "$browser->whenAvailable('.modal', function (Browser $modal) {\n" +# CODE +#: ./docs/8.x/dusk.md:763 +#: ./docs/9.x/dusk.md:855 +msgid "$browser->whenAvailable('.modal', function ($modal) {\n" " $modal->assertSee('Hello World')\n" " ->press('OK');\n" -"});\n" +"});" +msgstr "" + +# H3 +#: ./docs/10.x/dusk.md:764 +#: ./docs/11.x/dusk.md:819 +#: ./docs/master/dusk.md:815 +msgid "Using the Mouse" +msgstr "" + +# H4 +#: ./docs/10.x/dusk.md:767 +#: ./docs/11.x/dusk.md:822 +#: ./docs/master/dusk.md:818 +msgid "Clicking on Elements" +msgstr "" -#: docs/10.x/dusk.md:block 316 (header) +# P +#: ./docs/8.x/dusk.md:768 +#: ./docs/9.x/dusk.md:860 +#: ./docs/10.x/dusk.md:964 +#: ./docs/11.x/dusk.md:1019 +#: ./docs/master/dusk.md:1015 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:769 +#: ./docs/9.x/dusk.md:861 msgid "Waiting For Text" -msgstr "等待文字" +msgstr "" -#: docs/10.x/dusk.md:block 317 (paragraph) +# P +#: ./docs/8.x/dusk.md:771 +#: ./docs/9.x/dusk.md:863 +#: ./docs/10.x/dusk.md:967 +#: ./docs/11.x/dusk.md:1022 +#: ./docs/master/dusk.md:1018 msgid "The `waitForText` method may be used to wait until the given text is displayed on the page:" -msgstr "可使用 `waitForText` 方法來等待給定文字顯示在頁面上:" +msgstr "" -#: docs/10.x/dusk.md:block 318 (code) +# CODE +#: ./docs/8.x/dusk.md:773 +#: ./docs/9.x/dusk.md:865 +#: ./docs/10.x/dusk.md:969 +#: ./docs/11.x/dusk.md:1024 +#: ./docs/master/dusk.md:1020 msgid "// Wait a maximum of five seconds for the text...\n" "$browser->waitForText('Hello World');\n\n" "// Wait a maximum of one second for the text...\n" -"$browser->waitForText('Hello World', 1);\n" -msgstr "// 等待文字,最多 5 秒...\n" -"$browser->waitForText('Hello World');\n\n" -"// 等待文字,最多 1 秒...\n" -"$browser->waitForText('Hello World', 1);\n" +"$browser->waitForText('Hello World', 1);" +msgstr "" -#: docs/10.x/dusk.md:block 319 (paragraph) +# P +#: ./docs/8.x/dusk.md:779 +#: ./docs/9.x/dusk.md:871 +#: ./docs/10.x/dusk.md:975 +#: ./docs/11.x/dusk.md:1030 +#: ./docs/master/dusk.md:1026 msgid "You may use the `waitUntilMissingText` method to wait until the displayed text has been removed from the page:" -msgstr "可以使用 `waitUntilMissingText` 方法來等待某個正在顯示的文字從頁面上移除:" +msgstr "" -#: docs/10.x/dusk.md:block 320 (code) +# CODE +#: ./docs/8.x/dusk.md:781 +#: ./docs/9.x/dusk.md:873 +#: ./docs/10.x/dusk.md:977 +#: ./docs/11.x/dusk.md:1032 +#: ./docs/master/dusk.md:1028 msgid "// Wait a maximum of five seconds for the text to be removed...\n" "$browser->waitUntilMissingText('Hello World');\n\n" "// Wait a maximum of one second for the text to be removed...\n" -"$browser->waitUntilMissingText('Hello World', 1);\n" -msgstr "// 等待文字移除,最多 5 秒...\n" -"$browser->waitUntilMissingText('Hello World');\n\n" -"// 等待文字移除,最多 1 秒...\n" -"$browser->waitUntilMissingText('Hello World', 1);\n" +"$browser->waitUntilMissingText('Hello World', 1);" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:783 +#: ./docs/11.x/dusk.md:838 +#: ./docs/master/dusk.md:834 +msgid "$browser->doubleClick();\n\n" +"$browser->doubleClick('.selector');" +msgstr "" -#: docs/10.x/dusk.md:block 322 (header) +# P +#: ./docs/8.x/dusk.md:787 +#: ./docs/9.x/dusk.md:879 +#: ./docs/10.x/dusk.md:983 +#: ./docs/11.x/dusk.md:1038 +#: ./docs/master/dusk.md:1034 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:788 +#: ./docs/9.x/dusk.md:880 msgid "Waiting For Links" -msgstr "等待連結" +msgstr "" -#: docs/10.x/dusk.md:block 323 (paragraph) +# P +#: ./docs/8.x/dusk.md:790 +#: ./docs/9.x/dusk.md:882 +#: ./docs/10.x/dusk.md:986 +#: ./docs/11.x/dusk.md:1041 +#: ./docs/master/dusk.md:1037 msgid "The `waitForLink` method may be used to wait until the given link text is displayed on the page:" -msgstr "可使用 `waitForLink` 方法來等待給定連結文字顯示在頁面上:" +msgstr "" -#: docs/10.x/dusk.md:block 324 (code) +# CODE +#: ./docs/8.x/dusk.md:792 +#: ./docs/9.x/dusk.md:884 +#: ./docs/10.x/dusk.md:988 +#: ./docs/11.x/dusk.md:1043 +#: ./docs/master/dusk.md:1039 msgid "// Wait a maximum of five seconds for the link...\n" "$browser->waitForLink('Create');\n\n" "// Wait a maximum of one second for the link...\n" -"$browser->waitForLink('Create', 1);\n" -msgstr "// 等待連結,最多 5 秒...\n" -"$browser->waitForLink('Create');\n\n" -"// 等待連結,最多 1 秒...\n" -"$browser->waitForLink('Create', 1);\n" - -#: docs/10.x/dusk.md:block 326 (header) -msgid "Waiting For Inputs" -msgstr "等待輸入欄位" - -#: docs/10.x/dusk.md:block 327 (paragraph) -msgid "The `waitForInput` method may be used to wait until the given input field is visible on the page:" -msgstr "`waitForInput` 方法可用於等待給定輸入欄位顯示在頁面上:" +"$browser->waitForLink('Create', 1);" +msgstr "" -#: docs/10.x/dusk.md:block 328 (code) -msgid "// Wait a maximum of five seconds for the input...\n" -"$browser->waitForInput($field);\n\n" -"// Wait a maximum of one second for the input...\n" -"$browser->waitForInput($field, 1);\n" -msgstr "// 等待輸入欄位,最多 5 秒...\n" -"$browser->waitForInput($field);\n\n" -"// 等待輸入欄位,最多 1 秒..\n" -"$browser->waitForInput($field, 1);\n" +# CODE +#: ./docs/10.x/dusk.md:795 +#: ./docs/11.x/dusk.md:850 +#: ./docs/master/dusk.md:846 +msgid "$browser->clickAndHold('.selector');\n\n" +"$browser->clickAndHold()\n" +" ->pause(1000)\n" +" ->releaseMouse();" +msgstr "" -#: docs/10.x/dusk.md:block 330 (header) +# P +#: ./docs/8.x/dusk.md:798 +#: ./docs/9.x/dusk.md:901 +#: ./docs/10.x/dusk.md:1005 +#: ./docs/11.x/dusk.md:1060 +#: ./docs/master/dusk.md:1056 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:799 +#: ./docs/9.x/dusk.md:902 msgid "Waiting On The Page Location" -msgstr "等待網頁位置" +msgstr "" + +# P +#: ./docs/10.x/dusk.md:801 +#: ./docs/11.x/dusk.md:856 +#: ./docs/master/dusk.md:852 +msgid "The `controlClick` method may be used to simulate the `ctrl+click` event within the browser:" +msgstr "" -#: docs/10.x/dusk.md:block 331 (paragraph) +# P +#: ./docs/8.x/dusk.md:801 +#: ./docs/9.x/dusk.md:904 +#: ./docs/10.x/dusk.md:1008 +#: ./docs/11.x/dusk.md:1063 +#: ./docs/master/dusk.md:1059 msgid "When making a path assertion such as `$browser->assertPathIs('/home')`, the assertion can fail if `window.location.pathname` is being updated asynchronously. You may use the `waitForLocation` method to wait for the location to be a given value:" -msgstr "在進行如 `$browser->assertPathIs('/home')` 這種路徑 Assertion 時,如果 `window.location.pathname` 是非同步更新的,則該 Assertion 可能會失敗。可以使用 `waitForLocation` 方法來等待路徑為給定的值:" +msgstr "" + +# P +#: ./docs/9.x/dusk.md:801 +#: ./docs/10.x/dusk.md:905 +#: ./docs/11.x/dusk.md:960 +#: ./docs/master/dusk.md:956 +msgid "If you need to pause the test only if a given condition is `true`, use the `pauseIf` method:" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:803 +#: ./docs/11.x/dusk.md:858 +#: ./docs/master/dusk.md:854 +msgid "$browser->controlClick();\n\n" +"$browser->controlClick('.selector');" +msgstr "" -#: docs/10.x/dusk.md:block 332 (code) -msgid "$browser->waitForLocation('/secret');\n" -msgstr "$browser->waitForLocation('/secret');\n" +# CODE +#: ./docs/8.x/dusk.md:803 +#: ./docs/9.x/dusk.md:906 +#: ./docs/10.x/dusk.md:1010 +#: ./docs/11.x/dusk.md:1065 +#: ./docs/master/dusk.md:1061 +msgid "$browser->waitForLocation('/secret');" +msgstr "" + +# CODE +#: ./docs/9.x/dusk.md:803 +#: ./docs/10.x/dusk.md:907 +#: ./docs/11.x/dusk.md:962 +#: ./docs/master/dusk.md:958 +msgid "$browser->pauseIf(App::environment('production'), 1000);" +msgstr "" -#: docs/10.x/dusk.md:block 333 (paragraph) +# P +#: ./docs/8.x/dusk.md:805 +#: ./docs/9.x/dusk.md:908 +#: ./docs/10.x/dusk.md:1012 +#: ./docs/11.x/dusk.md:1067 +#: ./docs/master/dusk.md:1063 msgid "The `waitForLocation` method can also be used to wait for the current window location to be a fully qualified URL:" -msgstr "也可以使用 `waitForLocation` 方法來等待目前視窗的路徑符合完整的 URL:" +msgstr "" -#: docs/10.x/dusk.md:block 334 (code) -msgid "$browser->waitForLocation('https://example.com/path');\n" -msgstr "$browser->waitForLocation('https://example.com/path');\n" +# P +#: ./docs/9.x/dusk.md:805 +#: ./docs/10.x/dusk.md:909 +#: ./docs/11.x/dusk.md:964 +#: ./docs/master/dusk.md:960 +msgid "Likewise, if you need to pause the test unless a given condition is `true`, you may use the `pauseUnless` method:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:807 +#: ./docs/9.x/dusk.md:910 +#: ./docs/10.x/dusk.md:1014 +#: ./docs/11.x/dusk.md:1069 +#: ./docs/master/dusk.md:1065 +msgid "$browser->waitForLocation('https://example.com/path');" +msgstr "" -#: docs/10.x/dusk.md:block 335 (paragraph) +# CODE +#: ./docs/9.x/dusk.md:807 +#: ./docs/10.x/dusk.md:911 +#: ./docs/11.x/dusk.md:966 +#: ./docs/master/dusk.md:962 +msgid "$browser->pauseUnless(App::environment('testing'), 1000);" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:809 +#: ./docs/9.x/dusk.md:912 +#: ./docs/10.x/dusk.md:1016 +#: ./docs/11.x/dusk.md:1071 +#: ./docs/master/dusk.md:1067 msgid "You may also wait for a [named route's](/docs/{{version}}/routing#named-routes) location:" -msgstr "也可以等待 [命名路由](/docs/{{version}}/routing#named-routes) 的位置:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:811 +#: ./docs/9.x/dusk.md:914 +#: ./docs/10.x/dusk.md:1018 +#: ./docs/11.x/dusk.md:1073 +#: ./docs/master/dusk.md:1069 +msgid "$browser->waitForRoute($routeName, $parameters);" +msgstr "" -#: docs/10.x/dusk.md:block 336 (code) -msgid "$browser->waitForRoute($routeName, $parameters);\n" -msgstr "$browser->waitForRoute($routeName, $parameters);\n" +# P +#: ./docs/8.x/dusk.md:813 +#: ./docs/9.x/dusk.md:916 +#: ./docs/10.x/dusk.md:1020 +#: ./docs/11.x/dusk.md:1075 +#: ./docs/master/dusk.md:1071 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:814 +#: ./docs/10.x/dusk.md:1021 +#: ./docs/11.x/dusk.md:1076 +#: ./docs/master/dusk.md:1072 +msgid "Waiting for Page Reloads" +msgstr "" -#: docs/10.x/dusk.md:block 338 (header) -msgid "Waiting For Page Reloads" -msgstr "等待頁面重新整理" +# H4 +#: ./docs/10.x/dusk.md:815 +#: ./docs/11.x/dusk.md:870 +#: ./docs/master/dusk.md:866 +msgid "Drag and Drop" +msgstr "" -#: docs/10.x/dusk.md:block 339 (paragraph) +# P +#: ./docs/8.x/dusk.md:816 +#: ./docs/9.x/dusk.md:919 +#: ./docs/10.x/dusk.md:1023 +#: ./docs/11.x/dusk.md:1078 +#: ./docs/master/dusk.md:1074 msgid "If you need to wait for a page to reload after performing an action, use the `waitForReload` method:" -msgstr "若有需要在執行特定動作前等待頁面重新整理,請使用 `waitForReload` 方法:" +msgstr "" -#: docs/10.x/dusk.md:block 340 (code) +# CODE +#: ./docs/8.x/dusk.md:818 +#: ./docs/9.x/dusk.md:921 +#: ./docs/10.x/dusk.md:1025 +#: ./docs/11.x/dusk.md:1080 +#: ./docs/master/dusk.md:1076 msgid "use Laravel\\Dusk\\Browser;\n\n" "$browser->waitForReload(function (Browser $browser) {\n" " $browser->press('Submit');\n" "})\n" -"->assertSee('Success!');\n" -msgstr "use Laravel\\Dusk\\Browser;\n\n" -"$browser->waitForReload(function (Browser $browser) {\n" -" $browser->press('Submit');\n" -"})\n" -"->assertSee('Success!');\n" +"->assertSee('Success!');" +msgstr "" -#: docs/10.x/dusk.md:block 341 (paragraph) +# P +#: ./docs/8.x/dusk.md:825 +#: ./docs/9.x/dusk.md:928 +#: ./docs/10.x/dusk.md:1032 +#: ./docs/11.x/dusk.md:1087 +#: ./docs/master/dusk.md:1083 msgid "Since the need to wait for the page to reload typically occurs after clicking a button, you may use the `clickAndWaitForReload` method for convenience:" -msgstr "由於我們通常會在點擊按鈕後等待頁面重新整理,因此可以使用更方便的 `clickAndWaitForReload` 方法:" +msgstr "" -#: docs/10.x/dusk.md:block 342 (code) +# CODE +#: ./docs/8.x/dusk.md:827 +#: ./docs/9.x/dusk.md:930 +#: ./docs/10.x/dusk.md:1034 +#: ./docs/11.x/dusk.md:1089 +#: ./docs/master/dusk.md:1085 msgid "$browser->clickAndWaitForReload('.selector')\n" -" ->assertSee('something');\n" -msgstr "$browser->clickAndWaitForReload('.selector')\n" -" ->assertSee('something');\n" +" ->assertSee('something');" +msgstr "" -#: docs/10.x/dusk.md:block 344 (header) +# P +#: ./docs/8.x/dusk.md:830 +#: ./docs/9.x/dusk.md:933 +#: ./docs/10.x/dusk.md:1037 +#: ./docs/11.x/dusk.md:1092 +#: ./docs/master/dusk.md:1088 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:831 +#: ./docs/9.x/dusk.md:934 msgid "Waiting On JavaScript Expressions" -msgstr "等待 JavaScript 運算式" +msgstr "" -#: docs/10.x/dusk.md:block 345 (paragraph) +# P +#: ./docs/8.x/dusk.md:833 +#: ./docs/9.x/dusk.md:936 +#: ./docs/10.x/dusk.md:1040 +#: ./docs/11.x/dusk.md:1095 +#: ./docs/master/dusk.md:1091 msgid "Sometimes you may wish to pause the execution of a test until a given JavaScript expression evaluates to `true`. You may easily accomplish this using the `waitUntil` method. When passing an expression to this method, you do not need to include the `return` keyword or an ending semi-colon:" -msgstr "有時候,我們可能會想暫停測試並等待某個給定的 JavaScript 運算式取值為 `true`。可使用 `waitUntil` 方法來輕鬆達成。將運算式傳給該方法時,不需要包含 `return` 關鍵字或結尾的分號:" +msgstr "" -#: docs/10.x/dusk.md:block 346 (code) +# CODE +#: ./docs/8.x/dusk.md:835 +#: ./docs/9.x/dusk.md:938 +#: ./docs/10.x/dusk.md:1042 +#: ./docs/11.x/dusk.md:1097 +#: ./docs/master/dusk.md:1093 msgid "// Wait a maximum of five seconds for the expression to be true...\n" "$browser->waitUntil('App.data.servers.length > 0');\n\n" "// Wait a maximum of one second for the expression to be true...\n" -"$browser->waitUntil('App.data.servers.length > 0', 1);\n" -msgstr "// 等待運算式為 True,最多 5 秒...\n" -"$browser->waitUntil('App.data.servers.length > 0');\n\n" -"// 等待運算式為 True,最多 1 秒...\n" -"$browser->waitUntil('App.data.servers.length > 0', 1);\n" +"$browser->waitUntil('App.data.servers.length > 0', 1);" +msgstr "" -#: docs/10.x/dusk.md:block 348 (header) +# P +#: ./docs/8.x/dusk.md:841 +#: ./docs/9.x/dusk.md:944 +#: ./docs/10.x/dusk.md:1048 +#: ./docs/11.x/dusk.md:1103 +#: ./docs/master/dusk.md:1099 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:842 +#: ./docs/9.x/dusk.md:945 msgid "Waiting On Vue Expressions" -msgstr "等待 Vue 運算式" +msgstr "" -#: docs/10.x/dusk.md:block 349 (paragraph) +# P +#: ./docs/8.x/dusk.md:844 +#: ./docs/9.x/dusk.md:947 +#: ./docs/10.x/dusk.md:1051 +#: ./docs/11.x/dusk.md:1106 +#: ./docs/master/dusk.md:1102 msgid "The `waitUntilVue` and `waitUntilVueIsNot` methods may be used to wait until a [Vue component](https://vuejs.org) attribute has a given value:" -msgstr "可使用 `waitUntilVue` 與 `waitUntilVueIsNot` 方法來等待給定的 [Vue 元件](https://vuejs.org) 屬性具有給定的值:" +msgstr "" -#: docs/10.x/dusk.md:block 350 (code) +# CODE +#: ./docs/8.x/dusk.md:846 +#: ./docs/9.x/dusk.md:949 +#: ./docs/10.x/dusk.md:1053 +#: ./docs/11.x/dusk.md:1108 +#: ./docs/master/dusk.md:1104 msgid "// Wait until the component attribute contains the given value...\n" "$browser->waitUntilVue('user.name', 'Taylor', '@user');\n\n" "// Wait until the component attribute doesn't contain the given value...\n" -"$browser->waitUntilVueIsNot('user.name', null, '@user');\n" -msgstr "// 等待直到 Vue 元件的屬性包含給定值...\n" -"$browser->waitUntilVue('user.name', 'Taylor', '@user');\n\n" -"// 等待直到 Vue 元件的屬性不包含給定值...\n" -"$browser->waitUntilVueIsNot('user.name', null, '@user');\n" - -#: docs/10.x/dusk.md:block 352 (header) -msgid "Waiting For JavaScript Events" -msgstr "等待 JavaScript 事件" - -#: docs/10.x/dusk.md:block 353 (paragraph) -msgid "The `waitForEvent` method can be used to pause the execution of a test until a JavaScript event occurs:" -msgstr "`waitForEvent` 方法可用來暫停執行測試,直到發生了某個 JavaScript 事件:" - -#: docs/10.x/dusk.md:block 354 (code) -msgid "$browser->waitForEvent('load');\n" -msgstr "$browser->waitForEvent('load');\n" - -#: docs/10.x/dusk.md:block 355 (paragraph) -msgid "The event listener is attached to the current scope, which is the `body` element by default. When using a scoped selector, the event listener will be attached to the matching element:" -msgstr "會附加一個 Event Listener 到目前的 Scope 上,預設為 `body` 元素。在使用限定範圍的 Selector 時,則會將該 Event Listener 附加到符合的元素上:" - -#: docs/10.x/dusk.md:block 356 (code) -msgid "$browser->with('iframe', function (Browser $iframe) {\n" -" // Wait for the iframe's load event...\n" -" $iframe->waitForEvent('load');\n" -"});\n" -msgstr "$browser->with('iframe', function (Browser $iframe) {\n" -" // 等待 iframe 的 load 事件...\n" -" $iframe->waitForEvent('load');\n" -"});\n" - -#: docs/10.x/dusk.md:block 357 (paragraph) -msgid "You may also provide a selector as the second argument to the `waitForEvent` method to attach the event listener to a specific element:" -msgstr "也可以使用 `waitForEvent` 方法的第二個引數來提供選擇器,以將 Event Listener 附加到特定的元素上:" - -#: docs/10.x/dusk.md:block 358 (code) -msgid "$browser->waitForEvent('load', '.selector');\n" -msgstr "$browser->waitForEvent('load', '.selector');\n" - -#: docs/10.x/dusk.md:block 359 (paragraph) -msgid "You may also wait for events on the `document` and `window` objects:" -msgstr "也可以在 `document` 或 `window` 物件上等待事件:" - -#: docs/10.x/dusk.md:block 360 (code) -msgid "// Wait until the document is scrolled...\n" -"$browser->waitForEvent('scroll', 'document');\n\n" -"// Wait a maximum of five seconds until the window is resized...\n" -"$browser->waitForEvent('resize', 'window', 5);\n" -msgstr "// 等待直到捲動畫面...\n" -"$browser->waitForEvent('scroll', 'document');\n\n" -"// 等待視窗縮放,最多 5 秒...\n" -"$browser->waitForEvent('resize', 'window', 5);\n" +"$browser->waitUntilVueIsNot('user.name', null, '@user');" +msgstr "" -#: docs/10.x/dusk.md:block 362 (header) +# P +#: ./docs/8.x/dusk.md:852 +#: ./docs/9.x/dusk.md:981 +#: ./docs/10.x/dusk.md:1085 +#: ./docs/11.x/dusk.md:1140 +#: ./docs/master/dusk.md:1136 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:853 +#: ./docs/9.x/dusk.md:982 msgid "Waiting With A Callback" -msgstr "包含回呼的等待" +msgstr "" -#: docs/10.x/dusk.md:block 363 (paragraph) +# P +#: ./docs/10.x/dusk.md:855 +#: ./docs/11.x/dusk.md:910 +#: ./docs/master/dusk.md:906 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/8.x/dusk.md:855 +#: ./docs/9.x/dusk.md:984 +#: ./docs/10.x/dusk.md:1088 +#: ./docs/11.x/dusk.md:1143 +#: ./docs/master/dusk.md:1139 msgid "Many of the \"wait\" methods in Dusk rely on the underlying `waitUsing` method. You may use this method directly to wait for a given closure to return `true`. The `waitUsing` method accepts the maximum number of seconds to wait, the interval at which the closure should be evaluated, the closure, and an optional failure message:" -msgstr "在 Dusk 中,許多的「wait」方法都仰賴於底層的 `waitUsing` 方法。可以直接使用該方法來等待給定的閉包回傳 `true`。`waitUsing` 方法接受等待最大秒數、閉包取值的時間間隔、閉包、以及一個可選的錯誤訊息:" +msgstr "" -#: docs/10.x/dusk.md:block 364 (code) +# H3 +#: ./docs/10.x/dusk.md:856 +#: ./docs/11.x/dusk.md:911 +#: ./docs/master/dusk.md:907 +msgid "Interacting With Inline Frames" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:857 +#: ./docs/9.x/dusk.md:986 +#: ./docs/10.x/dusk.md:1090 +#: ./docs/11.x/dusk.md:1145 +#: ./docs/master/dusk.md:1141 msgid "$browser->waitUsing(10, 1, function () use ($something) {\n" " return $something->isReady();\n" -"}, \"Something wasn't ready in time.\");\n" -msgstr "$browser->waitUsing(10, 1, function () use ($something) {\n" -" return $something->isReady();\n" -"}, \"Something wasn't ready in time.\");\n" +"}, \"Something wasn't ready in time.\");" +msgstr "" + +# P +#: ./docs/10.x/dusk.md:858 +#: ./docs/11.x/dusk.md:913 +#: ./docs/master/dusk.md:909 +msgid "If you need to interact with elements within an iframe, you may use the `withinFrame` method. All element interactions that take place within the closure provided to the `withinFrame` method will be scoped to the context of the specified iframe:" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:860 +#: ./docs/master/dusk.md:911 +msgid "$browser->withinFrame('#credit-card-details', function ($browser) {\n" +" $browser->type('input[name=\"cardnumber\"]', '4242424242424242')\n" +" ->type('input[name=\"exp-date\"]', '12/24')\n" +" ->type('input[name=\"cvc\"]', '123');\n" +" })->press('Pay');\n" +"});" +msgstr "" -#: docs/10.x/dusk.md:block 366 (header) +# P +#: ./docs/8.x/dusk.md:861 +#: ./docs/9.x/dusk.md:990 +#: ./docs/10.x/dusk.md:1094 +#: ./docs/11.x/dusk.md:1149 +#: ./docs/master/dusk.md:1145 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/dusk.md:862 +#: ./docs/9.x/dusk.md:991 msgid "Scrolling An Element Into View" -msgstr "將元素滾動進也沒" +msgstr "" -#: docs/10.x/dusk.md:block 367 (paragraph) +# P +#: ./docs/8.x/dusk.md:864 +#: ./docs/9.x/dusk.md:993 +#: ./docs/10.x/dusk.md:1097 +#: ./docs/11.x/dusk.md:1152 +#: ./docs/master/dusk.md:1148 msgid "Sometimes you may not be able to click on an element because it is outside of the viewable area of the browser. The `scrollIntoView` method will scroll the browser window until the element at the given selector is within the view:" -msgstr "有時候,我們可能沒辦法點擊某個元素,因為該元素在瀏覽器可視區域外。使用 `scrollIntoView` 方法可以滾動瀏覽器視窗,直到給定選擇器元素出現在顯示區內:" +msgstr "" -#: docs/10.x/dusk.md:block 368 (code) +# CODE +#: ./docs/8.x/dusk.md:866 +#: ./docs/9.x/dusk.md:995 +#: ./docs/10.x/dusk.md:1099 +#: ./docs/11.x/dusk.md:1154 +#: ./docs/master/dusk.md:1150 msgid "$browser->scrollIntoView('.selector')\n" -" ->click('.selector');\n" -msgstr "$browser->scrollIntoView('.selector')\n" -" ->click('.selector');\n" +" ->click('.selector');" +msgstr "" -#: docs/10.x/dusk.md:block 370 (header) +# P +#: ./docs/8.x/dusk.md:869 +#: ./docs/9.x/dusk.md:998 +#: ./docs/10.x/dusk.md:1102 +#: ./docs/11.x/dusk.md:1157 +#: ./docs/master/dusk.md:1153 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/dusk.md:870 +#: ./docs/9.x/dusk.md:999 +#: ./docs/10.x/dusk.md:1103 +#: ./docs/11.x/dusk.md:1158 +#: ./docs/master/dusk.md:1154 msgid "Available Assertions" -msgstr "可用的 Assertion" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:872 +#: ./docs/11.x/dusk.md:927 +#: ./docs/master/dusk.md:923 +msgid "$browser->with('.table', function (Browser $table) {\n" +" $table->assertSee('Hello World')\n" +" ->clickLink('Delete');\n" +"});" +msgstr "" -#: docs/10.x/dusk.md:block 371 (paragraph) +# P +#: ./docs/8.x/dusk.md:872 +#: ./docs/9.x/dusk.md:1001 +#: ./docs/10.x/dusk.md:1105 +#: ./docs/11.x/dusk.md:1160 +#: ./docs/master/dusk.md:1156 msgid "Dusk provides a variety of assertions that you may make against your application. All of the available assertions are documented in the list below:" -msgstr "Dusk 提供了多種可對網站進行的 Assertion。下面列出了所有可用的 Assertion:" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:879 +#: ./docs/11.x/dusk.md:934 +#: ./docs/master/dusk.md:930 +msgid " $browser->with('.table', function (Browser $table) {\n" +" // Current scope is `body .table`...\n\n" +" $browser->elsewhere('.page-title', function (Browser $title) {\n" +" // Current scope is `body .page-title`...\n" +" $title->assertSee('Hello World');\n" +" });\n\n" +" $browser->elsewhereWhenAvailable('.page-title', function (Browser $title) {\n" +" // Current scope is `body .page-title`...\n" +" $title->assertSee('Hello World');\n" +" });\n" +" });" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:887 +msgid "[assertTitle](#assert-title)\n" +"[assertTitleContains](#assert-title-contains)\n" +"[assertUrlIs](#assert-url-is)\n" +"[assertSchemeIs](#assert-scheme-is)\n" +"[assertSchemeIsNot](#assert-scheme-is-not)\n" +"[assertHostIs](#assert-host-is)\n" +"[assertHostIsNot](#assert-host-is-not)\n" +"[assertPortIs](#assert-port-is)\n" +"[assertPortIsNot](#assert-port-is-not)\n" +"[assertPathBeginsWith](#assert-path-begins-with)\n" +"[assertPathIs](#assert-path-is)\n" +"[assertPathIsNot](#assert-path-is-not)\n" +"[assertRouteIs](#assert-route-is)\n" +"[assertQueryStringHas](#assert-query-string-has)\n" +"[assertQueryStringMissing](#assert-query-string-missing)\n" +"[assertFragmentIs](#assert-fragment-is)\n" +"[assertFragmentBeginsWith](#assert-fragment-begins-with)\n" +"[assertFragmentIsNot](#assert-fragment-is-not)\n" +"[assertHasCookie](#assert-has-cookie)\n" +"[assertHasPlainCookie](#assert-has-plain-cookie)\n" +"[assertCookieMissing](#assert-cookie-missing)\n" +"[assertPlainCookieMissing](#assert-plain-cookie-missing)\n" +"[assertCookieValue](#assert-cookie-value)\n" +"[assertPlainCookieValue](#assert-plain-cookie-value)\n" +"[assertSee](#assert-see)\n" +"[assertDontSee](#assert-dont-see)\n" +"[assertSeeIn](#assert-see-in)\n" +"[assertDontSeeIn](#assert-dont-see-in)\n" +"[assertSeeAnythingIn](#assert-see-anything-in)\n" +"[assertSeeNothingIn](#assert-see-nothing-in)\n" +"[assertScript](#assert-script)\n" +"[assertSourceHas](#assert-source-has)\n" +"[assertSourceMissing](#assert-source-missing)\n" +"[assertSeeLink](#assert-see-link)\n" +"[assertDontSeeLink](#assert-dont-see-link)\n" +"[assertInputValue](#assert-input-value)\n" +"[assertInputValueIsNot](#assert-input-value-is-not)\n" +"[assertChecked](#assert-checked)\n" +"[assertNotChecked](#assert-not-checked)\n" +"[assertRadioSelected](#assert-radio-selected)\n" +"[assertRadioNotSelected](#assert-radio-not-selected)\n" +"[assertSelected](#assert-selected)\n" +"[assertNotSelected](#assert-not-selected)\n" +"[assertSelectHasOptions](#assert-select-has-options)\n" +"[assertSelectMissingOptions](#assert-select-missing-options)\n" +"[assertSelectHasOption](#assert-select-has-option)\n" +"[assertSelectMissingOption](#assert-select-missing-option)\n" +"[assertValue](#assert-value)\n" +"[assertValueIsNot](#assert-value-is-not)\n" +"[assertAttribute](#assert-attribute)\n" +"[assertAttributeContains](#assert-attribute-contains)\n" +"[assertAriaAttribute](#assert-aria-attribute)\n" +"[assertDataAttribute](#assert-data-attribute)\n" +"[assertVisible](#assert-visible)\n" +"[assertPresent](#assert-present)\n" +"[assertNotPresent](#assert-not-present)\n" +"[assertMissing](#assert-missing)\n" +"[assertInputPresent](#assert-input-present)\n" +"[assertInputMissing](#assert-input-missing)\n" +"[assertDialogOpened](#assert-dialog-opened)\n" +"[assertEnabled](#assert-enabled)\n" +"[assertDisabled](#assert-disabled)\n" +"[assertButtonEnabled](#assert-button-enabled)\n" +"[assertButtonDisabled](#assert-button-disabled)\n" +"[assertFocused](#assert-focused)\n" +"[assertNotFocused](#assert-not-focused)\n" +"[assertAuthenticated](#assert-authenticated)\n" +"[assertGuest](#assert-guest)\n" +"[assertAuthenticatedAs](#assert-authenticated-as)\n" +"[assertVue](#assert-vue)\n" +"[assertVueIsNot](#assert-vue-is-not)\n" +"[assertVueContains](#assert-vue-contains)\n" +"[assertVueDoesNotContain](#assert-vue-does-not-contain)" +msgstr "" + +# P +#: ./docs/9.x/dusk.md:890 +#: ./docs/10.x/dusk.md:994 +#: ./docs/11.x/dusk.md:1049 +#: ./docs/master/dusk.md:1045 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/dusk.md:891 +msgid "Waiting For Inputs" +msgstr "" + +# P +#: ./docs/9.x/dusk.md:893 +#: ./docs/10.x/dusk.md:997 +#: ./docs/11.x/dusk.md:1052 +#: ./docs/master/dusk.md:1048 +msgid "The `waitForInput` method may be used to wait until the given input field is visible on the page:" +msgstr "" + +# H3 +#: ./docs/10.x/dusk.md:894 +#: ./docs/11.x/dusk.md:949 +#: ./docs/master/dusk.md:945 +msgid "Waiting for Elements" +msgstr "" + +# CODE +#: ./docs/9.x/dusk.md:895 +#: ./docs/10.x/dusk.md:999 +#: ./docs/11.x/dusk.md:1054 +#: ./docs/master/dusk.md:1050 +msgid "// Wait a maximum of five seconds for the input...\n" +"$browser->waitForInput($field);\n\n" +"// Wait a maximum of one second for the input...\n" +"$browser->waitForInput($field, 1);" +msgstr "" + +# H4 +#: ./docs/10.x/dusk.md:914 +#: ./docs/11.x/dusk.md:969 +#: ./docs/master/dusk.md:965 +msgid "Waiting for Selectors" +msgstr "" + +# CODE +#: ./docs/11.x/dusk.md:915 +msgid "$browser->withinFrame('#credit-card-details', function ($browser) {\n" +" $browser->type('input[name=\"cardnumber\"]', '4242424242424242')\n" +" ->type('input[name=\"exp-date\"]', '1224')\n" +" ->type('input[name=\"cvc\"]', '123')\n" +" ->press('Pay');\n" +"});" +msgstr "" + +# H4 +#: ./docs/9.x/dusk.md:917 +msgid "Waiting For Page Reloads" +msgstr "" + +# P +#: ./docs/9.x/dusk.md:955 +#: ./docs/10.x/dusk.md:1059 +#: ./docs/11.x/dusk.md:1114 +#: ./docs/master/dusk.md:1110 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/9.x/dusk.md:956 +msgid "Waiting For JavaScript Events" +msgstr "" + +# P +#: ./docs/9.x/dusk.md:958 +#: ./docs/10.x/dusk.md:1062 +#: ./docs/11.x/dusk.md:1117 +#: ./docs/master/dusk.md:1113 +msgid "The `waitForEvent` method can be used to pause the execution of a test until a JavaScript event occurs:" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:959 +#: ./docs/11.x/dusk.md:1014 +#: ./docs/master/dusk.md:1010 +msgid "$browser->whenAvailable('.modal', function (Browser $modal) {\n" +" $modal->assertSee('Hello World')\n" +" ->press('OK');\n" +"});" +msgstr "" + +# CODE +#: ./docs/9.x/dusk.md:960 +#: ./docs/10.x/dusk.md:1064 +#: ./docs/11.x/dusk.md:1119 +#: ./docs/master/dusk.md:1115 +msgid "$browser->waitForEvent('load');" +msgstr "" -#: docs/10.x/dusk.md:block 374 (paragraph) -msgid "[assertTitle](#assert-title) [assertTitleContains](#assert-title-contains) [assertUrlIs](#assert-url-is) [assertSchemeIs](#assert-scheme-is) [assertSchemeIsNot](#assert-scheme-is-not) [assertHostIs](#assert-host-is) [assertHostIsNot](#assert-host-is-not) [assertPortIs](#assert-port-is) [assertPortIsNot](#assert-port-is-not) [assertPathBeginsWith](#assert-path-begins-with) [assertPathIs](#assert-path-is) [assertPathIsNot](#assert-path-is-not) [assertRouteIs](#assert-route-is) [assertQueryStringHas](#assert-query-string-has) [assertQueryStringMissing](#assert-query-string-missing) [assertFragmentIs](#assert-fragment-is) [assertFragmentBeginsWith](#assert-fragment-begins-with) [assertFragmentIsNot](#assert-fragment-is-not) [assertHasCookie](#assert-has-cookie) [assertHasPlainCookie](#assert-has-plain-cookie) [assertCookieMissing](#assert-cookie-missing) [assertPlainCookieMissing](#assert-plain-cookie-missing) [assertCookieValue](#assert-cookie-value) [assertPlainCookieValue](#assert-plain-cookie-value) [assertSee](#assert-see) [assertDontSee](#assert-dont-see) [assertSeeIn](#assert-see-in) [assertDontSeeIn](#assert-dont-see-in) [assertSeeAnythingIn](#assert-see-anything-in) [assertSeeNothingIn](#assert-see-nothing-in) [assertScript](#assert-script) [assertSourceHas](#assert-source-has) [assertSourceMissing](#assert-source-missing) [assertSeeLink](#assert-see-link) [assertDontSeeLink](#assert-dont-see-link) [assertInputValue](#assert-input-value) [assertInputValueIsNot](#assert-input-value-is-not) [assertChecked](#assert-checked) [assertNotChecked](#assert-not-checked) [assertIndeterminate](#assert-indeterminate) [assertRadioSelected](#assert-radio-selected) [assertRadioNotSelected](#assert-radio-not-selected) [assertSelected](#assert-selected) [assertNotSelected](#assert-not-selected) [assertSelectHasOptions](#assert-select-has-options) [assertSelectMissingOptions](#assert-select-missing-options) [assertSelectHasOption](#assert-select-has-option) [assertSelectMissingOption](#assert-select-missing-option) [assertValue](#assert-value) [assertValueIsNot](#assert-value-is-not) [assertAttribute](#assert-attribute) [assertAttributeContains](#assert-attribute-contains) [assertAriaAttribute](#assert-aria-attribute) [assertDataAttribute](#assert-data-attribute) [assertVisible](#assert-visible) [assertPresent](#assert-present) [assertNotPresent](#assert-not-present) [assertMissing](#assert-missing) [assertInputPresent](#assert-input-present) [assertInputMissing](#assert-input-missing) [assertDialogOpened](#assert-dialog-opened) [assertEnabled](#assert-enabled) [assertDisabled](#assert-disabled) [assertButtonEnabled](#assert-button-enabled) [assertButtonDisabled](#assert-button-disabled) [assertFocused](#assert-focused) [assertNotFocused](#assert-not-focused) [assertAuthenticated](#assert-authenticated) [assertGuest](#assert-guest) [assertAuthenticatedAs](#assert-authenticated-as) [assertVue](#assert-vue) [assertVueIsNot](#assert-vue-is-not) [assertVueContains](#assert-vue-contains) [assertVueDoesNotContain](#assert-vue-does-not-contain)" -msgstr "[assertTitle](#assert-title) [assertTitleContains](#assert-title-contains) [assertUrlIs](#assert-url-is) [assertSchemeIs](#assert-scheme-is) [assertSchemeIsNot](#assert-scheme-is-not) [assertHostIs](#assert-host-is) [assertHostIsNot](#assert-host-is-not) [assertPortIs](#assert-port-is) [assertPortIsNot](#assert-port-is-not) [assertPathBeginsWith](#assert-path-begins-with) [assertPathIs](#assert-path-is) [assertPathIsNot](#assert-path-is-not) [assertRouteIs](#assert-route-is) [assertQueryStringHas](#assert-query-string-has) [assertQueryStringMissing](#assert-query-string-missing) [assertFragmentIs](#assert-fragment-is) [assertFragmentBeginsWith](#assert-fragment-begins-with) [assertFragmentIsNot](#assert-fragment-is-not) [assertHasCookie](#assert-has-cookie) [assertHasPlainCookie](#assert-has-plain-cookie) [assertCookieMissing](#assert-cookie-missing) [assertPlainCookieMissing](#assert-plain-cookie-missing) [assertCookieValue](#assert-cookie-value) [assertPlainCookieValue](#assert-plain-cookie-value) [assertSee](#assert-see) [assertDontSee](#assert-dont-see) [assertSeeIn](#assert-see-in) [assertDontSeeIn](#assert-dont-see-in) [assertSeeAnythingIn](#assert-see-anything-in) [assertSeeNothingIn](#assert-see-nothing-in) [assertScript](#assert-script) [assertSourceHas](#assert-source-has) [assertSourceMissing](#assert-source-missing) [assertSeeLink](#assert-see-link) [assertDontSeeLink](#assert-dont-see-link) [assertInputValue](#assert-input-value) [assertInputValueIsNot](#assert-input-value-is-not) [assertChecked](#assert-checked) [assertNotChecked](#assert-not-checked) [assertIndeterminate](#assert-indeterminate) [assertRadioSelected](#assert-radio-selected) [assertRadioNotSelected](#assert-radio-not-selected) [assertSelected](#assert-selected) [assertNotSelected](#assert-not-selected) [assertSelectHasOptions](#assert-select-has-options) [assertSelectMissingOptions](#assert-select-missing-options) [assertSelectHasOption](#assert-select-has-option) [assertSelectMissingOption](#assert-select-missing-option) [assertValue](#assert-value) [assertValueIsNot](#assert-value-is-not) [assertAttribute](#assert-attribute) [assertAttributeContains](#assert-attribute-contains) [assertAriaAttribute](#assert-aria-attribute) [assertDataAttribute](#assert-data-attribute) [assertVisible](#assert-visible) [assertPresent](#assert-present) [assertNotPresent](#assert-not-present) [assertMissing](#assert-missing) [assertInputPresent](#assert-input-present) [assertInputMissing](#assert-input-missing) [assertDialogOpened](#assert-dialog-opened) [assertEnabled](#assert-enabled) [assertDisabled](#assert-disabled) [assertButtonEnabled](#assert-button-enabled) [assertButtonDisabled](#assert-button-disabled) [assertFocused](#assert-focused) [assertNotFocused](#assert-not-focused) [assertAuthenticated](#assert-authenticated) [assertGuest](#assert-guest) [assertAuthenticatedAs](#assert-authenticated-as) [assertVue](#assert-vue) [assertVueIsNot](#assert-vue-is-not) [assertVueContains](#assert-vue-contains) [assertVueDoesNotContain](#assert-vue-does-not-contain)" +# P +#: ./docs/9.x/dusk.md:962 +#: ./docs/10.x/dusk.md:1066 +#: ./docs/11.x/dusk.md:1121 +#: ./docs/master/dusk.md:1117 +msgid "The event listener is attached to the current scope, which is the `body` element by default. When using a scoped selector, the event listener will be attached to the matching element:" +msgstr "" -#: docs/10.x/dusk.md:block 377 (header) +# P +#: ./docs/8.x/dusk.md:963 +#: ./docs/9.x/dusk.md:1095 +#: ./docs/10.x/dusk.md:1200 +#: ./docs/11.x/dusk.md:1257 +#: ./docs/master/dusk.md:1251 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:964 +#: ./docs/9.x/dusk.md:1096 +#: ./docs/10.x/dusk.md:1201 +#: ./docs/11.x/dusk.md:1258 +#: ./docs/master/dusk.md:1252 msgid "assertTitle" -msgstr "assertTitle" +msgstr "" + +# CODE +#: ./docs/9.x/dusk.md:964 +msgid "$browser->with('iframe', function ($iframe) {\n" +" // Wait for the iframe's load event...\n" +" $iframe->waitForEvent('load');\n" +"});" +msgstr "" -#: docs/10.x/dusk.md:block 378 (paragraph) +# H4 +#: ./docs/10.x/dusk.md:965 +#: ./docs/11.x/dusk.md:1020 +#: ./docs/master/dusk.md:1016 +msgid "Waiting for Text" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:966 +#: ./docs/9.x/dusk.md:1098 +#: ./docs/10.x/dusk.md:1203 +#: ./docs/11.x/dusk.md:1260 +#: ./docs/master/dusk.md:1254 msgid "Assert that the page title matches the given text:" -msgstr "判斷頁面標題符合給定文字:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:968 +#: ./docs/9.x/dusk.md:1100 +#: ./docs/10.x/dusk.md:1205 +#: ./docs/11.x/dusk.md:1262 +#: ./docs/master/dusk.md:1256 +msgid "$browser->assertTitle($title);" +msgstr "" -#: docs/10.x/dusk.md:block 379 (code) -msgid "$browser->assertTitle($title);\n" -msgstr "$browser->assertTitle($title);\n" +# P +#: ./docs/9.x/dusk.md:969 +#: ./docs/10.x/dusk.md:1073 +#: ./docs/11.x/dusk.md:1128 +#: ./docs/master/dusk.md:1124 +msgid "You may also provide a selector as the second argument to the `waitForEvent` method to attach the event listener to a specific element:" +msgstr "" -#: docs/10.x/dusk.md:block 381 (header) +# P +#: ./docs/8.x/dusk.md:970 +#: ./docs/9.x/dusk.md:1102 +#: ./docs/10.x/dusk.md:1207 +#: ./docs/11.x/dusk.md:1264 +#: ./docs/master/dusk.md:1258 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:971 +#: ./docs/9.x/dusk.md:1103 +#: ./docs/10.x/dusk.md:1208 +#: ./docs/11.x/dusk.md:1265 +#: ./docs/master/dusk.md:1259 msgid "assertTitleContains" -msgstr "assertTitleContains" +msgstr "" -#: docs/10.x/dusk.md:block 382 (paragraph) +# CODE +#: ./docs/9.x/dusk.md:971 +#: ./docs/10.x/dusk.md:1075 +#: ./docs/11.x/dusk.md:1130 +#: ./docs/master/dusk.md:1126 +msgid "$browser->waitForEvent('load', '.selector');" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:973 +#: ./docs/9.x/dusk.md:1105 +#: ./docs/10.x/dusk.md:1210 +#: ./docs/11.x/dusk.md:1267 +#: ./docs/master/dusk.md:1261 msgid "Assert that the page title contains the given text:" -msgstr "判斷頁面標題包含給定文字:" +msgstr "" + +# P +#: ./docs/9.x/dusk.md:973 +#: ./docs/10.x/dusk.md:1077 +#: ./docs/11.x/dusk.md:1132 +#: ./docs/master/dusk.md:1128 +msgid "You may also wait for events on the `document` and `window` objects:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:975 +#: ./docs/9.x/dusk.md:1107 +#: ./docs/10.x/dusk.md:1212 +#: ./docs/11.x/dusk.md:1269 +#: ./docs/master/dusk.md:1263 +msgid "$browser->assertTitleContains($title);" +msgstr "" -#: docs/10.x/dusk.md:block 383 (code) -msgid "$browser->assertTitleContains($title);\n" -msgstr "$browser->assertTitleContains($title);\n" +# CODE +#: ./docs/9.x/dusk.md:975 +#: ./docs/10.x/dusk.md:1079 +#: ./docs/11.x/dusk.md:1134 +#: ./docs/master/dusk.md:1130 +msgid "// Wait until the document is scrolled...\n" +"$browser->waitForEvent('scroll', 'document');\n\n" +"// Wait a maximum of five seconds until the window is resized...\n" +"$browser->waitForEvent('resize', 'window', 5);" +msgstr "" -#: docs/10.x/dusk.md:block 385 (header) +# P +#: ./docs/8.x/dusk.md:977 +#: ./docs/9.x/dusk.md:1109 +#: ./docs/10.x/dusk.md:1214 +#: ./docs/11.x/dusk.md:1271 +#: ./docs/master/dusk.md:1265 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:978 +#: ./docs/9.x/dusk.md:1110 +#: ./docs/10.x/dusk.md:1215 +#: ./docs/11.x/dusk.md:1272 +#: ./docs/master/dusk.md:1266 msgid "assertUrlIs" -msgstr "assertUrlIs" +msgstr "" -#: docs/10.x/dusk.md:block 386 (paragraph) +# P +#: ./docs/8.x/dusk.md:980 +#: ./docs/9.x/dusk.md:1112 +#: ./docs/10.x/dusk.md:1217 +#: ./docs/11.x/dusk.md:1274 +#: ./docs/master/dusk.md:1268 msgid "Assert that the current URL (without the query string) matches the given string:" -msgstr "判斷目前 URL (不含查詢字串 Query String) 符合給定字串:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:982 +#: ./docs/9.x/dusk.md:1114 +#: ./docs/10.x/dusk.md:1219 +#: ./docs/11.x/dusk.md:1276 +#: ./docs/master/dusk.md:1270 +msgid "$browser->assertUrlIs($url);" +msgstr "" -#: docs/10.x/dusk.md:block 387 (code) -msgid "$browser->assertUrlIs($url);\n" -msgstr "$browser->assertUrlIs($url);\n" +# H4 +#: ./docs/10.x/dusk.md:984 +#: ./docs/11.x/dusk.md:1039 +#: ./docs/master/dusk.md:1035 +msgid "Waiting for Links" +msgstr "" -#: docs/10.x/dusk.md:block 389 (header) +# P +#: ./docs/8.x/dusk.md:984 +#: ./docs/9.x/dusk.md:1116 +#: ./docs/10.x/dusk.md:1221 +#: ./docs/11.x/dusk.md:1278 +#: ./docs/master/dusk.md:1272 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:985 +#: ./docs/9.x/dusk.md:1117 +#: ./docs/10.x/dusk.md:1222 +#: ./docs/11.x/dusk.md:1279 +#: ./docs/master/dusk.md:1273 msgid "assertSchemeIs" -msgstr "assertSchemeIs" +msgstr "" -#: docs/10.x/dusk.md:block 390 (paragraph) +# P +#: ./docs/8.x/dusk.md:987 +#: ./docs/9.x/dusk.md:1119 +#: ./docs/10.x/dusk.md:1224 +#: ./docs/11.x/dusk.md:1281 +#: ./docs/master/dusk.md:1275 msgid "Assert that the current URL scheme matches the given scheme:" -msgstr "判斷目前 URL 的協定 (Scheme) 符合給定協定:" +msgstr "" -#: docs/10.x/dusk.md:block 391 (code) -msgid "$browser->assertSchemeIs($scheme);\n" -msgstr "$browser->assertSchemeIs($scheme);\n" +# CODE +#: ./docs/8.x/dusk.md:989 +#: ./docs/9.x/dusk.md:1121 +#: ./docs/10.x/dusk.md:1226 +#: ./docs/11.x/dusk.md:1283 +#: ./docs/master/dusk.md:1277 +msgid "$browser->assertSchemeIs($scheme);" +msgstr "" -#: docs/10.x/dusk.md:block 393 (header) +# P +#: ./docs/8.x/dusk.md:991 +#: ./docs/9.x/dusk.md:1123 +#: ./docs/10.x/dusk.md:1228 +#: ./docs/11.x/dusk.md:1285 +#: ./docs/master/dusk.md:1279 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:992 +#: ./docs/9.x/dusk.md:1124 +#: ./docs/10.x/dusk.md:1229 +#: ./docs/11.x/dusk.md:1286 +#: ./docs/master/dusk.md:1280 msgid "assertSchemeIsNot" -msgstr "assertSchemeIsNot" +msgstr "" -#: docs/10.x/dusk.md:block 394 (paragraph) +# P +#: ./docs/8.x/dusk.md:994 +#: ./docs/9.x/dusk.md:1126 +#: ./docs/10.x/dusk.md:1231 +#: ./docs/11.x/dusk.md:1288 +#: ./docs/master/dusk.md:1282 msgid "Assert that the current URL scheme does not match the given scheme:" -msgstr "判斷目前的 URL 協定 (Scheme) 不符合給定協定:" +msgstr "" + +# H4 +#: ./docs/10.x/dusk.md:995 +#: ./docs/11.x/dusk.md:1050 +#: ./docs/master/dusk.md:1046 +msgid "Waiting for Inputs" +msgstr "" -#: docs/10.x/dusk.md:block 395 (code) -msgid "$browser->assertSchemeIsNot($scheme);\n" -msgstr "$browser->assertSchemeIsNot($scheme);\n" +# CODE +#: ./docs/8.x/dusk.md:996 +#: ./docs/9.x/dusk.md:1128 +#: ./docs/10.x/dusk.md:1233 +#: ./docs/11.x/dusk.md:1290 +#: ./docs/master/dusk.md:1284 +msgid "$browser->assertSchemeIsNot($scheme);" +msgstr "" -#: docs/10.x/dusk.md:block 397 (header) +# P +#: ./docs/8.x/dusk.md:998 +#: ./docs/9.x/dusk.md:1130 +#: ./docs/10.x/dusk.md:1235 +#: ./docs/11.x/dusk.md:1292 +#: ./docs/master/dusk.md:1286 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:999 +#: ./docs/9.x/dusk.md:1131 +#: ./docs/10.x/dusk.md:1236 +#: ./docs/11.x/dusk.md:1293 +#: ./docs/master/dusk.md:1287 msgid "assertHostIs" -msgstr "assertHostIs" +msgstr "" -#: docs/10.x/dusk.md:block 398 (paragraph) +# P +#: ./docs/8.x/dusk.md:1001 +#: ./docs/9.x/dusk.md:1133 +#: ./docs/10.x/dusk.md:1238 +#: ./docs/11.x/dusk.md:1295 +#: ./docs/master/dusk.md:1289 msgid "Assert that the current URL host matches the given host:" -msgstr "判斷目前 URL 的主機名稱 (Host) 符合給定主機名稱:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:1003 +#: ./docs/9.x/dusk.md:1135 +#: ./docs/10.x/dusk.md:1240 +#: ./docs/11.x/dusk.md:1297 +#: ./docs/master/dusk.md:1291 +msgid "$browser->assertHostIs($host);" +msgstr "" -#: docs/10.x/dusk.md:block 399 (code) -msgid "$browser->assertHostIs($host);\n" -msgstr "$browser->assertHostIs($host);\n" +# P +#: ./docs/8.x/dusk.md:1005 +#: ./docs/9.x/dusk.md:1137 +#: ./docs/10.x/dusk.md:1242 +#: ./docs/11.x/dusk.md:1299 +#: ./docs/master/dusk.md:1293 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/dusk.md:1006 +#: ./docs/11.x/dusk.md:1061 +#: ./docs/master/dusk.md:1057 +msgid "Waiting on the Page Location" +msgstr "" -#: docs/10.x/dusk.md:block 401 (header) +# H4 +#: ./docs/8.x/dusk.md:1006 +#: ./docs/9.x/dusk.md:1138 +#: ./docs/10.x/dusk.md:1243 +#: ./docs/11.x/dusk.md:1300 +#: ./docs/master/dusk.md:1294 msgid "assertHostIsNot" -msgstr "assertHostIsNot" +msgstr "" -#: docs/10.x/dusk.md:block 402 (paragraph) +# P +#: ./docs/8.x/dusk.md:1008 +#: ./docs/9.x/dusk.md:1140 +#: ./docs/10.x/dusk.md:1245 +#: ./docs/11.x/dusk.md:1302 +#: ./docs/master/dusk.md:1296 msgid "Assert that the current URL host does not match the given host:" -msgstr "判斷目前 URL 的主機名稱 (Host) 不符合給定主機名稱:" +msgstr "" -#: docs/10.x/dusk.md:block 403 (code) -msgid "$browser->assertHostIsNot($host);\n" -msgstr "$browser->assertHostIsNot($host);\n" +# CODE +#: ./docs/8.x/dusk.md:1010 +#: ./docs/9.x/dusk.md:1142 +#: ./docs/10.x/dusk.md:1247 +#: ./docs/11.x/dusk.md:1304 +#: ./docs/master/dusk.md:1298 +msgid "$browser->assertHostIsNot($host);" +msgstr "" -#: docs/10.x/dusk.md:block 405 (header) +# P +#: ./docs/8.x/dusk.md:1012 +#: ./docs/9.x/dusk.md:1144 +#: ./docs/10.x/dusk.md:1249 +#: ./docs/11.x/dusk.md:1306 +#: ./docs/master/dusk.md:1300 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1013 +#: ./docs/9.x/dusk.md:1145 +#: ./docs/10.x/dusk.md:1250 +#: ./docs/11.x/dusk.md:1307 +#: ./docs/master/dusk.md:1301 msgid "assertPortIs" -msgstr "assertPortIs" +msgstr "" -#: docs/10.x/dusk.md:block 406 (paragraph) +# P +#: ./docs/8.x/dusk.md:1015 +#: ./docs/9.x/dusk.md:1147 +#: ./docs/10.x/dusk.md:1252 +#: ./docs/11.x/dusk.md:1309 +#: ./docs/master/dusk.md:1303 msgid "Assert that the current URL port matches the given port:" -msgstr "判斷目前 URL 的連接埠 (Port) 符合給定連接埠:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:1017 +#: ./docs/9.x/dusk.md:1149 +#: ./docs/10.x/dusk.md:1254 +#: ./docs/11.x/dusk.md:1311 +#: ./docs/master/dusk.md:1305 +msgid "$browser->assertPortIs($port);" +msgstr "" -#: docs/10.x/dusk.md:block 407 (code) -msgid "$browser->assertPortIs($port);\n" -msgstr "$browser->assertPortIs($port);\n" +# P +#: ./docs/9.x/dusk.md:1018 +msgid "[assertTitle](#assert-title)\n" +"[assertTitleContains](#assert-title-contains)\n" +"[assertUrlIs](#assert-url-is)\n" +"[assertSchemeIs](#assert-scheme-is)\n" +"[assertSchemeIsNot](#assert-scheme-is-not)\n" +"[assertHostIs](#assert-host-is)\n" +"[assertHostIsNot](#assert-host-is-not)\n" +"[assertPortIs](#assert-port-is)\n" +"[assertPortIsNot](#assert-port-is-not)\n" +"[assertPathBeginsWith](#assert-path-begins-with)\n" +"[assertPathIs](#assert-path-is)\n" +"[assertPathIsNot](#assert-path-is-not)\n" +"[assertRouteIs](#assert-route-is)\n" +"[assertQueryStringHas](#assert-query-string-has)\n" +"[assertQueryStringMissing](#assert-query-string-missing)\n" +"[assertFragmentIs](#assert-fragment-is)\n" +"[assertFragmentBeginsWith](#assert-fragment-begins-with)\n" +"[assertFragmentIsNot](#assert-fragment-is-not)\n" +"[assertHasCookie](#assert-has-cookie)\n" +"[assertHasPlainCookie](#assert-has-plain-cookie)\n" +"[assertCookieMissing](#assert-cookie-missing)\n" +"[assertPlainCookieMissing](#assert-plain-cookie-missing)\n" +"[assertCookieValue](#assert-cookie-value)\n" +"[assertPlainCookieValue](#assert-plain-cookie-value)\n" +"[assertSee](#assert-see)\n" +"[assertDontSee](#assert-dont-see)\n" +"[assertSeeIn](#assert-see-in)\n" +"[assertDontSeeIn](#assert-dont-see-in)\n" +"[assertSeeAnythingIn](#assert-see-anything-in)\n" +"[assertSeeNothingIn](#assert-see-nothing-in)\n" +"[assertScript](#assert-script)\n" +"[assertSourceHas](#assert-source-has)\n" +"[assertSourceMissing](#assert-source-missing)\n" +"[assertSeeLink](#assert-see-link)\n" +"[assertDontSeeLink](#assert-dont-see-link)\n" +"[assertInputValue](#assert-input-value)\n" +"[assertInputValueIsNot](#assert-input-value-is-not)\n" +"[assertChecked](#assert-checked)\n" +"[assertNotChecked](#assert-not-checked)\n" +"[assertIndeterminate](#assert-indeterminate)\n" +"[assertRadioSelected](#assert-radio-selected)\n" +"[assertRadioNotSelected](#assert-radio-not-selected)\n" +"[assertSelected](#assert-selected)\n" +"[assertNotSelected](#assert-not-selected)\n" +"[assertSelectHasOptions](#assert-select-has-options)\n" +"[assertSelectMissingOptions](#assert-select-missing-options)\n" +"[assertSelectHasOption](#assert-select-has-option)\n" +"[assertSelectMissingOption](#assert-select-missing-option)\n" +"[assertValue](#assert-value)\n" +"[assertValueIsNot](#assert-value-is-not)\n" +"[assertAttribute](#assert-attribute)\n" +"[assertAttributeContains](#assert-attribute-contains)\n" +"[assertAriaAttribute](#assert-aria-attribute)\n" +"[assertDataAttribute](#assert-data-attribute)\n" +"[assertVisible](#assert-visible)\n" +"[assertPresent](#assert-present)\n" +"[assertNotPresent](#assert-not-present)\n" +"[assertMissing](#assert-missing)\n" +"[assertInputPresent](#assert-input-present)\n" +"[assertInputMissing](#assert-input-missing)\n" +"[assertDialogOpened](#assert-dialog-opened)\n" +"[assertEnabled](#assert-enabled)\n" +"[assertDisabled](#assert-disabled)\n" +"[assertButtonEnabled](#assert-button-enabled)\n" +"[assertButtonDisabled](#assert-button-disabled)\n" +"[assertFocused](#assert-focused)\n" +"[assertNotFocused](#assert-not-focused)\n" +"[assertAuthenticated](#assert-authenticated)\n" +"[assertGuest](#assert-guest)\n" +"[assertAuthenticatedAs](#assert-authenticated-as)\n" +"[assertVue](#assert-vue)\n" +"[assertVueIsNot](#assert-vue-is-not)\n" +"[assertVueContains](#assert-vue-contains)\n" +"[assertVueDoesNotContain](#assert-vue-does-not-contain)" +msgstr "" -#: docs/10.x/dusk.md:block 409 (header) +# P +#: ./docs/8.x/dusk.md:1019 +#: ./docs/9.x/dusk.md:1151 +#: ./docs/10.x/dusk.md:1256 +#: ./docs/11.x/dusk.md:1313 +#: ./docs/master/dusk.md:1307 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1020 +#: ./docs/9.x/dusk.md:1152 +#: ./docs/10.x/dusk.md:1257 +#: ./docs/11.x/dusk.md:1314 +#: ./docs/master/dusk.md:1308 msgid "assertPortIsNot" -msgstr "assertPortIsNot" +msgstr "" -#: docs/10.x/dusk.md:block 410 (paragraph) +# P +#: ./docs/8.x/dusk.md:1022 +#: ./docs/9.x/dusk.md:1154 +#: ./docs/10.x/dusk.md:1259 +#: ./docs/11.x/dusk.md:1316 +#: ./docs/master/dusk.md:1310 msgid "Assert that the current URL port does not match the given port:" -msgstr "判斷目前 URL 的連接埠 (Port) 不符合給定連接埠:" +msgstr "" -#: docs/10.x/dusk.md:block 411 (code) -msgid "$browser->assertPortIsNot($port);\n" -msgstr "$browser->assertPortIsNot($port);\n" +# CODE +#: ./docs/8.x/dusk.md:1024 +#: ./docs/9.x/dusk.md:1156 +#: ./docs/10.x/dusk.md:1261 +#: ./docs/11.x/dusk.md:1318 +#: ./docs/master/dusk.md:1312 +msgid "$browser->assertPortIsNot($port);" +msgstr "" -#: docs/10.x/dusk.md:block 413 (header) +# P +#: ./docs/8.x/dusk.md:1026 +#: ./docs/9.x/dusk.md:1158 +#: ./docs/10.x/dusk.md:1263 +#: ./docs/11.x/dusk.md:1320 +#: ./docs/master/dusk.md:1314 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1027 +#: ./docs/9.x/dusk.md:1159 +#: ./docs/10.x/dusk.md:1264 +#: ./docs/11.x/dusk.md:1321 +#: ./docs/master/dusk.md:1315 msgid "assertPathBeginsWith" -msgstr "assertPathBeginsWith" +msgstr "" -#: docs/10.x/dusk.md:block 414 (paragraph) +# P +#: ./docs/8.x/dusk.md:1029 +#: ./docs/9.x/dusk.md:1161 +#: ./docs/10.x/dusk.md:1266 +#: ./docs/11.x/dusk.md:1323 +#: ./docs/master/dusk.md:1317 msgid "Assert that the current URL path begins with the given path:" -msgstr "判斷目前 URL 的路徑 (Path) 以給定路徑開始:" +msgstr "" -#: docs/10.x/dusk.md:block 415 (code) -msgid "$browser->assertPathBeginsWith('/home');\n" -msgstr "$browser->assertPathBeginsWith('/home');\n" +# CODE +#: ./docs/8.x/dusk.md:1031 +#: ./docs/9.x/dusk.md:1163 +#: ./docs/10.x/dusk.md:1268 +#: ./docs/11.x/dusk.md:1325 +#: ./docs/master/dusk.md:1319 +msgid "$browser->assertPathBeginsWith('/home');" +msgstr "" -#: docs/10.x/dusk.md:block 417 (header) +# P +#: ./docs/8.x/dusk.md:1033 +#: ./docs/9.x/dusk.md:1165 +#: ./docs/10.x/dusk.md:1270 +#: ./docs/11.x/dusk.md:1341 +#: ./docs/master/dusk.md:1321 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1034 +#: ./docs/9.x/dusk.md:1166 +#: ./docs/10.x/dusk.md:1271 +#: ./docs/11.x/dusk.md:1342 +#: ./docs/master/dusk.md:1322 msgid "assertPathIs" -msgstr "assertPathIs" +msgstr "" -#: docs/10.x/dusk.md:block 418 (paragraph) +# P +#: ./docs/8.x/dusk.md:1036 +#: ./docs/9.x/dusk.md:1168 +#: ./docs/10.x/dusk.md:1273 +#: ./docs/11.x/dusk.md:1344 +#: ./docs/master/dusk.md:1324 msgid "Assert that the current path matches the given path:" -msgstr "判斷目前路徑 (Path) 符合給定路徑:" +msgstr "" + +# H4 +#: ./docs/10.x/dusk.md:1038 +#: ./docs/11.x/dusk.md:1093 +#: ./docs/master/dusk.md:1089 +msgid "Waiting on JavaScript Expressions" +msgstr "" -#: docs/10.x/dusk.md:block 419 (code) -msgid "$browser->assertPathIs('/home');\n" -msgstr "$browser->assertPathIs('/home');\n" +# CODE +#: ./docs/8.x/dusk.md:1038 +#: ./docs/9.x/dusk.md:1170 +#: ./docs/10.x/dusk.md:1275 +#: ./docs/11.x/dusk.md:1346 +#: ./docs/master/dusk.md:1326 +msgid "$browser->assertPathIs('/home');" +msgstr "" -#: docs/10.x/dusk.md:block 421 (header) +# P +#: ./docs/8.x/dusk.md:1040 +#: ./docs/9.x/dusk.md:1172 +#: ./docs/10.x/dusk.md:1277 +#: ./docs/11.x/dusk.md:1348 +#: ./docs/master/dusk.md:1328 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1041 +#: ./docs/9.x/dusk.md:1173 +#: ./docs/10.x/dusk.md:1278 +#: ./docs/11.x/dusk.md:1349 +#: ./docs/master/dusk.md:1329 msgid "assertPathIsNot" -msgstr "assertPathIsNot" +msgstr "" -#: docs/10.x/dusk.md:block 422 (paragraph) +# P +#: ./docs/8.x/dusk.md:1043 +#: ./docs/9.x/dusk.md:1175 +#: ./docs/10.x/dusk.md:1280 +#: ./docs/11.x/dusk.md:1351 +#: ./docs/master/dusk.md:1331 msgid "Assert that the current path does not match the given path:" -msgstr "判斷目前路徑不符合給定路徑:" +msgstr "" -#: docs/10.x/dusk.md:block 423 (code) -msgid "$browser->assertPathIsNot('/home');\n" -msgstr "$browser->assertPathIsNot('/home');\n" +# CODE +#: ./docs/8.x/dusk.md:1045 +#: ./docs/9.x/dusk.md:1177 +#: ./docs/10.x/dusk.md:1282 +#: ./docs/11.x/dusk.md:1353 +#: ./docs/master/dusk.md:1333 +msgid "$browser->assertPathIsNot('/home');" +msgstr "" -#: docs/10.x/dusk.md:block 425 (header) +# P +#: ./docs/8.x/dusk.md:1047 +#: ./docs/9.x/dusk.md:1179 +#: ./docs/10.x/dusk.md:1284 +#: ./docs/11.x/dusk.md:1355 +#: ./docs/master/dusk.md:1335 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1048 +#: ./docs/9.x/dusk.md:1180 +#: ./docs/10.x/dusk.md:1285 +#: ./docs/11.x/dusk.md:1356 +#: ./docs/master/dusk.md:1336 msgid "assertRouteIs" -msgstr "assertRouteIs" +msgstr "" + +# H4 +#: ./docs/10.x/dusk.md:1049 +#: ./docs/11.x/dusk.md:1104 +#: ./docs/master/dusk.md:1100 +msgid "Waiting on Vue Expressions" +msgstr "" -#: docs/10.x/dusk.md:block 426 (paragraph) +# P +#: ./docs/8.x/dusk.md:1050 +#: ./docs/9.x/dusk.md:1182 +#: ./docs/10.x/dusk.md:1287 +#: ./docs/11.x/dusk.md:1358 +#: ./docs/master/dusk.md:1338 msgid "Assert that the current URL matches the given [named route's](/docs/{{version}}/routing#named-routes) URL:" -msgstr "判斷目前 URL 符合給定的 [命名路由](/docs/{{version}}/routing#named-routes) URL:" +msgstr "" -#: docs/10.x/dusk.md:block 427 (code) -msgid "$browser->assertRouteIs($name, $parameters);\n" -msgstr "$browser->assertRouteIs($name, $parameters);\n" +# CODE +#: ./docs/8.x/dusk.md:1052 +#: ./docs/9.x/dusk.md:1184 +#: ./docs/10.x/dusk.md:1289 +#: ./docs/11.x/dusk.md:1360 +#: ./docs/master/dusk.md:1340 +msgid "$browser->assertRouteIs($name, $parameters);" +msgstr "" -#: docs/10.x/dusk.md:block 429 (header) +# P +#: ./docs/8.x/dusk.md:1054 +#: ./docs/9.x/dusk.md:1186 +#: ./docs/10.x/dusk.md:1291 +#: ./docs/11.x/dusk.md:1362 +#: ./docs/master/dusk.md:1342 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1055 +#: ./docs/9.x/dusk.md:1187 +#: ./docs/10.x/dusk.md:1292 +#: ./docs/11.x/dusk.md:1363 +#: ./docs/master/dusk.md:1343 msgid "assertQueryStringHas" -msgstr "assertQueryStringHas" +msgstr "" -#: docs/10.x/dusk.md:block 430 (paragraph) +# P +#: ./docs/8.x/dusk.md:1057 +#: ./docs/9.x/dusk.md:1189 +#: ./docs/10.x/dusk.md:1294 +#: ./docs/11.x/dusk.md:1365 +#: ./docs/master/dusk.md:1345 msgid "Assert that the given query string parameter is present:" -msgstr "判斷查詢字串 (Query String) 有包含給定參數:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:1059 +#: ./docs/9.x/dusk.md:1191 +#: ./docs/10.x/dusk.md:1296 +#: ./docs/11.x/dusk.md:1367 +#: ./docs/master/dusk.md:1347 +msgid "$browser->assertQueryStringHas($name);" +msgstr "" -#: docs/10.x/dusk.md:block 431 (code) -msgid "$browser->assertQueryStringHas($name);\n" -msgstr "$browser->assertQueryStringHas($name);\n" +# H4 +#: ./docs/10.x/dusk.md:1060 +#: ./docs/11.x/dusk.md:1115 +#: ./docs/master/dusk.md:1111 +msgid "Waiting for JavaScript Events" +msgstr "" -#: docs/10.x/dusk.md:block 432 (paragraph) +# P +#: ./docs/8.x/dusk.md:1061 +#: ./docs/9.x/dusk.md:1193 +#: ./docs/10.x/dusk.md:1298 +#: ./docs/11.x/dusk.md:1369 +#: ./docs/master/dusk.md:1349 msgid "Assert that the given query string parameter is present and has a given value:" -msgstr "判斷查詢字串有包含給定參數,並符合給定的值:" +msgstr "" -#: docs/10.x/dusk.md:block 433 (code) -msgid "$browser->assertQueryStringHas($name, $value);\n" -msgstr "$browser->assertQueryStringHas($name, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1063 +#: ./docs/9.x/dusk.md:1195 +#: ./docs/10.x/dusk.md:1300 +#: ./docs/11.x/dusk.md:1371 +#: ./docs/master/dusk.md:1351 +msgid "$browser->assertQueryStringHas($name, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 435 (header) +# P +#: ./docs/8.x/dusk.md:1065 +#: ./docs/9.x/dusk.md:1197 +#: ./docs/10.x/dusk.md:1302 +#: ./docs/11.x/dusk.md:1373 +#: ./docs/master/dusk.md:1353 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1066 +#: ./docs/9.x/dusk.md:1198 +#: ./docs/10.x/dusk.md:1303 +#: ./docs/11.x/dusk.md:1374 +#: ./docs/master/dusk.md:1354 msgid "assertQueryStringMissing" -msgstr "assertQueryStringMissing" +msgstr "" + +# CODE +#: ./docs/10.x/dusk.md:1068 +#: ./docs/11.x/dusk.md:1123 +#: ./docs/master/dusk.md:1119 +msgid "$browser->with('iframe', function (Browser $iframe) {\n" +" // Wait for the iframe's load event...\n" +" $iframe->waitForEvent('load');\n" +"});" +msgstr "" -#: docs/10.x/dusk.md:block 436 (paragraph) +# P +#: ./docs/8.x/dusk.md:1068 +#: ./docs/9.x/dusk.md:1200 +#: ./docs/10.x/dusk.md:1305 +#: ./docs/11.x/dusk.md:1376 +#: ./docs/master/dusk.md:1356 msgid "Assert that the given query string parameter is missing:" -msgstr "判斷查詢字串 (Query String) 不包含給定的參數:" +msgstr "" -#: docs/10.x/dusk.md:block 437 (code) -msgid "$browser->assertQueryStringMissing($name);\n" -msgstr "$browser->assertQueryStringMissing($name);\n" +# CODE +#: ./docs/8.x/dusk.md:1070 +#: ./docs/9.x/dusk.md:1202 +#: ./docs/10.x/dusk.md:1307 +#: ./docs/11.x/dusk.md:1378 +#: ./docs/master/dusk.md:1358 +msgid "$browser->assertQueryStringMissing($name);" +msgstr "" -#: docs/10.x/dusk.md:block 439 (header) +# P +#: ./docs/8.x/dusk.md:1072 +#: ./docs/9.x/dusk.md:1204 +#: ./docs/10.x/dusk.md:1309 +#: ./docs/11.x/dusk.md:1380 +#: ./docs/master/dusk.md:1360 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1073 +#: ./docs/9.x/dusk.md:1205 +#: ./docs/10.x/dusk.md:1310 +#: ./docs/11.x/dusk.md:1381 +#: ./docs/master/dusk.md:1361 msgid "assertFragmentIs" -msgstr "assertFragmentIs" +msgstr "" -#: docs/10.x/dusk.md:block 440 (paragraph) +# P +#: ./docs/8.x/dusk.md:1075 +#: ./docs/9.x/dusk.md:1207 +#: ./docs/10.x/dusk.md:1312 +#: ./docs/11.x/dusk.md:1383 +#: ./docs/master/dusk.md:1363 msgid "Assert that the URL's current hash fragment matches the given fragment:" -msgstr "判斷 URL 目前的雜湊片段 (Hash Fragment) 符合給定的片段:" +msgstr "" -#: docs/10.x/dusk.md:block 441 (code) -msgid "$browser->assertFragmentIs('anchor');\n" -msgstr "$browser->assertFragmentIs('anchor');\n" +# CODE +#: ./docs/8.x/dusk.md:1077 +#: ./docs/9.x/dusk.md:1209 +#: ./docs/10.x/dusk.md:1314 +#: ./docs/11.x/dusk.md:1385 +#: ./docs/master/dusk.md:1365 +msgid "$browser->assertFragmentIs('anchor');" +msgstr "" -#: docs/10.x/dusk.md:block 443 (header) +# P +#: ./docs/8.x/dusk.md:1079 +#: ./docs/9.x/dusk.md:1211 +#: ./docs/10.x/dusk.md:1316 +#: ./docs/11.x/dusk.md:1387 +#: ./docs/master/dusk.md:1367 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1080 +#: ./docs/9.x/dusk.md:1212 +#: ./docs/10.x/dusk.md:1317 +#: ./docs/11.x/dusk.md:1388 +#: ./docs/master/dusk.md:1368 msgid "assertFragmentBeginsWith" -msgstr "assertFragmentBeginsWith" +msgstr "" -#: docs/10.x/dusk.md:block 444 (paragraph) +# P +#: ./docs/8.x/dusk.md:1082 +#: ./docs/9.x/dusk.md:1214 +#: ./docs/10.x/dusk.md:1319 +#: ./docs/11.x/dusk.md:1390 +#: ./docs/master/dusk.md:1370 msgid "Assert that the URL's current hash fragment begins with the given fragment:" -msgstr "判斷 URL 目前的雜湊片段 (Hash Fragment) 以給定的片段開始:" +msgstr "" -#: docs/10.x/dusk.md:block 445 (code) -msgid "$browser->assertFragmentBeginsWith('anchor');\n" -msgstr "$browser->assertFragmentBeginsWith('anchor');\n" +# CODE +#: ./docs/8.x/dusk.md:1084 +#: ./docs/9.x/dusk.md:1216 +#: ./docs/10.x/dusk.md:1321 +#: ./docs/11.x/dusk.md:1392 +#: ./docs/master/dusk.md:1372 +msgid "$browser->assertFragmentBeginsWith('anchor');" +msgstr "" -#: docs/10.x/dusk.md:block 447 (header) -msgid "assertFragmentIsNot" -msgstr "assertFragmentIsNot" +# H4 +#: ./docs/10.x/dusk.md:1086 +#: ./docs/11.x/dusk.md:1141 +#: ./docs/master/dusk.md:1137 +msgid "Waiting With a Callback" +msgstr "" -#: docs/10.x/dusk.md:block 448 (paragraph) +# P +#: ./docs/8.x/dusk.md:1086 +#: ./docs/9.x/dusk.md:1218 +#: ./docs/10.x/dusk.md:1323 +#: ./docs/11.x/dusk.md:1394 +#: ./docs/master/dusk.md:1374 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1087 +#: ./docs/9.x/dusk.md:1219 +#: ./docs/10.x/dusk.md:1324 +#: ./docs/11.x/dusk.md:1395 +#: ./docs/master/dusk.md:1375 +msgid "assertFragmentIsNot" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:1089 +#: ./docs/9.x/dusk.md:1221 +#: ./docs/10.x/dusk.md:1326 +#: ./docs/11.x/dusk.md:1397 +#: ./docs/master/dusk.md:1377 msgid "Assert that the URL's current hash fragment does not match the given fragment:" -msgstr "判斷 URL 目前的雜湊片段 (Hash Fragment) 不符合給定的片段:" +msgstr "" -#: docs/10.x/dusk.md:block 449 (code) -msgid "$browser->assertFragmentIsNot('anchor');\n" -msgstr "$browser->assertFragmentIsNot('anchor');\n" +# CODE +#: ./docs/8.x/dusk.md:1091 +#: ./docs/9.x/dusk.md:1223 +#: ./docs/10.x/dusk.md:1328 +#: ./docs/11.x/dusk.md:1399 +#: ./docs/master/dusk.md:1379 +msgid "$browser->assertFragmentIsNot('anchor');" +msgstr "" -#: docs/10.x/dusk.md:block 451 (header) +# P +#: ./docs/8.x/dusk.md:1093 +#: ./docs/9.x/dusk.md:1225 +#: ./docs/10.x/dusk.md:1330 +#: ./docs/11.x/dusk.md:1401 +#: ./docs/master/dusk.md:1381 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1094 +#: ./docs/9.x/dusk.md:1226 +#: ./docs/10.x/dusk.md:1331 +#: ./docs/11.x/dusk.md:1402 +#: ./docs/master/dusk.md:1382 msgid "assertHasCookie" -msgstr "assertHasCookie" +msgstr "" + +# H3 +#: ./docs/10.x/dusk.md:1095 +#: ./docs/11.x/dusk.md:1150 +#: ./docs/master/dusk.md:1146 +msgid "Scrolling an Element Into View" +msgstr "" -#: docs/10.x/dusk.md:block 452 (paragraph) +# P +#: ./docs/8.x/dusk.md:1096 +#: ./docs/9.x/dusk.md:1228 +#: ./docs/10.x/dusk.md:1333 +#: ./docs/11.x/dusk.md:1404 +#: ./docs/master/dusk.md:1384 msgid "Assert that the given encrypted cookie is present:" -msgstr "判斷 Cookie 中含有給定的加密 Cookie:" +msgstr "" -#: docs/10.x/dusk.md:block 453 (code) -msgid "$browser->assertHasCookie($name);\n" -msgstr "$browser->assertHasCookie($name);\n" +# CODE +#: ./docs/8.x/dusk.md:1098 +#: ./docs/9.x/dusk.md:1230 +#: ./docs/10.x/dusk.md:1335 +#: ./docs/11.x/dusk.md:1406 +#: ./docs/master/dusk.md:1386 +msgid "$browser->assertHasCookie($name);" +msgstr "" -#: docs/10.x/dusk.md:block 455 (header) +# P +#: ./docs/8.x/dusk.md:1100 +#: ./docs/9.x/dusk.md:1232 +#: ./docs/10.x/dusk.md:1337 +#: ./docs/11.x/dusk.md:1408 +#: ./docs/master/dusk.md:1388 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1101 +#: ./docs/9.x/dusk.md:1233 +#: ./docs/10.x/dusk.md:1338 +#: ./docs/11.x/dusk.md:1409 +#: ./docs/master/dusk.md:1389 msgid "assertHasPlainCookie" -msgstr "assertHasPlainCookie" +msgstr "" -#: docs/10.x/dusk.md:block 456 (paragraph) +# P +#: ./docs/8.x/dusk.md:1103 +#: ./docs/9.x/dusk.md:1235 +#: ./docs/10.x/dusk.md:1340 +#: ./docs/11.x/dusk.md:1411 +#: ./docs/master/dusk.md:1391 msgid "Assert that the given unencrypted cookie is present:" -msgstr "判斷 Cookie 中含有給定的未加密 Cookie:" +msgstr "" -#: docs/10.x/dusk.md:block 457 (code) -msgid "$browser->assertHasPlainCookie($name);\n" -msgstr "$browser->assertHasPlainCookie($name);\n" +# CODE +#: ./docs/8.x/dusk.md:1105 +#: ./docs/9.x/dusk.md:1237 +#: ./docs/10.x/dusk.md:1342 +#: ./docs/11.x/dusk.md:1413 +#: ./docs/master/dusk.md:1393 +msgid "$browser->assertHasPlainCookie($name);" +msgstr "" -#: docs/10.x/dusk.md:block 459 (header) +# P +#: ./docs/8.x/dusk.md:1107 +#: ./docs/9.x/dusk.md:1239 +#: ./docs/10.x/dusk.md:1344 +#: ./docs/11.x/dusk.md:1415 +#: ./docs/master/dusk.md:1395 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1108 +#: ./docs/9.x/dusk.md:1240 +#: ./docs/10.x/dusk.md:1345 +#: ./docs/11.x/dusk.md:1416 +#: ./docs/master/dusk.md:1396 msgid "assertCookieMissing" -msgstr "assertCookieMissing" +msgstr "" -#: docs/10.x/dusk.md:block 460 (paragraph) +# P +#: ./docs/8.x/dusk.md:1110 +#: ./docs/9.x/dusk.md:1242 +#: ./docs/10.x/dusk.md:1347 +#: ./docs/11.x/dusk.md:1418 +#: ./docs/master/dusk.md:1398 msgid "Assert that the given encrypted cookie is not present:" -msgstr "判斷 Cookie 中不包含給定的加密 Cookie:" +msgstr "" -#: docs/10.x/dusk.md:block 461 (code) -msgid "$browser->assertCookieMissing($name);\n" -msgstr "$browser->assertCookieMissing($name);\n" +# CODE +#: ./docs/8.x/dusk.md:1112 +#: ./docs/9.x/dusk.md:1244 +#: ./docs/10.x/dusk.md:1349 +#: ./docs/11.x/dusk.md:1420 +#: ./docs/master/dusk.md:1400 +msgid "$browser->assertCookieMissing($name);" +msgstr "" -#: docs/10.x/dusk.md:block 463 (header) +# P +#: ./docs/8.x/dusk.md:1114 +#: ./docs/9.x/dusk.md:1246 +#: ./docs/10.x/dusk.md:1351 +#: ./docs/11.x/dusk.md:1422 +#: ./docs/master/dusk.md:1402 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1115 +#: ./docs/9.x/dusk.md:1247 +#: ./docs/10.x/dusk.md:1352 +#: ./docs/11.x/dusk.md:1423 +#: ./docs/master/dusk.md:1403 msgid "assertPlainCookieMissing" -msgstr "assertPlainCookieMissing" +msgstr "" -#: docs/10.x/dusk.md:block 464 (paragraph) +# P +#: ./docs/8.x/dusk.md:1117 +#: ./docs/9.x/dusk.md:1249 +#: ./docs/10.x/dusk.md:1354 +#: ./docs/11.x/dusk.md:1425 +#: ./docs/master/dusk.md:1405 msgid "Assert that the given unencrypted cookie is not present:" -msgstr "判斷 Cookie 中不包含給定的未加密 Cookie:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:1119 +#: ./docs/9.x/dusk.md:1251 +#: ./docs/10.x/dusk.md:1356 +#: ./docs/11.x/dusk.md:1427 +#: ./docs/master/dusk.md:1407 +msgid "$browser->assertPlainCookieMissing($name);" +msgstr "" -#: docs/10.x/dusk.md:block 465 (code) -msgid "$browser->assertPlainCookieMissing($name);\n" -msgstr "$browser->assertPlainCookieMissing($name);\n" +# P +#: ./docs/8.x/dusk.md:1121 +#: ./docs/9.x/dusk.md:1253 +#: ./docs/10.x/dusk.md:1358 +#: ./docs/11.x/dusk.md:1429 +#: ./docs/master/dusk.md:1409 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/dusk.md:1122 +#: ./docs/master/dusk.md:1173 +msgid "[assertTitle](#assert-title)\n" +"[assertTitleContains](#assert-title-contains)\n" +"[assertUrlIs](#assert-url-is)\n" +"[assertSchemeIs](#assert-scheme-is)\n" +"[assertSchemeIsNot](#assert-scheme-is-not)\n" +"[assertHostIs](#assert-host-is)\n" +"[assertHostIsNot](#assert-host-is-not)\n" +"[assertPortIs](#assert-port-is)\n" +"[assertPortIsNot](#assert-port-is-not)\n" +"[assertPathBeginsWith](#assert-path-begins-with)\n" +"[assertPathIs](#assert-path-is)\n" +"[assertPathIsNot](#assert-path-is-not)\n" +"[assertRouteIs](#assert-route-is)\n" +"[assertQueryStringHas](#assert-query-string-has)\n" +"[assertQueryStringMissing](#assert-query-string-missing)\n" +"[assertFragmentIs](#assert-fragment-is)\n" +"[assertFragmentBeginsWith](#assert-fragment-begins-with)\n" +"[assertFragmentIsNot](#assert-fragment-is-not)\n" +"[assertHasCookie](#assert-has-cookie)\n" +"[assertHasPlainCookie](#assert-has-plain-cookie)\n" +"[assertCookieMissing](#assert-cookie-missing)\n" +"[assertPlainCookieMissing](#assert-plain-cookie-missing)\n" +"[assertCookieValue](#assert-cookie-value)\n" +"[assertPlainCookieValue](#assert-plain-cookie-value)\n" +"[assertSee](#assert-see)\n" +"[assertDontSee](#assert-dont-see)\n" +"[assertSeeIn](#assert-see-in)\n" +"[assertDontSeeIn](#assert-dont-see-in)\n" +"[assertSeeAnythingIn](#assert-see-anything-in)\n" +"[assertSeeNothingIn](#assert-see-nothing-in)\n" +"[assertScript](#assert-script)\n" +"[assertSourceHas](#assert-source-has)\n" +"[assertSourceMissing](#assert-source-missing)\n" +"[assertSeeLink](#assert-see-link)\n" +"[assertDontSeeLink](#assert-dont-see-link)\n" +"[assertInputValue](#assert-input-value)\n" +"[assertInputValueIsNot](#assert-input-value-is-not)\n" +"[assertChecked](#assert-checked)\n" +"[assertNotChecked](#assert-not-checked)\n" +"[assertIndeterminate](#assert-indeterminate)\n" +"[assertRadioSelected](#assert-radio-selected)\n" +"[assertRadioNotSelected](#assert-radio-not-selected)\n" +"[assertSelected](#assert-selected)\n" +"[assertNotSelected](#assert-not-selected)\n" +"[assertSelectHasOptions](#assert-select-has-options)\n" +"[assertSelectMissingOptions](#assert-select-missing-options)\n" +"[assertSelectHasOption](#assert-select-has-option)\n" +"[assertSelectMissingOption](#assert-select-missing-option)\n" +"[assertValue](#assert-value)\n" +"[assertValueIsNot](#assert-value-is-not)\n" +"[assertAttribute](#assert-attribute)\n" +"[assertAttributeContains](#assert-attribute-contains)\n" +"[assertAttributeDoesntContain](#assert-attribute-doesnt-contain)\n" +"[assertAriaAttribute](#assert-aria-attribute)\n" +"[assertDataAttribute](#assert-data-attribute)\n" +"[assertVisible](#assert-visible)\n" +"[assertPresent](#assert-present)\n" +"[assertNotPresent](#assert-not-present)\n" +"[assertMissing](#assert-missing)\n" +"[assertInputPresent](#assert-input-present)\n" +"[assertInputMissing](#assert-input-missing)\n" +"[assertDialogOpened](#assert-dialog-opened)\n" +"[assertEnabled](#assert-enabled)\n" +"[assertDisabled](#assert-disabled)\n" +"[assertButtonEnabled](#assert-button-enabled)\n" +"[assertButtonDisabled](#assert-button-disabled)\n" +"[assertFocused](#assert-focused)\n" +"[assertNotFocused](#assert-not-focused)\n" +"[assertAuthenticated](#assert-authenticated)\n" +"[assertGuest](#assert-guest)\n" +"[assertAuthenticatedAs](#assert-authenticated-as)\n" +"[assertVue](#assert-vue)\n" +"[assertVueIsNot](#assert-vue-is-not)\n" +"[assertVueContains](#assert-vue-contains)\n" +"[assertVueDoesntContain](#assert-vue-doesnt-contain)" +msgstr "" -#: docs/10.x/dusk.md:block 467 (header) +# H4 +#: ./docs/8.x/dusk.md:1122 +#: ./docs/9.x/dusk.md:1254 +#: ./docs/10.x/dusk.md:1359 +#: ./docs/11.x/dusk.md:1430 +#: ./docs/master/dusk.md:1410 msgid "assertCookieValue" -msgstr "assertCookieValue" +msgstr "" -#: docs/10.x/dusk.md:block 468 (paragraph) +# P +#: ./docs/8.x/dusk.md:1124 +#: ./docs/9.x/dusk.md:1256 +#: ./docs/10.x/dusk.md:1361 +#: ./docs/11.x/dusk.md:1432 +#: ./docs/master/dusk.md:1412 msgid "Assert that an encrypted cookie has a given value:" -msgstr "判斷加密 Cookie 為給定的值:" +msgstr "" -#: docs/10.x/dusk.md:block 469 (code) -msgid "$browser->assertCookieValue($name, $value);\n" -msgstr "$browser->assertCookieValue($name, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1126 +#: ./docs/9.x/dusk.md:1258 +#: ./docs/10.x/dusk.md:1363 +#: ./docs/11.x/dusk.md:1434 +#: ./docs/master/dusk.md:1414 +msgid "$browser->assertCookieValue($name, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 471 (header) +# P +#: ./docs/8.x/dusk.md:1128 +#: ./docs/9.x/dusk.md:1260 +#: ./docs/10.x/dusk.md:1365 +#: ./docs/11.x/dusk.md:1436 +#: ./docs/master/dusk.md:1416 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1129 +#: ./docs/9.x/dusk.md:1261 +#: ./docs/10.x/dusk.md:1366 +#: ./docs/11.x/dusk.md:1437 +#: ./docs/master/dusk.md:1417 msgid "assertPlainCookieValue" -msgstr "assertPlainCookieValue" +msgstr "" -#: docs/10.x/dusk.md:block 472 (paragraph) +# P +#: ./docs/8.x/dusk.md:1131 +#: ./docs/9.x/dusk.md:1263 +#: ./docs/10.x/dusk.md:1368 +#: ./docs/11.x/dusk.md:1439 +#: ./docs/master/dusk.md:1419 msgid "Assert that an unencrypted cookie has a given value:" -msgstr "判斷未加密 Cookie 為給定的值:" +msgstr "" -#: docs/10.x/dusk.md:block 473 (code) -msgid "$browser->assertPlainCookieValue($name, $value);\n" -msgstr "$browser->assertPlainCookieValue($name, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1133 +#: ./docs/9.x/dusk.md:1265 +#: ./docs/10.x/dusk.md:1370 +#: ./docs/11.x/dusk.md:1441 +#: ./docs/master/dusk.md:1421 +msgid "$browser->assertPlainCookieValue($name, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 475 (header) +# P +#: ./docs/8.x/dusk.md:1135 +#: ./docs/9.x/dusk.md:1267 +#: ./docs/10.x/dusk.md:1372 +#: ./docs/11.x/dusk.md:1443 +#: ./docs/master/dusk.md:1423 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1136 +#: ./docs/9.x/dusk.md:1268 +#: ./docs/10.x/dusk.md:1373 +#: ./docs/11.x/dusk.md:1444 +#: ./docs/master/dusk.md:1424 msgid "assertSee" -msgstr "assertSee" +msgstr "" -#: docs/10.x/dusk.md:block 476 (paragraph) +# P +#: ./docs/8.x/dusk.md:1138 +#: ./docs/9.x/dusk.md:1270 +#: ./docs/10.x/dusk.md:1375 +#: ./docs/11.x/dusk.md:1446 +#: ./docs/master/dusk.md:1426 msgid "Assert that the given text is present on the page:" -msgstr "判斷給定文字有出現在頁面上:" +msgstr "" -#: docs/10.x/dusk.md:block 477 (code) -msgid "$browser->assertSee($text);\n" -msgstr "$browser->assertSee($text);\n" +# CODE +#: ./docs/8.x/dusk.md:1140 +#: ./docs/9.x/dusk.md:1272 +#: ./docs/10.x/dusk.md:1377 +#: ./docs/11.x/dusk.md:1448 +#: ./docs/master/dusk.md:1428 +msgid "$browser->assertSee($text);" +msgstr "" -#: docs/10.x/dusk.md:block 479 (header) +# P +#: ./docs/8.x/dusk.md:1142 +#: ./docs/9.x/dusk.md:1274 +#: ./docs/10.x/dusk.md:1379 +#: ./docs/11.x/dusk.md:1450 +#: ./docs/master/dusk.md:1430 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1143 +#: ./docs/9.x/dusk.md:1275 +#: ./docs/10.x/dusk.md:1380 +#: ./docs/11.x/dusk.md:1451 +#: ./docs/master/dusk.md:1431 msgid "assertDontSee" -msgstr "assertDontSee" +msgstr "" -#: docs/10.x/dusk.md:block 480 (paragraph) +# P +#: ./docs/8.x/dusk.md:1145 +#: ./docs/9.x/dusk.md:1277 +#: ./docs/10.x/dusk.md:1382 +#: ./docs/11.x/dusk.md:1453 +#: ./docs/master/dusk.md:1433 msgid "Assert that the given text is not present on the page:" -msgstr "判斷給定文字未出現在頁面上:" +msgstr "" -#: docs/10.x/dusk.md:block 481 (code) -msgid "$browser->assertDontSee($text);\n" -msgstr "$browser->assertDontSee($text);\n" +# CODE +#: ./docs/8.x/dusk.md:1147 +#: ./docs/9.x/dusk.md:1279 +#: ./docs/10.x/dusk.md:1384 +#: ./docs/11.x/dusk.md:1455 +#: ./docs/master/dusk.md:1435 +msgid "$browser->assertDontSee($text);" +msgstr "" -#: docs/10.x/dusk.md:block 483 (header) +# P +#: ./docs/8.x/dusk.md:1149 +#: ./docs/9.x/dusk.md:1281 +#: ./docs/10.x/dusk.md:1386 +#: ./docs/11.x/dusk.md:1457 +#: ./docs/master/dusk.md:1437 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1150 +#: ./docs/9.x/dusk.md:1282 +#: ./docs/10.x/dusk.md:1387 +#: ./docs/11.x/dusk.md:1458 +#: ./docs/master/dusk.md:1438 msgid "assertSeeIn" -msgstr "assertSeeIn" +msgstr "" -#: docs/10.x/dusk.md:block 484 (paragraph) +# P +#: ./docs/8.x/dusk.md:1152 +#: ./docs/9.x/dusk.md:1284 +#: ./docs/10.x/dusk.md:1389 +#: ./docs/11.x/dusk.md:1460 +#: ./docs/master/dusk.md:1440 msgid "Assert that the given text is present within the selector:" -msgstr "判斷給定文字出現在選擇器中:" +msgstr "" -#: docs/10.x/dusk.md:block 485 (code) -msgid "$browser->assertSeeIn($selector, $text);\n" -msgstr "$browser->assertSeeIn($selector, $text);\n" +# CODE +#: ./docs/8.x/dusk.md:1154 +#: ./docs/9.x/dusk.md:1286 +#: ./docs/10.x/dusk.md:1391 +#: ./docs/11.x/dusk.md:1462 +#: ./docs/master/dusk.md:1442 +msgid "$browser->assertSeeIn($selector, $text);" +msgstr "" -#: docs/10.x/dusk.md:block 487 (header) +# P +#: ./docs/8.x/dusk.md:1156 +#: ./docs/9.x/dusk.md:1288 +#: ./docs/10.x/dusk.md:1393 +#: ./docs/11.x/dusk.md:1464 +#: ./docs/master/dusk.md:1444 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1157 +#: ./docs/9.x/dusk.md:1289 +#: ./docs/10.x/dusk.md:1394 +#: ./docs/11.x/dusk.md:1465 +#: ./docs/master/dusk.md:1445 msgid "assertDontSeeIn" -msgstr "assertDontSeeIn" +msgstr "" -#: docs/10.x/dusk.md:block 488 (paragraph) +# P +#: ./docs/8.x/dusk.md:1159 +#: ./docs/9.x/dusk.md:1291 +#: ./docs/10.x/dusk.md:1396 +#: ./docs/11.x/dusk.md:1467 +#: ./docs/master/dusk.md:1447 msgid "Assert that the given text is not present within the selector:" -msgstr "判斷給定文字未出現在選擇器中:" +msgstr "" -#: docs/10.x/dusk.md:block 489 (code) -msgid "$browser->assertDontSeeIn($selector, $text);\n" -msgstr "$browser->assertDontSeeIn($selector, $text);\n" +# CODE +#: ./docs/8.x/dusk.md:1161 +#: ./docs/9.x/dusk.md:1293 +#: ./docs/10.x/dusk.md:1398 +#: ./docs/11.x/dusk.md:1469 +#: ./docs/master/dusk.md:1449 +msgid "$browser->assertDontSeeIn($selector, $text);" +msgstr "" -#: docs/10.x/dusk.md:block 491 (header) +# P +#: ./docs/8.x/dusk.md:1163 +#: ./docs/9.x/dusk.md:1295 +#: ./docs/10.x/dusk.md:1400 +#: ./docs/11.x/dusk.md:1471 +#: ./docs/master/dusk.md:1451 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1164 +#: ./docs/9.x/dusk.md:1296 +#: ./docs/10.x/dusk.md:1401 +#: ./docs/11.x/dusk.md:1472 +#: ./docs/master/dusk.md:1452 msgid "assertSeeAnythingIn" -msgstr "assertSeeAnythingIn" +msgstr "" -#: docs/10.x/dusk.md:block 492 (paragraph) +# P +#: ./docs/8.x/dusk.md:1166 +#: ./docs/9.x/dusk.md:1298 +#: ./docs/10.x/dusk.md:1403 +#: ./docs/11.x/dusk.md:1474 +#: ./docs/master/dusk.md:1454 msgid "Assert that any text is present within the selector:" -msgstr "判斷選擇器中有包含任何文字:" +msgstr "" -#: docs/10.x/dusk.md:block 493 (code) -msgid "$browser->assertSeeAnythingIn($selector);\n" -msgstr "$browser->assertSeeAnythingIn($selector);\n" +# CODE +#: ./docs/8.x/dusk.md:1168 +#: ./docs/9.x/dusk.md:1300 +#: ./docs/10.x/dusk.md:1405 +#: ./docs/11.x/dusk.md:1476 +#: ./docs/master/dusk.md:1456 +msgid "$browser->assertSeeAnythingIn($selector);" +msgstr "" -#: docs/10.x/dusk.md:block 495 (header) +# P +#: ./docs/8.x/dusk.md:1170 +#: ./docs/9.x/dusk.md:1302 +#: ./docs/10.x/dusk.md:1407 +#: ./docs/11.x/dusk.md:1478 +#: ./docs/master/dusk.md:1458 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1171 +#: ./docs/9.x/dusk.md:1303 +#: ./docs/10.x/dusk.md:1408 +#: ./docs/11.x/dusk.md:1479 +#: ./docs/master/dusk.md:1459 msgid "assertSeeNothingIn" -msgstr "assertSeeNothingIn" +msgstr "" -#: docs/10.x/dusk.md:block 496 (paragraph) +# P +#: ./docs/8.x/dusk.md:1173 +#: ./docs/9.x/dusk.md:1305 +#: ./docs/10.x/dusk.md:1410 +#: ./docs/11.x/dusk.md:1481 +#: ./docs/master/dusk.md:1461 msgid "Assert that no text is present within the selector:" -msgstr "判斷選擇器中未包含任何文字:" +msgstr "" -#: docs/10.x/dusk.md:block 497 (code) -msgid "$browser->assertSeeNothingIn($selector);\n" -msgstr "$browser->assertSeeNothingIn($selector);\n" +# CODE +#: ./docs/8.x/dusk.md:1175 +#: ./docs/9.x/dusk.md:1307 +#: ./docs/10.x/dusk.md:1412 +#: ./docs/11.x/dusk.md:1483 +#: ./docs/master/dusk.md:1463 +msgid "$browser->assertSeeNothingIn($selector);" +msgstr "" + +# P +#: ./docs/11.x/dusk.md:1177 +msgid "[assertTitle](#assert-title)\n" +"[assertTitleContains](#assert-title-contains)\n" +"[assertUrlIs](#assert-url-is)\n" +"[assertSchemeIs](#assert-scheme-is)\n" +"[assertSchemeIsNot](#assert-scheme-is-not)\n" +"[assertHostIs](#assert-host-is)\n" +"[assertHostIsNot](#assert-host-is-not)\n" +"[assertPortIs](#assert-port-is)\n" +"[assertPortIsNot](#assert-port-is-not)\n" +"[assertPathBeginsWith](#assert-path-begins-with)\n" +"[assertPathEndsWith](#assert-path-ends-with)\n" +"[assertPathContains](#assert-path-contains)\n" +"[assertPathIs](#assert-path-is)\n" +"[assertPathIsNot](#assert-path-is-not)\n" +"[assertRouteIs](#assert-route-is)\n" +"[assertQueryStringHas](#assert-query-string-has)\n" +"[assertQueryStringMissing](#assert-query-string-missing)\n" +"[assertFragmentIs](#assert-fragment-is)\n" +"[assertFragmentBeginsWith](#assert-fragment-begins-with)\n" +"[assertFragmentIsNot](#assert-fragment-is-not)\n" +"[assertHasCookie](#assert-has-cookie)\n" +"[assertHasPlainCookie](#assert-has-plain-cookie)\n" +"[assertCookieMissing](#assert-cookie-missing)\n" +"[assertPlainCookieMissing](#assert-plain-cookie-missing)\n" +"[assertCookieValue](#assert-cookie-value)\n" +"[assertPlainCookieValue](#assert-plain-cookie-value)\n" +"[assertSee](#assert-see)\n" +"[assertDontSee](#assert-dont-see)\n" +"[assertSeeIn](#assert-see-in)\n" +"[assertDontSeeIn](#assert-dont-see-in)\n" +"[assertSeeAnythingIn](#assert-see-anything-in)\n" +"[assertSeeNothingIn](#assert-see-nothing-in)\n" +"[assertScript](#assert-script)\n" +"[assertSourceHas](#assert-source-has)\n" +"[assertSourceMissing](#assert-source-missing)\n" +"[assertSeeLink](#assert-see-link)\n" +"[assertDontSeeLink](#assert-dont-see-link)\n" +"[assertInputValue](#assert-input-value)\n" +"[assertInputValueIsNot](#assert-input-value-is-not)\n" +"[assertChecked](#assert-checked)\n" +"[assertNotChecked](#assert-not-checked)\n" +"[assertIndeterminate](#assert-indeterminate)\n" +"[assertRadioSelected](#assert-radio-selected)\n" +"[assertRadioNotSelected](#assert-radio-not-selected)\n" +"[assertSelected](#assert-selected)\n" +"[assertNotSelected](#assert-not-selected)\n" +"[assertSelectHasOptions](#assert-select-has-options)\n" +"[assertSelectMissingOptions](#assert-select-missing-options)\n" +"[assertSelectHasOption](#assert-select-has-option)\n" +"[assertSelectMissingOption](#assert-select-missing-option)\n" +"[assertValue](#assert-value)\n" +"[assertValueIsNot](#assert-value-is-not)\n" +"[assertAttribute](#assert-attribute)\n" +"[assertAttributeContains](#assert-attribute-contains)\n" +"[assertAttributeDoesntContain](#assert-attribute-doesnt-contain)\n" +"[assertAriaAttribute](#assert-aria-attribute)\n" +"[assertDataAttribute](#assert-data-attribute)\n" +"[assertVisible](#assert-visible)\n" +"[assertPresent](#assert-present)\n" +"[assertNotPresent](#assert-not-present)\n" +"[assertMissing](#assert-missing)\n" +"[assertInputPresent](#assert-input-present)\n" +"[assertInputMissing](#assert-input-missing)\n" +"[assertDialogOpened](#assert-dialog-opened)\n" +"[assertEnabled](#assert-enabled)\n" +"[assertDisabled](#assert-disabled)\n" +"[assertButtonEnabled](#assert-button-enabled)\n" +"[assertButtonDisabled](#assert-button-disabled)\n" +"[assertFocused](#assert-focused)\n" +"[assertNotFocused](#assert-not-focused)\n" +"[assertAuthenticated](#assert-authenticated)\n" +"[assertGuest](#assert-guest)\n" +"[assertAuthenticatedAs](#assert-authenticated-as)\n" +"[assertVue](#assert-vue)\n" +"[assertVueIsNot](#assert-vue-is-not)\n" +"[assertVueContains](#assert-vue-contains)\n" +"[assertVueDoesntContain](#assert-vue-doesnt-contain)" +msgstr "" -#: docs/10.x/dusk.md:block 499 (header) +# P +#: ./docs/8.x/dusk.md:1177 +#: ./docs/9.x/dusk.md:1309 +#: ./docs/10.x/dusk.md:1414 +#: ./docs/11.x/dusk.md:1485 +#: ./docs/master/dusk.md:1465 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1178 +#: ./docs/9.x/dusk.md:1310 +#: ./docs/10.x/dusk.md:1415 +#: ./docs/11.x/dusk.md:1486 +#: ./docs/master/dusk.md:1466 msgid "assertScript" -msgstr "assertScript" +msgstr "" -#: docs/10.x/dusk.md:block 500 (paragraph) +# P +#: ./docs/8.x/dusk.md:1180 +#: ./docs/9.x/dusk.md:1312 +#: ./docs/10.x/dusk.md:1417 +#: ./docs/11.x/dusk.md:1488 +#: ./docs/master/dusk.md:1468 msgid "Assert that the given JavaScript expression evaluates to the given value:" -msgstr "判斷給定的 JavaScript 運算式取值為給定的值:" +msgstr "" -#: docs/10.x/dusk.md:block 501 (code) +# CODE +#: ./docs/8.x/dusk.md:1182 +#: ./docs/9.x/dusk.md:1314 +#: ./docs/10.x/dusk.md:1419 +#: ./docs/11.x/dusk.md:1490 +#: ./docs/master/dusk.md:1470 msgid "$browser->assertScript('window.isLoaded')\n" -" ->assertScript('document.readyState', 'complete');\n" -msgstr "$browser->assertScript('window.isLoaded')\n" -" ->assertScript('document.readyState', 'complete');\n" +" ->assertScript('document.readyState', 'complete');" +msgstr "" -#: docs/10.x/dusk.md:block 503 (header) +# P +#: ./docs/8.x/dusk.md:1185 +#: ./docs/9.x/dusk.md:1317 +#: ./docs/10.x/dusk.md:1422 +#: ./docs/11.x/dusk.md:1493 +#: ./docs/master/dusk.md:1473 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1186 +#: ./docs/9.x/dusk.md:1318 +#: ./docs/10.x/dusk.md:1423 +#: ./docs/11.x/dusk.md:1494 +#: ./docs/master/dusk.md:1474 msgid "assertSourceHas" -msgstr "assertSourceHas" +msgstr "" -#: docs/10.x/dusk.md:block 504 (paragraph) +# P +#: ./docs/8.x/dusk.md:1188 +#: ./docs/9.x/dusk.md:1320 +#: ./docs/10.x/dusk.md:1425 +#: ./docs/11.x/dusk.md:1496 +#: ./docs/master/dusk.md:1476 msgid "Assert that the given source code is present on the page:" -msgstr "判斷給定的原始碼有出現在頁面上:" +msgstr "" -#: docs/10.x/dusk.md:block 505 (code) -msgid "$browser->assertSourceHas($code);\n" -msgstr "$browser->assertSourceHas($code);\n" +# CODE +#: ./docs/8.x/dusk.md:1190 +#: ./docs/9.x/dusk.md:1322 +#: ./docs/10.x/dusk.md:1427 +#: ./docs/11.x/dusk.md:1498 +#: ./docs/master/dusk.md:1478 +msgid "$browser->assertSourceHas($code);" +msgstr "" -#: docs/10.x/dusk.md:block 507 (header) +# P +#: ./docs/8.x/dusk.md:1192 +#: ./docs/9.x/dusk.md:1324 +#: ./docs/10.x/dusk.md:1429 +#: ./docs/11.x/dusk.md:1500 +#: ./docs/master/dusk.md:1480 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1193 +#: ./docs/9.x/dusk.md:1325 +#: ./docs/10.x/dusk.md:1430 +#: ./docs/11.x/dusk.md:1501 +#: ./docs/master/dusk.md:1481 msgid "assertSourceMissing" -msgstr "assertSourceMissing" +msgstr "" -#: docs/10.x/dusk.md:block 508 (paragraph) +# P +#: ./docs/8.x/dusk.md:1195 +#: ./docs/9.x/dusk.md:1327 +#: ./docs/10.x/dusk.md:1432 +#: ./docs/11.x/dusk.md:1503 +#: ./docs/master/dusk.md:1483 msgid "Assert that the given source code is not present on the page:" -msgstr "判斷給定的原始碼未出現在頁面上:" +msgstr "" -#: docs/10.x/dusk.md:block 509 (code) -msgid "$browser->assertSourceMissing($code);\n" -msgstr "$browser->assertSourceMissing($code);\n" +# CODE +#: ./docs/8.x/dusk.md:1197 +#: ./docs/9.x/dusk.md:1329 +#: ./docs/10.x/dusk.md:1434 +#: ./docs/11.x/dusk.md:1505 +#: ./docs/master/dusk.md:1485 +msgid "$browser->assertSourceMissing($code);" +msgstr "" -#: docs/10.x/dusk.md:block 511 (header) +# P +#: ./docs/8.x/dusk.md:1199 +#: ./docs/9.x/dusk.md:1331 +#: ./docs/10.x/dusk.md:1436 +#: ./docs/11.x/dusk.md:1507 +#: ./docs/master/dusk.md:1487 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1200 +#: ./docs/9.x/dusk.md:1332 +#: ./docs/10.x/dusk.md:1437 +#: ./docs/11.x/dusk.md:1508 +#: ./docs/master/dusk.md:1488 msgid "assertSeeLink" -msgstr "assertSeeLink" +msgstr "" -#: docs/10.x/dusk.md:block 512 (paragraph) +# P +#: ./docs/8.x/dusk.md:1202 +#: ./docs/9.x/dusk.md:1334 +#: ./docs/10.x/dusk.md:1439 +#: ./docs/11.x/dusk.md:1510 +#: ./docs/master/dusk.md:1490 msgid "Assert that the given link is present on the page:" -msgstr "判斷給定連結有出現在頁面上:" +msgstr "" -#: docs/10.x/dusk.md:block 513 (code) -msgid "$browser->assertSeeLink($linkText);\n" -msgstr "$browser->assertSeeLink($linkText);\n" +# CODE +#: ./docs/8.x/dusk.md:1204 +#: ./docs/9.x/dusk.md:1336 +#: ./docs/10.x/dusk.md:1441 +#: ./docs/11.x/dusk.md:1512 +#: ./docs/master/dusk.md:1492 +msgid "$browser->assertSeeLink($linkText);" +msgstr "" -#: docs/10.x/dusk.md:block 515 (header) +# P +#: ./docs/8.x/dusk.md:1206 +#: ./docs/9.x/dusk.md:1338 +#: ./docs/10.x/dusk.md:1443 +#: ./docs/11.x/dusk.md:1514 +#: ./docs/master/dusk.md:1494 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1207 +#: ./docs/9.x/dusk.md:1339 +#: ./docs/10.x/dusk.md:1444 +#: ./docs/11.x/dusk.md:1515 +#: ./docs/master/dusk.md:1495 msgid "assertDontSeeLink" -msgstr "assertDontSeeLink" +msgstr "" -#: docs/10.x/dusk.md:block 516 (paragraph) +# P +#: ./docs/8.x/dusk.md:1209 +#: ./docs/9.x/dusk.md:1341 +#: ./docs/10.x/dusk.md:1446 +#: ./docs/11.x/dusk.md:1517 +#: ./docs/master/dusk.md:1497 msgid "Assert that the given link is not present on the page:" -msgstr "判斷給定連結未出現在頁面上:" +msgstr "" -#: docs/10.x/dusk.md:block 517 (code) -msgid "$browser->assertDontSeeLink($linkText);\n" -msgstr "$browser->assertDontSeeLink($linkText);\n" +# CODE +#: ./docs/8.x/dusk.md:1211 +#: ./docs/9.x/dusk.md:1343 +#: ./docs/10.x/dusk.md:1448 +#: ./docs/11.x/dusk.md:1519 +#: ./docs/master/dusk.md:1499 +msgid "$browser->assertDontSeeLink($linkText);" +msgstr "" -#: docs/10.x/dusk.md:block 519 (header) +# P +#: ./docs/8.x/dusk.md:1213 +#: ./docs/9.x/dusk.md:1345 +#: ./docs/10.x/dusk.md:1450 +#: ./docs/11.x/dusk.md:1521 +#: ./docs/master/dusk.md:1501 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1214 +#: ./docs/9.x/dusk.md:1346 +#: ./docs/10.x/dusk.md:1451 +#: ./docs/11.x/dusk.md:1522 +#: ./docs/master/dusk.md:1502 msgid "assertInputValue" -msgstr "assertInputValue" +msgstr "" -#: docs/10.x/dusk.md:block 520 (paragraph) +# P +#: ./docs/8.x/dusk.md:1216 +#: ./docs/9.x/dusk.md:1348 +#: ./docs/10.x/dusk.md:1453 +#: ./docs/11.x/dusk.md:1524 +#: ./docs/master/dusk.md:1504 msgid "Assert that the given input field has the given value:" -msgstr "判斷給定的輸入欄位為給定值:" +msgstr "" -#: docs/10.x/dusk.md:block 521 (code) -msgid "$browser->assertInputValue($field, $value);\n" -msgstr "$browser->assertInputValue($field, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1218 +#: ./docs/9.x/dusk.md:1350 +#: ./docs/10.x/dusk.md:1455 +#: ./docs/11.x/dusk.md:1526 +#: ./docs/master/dusk.md:1506 +msgid "$browser->assertInputValue($field, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 523 (header) +# P +#: ./docs/8.x/dusk.md:1220 +#: ./docs/9.x/dusk.md:1352 +#: ./docs/10.x/dusk.md:1457 +#: ./docs/11.x/dusk.md:1528 +#: ./docs/master/dusk.md:1508 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1221 +#: ./docs/9.x/dusk.md:1353 +#: ./docs/10.x/dusk.md:1458 +#: ./docs/11.x/dusk.md:1529 +#: ./docs/master/dusk.md:1509 msgid "assertInputValueIsNot" -msgstr "assertInputValueIsNot" +msgstr "" -#: docs/10.x/dusk.md:block 524 (paragraph) +# P +#: ./docs/8.x/dusk.md:1223 +#: ./docs/9.x/dusk.md:1355 +#: ./docs/10.x/dusk.md:1460 +#: ./docs/11.x/dusk.md:1531 +#: ./docs/master/dusk.md:1511 msgid "Assert that the given input field does not have the given value:" -msgstr "判斷給定的輸入欄位不是給定值:" +msgstr "" -#: docs/10.x/dusk.md:block 525 (code) -msgid "$browser->assertInputValueIsNot($field, $value);\n" -msgstr "$browser->assertInputValueIsNot($field, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1225 +#: ./docs/9.x/dusk.md:1357 +#: ./docs/10.x/dusk.md:1462 +#: ./docs/11.x/dusk.md:1533 +#: ./docs/master/dusk.md:1513 +msgid "$browser->assertInputValueIsNot($field, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 527 (header) +# P +#: ./docs/8.x/dusk.md:1227 +#: ./docs/9.x/dusk.md:1359 +#: ./docs/10.x/dusk.md:1464 +#: ./docs/11.x/dusk.md:1535 +#: ./docs/master/dusk.md:1515 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1228 +#: ./docs/9.x/dusk.md:1360 +#: ./docs/10.x/dusk.md:1465 +#: ./docs/11.x/dusk.md:1536 +#: ./docs/master/dusk.md:1516 msgid "assertChecked" -msgstr "assertChecked" +msgstr "" -#: docs/10.x/dusk.md:block 528 (paragraph) +# P +#: ./docs/8.x/dusk.md:1230 +#: ./docs/9.x/dusk.md:1362 +#: ./docs/10.x/dusk.md:1467 +#: ./docs/11.x/dusk.md:1538 +#: ./docs/master/dusk.md:1518 msgid "Assert that the given checkbox is checked:" -msgstr "判斷給定多選況已勾選:" +msgstr "" -#: docs/10.x/dusk.md:block 529 (code) -msgid "$browser->assertChecked($field);\n" -msgstr "$browser->assertChecked($field);\n" +# CODE +#: ./docs/8.x/dusk.md:1232 +#: ./docs/9.x/dusk.md:1364 +#: ./docs/10.x/dusk.md:1469 +#: ./docs/11.x/dusk.md:1540 +#: ./docs/master/dusk.md:1520 +msgid "$browser->assertChecked($field);" +msgstr "" -#: docs/10.x/dusk.md:block 531 (header) +# P +#: ./docs/8.x/dusk.md:1234 +#: ./docs/9.x/dusk.md:1366 +#: ./docs/10.x/dusk.md:1471 +#: ./docs/11.x/dusk.md:1542 +#: ./docs/master/dusk.md:1522 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1235 +#: ./docs/9.x/dusk.md:1367 +#: ./docs/10.x/dusk.md:1472 +#: ./docs/11.x/dusk.md:1543 +#: ./docs/master/dusk.md:1523 msgid "assertNotChecked" -msgstr "assertNotChecked" +msgstr "" -#: docs/10.x/dusk.md:block 532 (paragraph) +# P +#: ./docs/8.x/dusk.md:1237 +#: ./docs/9.x/dusk.md:1369 +#: ./docs/10.x/dusk.md:1474 +#: ./docs/11.x/dusk.md:1545 +#: ./docs/master/dusk.md:1525 msgid "Assert that the given checkbox is not checked:" -msgstr "判斷給定多選況未勾選:" - -#: docs/10.x/dusk.md:block 533 (code) -msgid "$browser->assertNotChecked($field);\n" -msgstr "$browser->assertNotChecked($field);\n" - -#: docs/10.x/dusk.md:block 535 (header) -msgid "assertIndeterminate" -msgstr "assertIndeterminate" - -#: docs/10.x/dusk.md:block 536 (paragraph) -msgid "Assert that the given checkbox is in an indeterminate state:" -msgstr "判斷給定 Checkbox 是否為 ^[Indeterminate](無法判斷) 的狀態:" +msgstr "" -#: docs/10.x/dusk.md:block 537 (code) -msgid "$browser->assertIndeterminate($field);\n" -msgstr "$browser->assertIndeterminate($field);\n" +# CODE +#: ./docs/8.x/dusk.md:1239 +#: ./docs/9.x/dusk.md:1371 +#: ./docs/10.x/dusk.md:1476 +#: ./docs/11.x/dusk.md:1547 +#: ./docs/master/dusk.md:1527 +msgid "$browser->assertNotChecked($field);" +msgstr "" -#: docs/10.x/dusk.md:block 539 (header) +# P +#: ./docs/8.x/dusk.md:1241 +#: ./docs/9.x/dusk.md:1380 +#: ./docs/10.x/dusk.md:1485 +#: ./docs/11.x/dusk.md:1556 +#: ./docs/master/dusk.md:1536 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1242 +#: ./docs/9.x/dusk.md:1381 +#: ./docs/10.x/dusk.md:1486 +#: ./docs/11.x/dusk.md:1557 +#: ./docs/master/dusk.md:1537 msgid "assertRadioSelected" -msgstr "assertRadioSelected" +msgstr "" -#: docs/10.x/dusk.md:block 540 (paragraph) +# P +#: ./docs/8.x/dusk.md:1244 +#: ./docs/9.x/dusk.md:1383 +#: ./docs/10.x/dusk.md:1488 +#: ./docs/11.x/dusk.md:1559 +#: ./docs/master/dusk.md:1539 msgid "Assert that the given radio field is selected:" -msgstr "判斷給定單選框欄位已選擇:" +msgstr "" -#: docs/10.x/dusk.md:block 541 (code) -msgid "$browser->assertRadioSelected($field, $value);\n" -msgstr "$browser->assertRadioSelected($field, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1246 +#: ./docs/9.x/dusk.md:1385 +#: ./docs/10.x/dusk.md:1490 +#: ./docs/11.x/dusk.md:1561 +#: ./docs/master/dusk.md:1541 +msgid "$browser->assertRadioSelected($field, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 543 (header) +# P +#: ./docs/8.x/dusk.md:1248 +#: ./docs/9.x/dusk.md:1387 +#: ./docs/10.x/dusk.md:1492 +#: ./docs/11.x/dusk.md:1563 +#: ./docs/master/dusk.md:1543 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1249 +#: ./docs/9.x/dusk.md:1388 +#: ./docs/10.x/dusk.md:1493 +#: ./docs/11.x/dusk.md:1564 +#: ./docs/master/dusk.md:1544 msgid "assertRadioNotSelected" -msgstr "assertRadioNotSelected" +msgstr "" -#: docs/10.x/dusk.md:block 544 (paragraph) +# P +#: ./docs/8.x/dusk.md:1251 +#: ./docs/9.x/dusk.md:1390 +#: ./docs/10.x/dusk.md:1495 +#: ./docs/11.x/dusk.md:1566 +#: ./docs/master/dusk.md:1546 msgid "Assert that the given radio field is not selected:" -msgstr "判斷給定單選框欄位未選擇:" +msgstr "" -#: docs/10.x/dusk.md:block 545 (code) -msgid "$browser->assertRadioNotSelected($field, $value);\n" -msgstr "$browser->assertRadioNotSelected($field, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1253 +#: ./docs/9.x/dusk.md:1392 +#: ./docs/10.x/dusk.md:1497 +#: ./docs/11.x/dusk.md:1568 +#: ./docs/master/dusk.md:1548 +msgid "$browser->assertRadioNotSelected($field, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 547 (header) +# P +#: ./docs/8.x/dusk.md:1255 +#: ./docs/9.x/dusk.md:1394 +#: ./docs/10.x/dusk.md:1499 +#: ./docs/11.x/dusk.md:1570 +#: ./docs/master/dusk.md:1550 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1256 +#: ./docs/9.x/dusk.md:1395 +#: ./docs/10.x/dusk.md:1500 +#: ./docs/11.x/dusk.md:1571 +#: ./docs/master/dusk.md:1551 msgid "assertSelected" -msgstr "assertSelected" +msgstr "" -#: docs/10.x/dusk.md:block 548 (paragraph) +# P +#: ./docs/8.x/dusk.md:1258 +#: ./docs/9.x/dusk.md:1397 +#: ./docs/10.x/dusk.md:1502 +#: ./docs/11.x/dusk.md:1573 +#: ./docs/master/dusk.md:1553 msgid "Assert that the given dropdown has the given value selected:" -msgstr "判斷給定下拉選單已選擇給定值:" +msgstr "" -#: docs/10.x/dusk.md:block 549 (code) -msgid "$browser->assertSelected($field, $value);\n" -msgstr "$browser->assertSelected($field, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1260 +#: ./docs/9.x/dusk.md:1399 +#: ./docs/10.x/dusk.md:1504 +#: ./docs/11.x/dusk.md:1575 +#: ./docs/master/dusk.md:1555 +msgid "$browser->assertSelected($field, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 551 (header) +# P +#: ./docs/8.x/dusk.md:1262 +#: ./docs/9.x/dusk.md:1401 +#: ./docs/10.x/dusk.md:1506 +#: ./docs/11.x/dusk.md:1577 +#: ./docs/master/dusk.md:1557 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1263 +#: ./docs/9.x/dusk.md:1402 +#: ./docs/10.x/dusk.md:1507 +#: ./docs/11.x/dusk.md:1578 +#: ./docs/master/dusk.md:1558 msgid "assertNotSelected" -msgstr "assertNotSelected" +msgstr "" -#: docs/10.x/dusk.md:block 552 (paragraph) +# P +#: ./docs/8.x/dusk.md:1265 +#: ./docs/9.x/dusk.md:1404 +#: ./docs/10.x/dusk.md:1509 +#: ./docs/11.x/dusk.md:1580 +#: ./docs/master/dusk.md:1560 msgid "Assert that the given dropdown does not have the given value selected:" -msgstr "判斷給定下拉選單未選擇給定值:" +msgstr "" -#: docs/10.x/dusk.md:block 553 (code) -msgid "$browser->assertNotSelected($field, $value);\n" -msgstr "$browser->assertNotSelected($field, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1267 +#: ./docs/9.x/dusk.md:1406 +#: ./docs/10.x/dusk.md:1511 +#: ./docs/11.x/dusk.md:1582 +#: ./docs/master/dusk.md:1562 +msgid "$browser->assertNotSelected($field, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 555 (header) +# P +#: ./docs/8.x/dusk.md:1269 +#: ./docs/9.x/dusk.md:1408 +#: ./docs/10.x/dusk.md:1513 +#: ./docs/11.x/dusk.md:1584 +#: ./docs/master/dusk.md:1564 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1270 +#: ./docs/9.x/dusk.md:1409 +#: ./docs/10.x/dusk.md:1514 +#: ./docs/11.x/dusk.md:1585 +#: ./docs/master/dusk.md:1565 msgid "assertSelectHasOptions" -msgstr "assertSelectHasOptions" +msgstr "" -#: docs/10.x/dusk.md:block 556 (paragraph) +# P +#: ./docs/8.x/dusk.md:1272 +#: ./docs/9.x/dusk.md:1411 +#: ./docs/10.x/dusk.md:1516 +#: ./docs/11.x/dusk.md:1587 +#: ./docs/master/dusk.md:1567 msgid "Assert that the given array of values are available to be selected:" -msgstr "判斷給定陣列中的值可被選取:" +msgstr "" -#: docs/10.x/dusk.md:block 557 (code) -msgid "$browser->assertSelectHasOptions($field, $values);\n" -msgstr "$browser->assertSelectHasOptions($field, $values);\n" +# CODE +#: ./docs/8.x/dusk.md:1274 +#: ./docs/9.x/dusk.md:1413 +#: ./docs/10.x/dusk.md:1518 +#: ./docs/11.x/dusk.md:1589 +#: ./docs/master/dusk.md:1569 +msgid "$browser->assertSelectHasOptions($field, $values);" +msgstr "" -#: docs/10.x/dusk.md:block 559 (header) +# P +#: ./docs/8.x/dusk.md:1276 +#: ./docs/9.x/dusk.md:1415 +#: ./docs/10.x/dusk.md:1520 +#: ./docs/11.x/dusk.md:1591 +#: ./docs/master/dusk.md:1571 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1277 +#: ./docs/9.x/dusk.md:1416 +#: ./docs/10.x/dusk.md:1521 +#: ./docs/11.x/dusk.md:1592 +#: ./docs/master/dusk.md:1572 msgid "assertSelectMissingOptions" -msgstr "assertSelectMissingOptions" +msgstr "" -#: docs/10.x/dusk.md:block 560 (paragraph) +# P +#: ./docs/8.x/dusk.md:1279 +#: ./docs/9.x/dusk.md:1418 +#: ./docs/10.x/dusk.md:1523 +#: ./docs/11.x/dusk.md:1594 +#: ./docs/master/dusk.md:1574 msgid "Assert that the given array of values are not available to be selected:" -msgstr "判斷給定陣列中的值不可被選取:" +msgstr "" -#: docs/10.x/dusk.md:block 561 (code) -msgid "$browser->assertSelectMissingOptions($field, $values);\n" -msgstr "$browser->assertSelectMissingOptions($field, $values);\n" +# CODE +#: ./docs/8.x/dusk.md:1281 +#: ./docs/9.x/dusk.md:1420 +#: ./docs/10.x/dusk.md:1525 +#: ./docs/11.x/dusk.md:1596 +#: ./docs/master/dusk.md:1576 +msgid "$browser->assertSelectMissingOptions($field, $values);" +msgstr "" -#: docs/10.x/dusk.md:block 563 (header) +# P +#: ./docs/8.x/dusk.md:1283 +#: ./docs/9.x/dusk.md:1422 +#: ./docs/10.x/dusk.md:1527 +#: ./docs/11.x/dusk.md:1598 +#: ./docs/master/dusk.md:1578 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1284 +#: ./docs/9.x/dusk.md:1423 +#: ./docs/10.x/dusk.md:1528 +#: ./docs/11.x/dusk.md:1599 +#: ./docs/master/dusk.md:1579 msgid "assertSelectHasOption" -msgstr "assertSelectHasOption" +msgstr "" -#: docs/10.x/dusk.md:block 564 (paragraph) +# P +#: ./docs/8.x/dusk.md:1286 +#: ./docs/9.x/dusk.md:1425 +#: ./docs/10.x/dusk.md:1530 +#: ./docs/11.x/dusk.md:1601 +#: ./docs/master/dusk.md:1581 msgid "Assert that the given value is available to be selected on the given field:" -msgstr "判斷給定值在給定欄位中可被選取:" +msgstr "" -#: docs/10.x/dusk.md:block 565 (code) -msgid "$browser->assertSelectHasOption($field, $value);\n" -msgstr "$browser->assertSelectHasOption($field, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1288 +#: ./docs/9.x/dusk.md:1427 +#: ./docs/10.x/dusk.md:1532 +#: ./docs/11.x/dusk.md:1603 +#: ./docs/master/dusk.md:1583 +msgid "$browser->assertSelectHasOption($field, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 567 (header) +# P +#: ./docs/8.x/dusk.md:1290 +#: ./docs/9.x/dusk.md:1429 +#: ./docs/10.x/dusk.md:1534 +#: ./docs/11.x/dusk.md:1605 +#: ./docs/master/dusk.md:1585 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1291 +#: ./docs/9.x/dusk.md:1430 +#: ./docs/10.x/dusk.md:1535 +#: ./docs/11.x/dusk.md:1606 +#: ./docs/master/dusk.md:1586 msgid "assertSelectMissingOption" -msgstr "assertSelectMissingOption" +msgstr "" -#: docs/10.x/dusk.md:block 568 (paragraph) +# P +#: ./docs/8.x/dusk.md:1293 +#: ./docs/9.x/dusk.md:1432 +#: ./docs/10.x/dusk.md:1537 +#: ./docs/11.x/dusk.md:1608 +#: ./docs/master/dusk.md:1588 msgid "Assert that the given value is not available to be selected:" -msgstr "判斷給定值不可被選取:" +msgstr "" -#: docs/10.x/dusk.md:block 569 (code) -msgid "$browser->assertSelectMissingOption($field, $value);\n" -msgstr "$browser->assertSelectMissingOption($field, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1295 +#: ./docs/9.x/dusk.md:1434 +#: ./docs/10.x/dusk.md:1539 +#: ./docs/11.x/dusk.md:1610 +#: ./docs/master/dusk.md:1590 +msgid "$browser->assertSelectMissingOption($field, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 571 (header) +# P +#: ./docs/8.x/dusk.md:1297 +#: ./docs/9.x/dusk.md:1436 +#: ./docs/10.x/dusk.md:1541 +#: ./docs/11.x/dusk.md:1612 +#: ./docs/master/dusk.md:1592 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1298 +#: ./docs/9.x/dusk.md:1437 +#: ./docs/10.x/dusk.md:1542 +#: ./docs/11.x/dusk.md:1613 +#: ./docs/master/dusk.md:1593 msgid "assertValue" -msgstr "assertValue" +msgstr "" -#: docs/10.x/dusk.md:block 572 (paragraph) +# P +#: ./docs/8.x/dusk.md:1300 +#: ./docs/9.x/dusk.md:1439 +#: ./docs/10.x/dusk.md:1544 +#: ./docs/11.x/dusk.md:1615 +#: ./docs/master/dusk.md:1595 msgid "Assert that the element matching the given selector has the given value:" -msgstr "判斷符合給定選擇器的元素符合給定值:" +msgstr "" -#: docs/10.x/dusk.md:block 573 (code) -msgid "$browser->assertValue($selector, $value);\n" -msgstr "$browser->assertValue($selector, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1302 +#: ./docs/9.x/dusk.md:1441 +#: ./docs/10.x/dusk.md:1546 +#: ./docs/11.x/dusk.md:1617 +#: ./docs/master/dusk.md:1597 +msgid "$browser->assertValue($selector, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 575 (header) +# P +#: ./docs/8.x/dusk.md:1304 +#: ./docs/9.x/dusk.md:1443 +#: ./docs/10.x/dusk.md:1548 +#: ./docs/11.x/dusk.md:1619 +#: ./docs/master/dusk.md:1599 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1305 +#: ./docs/9.x/dusk.md:1444 +#: ./docs/10.x/dusk.md:1549 +#: ./docs/11.x/dusk.md:1620 +#: ./docs/master/dusk.md:1600 msgid "assertValueIsNot" -msgstr "assertValueIsNot" +msgstr "" -#: docs/10.x/dusk.md:block 576 (paragraph) +# P +#: ./docs/8.x/dusk.md:1307 +#: ./docs/9.x/dusk.md:1446 +#: ./docs/10.x/dusk.md:1551 +#: ./docs/11.x/dusk.md:1622 +#: ./docs/master/dusk.md:1602 msgid "Assert that the element matching the given selector does not have the given value:" -msgstr "判斷符合給定選擇器的元素不符合給定值:" +msgstr "" -#: docs/10.x/dusk.md:block 577 (code) -msgid "$browser->assertValueIsNot($selector, $value);\n" -msgstr "$browser->assertValueIsNot($selector, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1309 +#: ./docs/9.x/dusk.md:1448 +#: ./docs/10.x/dusk.md:1553 +#: ./docs/11.x/dusk.md:1624 +#: ./docs/master/dusk.md:1604 +msgid "$browser->assertValueIsNot($selector, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 579 (header) +# P +#: ./docs/8.x/dusk.md:1311 +#: ./docs/9.x/dusk.md:1450 +#: ./docs/10.x/dusk.md:1555 +#: ./docs/11.x/dusk.md:1626 +#: ./docs/master/dusk.md:1606 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1312 +#: ./docs/9.x/dusk.md:1451 +#: ./docs/10.x/dusk.md:1556 +#: ./docs/11.x/dusk.md:1627 +#: ./docs/master/dusk.md:1607 msgid "assertAttribute" -msgstr "assertAttribute" +msgstr "" -#: docs/10.x/dusk.md:block 580 (paragraph) +# P +#: ./docs/8.x/dusk.md:1314 +#: ./docs/9.x/dusk.md:1453 +#: ./docs/10.x/dusk.md:1558 +#: ./docs/11.x/dusk.md:1629 +#: ./docs/master/dusk.md:1609 msgid "Assert that the element matching the given selector has the given value in the provided attribute:" -msgstr "判斷符合給定選擇器的元素中指定的屬性為給定值:" +msgstr "" -#: docs/10.x/dusk.md:block 581 (code) -msgid "$browser->assertAttribute($selector, $attribute, $value);\n" -msgstr "$browser->assertAttribute($selector, $attribute, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1316 +#: ./docs/9.x/dusk.md:1455 +#: ./docs/10.x/dusk.md:1560 +#: ./docs/11.x/dusk.md:1631 +#: ./docs/master/dusk.md:1611 +msgid "$browser->assertAttribute($selector, $attribute, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 583 (header) +# P +#: ./docs/8.x/dusk.md:1318 +#: ./docs/9.x/dusk.md:1457 +#: ./docs/10.x/dusk.md:1562 +#: ./docs/11.x/dusk.md:1633 +#: ./docs/master/dusk.md:1613 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1319 +#: ./docs/9.x/dusk.md:1458 +#: ./docs/10.x/dusk.md:1563 +#: ./docs/11.x/dusk.md:1634 +#: ./docs/master/dusk.md:1614 msgid "assertAttributeContains" -msgstr "assertAttributeContains" +msgstr "" -#: docs/10.x/dusk.md:block 584 (paragraph) +# P +#: ./docs/8.x/dusk.md:1321 +#: ./docs/9.x/dusk.md:1460 +#: ./docs/10.x/dusk.md:1565 +#: ./docs/11.x/dusk.md:1636 +#: ./docs/master/dusk.md:1616 msgid "Assert that the element matching the given selector contains the given value in the provided attribute:" -msgstr "判斷符合給定選擇器的元素中指定的屬性包含給定值:" +msgstr "" -#: docs/10.x/dusk.md:block 585 (code) -msgid "$browser->assertAttributeContains($selector, $attribute, $value);\n" -msgstr "$browser->assertAttributeContains($selector, $attribute, $value);\n" +# CODE +#: ./docs/8.x/dusk.md:1323 +#: ./docs/9.x/dusk.md:1462 +#: ./docs/10.x/dusk.md:1567 +#: ./docs/11.x/dusk.md:1638 +#: ./docs/master/dusk.md:1618 +msgid "$browser->assertAttributeContains($selector, $attribute, $value);" +msgstr "" -#: docs/10.x/dusk.md:block 587 (header) +# P +#: ./docs/8.x/dusk.md:1325 +#: ./docs/9.x/dusk.md:1464 +#: ./docs/10.x/dusk.md:1576 +#: ./docs/11.x/dusk.md:1647 +#: ./docs/master/dusk.md:1627 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/dusk.md:1326 +#: ./docs/9.x/dusk.md:1465 +#: ./docs/10.x/dusk.md:1577 +#: ./docs/11.x/dusk.md:1648 +#: ./docs/master/dusk.md:1628 msgid "assertAriaAttribute" -msgstr "assertAriaAttribute" +msgstr "" -#: docs/10.x/dusk.md:block 588 (paragraph) +# P +#: ./docs/11.x/dusk.md:1327 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/11.x/dusk.md:1328 +msgid "assertPathEndsWith" +msgstr "" + +# P +#: ./docs/8.x/dusk.md:1328 +#: ./docs/9.x/dusk.md:1467 +#: ./docs/10.x/dusk.md:1579 +#: ./docs/11.x/dusk.md:1650 +#: ./docs/master/dusk.md:1630 msgid "Assert that the element matching the given selector has the given value in the provided aria attribute:" -msgstr "判斷符合給定選擇器的元素中指定的 Aria 屬性為給定值:" +msgstr "" -#: docs/10.x/dusk.md:block 589 (code) -msgid "$browser->assertAriaAttribute($selector, $attribute, $value);\n" -msgstr "$browser->assertAriaAttribute($selector, $attribute, $value);\n" +# P +#: ./docs/11.x/dusk.md:1330 +msgid "Assert that the current URL path ends with the given path:" +msgstr "" + +# CODE +#: ./docs/8.x/dusk.md:1330 +#: ./docs/9.x/dusk.md:1469 +#: ./docs/10.x/dusk.md:1581 +#: ./docs/11.x/dusk.md:1652 +#: ./docs/master/dusk.md:1632 +msgid "$browser->assertAriaAttribute($selector, $attribute, $value);" +msgstr "" + +# CODE +#: ./docs/11.x/dusk.md:1332 +msgid "$browser->assertPathEndsWith('/home');" +msgstr "" -#: docs/10.x/dusk.md:block 590 (paragraph) +# P +#: ./docs/8.x/dusk.md:1332 +#: ./docs/9.x/dusk.md:1471 +#: ./docs/10.x/dusk.md:1583 +#: ./docs/11.x/dusk.md:1654 +#: ./docs/master/dusk.md:1634 msgid "For example, given the markup ``, you may assert against the `aria-label` attribute like so:" -msgstr "舉例來說,若有 `\n" "

    {{ $count }}

    \n" -"\n" -msgstr "
    \n" -" \n" -"

    {{ $count }}

    \n" -"
    \n" +"" +msgstr "" -#: docs/10.x/frontend.md:block 28 (paragraph) +# P +#: ./docs/9.x/frontend.md:96 +#: ./docs/10.x/frontend.md:96 +#: ./docs/11.x/frontend.md:96 +#: ./docs/master/frontend.md:96 msgid "As you can see, Livewire enables you to write new HTML attributes such as `wire:click` that connect your Laravel application's frontend and backend. In addition, you can render your component's current state using simple Blade expressions." -msgstr "就像這樣,使用 Livewire,就可以讓我們使用像 `wire:click` 這樣的新 HTML 屬性來將網站前端與 Laravel 後端連結起來。而且,我們只要使用簡單的 Blade 運算式,就能將元件目前的狀態轉譯出來。" +msgstr "" -#: docs/10.x/frontend.md:block 29 (paragraph) +# P +#: ./docs/9.x/frontend.md:98 +#: ./docs/10.x/frontend.md:98 +#: ./docs/11.x/frontend.md:98 +#: ./docs/master/frontend.md:98 msgid "For many, Livewire has revolutionized frontend development with Laravel, allowing them to stay within the comfort of Laravel while constructing modern, dynamic web applications. Typically, developers using Livewire will also utilize [Alpine.js](https://alpinejs.dev/) to \"sprinkle\" JavaScript onto their frontend only where it is needed, such as in order to render a dialog window." -msgstr "對許多人來說,Livewire 徹底改變了 Laravel 的前端開發,讓我們能待在舒服的 Laravel 內製作現代化的動態 Web App。一般來說,使用 Livewire 的開發人員也會使用 [Alpine.js](https://alpinejs.dev/) 來在一些真的有需要用到 JavaScript 的地方「點綴」上一點 JavaScript,例如要轉譯對話方塊視窗等。" +msgstr "" -#: docs/10.x/frontend.md:block 30 (paragraph) +# P +#: ./docs/10.x/frontend.md:100 +#: ./docs/11.x/frontend.md:100 +#: ./docs/master/frontend.md:100 msgid "If you're new to Laravel, we recommend getting familiar with the basic usage of [views](/docs/{{version}}/views) and [Blade](/docs/{{version}}/blade). Then, consult the official [Laravel Livewire documentation](https://livewire.laravel.com/docs) to learn how to take your application to the next level with interactive Livewire components." -msgstr "若讀者是 Laravel 初學者,我們建議可以先熟悉 [View](/docs/{{version}}/views) 與 [Blade](/docs/{{version}}/blade) 的基礎用法。然後,請參考官方的 [Laravel Livewire 說明文件](https://livewire.laravel.com/docs)來瞭解如何使用可互動的 Livewire 元件讓你的網站更好用。" +msgstr "" + +# P +#: ./docs/9.x/frontend.md:100 +msgid "If you're new to Laravel, we recommend getting familiar with the basic usage of [views](/docs/{{version}}/views) and [Blade](/docs/{{version}}/blade). Then, consult the official [Laravel Livewire documentation](https://laravel-livewire.com/docs) to learn how to take your application to the next level with interactive Livewire components." +msgstr "" -#: docs/10.x/frontend.md:block 32 (header) +# P +#: ./docs/9.x/frontend.md:102 +#: ./docs/10.x/frontend.md:102 +#: ./docs/11.x/frontend.md:102 +#: ./docs/master/frontend.md:102 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/frontend.md:103 +#: ./docs/9.x/frontend.md:183 +#: ./docs/10.x/frontend.md:103 +#: ./docs/10.x/frontend.md:181 +#: ./docs/11.x/frontend.md:103 +#: ./docs/11.x/frontend.md:181 +#: ./docs/master/frontend.md:103 +#: ./docs/master/frontend.md:181 msgid "Starter Kits" -msgstr "入門套件" +msgstr "" -#: docs/10.x/frontend.md:block 33 (paragraph) +# P +#: ./docs/9.x/frontend.md:105 +#: ./docs/10.x/frontend.md:105 +#: ./docs/11.x/frontend.md:105 +#: ./docs/master/frontend.md:105 msgid "If you would like to build your frontend using PHP and Livewire, you can leverage our Breeze or Jetstream [starter kits](/docs/{{version}}/starter-kits) to jump-start your application's development. Both of these starter kits scaffold your application's backend and frontend authentication flow using [Blade](/docs/{{version}}/blade) and [Tailwind](https://tailwindcss.com) so that you can simply start building your next big idea." -msgstr "若想使用 PHP 與 Livewire 來製作前端,可參考我們的 Breeze 與 Jetstream [入門套件](/docs/{{version}}/starter-kits)以快速開始開發網站。這兩個入門套件都使用 [Blade] 與 [Tailwind] 來 Scaffold 網站的前後端登入流程,這樣一來你就能直接開始製作你的 Idea。" +msgstr "" -#: docs/10.x/frontend.md:block 35 (header) +# P +#: ./docs/9.x/frontend.md:107 +#: ./docs/10.x/frontend.md:107 +#: ./docs/11.x/frontend.md:107 +#: ./docs/master/frontend.md:107 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/frontend.md:108 +#: ./docs/10.x/frontend.md:108 +#: ./docs/11.x/frontend.md:108 +#: ./docs/master/frontend.md:108 msgid "Using Vue / React" -msgstr "使用 Vue 或 React" +msgstr "" -#: docs/10.x/frontend.md:block 36 (paragraph) +# P +#: ./docs/9.x/frontend.md:110 +#: ./docs/10.x/frontend.md:110 +#: ./docs/11.x/frontend.md:110 +#: ./docs/master/frontend.md:110 msgid "Although it's possible to build modern frontends using Laravel and Livewire, many developers still prefer to leverage the power of a JavaScript framework like Vue or React. This allows developers to take advantage of the rich ecosystem of JavaScript packages and tools available via NPM." -msgstr "雖然,也是可以使用 Laravel 與 Livewire 來製作現代化的前端,但許多開發者還是偏好使用如 Vue 或 React 等的 JavaScript 框架。這樣,開發者就能享受到 NPM 生態圈上眾多的 JavaScript 套件與工具。" +msgstr "" -#: docs/10.x/frontend.md:block 37 (paragraph) +# P +#: ./docs/9.x/frontend.md:112 +#: ./docs/10.x/frontend.md:112 +#: ./docs/11.x/frontend.md:112 +#: ./docs/master/frontend.md:112 msgid "However, without additional tooling, pairing Laravel with Vue or React would leave us needing to solve a variety of complicated problems such as client-side routing, data hydration, and authentication. Client-side routing is often simplified by using opinionated Vue / React frameworks such as [Nuxt](https://nuxt.com/) and [Next](https://nextjs.org/); however, data hydration and authentication remain complicated and cumbersome problems to solve when pairing a backend framework like Laravel with these frontend frameworks." -msgstr "不過,若沒有額外工具,要把 Laravel 跟 Vue 或 React 搭配在一起使用會需要處理各種複雜的問題。如在用戶端進行路由、填入資料 (Hydration)、身份認證等。使用一些如 [Nuxt](https://nuxt.com/) 或 [Next](https://nextjs.org/) 等常用的 Vue / React 框架通常可簡化用戶端路由。不過,要讓這些前端框架與 Laravel 這樣的後端框架搭配使用時,要填入資料或是身份認證等的問題還是一樣複雜而且是個棘手的問題。" +msgstr "" -#: docs/10.x/frontend.md:block 38 (paragraph) +# P +#: ./docs/9.x/frontend.md:114 +#: ./docs/10.x/frontend.md:114 +#: ./docs/11.x/frontend.md:114 +#: ./docs/master/frontend.md:114 msgid "In addition, developers are left maintaining two separate code repositories, often needing to coordinate maintenance, releases, and deployments across both repositories. While these problems are not insurmountable, we don't believe it's a productive or enjoyable way to develop applications." -msgstr "而且,一些開發者最後還必須維護兩個分開的 Repository,而且還常常需要在兩個 Repository 間互相協調其維護、Release、或開發。但這些問題並不是無解的,我們認為這種開發網站的方式並不是一種有效率且可享受的方法。" +msgstr "" -#: docs/10.x/frontend.md:block 40 (header) +# P +#: ./docs/9.x/frontend.md:116 +#: ./docs/10.x/frontend.md:116 +#: ./docs/11.x/frontend.md:116 +#: ./docs/master/frontend.md:116 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/frontend.md:117 +#: ./docs/10.x/frontend.md:117 +#: ./docs/11.x/frontend.md:117 +#: ./docs/master/frontend.md:117 msgid "Inertia" -msgstr "Inertia" +msgstr "" -#: docs/10.x/frontend.md:block 41 (paragraph) +# P +#: ./docs/9.x/frontend.md:119 +#: ./docs/10.x/frontend.md:119 +#: ./docs/11.x/frontend.md:119 +#: ./docs/master/frontend.md:119 msgid "Thankfully, Laravel offers the best of both worlds. [Inertia](https://inertiajs.com) bridges the gap between your Laravel application and your modern Vue or React frontend, allowing you to build full-fledged, modern frontends using Vue or React while leveraging Laravel routes and controllers for routing, data hydration, and authentication — all within a single code repository. With this approach, you can enjoy the full power of both Laravel and Vue / React without crippling the capabilities of either tool." -msgstr "幸好,Laravel 為前後端都提供了最好的解決方案。使用 [Inertia](https://inertiajs.com) ,就能將 Laravel 程式與你的現代化 Vue 或 React 前端連結起來,讓我們能在使用供 Laravel 來路由到 Controller、填充資料、進行身份認證等的同時,還能使用 Vue 或 React 來製作成熟的現代化前端。用這種方式的話,我們就能同時享受到 Laravel 與 Vue / React 的完整功能,而不前後端框架的任何功能妥協。" +msgstr "" -#: docs/10.x/frontend.md:block 42 (paragraph) +# P +#: ./docs/9.x/frontend.md:121 +#: ./docs/10.x/frontend.md:121 +#: ./docs/11.x/frontend.md:121 +#: ./docs/master/frontend.md:121 msgid "After installing Inertia into your Laravel application, you will write routes and controllers like normal. However, instead of returning a Blade template from your controller, you will return an Inertia page:" -msgstr "將 Inertia 安裝到 Laravel 專案後,我們就可以像平常一樣寫 Route 與 Controller。不過,在這裡我們不在 Controller 內回傳 Blade 樣板,而是回傳 Inertia 頁面:" +msgstr "" -#: docs/10.x/frontend.md:block 43 (code) +# CODE: php +#: ./docs/10.x/frontend.md:123 +#: ./docs/11.x/frontend.md:123 +#: ./docs/master/frontend.md:123 msgid " User::findOrFail($id)\n" " ]);\n" " }\n" -"}\n" -msgstr " User::findOrFail($id)\n" " ]);\n" " }\n" -"}\n" - -#: docs/10.x/frontend.md:block 44 (paragraph) -msgid "An Inertia page corresponds to a Vue or React component, typically stored within the `resources/js/Pages` directory of your application. The data given to the page via the `Inertia::render` method will be used to hydrate the \"props\" of the page component:" -msgstr "Inertia 頁面對應到 Vue 或 React 元件,這些元件通常存放在專案的 `resources/js/Pages` 目錄下。使用 `Inertia::render` 方法傳給頁面的資料會用來填入該頁面元件中的「^[props](屬性)」:" +"}" +msgstr "" -#: docs/10.x/frontend.md:block 45 (code) +# CODE: vue +#: ./docs/10.x/frontend.md:149 +#: ./docs/11.x/frontend.md:149 +#: ./docs/master/frontend.md:149 msgid "\n\n" "" msgstr "" -#: docs/10.x/precognition.md:block 96 (code) +# CODE: html +#: ./docs/10.x/precognition.md:475 +#: ./docs/11.x/precognition.md:503 +#: ./docs/master/precognition.md:475 msgid "\n" +"" msgstr "" -#: docs/10.x/precognition.md:block 98 (code) +# CODE: html +#: ./docs/10.x/precognition.md:483 +#: ./docs/11.x/precognition.md:511 +#: ./docs/master/precognition.md:483 msgid "\n" +"" msgstr "" -#: docs/10.x/precognition.md:block 100 (code) +# CODE: html +#: ./docs/10.x/precognition.md:491 +#: ./docs/11.x/precognition.md:519 +#: ./docs/master/precognition.md:491 msgid "\n\n" "\n" +"" msgstr "" -#: docs/10.x/precognition.md:block 105 (header) +# P +#: ./docs/10.x/precognition.md:512 +#: ./docs/11.x/precognition.md:554 +#: ./docs/master/precognition.md:512 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/precognition.md:513 +#: ./docs/11.x/precognition.md:555 +#: ./docs/master/precognition.md:513 msgid "Repopulating Old Form Data" msgstr "" -#: docs/10.x/precognition.md:block 106 (paragraph) +# P +#: ./docs/10.x/precognition.md:515 +#: ./docs/11.x/precognition.md:557 +#: ./docs/master/precognition.md:515 msgid "In the user creation example discussed above, we are using Precognition to perform live validation; however, we are performing a traditional server-side form submission to submit the form. So, the form should be populated with any \"old\" input and validation errors returned from the server-side form submission:" msgstr "" -#: docs/10.x/precognition.md:block 107 (code) +# CODE: html +#: ./docs/10.x/precognition.md:517 +#: ./docs/11.x/precognition.md:559 +#: ./docs/master/precognition.md:517 msgid "
    messages()) }}),\n" -"}\">\n" +"}\">" msgstr "" -#: docs/10.x/precognition.md:block 108 (paragraph) +# P +#: ./docs/10.x/precognition.md:526 +#: ./docs/11.x/precognition.md:568 +#: ./docs/master/precognition.md:526 msgid "Alternatively, if you would like to submit the form via XHR you may use the form's `submit` function, which returns an Axios request promise:" msgstr "" -#: docs/10.x/precognition.md:block 109 (code) +# CODE: html +#: ./docs/10.x/precognition.md:528 +#: ./docs/master/precognition.md:528 msgid "\n" -msgstr "" - -#: docs/10.x/precognition.md:block 111 (header) +">" +msgstr "" + +# CODE: html +#: ./docs/11.x/precognition.md:536 +msgid " nextStep(),\n" +" onValidationError: (response) => /* ... */,\n" +" })\"\n" +">Next Step" +msgstr "" + +# P +#: ./docs/10.x/precognition.md:551 +#: ./docs/11.x/precognition.md:593 +#: ./docs/master/precognition.md:551 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/precognition.md:552 +#: ./docs/11.x/precognition.md:594 +#: ./docs/master/precognition.md:552 msgid "Configuring Axios" msgstr "" -#: docs/10.x/precognition.md:block 112 (paragraph) +# P +#: ./docs/10.x/precognition.md:554 +#: ./docs/11.x/precognition.md:596 +#: ./docs/master/precognition.md:554 msgid "The Precognition validation libraries use the [Axios](https://github.com/axios/axios) HTTP client to send requests to your application's backend. For convenience, the Axios instance may be customized if required by your application. For example, when using the `laravel-precognition-vue` library, you may add additional request headers to each outgoing request in your application's `resources/js/app.js` file:" msgstr "" -#: docs/10.x/precognition.md:block 113 (code) +# CODE: js +#: ./docs/10.x/precognition.md:556 +#: ./docs/11.x/precognition.md:598 +#: ./docs/master/precognition.md:556 msgid "import { client } from 'laravel-precognition-vue';\n\n" -"client.axios().defaults.headers.common['Authorization'] = authToken;\n" +"client.axios().defaults.headers.common['Authorization'] = authToken;" msgstr "" -#: docs/10.x/precognition.md:block 114 (paragraph) +# P +#: ./docs/10.x/precognition.md:562 +#: ./docs/11.x/precognition.md:604 +#: ./docs/master/precognition.md:562 msgid "Or, if you already have a configured Axios instance for your application, you may tell Precognition to use that instance instead:" msgstr "" -#: docs/10.x/precognition.md:block 115 (code) +# CODE: js +#: ./docs/10.x/precognition.md:564 +#: ./docs/11.x/precognition.md:606 +#: ./docs/master/precognition.md:564 msgid "import Axios from 'axios';\n" "import { client } from 'laravel-precognition-vue';\n\n" "window.axios = Axios.create()\n" "window.axios.defaults.headers.common['Authorization'] = authToken;\n\n" -"client.use(window.axios)\n" +"client.use(window.axios)" +msgstr "" + +# CODE: html +#: ./docs/11.x/precognition.md:570 +msgid " {\n" +" form.reset();\n\n" +" alert('User created.')\n" +" })\n" +" .catch(error => {\n" +" alert('An error occurred.');\n" +" });\n" +" },\n" +" }\"\n" +" @submit.prevent=\"submit\"\n" +">" msgstr "" -#: docs/10.x/precognition.md:block 116 (quote) -msgid "**Warning** The Inertia flavored Precognition libraries will only use the configured Axios instance for validation requests. Form submissions will always be sent by Inertia." +# P +#: ./docs/10.x/precognition.md:575 +#: ./docs/11.x/precognition.md:617 +#: ./docs/master/precognition.md:575 +msgid "The Inertia flavored Precognition libraries will only use the configured Axios instance for validation requests. Form submissions will always be sent by Inertia." msgstr "" -#: docs/10.x/precognition.md:block 118 (header) +# P +#: ./docs/10.x/precognition.md:577 +#: ./docs/11.x/precognition.md:619 +#: ./docs/master/precognition.md:577 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/precognition.md:578 +#: ./docs/11.x/precognition.md:620 +#: ./docs/master/precognition.md:578 msgid "Customizing Validation Rules" msgstr "" -#: docs/10.x/precognition.md:block 119 (paragraph) +# P +#: ./docs/10.x/precognition.md:580 +#: ./docs/11.x/precognition.md:622 +#: ./docs/master/precognition.md:580 msgid "It is possible to customize the validation rules executed during a precognitive request by using the request's `isPrecognitive` method." msgstr "" -#: docs/10.x/precognition.md:block 120 (paragraph) +# P +#: ./docs/10.x/precognition.md:582 +#: ./docs/11.x/precognition.md:624 +#: ./docs/master/precognition.md:582 msgid "For example, on a user creation form, we may want to validate that a password is \"uncompromised\" only on the final form submission. For precognitive validation requests, we will simply validate that the password is required and has a minimum of 8 characters. Using the `isPrecognitive` method, we can customize the rules defined by our form request:" msgstr "" -#: docs/10.x/precognition.md:block 121 (code) +# CODE: php +#: ./docs/10.x/precognition.md:584 +#: ./docs/11.x/precognition.md:626 +#: ./docs/master/precognition.md:584 msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/precognition.md:615 +#: ./docs/11.x/precognition.md:657 +#: ./docs/master/precognition.md:615 msgid "Handling File Uploads" msgstr "" -#: docs/10.x/precognition.md:block 124 (paragraph) +# P +#: ./docs/10.x/precognition.md:617 +#: ./docs/11.x/precognition.md:659 +#: ./docs/master/precognition.md:617 msgid "By default, Laravel Precognition does not upload or validate files during a precognitive validation request. This ensure that large files are not unnecessarily uploaded multiple times." msgstr "" -#: docs/10.x/precognition.md:block 125 (paragraph) +# P +#: ./docs/10.x/precognition.md:619 +#: ./docs/11.x/precognition.md:661 +#: ./docs/master/precognition.md:619 msgid "Because of this behavior, you should ensure that your application [customizes the corresponding form request's validation rules](#customizing-validation-rules) to specify the field is only required for full form submissions:" msgstr "" -#: docs/10.x/precognition.md:block 126 (code) +# CODE: php +#: ./docs/10.x/precognition.md:621 +#: ./docs/master/precognition.md:621 msgid "/**\n" " * Get the validation rules that apply to the request.\n" " *\n" @@ -675,30 +1250,55 @@ msgid "/**\n" " ],\n" " // ...\n" " ];\n" -"}\n" +"}" msgstr "" -#: docs/10.x/precognition.md:block 127 (paragraph) +# P +#: ./docs/10.x/precognition.md:641 +#: ./docs/11.x/precognition.md:683 +#: ./docs/master/precognition.md:641 msgid "If you would like to include files in every validation request, you may invoke the `validateFiles` function on your client-side form instance:" msgstr "" -#: docs/10.x/precognition.md:block 128 (code) -msgid "form.validateFiles();\n" +# CODE: js +#: ./docs/10.x/precognition.md:643 +#: ./docs/11.x/precognition.md:685 +#: ./docs/master/precognition.md:643 +msgid "form.validateFiles();" msgstr "" -#: docs/10.x/precognition.md:block 130 (header) +# P +#: ./docs/10.x/precognition.md:647 +#: ./docs/11.x/precognition.md:689 +#: ./docs/master/precognition.md:647 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/precognition.md:648 +#: ./docs/11.x/precognition.md:690 +#: ./docs/master/precognition.md:648 msgid "Managing Side-Effects" msgstr "" -#: docs/10.x/precognition.md:block 131 (paragraph) +# P +#: ./docs/10.x/precognition.md:650 +#: ./docs/11.x/precognition.md:692 +#: ./docs/master/precognition.md:650 msgid "When adding the `HandlePrecognitiveRequests` middleware to a route, you should consider if there are any side-effects in *other* middleware that should be skipped during a precognitive request." msgstr "" -#: docs/10.x/precognition.md:block 132 (paragraph) +# P +#: ./docs/10.x/precognition.md:652 +#: ./docs/11.x/precognition.md:694 +#: ./docs/master/precognition.md:652 msgid "For example, you may have a middleware that increments the total number of \"interactions\" each user has with your application, but you may not want precognitive requests to be counted as an interaction. To accomplish this, we may check the request's `isPrecognitive` method before incrementing the interaction count:" msgstr "" -#: docs/10.x/precognition.md:block 133 (code) +# CODE: php +#: ./docs/10.x/precognition.md:654 +#: ./docs/11.x/precognition.md:696 +#: ./docs/master/precognition.md:654 msgid " [\n" +" ...$this->isPrecognitive() ? [] : ['required'],\n" +" 'image',\n" +" 'mimes:jpg,png',\n" +" 'dimensions:ratio=3/2',\n" +" ],\n" +" // ...\n" +" ];\n" +"}" msgstr "" -#: docs/10.x/precognition.md:block 135 (header) +# P +#: ./docs/10.x/precognition.md:679 +#: ./docs/11.x/precognition.md:721 +#: ./docs/master/precognition.md:679 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/precognition.md:680 +#: ./docs/11.x/precognition.md:722 +#: ./docs/master/precognition.md:680 msgid "Testing" msgstr "" -#: docs/10.x/precognition.md:block 136 (paragraph) +# P +#: ./docs/10.x/precognition.md:682 +#: ./docs/11.x/precognition.md:724 +#: ./docs/master/precognition.md:682 msgid "If you would like to make precognitive requests in your tests, Laravel's `TestCase` includes a `withPrecognition` helper which will add the `Precognition` request header." msgstr "" -#: docs/10.x/precognition.md:block 137 (paragraph) +# P +#: ./docs/10.x/precognition.md:684 +#: ./docs/11.x/precognition.md:726 +#: ./docs/master/precognition.md:684 msgid "Additionally, if you would like to assert that a precognitive request was successful, e.g., did not return any validation errors, you may use the `assertSuccessfulPrecognition` method on the response:" msgstr "" -#: docs/10.x/precognition.md:block 138 (code) +# CODE: php +# CODE: php tab=PHPUnit +#: ./docs/10.x/precognition.md:686 +#: ./docs/11.x/precognition.md:741 +#: ./docs/master/precognition.md:699 msgid "public function test_it_validates_registration_form_with_precognition()\n" "{\n" " $response = $this->withPrecognition()\n" @@ -740,6 +1381,19 @@ msgid "public function test_it_validates_registration_form_with_precognition()\n " ]);\n\n" " $response->assertSuccessfulPrecognition();\n" " $this->assertSame(0, User::count());\n" -"}\n" +"}" +msgstr "" + +# CODE: php tab=Pest +#: ./docs/11.x/precognition.md:728 +#: ./docs/master/precognition.md:686 +msgid "it('validates registration form with precognition', function () {\n" +" $response = $this->withPrecognition()\n" +" ->post('/register', [\n" +" 'name' => 'Taylor Otwell',\n" +" ]);\n\n" +" $response->assertSuccessfulPrecognition();\n\n" +" expect(User::count())->toBe(0);\n" +"});" msgstr "" diff --git a/po/zh_TW/processes.po b/po/zh_TW/processes.po index 2170c91ff..25c96e4e5 100644 --- a/po/zh_TW/processes.po +++ b/po/zh_TW/processes.po @@ -10,305 +10,568 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:27\n" +"PO-Revision-Date: 2024-11-30 08:39\n" -#: docs/10.x/processes.md:block 1 (header) +# H1 +#: ./docs/10.x/processes.md:1 +#: ./docs/11.x/processes.md:1 +#: ./docs/master/processes.md:1 msgid "Processes" -msgstr "Process" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:3 +#: ./docs/11.x/processes.md:3 +#: ./docs/master/processes.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:4 +#: ./docs/11.x/processes.md:4 +#: ./docs/master/processes.md:4 msgid "[Invoking Processes](#invoking-processes)" -msgstr "[呼叫 Process](#invoking-processes)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:5 +#: ./docs/11.x/processes.md:5 +#: ./docs/master/processes.md:5 msgid "[Process Options](#process-options)" -msgstr "[Process 選項](#process-options)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:6 +#: ./docs/11.x/processes.md:6 +#: ./docs/master/processes.md:6 msgid "[Process Output](#process-output)" -msgstr "[Process 的輸出](#process-output)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:7 +#: ./docs/11.x/processes.md:7 +#: ./docs/master/processes.md:7 msgid "[Pipelines](#process-pipelines)" -msgstr "[管道 (Pipeline)](#process-pipelines)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:8 +#: ./docs/11.x/processes.md:8 +#: ./docs/master/processes.md:8 msgid "[Asynchronous Processes](#asynchronous-processes)" -msgstr "[非同步的 Process](#asynchronous-processes)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) -msgid "[Process IDs & Signals](#process-ids-and-signals)" -msgstr "[Process ID 與 Signal](#process-ids-and-signals)" +# P +#: ./docs/10.x/processes.md:9 +#: ./docs/11.x/processes.md:9 +#: ./docs/master/processes.md:9 +msgid "[Process IDs and Signals](#process-ids-and-signals)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:10 +#: ./docs/11.x/processes.md:10 +#: ./docs/master/processes.md:10 msgid "[Asynchronous Process Output](#asynchronous-process-output)" -msgstr "[非同步 Process 的輸出](#asynchronous-process-output)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:11 +#: ./docs/11.x/processes.md:11 +#: ./docs/master/processes.md:11 msgid "[Concurrent Processes](#concurrent-processes)" -msgstr "[併行地 Process](#concurrent-processes)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:12 +#: ./docs/11.x/processes.md:12 +#: ./docs/master/processes.md:12 msgid "[Naming Pool Processes](#naming-pool-processes)" -msgstr "[命名的 Pool Process](#naming-pool-processes)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) -msgid "[Pool Process IDs & Signals](#pool-process-ids-and-signals)" -msgstr "[Pool Process 的 ID 與 Signal](#pool-process-ids-and-signals)" +# P +#: ./docs/10.x/processes.md:13 +#: ./docs/11.x/processes.md:13 +#: ./docs/master/processes.md:13 +msgid "[Pool Process IDs and Signals](#pool-process-ids-and-signals)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:14 +#: ./docs/11.x/processes.md:14 +#: ./docs/master/processes.md:14 msgid "[Testing](#testing)" -msgstr "[測試](#testing)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:15 +#: ./docs/11.x/processes.md:15 +#: ./docs/master/processes.md:15 msgid "[Faking Processes](#faking-processes)" -msgstr "[模擬 Process](#faking-processes)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:16 +#: ./docs/11.x/processes.md:16 +#: ./docs/master/processes.md:16 msgid "[Faking Specific Processes](#faking-specific-processes)" -msgstr "[模擬特定 Process](#faking-specific-processes)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:17 +#: ./docs/11.x/processes.md:17 +#: ./docs/master/processes.md:17 msgid "[Faking Process Sequences](#faking-process-sequences)" -msgstr "[模擬 Process 的順序](#faking-process-sequences)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:18 +#: ./docs/11.x/processes.md:18 +#: ./docs/master/processes.md:18 msgid "[Faking Asynchronous Process Lifecycles](#faking-asynchronous-process-lifecycles)" -msgstr "[模擬非同步 Process 的生命週期](#faking-asynchronous-process-lifecycles)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:19 +#: ./docs/11.x/processes.md:19 +#: ./docs/master/processes.md:19 msgid "[Available Assertions](#available-assertions)" -msgstr "[可用的 Assertion](#available-assertions)" +msgstr "" -#: docs/10.x/processes.md:block 2 (unordered list) +# P +#: ./docs/10.x/processes.md:20 +#: ./docs/11.x/processes.md:20 +#: ./docs/master/processes.md:20 msgid "[Preventing Stray Processes](#preventing-stray-processes)" -msgstr "[避免漏掉的 Process](#preventing-stray-processes)" +msgstr "" -#: docs/10.x/processes.md:block 4 (header) +# P +#: ./docs/10.x/processes.md:22 +#: ./docs/11.x/processes.md:22 +#: ./docs/master/processes.md:22 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/processes.md:23 +#: ./docs/11.x/processes.md:23 +#: ./docs/master/processes.md:23 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/processes.md:block 5 (paragraph) +# P +#: ./docs/10.x/processes.md:25 msgid "Laravel provides an expressive, minimal API around the [Symfony Process component](https://symfony.com/doc/current/components/process.html), allowing you to conveniently invoke external processes from your Laravel application. Laravel's process features are focused on the most common use cases and a wonderful developer experience." -msgstr "Laravel 為 [Symfony 的 Process Component](https://symfony.com/doc/current/components/process.html) 提供了一個語意化、極簡的 API,能讓我們方便地在 Laravel 專案中呼叫外部 ^[Process](處理程序)。Laravel 的 Process 功能著重於最常見的使用情境,並提供優秀的開發人員經驗 (Developer Experience)。" +msgstr "" + +# P +#: ./docs/11.x/processes.md:25 +#: ./docs/master/processes.md:25 +msgid "Laravel provides an expressive, minimal API around the [Symfony Process component](https://symfony.com/doc/7.0/components/process.html), allowing you to conveniently invoke external processes from your Laravel application. Laravel's process features are focused on the most common use cases and a wonderful developer experience." +msgstr "" -#: docs/10.x/processes.md:block 7 (header) +# P +#: ./docs/10.x/processes.md:27 +#: ./docs/11.x/processes.md:27 +#: ./docs/master/processes.md:27 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/processes.md:28 +#: ./docs/11.x/processes.md:28 +#: ./docs/master/processes.md:28 msgid "Invoking Processes" -msgstr "呼叫 Process" +msgstr "" -#: docs/10.x/processes.md:block 8 (paragraph) +# P +#: ./docs/10.x/processes.md:30 +#: ./docs/11.x/processes.md:30 +#: ./docs/master/processes.md:30 msgid "To invoke a process, you may use the `run` and `start` methods offered by the `Process` facade. The `run` method will invoke a process and wait for the process to finish executing, while the `start` method is used for asynchronous process execution. We'll examine both approaches within this documentation. First, let's examine how to invoke a basic, synchronous process and inspect its result:" -msgstr "若要呼叫 Process,可以使用 `Process` Facade 提供的 `run` 與 `start` 方法。`run` 方法會呼叫 Process,並等待該 Process 執行完畢。而 `start` 方法會以非同步方式執行 Process。我們將在此文件中詳細討論這兩種方法。首先,我們先來看看如何執行一個基本的同步 Process 並取得其執行結果:" +msgstr "" -#: docs/10.x/processes.md:block 9 (code) +# CODE: php +#: ./docs/10.x/processes.md:32 +#: ./docs/11.x/processes.md:32 +#: ./docs/master/processes.md:32 msgid "use Illuminate\\Support\\Facades\\Process;\n\n" "$result = Process::run('ls -la');\n\n" -"return $result->output();\n" -msgstr "use Illuminate\\Support\\Facades\\Process;\n\n" -"$result = Process::run('ls -la');\n\n" -"return $result->output();\n" +"return $result->output();" +msgstr "" -#: docs/10.x/processes.md:block 10 (paragraph) +# P +#: ./docs/10.x/processes.md:40 +#: ./docs/11.x/processes.md:40 +#: ./docs/master/processes.md:40 msgid "Of course, the `Illuminate\\Contracts\\Process\\ProcessResult` instance returned by the `run` method offers a variety of helpful methods that may be used to inspect the process result:" -msgstr "當然,`run` 方法回傳的 `Illuminate\\Contracts\\Process\\ProcessResult` 實體還包含了多種可用於檢查 Process 執行結果的實用方法:" +msgstr "" -#: docs/10.x/processes.md:block 11 (code) +# CODE: php +#: ./docs/10.x/processes.md:42 +#: ./docs/11.x/processes.md:42 +#: ./docs/master/processes.md:42 msgid "$result = Process::run('ls -la');\n\n" "$result->successful();\n" "$result->failed();\n" "$result->exitCode();\n" "$result->output();\n" -"$result->errorOutput();\n" -msgstr "$result = Process::run('ls -la');\n\n" -"$result->successful();\n" -"$result->failed();\n" -"$result->exitCode();\n" -"$result->output();\n" -"$result->errorOutput();\n" +"$result->errorOutput();" +msgstr "" -#: docs/10.x/processes.md:block 13 (header) +# P +#: ./docs/10.x/processes.md:52 +#: ./docs/11.x/processes.md:52 +#: ./docs/master/processes.md:52 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/processes.md:53 +#: ./docs/11.x/processes.md:53 +#: ./docs/master/processes.md:53 msgid "Throwing Exceptions" -msgstr "擲回 Exception" +msgstr "" -#: docs/10.x/processes.md:block 14 (paragraph) +# P +#: ./docs/10.x/processes.md:55 +#: ./docs/11.x/processes.md:55 +#: ./docs/master/processes.md:55 msgid "If you have a process result and would like to throw an instance of `Illuminate\\Process\\Exceptions\\ProcessFailedException` if the exit code is greater than zero (thus indicating failure), you may use the `throw` and `throwIf` methods. If the process did not fail, the process result instance will be returned:" -msgstr "若在取得 Process 執行結果後,希望能讓終止代碼 (Exit Code) 大於 0 的狀況 (表示執行失敗) 擲回 `Illuminate\\Process\\Exceptions\\ProcessFailedException`,可以使用 `throw` 與 `throwIf` 方法。若 Process 並未執行失敗,則會回傳 Process 執行結果的實體:" +msgstr "" -#: docs/10.x/processes.md:block 15 (code) +# CODE: php +#: ./docs/10.x/processes.md:57 +#: ./docs/11.x/processes.md:57 +#: ./docs/master/processes.md:57 msgid "$result = Process::run('ls -la')->throw();\n\n" -"$result = Process::run('ls -la')->throwIf($condition);\n" -msgstr "$result = Process::run('ls -la')->throw();\n\n" -"$result = Process::run('ls -la')->throwIf($condition);\n" +"$result = Process::run('ls -la')->throwIf($condition);" +msgstr "" -#: docs/10.x/processes.md:block 17 (header) +# P +#: ./docs/10.x/processes.md:63 +#: ./docs/11.x/processes.md:63 +#: ./docs/master/processes.md:63 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:64 +#: ./docs/11.x/processes.md:64 +#: ./docs/master/processes.md:64 msgid "Process Options" -msgstr "Process 選項" +msgstr "" -#: docs/10.x/processes.md:block 18 (paragraph) +# P +#: ./docs/10.x/processes.md:66 +#: ./docs/11.x/processes.md:66 +#: ./docs/master/processes.md:66 msgid "Of course, you may need to customize the behavior of a process before invoking it. Thankfully, Laravel allows you to tweak a variety of process features, such as the working directory, timeout, and environment variables." -msgstr "當然,你可能會需要在呼叫 Process 前自訂該 Process 的行為。在 Laravel 中,可以調整許多 Process 的功能,例如工作目錄 (Working Directory)、逾時與環境變數等。" +msgstr "" -#: docs/10.x/processes.md:block 20 (header) +# P +#: ./docs/10.x/processes.md:68 +#: ./docs/11.x/processes.md:68 +#: ./docs/master/processes.md:68 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/processes.md:69 +#: ./docs/11.x/processes.md:69 +#: ./docs/master/processes.md:69 msgid "Working Directory Path" -msgstr "工作目錄路徑" +msgstr "" -#: docs/10.x/processes.md:block 21 (paragraph) +# P +#: ./docs/10.x/processes.md:71 +#: ./docs/11.x/processes.md:71 +#: ./docs/master/processes.md:71 msgid "You may use the `path` method to specify the working directory of the process. If this method is not invoked, the process will inherit the working directory of the currently executing PHP script:" -msgstr "可以使用 `path` 方法來指定 Process 的工作目錄。若未呼叫此方法,則該 Process 會繼承目前執行 PHP Script 的工作目錄:" +msgstr "" -#: docs/10.x/processes.md:block 22 (code) -msgid "$result = Process::path(__DIR__)->run('ls -la');\n" -msgstr "$result = Process::path(__DIR__)->run('ls -la');\n" +# CODE: php +#: ./docs/10.x/processes.md:73 +#: ./docs/11.x/processes.md:73 +#: ./docs/master/processes.md:73 +msgid "$result = Process::path(__DIR__)->run('ls -la');" +msgstr "" -#: docs/10.x/processes.md:block 24 (header) +# P +#: ./docs/10.x/processes.md:77 +#: ./docs/11.x/processes.md:77 +#: ./docs/master/processes.md:77 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/processes.md:78 +#: ./docs/11.x/processes.md:78 +#: ./docs/master/processes.md:78 msgid "Input" -msgstr "輸入" +msgstr "" -#: docs/10.x/processes.md:block 25 (paragraph) +# P +#: ./docs/10.x/processes.md:80 +#: ./docs/11.x/processes.md:80 +#: ./docs/master/processes.md:80 msgid "You may provide input via the \"standard input\" of the process using the `input` method:" -msgstr "可以通過 `input` 方法來以「標準輸入 (Standard Input)」提供輸入給 Process:" +msgstr "" -#: docs/10.x/processes.md:block 26 (code) -msgid "$result = Process::input('Hello World')->run('cat');\n" -msgstr "$result = Process::input('Hello World')->run('cat');\n" +# CODE: php +#: ./docs/10.x/processes.md:82 +#: ./docs/11.x/processes.md:82 +#: ./docs/master/processes.md:82 +msgid "$result = Process::input('Hello World')->run('cat');" +msgstr "" -#: docs/10.x/processes.md:block 28 (header) +# P +#: ./docs/10.x/processes.md:86 +#: ./docs/11.x/processes.md:86 +#: ./docs/master/processes.md:86 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/processes.md:87 +#: ./docs/11.x/processes.md:87 +#: ./docs/master/processes.md:87 msgid "Timeouts" -msgstr "逾時" +msgstr "" -#: docs/10.x/processes.md:block 29 (paragraph) +# P +#: ./docs/10.x/processes.md:89 +#: ./docs/11.x/processes.md:89 +#: ./docs/master/processes.md:89 msgid "By default, processes will throw an instance of `Illuminate\\Process\\Exceptions\\ProcessTimedOutException` after executing for more than 60 seconds. However, you can customize this behavior via the `timeout` method:" -msgstr "預設情況下,Process 會在執行超過 60 秒後擲回 `Illuminate\\Process\\Exceptions\\ProcessTimedOutException` 實體。不過,可以使用 `timeout` 方法來自定此行為:" +msgstr "" -#: docs/10.x/processes.md:block 30 (code) -msgid "$result = Process::timeout(120)->run('bash import.sh');\n" -msgstr "$result = Process::timeout(120)->run('bash import.sh');\n" +# CODE: php +#: ./docs/10.x/processes.md:91 +#: ./docs/11.x/processes.md:91 +#: ./docs/master/processes.md:91 +msgid "$result = Process::timeout(120)->run('bash import.sh');" +msgstr "" -#: docs/10.x/processes.md:block 31 (paragraph) +# P +#: ./docs/10.x/processes.md:95 +#: ./docs/11.x/processes.md:95 +#: ./docs/master/processes.md:95 msgid "Or, if you would like to disable the process timeout entirely, you may invoke the `forever` method:" -msgstr "或者,若要完全禁用 Process 的逾時,可以呼叫 `forever` 方法:" +msgstr "" -#: docs/10.x/processes.md:block 32 (code) -msgid "$result = Process::forever()->run('bash import.sh');\n" -msgstr "$result = Process::forever()->run('bash import.sh');\n" +# CODE: php +#: ./docs/10.x/processes.md:97 +#: ./docs/11.x/processes.md:97 +#: ./docs/master/processes.md:97 +msgid "$result = Process::forever()->run('bash import.sh');" +msgstr "" -#: docs/10.x/processes.md:block 33 (paragraph) +# P +#: ./docs/10.x/processes.md:101 +#: ./docs/11.x/processes.md:101 +#: ./docs/master/processes.md:101 msgid "The `idleTimeout` method may be used to specify the maximum number of seconds the process may run without returning any output:" -msgstr "`idleTimeout` 方法可用來指定 Process 在不回傳任何輸出下可執行的最大秒數:" +msgstr "" -#: docs/10.x/processes.md:block 34 (code) -msgid "$result = Process::timeout(60)->idleTimeout(30)->run('bash import.sh');\n" -msgstr "$result = Process::timeout(60)->idleTimeout(30)->run('bash import.sh');\n" +# CODE: php +#: ./docs/10.x/processes.md:103 +#: ./docs/11.x/processes.md:103 +#: ./docs/master/processes.md:103 +msgid "$result = Process::timeout(60)->idleTimeout(30)->run('bash import.sh');" +msgstr "" -#: docs/10.x/processes.md:block 36 (header) +# P +#: ./docs/10.x/processes.md:107 +#: ./docs/11.x/processes.md:107 +#: ./docs/master/processes.md:107 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/processes.md:108 +#: ./docs/11.x/processes.md:108 +#: ./docs/master/processes.md:108 msgid "Environment Variables" -msgstr "環境變數" +msgstr "" -#: docs/10.x/processes.md:block 37 (paragraph) +# P +#: ./docs/10.x/processes.md:110 +#: ./docs/11.x/processes.md:110 +#: ./docs/master/processes.md:110 msgid "Environment variables may be provided to the process via the `env` method. The invoked process will also inherit all of the environment variables defined by your system:" -msgstr "可以使用 `env` 方法來提供環境變數給 Process。被呼叫的 Process 也會繼承在系統中所定義的所有環境變數:" +msgstr "" -#: docs/10.x/processes.md:block 38 (code) +# CODE: php +#: ./docs/10.x/processes.md:112 +#: ./docs/11.x/processes.md:112 +#: ./docs/master/processes.md:112 msgid "$result = Process::forever()\n" " ->env(['IMPORT_PATH' => __DIR__])\n" -" ->run('bash import.sh');\n" -msgstr "$result = Process::forever()\n" -" ->env(['IMPORT_PATH' => __DIR__])\n" -" ->run('bash import.sh');\n" +" ->run('bash import.sh');" +msgstr "" -#: docs/10.x/processes.md:block 39 (paragraph) +# P +#: ./docs/10.x/processes.md:118 +#: ./docs/11.x/processes.md:118 +#: ./docs/master/processes.md:118 msgid "If you wish to remove an inherited environment variable from the invoked process, you may provide that environment variable with a value of `false`:" -msgstr "若想從呼叫的 Process 中移除繼承的環境變數,可以提供一個值為 `false` 的環境變數:" +msgstr "" -#: docs/10.x/processes.md:block 40 (code) +# CODE: php +#: ./docs/10.x/processes.md:120 +#: ./docs/11.x/processes.md:120 +#: ./docs/master/processes.md:120 msgid "$result = Process::forever()\n" " ->env(['LOAD_PATH' => false])\n" -" ->run('bash import.sh');\n" -msgstr "$result = Process::forever()\n" -" ->env(['LOAD_PATH' => false])\n" -" ->run('bash import.sh');\n" +" ->run('bash import.sh');" +msgstr "" -#: docs/10.x/processes.md:block 42 (header) +# P +#: ./docs/10.x/processes.md:126 +#: ./docs/11.x/processes.md:126 +#: ./docs/master/processes.md:126 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/processes.md:127 +#: ./docs/11.x/processes.md:127 +#: ./docs/master/processes.md:127 msgid "TTY Mode" -msgstr "TTY 模式" +msgstr "" -#: docs/10.x/processes.md:block 43 (paragraph) +# P +#: ./docs/10.x/processes.md:129 +#: ./docs/11.x/processes.md:129 +#: ./docs/master/processes.md:129 msgid "The `tty` method may be used to enable TTY mode for your process. TTY mode connects the input and output of the process to the input and output of your program, allowing your process to open an editor like Vim or Nano as a process:" -msgstr "`tty` 方法可用來在 Process 上啟用 TTY 模式。TTY 模式會將 Process 的 Input 與 Output 連結到你的程式的 Input 與 Output,讓你的 Process 能打開如 Vim 或 Nano 之類的 Process:" +msgstr "" -#: docs/10.x/processes.md:block 44 (code) -msgid "Process::forever()->tty()->run('vim');\n" -msgstr "Process::forever()->tty()->run('vim');\n" +# CODE: php +#: ./docs/10.x/processes.md:131 +#: ./docs/11.x/processes.md:131 +#: ./docs/master/processes.md:131 +msgid "Process::forever()->tty()->run('vim');" +msgstr "" -#: docs/10.x/processes.md:block 46 (header) +# P +#: ./docs/10.x/processes.md:135 +#: ./docs/11.x/processes.md:135 +#: ./docs/master/processes.md:135 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:136 +#: ./docs/11.x/processes.md:136 +#: ./docs/master/processes.md:136 msgid "Process Output" -msgstr "Process 的輸出" +msgstr "" -#: docs/10.x/processes.md:block 47 (paragraph) +# P +#: ./docs/10.x/processes.md:138 +#: ./docs/11.x/processes.md:138 +#: ./docs/master/processes.md:138 msgid "As previously discussed, process output may be accessed using the `output` (stdout) and `errorOutput` (stderr) methods on a process result:" -msgstr "剛才提到過,可以使用 `output` (stdout) 與 `errorOutput` (stderr) 方法來在 Process 結果上取得 Process 的輸出:" +msgstr "" -#: docs/10.x/processes.md:block 48 (code) +# CODE: php +#: ./docs/10.x/processes.md:140 +#: ./docs/11.x/processes.md:140 +#: ./docs/master/processes.md:140 msgid "use Illuminate\\Support\\Facades\\Process;\n\n" "$result = Process::run('ls -la');\n\n" "echo $result->output();\n" -"echo $result->errorOutput();\n" -msgstr "use Illuminate\\Support\\Facades\\Process;\n\n" -"$result = Process::run('ls -la');\n\n" -"echo $result->output();\n" -"echo $result->errorOutput();\n" +"echo $result->errorOutput();" +msgstr "" -#: docs/10.x/processes.md:block 49 (paragraph) +# P +#: ./docs/10.x/processes.md:149 +#: ./docs/11.x/processes.md:149 +#: ./docs/master/processes.md:149 msgid "However, output may also be gathered in real-time by passing a closure as the second argument to the `run` method. The closure will receive two arguments: the \"type\" of output (`stdout` or `stderr`) and the output string itself:" -msgstr "不過,也可以在呼叫 `run` 方法時傳入一個 Closure 作為第二個引數來即時取得輸出。該 Closure 會收到兩個引數:輸出的「類型 (Type)」(`stdout` 或 `stderr`) 與輸出字串本身:" +msgstr "" -#: docs/10.x/processes.md:block 50 (code) +# CODE: php +#: ./docs/10.x/processes.md:151 +#: ./docs/11.x/processes.md:151 +#: ./docs/master/processes.md:151 msgid "$result = Process::run('ls -la', function (string $type, string $output) {\n" " echo $output;\n" -"});\n" -msgstr "$result = Process::run('ls -la', function (string $type, string $output) {\n" -" echo $output;\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/processes.md:block 51 (paragraph) +# P +#: ./docs/10.x/processes.md:157 +#: ./docs/11.x/processes.md:157 +#: ./docs/master/processes.md:157 msgid "Laravel also offers the `seeInOutput` and `seeInErrorOutput` methods, which provide a convenient way to determine if a given string was contained in the process' output:" -msgstr "Laravel 也提供了 `seeInOutput` 與 `seeInErrorOutput` 方法。通過這兩個方法,就可以方便地判斷給定的字串是否包含在該 Process 的輸出中:" +msgstr "" -#: docs/10.x/processes.md:block 52 (code) +# CODE: php +#: ./docs/10.x/processes.md:159 +#: ./docs/11.x/processes.md:159 +#: ./docs/master/processes.md:159 msgid "if (Process::run('ls -la')->seeInOutput('laravel')) {\n" " // ...\n" -"}\n" -msgstr "if (Process::run('ls -la')->seeInOutput('laravel')) {\n" -" // ...\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/processes.md:block 54 (header) +# P +#: ./docs/10.x/processes.md:165 +#: ./docs/11.x/processes.md:165 +#: ./docs/master/processes.md:165 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/processes.md:166 +#: ./docs/11.x/processes.md:166 +#: ./docs/master/processes.md:166 msgid "Disabling Process Output" -msgstr "關閉 Process 的輸出" +msgstr "" -#: docs/10.x/processes.md:block 55 (paragraph) +# P +#: ./docs/10.x/processes.md:168 +#: ./docs/11.x/processes.md:168 +#: ./docs/master/processes.md:168 msgid "If your process is writing a significant amount of output that you are not interested in, you can conserve memory by disabling output retrieval entirely. To accomplish this, invoke the `quietly` method while building the process:" -msgstr "若 Process 會寫入大量不必要的輸出,可以完全關閉取得輸出來減少記憶體使用。若要關閉取得輸出,請在建構 Process 時呼叫 `quietly` 方法:" +msgstr "" -#: docs/10.x/processes.md:block 56 (code) +# CODE: php +#: ./docs/10.x/processes.md:170 +#: ./docs/11.x/processes.md:170 +#: ./docs/master/processes.md:170 msgid "use Illuminate\\Support\\Facades\\Process;\n\n" -"$result = Process::quietly()->run('bash import.sh');\n" -msgstr "use Illuminate\\Support\\Facades\\Process;\n\n" -"$result = Process::quietly()->run('bash import.sh');\n" +"$result = Process::quietly()->run('bash import.sh');" +msgstr "" -#: docs/10.x/processes.md:block 58 (header) +# P +#: ./docs/10.x/processes.md:176 +#: ./docs/11.x/processes.md:176 +#: ./docs/master/processes.md:176 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:177 +#: ./docs/11.x/processes.md:177 +#: ./docs/master/processes.md:177 msgid "Pipelines" -msgstr "管道" +msgstr "" -#: docs/10.x/processes.md:block 59 (paragraph) +# P +#: ./docs/10.x/processes.md:179 +#: ./docs/11.x/processes.md:179 +#: ./docs/master/processes.md:179 msgid "Sometimes you may want to make the output of one process the input of another process. This is often referred to as \"piping\" the output of a process into another. The `pipe` method provided by the `Process` facades makes this easy to accomplish. The `pipe` method will execute the piped processes synchronously and return the process result for the last process in the pipeline:" -msgstr "有時候,我們可能會想使用某個 Process 的輸出來作為另一個 Process 的輸入。這個動作我們一般會說是把 Process 的輸出「Pipe」到另一個 Process。`Process` Facade 提供的 `pipe` 方法能讓我們輕鬆進行此動作。`pipe` 方法會同步執行被 Pipe 的Process,並回傳管道中最後一個 Process 的結果:" +msgstr "" -#: docs/10.x/processes.md:block 60 (code) +# CODE: php +#: ./docs/10.x/processes.md:181 +#: ./docs/11.x/processes.md:181 +#: ./docs/master/processes.md:181 msgid "use Illuminate\\Process\\Pipe;\n" "use Illuminate\\Support\\Facades\\Process;\n\n" "$result = Process::pipe(function (Pipe $pipe) {\n" @@ -317,170 +580,250 @@ msgid "use Illuminate\\Process\\Pipe;\n" "});\n\n" "if ($result->successful()) {\n" " // ...\n" -"}\n" -msgstr "use Illuminate\\Process\\Pipe;\n" -"use Illuminate\\Support\\Facades\\Process;\n\n" -"$result = Process::pipe(function (Pipe $pipe) {\n" -" $pipe->command('cat example.txt');\n" -" $pipe->command('grep -i \"laravel\"');\n" -"});\n\n" -"if ($result->successful()) {\n" -" // ...\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/processes.md:block 61 (paragraph) +# P +#: ./docs/10.x/processes.md:195 +#: ./docs/11.x/processes.md:195 +#: ./docs/master/processes.md:195 msgid "If you do not need to customize the individual processes that make up the pipeline, you may simply pass an array of command strings to the `pipe` method:" -msgstr "若不需要為組成管道的個別 Process 進行自訂,則只需要傳入一組指令字串的陣列給 `pipe` 方法即可:" +msgstr "" -#: docs/10.x/processes.md:block 62 (code) +# CODE: php +#: ./docs/10.x/processes.md:197 +#: ./docs/11.x/processes.md:197 +#: ./docs/master/processes.md:197 msgid "$result = Process::pipe([\n" " 'cat example.txt',\n" " 'grep -i \"laravel\"',\n" -"]);\n" -msgstr "$result = Process::pipe([\n" -" 'cat example.txt',\n" -" 'grep -i \"laravel\"',\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/processes.md:block 63 (paragraph) +# P +#: ./docs/10.x/processes.md:204 +#: ./docs/11.x/processes.md:204 +#: ./docs/master/processes.md:204 msgid "The process output may be gathered in real-time by passing a closure as the second argument to the `pipe` method. The closure will receive two arguments: the \"type\" of output (`stdout` or `stderr`) and the output string itself:" -msgstr "可以在呼叫 `pipe` 方法時傳入一個 Closure 作為第二個引數來即時取得輸出。該 Closure 會收到兩個引數:輸出的「類型 (Type)」(`stdout` 或 `stderr`) 與輸出字串本身:" +msgstr "" -#: docs/10.x/processes.md:block 64 (code) +# CODE: php +#: ./docs/10.x/processes.md:206 +#: ./docs/11.x/processes.md:206 +#: ./docs/master/processes.md:206 msgid "$result = Process::pipe(function (Pipe $pipe) {\n" " $pipe->command('cat example.txt');\n" " $pipe->command('grep -i \"laravel\"');\n" "}, function (string $type, string $output) {\n" " echo $output;\n" -"});\n" -msgstr "$result = Process::pipe(function (Pipe $pipe) {\n" -" $pipe->command('cat example.txt');\n" -" $pipe->command('grep -i \"laravel\"');\n" -"}, function (string $type, string $output) {\n" -" echo $output;\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/processes.md:block 65 (paragraph) +# P +#: ./docs/10.x/processes.md:215 +#: ./docs/11.x/processes.md:215 +#: ./docs/master/processes.md:215 msgid "Laravel also allows you to assign string keys to each process within a pipeline via the `as` method. This key will also be passed to the output closure provided to the `pipe` method, allowing you to determine which process the output belongs to:" -msgstr "Laravel 可讓你使用 `as` 方法來為管道中的各個 Process 指派一個字串索引鍵。該索引鍵也會傳入提供給 `pipe` 方法的輸出 Closure,讓你能判斷輸出屬於哪個 Process:" +msgstr "" -#: docs/10.x/processes.md:block 66 (code) +# CODE: php +#: ./docs/10.x/processes.md:217 +#: ./docs/11.x/processes.md:217 +#: ./docs/master/processes.md:217 msgid "$result = Process::pipe(function (Pipe $pipe) {\n" " $pipe->as('first')->command('cat example.txt');\n" " $pipe->as('second')->command('grep -i \"laravel\"');\n" "})->start(function (string $type, string $output, string $key) {\n" " // ...\n" -"});\n" -msgstr "$result = Process::pipe(function (Pipe $pipe) {\n" -" $pipe->as('first')->command('cat example.txt');\n" -" $pipe->as('second')->command('grep -i \"laravel\"');\n" -"})->start(function (string $type, string $output, string $key) {\n" -" // ...\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/processes.md:block 68 (header) +# P +#: ./docs/10.x/processes.md:226 +#: ./docs/11.x/processes.md:226 +#: ./docs/master/processes.md:226 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/processes.md:227 +#: ./docs/11.x/processes.md:227 +#: ./docs/master/processes.md:227 msgid "Asynchronous Processes" -msgstr "非同步的 Process" +msgstr "" -#: docs/10.x/processes.md:block 69 (paragraph) +# P +#: ./docs/10.x/processes.md:229 +#: ./docs/11.x/processes.md:229 +#: ./docs/master/processes.md:229 msgid "While the `run` method invokes processes synchronously, the `start` method may be used to invoke a process asynchronously. This allows your application to continue performing other tasks while the process runs in the background. Once the process has been invoked, you may utilize the `running` method to determine if the process is still running:" -msgstr "`run` 方法會同步呼叫 Process,而 `start` 方法可用來非同步地呼叫 Process。這樣一來,你的程式就可以繼續執行其他任務,並讓 Process 在背景執行。Process 被呼叫後,可以使用 `running` 方法來判斷該 Process 是否還在執行:" +msgstr "" -#: docs/10.x/processes.md:block 70 (code) +# CODE: php +#: ./docs/10.x/processes.md:231 +#: ./docs/11.x/processes.md:231 +#: ./docs/master/processes.md:231 msgid "$process = Process::timeout(120)->start('bash import.sh');\n\n" "while ($process->running()) {\n" " // ...\n" "}\n\n" -"$result = $process->wait();\n" -msgstr "$process = Process::timeout(120)->start('bash import.sh');\n\n" -"while ($process->running()) {\n" -" // ...\n" -"}\n\n" -"$result = $process->wait();\n" +"$result = $process->wait();" +msgstr "" -#: docs/10.x/processes.md:block 71 (paragraph) +# P +#: ./docs/10.x/processes.md:241 +#: ./docs/11.x/processes.md:241 +#: ./docs/master/processes.md:241 msgid "As you may have noticed, you may invoke the `wait` method to wait until the process is finished executing and retrieve the process result instance:" -msgstr "讀者可能已經注意到,可以通過呼叫 `wait` 方法來等待 Process 完成執行,然後再取得 Process 的結果實體:" +msgstr "" -#: docs/10.x/processes.md:block 72 (code) +# CODE: php +#: ./docs/10.x/processes.md:243 +#: ./docs/11.x/processes.md:243 +#: ./docs/master/processes.md:243 msgid "$process = Process::timeout(120)->start('bash import.sh');\n\n" "// ...\n\n" -"$result = $process->wait();\n" -msgstr "$process = Process::timeout(120)->start('bash import.sh');\n\n" -"// ...\n\n" -"$result = $process->wait();\n" +"$result = $process->wait();" +msgstr "" -#: docs/10.x/processes.md:block 74 (header) -msgid "Process IDs & Signals" -msgstr "Process 的 ID 與 Signal" +# P +#: ./docs/10.x/processes.md:251 +#: ./docs/11.x/processes.md:251 +#: ./docs/master/processes.md:251 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:252 +#: ./docs/11.x/processes.md:252 +#: ./docs/master/processes.md:252 +msgid "Process IDs and Signals" +msgstr "" -#: docs/10.x/processes.md:block 75 (paragraph) +# P +#: ./docs/10.x/processes.md:254 +#: ./docs/11.x/processes.md:254 +#: ./docs/master/processes.md:254 msgid "The `id` method may be used to retrieve the operating system assigned process ID of the running process:" -msgstr "`id` 方法可用來取得正在執行的 Process 由作業系統指派的 Process ID:" +msgstr "" -#: docs/10.x/processes.md:block 76 (code) +# CODE: php +#: ./docs/10.x/processes.md:256 +#: ./docs/11.x/processes.md:256 +#: ./docs/master/processes.md:256 msgid "$process = Process::start('bash import.sh');\n\n" -"return $process->id();\n" -msgstr "$process = Process::start('bash import.sh');\n\n" -"return $process->id();\n" +"return $process->id();" +msgstr "" -#: docs/10.x/processes.md:block 77 (paragraph) +# P +#: ./docs/10.x/processes.md:262 +#: ./docs/11.x/processes.md:262 +#: ./docs/master/processes.md:262 msgid "You may use the `signal` method to send a \"signal\" to the running process. A list of predefined signal constants can be found within the [PHP documentation](https://www.php.net/manual/en/pcntl.constants.php):" -msgstr "可以使用 `signal` 方法來向正在執行的 Process 傳送「訊號 (Signal)」。請參考《[PHP 說明文件](https://www.php.net/manual/en/pcntl.constants.php)》以瞭解預先定義的 Signal 常數列表:" +msgstr "" -#: docs/10.x/processes.md:block 78 (code) -msgid "$process->signal(SIGUSR2);\n" -msgstr "$process->signal(SIGUSR2);\n" +# CODE: php +#: ./docs/10.x/processes.md:264 +#: ./docs/11.x/processes.md:264 +#: ./docs/master/processes.md:264 +msgid "$process->signal(SIGUSR2);" +msgstr "" -#: docs/10.x/processes.md:block 80 (header) +# P +#: ./docs/10.x/processes.md:268 +#: ./docs/11.x/processes.md:268 +#: ./docs/master/processes.md:268 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:269 +#: ./docs/11.x/processes.md:269 +#: ./docs/master/processes.md:269 msgid "Asynchronous Process Output" -msgstr "非同步 Process 的輸出" +msgstr "" -#: docs/10.x/processes.md:block 81 (paragraph) +# P +#: ./docs/10.x/processes.md:271 +#: ./docs/11.x/processes.md:271 +#: ./docs/master/processes.md:271 msgid "While an asynchronous process is running, you may access its entire current output using the `output` and `errorOutput` methods; however, you may utilize the `latestOutput` and `latestErrorOutput` to access the output from the process that has occurred since the output was last retrieved:" -msgstr "當非同步 Process 正在執行時,可以使用 `output` 與 `errorOutput` 方法來取得該 Process 目前的完整輸出。而 `latestOutput` 與 `latestErrorOutput` 可用來存取自從上一次取得輸出後該 Process 所產生的最新輸出:" +msgstr "" -#: docs/10.x/processes.md:block 82 (code) +# CODE: php +#: ./docs/10.x/processes.md:273 +#: ./docs/11.x/processes.md:273 +#: ./docs/master/processes.md:273 msgid "$process = Process::timeout(120)->start('bash import.sh');\n\n" "while ($process->running()) {\n" " echo $process->latestOutput();\n" " echo $process->latestErrorOutput();\n\n" " sleep(1);\n" -"}\n" -msgstr "$process = Process::timeout(120)->start('bash import.sh');\n\n" -"while ($process->running()) {\n" -" echo $process->latestOutput();\n" -" echo $process->latestErrorOutput();\n\n" -" sleep(1);\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/processes.md:block 83 (paragraph) +# P +#: ./docs/10.x/processes.md:284 +#: ./docs/11.x/processes.md:284 +#: ./docs/master/processes.md:284 msgid "Like the `run` method, output may also be gathered in real-time from asynchronous processes by passing a closure as the second argument to the `start` method. The closure will receive two arguments: the \"type\" of output (`stdout` or `stderr`) and the output string itself:" -msgstr "與 `run` 方法類似,`start` 方法也可以在呼叫時傳入一個 Closure 作為第二個引數來即時取得輸出。該 Closure 會收到兩個引數:輸出的「類型 (Type)」(`stdout` 或 `stderr`) 與輸出字串本身:" +msgstr "" -#: docs/10.x/processes.md:block 84 (code) +# CODE: php +#: ./docs/10.x/processes.md:286 +#: ./docs/11.x/processes.md:286 +#: ./docs/master/processes.md:286 msgid "$process = Process::start('bash import.sh', function (string $type, string $output) {\n" " echo $output;\n" "});\n\n" -"$result = $process->wait();\n" -msgstr "$process = Process::start('bash import.sh', function (string $type, string $output) {\n" -" echo $output;\n" -"});\n\n" -"$result = $process->wait();\n" +"$result = $process->wait();" +msgstr "" + +# P +#: ./docs/10.x/processes.md:294 +#: ./docs/11.x/processes.md:304 +#: ./docs/master/processes.md:294 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/processes.md:block 86 (header) +# P +#: ./docs/11.x/processes.md:294 +msgid "Instead of waiting until the process has finished, you may use the `waitUntil` method to stop waiting based on the output of the process. Laravel will stop waiting for the process to finish when the closure given to the `waitUntil` method returns `true`:" +msgstr "" + +# H2 +#: ./docs/10.x/processes.md:295 +#: ./docs/11.x/processes.md:305 +#: ./docs/master/processes.md:295 msgid "Concurrent Processes" -msgstr "併行的 Process" +msgstr "" -#: docs/10.x/processes.md:block 87 (paragraph) +# CODE: php +#: ./docs/11.x/processes.md:296 +msgid "$process = Process::start('bash import.sh');\n\n" +"$process->waitUntil(function (string $type, string $output) {\n" +" return $output === 'Ready...';\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/processes.md:297 +#: ./docs/11.x/processes.md:307 +#: ./docs/master/processes.md:297 msgid "Laravel also makes it a breeze to manage a pool of concurrent, asynchronous processes, allowing you to easily execute many tasks simultaneously. To get started, invoke the `pool` method, which accepts a closure that receives an instance of `Illuminate\\Process\\Pool`." -msgstr "Laravel 也讓管理平行的、非同步的 Process 集區 (Pool) 變的非常容易,讓你能輕鬆的同步執行多個任務。若要執行非同步 Process 集區,請執行 `pool` 方法。請傳入一個 Closure 給 `pool` 方法,該 Closure 會收到 `Illumiante\\Process\\Pool` 的實體。" +msgstr "" -#: docs/10.x/processes.md:block 88 (paragraph) +# P +#: ./docs/10.x/processes.md:299 +#: ./docs/11.x/processes.md:309 +#: ./docs/master/processes.md:299 msgid "Within this closure, you may define the processes that belong to the pool. Once a process pool is started via the `start` method, you may access the [collection](/docs/{{version}}/collections) of running processes via the `running` method:" -msgstr "在該 Closure 中,可以定義屬於該集區的 Process。使用 `start` 方法開始 Process 集區後,可以使用 `running` 方法來存取一組包含正在執行的 Process 的 [Collection](/docs/{{version}}/collections):" +msgstr "" -#: docs/10.x/processes.md:block 89 (code) +# CODE: php +#: ./docs/10.x/processes.md:301 +#: ./docs/11.x/processes.md:311 +#: ./docs/master/processes.md:301 msgid "use Illuminate\\Process\\Pool;\n" "use Illuminate\\Support\\Facades\\Process;\n\n" "$pool = Process::pool(function (Pool $pool) {\n" @@ -493,58 +836,68 @@ msgid "use Illuminate\\Process\\Pool;\n" "while ($pool->running()->isNotEmpty()) {\n" " // ...\n" "}\n\n" -"$results = $pool->wait();\n" -msgstr "use Illuminate\\Process\\Pool;\n" -"use Illuminate\\Support\\Facades\\Process;\n\n" -"$pool = Process::pool(function (Pool $pool) {\n" -" $pool->path(__DIR__)->command('bash import-1.sh');\n" -" $pool->path(__DIR__)->command('bash import-2.sh');\n" -" $pool->path(__DIR__)->command('bash import-3.sh');\n" -"})->start(function (string $type, string $output, int $key) {\n" -" // ...\n" -"});\n\n" -"while ($pool->running()->isNotEmpty()) {\n" -" // ...\n" -"}\n\n" -"$results = $pool->wait();\n" +"$results = $pool->wait();" +msgstr "" -#: docs/10.x/processes.md:block 90 (paragraph) +# P +#: ./docs/10.x/processes.md:320 +#: ./docs/11.x/processes.md:330 +#: ./docs/master/processes.md:320 msgid "As you can see, you may wait for all of the pool processes to finish executing and resolve their results via the `wait` method. The `wait` method returns an array accessible object that allows you to access the process result instance of each process in the pool by its key:" -msgstr "就像這樣,可以使用 `wait` 方法來等待集區 Process 完成執行並解析這些 Process 的執行結果。`wait` 方法會回傳一個可使用陣列存取的物件 (Array Accessible Object),讓你能使用其索引鍵來存取集區中各個 Process 的 Process 執行結果實體:" +msgstr "" -#: docs/10.x/processes.md:block 91 (code) +# CODE: php +#: ./docs/10.x/processes.md:322 +#: ./docs/11.x/processes.md:332 +#: ./docs/master/processes.md:322 msgid "$results = $pool->wait();\n\n" -"echo $results[0]->output();\n" -msgstr "$results = $pool->wait();\n\n" -"echo $results[0]->output();\n" +"echo $results[0]->output();" +msgstr "" -#: docs/10.x/processes.md:block 92 (paragraph) +# P +#: ./docs/10.x/processes.md:328 +#: ./docs/11.x/processes.md:338 +#: ./docs/master/processes.md:328 msgid "Or, for convenience, the `concurrently` method may be used to start an asynchronous process pool and immediately wait on its results. This can provide particularly expressive syntax when combined with PHP's array destructuring capabilities:" -msgstr "或者,也可以使用方便的 `concurrently` 方法來開始一組非同步 Process 集區,並馬上開始等待其執行結果。當與 PHP 的陣列解構功能搭配使用時,使用此方法就可取得富含表達性的語法:" +msgstr "" -#: docs/10.x/processes.md:block 93 (code) +# CODE: php +#: ./docs/10.x/processes.md:330 +#: ./docs/11.x/processes.md:340 +#: ./docs/master/processes.md:330 msgid "[$first, $second, $third] = Process::concurrently(function (Pool $pool) {\n" " $pool->path(__DIR__)->command('ls -la');\n" " $pool->path(app_path())->command('ls -la');\n" " $pool->path(storage_path())->command('ls -la');\n" "});\n\n" -"echo $first->output();\n" -msgstr "[$first, $second, $third] = Process::concurrently(function (Pool $pool) {\n" -" $pool->path(__DIR__)->command('ls -la');\n" -" $pool->path(app_path())->command('ls -la');\n" -" $pool->path(storage_path())->command('ls -la');\n" -"});\n\n" -"echo $first->output();\n" +"echo $first->output();" +msgstr "" -#: docs/10.x/processes.md:block 95 (header) +# P +#: ./docs/10.x/processes.md:340 +#: ./docs/11.x/processes.md:350 +#: ./docs/master/processes.md:340 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:341 +#: ./docs/11.x/processes.md:351 +#: ./docs/master/processes.md:341 msgid "Naming Pool Processes" -msgstr "命名的 Pool Process" +msgstr "" -#: docs/10.x/processes.md:block 96 (paragraph) +# P +#: ./docs/10.x/processes.md:343 +#: ./docs/11.x/processes.md:353 +#: ./docs/master/processes.md:343 msgid "Accessing process pool results via a numeric key is not very expressive; therefore, Laravel allows you to assign string keys to each process within a pool via the `as` method. This key will also be passed to the closure provided to the `start` method, allowing you to determine which process the output belongs to:" -msgstr "使用數字索引鍵來存取 Process 集區並不是很有表達性。因此,Laravel 可讓你使用 `as` 方法來為集區中的各個 Process 指派一個字串索引鍵。該索引鍵也會傳入提供給 `start` 方法的 Closure,讓你能判斷輸出屬於哪個 Process:" +msgstr "" -#: docs/10.x/processes.md:block 97 (code) +# CODE: php +#: ./docs/10.x/processes.md:345 +#: ./docs/11.x/processes.md:355 +#: ./docs/master/processes.md:345 msgid "$pool = Process::pool(function (Pool $pool) {\n" " $pool->as('first')->command('bash import-1.sh');\n" " $pool->as('second')->command('bash import-2.sh');\n" @@ -553,72 +906,117 @@ msgid "$pool = Process::pool(function (Pool $pool) {\n" " // ...\n" "});\n\n" "$results = $pool->wait();\n\n" -"return $results['first']->output();\n" -msgstr "$pool = Process::pool(function (Pool $pool) {\n" -" $pool->as('first')->command('bash import-1.sh');\n" -" $pool->as('second')->command('bash import-2.sh');\n" -" $pool->as('third')->command('bash import-3.sh');\n" -"})->start(function (string $type, string $output, string $key) {\n" -" // ...\n" -"});\n\n" -"$results = $pool->wait();\n\n" -"return $results['first']->output();\n" +"return $results['first']->output();" +msgstr "" -#: docs/10.x/processes.md:block 99 (header) -msgid "Pool Process IDs & Signals" -msgstr "Pool Process 的 ID 與 Signal" +# P +#: ./docs/10.x/processes.md:359 +#: ./docs/11.x/processes.md:369 +#: ./docs/master/processes.md:359 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:360 +#: ./docs/11.x/processes.md:370 +#: ./docs/master/processes.md:360 +msgid "Pool Process IDs and Signals" +msgstr "" -#: docs/10.x/processes.md:block 100 (paragraph) +# P +#: ./docs/10.x/processes.md:362 +#: ./docs/11.x/processes.md:372 +#: ./docs/master/processes.md:362 msgid "Since the process pool's `running` method provides a collection of all invoked processes within the pool, you may easily access the underlying pool process IDs:" -msgstr "由於 Process 集區的 `running` 方法提供了一組包含集區中所有已呼叫 Process 的 Collection,因此你可以輕鬆地存取集區中相應的 Process ID:" +msgstr "" -#: docs/10.x/processes.md:block 101 (code) -msgid "$processIds = $pool->running()->each->id();\n" -msgstr "$processIds = $pool->running()->each->id();\n" +# CODE: php +#: ./docs/10.x/processes.md:364 +#: ./docs/11.x/processes.md:374 +#: ./docs/master/processes.md:364 +msgid "$processIds = $pool->running()->each->id();" +msgstr "" -#: docs/10.x/processes.md:block 102 (paragraph) +# P +#: ./docs/10.x/processes.md:368 +#: ./docs/11.x/processes.md:378 +#: ./docs/master/processes.md:368 msgid "And, for convenience, you may invoke the `signal` method on a process pool to send a signal to every process within the pool:" -msgstr "而且,也可以在 Process 集區上使用 `signal` 方法來方便地傳送 Signal 給集區中的每一個 Process:" +msgstr "" -#: docs/10.x/processes.md:block 103 (code) -msgid "$pool->signal(SIGUSR2);\n" -msgstr "$pool->signal(SIGUSR2);\n" +# CODE: php +#: ./docs/10.x/processes.md:370 +#: ./docs/11.x/processes.md:380 +#: ./docs/master/processes.md:370 +msgid "$pool->signal(SIGUSR2);" +msgstr "" -#: docs/10.x/processes.md:block 105 (header) +# P +#: ./docs/10.x/processes.md:374 +#: ./docs/11.x/processes.md:384 +#: ./docs/master/processes.md:374 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/processes.md:375 +#: ./docs/11.x/processes.md:385 +#: ./docs/master/processes.md:375 msgid "Testing" -msgstr "測試" +msgstr "" -#: docs/10.x/processes.md:block 106 (paragraph) +# P +#: ./docs/10.x/processes.md:377 +#: ./docs/11.x/processes.md:387 +#: ./docs/master/processes.md:377 msgid "Many Laravel services provide functionality to help you easily and expressively write tests, and Laravel's process service is no exception. The `Process` facade's `fake` method allows you to instruct Laravel to return stubbed / dummy results when processes are invoked." -msgstr "許多 Laravel 的服務都提供了能讓你輕鬆且表達性地撰寫測試的方法,而 Laravel 的 Process 服務也不例外。使用 `Process` Facade 的 `fake` 方法,能讓你指定要 Laravel 在執行 Process 時回傳一組模擬的執行結果。" +msgstr "" -#: docs/10.x/processes.md:block 108 (header) +# P +#: ./docs/10.x/processes.md:379 +#: ./docs/11.x/processes.md:389 +#: ./docs/master/processes.md:379 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:380 +#: ./docs/11.x/processes.md:390 +#: ./docs/master/processes.md:380 msgid "Faking Processes" -msgstr "模擬 Process" +msgstr "" -#: docs/10.x/processes.md:block 109 (paragraph) +# P +#: ./docs/10.x/processes.md:382 +#: ./docs/11.x/processes.md:392 +#: ./docs/master/processes.md:382 msgid "To explore Laravel's ability to fake processes, let's imagine a route that invokes a process:" -msgstr "若要瞭解 Laravel 中模擬 Process 的功能,我們先來想像有個 Route 會呼叫一個 Process:" +msgstr "" -#: docs/10.x/processes.md:block 110 (code) +# CODE: php +#: ./docs/10.x/processes.md:384 +#: ./docs/11.x/processes.md:394 +#: ./docs/master/processes.md:384 msgid "use Illuminate\\Support\\Facades\\Process;\n" "use Illuminate\\Support\\Facades\\Route;\n\n" "Route::get('/import', function () {\n" " Process::run('bash import.sh');\n\n" " return 'Import complete!';\n" -"});\n" -msgstr "use Illuminate\\Support\\Facades\\Process;\n" -"use Illuminate\\Support\\Facades\\Route;\n\n" -"Route::get('/import', function () {\n" -" Process::run('bash import.sh');\n\n" -" return 'Import complete!';\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/processes.md:block 111 (paragraph) +# P +#: ./docs/10.x/processes.md:395 +#: ./docs/11.x/processes.md:405 +#: ./docs/master/processes.md:395 msgid "When testing this route, we can instruct Laravel to return a fake, successful process result for every invoked process by calling the `fake` method on the `Process` facade with no arguments. In addition, we can even [assert](#available-assertions) that a given process was \"run\":" -msgstr "在測試此 Route 時,我們可以不帶任何引數呼叫 `Process` Facade 上的 `fake` 方法,讓 Laravel 在每一個被呼叫的 Process 上回傳一組模擬的成功 Process 執行結果。此外,我們還可以 [Assert](#available-assertions) 判斷給定的 Process 是否已執行:" +msgstr "" -#: docs/10.x/processes.md:block 112 (code) +# CODE: php +# CODE: php tab=PHPUnit +#: ./docs/10.x/processes.md:397 +#: ./docs/11.x/processes.md:430 +#: ./docs/master/processes.md:420 msgid "get('/');\n\n" +" $response = $this->get('/import');\n\n" " // Simple process assertion...\n" " Process::assertRan('bash import.sh');\n\n" " // Or, inspecting the process configuration...\n" @@ -639,62 +1037,81 @@ msgid "timeout === 60;\n" " });\n" " }\n" -"}\n" -msgstr "get('/');\n\n" -" // 簡單的 Process Assertion...\n" -" Process::assertRan('bash import.sh');\n\n" -" // 或者,也可以檢查 Process 的設定...\n" -" Process::assertRan(function (PendingProcess $process, ProcessResult $result) {\n" -" return $process->command === 'bash import.sh' &&\n" -" $process->timeout === 60;\n" -" });\n" -" }\n" -"}\n" +"use Illuminate\\Support\\Facades\\Process;\n\n" +"test('process is invoked', function () {\n" +" Process::fake();\n\n" +" $response = $this->get('/import');\n\n" +" // Simple process assertion...\n" +" Process::assertRan('bash import.sh');\n\n" +" // Or, inspecting the process configuration...\n" +" Process::assertRan(function (PendingProcess $process, ProcessResult $result) {\n" +" return $process->command === 'bash import.sh' &&\n" +" $process->timeout === 60;\n" +" });\n" +"});" +msgstr "" -#: docs/10.x/processes.md:block 113 (paragraph) +# P +#: ./docs/10.x/processes.md:427 +#: ./docs/11.x/processes.md:460 +#: ./docs/master/processes.md:450 msgid "As discussed, invoking the `fake` method on the `Process` facade will instruct Laravel to always return a successful process result with no output. However, you may easily specify the output and exit code for faked processes using the `Process` facade's `result` method:" -msgstr "剛才也提到過,在 `Process` Facade 上呼叫 `fake` 方法會讓 Laravel 為每個 Process 回傳沒有輸出的 Process 執行結果。不過,你可以使用 `Process` Facade 的 `result` 方法來輕鬆地指定模擬 Process 的輸出與結束代碼 (Exit Code):" +msgstr "" -#: docs/10.x/processes.md:block 114 (code) +# CODE: php +#: ./docs/10.x/processes.md:429 +#: ./docs/11.x/processes.md:462 +#: ./docs/master/processes.md:452 msgid "Process::fake([\n" " '*' => Process::result(\n" " output: 'Test output',\n" " errorOutput: 'Test error output',\n" " exitCode: 1,\n" " ),\n" -"]);\n" -msgstr "Process::fake([\n" -" '*' => Process::result(\n" -" output: 'Test output',\n" -" errorOutput: 'Test error output',\n" -" exitCode: 1,\n" -" ),\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/processes.md:block 116 (header) +# P +#: ./docs/10.x/processes.md:439 +#: ./docs/11.x/processes.md:472 +#: ./docs/master/processes.md:462 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:440 +#: ./docs/11.x/processes.md:473 +#: ./docs/master/processes.md:463 msgid "Faking Specific Processes" -msgstr "模擬特定的 Process" +msgstr "" -#: docs/10.x/processes.md:block 117 (paragraph) +# P +#: ./docs/10.x/processes.md:442 +#: ./docs/11.x/processes.md:475 +#: ./docs/master/processes.md:465 msgid "As you may have noticed in a previous example, the `Process` facade allows you to specify different fake results per process by passing an array to the `fake` method." -msgstr "讀者可能已經在前一個例子中注意到,通過 `Process` Facade,就可以通過傳入一組陣列給 `fake` 方法來指定各個 Process 的模擬執行結果。" +msgstr "" -#: docs/10.x/processes.md:block 118 (paragraph) +# P +#: ./docs/10.x/processes.md:444 +#: ./docs/11.x/processes.md:477 +#: ./docs/master/processes.md:467 msgid "The array's keys should represent command patterns that you wish to fake and their associated results. The `*` character may be used as a wildcard character. Any process commands that have not been faked will actually be invoked. You may use the `Process` facade's `result` method to construct stub / fake results for these commands:" -msgstr "陣列的索引鍵代表要模擬的指令格式,以及其相應的執行結果。可使用 `*` 字元來作為萬用字元。沒有被模擬的 Process 指令會被實際執行。可以使用 `Process` Facade 的 `result` 方法來為這些指令建立模擬的執行結果:" +msgstr "" -#: docs/10.x/processes.md:block 119 (code) +# CODE: php +#: ./docs/10.x/processes.md:446 +#: ./docs/11.x/processes.md:479 +#: ./docs/master/processes.md:469 msgid "Process::fake([\n" " 'cat *' => Process::result(\n" " output: 'Test \"cat\" output',\n" @@ -702,63 +1119,90 @@ msgid "Process::fake([\n" " 'ls *' => Process::result(\n" " output: 'Test \"ls\" output',\n" " ),\n" -"]);\n" -msgstr "Process::fake([\n" -" 'cat *' => Process::result(\n" -" output: 'Test \"cat\" output',\n" -" ),\n" -" 'ls *' => Process::result(\n" -" output: 'Test \"ls\" output',\n" -" ),\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/processes.md:block 120 (paragraph) +# P +#: ./docs/10.x/processes.md:457 +#: ./docs/11.x/processes.md:490 +#: ./docs/master/processes.md:480 msgid "If you do not need to customize the exit code or error output of a faked process, you may find it more convenient to specify the fake process results as simple strings:" -msgstr "若不需要自定模擬 Process 的終止代碼或錯誤輸出,那麼使用字串來指定 Process 的模擬結果可能會更方便:" +msgstr "" -#: docs/10.x/processes.md:block 121 (code) +# CODE: php +#: ./docs/10.x/processes.md:459 +#: ./docs/11.x/processes.md:492 +#: ./docs/master/processes.md:482 msgid "Process::fake([\n" " 'cat *' => 'Test \"cat\" output',\n" " 'ls *' => 'Test \"ls\" output',\n" -"]);\n" -msgstr "Process::fake([\n" -" 'cat *' => 'Test \"cat\" output',\n" -" 'ls *' => 'Test \"ls\" output',\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/processes.md:block 123 (header) +# P +#: ./docs/10.x/processes.md:466 +#: ./docs/11.x/processes.md:499 +#: ./docs/master/processes.md:489 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:467 +#: ./docs/11.x/processes.md:500 +#: ./docs/master/processes.md:490 msgid "Faking Process Sequences" -msgstr "模擬 Process 序列" +msgstr "" -#: docs/10.x/processes.md:block 124 (paragraph) +# P +#: ./docs/10.x/processes.md:469 +#: ./docs/11.x/processes.md:502 +#: ./docs/master/processes.md:492 msgid "If the code you are testing invokes multiple processes with the same command, you may wish to assign a different fake process result to each process invocation. You may accomplish this via the `Process` facade's `sequence` method:" -msgstr "若要測試的程式碼會以相同指令來呼叫多個 Process,則可為各個 Process 呼叫指定不同的 Process 模擬執行結果。若要為各個 Process 呼叫設定各自的執行結果,請使用 `Process` Facade 的 `sequence` 方法:" +msgstr "" -#: docs/10.x/processes.md:block 125 (code) +# CODE: php +#: ./docs/10.x/processes.md:471 +#: ./docs/11.x/processes.md:504 +#: ./docs/master/processes.md:494 msgid "Process::fake([\n" " 'ls *' => Process::sequence()\n" " ->push(Process::result('First invocation'))\n" " ->push(Process::result('Second invocation')),\n" -"]);\n" -msgstr "Process::fake([\n" -" 'ls *' => Process::sequence()\n" -" ->push(Process::result('First invocation'))\n" -" ->push(Process::result('Second invocation')),\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/processes.md:block 127 (header) +# P +#: ./docs/10.x/processes.md:479 +#: ./docs/11.x/processes.md:512 +#: ./docs/master/processes.md:502 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:480 +#: ./docs/11.x/processes.md:513 +#: ./docs/master/processes.md:503 msgid "Faking Asynchronous Process Lifecycles" -msgstr "模擬非同步 Process 的生命週期" +msgstr "" -#: docs/10.x/processes.md:block 128 (paragraph) +# P +#: ./docs/10.x/processes.md:482 +#: ./docs/11.x/processes.md:515 +#: ./docs/master/processes.md:505 msgid "Thus far, we have primarily discussed faking processes which are invoked synchronously using the `run` method. However, if you are attempting to test code that interacts with asynchronous processes invoked via `start`, you may need a more sophisticated approach to describing your fake processes." -msgstr "到目前為止,我們主要針對使用 `run` 方法同步呼叫的 Process 討論要如何進行模擬。不過,若要測試的程式碼中有使用 `start` 來非同步呼叫 Process,就需要使用更複雜的方法來模擬 Process。" +msgstr "" -#: docs/10.x/processes.md:block 129 (paragraph) +# P +#: ./docs/10.x/processes.md:484 +#: ./docs/11.x/processes.md:517 +#: ./docs/master/processes.md:507 msgid "For example, let's imagine the following route which interacts with an asynchronous process:" -msgstr "舉例來說,假設有下列 Route 會觸發非同步 Process:" +msgstr "" -#: docs/10.x/processes.md:block 130 (code) +# CODE: php +#: ./docs/10.x/processes.md:486 +#: ./docs/11.x/processes.md:519 +#: ./docs/master/processes.md:509 msgid "use Illuminate\\Support\\Facades\\Log;\n" "use Illuminate\\Support\\Facades\\Route;\n\n" "Route::get('/import', function () {\n" @@ -768,23 +1212,20 @@ msgid "use Illuminate\\Support\\Facades\\Log;\n" " Log::info($process->latestErrorOutput());\n" " }\n\n" " return 'Done';\n" -"});\n" -msgstr "use Illuminate\\Support\\Facades\\Log;\n" -"use Illuminate\\Support\\Facades\\Route;\n\n" -"Route::get('/import', function () {\n" -" $process = Process::start('bash import.sh');\n\n" -" while ($process->running()) {\n" -" Log::info($process->latestOutput());\n" -" Log::info($process->latestErrorOutput());\n" -" }\n\n" -" return 'Done';\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/processes.md:block 131 (paragraph) +# P +#: ./docs/10.x/processes.md:502 +#: ./docs/11.x/processes.md:535 +#: ./docs/master/processes.md:525 msgid "To properly fake this process, we need to be able to describe how many times the `running` method should return `true`. In addition, we may want to specify multiple lines of output that should be returned in sequence. To accomplish this, we can use the `Process` facade's `describe` method:" -msgstr "若要正確模擬此 Process,我們需要能夠描述 `running` 方法要回傳幾次 `true`。此外,我們可能還需要指定要依序回傳的多行輸出。為此,我們可以使用 `Process` Facade 的 `describe` 方法:" +msgstr "" -#: docs/10.x/processes.md:block 132 (code) +# CODE: php +#: ./docs/10.x/processes.md:504 +#: ./docs/11.x/processes.md:537 +#: ./docs/master/processes.md:527 msgid "Process::fake([\n" " 'bash import.sh' => Process::describe()\n" " ->output('First line of standard output')\n" @@ -792,123 +1233,206 @@ msgid "Process::fake([\n" " ->output('Second line of standard output')\n" " ->exitCode(0)\n" " ->iterations(3),\n" -"]);\n" -msgstr "Process::fake([\n" -" 'bash import.sh' => Process::describe()\n" -" ->output('First line of standard output')\n" -" ->errorOutput('First line of error output')\n" -" ->output('Second line of standard output')\n" -" ->exitCode(0)\n" -" ->iterations(3),\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/processes.md:block 133 (paragraph) +# P +#: ./docs/10.x/processes.md:515 +#: ./docs/11.x/processes.md:548 +#: ./docs/master/processes.md:538 msgid "Let's dig into the example above. Using the `output` and `errorOutput` methods, we may specify multiple lines of output that will be returned in sequence. The `exitCode` method may be used to specify the final exit code of the fake process. Finally, the `iterations` method may be used to specify how many times the `running` method should return `true`." -msgstr "讓我們來仔細看看上面的範例。使用 `output` 與 `errorOutput` 方法,我們可以指定要依序回傳的多行輸出。`exitCode` 方法可用來指定模擬 Process 最終的終止代碼。最後,`iterations` 方法可用來指定 `running` 方法要回傳幾次 `true`。" +msgstr "" -#: docs/10.x/processes.md:block 135 (header) +# P +#: ./docs/10.x/processes.md:517 +#: ./docs/11.x/processes.md:550 +#: ./docs/master/processes.md:540 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:518 +#: ./docs/11.x/processes.md:551 +#: ./docs/master/processes.md:541 msgid "Available Assertions" -msgstr "可用的 Assertion" +msgstr "" -#: docs/10.x/processes.md:block 136 (paragraph) +# P +#: ./docs/10.x/processes.md:520 +#: ./docs/11.x/processes.md:553 +#: ./docs/master/processes.md:543 msgid "As [previously discussed](#faking-processes), Laravel provides several process assertions for your feature tests. We'll discuss each of these assertions below." -msgstr "就像[剛才提到過的](#faking-processes),Laravel 為功能測試 (Feature Test) 提供了多個 Process 的 ^[Assertion](判斷提示)。我們會在接下來的部分討論這些 Assertion。" +msgstr "" -#: docs/10.x/processes.md:block 138 (header) +# P +#: ./docs/10.x/processes.md:522 +#: ./docs/11.x/processes.md:555 +#: ./docs/master/processes.md:545 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/processes.md:523 +#: ./docs/11.x/processes.md:556 +#: ./docs/master/processes.md:546 msgid "assertRan" -msgstr "assertRan" +msgstr "" -#: docs/10.x/processes.md:block 139 (paragraph) +# P +#: ./docs/10.x/processes.md:525 +#: ./docs/11.x/processes.md:558 +#: ./docs/master/processes.md:548 msgid "Assert that a given process was invoked:" -msgstr "判斷給定 Process 是否已被呼叫:" +msgstr "" -#: docs/10.x/processes.md:block 140 (code) +# CODE: php +#: ./docs/10.x/processes.md:527 +#: ./docs/11.x/processes.md:560 +#: ./docs/master/processes.md:550 msgid "use Illuminate\\Support\\Facades\\Process;\n\n" -"Process::assertRan('ls -la');\n" -msgstr "use Illuminate\\Support\\Facades\\Process;\n\n" -"Process::assertRan('ls -la');\n" +"Process::assertRan('ls -la');" +msgstr "" -#: docs/10.x/processes.md:block 141 (paragraph) +# P +#: ./docs/10.x/processes.md:533 +#: ./docs/11.x/processes.md:566 +#: ./docs/master/processes.md:556 msgid "The `assertRan` method also accepts a closure, which will receive an instance of a process and a process result, allowing you to inspect the process' configured options. If this closure returns `true`, the assertion will \"pass\":" -msgstr "也可傳入一個 Closure 給 `assertRun` 方法。該 Closure 會收到 Process 的實體與 Process 的執行結果,讓你能檢查 Process 上的設定。若讓該 Closure 回傳 `true`,則該 Assertion 就會通過 (Pass):" +msgstr "" -#: docs/10.x/processes.md:block 142 (code) +# CODE: php +#: ./docs/10.x/processes.md:535 +#: ./docs/11.x/processes.md:568 +#: ./docs/master/processes.md:558 msgid "Process::assertRan(fn ($process, $result) =>\n" " $process->command === 'ls -la' &&\n" " $process->path === __DIR__ &&\n" " $process->timeout === 60\n" -");\n" -msgstr "Process::assertRan(fn ($process, $result) =>\n" -" $process->command === 'ls -la' &&\n" -" $process->path === __DIR__ &&\n" -" $process->timeout === 60\n" -");\n" +");" +msgstr "" -#: docs/10.x/processes.md:block 143 (paragraph) +# P +#: ./docs/10.x/processes.md:543 +#: ./docs/11.x/processes.md:576 +#: ./docs/master/processes.md:566 msgid "The `$process` passed to the `assertRan` closure is an instance of `Illuminate\\Process\\PendingProcess`, while the `$result` is an instance of `Illuminate\\Contracts\\Process\\ProcessResult`." -msgstr "傳給 `assertRun` Closure 的 `$process` 是 `Illuminate\\Process\\PendingProcess` 的實體,而 `$result` 是 `Illuminate\\Contracts\\Process\\ProcessResult` 的實體。" +msgstr "" -#: docs/10.x/processes.md:block 145 (header) +# P +#: ./docs/10.x/processes.md:545 +#: ./docs/11.x/processes.md:578 +#: ./docs/master/processes.md:568 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/processes.md:546 +#: ./docs/11.x/processes.md:579 +#: ./docs/master/processes.md:569 msgid "assertDidntRun" -msgstr "assertDidntRun" +msgstr "" -#: docs/10.x/processes.md:block 146 (paragraph) +# P +#: ./docs/10.x/processes.md:548 +#: ./docs/11.x/processes.md:581 +#: ./docs/master/processes.md:571 msgid "Assert that a given process was not invoked:" -msgstr "判斷給定 Process 是否未被呼叫:" +msgstr "" -#: docs/10.x/processes.md:block 147 (code) +# CODE: php +#: ./docs/10.x/processes.md:550 +#: ./docs/11.x/processes.md:583 +#: ./docs/master/processes.md:573 msgid "use Illuminate\\Support\\Facades\\Process;\n\n" -"Process::assertDidntRun('ls -la');\n" -msgstr "use Illuminate\\Support\\Facades\\Process;\n\n" -"Process::assertDidntRun('ls -la');\n" +"Process::assertDidntRun('ls -la');" +msgstr "" -#: docs/10.x/processes.md:block 148 (paragraph) +# P +#: ./docs/10.x/processes.md:556 +#: ./docs/11.x/processes.md:589 +#: ./docs/master/processes.md:579 msgid "Like the `assertRan` method, the `assertDidntRun` method also accepts a closure, which will receive an instance of a process and a process result, allowing you to inspect the process' configured options. If this closure returns `true`, the assertion will \"fail\":" -msgstr "與 `assertRun` 方法類似,`assertDidntRun` 方法也可被傳入一個 Closure。傳給 `assertDidntRun` 的 Closure 會收到 Process 實體與 Process 的執行結果,讓你能檢查 Process 上的設定。若該 Closure 回傳 `true`,則該 Assertion 就會失敗 (Fail):" +msgstr "" -#: docs/10.x/processes.md:block 149 (code) +# CODE: php +#: ./docs/10.x/processes.md:558 +#: ./docs/11.x/processes.md:591 +#: ./docs/master/processes.md:581 msgid "Process::assertDidntRun(fn (PendingProcess $process, ProcessResult $result) =>\n" " $process->command === 'ls -la'\n" -");\n" -msgstr "Process::assertDidntRun(fn (PendingProcess $process, ProcessResult $result) =>\n" -" $process->command === 'ls -la'\n" -");\n" +");" +msgstr "" -#: docs/10.x/processes.md:block 151 (header) +# P +#: ./docs/10.x/processes.md:564 +#: ./docs/11.x/processes.md:597 +#: ./docs/master/processes.md:587 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/processes.md:565 +#: ./docs/11.x/processes.md:598 +#: ./docs/master/processes.md:588 msgid "assertRanTimes" -msgstr "assertRanTimes" +msgstr "" -#: docs/10.x/processes.md:block 152 (paragraph) +# P +#: ./docs/10.x/processes.md:567 +#: ./docs/11.x/processes.md:600 +#: ./docs/master/processes.md:590 msgid "Assert that a given process was invoked a given number of times:" -msgstr "判斷給定 Process 是否被呼叫了給定次數:" +msgstr "" -#: docs/10.x/processes.md:block 153 (code) +# CODE: php +#: ./docs/10.x/processes.md:569 +#: ./docs/11.x/processes.md:602 +#: ./docs/master/processes.md:592 msgid "use Illuminate\\Support\\Facades\\Process;\n\n" -"Process::assertRanTimes('ls -la', times: 3);\n" -msgstr "use Illuminate\\Support\\Facades\\Process;\n\n" -"Process::assertRanTimes('ls -la', times: 3);\n" +"Process::assertRanTimes('ls -la', times: 3);" +msgstr "" -#: docs/10.x/processes.md:block 154 (paragraph) +# P +#: ./docs/10.x/processes.md:575 +#: ./docs/11.x/processes.md:608 +#: ./docs/master/processes.md:598 msgid "The `assertRanTimes` method also accepts a closure, which will receive an instance of a process and a process result, allowing you to inspect the process' configured options. If this closure returns `true` and the process was invoked the specified number of times, the assertion will \"pass\":" -msgstr "也可傳入一個 Closure 給 `assertRanTimes` 方法。該 Closure 會收到 Process 的實體與 Process 的執行結果,讓你能檢查 Process 上的設定。若讓該 Closure 回傳 `true`,且該 Process 被呼叫了給定的次數,則該 Assertion 就會通過 (Pass):" +msgstr "" -#: docs/10.x/processes.md:block 155 (code) +# CODE: php +#: ./docs/10.x/processes.md:577 +#: ./docs/11.x/processes.md:610 +#: ./docs/master/processes.md:600 msgid "Process::assertRanTimes(function (PendingProcess $process, ProcessResult $result) {\n" " return $process->command === 'ls -la';\n" -"}, times: 3);\n" -msgstr "Process::assertRanTimes(function (PendingProcess $process, ProcessResult $result) {\n" -" return $process->command === 'ls -la';\n" -"}, times: 3);\n" +"}, times: 3);" +msgstr "" -#: docs/10.x/processes.md:block 157 (header) +# P +#: ./docs/10.x/processes.md:583 +#: ./docs/11.x/processes.md:616 +#: ./docs/master/processes.md:606 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/processes.md:584 +#: ./docs/11.x/processes.md:617 +#: ./docs/master/processes.md:607 msgid "Preventing Stray Processes" -msgstr "避免漏掉的 Process" +msgstr "" -#: docs/10.x/processes.md:block 158 (paragraph) +# P +#: ./docs/10.x/processes.md:586 +#: ./docs/11.x/processes.md:619 +#: ./docs/master/processes.md:609 msgid "If you would like to ensure that all invoked processes have been faked throughout your individual test or complete test suite, you can call the `preventStrayProcesses` method. After calling this method, any processes that do not have a corresponding fake result will throw an exception rather than starting an actual process:" -msgstr "若想在個別測試或整個測試套件中,確保所有呼叫的 Process 都被模擬,則可呼叫 `preventStrayProcesses` 方法。呼叫該方法後,若某個 Process 沒有相對應的模擬結果,該 Process 就不會被執行,而會擲回一個 Exception:" +msgstr "" -#: docs/10.x/processes.md:block 159 (code) +# CODE +#: ./docs/10.x/processes.md:588 +#: ./docs/11.x/processes.md:621 +#: ./docs/master/processes.md:611 msgid "use Illuminate\\Support\\Facades\\Process;\n\n" "Process::preventStrayProcesses();\n\n" "Process::fake([\n" @@ -917,32 +1441,6 @@ msgid "use Illuminate\\Support\\Facades\\Process;\n\n" "// Fake response is returned...\n" "Process::run('ls -la');\n\n" "// An exception is thrown...\n" -"Process::run('bash import.sh');\n" -msgstr "use Illuminate\\Support\\Facades\\Process;\n\n" -"Process::preventStrayProcesses();\n\n" -"Process::fake([\n" -" 'ls *' => 'Test output...',\n" -"]);\n\n" -"// 回傳模擬的輸出...\n" -"Process::run('ls -la');\n\n" -"// 擲回 Exception...\n" -"Process::run('bash import.sh');\n" - -#: docs/master/processes.md:block 61 (paragraph) -msgid "The `pid` method may be used to retrieve the operating system assigned process ID of the running process:" -msgstr "`pid` 方法可用來取得正在執行的 Process 由作業系統指派的 Process ID:" - -#: docs/master/processes.md:block 62 (code) -msgid "$process = Process::start('bash import.sh');\n\n" -"return $process->pid();\n" -msgstr "$process = Process::start('bash import.sh');\n\n" -"return $process->pid();\n" - -#: docs/master/processes.md:block 87 (code) -msgid "$processIds = $pool->running()->each->pid();\n" -msgstr "$processIds = $pool->running()->each->pid();\n" - -#: docs/master/processes.md:block 97 (paragraph) -msgid "When testing this route, we can instruct Laravel to return a fake, successful process result for every invoked process by calling the `fake` method on the `Process` facade with no arguments. In addition, we can even [assert](#available-assertions) that a given process was \"ran\":" -msgstr "在測試此 Route 時,我們可以不帶任何引數呼叫 `Process` Facade 上的 `fake` 方法,讓 Laravel 在每一個被呼叫的 Process 上回傳一組模擬的成功 Process 執行結果。此外,我們還可以 [Assert](#available-assertions) 判斷給定的 Process 是否已執行:" +"Process::run('bash import.sh');" +msgstr "" diff --git a/po/zh_TW/prompts.po b/po/zh_TW/prompts.po index 157dabd49..484e3f83b 100644 --- a/po/zh_TW/prompts.po +++ b/po/zh_TW/prompts.po @@ -10,177 +10,412 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:27\n" +"PO-Revision-Date: 2024-11-30 08:39\n" -#: docs/10.x/prompts.md:block 1 (header) +# H1 +#: ./docs/10.x/prompts.md:1 +#: ./docs/11.x/prompts.md:1 +#: ./docs/master/prompts.md:1 msgid "Prompts" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:3 +#: ./docs/11.x/prompts.md:3 +#: ./docs/master/prompts.md:3 msgid "[Introduction](#introduction)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:4 +#: ./docs/11.x/prompts.md:4 +#: ./docs/master/prompts.md:4 msgid "[Installation](#installation)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:5 +#: ./docs/11.x/prompts.md:5 +#: ./docs/master/prompts.md:5 msgid "[Available Prompts](#available-prompts)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:6 +#: ./docs/11.x/prompts.md:6 +#: ./docs/master/prompts.md:6 msgid "[Text](#text)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:7 +#: ./docs/11.x/prompts.md:8 +#: ./docs/master/prompts.md:7 msgid "[Password](#password)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/11.x/prompts.md:7 +msgid "[Textarea](#textarea)" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:8 +#: ./docs/11.x/prompts.md:9 +#: ./docs/master/prompts.md:8 msgid "[Confirm](#confirm)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:9 +#: ./docs/11.x/prompts.md:10 +#: ./docs/master/prompts.md:9 msgid "[Select](#select)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:10 +#: ./docs/11.x/prompts.md:11 +#: ./docs/master/prompts.md:10 msgid "[Multi-select](#multiselect)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:11 +#: ./docs/11.x/prompts.md:12 +#: ./docs/master/prompts.md:11 msgid "[Suggest](#suggest)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:12 +#: ./docs/11.x/prompts.md:13 +#: ./docs/master/prompts.md:12 msgid "[Search](#search)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:13 +#: ./docs/11.x/prompts.md:14 +#: ./docs/master/prompts.md:13 msgid "[Multi-search](#multisearch)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:14 +#: ./docs/11.x/prompts.md:15 +#: ./docs/master/prompts.md:14 +msgid "[Pause](#pause)" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:15 +#: ./docs/11.x/prompts.md:18 +#: ./docs/master/prompts.md:15 msgid "[Informational Messages](#informational-messages)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:16 +#: ./docs/11.x/prompts.md:19 +#: ./docs/master/prompts.md:16 msgid "[Tables](#tables)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/11.x/prompts.md:16 +msgid "[Transforming Input Before Validation](#transforming-input-before-validation)" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:17 +#: ./docs/11.x/prompts.md:20 +#: ./docs/master/prompts.md:17 msgid "[Spin](#spin)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/11.x/prompts.md:17 +msgid "[Forms](#forms)" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:18 +#: ./docs/11.x/prompts.md:21 +#: ./docs/master/prompts.md:18 msgid "[Progress Bar](#progress)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) +# P +#: ./docs/10.x/prompts.md:19 +#: ./docs/11.x/prompts.md:23 +#: ./docs/master/prompts.md:19 msgid "[Terminal Considerations](#terminal-considerations)" msgstr "" -#: docs/10.x/prompts.md:block 2 (unordered list) -msgid "[Unsupported Environments & Fallbacks](#fallbacks)" +# P +#: ./docs/10.x/prompts.md:20 +#: ./docs/11.x/prompts.md:24 +#: ./docs/master/prompts.md:20 +msgid "[Unsupported Environments and Fallbacks](#fallbacks)" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:22 +#: ./docs/11.x/prompts.md:26 +#: ./docs/master/prompts.md:22 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/11.x/prompts.md:22 +msgid "[Clearing the Terminal](#clear)" msgstr "" -#: docs/10.x/prompts.md:block 4 (header) +# H2 +#: ./docs/10.x/prompts.md:23 +#: ./docs/11.x/prompts.md:27 +#: ./docs/master/prompts.md:23 msgid "Introduction" msgstr "" -#: docs/10.x/prompts.md:block 5 (paragraph) +# P +#: ./docs/10.x/prompts.md:25 +#: ./docs/11.x/prompts.md:29 +#: ./docs/master/prompts.md:25 msgid "[Laravel Prompts](https://github.com/laravel/prompts) is a PHP package for adding beautiful and user-friendly forms to your command-line applications, with browser-like features including placeholder text and validation." msgstr "" -#: docs/10.x/prompts.md:block 7 (paragraph) +# P +#: ./docs/10.x/prompts.md:29 +#: ./docs/11.x/prompts.md:33 +#: ./docs/master/prompts.md:29 msgid "Laravel Prompts is perfect for accepting user input in your [Artisan console commands](/docs/{{version}}/artisan#writing-commands), but it may also be used in any command-line PHP project." msgstr "" -#: docs/10.x/prompts.md:block 8 (quote) -msgid "**Note** Laravel Prompts supports macOS, Linux, and Windows with WSL. For more information, please see our documentation on [unsupported environments & fallbacks](#fallbacks)." +# P +#: ./docs/10.x/prompts.md:32 +#: ./docs/11.x/prompts.md:36 +#: ./docs/master/prompts.md:32 +msgid "Laravel Prompts supports macOS, Linux, and Windows with WSL. For more information, please see our documentation on [unsupported environments & fallbacks](#fallbacks)." msgstr "" -#: docs/10.x/prompts.md:block 10 (header) +# P +#: ./docs/10.x/prompts.md:34 +#: ./docs/11.x/prompts.md:38 +#: ./docs/master/prompts.md:34 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/prompts.md:35 +#: ./docs/11.x/prompts.md:39 +#: ./docs/master/prompts.md:35 msgid "Installation" msgstr "" -#: docs/10.x/prompts.md:block 11 (paragraph) +# P +#: ./docs/10.x/prompts.md:37 +#: ./docs/11.x/prompts.md:41 +#: ./docs/master/prompts.md:37 msgid "Laravel Prompts is already included with the latest release of Laravel." msgstr "" -#: docs/10.x/prompts.md:block 12 (paragraph) +# P +#: ./docs/10.x/prompts.md:39 +#: ./docs/11.x/prompts.md:43 +#: ./docs/master/prompts.md:39 msgid "Laravel Prompts may also be installed in your other PHP projects by using the Composer package manager:" msgstr "" -#: docs/10.x/prompts.md:block 13 (code) -msgid "composer require laravel/prompts\n" +# CODE: shell +#: ./docs/10.x/prompts.md:41 +#: ./docs/11.x/prompts.md:45 +#: ./docs/master/prompts.md:41 +msgid "composer require laravel/prompts" msgstr "" -#: docs/10.x/prompts.md:block 15 (header) +# P +#: ./docs/10.x/prompts.md:45 +#: ./docs/11.x/prompts.md:49 +#: ./docs/master/prompts.md:45 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/prompts.md:46 +#: ./docs/11.x/prompts.md:50 +#: ./docs/master/prompts.md:46 msgid "Available Prompts" msgstr "" -#: docs/10.x/prompts.md:block 17 (header) +# P +#: ./docs/10.x/prompts.md:48 +#: ./docs/11.x/prompts.md:52 +#: ./docs/master/prompts.md:48 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/prompts.md:49 +#: ./docs/11.x/prompts.md:53 +#: ./docs/master/prompts.md:49 msgid "Text" msgstr "" -#: docs/10.x/prompts.md:block 18 (paragraph) +# P +#: ./docs/10.x/prompts.md:51 +#: ./docs/11.x/prompts.md:55 +#: ./docs/master/prompts.md:51 msgid "The `text` function will prompt the user with the given question, accept their input, and then return it:" msgstr "" -#: docs/10.x/prompts.md:block 19 (code) +# CODE: php +#: ./docs/10.x/prompts.md:53 +#: ./docs/11.x/prompts.md:57 +#: ./docs/master/prompts.md:53 msgid "use function Laravel\\Prompts\\text;\n\n" -"$name = text('What is your name?');\n" +"$name = text('What is your name?');" msgstr "" -#: docs/10.x/prompts.md:block 20 (paragraph) +# P +#: ./docs/10.x/prompts.md:59 +#: ./docs/10.x/prompts.md:401 +#: ./docs/11.x/prompts.md:63 +#: ./docs/11.x/prompts.md:133 +#: ./docs/11.x/prompts.md:492 +#: ./docs/master/prompts.md:59 +#: ./docs/master/prompts.md:419 msgid "You may also include placeholder text, a default value, and an informational hint:" msgstr "" -#: docs/10.x/prompts.md:block 21 (code) +# CODE: php +#: ./docs/10.x/prompts.md:61 +#: ./docs/11.x/prompts.md:65 +#: ./docs/master/prompts.md:61 msgid "$name = text(\n" " label: 'What is your name?',\n" " placeholder: 'E.g. Taylor Otwell',\n" " default: $user?->name,\n" " hint: 'This will be displayed on your profile.'\n" -");\n" -msgstr "" - -#: docs/10.x/prompts.md:block 23 (header) +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:70 +#: ./docs/11.x/prompts.md:74 +#: ./docs/master/prompts.md:70 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/prompts.md:71 +#: ./docs/10.x/prompts.md:131 +#: ./docs/10.x/prompts.md:414 +#: ./docs/11.x/prompts.md:75 +#: ./docs/11.x/prompts.md:144 +#: ./docs/11.x/prompts.md:213 +#: ./docs/11.x/prompts.md:505 +#: ./docs/master/prompts.md:71 +#: ./docs/master/prompts.md:140 +#: ./docs/master/prompts.md:432 msgid "Required Values" msgstr "" -#: docs/10.x/prompts.md:block 24 (paragraph) +# P +#: ./docs/10.x/prompts.md:73 +#: ./docs/10.x/prompts.md:133 +#: ./docs/10.x/prompts.md:416 +#: ./docs/11.x/prompts.md:77 +#: ./docs/11.x/prompts.md:146 +#: ./docs/11.x/prompts.md:215 +#: ./docs/11.x/prompts.md:507 +#: ./docs/master/prompts.md:73 +#: ./docs/master/prompts.md:142 +#: ./docs/master/prompts.md:434 msgid "If you require a value to be entered, you may pass the `required` argument:" msgstr "" -#: docs/10.x/prompts.md:block 25 (code) +# CODE: php +#: ./docs/10.x/prompts.md:75 +#: ./docs/11.x/prompts.md:79 +#: ./docs/master/prompts.md:75 msgid "$name = text(\n" " label: 'What is your name?',\n" " required: true\n" -");\n" -msgstr "" - -#: docs/10.x/prompts.md:block 26 (paragraph) +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:82 +#: ./docs/10.x/prompts.md:142 +#: ./docs/10.x/prompts.md:203 +#: ./docs/10.x/prompts.md:426 +#: ./docs/11.x/prompts.md:86 +#: ./docs/11.x/prompts.md:155 +#: ./docs/11.x/prompts.md:224 +#: ./docs/11.x/prompts.md:294 +#: ./docs/11.x/prompts.md:517 +#: ./docs/master/prompts.md:82 +#: ./docs/master/prompts.md:151 +#: ./docs/master/prompts.md:221 +#: ./docs/master/prompts.md:444 msgid "If you would like to customize the validation message, you may also pass a string:" msgstr "" -#: docs/10.x/prompts.md:block 27 (code) +# CODE: php +#: ./docs/10.x/prompts.md:84 +#: ./docs/11.x/prompts.md:88 +#: ./docs/master/prompts.md:84 msgid "$name = text(\n" " label: 'What is your name?',\n" " required: 'Your name is required.'\n" -");\n" -msgstr "" - -#: docs/10.x/prompts.md:block 29 (header) +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:91 +#: ./docs/11.x/prompts.md:95 +#: ./docs/master/prompts.md:91 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/prompts.md:92 +#: ./docs/10.x/prompts.md:152 +#: ./docs/10.x/prompts.md:437 +#: ./docs/11.x/prompts.md:96 +#: ./docs/11.x/prompts.md:165 +#: ./docs/11.x/prompts.md:234 +#: ./docs/11.x/prompts.md:353 +#: ./docs/11.x/prompts.md:450 +#: ./docs/11.x/prompts.md:528 +#: ./docs/11.x/prompts.md:614 +#: ./docs/11.x/prompts.md:721 +#: ./docs/master/prompts.md:92 +#: ./docs/master/prompts.md:161 +#: ./docs/master/prompts.md:455 msgid "Additional Validation" msgstr "" -#: docs/10.x/prompts.md:block 30 (paragraph) +# P +#: ./docs/10.x/prompts.md:94 +#: ./docs/10.x/prompts.md:154 +#: ./docs/10.x/prompts.md:439 +#: ./docs/11.x/prompts.md:98 +#: ./docs/11.x/prompts.md:167 +#: ./docs/11.x/prompts.md:236 +#: ./docs/11.x/prompts.md:530 +#: ./docs/master/prompts.md:94 +#: ./docs/master/prompts.md:163 +#: ./docs/master/prompts.md:457 msgid "Finally, if you would like to perform additional validation logic, you may pass a closure to the `validate` argument:" msgstr "" -#: docs/10.x/prompts.md:block 31 (code) +# CODE: php +#: ./docs/10.x/prompts.md:96 +#: ./docs/11.x/prompts.md:100 +#: ./docs/master/prompts.md:96 msgid "$name = text(\n" " label: 'What is your name?',\n" " validate: fn (string $value) => match (true) {\n" @@ -188,145 +423,376 @@ msgid "$name = text(\n" " strlen($value) > 255 => 'The name must not exceed 255 characters.',\n" " default => null\n" " }\n" -");\n" -msgstr "" - -#: docs/10.x/prompts.md:block 32 (paragraph) +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:107 +#: ./docs/10.x/prompts.md:166 +#: ./docs/10.x/prompts.md:453 +#: ./docs/11.x/prompts.md:111 +#: ./docs/11.x/prompts.md:180 +#: ./docs/11.x/prompts.md:248 +#: ./docs/11.x/prompts.md:544 +#: ./docs/master/prompts.md:107 +#: ./docs/master/prompts.md:175 +#: ./docs/master/prompts.md:471 msgid "The closure will receive the value that has been entered and may return an error message, or `null` if the validation passes." msgstr "" -#: docs/10.x/prompts.md:block 34 (header) +# P +#: ./docs/10.x/prompts.md:109 +#: ./docs/11.x/prompts.md:191 +#: ./docs/master/prompts.md:118 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/prompts.md:110 +#: ./docs/11.x/prompts.md:192 +#: ./docs/master/prompts.md:119 msgid "Password" msgstr "" -#: docs/10.x/prompts.md:block 35 (paragraph) +# CODE: php +#: ./docs/master/prompts.md:111 +msgid "$name = text(\n" +" label: 'What is your name?',\n" +" validate: ['name' => 'required|max:255|unique:users,name']\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:112 +#: ./docs/11.x/prompts.md:194 +#: ./docs/master/prompts.md:121 msgid "The `password` function is similar to the `text` function, but the user's input will be masked as they type in the console. This is useful when asking for sensitive information such as passwords:" msgstr "" -#: docs/10.x/prompts.md:block 36 (code) +# P +#: ./docs/11.x/prompts.md:113 +#: ./docs/11.x/prompts.md:182 +#: ./docs/11.x/prompts.md:250 +#: ./docs/11.x/prompts.md:546 +#: ./docs/master/prompts.md:109 +#: ./docs/master/prompts.md:177 +#: ./docs/master/prompts.md:473 +msgid "Alternatively, you may leverage the power of Laravel's [validator](/docs/{{version}}/validation). To do so, provide an array containing the name of the attribute and the desired validation rules to the `validate` argument:" +msgstr "" + +# CODE: php +#: ./docs/10.x/prompts.md:114 +#: ./docs/11.x/prompts.md:196 +#: ./docs/master/prompts.md:123 msgid "use function Laravel\\Prompts\\password;\n\n" -"$password = password('What is your password?');\n" +"$password = password('What is your password?');" msgstr "" -#: docs/10.x/prompts.md:block 37 (paragraph) +# CODE: php +#: ./docs/11.x/prompts.md:115 +msgid "$name = text(\n" +" label: 'What is your name?',\n" +" validate: ['name' => 'required|max:255|unique:users']\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:120 +#: ./docs/10.x/prompts.md:473 +#: ./docs/10.x/prompts.md:539 +#: ./docs/11.x/prompts.md:202 +#: ./docs/11.x/prompts.md:588 +#: ./docs/11.x/prompts.md:668 +#: ./docs/master/prompts.md:129 +#: ./docs/master/prompts.md:501 +#: ./docs/master/prompts.md:567 msgid "You may also include placeholder text and an informational hint:" msgstr "" -#: docs/10.x/prompts.md:block 38 (code) +# CODE: php +#: ./docs/10.x/prompts.md:122 +#: ./docs/11.x/prompts.md:204 +#: ./docs/master/prompts.md:131 msgid "$password = password(\n" " label: 'What is your password?',\n" " placeholder: 'password',\n" " hint: 'Minimum 8 characters.'\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 42 (code) +# P +#: ./docs/11.x/prompts.md:122 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/11.x/prompts.md:123 +msgid "Textarea" +msgstr "" + +# P +#: ./docs/11.x/prompts.md:125 +msgid "The `textarea` function will prompt the user with the given question, accept their input via a multi-line textarea, and then return it:" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:127 +msgid "use function Laravel\\Prompts\\textarea;\n\n" +"$story = textarea('Tell me a story.');" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:130 +#: ./docs/11.x/prompts.md:212 +#: ./docs/master/prompts.md:139 +#~ msgid "" +#~ msgstr "" + +# CODE: php +#: ./docs/10.x/prompts.md:135 +#: ./docs/11.x/prompts.md:217 +#: ./docs/master/prompts.md:144 msgid "$password = password(\n" " label: 'What is your password?',\n" " required: true\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 44 (code) +# CODE: php +#: ./docs/11.x/prompts.md:135 +msgid "$story = textarea(\n" +" label: 'Tell me a story.',\n" +" placeholder: 'This is a story about...',\n" +" hint: 'This will be displayed on your profile.'\n" +");" +msgstr "" + +# P +#: ./docs/11.x/prompts.md:143 +#~ msgid "" +#~ msgstr "" + +# CODE: php +#: ./docs/10.x/prompts.md:144 +#: ./docs/11.x/prompts.md:226 +#: ./docs/master/prompts.md:153 msgid "$password = password(\n" " label: 'What is your password?',\n" " required: 'The password is required.'\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 48 (code) +# CODE: php +#: ./docs/11.x/prompts.md:148 +msgid "$story = textarea(\n" +" label: 'Tell me a story.',\n" +" required: true\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:151 +#: ./docs/11.x/prompts.md:233 +#: ./docs/master/prompts.md:160 +#~ msgid "" +#~ msgstr "" + +# CODE: php +#: ./docs/10.x/prompts.md:156 +#: ./docs/11.x/prompts.md:238 +#: ./docs/master/prompts.md:165 msgid "$password = password(\n" " label: 'What is your password?',\n" " validate: fn (string $value) => match (true) {\n" " strlen($value) < 8 => 'The password must be at least 8 characters.',\n" " default => null\n" " }\n" -");\n" +");" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:157 +msgid "$story = textarea(\n" +" label: 'Tell me a story.',\n" +" required: 'A story is required.'\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 51 (header) +# P +#: ./docs/11.x/prompts.md:164 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/prompts.md:168 +#: ./docs/11.x/prompts.md:259 +#: ./docs/master/prompts.md:186 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/prompts.md:169 +#: ./docs/11.x/prompts.md:260 +#: ./docs/master/prompts.md:187 msgid "Confirm" msgstr "" -#: docs/10.x/prompts.md:block 52 (paragraph) +# CODE: php +#: ./docs/11.x/prompts.md:169 +msgid "$story = textarea(\n" +" label: 'Tell me a story.',\n" +" validate: fn (string $value) => match (true) {\n" +" strlen($value) < 250 => 'The story must be at least 250 characters.',\n" +" strlen($value) > 10000 => 'The story must not exceed 10,000 characters.',\n" +" default => null\n" +" }\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:171 +#: ./docs/11.x/prompts.md:262 +#: ./docs/master/prompts.md:189 msgid "If you need to ask the user for a \"yes or no\" confirmation, you may use the `confirm` function. Users may use the arrow keys or press `y` or `n` to select their response. This function will return either `true` or `false`." msgstr "" -#: docs/10.x/prompts.md:block 53 (code) +# CODE: php +#: ./docs/10.x/prompts.md:173 +#: ./docs/11.x/prompts.md:264 +#: ./docs/master/prompts.md:191 msgid "use function Laravel\\Prompts\\confirm;\n\n" -"$confirmed = confirm('Do you accept the terms?');\n" +"$confirmed = confirm('Do you accept the terms?');" msgstr "" -#: docs/10.x/prompts.md:block 54 (paragraph) +# P +#: ./docs/10.x/prompts.md:179 +#: ./docs/11.x/prompts.md:270 +#: ./docs/master/prompts.md:197 msgid "You may also include a default value, customized wording for the \"Yes\" and \"No\" labels, and an informational hint:" msgstr "" -#: docs/10.x/prompts.md:block 55 (code) +# CODE: php +#: ./docs/10.x/prompts.md:181 +#: ./docs/11.x/prompts.md:272 +#: ./docs/master/prompts.md:199 msgid "$confirmed = confirm(\n" " label: 'Do you accept the terms?',\n" " default: false,\n" " yes: 'I accept',\n" " no: 'I decline',\n" " hint: 'The terms must be accepted to continue.'\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 57 (header) +# CODE: php +#: ./docs/11.x/prompts.md:184 +msgid "$story = textarea(\n" +" label: 'Tell me a story.',\n" +" validate: ['story' => 'required|max:10000']\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:191 +#: ./docs/11.x/prompts.md:282 +#: ./docs/master/prompts.md:209 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/prompts.md:192 +#: ./docs/11.x/prompts.md:283 +#: ./docs/master/prompts.md:210 msgid "Requiring \"Yes\"" msgstr "" -#: docs/10.x/prompts.md:block 58 (paragraph) +# P +#: ./docs/10.x/prompts.md:194 +#: ./docs/11.x/prompts.md:285 +#: ./docs/master/prompts.md:212 msgid "If necessary, you may require your users to select \"Yes\" by passing the `required` argument:" msgstr "" -#: docs/10.x/prompts.md:block 59 (code) +# CODE: php +#: ./docs/10.x/prompts.md:196 +#: ./docs/11.x/prompts.md:287 +#: ./docs/master/prompts.md:214 msgid "$confirmed = confirm(\n" " label: 'Do you accept the terms?',\n" " required: true\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 61 (code) +# CODE: php +#: ./docs/10.x/prompts.md:205 +#: ./docs/11.x/prompts.md:296 +#: ./docs/master/prompts.md:223 msgid "$confirmed = confirm(\n" " label: 'Do you accept the terms?',\n" " required: 'You must accept the terms to continue.'\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 63 (header) +# P +#: ./docs/10.x/prompts.md:212 +#: ./docs/11.x/prompts.md:303 +#: ./docs/master/prompts.md:230 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/prompts.md:213 +#: ./docs/11.x/prompts.md:304 +#: ./docs/master/prompts.md:231 msgid "Select" msgstr "" -#: docs/10.x/prompts.md:block 64 (paragraph) +# P +#: ./docs/10.x/prompts.md:215 +#: ./docs/11.x/prompts.md:306 +#: ./docs/master/prompts.md:233 msgid "If you need the user to select from a predefined set of choices, you may use the `select` function:" msgstr "" -#: docs/10.x/prompts.md:block 65 (code) +# CODE: php +#: ./docs/10.x/prompts.md:217 +#: ./docs/master/prompts.md:235 msgid "use function Laravel\\Prompts\\select;\n\n" "$role = select(\n" " 'What role should the user have?',\n" " ['Member', 'Contributor', 'Owner'],\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 66 (paragraph) +# P +#: ./docs/10.x/prompts.md:226 +#: ./docs/11.x/prompts.md:317 +#: ./docs/master/prompts.md:244 msgid "You may also specify the default choice and an informational hint:" msgstr "" -#: docs/10.x/prompts.md:block 67 (code) +# CODE: php +#: ./docs/10.x/prompts.md:228 +#: ./docs/11.x/prompts.md:319 +#: ./docs/master/prompts.md:246 msgid "$role = select(\n" " label: 'What role should the user have?',\n" " options: ['Member', 'Contributor', 'Owner'],\n" " default: 'Owner',\n" " hint: 'The role may be changed at any time.'\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 68 (paragraph) +# P +#: ./docs/10.x/prompts.md:237 +#: ./docs/11.x/prompts.md:328 +#: ./docs/master/prompts.md:255 msgid "You may also pass an associative array to the `options` argument to have the selected key returned instead of its value:" msgstr "" -#: docs/10.x/prompts.md:block 69 (code) +# CODE: php +#: ./docs/10.x/prompts.md:239 +#: ./docs/master/prompts.md:257 msgid "$role = select(\n" " label: 'What role should the user have?',\n" " options: [\n" @@ -335,30 +801,71 @@ msgid "$role = select(\n" " 'owner' => 'Owner'\n" " ],\n" " default: 'owner'\n" -");\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:251 +#: ./docs/10.x/prompts.md:325 +#: ./docs/10.x/prompts.md:486 +#: ./docs/11.x/prompts.md:342 +#: ./docs/11.x/prompts.md:416 +#: ./docs/11.x/prompts.md:601 +#: ./docs/master/prompts.md:269 +#: ./docs/master/prompts.md:343 +#: ./docs/master/prompts.md:514 +msgid "Up to five options will be displayed before the list begins to scroll. You may customize this by passing the `scroll` argument:" msgstr "" -#: docs/10.x/prompts.md:block 70 (paragraph) -msgid "Up to five options will be displayed before the list begins to scroll. You may customize this by passing the `scroll` argument:" +# CODE: php +#: ./docs/11.x/prompts.md:252 +#: ./docs/master/prompts.md:179 +msgid "$password = password(\n" +" label: 'What is your password?',\n" +" validate: ['password' => 'min:8']\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 71 (code) +# CODE: php +#: ./docs/10.x/prompts.md:253 +#: ./docs/11.x/prompts.md:344 +#: ./docs/master/prompts.md:271 msgid "$role = select(\n" " label: 'Which category would you like to assign?',\n" " options: Category::pluck('name', 'id'),\n" " scroll: 10\n" -");\n" -msgstr "" - -#: docs/10.x/prompts.md:block 73 (header) +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:261 +#: ./docs/11.x/prompts.md:352 +#: ./docs/master/prompts.md:279 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/prompts.md:262 +#: ./docs/10.x/prompts.md:359 +#: ./docs/10.x/prompts.md:499 +#: ./docs/10.x/prompts.md:592 +#: ./docs/master/prompts.md:280 +#: ./docs/master/prompts.md:377 +#: ./docs/master/prompts.md:527 +#: ./docs/master/prompts.md:620 msgid "Validation" msgstr "" -#: docs/10.x/prompts.md:block 74 (paragraph) +# P +#: ./docs/10.x/prompts.md:264 +#: ./docs/11.x/prompts.md:355 +#: ./docs/master/prompts.md:282 msgid "Unlike other prompt functions, the `select` function doesn't accept the `required` argument because it is not possible to select nothing. However, you may pass a closure to the `validate` argument if you need to present an option but prevent it from being selected:" msgstr "" -#: docs/10.x/prompts.md:block 75 (code) +# CODE: php +#: ./docs/10.x/prompts.md:266 +#: ./docs/master/prompts.md:284 msgid "$role = select(\n" " label: 'What role should the user have?',\n" " options: [\n" @@ -370,48 +877,85 @@ msgid "$role = select(\n" " $value === 'owner' && User::where('role', 'owner')->exists()\n" " ? 'An owner already exists.'\n" " : null\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 76 (paragraph) +# P +#: ./docs/10.x/prompts.md:281 +#: ./docs/11.x/prompts.md:372 +#: ./docs/master/prompts.md:299 msgid "If the `options` argument is an associative array, then the closure will receive the selected key, otherwise it will receive the selected value. The closure may return an error message, or `null` if the validation passes." msgstr "" -#: docs/10.x/prompts.md:block 78 (header) +# P +#: ./docs/10.x/prompts.md:283 +#: ./docs/11.x/prompts.md:374 +#: ./docs/master/prompts.md:301 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/prompts.md:284 +#: ./docs/11.x/prompts.md:375 +#: ./docs/master/prompts.md:302 msgid "Multi-select" msgstr "" -#: docs/10.x/prompts.md:block 79 (paragraph) +# P +#: ./docs/10.x/prompts.md:286 +#: ./docs/master/prompts.md:304 msgid "If you need to the user to be able to select multiple options, you may use the `multiselect` function:" msgstr "" -#: docs/10.x/prompts.md:block 80 (code) +# CODE: php +#: ./docs/10.x/prompts.md:288 +#: ./docs/master/prompts.md:306 msgid "use function Laravel\\Prompts\\multiselect;\n\n" "$permissions = multiselect(\n" " 'What permissions should be assigned?',\n" " ['Read', 'Create', 'Update', 'Delete']\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 81 (paragraph) +# P +#: ./docs/10.x/prompts.md:297 +#: ./docs/11.x/prompts.md:388 +#: ./docs/master/prompts.md:315 msgid "You may also specify default choices and an informational hint:" msgstr "" -#: docs/10.x/prompts.md:block 82 (code) +# CODE: php +#: ./docs/10.x/prompts.md:299 +#: ./docs/11.x/prompts.md:390 +#: ./docs/master/prompts.md:317 msgid "use function Laravel\\Prompts\\multiselect;\n\n" "$permissions = multiselect(\n" " label: 'What permissions should be assigned?',\n" " options: ['Read', 'Create', 'Update', 'Delete'],\n" " default: ['Read', 'Create'],\n" " hint: 'Permissions may be updated at any time.'\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 83 (paragraph) +# CODE: php +#: ./docs/11.x/prompts.md:308 +msgid "use function Laravel\\Prompts\\select;\n\n" +"$role = select(\n" +" label: 'What role should the user have?',\n" +" options: ['Member', 'Contributor', 'Owner']\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:310 +#: ./docs/11.x/prompts.md:401 +#: ./docs/master/prompts.md:328 msgid "You may also pass an associative array to the `options` argument to return the selected options' keys instead of their values:" msgstr "" -#: docs/10.x/prompts.md:block 84 (code) +# CODE +#: ./docs/10.x/prompts.md:312 +#: ./docs/master/prompts.md:330 msgid "$permissions = multiselect(\n" " label: 'What permissions should be assigned?',\n" " options: [\n" @@ -421,51 +965,121 @@ msgid "$permissions = multiselect(\n" " 'delete' => 'Delete'\n" " ],\n" " default: ['read', 'create']\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 86 (code) +# CODE: php +#: ./docs/10.x/prompts.md:327 +#: ./docs/11.x/prompts.md:418 +#: ./docs/master/prompts.md:345 msgid "$categories = multiselect(\n" " label: 'What categories should be assigned?',\n" " options: Category::pluck('name', 'id'),\n" " scroll: 10\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 88 (header) +# CODE: php +#: ./docs/11.x/prompts.md:330 +msgid "$role = select(\n" +" label: 'What role should the user have?',\n" +" options: [\n" +" 'member' => 'Member',\n" +" 'contributor' => 'Contributor',\n" +" 'owner' => 'Owner',\n" +" ],\n" +" default: 'owner'\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:335 +#: ./docs/11.x/prompts.md:426 +#: ./docs/master/prompts.md:353 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/prompts.md:336 +#: ./docs/10.x/prompts.md:565 +#: ./docs/11.x/prompts.md:427 +#: ./docs/11.x/prompts.md:694 +#: ./docs/master/prompts.md:354 +#: ./docs/master/prompts.md:593 msgid "Requiring a Value" msgstr "" -#: docs/10.x/prompts.md:block 89 (paragraph) +# P +#: ./docs/10.x/prompts.md:338 +#: ./docs/10.x/prompts.md:567 +#: ./docs/11.x/prompts.md:429 +#: ./docs/11.x/prompts.md:696 +#: ./docs/master/prompts.md:356 +#: ./docs/master/prompts.md:595 msgid "By default, the user may select zero or more options. You may pass the `required` argument to enforce one or more options instead:" msgstr "" -#: docs/10.x/prompts.md:block 90 (code) +# CODE: php +#: ./docs/10.x/prompts.md:340 +#: ./docs/master/prompts.md:358 msgid "$categories = multiselect(\n" " label: 'What categories should be assigned?',\n" " options: Category::pluck('name', 'id'),\n" " required: true,\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 91 (paragraph) +# P +#: ./docs/10.x/prompts.md:348 +#: ./docs/11.x/prompts.md:439 +#: ./docs/master/prompts.md:366 msgid "If you would like to customize the validation message, you may provide a string to the `required` argument:" msgstr "" -#: docs/10.x/prompts.md:block 92 (code) +# CODE: php +#: ./docs/10.x/prompts.md:350 +#: ./docs/master/prompts.md:368 msgid "$categories = multiselect(\n" " label: 'What categories should be assigned?',\n" " options: Category::pluck('name', 'id'),\n" " required: 'You must select at least one category',\n" -");\n" +");" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:357 +msgid "$role = select(\n" +" label: 'What role should the user have?',\n" +" options: [\n" +" 'member' => 'Member',\n" +" 'contributor' => 'Contributor',\n" +" 'owner' => 'Owner',\n" +" ],\n" +" validate: fn (string $value) =>\n" +" $value === 'owner' && User::where('role', 'owner')->exists()\n" +" ? 'An owner already exists.'\n" +" : null\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 95 (paragraph) +# P +#: ./docs/10.x/prompts.md:358 +#: ./docs/11.x/prompts.md:449 +#: ./docs/master/prompts.md:376 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/prompts.md:361 +#: ./docs/11.x/prompts.md:452 +#: ./docs/master/prompts.md:379 msgid "You may pass a closure to the `validate` argument if you need to present an option but prevent it from being selected:" msgstr "" -#: docs/10.x/prompts.md:block 96 (code) -msgid "$permissions = select(\n" +# CODE +#: ./docs/10.x/prompts.md:363 +#: ./docs/master/prompts.md:381 +msgid "$permissions = multiselect(\n" " label: 'What permissions should the user have?',\n" " options: [\n" " 'read' => 'Read',\n" @@ -476,65 +1090,152 @@ msgid "$permissions = select(\n" " validate: fn (array $values) => ! in_array('read', $values)\n" " ? 'All users require the read permission.'\n" " : null\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 97 (paragraph) +# P +#: ./docs/11.x/prompts.md:377 +msgid "If you need the user to be able to select multiple options, you may use the `multiselect` function:" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:378 +#: ./docs/11.x/prompts.md:469 +#: ./docs/master/prompts.md:396 msgid "If the `options` argument is 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." msgstr "" -#: docs/10.x/prompts.md:block 99 (header) +# CODE: php +#: ./docs/11.x/prompts.md:379 +msgid "use function Laravel\\Prompts\\multiselect;\n\n" +"$permissions = multiselect(\n" +" label: 'What permissions should be assigned?',\n" +" options: ['Read', 'Create', 'Update', 'Delete']\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:380 +#: ./docs/11.x/prompts.md:471 +#: ./docs/master/prompts.md:398 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/prompts.md:381 +#: ./docs/11.x/prompts.md:472 +#: ./docs/master/prompts.md:399 msgid "Suggest" msgstr "" -#: docs/10.x/prompts.md:block 100 (paragraph) +# P +#: ./docs/10.x/prompts.md:383 +#: ./docs/11.x/prompts.md:474 +#: ./docs/master/prompts.md:401 msgid "The `suggest` function can be used to provide auto-completion for possible choices. The user can still provide any answer, regardless of the auto-completion hints:" msgstr "" -#: docs/10.x/prompts.md:block 101 (code) +# CODE: php +#: ./docs/10.x/prompts.md:385 +#: ./docs/11.x/prompts.md:476 +#: ./docs/master/prompts.md:403 msgid "use function Laravel\\Prompts\\suggest;\n\n" -"$name = suggest('What is your name?', ['Taylor', 'Dayle']);\n" +"$name = suggest('What is your name?', ['Taylor', 'Dayle']);" msgstr "" -#: docs/10.x/prompts.md:block 102 (paragraph) +# P +#: ./docs/10.x/prompts.md:391 +#: ./docs/11.x/prompts.md:482 +#: ./docs/master/prompts.md:409 msgid "Alternatively, you may pass a closure as the second argument to the `suggest` function. The closure will be called each time the user types an input character. The closure should accept a string parameter containing the user's input so far and return an array of options for auto-completion:" msgstr "" -#: docs/10.x/prompts.md:block 103 (code) +# CODE: php +#: ./docs/10.x/prompts.md:393 +#: ./docs/master/prompts.md:411 msgid "$name = suggest(\n" " 'What is your name?',\n" " fn ($value) => collect(['Taylor', 'Dayle'])\n" " ->filter(fn ($name) => Str::contains($name, $value, ignoreCase: true))\n" -")\n" +")" msgstr "" -#: docs/10.x/prompts.md:block 105 (code) +# CODE: php +#: ./docs/10.x/prompts.md:403 +#: ./docs/11.x/prompts.md:494 +#: ./docs/master/prompts.md:421 msgid "$name = suggest(\n" " label: 'What is your name?',\n" " options: ['Taylor', 'Dayle'],\n" " placeholder: 'E.g. Taylor',\n" " default: $user?->name,\n" " hint: 'This will be displayed on your profile.'\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 109 (code) +# CODE: php +#: ./docs/11.x/prompts.md:403 +msgid "$permissions = multiselect(\n" +" label: 'What permissions should be assigned?',\n" +" options: [\n" +" 'read' => 'Read',\n" +" 'create' => 'Create',\n" +" 'update' => 'Update',\n" +" 'delete' => 'Delete',\n" +" ],\n" +" default: ['read', 'create']\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:413 +#: ./docs/11.x/prompts.md:504 +#: ./docs/master/prompts.md:431 +#~ msgid "" +#~ msgstr "" + +# CODE: php +#: ./docs/10.x/prompts.md:418 +#: ./docs/11.x/prompts.md:509 +#: ./docs/master/prompts.md:436 msgid "$name = suggest(\n" " label: 'What is your name?',\n" " options: ['Taylor', 'Dayle'],\n" " required: true\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 111 (code) +# CODE: php +#: ./docs/10.x/prompts.md:428 +#: ./docs/11.x/prompts.md:519 +#: ./docs/master/prompts.md:446 msgid "$name = suggest(\n" " label: 'What is your name?',\n" " options: ['Taylor', 'Dayle'],\n" " required: 'Your name is required.'\n" -");\n" +");" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:431 +msgid "$categories = multiselect(\n" +" label: 'What categories should be assigned?',\n" +" options: Category::pluck('name', 'id'),\n" +" required: true\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 115 (code) +# P +#: ./docs/10.x/prompts.md:436 +#: ./docs/11.x/prompts.md:527 +#: ./docs/master/prompts.md:454 +#~ msgid "" +#~ msgstr "" + +# CODE: php +#: ./docs/10.x/prompts.md:441 +#: ./docs/11.x/prompts.md:532 +#: ./docs/master/prompts.md:459 msgid "$name = suggest(\n" " label: 'What is your name?',\n" " options: ['Taylor', 'Dayle'],\n" @@ -543,32 +1244,77 @@ msgid "$name = suggest(\n" " strlen($value) > 255 => 'The name must not exceed 255 characters.',\n" " default => null\n" " }\n" -");\n" +");" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:441 +msgid "$categories = multiselect(\n" +" label: 'What categories should be assigned?',\n" +" options: Category::pluck('name', 'id'),\n" +" required: 'You must select at least one category'\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 118 (header) +# CODE: php +#: ./docs/11.x/prompts.md:454 +msgid "$permissions = multiselect(\n" +" label: 'What permissions should the user have?',\n" +" options: [\n" +" 'read' => 'Read',\n" +" 'create' => 'Create',\n" +" 'update' => 'Update',\n" +" 'delete' => 'Delete',\n" +" ],\n" +" validate: fn (array $values) => ! in_array('read', $values)\n" +" ? 'All users require the read permission.'\n" +" : null\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:455 +#: ./docs/11.x/prompts.md:556 +#: ./docs/master/prompts.md:483 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/prompts.md:456 +#: ./docs/11.x/prompts.md:557 +#: ./docs/master/prompts.md:484 msgid "Search" msgstr "" -#: docs/10.x/prompts.md:block 119 (paragraph) +# P +#: ./docs/10.x/prompts.md:458 +#: ./docs/11.x/prompts.md:559 +#: ./docs/master/prompts.md:486 msgid "If you have a lot of options for the user to select from, the `search` function allows the user to type a search query to filter the results before using the arrow keys to select an option:" msgstr "" -#: docs/10.x/prompts.md:block 120 (code) +# CODE: php +#: ./docs/10.x/prompts.md:460 +#: ./docs/master/prompts.md:488 msgid "use function Laravel\\Prompts\\search;\n\n" "$id = search(\n" " 'Search for the user that should receive the mail',\n" " fn (string $value) => strlen($value) > 0\n" " ? User::where('name', 'like', \"%{$value}%\")->pluck('name', 'id')->all()\n" " : []\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 121 (paragraph) +# P +#: ./docs/10.x/prompts.md:471 +#: ./docs/11.x/prompts.md:572 +#: ./docs/master/prompts.md:499 msgid "The closure will receive the text that has been typed by the user so far and must return an array of options. If you return an associative array then the selected option's key will be returned, otherwise its value will be returned instead." msgstr "" -#: docs/10.x/prompts.md:block 123 (code) +# CODE: php +#: ./docs/10.x/prompts.md:475 +#: ./docs/master/prompts.md:503 msgid "$id = search(\n" " label: 'Search for the user that should receive the mail',\n" " placeholder: 'E.g. Taylor Otwell',\n" @@ -576,24 +1322,50 @@ msgid "$id = search(\n" " ? User::where('name', 'like', \"%{$value}%\")->pluck('name', 'id')->all()\n" " : [],\n" " hint: 'The user will receive an email immediately.'\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 125 (code) +# CODE: php +#: ./docs/11.x/prompts.md:484 +msgid "$name = suggest(\n" +" label: 'What is your name?',\n" +" options: fn ($value) => collect(['Taylor', 'Dayle'])\n" +" ->filter(fn ($name) => Str::contains($name, $value, ignoreCase: true))\n" +")" +msgstr "" + +# CODE: php +#: ./docs/10.x/prompts.md:488 +#: ./docs/master/prompts.md:516 msgid "$id = search(\n" " label: 'Search for the user that should receive the mail',\n" " options: fn (string $value) => strlen($value) > 0\n" " ? User::where('name', 'like', \"%{$value}%\")->pluck('name', 'id')->all()\n" " : [],\n" " scroll: 10\n" -");\n" -msgstr "" - -#: docs/10.x/prompts.md:block 128 (paragraph) +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:498 +#: ./docs/11.x/prompts.md:613 +#: ./docs/master/prompts.md:526 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/prompts.md:501 +#: ./docs/10.x/prompts.md:594 +#: ./docs/11.x/prompts.md:616 +#: ./docs/11.x/prompts.md:723 +#: ./docs/master/prompts.md:529 +#: ./docs/master/prompts.md:622 msgid "If you would like to perform additional validation logic, you may pass a closure to the `validate` argument:" msgstr "" -#: docs/10.x/prompts.md:block 129 (code) +# CODE: php +#: ./docs/10.x/prompts.md:503 +#: ./docs/master/prompts.md:531 msgid "$id = search(\n" " label: 'Search for the user that should receive the mail',\n" " options: fn (string $value) => strlen($value) > 0\n" @@ -605,36 +1377,59 @@ msgid "$id = search(\n" " return 'This user has opted-out of receiving mail.';\n" " }\n" " }\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 130 (paragraph) +# P +#: ./docs/10.x/prompts.md:519 +#: ./docs/11.x/prompts.md:634 +#: ./docs/master/prompts.md:547 msgid "If the `options` closure returns an associative array, then the closure will receive the selected key, otherwise, it will receive the selected value. The closure may return an error message, or `null` if the validation passes." msgstr "" -#: docs/10.x/prompts.md:block 132 (header) +# P +#: ./docs/10.x/prompts.md:521 +#: ./docs/11.x/prompts.md:636 +#: ./docs/master/prompts.md:549 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/prompts.md:522 +#: ./docs/11.x/prompts.md:637 +#: ./docs/master/prompts.md:550 msgid "Multi-search" msgstr "" -#: docs/10.x/prompts.md:block 133 (paragraph) +# P +#: ./docs/10.x/prompts.md:524 +#: ./docs/11.x/prompts.md:639 +#: ./docs/master/prompts.md:552 msgid "If you have a lot of searchable options and need the user to be able to select multiple items, the `multisearch` function allows the user to type a search query to filter the results before using the arrow keys and space-bar to select options:" msgstr "" -#: docs/10.x/prompts.md:block 134 (code) +# CODE: php +#: ./docs/10.x/prompts.md:526 +#: ./docs/master/prompts.md:554 msgid "use function Laravel\\Prompts\\multisearch;\n\n" "$ids = multisearch(\n" " 'Search for the users that should receive the mail',\n" " fn (string $value) => strlen($value) > 0\n" " ? User::where('name', 'like', \"%{$value}%\")->pluck('name', 'id')->all()\n" " : []\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 135 (paragraph) +# P +#: ./docs/10.x/prompts.md:537 +#: ./docs/11.x/prompts.md:652 +#: ./docs/master/prompts.md:565 msgid "The closure will receive the text that has been typed by the user so far and must return an array of options. If you return an associative array then the selected options' keys will be returned; otherwise, their values will be returned instead." msgstr "" -#: docs/10.x/prompts.md:block 137 (code) +# CODE: php +#: ./docs/10.x/prompts.md:541 +#: ./docs/master/prompts.md:569 msgid "$ids = multisearch(\n" " label: 'Search for the users that should receive the mail',\n" " placeholder: 'E.g. Taylor Otwell',\n" @@ -642,48 +1437,127 @@ msgid "$ids = multisearch(\n" " ? User::where('name', 'like', \"%{$value}%\")->pluck('name', 'id')->all()\n" " : [],\n" " hint: 'The user will receive an email immediately.'\n" -");\n" +");" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:548 +#: ./docs/master/prompts.md:475 +msgid "$name = suggest(\n" +" label: 'What is your name?',\n" +" options: ['Taylor', 'Dayle'],\n" +" validate: ['name' => 'required|min:3|max:255']\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 138 (paragraph) +# P +#: ./docs/10.x/prompts.md:552 +#: ./docs/11.x/prompts.md:681 +#: ./docs/master/prompts.md:580 msgid "Up to five options will be displayed before the list begins to scroll. You may customize this by providing the `scroll` argument:" msgstr "" -#: docs/10.x/prompts.md:block 139 (code) +# CODE: php +#: ./docs/10.x/prompts.md:554 +#: ./docs/master/prompts.md:582 msgid "$ids = multisearch(\n" " label: 'Search for the users that should receive the mail',\n" " options: fn (string $value) => strlen($value) > 0\n" " ? User::where('name', 'like', \"%{$value}%\")->pluck('name', 'id')->all()\n" " : [],\n" " scroll: 10\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 143 (code) +# CODE: php +#: ./docs/11.x/prompts.md:561 +msgid "use function Laravel\\Prompts\\search;\n\n" +"$id = search(\n" +" label: 'Search for the user that should receive the mail',\n" +" options: fn (string $value) => strlen($value) > 0\n" +" ? User::whereLike('name', \"%{$value}%\")->pluck('name', 'id')->all()\n" +" : []\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:564 +#: ./docs/11.x/prompts.md:693 +#: ./docs/master/prompts.md:592 +#~ msgid "" +#~ msgstr "" + +# CODE: php +#: ./docs/10.x/prompts.md:569 +#: ./docs/master/prompts.md:597 msgid "$ids = multisearch(\n" " 'Search for the users that should receive the mail',\n" " fn (string $value) => strlen($value) > 0\n" " ? User::where('name', 'like', \"%{$value}%\")->pluck('name', 'id')->all()\n" " : [],\n" " required: true,\n" -");\n" +");" +msgstr "" + +# P +#: ./docs/11.x/prompts.md:574 +#: ./docs/11.x/prompts.md:654 +msgid "When filtering an array where you intend to return the value, you should use the `array_values` function or the `values` Collection method to ensure the array doesn't become associative:" msgstr "" -#: docs/10.x/prompts.md:block 144 (paragraph) +# CODE: php +#: ./docs/11.x/prompts.md:576 +msgid "$names = collect(['Taylor', 'Abigail']);\n\n" +"$selected = search(\n" +" label: 'Search for the user that should receive the mail',\n" +" options: fn (string $value) => $names\n" +" ->filter(fn ($name) => Str::contains($name, $value, ignoreCase: true))\n" +" ->values()\n" +" ->all(),\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:579 +#: ./docs/11.x/prompts.md:708 +#: ./docs/master/prompts.md:607 msgid "If you would like to customize the validation message, you may also provide a string to the `required` argument:" msgstr "" -#: docs/10.x/prompts.md:block 145 (code) +# CODE: php +#: ./docs/10.x/prompts.md:581 +#: ./docs/master/prompts.md:609 msgid "$ids = multisearch(\n" " 'Search for the users that should receive the mail',\n" " fn (string $value) => strlen($value) > 0\n" " ? User::where('name', 'like', \"%{$value}%\")->pluck('name', 'id')->all()\n" " : [],\n" " required: 'You must select at least one user.'\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 149 (code) +# CODE: php +#: ./docs/11.x/prompts.md:590 +msgid "$id = search(\n" +" label: 'Search for the user that should receive the mail',\n" +" placeholder: 'E.g. Taylor Otwell',\n" +" options: fn (string $value) => strlen($value) > 0\n" +" ? User::whereLike('name', \"%{$value}%\")->pluck('name', 'id')->all()\n" +" : [],\n" +" hint: 'The user will receive an email immediately.'\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:591 +#: ./docs/11.x/prompts.md:720 +#: ./docs/master/prompts.md:619 +#~ msgid "" +#~ msgstr "" + +# CODE: php +#: ./docs/10.x/prompts.md:596 +#: ./docs/master/prompts.md:624 msgid "$ids = multisearch(\n" " label: 'Search for the users that should receive the mail',\n" " options: fn (string $value) => strlen($value) > 0\n" @@ -695,88 +1569,264 @@ msgid "$ids = multisearch(\n" " return $optedOut->pluck('name')->join(', ', ', and ').' have opted out.';\n" " }\n" " }\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 150 (paragraph) +# CODE: php +#: ./docs/11.x/prompts.md:603 +msgid "$id = search(\n" +" label: 'Search for the user that should receive the mail',\n" +" options: fn (string $value) => strlen($value) > 0\n" +" ? User::whereLike('name', \"%{$value}%\")->pluck('name', 'id')->all()\n" +" : [],\n" +" scroll: 10\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:612 +#: ./docs/11.x/prompts.md:741 +#: ./docs/master/prompts.md:640 msgid "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." msgstr "" -#: docs/10.x/prompts.md:block 152 (header) +# P +#: ./docs/10.x/prompts.md:614 +#: ./docs/11.x/prompts.md:743 +#: ./docs/master/prompts.md:642 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/prompts.md:615 +#: ./docs/11.x/prompts.md:744 +#: ./docs/master/prompts.md:643 +msgid "Pause" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:617 +#: ./docs/11.x/prompts.md:746 +#: ./docs/master/prompts.md:645 +msgid "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:" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:618 +msgid "$id = search(\n" +" label: 'Search for the user that should receive the mail',\n" +" options: fn (string $value) => strlen($value) > 0\n" +" ? User::whereLike('name', \"%{$value}%\")->pluck('name', 'id')->all()\n" +" : [],\n" +" validate: function (int|string $value) {\n" +" $user = User::findOrFail($value);\n\n" +" if ($user->opted_out) {\n" +" return 'This user has opted-out of receiving mail.';\n" +" }\n" +" }\n" +");" +msgstr "" + +# CODE: php +#: ./docs/10.x/prompts.md:619 +#: ./docs/11.x/prompts.md:748 +#: ./docs/master/prompts.md:647 +msgid "use function Laravel\\Prompts\\pause;\n\n" +"pause('Press ENTER to continue.');" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:625 +#: ./docs/11.x/prompts.md:826 +#: ./docs/master/prompts.md:653 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/prompts.md:626 +#: ./docs/11.x/prompts.md:827 +#: ./docs/master/prompts.md:654 msgid "Informational Messages" msgstr "" -#: docs/10.x/prompts.md:block 153 (paragraph) +# P +#: ./docs/10.x/prompts.md:628 +#: ./docs/11.x/prompts.md:829 +#: ./docs/master/prompts.md:656 msgid "The `note`, `info`, `warning`, `error`, and `alert` functions may be used to display informational messages:" msgstr "" -#: docs/10.x/prompts.md:block 154 (code) +# CODE: php +#: ./docs/10.x/prompts.md:630 +#: ./docs/11.x/prompts.md:831 +#: ./docs/master/prompts.md:658 msgid "use function Laravel\\Prompts\\info;\n\n" -"info('Package installed successfully.');\n" +"info('Package installed successfully.');" msgstr "" -#: docs/10.x/prompts.md:block 156 (header) +# P +#: ./docs/10.x/prompts.md:636 +#: ./docs/11.x/prompts.md:837 +#: ./docs/master/prompts.md:664 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/prompts.md:637 +#: ./docs/11.x/prompts.md:838 +#: ./docs/master/prompts.md:665 msgid "Tables" msgstr "" -#: docs/10.x/prompts.md:block 157 (paragraph) +# P +#: ./docs/10.x/prompts.md:639 +#: ./docs/11.x/prompts.md:840 +#: ./docs/master/prompts.md:667 msgid "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:" msgstr "" -#: docs/10.x/prompts.md:block 158 (code) +# CODE: php +#: ./docs/10.x/prompts.md:641 +#: ./docs/master/prompts.md:669 msgid "use function Laravel\\Prompts\\table;\n\n" "table(\n" " ['Name', 'Email'],\n" " User::all(['name', 'email'])\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 160 (header) +# CODE: php +#: ./docs/11.x/prompts.md:641 +msgid "use function Laravel\\Prompts\\multisearch;\n\n" +"$ids = multisearch(\n" +" 'Search for the users that should receive the mail',\n" +" fn (string $value) => strlen($value) > 0\n" +" ? User::whereLike('name', \"%{$value}%\")->pluck('name', 'id')->all()\n" +" : []\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:650 +#: ./docs/11.x/prompts.md:851 +#: ./docs/master/prompts.md:678 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/prompts.md:651 +#: ./docs/11.x/prompts.md:852 +#: ./docs/master/prompts.md:679 msgid "Spin" msgstr "" -#: docs/10.x/prompts.md:block 161 (paragraph) +# P +#: ./docs/10.x/prompts.md:653 +#: ./docs/11.x/prompts.md:854 +#: ./docs/master/prompts.md:681 msgid "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:" msgstr "" -#: docs/10.x/prompts.md:block 162 (code) +# CODE: php +#: ./docs/10.x/prompts.md:655 +#: ./docs/master/prompts.md:683 msgid "use function Laravel\\Prompts\\spin;\n\n" "$response = spin(\n" " fn () => Http::get('http://example.com'),\n" " 'Fetching response...'\n" -");\n" +");" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:656 +msgid "$names = collect(['Taylor', 'Abigail']);\n\n" +"$selected = multisearch(\n" +" label: 'Search for the users that should receive the mail',\n" +" options: fn (string $value) => $names\n" +" ->filter(fn ($name) => Str::contains($name, $value, ignoreCase: true))\n" +" ->values()\n" +" ->all(),\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 163 (quote) -msgid "**Warning** The `spin` function requires the `pcntl` PHP extension to animate the spinner. When this extension is not available, a static version of the spinner will appear instead." +# P +#: ./docs/10.x/prompts.md:665 +#: ./docs/11.x/prompts.md:866 +#: ./docs/master/prompts.md:693 +msgid "The `spin` function requires the `pcntl` PHP extension to animate the spinner. When this extension is not available, a static version of the spinner will appear instead." msgstr "" -#: docs/10.x/prompts.md:block 165 (header) +# P +#: ./docs/10.x/prompts.md:667 +#: ./docs/11.x/prompts.md:868 +#: ./docs/master/prompts.md:695 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/prompts.md:668 +#: ./docs/11.x/prompts.md:869 +#: ./docs/master/prompts.md:696 msgid "Progress Bars" msgstr "" -#: docs/10.x/prompts.md:block 166 (paragraph) +# P +#: ./docs/10.x/prompts.md:670 +#: ./docs/11.x/prompts.md:871 +#: ./docs/master/prompts.md:698 msgid "For long running tasks, it can be helpful to show a progress bar that informs users how complete the task is. Using the `progress` function, Laravel will display a progress bar and advance its progress for each iteration over a given iterable value:" msgstr "" -#: docs/10.x/prompts.md:block 167 (code) +# CODE: php +#: ./docs/11.x/prompts.md:670 +msgid "$ids = multisearch(\n" +" label: 'Search for the users that should receive the mail',\n" +" placeholder: 'E.g. Taylor Otwell',\n" +" options: fn (string $value) => strlen($value) > 0\n" +" ? User::whereLike('name', \"%{$value}%\")->pluck('name', 'id')->all()\n" +" : [],\n" +" hint: 'The user will receive an email immediately.'\n" +");" +msgstr "" + +# CODE: php +#: ./docs/10.x/prompts.md:672 +#: ./docs/master/prompts.md:700 msgid "use function Laravel\\Prompts\\progress;\n\n" "$users = progress(\n" " label: 'Updating users',\n" " steps: User::all(),\n" " callback: fn ($user) => $this->performTask($user),\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 168 (paragraph) +# P +#: ./docs/10.x/prompts.md:682 +#: ./docs/11.x/prompts.md:883 +#: ./docs/master/prompts.md:710 msgid "The `progress` function acts like a map function and will return an array containing the return value of each iteration of your callback." msgstr "" -#: docs/10.x/prompts.md:block 169 (paragraph) +# CODE: php +#: ./docs/11.x/prompts.md:683 +msgid "$ids = multisearch(\n" +" label: 'Search for the users that should receive the mail',\n" +" options: fn (string $value) => strlen($value) > 0\n" +" ? User::whereLike('name', \"%{$value}%\")->pluck('name', 'id')->all()\n" +" : [],\n" +" scroll: 10\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:684 +#: ./docs/master/prompts.md:712 msgid "The callback may also accept the `\\Laravel\\Prompts\\Progress` instance, allowing you to modify the label and hint on each iteration:" msgstr "" -#: docs/10.x/prompts.md:block 170 (code) +# CODE: php +#: ./docs/10.x/prompts.md:686 +#: ./docs/master/prompts.md:714 msgid "$users = progress(\n" " label: 'Updating users',\n" " steps: User::all(),\n" @@ -787,14 +1837,31 @@ msgid "$users = progress(\n" " return $this->performTask($user);\n" " },\n" " hint: 'This may take some time.',\n" -");\n" +");" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:698 +msgid "$ids = multisearch(\n" +" label: 'Search for the users that should receive the mail',\n" +" options: fn (string $value) => strlen($value) > 0\n" +" ? User::whereLike('name', \"%{$value}%\")->pluck('name', 'id')->all()\n" +" : [],\n" +" required: true\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 171 (paragraph) +# P +#: ./docs/10.x/prompts.md:701 +#: ./docs/11.x/prompts.md:902 +#: ./docs/master/prompts.md:729 msgid "Sometimes, you may need more manual control over how a progress bar is advanced. First, define the total number of steps the process will iterate through. Then, advance the progress bar via the `advance` method after processing each item:" msgstr "" -#: docs/10.x/prompts.md:block 172 (code) +# CODE: php +#: ./docs/10.x/prompts.md:703 +#: ./docs/11.x/prompts.md:904 +#: ./docs/master/prompts.md:731 msgid "$progress = progress(label: 'Updating users', steps: 10);\n\n" "$users = User::all();\n\n" "$progress->start();\n\n" @@ -802,69 +1869,208 @@ msgid "$progress = progress(label: 'Updating users', steps: 10);\n\n" " $this->performTask($user);\n\n" " $progress->advance();\n" "}\n\n" -"$progress->finish();\n" +"$progress->finish();" msgstr "" -#: docs/10.x/prompts.md:block 174 (header) +# CODE: php +#: ./docs/11.x/prompts.md:710 +msgid "$ids = multisearch(\n" +" label: 'Search for the users that should receive the mail',\n" +" options: fn (string $value) => strlen($value) > 0\n" +" ? User::whereLike('name', \"%{$value}%\")->pluck('name', 'id')->all()\n" +" : [],\n" +" required: 'You must select at least one user.'\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:719 +#: ./docs/11.x/prompts.md:931 +#: ./docs/master/prompts.md:747 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/prompts.md:720 +#: ./docs/11.x/prompts.md:932 +#: ./docs/master/prompts.md:748 msgid "Terminal Considerations" msgstr "" -#: docs/10.x/prompts.md:block 176 (header) +# P +#: ./docs/10.x/prompts.md:722 +#: ./docs/11.x/prompts.md:934 +#: ./docs/master/prompts.md:750 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/prompts.md:723 +#: ./docs/11.x/prompts.md:935 +#: ./docs/master/prompts.md:751 msgid "Terminal Width" msgstr "" -#: docs/10.x/prompts.md:block 177 (paragraph) +# P +#: ./docs/10.x/prompts.md:725 +#: ./docs/11.x/prompts.md:937 +#: ./docs/master/prompts.md:753 msgid "If the length of any label, option, or validation message exceeds the number of \"columns\" in the user's terminal, it will be automatically truncated to fit. Consider minimizing the length of these strings if your users may be using narrower terminals. A typically safe maximum length is 74 characters to support an 80-character terminal." msgstr "" -#: docs/10.x/prompts.md:block 179 (header) +# CODE: php +#: ./docs/11.x/prompts.md:725 +msgid "$ids = multisearch(\n" +" label: 'Search for the users that should receive the mail',\n" +" options: fn (string $value) => strlen($value) > 0\n" +" ? User::whereLike('name', \"%{$value}%\")->pluck('name', 'id')->all()\n" +" : [],\n" +" validate: function (array $values) {\n" +" $optedOut = User::whereLike('name', '%a%')->findMany($values);\n\n" +" if ($optedOut->isNotEmpty()) {\n" +" return $optedOut->pluck('name')->join(', ', ', and ').' have opted out.';\n" +" }\n" +" }\n" +");" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:727 +#: ./docs/11.x/prompts.md:939 +#: ./docs/master/prompts.md:755 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/prompts.md:728 +#: ./docs/11.x/prompts.md:940 +#: ./docs/master/prompts.md:756 msgid "Terminal Height" msgstr "" -#: docs/10.x/prompts.md:block 180 (paragraph) +# P +#: ./docs/10.x/prompts.md:730 +#: ./docs/11.x/prompts.md:942 +#: ./docs/master/prompts.md:758 msgid "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." msgstr "" -#: docs/10.x/prompts.md:block 182 (header) -msgid "Unsupported Environments & Fallbacks" +# P +#: ./docs/10.x/prompts.md:732 +#: ./docs/11.x/prompts.md:944 +#: ./docs/master/prompts.md:760 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/prompts.md:733 +#: ./docs/11.x/prompts.md:945 +#: ./docs/master/prompts.md:761 +msgid "Unsupported Environments and Fallbacks" msgstr "" -#: docs/10.x/prompts.md:block 183 (paragraph) +# P +#: ./docs/10.x/prompts.md:735 +#: ./docs/11.x/prompts.md:947 +#: ./docs/master/prompts.md:763 msgid "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." msgstr "" -#: docs/10.x/prompts.md:block 184 (paragraph) +# P +#: ./docs/10.x/prompts.md:737 msgid "For this reason, Laravel Prompts supports falling back to an alternative implementation such as the [Symfony Console Question Helper](https://symfony.com/doc/current/components/console/helpers/questionhelper.html)." msgstr "" -#: docs/10.x/prompts.md:block 185 (quote) -msgid "**Note** When using Laravel Prompts with the Laravel framework, fallbacks for each prompt have been configured for you and will be automatically enabled in unsupported environments." +# P +#: ./docs/10.x/prompts.md:740 +#: ./docs/11.x/prompts.md:952 +#: ./docs/master/prompts.md:768 +msgid "When using Laravel Prompts with the Laravel framework, fallbacks for each prompt have been configured for you and will be automatically enabled in unsupported environments." msgstr "" -#: docs/10.x/prompts.md:block 187 (header) +# P +#: ./docs/10.x/prompts.md:742 +#: ./docs/11.x/prompts.md:954 +#: ./docs/master/prompts.md:770 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/prompts.md:743 +#: ./docs/11.x/prompts.md:955 +#: ./docs/master/prompts.md:771 msgid "Fallback Conditions" msgstr "" -#: docs/10.x/prompts.md:block 188 (paragraph) +# P +#: ./docs/10.x/prompts.md:745 +#: ./docs/11.x/prompts.md:957 +#: ./docs/master/prompts.md:773 msgid "If you are not using Laravel or need to customize when the fallback behavior is used, you may pass a boolean to the `fallbackWhen` static method on the `Prompt` class:" msgstr "" -#: docs/10.x/prompts.md:block 189 (code) +# CODE: php +#: ./docs/10.x/prompts.md:747 +#: ./docs/11.x/prompts.md:959 +#: ./docs/master/prompts.md:775 msgid "use Laravel\\Prompts\\Prompt;\n\n" "Prompt::fallbackWhen(\n" " ! $input->isInteractive() || windows_os() || app()->runningUnitTests()\n" -");\n" +");" msgstr "" -#: docs/10.x/prompts.md:block 191 (header) +# P +#: ./docs/11.x/prompts.md:754 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/prompts.md:755 +#: ./docs/11.x/prompts.md:967 +#: ./docs/master/prompts.md:783 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/prompts.md:755 +msgid "Transforming Input Before Validation" +msgstr "" + +# H4 +#: ./docs/10.x/prompts.md:756 +#: ./docs/11.x/prompts.md:968 +#: ./docs/master/prompts.md:784 msgid "Fallback Behavior" msgstr "" -#: docs/10.x/prompts.md:block 192 (paragraph) +# P +#: ./docs/11.x/prompts.md:757 +msgid "Sometimes you may want to transform the prompt input before validation takes place. For example, you may wish to remove white space from any provided strings. To accomplish this, many of the prompt functions provide a `transform` argument, which accepts a closure:" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:758 +#: ./docs/11.x/prompts.md:970 +#: ./docs/master/prompts.md:786 msgid "If you are not using Laravel or need to customize the fallback behavior, you may pass a closure to the `fallbackUsing` static method on each prompt class:" msgstr "" -#: docs/10.x/prompts.md:block 193 (code) +# CODE: php +#: ./docs/11.x/prompts.md:759 +msgid "$name = text(\n" +" label: 'What is your name?',\n" +" transform: fn (string $value) => trim($value),\n" +" validate: fn (string $value) => match (true) {\n" +" strlen($value) < 3 => 'The name must be at least 3 characters.',\n" +" strlen($value) > 255 => 'The name must not exceed 255 characters.',\n" +" default => null\n" +" }\n" +");" +msgstr "" + +# CODE: php +#: ./docs/10.x/prompts.md:760 +#: ./docs/master/prompts.md:788 msgid "use Laravel\\Prompts\\TextPrompt;\n" "use Symfony\\Component\\Console\\Question\\Question;\n" "use Symfony\\Component\\Console\\Style\\SymfonyStyle;\n\n" @@ -884,10 +2090,186 @@ msgid "use Laravel\\Prompts\\TextPrompt;\n" " });\n\n" " return (new SymfonyStyle($input, $output))\n" " ->askQuestion($question);\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/11.x/prompts.md:771 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/prompts.md:772 +msgid "Forms" +msgstr "" + +# P +#: ./docs/11.x/prompts.md:774 +msgid "Often, you will have multiple prompts that will be displayed in sequence to collect information before performing additional actions. You may use the `form` function to create a grouped set of prompts for the user to complete:" msgstr "" -#: docs/10.x/prompts.md:block 194 (paragraph) +# CODE: php +#: ./docs/11.x/prompts.md:776 +msgid "use function Laravel\\Prompts\\form;\n\n" +"$responses = form()\n" +" ->text('What is your name?', required: true)\n" +" ->password('What is your password?', validate: ['password' => 'min:8'])\n" +" ->confirm('Do you accept the terms?')\n" +" ->submit();" +msgstr "" + +# P +#: ./docs/11.x/prompts.md:786 +msgid "The `submit` method will return a numerically indexed array containing all of the responses from the form's prompts. However, you may provide a name for each prompt via the `name` argument. When a name is provided, the named prompt's response may be accessed via that name:" +msgstr "" + +# P +#: ./docs/10.x/prompts.md:788 +#: ./docs/11.x/prompts.md:1002 +#: ./docs/master/prompts.md:816 msgid "Fallbacks must be configured individually for each prompt class. The closure will receive an instance of the prompt class and must return an appropriate type for the prompt." msgstr "" +# CODE: php +#: ./docs/11.x/prompts.md:788 +msgid "use App\\Models\\User;\n" +"use function Laravel\\Prompts\\form;\n\n" +"$responses = form()\n" +" ->text('What is your name?', required: true, name: 'name')\n" +" ->password(\n" +" label: 'What is your password?',\n" +" validate: ['password' => 'min:8'],\n" +" name: 'password'\n" +" )\n" +" ->confirm('Do you accept the terms?')\n" +" ->submit();\n\n" +"User::create([\n" +" 'name' => $responses['name'],\n" +" 'password' => $responses['password'],\n" +"]);" +msgstr "" + +# P +#: ./docs/11.x/prompts.md:808 +msgid "The primary benefit of using the `form` function is the ability for the user to return to previous prompts in the form using `CTRL + U`. This allows the user to fix mistakes or alter selections without needing to cancel and restart the entire form." +msgstr "" + +# P +#: ./docs/11.x/prompts.md:810 +msgid "If you need more granular control over a prompt in a form, you may invoke the `add` method instead of calling one of the prompt functions directly. The `add` method is passed all previous responses provided by the user:" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:812 +msgid "use function Laravel\\Prompts\\form;\n" +"use function Laravel\\Prompts\\outro;\n\n" +"$responses = form()\n" +" ->text('What is your name?', required: true, name: 'name')\n" +" ->add(function ($responses) {\n" +" return text(\"How old are you, {$responses['name']}?\");\n" +" }, name: 'age')\n" +" ->submit();\n\n" +"outro(\"Your name is {$responses['name']} and you are {$responses['age']} years old.\");" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:842 +msgid "use function Laravel\\Prompts\\table;\n\n" +"table(\n" +" headers: ['Name', 'Email'],\n" +" rows: User::all(['name', 'email'])->toArray()\n" +");" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:856 +msgid "use function Laravel\\Prompts\\spin;\n\n" +"$response = spin(\n" +" message: 'Fetching response...',\n" +" callback: fn () => Http::get('http://example.com')\n" +");" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:873 +msgid "use function Laravel\\Prompts\\progress;\n\n" +"$users = progress(\n" +" label: 'Updating users',\n" +" steps: User::all(),\n" +" callback: fn ($user) => $this->performTask($user)\n" +");" +msgstr "" + +# P +#: ./docs/11.x/prompts.md:885 +msgid "The callback may also accept the `Laravel\\Prompts\\Progress` instance, allowing you to modify the label and hint on each iteration:" +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:887 +msgid "$users = progress(\n" +" label: 'Updating users',\n" +" steps: User::all(),\n" +" callback: function ($user, $progress) {\n" +" $progress\n" +" ->label(\"Updating {$user->name}\")\n" +" ->hint(\"Created on {$user->created_at}\");\n\n" +" return $this->performTask($user);\n" +" },\n" +" hint: 'This may take some time.'\n" +");" +msgstr "" + +# P +#: ./docs/11.x/prompts.md:920 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/prompts.md:921 +msgid "Clearing the Terminal" +msgstr "" + +# P +#: ./docs/11.x/prompts.md:923 +msgid "The `clear` function may be used to clear the user's terminal:" +msgstr "" + +# CODE +#: ./docs/11.x/prompts.md:925 +msgid "use function Laravel\\Prompts\\clear;\n\n" +"clear();" +msgstr "" + +# P +#: ./docs/11.x/prompts.md:949 +#: ./docs/master/prompts.md:765 +msgid "For this reason, Laravel Prompts supports falling back to an alternative implementation such as the [Symfony Console Question Helper](https://symfony.com/doc/7.0/components/console/helpers/questionhelper.html)." +msgstr "" + +# CODE: php +#: ./docs/11.x/prompts.md:972 +msgid "use Laravel\\Prompts\\TextPrompt;\n" +"use Symfony\\Component\\Console\\Question\\Question;\n" +"use Symfony\\Component\\Console\\Style\\SymfonyStyle;\n\n" +"TextPrompt::fallbackUsing(function (TextPrompt $prompt) use ($input, $output) {\n" +" $question = (new Question($prompt->label, $prompt->default ?: null))\n" +" ->setValidator(function ($answer) use ($prompt) {\n" +" if ($prompt->required && $answer === null) {\n" +" throw new \\RuntimeException(\n" +" is_string($prompt->required) ? $prompt->required : 'Required.'\n" +" );\n" +" }\n\n" +" if ($prompt->validate) {\n" +" $error = ($prompt->validate)($answer ?? '');\n\n" +" if ($error) {\n" +" throw new \\RuntimeException($error);\n" +" }\n" +" }\n\n" +" return $answer;\n" +" });\n\n" +" return (new SymfonyStyle($input, $output))\n" +" ->askQuestion($question);\n" +"});" +msgstr "" + diff --git a/po/zh_TW/providers.po b/po/zh_TW/providers.po index 0b9845d1c..94db8ae35 100644 --- a/po/zh_TW/providers.po +++ b/po/zh_TW/providers.po @@ -10,107 +10,256 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Language-Team: Chinese Traditional\n" "Language: zh_TW\n" -"PO-Revision-Date: 2024-06-30 08:15\n" - -#: docs/10.x/providers.md:block 1 (header) +"PO-Revision-Date: 2024-11-30 08:39\n" + +# H1 +#: ./docs/8.x/providers.md:1 +#: ./docs/9.x/providers.md:1 +#: ./docs/10.x/providers.md:1 +#: ./docs/11.x/providers.md:1 +#: ./docs/master/providers.md:1 msgid "Service Providers" -msgstr "Service Provider" +msgstr "" -#: docs/10.x/providers.md:block 2 (unordered list) +# P +#: ./docs/8.x/providers.md:3 +#: ./docs/9.x/providers.md:3 +#: ./docs/10.x/providers.md:3 +#: ./docs/11.x/providers.md:3 +#: ./docs/master/providers.md:3 msgid "[Introduction](#introduction)" -msgstr "[簡介](#introduction)" +msgstr "" -#: docs/10.x/providers.md:block 2 (unordered list) +# P +#: ./docs/8.x/providers.md:4 +#: ./docs/9.x/providers.md:4 +#: ./docs/10.x/providers.md:4 +#: ./docs/11.x/providers.md:4 +#: ./docs/master/providers.md:4 msgid "[Writing Service Providers](#writing-service-providers)" -msgstr "[撰寫 ServiceProvider](#writing-service-providers)" +msgstr "" -#: docs/10.x/providers.md:block 2 (unordered list) +# P +#: ./docs/8.x/providers.md:5 +#: ./docs/9.x/providers.md:5 +#: ./docs/10.x/providers.md:5 +#: ./docs/11.x/providers.md:5 +#: ./docs/master/providers.md:5 msgid "[The Register Method](#the-register-method)" -msgstr "[Register 方法](#the-register-method)" +msgstr "" -#: docs/10.x/providers.md:block 2 (unordered list) +# P +#: ./docs/8.x/providers.md:6 +#: ./docs/9.x/providers.md:6 +#: ./docs/10.x/providers.md:6 +#: ./docs/11.x/providers.md:6 +#: ./docs/master/providers.md:6 msgid "[The Boot Method](#the-boot-method)" -msgstr "[Boot 方法](#the-boot-method)" +msgstr "" -#: docs/10.x/providers.md:block 2 (unordered list) +# P +#: ./docs/8.x/providers.md:7 +#: ./docs/9.x/providers.md:7 +#: ./docs/10.x/providers.md:7 +#: ./docs/11.x/providers.md:7 +#: ./docs/master/providers.md:7 msgid "[Registering Providers](#registering-providers)" -msgstr "[註冊 Provider](#registering-providers)" +msgstr "" -#: docs/10.x/providers.md:block 2 (unordered list) +# P +#: ./docs/8.x/providers.md:8 +#: ./docs/9.x/providers.md:8 +#: ./docs/10.x/providers.md:8 +#: ./docs/11.x/providers.md:8 +#: ./docs/master/providers.md:8 msgid "[Deferred Providers](#deferred-providers)" -msgstr "[延遲的 Provider](#deferred-providers)" +msgstr "" -#: docs/10.x/providers.md:block 4 (header) +# P +#: ./docs/8.x/providers.md:10 +#: ./docs/9.x/providers.md:10 +#: ./docs/10.x/providers.md:10 +#: ./docs/11.x/providers.md:10 +#: ./docs/master/providers.md:10 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/providers.md:11 +#: ./docs/9.x/providers.md:11 +#: ./docs/10.x/providers.md:11 +#: ./docs/11.x/providers.md:11 +#: ./docs/master/providers.md:11 msgid "Introduction" -msgstr "簡介" +msgstr "" -#: docs/10.x/providers.md:block 5 (paragraph) +# P +#: ./docs/8.x/providers.md:13 +#: ./docs/9.x/providers.md:13 +#: ./docs/10.x/providers.md:13 +#: ./docs/11.x/providers.md:13 +#: ./docs/master/providers.md:13 msgid "Service providers are the central place of all Laravel application bootstrapping. Your own application, as well as all of Laravel's core services, are bootstrapped via service providers." -msgstr "Service Provider 是 Laravel 中負責啟動應用程式的中心點。不過是你自己開發的應用程式,還是 Laravel 的核心服務,都是使用 Service Provider 啟動的。" +msgstr "" -#: docs/10.x/providers.md:block 6 (paragraph) +# P +#: ./docs/8.x/providers.md:15 +#: ./docs/9.x/providers.md:15 +#: ./docs/10.x/providers.md:15 +#: ./docs/11.x/providers.md:15 +#: ./docs/master/providers.md:15 msgid "But, what do we mean by \"bootstrapped\"? In general, we mean **registering** things, including registering service container bindings, event listeners, middleware, and even routes. Service providers are the central place to configure your application." -msgstr "不過,「啟動」是什麼意思呢?一般來說,我們指的是 **註冊** 一些東西,包含註冊 Service Container 的繫結、事件監聽常式、Middleware、甚至是 Route。Service Provider 是用來設定應用程式的中心點。" +msgstr "" -#: docs/10.x/providers.md:block 7 (paragraph) +# P +#: ./docs/11.x/providers.md:17 +#: ./docs/master/providers.md:17 +msgid "Laravel uses dozens of service providers internally to bootstrap its core services, such as the mailer, queue, cache, and others. Many of these providers are \"deferred\" providers, meaning they will not be loaded on every request, but only when the services they provide are actually needed." +msgstr "" + +# P +#: ./docs/8.x/providers.md:17 +#: ./docs/9.x/providers.md:17 +#: ./docs/10.x/providers.md:17 msgid "If you open the `config/app.php` file included with Laravel, you will see a `providers` array. These are all of the service provider classes that will be loaded for your application. By default, a set of Laravel core service providers are listed in this array. These providers bootstrap the core Laravel components, such as the mailer, queue, cache, and others. Many of these providers are \"deferred\" providers, meaning they will not be loaded on every request, but only when the services they provide are actually needed." -msgstr "若打開 Laravel 中的 `config/app.php`,可以看到一個 `providers` 陣列。這個陣列中的就是你的程式會載入的所有 Service Provider。預設情況下,這個陣列中列出了一組 Laravel 的核心 Service Provider。這些 Provider 會啟動 Laravel 的核心元件,如:Mailer、佇列 (Queue)⋯⋯等。其中的許多 Provider 是屬於「延遲的」Provider,延遲的 Provider 是指:不是所有 Request 中都會載入這些 Provider,只有在我們有需要這些 Provider 提供的服務時才會載入。" +msgstr "" -#: docs/10.x/providers.md:block 8 (paragraph) +# P +#: ./docs/11.x/providers.md:19 +#: ./docs/master/providers.md:19 +msgid "All user-defined service providers are registered in the `bootstrap/providers.php` file. In the following documentation, you will learn how to write your own service providers and register them with your Laravel application." +msgstr "" + +# P +#: ./docs/8.x/providers.md:19 +#: ./docs/9.x/providers.md:19 +#: ./docs/10.x/providers.md:19 msgid "In this overview, you will learn how to write your own service providers and register them with your Laravel application." -msgstr "在本篇概覽中,讀者將可以學習到如何撰寫你自己的 Service Provider,並將這些 Provider 註冊到 Laravel 專案上。" +msgstr "" -#: docs/10.x/providers.md:block 9 (quote) -msgid "**Note** If you would like to learn more about how Laravel handles requests and works internally, check out our documentation on the Laravel [request lifecycle](/docs/{{version}}/lifecycle)." -msgstr "**Note** 若想瞭解 Laravel 如何處理 Request 以及其內部如何運作,請參考我們有關 Laravel [Request 的生命週期](/docs/{{version}}/lifecycle)說明文件。" +# P +#: ./docs/8.x/providers.md:21 +#: ./docs/9.x/providers.md:22 +#: ./docs/10.x/providers.md:22 +#: ./docs/11.x/providers.md:22 +#: ./docs/master/providers.md:22 +msgid "If you would like to learn more about how Laravel handles requests and works internally, check out our documentation on the Laravel [request lifecycle](/docs/{{version}}/lifecycle)." +msgstr "" -#: docs/10.x/providers.md:block 11 (header) +# P +#: ./docs/8.x/providers.md:23 +#: ./docs/9.x/providers.md:24 +#: ./docs/10.x/providers.md:24 +#: ./docs/11.x/providers.md:24 +#: ./docs/master/providers.md:24 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/providers.md:24 +#: ./docs/9.x/providers.md:25 +#: ./docs/10.x/providers.md:25 +#: ./docs/11.x/providers.md:25 +#: ./docs/master/providers.md:25 msgid "Writing Service Providers" -msgstr "撰寫 Service Provider" +msgstr "" -#: docs/10.x/providers.md:block 12 (paragraph) +# P +#: ./docs/8.x/providers.md:26 +#: ./docs/9.x/providers.md:27 +#: ./docs/10.x/providers.md:27 +#: ./docs/11.x/providers.md:27 +#: ./docs/master/providers.md:27 msgid "All service providers extend the `Illuminate\\Support\\ServiceProvider` class. Most service providers contain a `register` and a `boot` method. Within the `register` method, you should **only bind things into the [service container](/docs/{{version}}/container)**. You should never attempt to register any event listeners, routes, or any other piece of functionality within the `register` method." -msgstr "所有的 Service Provider 都繼承自 `Illuminate\\Support\\ServiceProvider`。大多數的 Service Provider 都包含了 `registe` 與 `boot` 方法。`register` 方法 **只負責將事物繫結到 [Service Container](/docs/{{version}}/container)** 上。請絕對不要在 `register` 方法中註冊任何事件監聽常式、Route、或是任何其他的功能。" +msgstr "" -#: docs/10.x/providers.md:block 13 (paragraph) +# P +#: ./docs/8.x/providers.md:28 +#: ./docs/9.x/providers.md:29 +#: ./docs/10.x/providers.md:29 +#: ./docs/master/providers.md:29 msgid "The Artisan CLI can generate a new provider via the `make:provider` command:" -msgstr "Artisan CLI 提供了一個 `make:provider` 指令來新增新 Provider:" +msgstr "" -#: docs/10.x/providers.md:block 14 (code) -msgid "php artisan make:provider RiakServiceProvider\n" -msgstr "php artisan make:provider RiakServiceProvider\n" +# P +#: ./docs/11.x/providers.md:29 +msgid "The Artisan CLI can generate a new provider via the `make:provider` command. Laravel will automatically register your new provider in your application's `bootstrap/providers.php` file:" +msgstr "" -#: docs/10.x/providers.md:block 16 (header) +# CODE +# CODE: shell +#: ./docs/8.x/providers.md:30 +#: ./docs/9.x/providers.md:31 +#: ./docs/10.x/providers.md:31 +#: ./docs/11.x/providers.md:31 +#: ./docs/master/providers.md:31 +msgid "php artisan make:provider RiakServiceProvider" +msgstr "" + +# P +#: ./docs/8.x/providers.md:32 +#: ./docs/9.x/providers.md:35 +#: ./docs/10.x/providers.md:35 +#: ./docs/11.x/providers.md:35 +#: ./docs/master/providers.md:35 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/providers.md:33 +#: ./docs/9.x/providers.md:36 +#: ./docs/10.x/providers.md:36 +#: ./docs/11.x/providers.md:36 +#: ./docs/master/providers.md:36 msgid "The Register Method" -msgstr "Register 方法" +msgstr "" -#: docs/10.x/providers.md:block 17 (paragraph) +# P +#: ./docs/8.x/providers.md:35 +#: ./docs/9.x/providers.md:38 +#: ./docs/10.x/providers.md:38 +#: ./docs/11.x/providers.md:38 +#: ./docs/master/providers.md:38 msgid "As mentioned previously, within the `register` method, you should only bind things into the [service container](/docs/{{version}}/container). You should never attempt to register any event listeners, routes, or any other piece of functionality within the `register` method. Otherwise, you may accidentally use a service that is provided by a service provider which has not loaded yet." -msgstr "剛才也提到過,在 `register` 方法中應只能將東西註冊到 [Service Provider](/docs/{{version}}/container) 內。絕對不要嘗試在 `register` 方法內註冊事件監聽常式、Route、或其他任何功能。否則,我們可能會不小心使用到還沒載入的 Service Provider 提供的服務。" +msgstr "" -#: docs/10.x/providers.md:block 18 (paragraph) +# P +#: ./docs/8.x/providers.md:37 +#: ./docs/9.x/providers.md:40 +#: ./docs/10.x/providers.md:40 +#: ./docs/11.x/providers.md:40 +#: ./docs/master/providers.md:40 msgid "Let's take a look at a basic service provider. Within any of your service provider methods, you always have access to the `$app` property which provides access to the service container:" -msgstr "來看看一個基礎的 Service Provider。在 Service Provider 中的任何方法都可以存取一個 `$app` 屬性,該屬性可用來存取 Service Container:" +msgstr "" -#: docs/10.x/providers.md:block 19 (code) +# CODE +#: ./docs/8.x/providers.md:39 +#: ./docs/9.x/providers.md:42 msgid "app->singleton(Connection::class, function (Application $app) {\n" +" $this->app->singleton(Connection::class, function ($app) {\n" " return new Connection(config('riak'));\n" " });\n" " }\n" -"}\n" -msgstr "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/providers.md:64 +#: ./docs/9.x/providers.md:67 msgid "The `bindings` And `singletons` Properties" -msgstr "`bindings` 與 `singletons` 屬性" +msgstr "" -#: docs/10.x/providers.md:block 23 (paragraph) +# H4 +#: ./docs/10.x/providers.md:66 +#: ./docs/11.x/providers.md:66 +#: ./docs/master/providers.md:66 +msgid "The `bindings` and `singletons` Properties" +msgstr "" + +# P +#: ./docs/8.x/providers.md:66 +#: ./docs/9.x/providers.md:69 +#: ./docs/10.x/providers.md:68 +#: ./docs/11.x/providers.md:68 +#: ./docs/master/providers.md:68 msgid "If your service provider registers many simple bindings, you may wish to use the `bindings` and `singletons` properties instead of manually registering each container binding. When the service provider is loaded by the framework, it will automatically check for these properties and register their bindings:" -msgstr "若你的 Service Provider 會註冊很多的繫結,則可以使用 `bindings` 或 `singletons` 屬性,而不用手動註冊個別的 Container 繫結。Laravel 載入這個 Service Provider 後,會自動檢查這些屬性並註冊這些繫結:" +msgstr "" -#: docs/10.x/providers.md:block 24 (code) +# CODE +#: ./docs/8.x/providers.md:68 +#: ./docs/9.x/providers.md:71 +#: ./docs/10.x/providers.md:70 +#: ./docs/11.x/providers.md:70 +#: ./docs/master/providers.md:70 msgid " PingdomDowntimeNotifier::class,\n" " ServerProvider::class => ServerToolsProvider::class,\n" " ];\n" -"}\n" -msgstr " DigitalOceanServerProvider::class,\n" -" ];\n\n" -" /**\n" -" * All of the container singletons that should be registered.\n" -" *\n" -" * @var array\n" -" */\n" -" public $singletons = [\n" -" DowntimeNotifier::class => PingdomDowntimeNotifier::class,\n" -" ServerProvider::class => ServerToolsProvider::class,\n" -" ];\n" -"}\n" +"}" +msgstr "" -#: docs/10.x/providers.md:block 26 (header) +# P +#: ./docs/8.x/providers.md:101 +#: ./docs/9.x/providers.md:104 +#: ./docs/10.x/providers.md:103 +#: ./docs/11.x/providers.md:103 +#: ./docs/master/providers.md:103 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/8.x/providers.md:102 +#: ./docs/9.x/providers.md:105 +#: ./docs/10.x/providers.md:104 +#: ./docs/11.x/providers.md:104 +#: ./docs/master/providers.md:104 msgid "The Boot Method" -msgstr "Boot 方法" +msgstr "" -#: docs/10.x/providers.md:block 27 (paragraph) +# P +#: ./docs/8.x/providers.md:104 +#: ./docs/9.x/providers.md:107 +#: ./docs/10.x/providers.md:106 +#: ./docs/11.x/providers.md:106 +#: ./docs/master/providers.md:106 msgid "So, what if we need to register a [view composer](/docs/{{version}}/views#view-composers) within our service provider? This should be done within the `boot` method. **This method is called after all other service providers have been registered**, meaning you have access to all other services that have been registered by the framework:" -msgstr "那麼,若我們想在 Service Provider 內註冊 [View Composer] 該怎麼辦呢?我們可以在 `boot` 方法中註冊。**這個方法會在所有 Service Provider 都註冊好後才被呼叫**,這表示,我們就可以存取所有 Laravel 中已註冊好的服務:" +msgstr "" -#: docs/10.x/providers.md:block 28 (code) +# CODE +#: ./docs/8.x/providers.md:106 +#: ./docs/9.x/providers.md:109 msgid "" +#~ msgstr "" + +# H4 +#: ./docs/8.x/providers.md:129 +#: ./docs/9.x/providers.md:132 +#: ./docs/10.x/providers.md:129 +#: ./docs/11.x/providers.md:129 +#: ./docs/master/providers.md:129 msgid "Boot Method Dependency Injection" -msgstr "Boot 方法的相依性插入" +msgstr "" -#: docs/10.x/providers.md:block 31 (paragraph) +# P +#: ./docs/8.x/providers.md:131 +#: ./docs/9.x/providers.md:134 +#: ./docs/10.x/providers.md:131 +#: ./docs/11.x/providers.md:131 +#: ./docs/master/providers.md:131 msgid "You may type-hint dependencies for your service provider's `boot` method. The [service container](/docs/{{version}}/container) will automatically inject any dependencies you need:" -msgstr "在 Service Provider 中,若 `boot` 方法有相依性 (Dependency),我們可以在該方法上做型別提示 (Type-Hint)。[Service Container](/docs/{{version}}/container) 會自動為你插入所有所需的相依性:" +msgstr "" -#: docs/10.x/providers.md:block 32 (code) +# CODE +#: ./docs/10.x/providers.md:133 +#: ./docs/11.x/providers.md:133 +#: ./docs/master/providers.md:133 msgid "use Illuminate\\Contracts\\Routing\\ResponseFactory;\n\n" "/**\n" " * Bootstrap any application services.\n" @@ -258,57 +466,168 @@ msgid "use Illuminate\\Contracts\\Routing\\ResponseFactory;\n\n" " $response->macro('serialized', function (mixed $value) {\n" " // ...\n" " });\n" -"}\n" -msgstr "use Illuminate\\Contracts\\Routing\\ResponseFactory;\n\n" +"}" +msgstr "" + +# CODE +#: ./docs/8.x/providers.md:133 +#: ./docs/9.x/providers.md:136 +msgid "use Illuminate\\Contracts\\Routing\\ResponseFactory;\n\n" "/**\n" " * Bootstrap any application services.\n" +" *\n" +" * @param \\Illuminate\\Contracts\\Routing\\ResponseFactory $response\n" +" * @return void\n" " */\n" -"public function boot(ResponseFactory $response): void\n" +"public function boot(ResponseFactory $response)\n" "{\n" -" $response->macro('serialized', function (mixed $value) {\n" -" // ...\n" +" $response->macro('serialized', function ($value) {\n" +" //\n" " });\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/providers.md:148 +msgid "All service providers are registered in the `config/app.php` configuration file. This file contains a `providers` array where you can list the class names of your service providers. By default, a set of Laravel core service providers are registered in this array. The default providers bootstrap the core Laravel components, such as the mailer, queue, cache, and others." +msgstr "" + +# P +#: ./docs/11.x/providers.md:148 +#: ./docs/master/providers.md:148 +msgid "All service providers are registered in the `bootstrap/providers.php` configuration file. This file returns an array that contains the class names of your application's service providers:" +msgstr "" -#: docs/10.x/providers.md:block 34 (header) +# P +#: ./docs/8.x/providers.md:148 +#: ./docs/9.x/providers.md:151 +#: ./docs/10.x/providers.md:145 +#: ./docs/11.x/providers.md:145 +#: ./docs/master/providers.md:145 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/providers.md:149 +#: ./docs/9.x/providers.md:152 +#: ./docs/10.x/providers.md:146 +#: ./docs/11.x/providers.md:146 +#: ./docs/master/providers.md:146 msgid "Registering Providers" -msgstr "註冊 Provider" +msgstr "" -#: docs/10.x/providers.md:block 35 (paragraph) -msgid "All service providers are registered in the `config/app.php` configuration file. This file contains a `providers` array where you can list the class names of your service providers. By default, a set of Laravel core service providers are registered in this array. The default providers bootstrap the core Laravel components, such as the mailer, queue, cache, and others." -msgstr "`config/app.php` 中註冊了所有的 Provider。這個檔案中包含了一個 `providers` 陣列,我們可以在其中列出所有 Service Provider 的類別名稱。預設情況下,這個陣列中已經註冊了一組 Laravel 的核心 Service Provider。預設的這些 Provider 負責啟動 Laravel 的核心元件,如:Mailer、佇列、快取⋯⋯等。" +# CODE +#: ./docs/11.x/providers.md:150 +msgid " ServiceProvider::defaultProviders()->merge([\n" " // Other Service Providers\n\n" " App\\Providers\\ComposerServiceProvider::class,\n" -"])->toArray(),\n" -msgstr "'providers' => ServiceProvider::defaultProviders()->merge([\n" -" // 其他 Service Provider\n\n" +"])->toArray()," +msgstr "" + +# P +#: ./docs/8.x/providers.md:153 +#: ./docs/9.x/providers.md:156 +#: ./docs/10.x/providers.md:150 +msgid "To register your provider, add it to the array:" +msgstr "" + +# CODE +#: ./docs/8.x/providers.md:155 +#: ./docs/9.x/providers.md:158 +msgid "'providers' => [\n" +" // Other Service Providers\n\n" " App\\Providers\\ComposerServiceProvider::class,\n" -"])->toArray(),\n" +"]," +msgstr "" + +# P +#: ./docs/11.x/providers.md:156 +#: ./docs/master/providers.md:158 +msgid "When you invoke the `make:provider` Artisan command, Laravel will automatically add the generated provider to the `bootstrap/providers.php` file. However, if you have manually created the provider class, you should manually add the provider class to the array:" +msgstr "" + +# CODE +#: ./docs/11.x/providers.md:158 +msgid "" +#~ msgstr "" + +# H2 +#: ./docs/8.x/providers.md:162 +#: ./docs/9.x/providers.md:165 +#: ./docs/10.x/providers.md:159 +#: ./docs/11.x/providers.md:166 +#: ./docs/master/providers.md:170 msgid "Deferred Providers" -msgstr "延遲的 Provider" +msgstr "" -#: docs/10.x/providers.md:block 40 (paragraph) +# P +#: ./docs/8.x/providers.md:164 +#: ./docs/9.x/providers.md:167 +#: ./docs/10.x/providers.md:161 +#: ./docs/11.x/providers.md:168 +#: ./docs/master/providers.md:172 msgid "If your provider is **only** registering bindings in the [service container](/docs/{{version}}/container), you may choose to defer its registration until one of the registered bindings is actually needed. Deferring the loading of such a provider will improve the performance of your application, since it is not loaded from the filesystem on every request." -msgstr "若 Provider **只有** 向 [Service Container](/docs/{{version}}/container) 註冊繫結,則可以選擇將其註冊過程延遲到真正有需要這些繫結時才註冊。由於我們就不需要每個 Request 都從檔案系統中載入這些 Provider,因此延遲載入這類 Provider 可以提升你程式的效能。" +msgstr "" -#: docs/10.x/providers.md:block 41 (paragraph) +# P +#: ./docs/8.x/providers.md:166 +#: ./docs/9.x/providers.md:169 +#: ./docs/10.x/providers.md:163 +#: ./docs/11.x/providers.md:170 +#: ./docs/master/providers.md:174 msgid "Laravel compiles and stores a list of all of the services supplied by deferred service providers, along with the name of its service provider class. Then, only when you attempt to resolve one of these services does Laravel load the service provider." -msgstr "Laravel 會編譯並保存延遲的 Service Provider 名稱、以及其所提供的 Service 列表。接著,當有需要解析其中一個 Service 時,Laravel 就會載入這個 Service Provider:" - -#: docs/10.x/providers.md:block 42 (paragraph) -msgid "To defer the loading of a provider, implement the `\\Illuminate\\Contracts\\Support\\DeferrableProvider` interface and define a `provides` method. The `provides` method should return the service container bindings registered by the provider:" -msgstr "若要延遲載入 Provider,請實作 `\\Illuminate\\Contracts\\Support\\DeferrableProvider` 介面,並定義 `provides` 方法。`provides` 方法應回傳該 Provider 中註冊的 Service Container 繫結:" +msgstr "" -#: docs/10.x/providers.md:block 43 (code) +# CODE +#: ./docs/10.x/providers.md:167 +#: ./docs/11.x/providers.md:174 +#: ./docs/master/providers.md:178 msgid "app->singleton(Connection::class, function (Application $app) {\n" -" return new Connection($app['config']['riak']);\n" -" });\n" -" }\n\n" -" /**\n" -" * Get the services provided by the provider.\n" -" *\n" -" * @return array\n" -" */\n" -" public function provides(): array\n" -" {\n" -" return [Connection::class];\n" -" }\n" -"}\n" - -#: docs/8.x/providers.md:block 9 (quote) -msgid "{tip} If you would like to learn more about how Laravel handles requests and works internally, check out our documentation on the Laravel [request lifecycle](/docs/{{version}}/lifecycle)." -msgstr "{tip} 若想瞭解 Laravel 如何處理 Request 以及其內部如何運作,請參考我們有關 Laravel [Request 的生命週期](/docs/{{version}}/lifecycle)說明文件。" - -#: docs/8.x/providers.md:block 19 (code) -msgid "app->singleton(Connection::class, function ($app) {\n" -" return new Connection(config('riak'));\n" -" });\n" -" }\n" -"}\n" -msgstr "app->singleton(Connection::class, function ($app) {\n" -" return new Connection(config('riak'));\n" -" });\n" -" }\n" -"}\n" - -#: docs/8.x/providers.md:block 28 (code) -msgid "macro('serialized', function ($value) {\n" -" //\n" -" });\n" -"}\n" -msgstr "use Illuminate\\Contracts\\Routing\\ResponseFactory;\n\n" -"/**\n" -" * Bootstrap any application services.\n" -" *\n" -" * @param \\Illuminate\\Contracts\\Routing\\ResponseFactory $response\n" -" * @return void\n" -" */\n" -"public function boot(ResponseFactory $response)\n" -"{\n" -" $response->macro('serialized', function ($value) {\n" -" //\n" -" });\n" -"}\n" - -#: docs/8.x/providers.md:block 35 (paragraph) -msgid "All service providers are registered in the `config/app.php` configuration file. This file contains a `providers` array where you can list the class names of your service providers. By default, a set of Laravel core service providers are listed in this array. These providers bootstrap the core Laravel components, such as the mailer, queue, cache, and others." -msgstr "`config/app.php` 中註冊了所有的 Provider。這個檔案中包含了一個 `providers` 陣列,我們可以在其中列出所有 Service Provider 的類別名稱。預設情況下,這個陣列中已經有一組 Laravel 的核心 Service Provider。這些 Provider 負責啟動 Laravel 的核心元件,如:Mailer、佇列、快取⋯⋯等。" +"}" +msgstr "" -#: docs/8.x/providers.md:block 37 (code) -msgid "'providers' => [\n" -" // Other Service Providers\n\n" -" App\\Providers\\ComposerServiceProvider::class,\n" -"],\n" -msgstr "'providers' => [\n" -" // 其他 Service Provider\n\n" -" App\\Providers\\ComposerServiceProvider::class,\n" -"],\n" +# P +#: ./docs/8.x/providers.md:168 +#: ./docs/9.x/providers.md:171 +#: ./docs/10.x/providers.md:165 +#: ./docs/11.x/providers.md:172 +#: ./docs/master/providers.md:176 +msgid "To defer the loading of a provider, implement the `\\Illuminate\\Contracts\\Support\\DeferrableProvider` interface and define a `provides` method. The `provides` method should return the service container bindings registered by the provider:" +msgstr "" -#: docs/8.x/providers.md:block 43 (code) +# CODE +#: ./docs/8.x/providers.md:170 +#: ./docs/9.x/providers.md:173 msgid "app->singleton(Connection::class, function ($app) {\n" -" return new Connection($app['config']['riak']);\n" -" });\n" -" }\n\n" -" /**\n" -" * Get the services provided by the provider.\n" -" *\n" -" * @return array\n" -" */\n" -" public function provides()\n" -" {\n" -" return [Connection::class];\n" -" }\n" -"}\n" +"}" +msgstr "" diff --git a/po/zh_TW/pulse.po b/po/zh_TW/pulse.po new file mode 100644 index 000000000..d9147f863 --- /dev/null +++ b/po/zh_TW/pulse.po @@ -0,0 +1,2257 @@ +msgid "" +msgstr "" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Crowdin-Project: laravel-docs\n" +"X-Crowdin-Project-ID: 447952\n" +"X-Crowdin-Language: zh-TW\n" +"X-Crowdin-File: /main/templates/pulse.pot\n" +"X-Crowdin-File-ID: 196\n" +"Project-Id-Version: laravel-docs\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Language-Team: Chinese Traditional\n" +"Language: zh_TW\n" +"PO-Revision-Date: 2024-11-30 08:39\n" + +# H1 +#: ./docs/10.x/pulse.md:1 +#: ./docs/11.x/pulse.md:1 +#: ./docs/master/pulse.md:1 +msgid "Laravel Pulse" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:3 +#: ./docs/11.x/pulse.md:3 +#: ./docs/master/pulse.md:3 +msgid "[Introduction](#introduction)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:4 +#: ./docs/11.x/pulse.md:4 +#: ./docs/master/pulse.md:4 +msgid "[Installation](#installation)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:5 +#: ./docs/11.x/pulse.md:5 +#: ./docs/master/pulse.md:5 +msgid "[Configuration](#configuration)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:6 +#: ./docs/11.x/pulse.md:6 +#: ./docs/master/pulse.md:6 +msgid "[Dashboard](#dashboard)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:7 +#: ./docs/11.x/pulse.md:7 +#: ./docs/master/pulse.md:7 +msgid "[Authorization](#dashboard-authorization)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:8 +#: ./docs/11.x/pulse.md:8 +#: ./docs/master/pulse.md:8 +msgid "[Customization](#dashboard-customization)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:9 +#: ./docs/11.x/pulse.md:9 +#: ./docs/master/pulse.md:9 +msgid "[Resolving Users](#dashboard-resolving-users)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:10 +#: ./docs/11.x/pulse.md:10 +#: ./docs/master/pulse.md:10 +msgid "[Cards](#dashboard-cards)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:11 +#: ./docs/11.x/pulse.md:11 +#: ./docs/master/pulse.md:11 +msgid "[Capturing Entries](#capturing-entries)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:12 +#: ./docs/11.x/pulse.md:12 +#: ./docs/master/pulse.md:12 +msgid "[Recorders](#recorders)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:13 +#: ./docs/11.x/pulse.md:13 +#: ./docs/master/pulse.md:13 +msgid "[Filtering](#filtering)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:14 +#: ./docs/11.x/pulse.md:14 +#: ./docs/master/pulse.md:14 +msgid "[Performance](#performance)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:15 +#: ./docs/11.x/pulse.md:15 +#: ./docs/master/pulse.md:15 +msgid "[Using a Different Database](#using-a-different-database)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:16 +#: ./docs/11.x/pulse.md:16 +#: ./docs/master/pulse.md:16 +msgid "[Redis Ingest](#ingest)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:17 +#: ./docs/11.x/pulse.md:17 +#: ./docs/master/pulse.md:17 +msgid "[Sampling](#sampling)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:18 +#: ./docs/11.x/pulse.md:18 +#: ./docs/master/pulse.md:18 +msgid "[Trimming](#trimming)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:19 +#: ./docs/11.x/pulse.md:19 +#: ./docs/master/pulse.md:19 +msgid "[Handling Pulse Exceptions](#pulse-exceptions)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:20 +#: ./docs/11.x/pulse.md:20 +#: ./docs/master/pulse.md:20 +msgid "[Custom Cards](#custom-cards)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:21 +#: ./docs/11.x/pulse.md:21 +#: ./docs/master/pulse.md:21 +msgid "[Card Components](#custom-card-components)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:22 +#: ./docs/11.x/pulse.md:22 +#: ./docs/master/pulse.md:22 +msgid "[Styling](#custom-card-styling)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:23 +#: ./docs/11.x/pulse.md:23 +#: ./docs/master/pulse.md:23 +msgid "[Data Capture and Aggregation](#custom-card-data)" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:25 +#: ./docs/11.x/pulse.md:25 +#: ./docs/master/pulse.md:25 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/pulse.md:26 +#: ./docs/11.x/pulse.md:26 +#: ./docs/master/pulse.md:26 +msgid "Introduction" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:28 +#: ./docs/11.x/pulse.md:28 +#: ./docs/master/pulse.md:28 +msgid "[Laravel Pulse](https://github.com/laravel/pulse) delivers at-a-glance insights into your application's performance and usage. With Pulse, you can track down bottlenecks like slow jobs and endpoints, find your most active users, and more." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:30 +#: ./docs/11.x/pulse.md:30 +#: ./docs/master/pulse.md:30 +msgid "For in-depth debugging of individual events, check out [Laravel Telescope](/docs/{{version}}/telescope)." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:32 +#: ./docs/11.x/pulse.md:32 +#: ./docs/master/pulse.md:32 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/pulse.md:33 +#: ./docs/11.x/pulse.md:33 +#: ./docs/master/pulse.md:33 +msgid "Installation" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:36 +#: ./docs/master/pulse.md:36 +msgid "Pulse's first-party storage implementation currently requires a MySQL or PostgreSQL database. If you are using a different database engine, you will need a separate MySQL or PostgreSQL database for your Pulse data." +msgstr "" + +# P +#: ./docs/11.x/pulse.md:36 +msgid "Pulse's first-party storage implementation currently requires a MySQL, MariaDB, or PostgreSQL database. If you are using a different database engine, you will need a separate MySQL, MariaDB, or PostgreSQL database for your Pulse data." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:38 +#: ./docs/master/pulse.md:38 +msgid "Since Pulse is currently in beta, you may need to adjust your application's `composer.json` file to allow beta package releases to be installed:" +msgstr "" + +# P +#: ./docs/11.x/pulse.md:38 +msgid "You may install Pulse using the Composer package manager:" +msgstr "" + +# CODE: json +#: ./docs/10.x/pulse.md:40 +#: ./docs/master/pulse.md:40 +msgid "\"minimum-stability\": \"beta\",\n" +"\"prefer-stable\": true" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:45 +#: ./docs/master/pulse.md:45 +msgid "Then, you may use the Composer package manager to install Pulse into your Laravel project:" +msgstr "" + +# CODE: sh +#: ./docs/10.x/pulse.md:47 +#: ./docs/11.x/pulse.md:40 +#: ./docs/master/pulse.md:47 +msgid "composer require laravel/pulse" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:51 +#: ./docs/11.x/pulse.md:44 +#: ./docs/master/pulse.md:51 +msgid "Next, you should publish the Pulse configuration and migration files using the `vendor:publish` Artisan command:" +msgstr "" + +# CODE: shell +#: ./docs/10.x/pulse.md:53 +#: ./docs/11.x/pulse.md:46 +#: ./docs/master/pulse.md:53 +msgid "php artisan vendor:publish --provider=\"Laravel\\Pulse\\PulseServiceProvider\"" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:57 +#: ./docs/11.x/pulse.md:50 +#: ./docs/master/pulse.md:57 +msgid "Finally, you should run the `migrate` command in order to create the tables needed to store Pulse's data:" +msgstr "" + +# CODE: shell +#: ./docs/10.x/pulse.md:59 +#: ./docs/11.x/pulse.md:52 +#: ./docs/master/pulse.md:59 +msgid "php artisan migrate" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:63 +#: ./docs/11.x/pulse.md:56 +#: ./docs/master/pulse.md:63 +msgid "Once Pulse's database migrations have been run, you may access the Pulse dashboard via the `/pulse` route." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:66 +#: ./docs/11.x/pulse.md:59 +#: ./docs/master/pulse.md:66 +msgid "If you do not want to store Pulse data in your application's primary database, you may [specify a dedicated database connection](#using-a-different-database)." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:68 +#: ./docs/11.x/pulse.md:61 +#: ./docs/master/pulse.md:68 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:69 +#: ./docs/11.x/pulse.md:62 +#: ./docs/master/pulse.md:69 +msgid "Configuration" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:71 +#: ./docs/11.x/pulse.md:64 +#: ./docs/master/pulse.md:71 +msgid "Many of Pulse's configuration options can be controlled using environment variables. To see the available options, register new recorders, or configure advanced options, you may publish the `config/pulse.php` configuration file:" +msgstr "" + +# CODE: sh +#: ./docs/10.x/pulse.md:73 +#: ./docs/11.x/pulse.md:66 +#: ./docs/master/pulse.md:73 +msgid "php artisan vendor:publish --tag=pulse-config" +msgstr "" + +# P +#: ./docs/11.x/pulse.md:76 +#: ./docs/master/pulse.md:83 +msgid "The Pulse dashboard may be accessed via the `/pulse` route. By default, you will only be able to access this dashboard in the `local` environment, so you will need to configure authorization for your production environments by customizing the `'viewPulse'` authorization gate. You can accomplish this within your application's `app/Providers/AppServiceProvider.php` file:" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:77 +#: ./docs/11.x/pulse.md:70 +#: ./docs/master/pulse.md:77 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/pulse.md:78 +#: ./docs/11.x/pulse.md:71 +#: ./docs/master/pulse.md:78 +msgid "Dashboard" +msgstr "" + +# CODE: php +#: ./docs/11.x/pulse.md:78 +#: ./docs/master/pulse.md:85 +msgid "use App\\Models\\User;\n" +"use Illuminate\\Support\\Facades\\Gate;\n\n" +"/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Gate::define('viewPulse', function (User $user) {\n" +" return $user->isAdmin();\n" +" });\n\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:80 +#: ./docs/11.x/pulse.md:73 +#: ./docs/master/pulse.md:80 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:81 +#: ./docs/11.x/pulse.md:74 +#: ./docs/master/pulse.md:81 +msgid "Authorization" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:83 +msgid "The Pulse dashboard may be accessed via the `/pulse` route. By default, you will only be able to access this dashboard in the `local` environment, so you will need to configure authorization for your production environments by customizing the `'viewPulse'` authorization gate. You can accomplish this within your application's `app/Providers/AuthServiceProvider.php` file:" +msgstr "" + +# CODE: php +#: ./docs/10.x/pulse.md:85 +msgid "use App\\Models\\User;\n" +"use Illuminate\\Support\\Facades\\Gate;\n\n" +"/**\n" +" * Register any authentication / authorization services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Gate::define('viewPulse', function (User $user) {\n" +" return $user->isAdmin();\n" +" });\n\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:102 +#: ./docs/11.x/pulse.md:95 +#: ./docs/master/pulse.md:102 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:103 +#: ./docs/11.x/pulse.md:96 +#: ./docs/master/pulse.md:103 +msgid "Customization" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:105 +#: ./docs/11.x/pulse.md:98 +#: ./docs/master/pulse.md:105 +msgid "The Pulse dashboard cards and layout may be configured by publishing the dashboard view. The dashboard view will be published to `resources/views/vendor/pulse/dashboard.blade.php`:" +msgstr "" + +# CODE: sh +#: ./docs/10.x/pulse.md:107 +#: ./docs/11.x/pulse.md:100 +#: ./docs/master/pulse.md:107 +msgid "php artisan vendor:publish --tag=pulse-dashboard" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:111 +#: ./docs/11.x/pulse.md:104 +#: ./docs/master/pulse.md:111 +msgid "The dashboard is powered by [Livewire](https://livewire.laravel.com/), and allows you to customize the cards and layout without needing to rebuild any JavaScript assets." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:113 +#: ./docs/11.x/pulse.md:106 +#: ./docs/master/pulse.md:113 +msgid "Within this file, the `` component is responsible for rendering the dashboard and provides a grid layout for the cards. If you would like the dashboard to span the full width of the screen, you may provide the `full-width` prop to the component:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/pulse.md:115 +#: ./docs/11.x/pulse.md:108 +#: ./docs/master/pulse.md:115 +msgid "\n" +" ...\n" +"" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:121 +#: ./docs/11.x/pulse.md:114 +#: ./docs/master/pulse.md:121 +msgid "By default, the `` component will create a 12 column grid, but you may customize this using the `cols` prop:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/pulse.md:123 +#: ./docs/11.x/pulse.md:116 +#: ./docs/master/pulse.md:123 +msgid "\n" +" ...\n" +"" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:129 +#: ./docs/11.x/pulse.md:122 +#: ./docs/master/pulse.md:129 +msgid "Each card accepts a `cols` and `rows` prop to control the space and positioning:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/pulse.md:131 +#: ./docs/11.x/pulse.md:124 +#: ./docs/master/pulse.md:131 +msgid "" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:135 +#: ./docs/11.x/pulse.md:128 +#: ./docs/master/pulse.md:135 +msgid "Most cards also accept an `expand` prop to show the full card instead of scrolling:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/pulse.md:137 +#: ./docs/11.x/pulse.md:130 +#: ./docs/master/pulse.md:137 +msgid "" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:141 +#: ./docs/11.x/pulse.md:134 +#: ./docs/master/pulse.md:141 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:142 +#: ./docs/11.x/pulse.md:135 +#: ./docs/master/pulse.md:142 +msgid "Resolving Users" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:144 +#: ./docs/11.x/pulse.md:137 +#: ./docs/master/pulse.md:144 +msgid "For cards that display information about your users, such as the Application Usage card, Pulse will only record the user's ID. When rendering the dashboard, Pulse will resolve the `name` and `email` fields from your default `Authenticatable` model and display avatars using the Gravatar web service." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:146 +#: ./docs/11.x/pulse.md:139 +#: ./docs/master/pulse.md:146 +msgid "You may customize the fields and avatar by invoking the `Pulse::user` method within your application's `App\\Providers\\AppServiceProvider` class." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:148 +#: ./docs/11.x/pulse.md:141 +#: ./docs/master/pulse.md:148 +msgid "The `user` method accepts a closure which will receive the `Authenticatable` model to be displayed and should return an array containing `name`, `extra`, and `avatar` information for the user:" +msgstr "" + +# CODE: php +#: ./docs/10.x/pulse.md:150 +#: ./docs/11.x/pulse.md:143 +#: ./docs/master/pulse.md:150 +msgid "use Laravel\\Pulse\\Facades\\Pulse;\n\n" +"/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Pulse::user(fn ($user) => [\n" +" 'name' => $user->name,\n" +" 'extra' => $user->email,\n" +" 'avatar' => $user->avatar_url,\n" +" ]);\n\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:169 +#: ./docs/11.x/pulse.md:162 +#: ./docs/master/pulse.md:169 +msgid "You may completely customize how the authenticated user is captured and retrieved by implementing the `Laravel\\Pulse\\Contracts\\ResolvesUsers` contract and binding it in Laravel's [service container](/docs/{{version}}/container#binding-a-singleton)." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:171 +#: ./docs/11.x/pulse.md:164 +#: ./docs/master/pulse.md:171 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:172 +#: ./docs/11.x/pulse.md:165 +#: ./docs/master/pulse.md:172 +msgid "Cards" +msgstr "" + +# P +#: ./docs/11.x/pulse.md:172 +msgid "If you replace a server in your infrastructure, you may wish to stop displaying the inactive server in the Pulse dashboard after a given duration. You may accomplish this using the `ignore-after` prop, which accepts the number of seconds after which inactive servers should be removed from the Pulse dashboard. Alternatively, you may provide a relative time formatted string, such as `1 hour` or `3 days and 1 hour`:" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:174 +#: ./docs/11.x/pulse.md:167 +#: ./docs/master/pulse.md:174 +#~ msgid "" +#~ msgstr "" + +# CODE: blade +#: ./docs/11.x/pulse.md:174 +msgid "" +msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:175 +#: ./docs/10.x/pulse.md:344 +#: ./docs/11.x/pulse.md:168 +#: ./docs/11.x/pulse.md:405 +#: ./docs/master/pulse.md:175 +#: ./docs/master/pulse.md:344 +msgid "Servers" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:177 +#: ./docs/11.x/pulse.md:170 +#: ./docs/master/pulse.md:177 +msgid "The `` card displays system resource usage for all servers running the `pulse:check` command. Please refer to the documentation regarding the [servers recorder](#servers-recorder) for more information on system resource reporting." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:179 +#: ./docs/11.x/pulse.md:178 +#: ./docs/master/pulse.md:179 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:180 +#: ./docs/11.x/pulse.md:179 +#: ./docs/master/pulse.md:180 +msgid "Application Usage" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:182 +#: ./docs/11.x/pulse.md:181 +#: ./docs/master/pulse.md:182 +msgid "The `` card displays the top 10 users making requests to your application, dispatching jobs, and experiencing slow requests." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:184 +#: ./docs/11.x/pulse.md:183 +#: ./docs/master/pulse.md:184 +msgid "If you wish to view all usage metrics on screen at the same time, you may include the card multiple times and specify the `type` attribute:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/pulse.md:186 +#: ./docs/11.x/pulse.md:185 +#: ./docs/master/pulse.md:186 +msgid "\n" +"\n" +"" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:192 +#: ./docs/11.x/pulse.md:191 +#: ./docs/master/pulse.md:192 +msgid "To learn how to customize how Pulse retrieves and displays user information, consult our documentation on [resolving users](#dashboard-resolving-users)." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:195 +#: ./docs/11.x/pulse.md:194 +#: ./docs/master/pulse.md:195 +msgid "If your application receives a lot of requests or dispatches a lot of jobs, you may wish to enable [sampling](#sampling). See the [user requests recorder](#user-requests-recorder), [user jobs recorder](#user-jobs-recorder), and [slow jobs recorder](#slow-jobs-recorder) documentation for more information." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:197 +#: ./docs/11.x/pulse.md:196 +#: ./docs/master/pulse.md:197 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:198 +#: ./docs/10.x/pulse.md:287 +#: ./docs/11.x/pulse.md:197 +#: ./docs/11.x/pulse.md:292 +#: ./docs/master/pulse.md:198 +#: ./docs/master/pulse.md:287 +msgid "Exceptions" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:200 +#: ./docs/11.x/pulse.md:199 +#: ./docs/master/pulse.md:200 +msgid "The `` card shows the frequency and recency of exceptions occurring in your application. By default, exceptions are grouped based on the exception class and location where it occurred. See the [exceptions recorder](#exceptions-recorder) documentation for more information." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:202 +#: ./docs/11.x/pulse.md:201 +#: ./docs/master/pulse.md:202 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:203 +#: ./docs/10.x/pulse.md:294 +#: ./docs/11.x/pulse.md:202 +#: ./docs/11.x/pulse.md:299 +#: ./docs/master/pulse.md:203 +#: ./docs/master/pulse.md:294 +msgid "Queues" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:205 +#: ./docs/11.x/pulse.md:204 +#: ./docs/master/pulse.md:205 +msgid "The `` card shows the throughput of the queues in your application, including the number of jobs queued, processing, processed, released, and failed. See the [queues recorder](#queues-recorder) documentation for more information." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:207 +#: ./docs/11.x/pulse.md:206 +#: ./docs/master/pulse.md:207 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:208 +#: ./docs/10.x/pulse.md:337 +#: ./docs/11.x/pulse.md:207 +#: ./docs/11.x/pulse.md:384 +#: ./docs/master/pulse.md:208 +#: ./docs/master/pulse.md:337 +msgid "Slow Requests" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:210 +#: ./docs/11.x/pulse.md:209 +#: ./docs/master/pulse.md:210 +msgid "The `` card shows incoming requests to your application that exceed the configured threshold, which is 1,000ms by default. See the [slow requests recorder](#slow-requests-recorder) documentation for more information." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:212 +#: ./docs/11.x/pulse.md:211 +#: ./docs/master/pulse.md:212 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:213 +#: ./docs/10.x/pulse.md:301 +#: ./docs/11.x/pulse.md:212 +#: ./docs/11.x/pulse.md:306 +#: ./docs/master/pulse.md:213 +#: ./docs/master/pulse.md:301 +msgid "Slow Jobs" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:215 +#: ./docs/11.x/pulse.md:214 +#: ./docs/master/pulse.md:215 +msgid "The `` card shows the queued jobs in your application that exceed the configured threshold, which is 1,000ms by default. See the [slow jobs recorder](#slow-jobs-recorder) documentation for more information." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:217 +#: ./docs/11.x/pulse.md:216 +#: ./docs/master/pulse.md:217 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:218 +#: ./docs/10.x/pulse.md:330 +#: ./docs/11.x/pulse.md:217 +#: ./docs/11.x/pulse.md:363 +#: ./docs/master/pulse.md:218 +#: ./docs/master/pulse.md:330 +msgid "Slow Queries" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:220 +#: ./docs/11.x/pulse.md:219 +#: ./docs/master/pulse.md:220 +msgid "The `` card shows the database queries in your application that exceed the configured threshold, which is 1,000ms by default." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:222 +#: ./docs/11.x/pulse.md:221 +#: ./docs/master/pulse.md:222 +msgid "By default, slow queries are grouped based on the SQL query (without bindings) and the location where it occurred, but you may choose to not capture the location if you wish to group solely on the SQL query." +msgstr "" + +# P +#: ./docs/11.x/pulse.md:223 +msgid "If you encounter rendering performance issues due to extremely large SQL queries receiving syntax highlighting, you may disable highlighting by adding the `without-highlighting` prop:" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:224 +#: ./docs/11.x/pulse.md:229 +#: ./docs/master/pulse.md:224 +msgid "See the [slow queries recorder](#slow-queries-recorder) documentation for more information." +msgstr "" + +# CODE: blade +#: ./docs/11.x/pulse.md:225 +msgid "" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:226 +#: ./docs/11.x/pulse.md:231 +#: ./docs/master/pulse.md:226 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:227 +#: ./docs/10.x/pulse.md:308 +#: ./docs/11.x/pulse.md:232 +#: ./docs/11.x/pulse.md:327 +#: ./docs/master/pulse.md:227 +#: ./docs/master/pulse.md:308 +msgid "Slow Outgoing Requests" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:229 +#: ./docs/11.x/pulse.md:234 +#: ./docs/master/pulse.md:229 +msgid "The `` card shows outgoing requests made using Laravel's [HTTP client](/docs/{{version}}/http-client) that exceed the configured threshold, which is 1,000ms by default." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:231 +#: ./docs/11.x/pulse.md:236 +#: ./docs/master/pulse.md:231 +msgid "By default, entries will be grouped by the full URL. However, you may wish to normalize or group similar outgoing requests using regular expressions. See the [slow outgoing requests recorder](#slow-outgoing-requests-recorder) documentation for more information." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:233 +#: ./docs/11.x/pulse.md:238 +#: ./docs/master/pulse.md:233 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:234 +#: ./docs/11.x/pulse.md:239 +#: ./docs/master/pulse.md:234 +msgid "Cache" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:236 +#: ./docs/11.x/pulse.md:241 +#: ./docs/master/pulse.md:236 +msgid "The `` card shows the cache hit and miss statistics for your application, both globally and for individual keys." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:238 +#: ./docs/11.x/pulse.md:243 +#: ./docs/master/pulse.md:238 +msgid "By default, entries will be grouped by key. However, you may wish to normalize or group similar keys using regular expressions. See the [cache interactions recorder](#cache-interactions-recorder) documentation for more information." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:240 +#: ./docs/11.x/pulse.md:245 +#: ./docs/master/pulse.md:240 +#~ msgid "" +#~ msgstr "" + +# H2 +# H4 +#: ./docs/10.x/pulse.md:241 +#: ./docs/10.x/pulse.md:627 +#: ./docs/11.x/pulse.md:246 +#: ./docs/11.x/pulse.md:688 +#: ./docs/master/pulse.md:241 +#: ./docs/master/pulse.md:627 +msgid "Capturing Entries" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:243 +#: ./docs/11.x/pulse.md:248 +#: ./docs/master/pulse.md:243 +msgid "Most Pulse recorders will automatically capture entries based on framework events dispatched by Laravel. However, the [servers recorder](#servers-recorder) and some third-party cards must poll for information regularly. To use these cards, you must run the `pulse:check` daemon on all of your individual application servers:" +msgstr "" + +# CODE: php +#: ./docs/10.x/pulse.md:245 +#: ./docs/11.x/pulse.md:250 +#: ./docs/master/pulse.md:245 +msgid "php artisan pulse:check" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:250 +#: ./docs/11.x/pulse.md:255 +#: ./docs/master/pulse.md:250 +msgid "To keep the `pulse:check` process running permanently in the background, you should use a process monitor such as Supervisor to ensure that the command does not stop running." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:252 +#: ./docs/11.x/pulse.md:257 +#: ./docs/master/pulse.md:252 +msgid "As the `pulse:check` command is a long-lived process, it will not see changes to your codebase without being restarted. You should gracefully restart the command by calling the `pulse:restart` command during your application's deployment process:" +msgstr "" + +# CODE: sh +#: ./docs/10.x/pulse.md:254 +#: ./docs/10.x/pulse.md:439 +#: ./docs/11.x/pulse.md:259 +#: ./docs/11.x/pulse.md:500 +#: ./docs/master/pulse.md:254 +#: ./docs/master/pulse.md:439 +msgid "php artisan pulse:restart" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:259 +#: ./docs/10.x/pulse.md:444 +#: ./docs/11.x/pulse.md:264 +#: ./docs/11.x/pulse.md:505 +#: ./docs/master/pulse.md:259 +#: ./docs/master/pulse.md:444 +msgid "Pulse uses the [cache](/docs/{{version}}/cache) to store restart signals, so you should verify that a cache driver is properly configured for your application before using this feature." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:261 +#: ./docs/11.x/pulse.md:266 +#: ./docs/master/pulse.md:261 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:262 +#: ./docs/11.x/pulse.md:267 +#: ./docs/master/pulse.md:262 +msgid "Recorders" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:264 +#: ./docs/11.x/pulse.md:269 +#: ./docs/master/pulse.md:264 +msgid "Recorders are responsible for capturing entries from your application to be recorded in the Pulse database. Recorders are registered and configured in the `recorders` section of the [Pulse configuration file](#configuration)." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:266 +#: ./docs/11.x/pulse.md:271 +#: ./docs/master/pulse.md:266 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:267 +#: ./docs/11.x/pulse.md:272 +#: ./docs/master/pulse.md:267 +msgid "Cache Interactions" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:269 +#: ./docs/11.x/pulse.md:274 +#: ./docs/master/pulse.md:269 +msgid "The `CacheInteractions` recorder captures information about the [cache](/docs/{{version}}/cache) hits and misses occurring in your application for display on the [Cache](#cache-card) card." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:271 +#: ./docs/11.x/pulse.md:276 +#: ./docs/master/pulse.md:271 +msgid "You may optionally adjust the [sample rate](#sampling) and ignored key patterns." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:273 +#: ./docs/11.x/pulse.md:278 +#: ./docs/master/pulse.md:273 +msgid "You may also configure key grouping so that similar keys are grouped as a single entry. For example, you may wish to remove unique IDs from keys caching the same type of information. Groups are configured using a regular expression to \"find and replace\" parts of the key. An example is included in the configuration file:" +msgstr "" + +# CODE: php +#: ./docs/10.x/pulse.md:275 +#: ./docs/11.x/pulse.md:280 +#: ./docs/master/pulse.md:275 +msgid "Recorders\\CacheInteractions::class => [\n" +" // ...\n" +" 'groups' => [\n" +" // '/:\\d+/' => ':*',\n" +" ],\n" +"]," +msgstr "" + +# P +#: ./docs/10.x/pulse.md:284 +#: ./docs/11.x/pulse.md:289 +#: ./docs/master/pulse.md:284 +msgid "The first pattern that matches will be used. If no patterns match, then the key will be captured as-is." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:286 +#: ./docs/11.x/pulse.md:291 +#: ./docs/master/pulse.md:286 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/pulse.md:289 +#: ./docs/11.x/pulse.md:294 +#: ./docs/master/pulse.md:289 +msgid "The `Exceptions` recorder captures information about reportable exceptions occurring in your application for display on the [Exceptions](#exceptions-card) card." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:291 +#: ./docs/11.x/pulse.md:296 +#: ./docs/master/pulse.md:291 +msgid "You may optionally adjust the [sample rate](#sampling) and ignored exceptions patterns. You may also configure whether to capture the location that the exception originated from. The captured location will be displayed on the Pulse dashboard which can help to track down the exception origin; however, if the same exception occurs in multiple locations then it will appear multiple times for each unique location." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:293 +#: ./docs/11.x/pulse.md:298 +#: ./docs/master/pulse.md:293 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/pulse.md:296 +#: ./docs/11.x/pulse.md:301 +#: ./docs/master/pulse.md:296 +msgid "The `Queues` recorder captures information about your applications queues for display on the [Queues](#queues-card)." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:298 +#: ./docs/11.x/pulse.md:303 +#: ./docs/master/pulse.md:298 +msgid "You may optionally adjust the [sample rate](#sampling) and ignored jobs patterns." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:300 +#: ./docs/11.x/pulse.md:305 +#: ./docs/master/pulse.md:300 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/pulse.md:303 +#: ./docs/11.x/pulse.md:308 +#: ./docs/master/pulse.md:303 +msgid "The `SlowJobs` recorder captures information about slow jobs occurring in your application for display on the [Slow Jobs](#slow-jobs-recorder) card." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:305 +#: ./docs/11.x/pulse.md:310 +#: ./docs/master/pulse.md:305 +msgid "You may optionally adjust the slow job threshold, [sample rate](#sampling), and ignored job patterns." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:307 +#: ./docs/11.x/pulse.md:326 +#: ./docs/master/pulse.md:307 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/pulse.md:310 +#: ./docs/11.x/pulse.md:329 +#: ./docs/master/pulse.md:310 +msgid "The `SlowOutgoingRequests` recorder captures information about outgoing HTTP requests made using Laravel's [HTTP client](/docs/{{version}}/http-client) that exceed the configured threshold for display on the [Slow Outgoing Requests](#slow-outgoing-requests-card) card." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:312 +#: ./docs/11.x/pulse.md:331 +#: ./docs/master/pulse.md:312 +msgid "You may optionally adjust the slow outgoing request threshold, [sample rate](#sampling), and ignored URL patterns." +msgstr "" + +# P +#: ./docs/11.x/pulse.md:312 +msgid "You may have some jobs that you expect to take longer than others. In those cases, you may configure per-job thresholds:" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:314 +#: ./docs/11.x/pulse.md:347 +#: ./docs/master/pulse.md:314 +msgid "You may also configure URL grouping so that similar URLs are grouped as a single entry. For example, you may wish to remove unique IDs from URL paths or group by domain only. Groups are configured using a regular expression to \"find and replace\" parts of the URL. Some examples are included in the configuration file:" +msgstr "" + +# CODE: php +#: ./docs/11.x/pulse.md:314 +msgid "Recorders\\SlowJobs::class => [\n" +" // ...\n" +" 'threshold' => [\n" +" '#^App\\\\Jobs\\\\GenerateYearlyReports$#' => 5000,\n" +" 'default' => env('PULSE_SLOW_JOBS_THRESHOLD', 1000),\n" +" ],\n" +"]," +msgstr "" + +# CODE: php +#: ./docs/10.x/pulse.md:316 +#: ./docs/master/pulse.md:316 +msgid "Recorders\\OutgoingRequests::class => [\n" +" // ...\n" +" 'groups' => [\n" +" // '#^https://api\\.github\\.com/repos/.*$#' => 'api.github.com/repos/*',\n" +" // '#^https?://([^/]*).*$#' => '\\1',\n" +" // '#/\\d+#' => '/*',\n" +" ],\n" +"]," +msgstr "" + +# P +#: ./docs/11.x/pulse.md:324 +msgid "If no regular expression patterns match the job's classname, then the `'default'` value will be used." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:327 +#: ./docs/11.x/pulse.md:360 +#: ./docs/master/pulse.md:327 +msgid "The first pattern that matches will be used. If no patterns match, then the URL will be captured as-is." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:329 +#: ./docs/11.x/pulse.md:362 +#: ./docs/master/pulse.md:329 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/pulse.md:332 +#: ./docs/11.x/pulse.md:365 +#: ./docs/master/pulse.md:332 +msgid "The `SlowQueries` recorder captures any database queries in your application that exceed the configured threshold for display on the [Slow Queries](#slow-queries-card) card." +msgstr "" + +# P +#: ./docs/11.x/pulse.md:333 +msgid "You may have some outgoing requests that you expect to take longer than others. In those cases, you may configure per-request thresholds:" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:334 +#: ./docs/11.x/pulse.md:367 +#: ./docs/master/pulse.md:334 +msgid "You may optionally adjust the slow query threshold, [sample rate](#sampling), and ignored query patterns. You may also configure whether to capture the query location. The captured location will be displayed on the Pulse dashboard which can help to track down the query origin; however, if the same query is made in multiple locations then it will appear multiple times for each unique location." +msgstr "" + +# CODE: php +#: ./docs/11.x/pulse.md:335 +msgid "Recorders\\SlowOutgoingRequests::class => [\n" +" // ...\n" +" 'threshold' => [\n" +" '#backup.zip$#' => 5000,\n" +" 'default' => env('PULSE_SLOW_OUTGOING_REQUESTS_THRESHOLD', 1000),\n" +" ],\n" +"]," +msgstr "" + +# P +#: ./docs/10.x/pulse.md:336 +#: ./docs/11.x/pulse.md:383 +#: ./docs/master/pulse.md:336 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/10.x/pulse.md:339 +#: ./docs/11.x/pulse.md:386 +#: ./docs/master/pulse.md:339 +msgid "The `Requests` recorder captures information about requests made to your application for display on the [Slow Requests](#slow-requests-card) and [Application Usage](#application-usage-card) cards." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:341 +#: ./docs/11.x/pulse.md:388 +#: ./docs/master/pulse.md:341 +msgid "You may optionally adjust the slow route threshold, [sample rate](#sampling), and ignored paths." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:343 +#: ./docs/11.x/pulse.md:404 +#: ./docs/master/pulse.md:343 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/11.x/pulse.md:345 +#: ./docs/11.x/pulse.md:402 +msgid "If no regular expression patterns match the request's URL, then the `'default'` value will be used." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:346 +#: ./docs/11.x/pulse.md:407 +#: ./docs/master/pulse.md:346 +msgid "The `Servers` recorder captures CPU, memory, and storage usage of the servers that power your application for display on the [Servers](#servers-card) card. This recorder requires the [`pulse:check` command](#capturing-entries) to be running on each of the servers you wish to monitor." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:348 +#: ./docs/11.x/pulse.md:409 +#: ./docs/master/pulse.md:348 +msgid "Each reporting server must have a unique name. By default, Pulse will use the value returned by PHP's `gethostname` function. If you wish to customize this, you may set the `PULSE_SERVER_NAME` environment variable:" +msgstr "" + +# CODE: php +#: ./docs/11.x/pulse.md:349 +msgid "Recorders\\SlowOutgoingRequests::class => [\n" +" // ...\n" +" 'groups' => [\n" +" // '#^https://api\\.github\\.com/repos/.*$#' => 'api.github.com/repos/*',\n" +" // '#^https?://([^/]*).*$#' => '\\1',\n" +" // '#/\\d+#' => '/*',\n" +" ],\n" +"]," +msgstr "" + +# CODE: env +#: ./docs/10.x/pulse.md:350 +#: ./docs/11.x/pulse.md:411 +#: ./docs/master/pulse.md:350 +msgid "PULSE_SERVER_NAME=load-balancer" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:354 +#: ./docs/11.x/pulse.md:415 +#: ./docs/master/pulse.md:354 +msgid "The Pulse configuration file also allows you to customize the directories that are monitored." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:356 +#: ./docs/11.x/pulse.md:417 +#: ./docs/master/pulse.md:356 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:357 +#: ./docs/11.x/pulse.md:418 +#: ./docs/master/pulse.md:357 +msgid "User Jobs" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:359 +#: ./docs/11.x/pulse.md:420 +#: ./docs/master/pulse.md:359 +msgid "The `UserJobs` recorder captures information about the users dispatching jobs in your application for display on the [Application Usage](#application-usage-card) card." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:361 +#: ./docs/10.x/pulse.md:368 +#: ./docs/11.x/pulse.md:422 +#: ./docs/master/pulse.md:361 +#: ./docs/master/pulse.md:368 +msgid "You may optionally adjust the [sample rate](#sampling) and ignored job patterns." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:363 +#: ./docs/11.x/pulse.md:424 +#: ./docs/master/pulse.md:363 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:364 +#: ./docs/11.x/pulse.md:425 +#: ./docs/master/pulse.md:364 +msgid "User Requests" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:366 +#: ./docs/11.x/pulse.md:427 +#: ./docs/master/pulse.md:366 +msgid "The `UserRequests` recorder captures information about the users making requests to your application for display on the [Application Usage](#application-usage-card) card." +msgstr "" + +# P +#: ./docs/11.x/pulse.md:369 +msgid "You may have some queries that you expect to take longer than others. In those cases, you may configure per-query thresholds:" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:370 +#: ./docs/11.x/pulse.md:431 +#: ./docs/master/pulse.md:370 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:371 +#: ./docs/11.x/pulse.md:432 +#: ./docs/master/pulse.md:371 +msgid "Filtering" +msgstr "" + +# CODE: php +#: ./docs/11.x/pulse.md:371 +msgid "Recorders\\SlowQueries::class => [\n" +" // ...\n" +" 'threshold' => [\n" +" '#^insert into `yearly_reports`#' => 5000,\n" +" 'default' => env('PULSE_SLOW_QUERIES_THRESHOLD', 1000),\n" +" ],\n" +"]," +msgstr "" + +# P +#: ./docs/10.x/pulse.md:373 +#: ./docs/11.x/pulse.md:434 +#: ./docs/master/pulse.md:373 +msgid "As we have seen, many [recorders](#recorders) offer the ability to, via configuration, \"ignore\" incoming entries based on their value, such as a request's URL. But, sometimes it may be useful to filter out records based on other factors, such as the currently authenticated user. To filter out these records, you may pass a closure to Pulse's `filter` method. Typically, the `filter` method should be invoked within the `boot` method of your application's `AppServiceProvider`:" +msgstr "" + +# CODE: php +#: ./docs/10.x/pulse.md:375 +#: ./docs/11.x/pulse.md:436 +#: ./docs/master/pulse.md:375 +msgid "use Illuminate\\Support\\Facades\\Auth;\n" +"use Laravel\\Pulse\\Entry;\n" +"use Laravel\\Pulse\\Facades\\Pulse;\n" +"use Laravel\\Pulse\\Value;\n\n" +"/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Pulse::filter(function (Entry|Value $entry) {\n" +" return Auth::user()->isNotAdmin();\n" +" });\n\n" +" // ...\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/pulse.md:381 +msgid "If no regular expression patterns match the query's SQL, then the `'default'` value will be used." +msgstr "" + +# P +#: ./docs/11.x/pulse.md:390 +msgid "You may have some requests that you expect to take longer than others. In those cases, you may configure per-request thresholds:" +msgstr "" + +# CODE: php +#: ./docs/11.x/pulse.md:392 +msgid "Recorders\\SlowRequests::class => [\n" +" // ...\n" +" 'threshold' => [\n" +" '#^/admin/#' => 5000,\n" +" 'default' => env('PULSE_SLOW_REQUESTS_THRESHOLD', 1000),\n" +" ],\n" +"]," +msgstr "" + +# P +#: ./docs/10.x/pulse.md:394 +#: ./docs/11.x/pulse.md:455 +#: ./docs/master/pulse.md:394 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/pulse.md:395 +#: ./docs/11.x/pulse.md:456 +#: ./docs/master/pulse.md:395 +msgid "Performance" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:397 +#: ./docs/11.x/pulse.md:458 +#: ./docs/master/pulse.md:397 +msgid "Pulse has been designed to drop into an existing application without requiring any additional infrastructure. However, for high-traffic applications, there are several ways of removing any impact Pulse may have on your application's performance." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:399 +#: ./docs/11.x/pulse.md:460 +#: ./docs/master/pulse.md:399 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:400 +#: ./docs/11.x/pulse.md:461 +#: ./docs/master/pulse.md:400 +msgid "Using a Different Database" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:402 +#: ./docs/11.x/pulse.md:463 +#: ./docs/master/pulse.md:402 +msgid "For high-traffic applications, you may prefer to use a dedicated database connection for Pulse to avoid impacting your application database." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:404 +#: ./docs/11.x/pulse.md:465 +#: ./docs/master/pulse.md:404 +msgid "You may customize the [database connection](/docs/{{version}}/database#configuration) used by Pulse by setting the `PULSE_DB_CONNECTION` environment variable." +msgstr "" + +# CODE: env +#: ./docs/10.x/pulse.md:406 +#: ./docs/11.x/pulse.md:467 +#: ./docs/master/pulse.md:406 +msgid "PULSE_DB_CONNECTION=pulse" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:410 +#: ./docs/11.x/pulse.md:471 +#: ./docs/master/pulse.md:410 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:411 +#: ./docs/11.x/pulse.md:472 +#: ./docs/master/pulse.md:411 +msgid "Redis Ingest" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:414 +#: ./docs/11.x/pulse.md:475 +#: ./docs/master/pulse.md:414 +msgid "The Redis Ingest requires Redis 6.2 or greater and `phpredis` or `predis` as the application's configured Redis client driver." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:416 +#: ./docs/11.x/pulse.md:477 +#: ./docs/master/pulse.md:416 +msgid "By default, Pulse will store entries directly to the [configured database connection](#using-a-different-database) after the HTTP response has been sent to the client or a job has been processed; however, you may use Pulse's Redis ingest driver to send entries to a Redis stream instead. This can be enabled by configuring the `PULSE_INGEST_DRIVER` environment variable:" +msgstr "" + +# CODE +#: ./docs/10.x/pulse.md:418 +#: ./docs/11.x/pulse.md:479 +#: ./docs/master/pulse.md:418 +msgid "PULSE_INGEST_DRIVER=redis" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:422 +#: ./docs/11.x/pulse.md:483 +#: ./docs/master/pulse.md:422 +msgid "Pulse will use your default [Redis connection](/docs/{{version}}/redis#configuration) by default, but you may customize this via the `PULSE_REDIS_CONNECTION` environment variable:" +msgstr "" + +# CODE +#: ./docs/10.x/pulse.md:424 +#: ./docs/11.x/pulse.md:485 +#: ./docs/master/pulse.md:424 +msgid "PULSE_REDIS_CONNECTION=pulse" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:428 +#: ./docs/11.x/pulse.md:489 +#: ./docs/master/pulse.md:428 +msgid "When using the Redis ingest, you will need to run the `pulse:work` command to monitor the stream and move entries from Redis into Pulse's database tables." +msgstr "" + +# P +#: ./docs/11.x/pulse.md:429 +msgid "You may optionally adjust the [sample rate](#sampling) and ignored URL patterns." +msgstr "" + +# CODE: php +#: ./docs/10.x/pulse.md:430 +#: ./docs/11.x/pulse.md:491 +#: ./docs/master/pulse.md:430 +msgid "php artisan pulse:work" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:435 +#: ./docs/11.x/pulse.md:496 +#: ./docs/master/pulse.md:435 +msgid "To keep the `pulse:work` process running permanently in the background, you should use a process monitor such as Supervisor to ensure that the Pulse worker does not stop running." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:437 +#: ./docs/11.x/pulse.md:498 +#: ./docs/master/pulse.md:437 +msgid "As the `pulse:work` command is a long-lived process, it will not see changes to your codebase without being restarted. You should gracefully restart the command by calling the `pulse:restart` command during your application's deployment process:" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:446 +#: ./docs/11.x/pulse.md:507 +#: ./docs/master/pulse.md:446 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:447 +#: ./docs/11.x/pulse.md:508 +#: ./docs/master/pulse.md:447 +msgid "Sampling" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:449 +#: ./docs/11.x/pulse.md:510 +#: ./docs/master/pulse.md:449 +msgid "By default, Pulse will capture every relevant event that occurs in your application. For high-traffic applications, this can result in needing to aggregate millions of database rows in the dashboard, especially for longer time periods." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:451 +#: ./docs/11.x/pulse.md:512 +#: ./docs/master/pulse.md:451 +msgid "You may instead choose to enable \"sampling\" on certain Pulse data recorders. For example, setting the sample rate to `0.1` on the [`User Requests`](#user-requests-recorder) recorder will mean that you only record approximately 10% of the requests to your application. In the dashboard, the values will be scaled up and prefixed with a `~` to indicate that they are an approximation." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:453 +#: ./docs/11.x/pulse.md:514 +#: ./docs/master/pulse.md:453 +msgid "In general, the more entries you have for a particular metric, the lower you can safely set the sample rate without sacrificing too much accuracy." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:455 +#: ./docs/11.x/pulse.md:516 +#: ./docs/master/pulse.md:455 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:456 +#: ./docs/11.x/pulse.md:517 +#: ./docs/master/pulse.md:456 +msgid "Trimming" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:458 +#: ./docs/11.x/pulse.md:519 +#: ./docs/master/pulse.md:458 +msgid "Pulse will automatically trim its stored entries once they are outside of the dashboard window. Trimming occurs when ingesting data using a lottery system which may be customized in the Pulse [configuration file](#configuration)." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:460 +#: ./docs/11.x/pulse.md:521 +#: ./docs/master/pulse.md:460 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:461 +#: ./docs/11.x/pulse.md:522 +#: ./docs/master/pulse.md:461 +msgid "Handling Pulse Exceptions" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:463 +#: ./docs/11.x/pulse.md:524 +#: ./docs/master/pulse.md:463 +msgid "If an exception occurs while capturing Pulse data, such as being unable to connect to the storage database, Pulse will silently fail to avoid impacting your application." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:465 +#: ./docs/11.x/pulse.md:526 +#: ./docs/master/pulse.md:465 +msgid "If you wish to customize how these exceptions are handled, you may provide a closure to the `handleExceptionsUsing` method:" +msgstr "" + +# CODE: php +#: ./docs/10.x/pulse.md:467 +#: ./docs/11.x/pulse.md:528 +#: ./docs/master/pulse.md:467 +msgid "use Laravel\\Pulse\\Facades\\Pulse;\n" +"use Illuminate\\Support\\Facades\\Log;\n\n" +"Pulse::handleExceptionsUsing(function ($e) {\n" +" Log::debug('An exception happened in Pulse', [\n" +" 'message' => $e->getMessage(),\n" +" 'stack' => $e->getTraceAsString(),\n" +" ]);\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:479 +#: ./docs/11.x/pulse.md:540 +#: ./docs/master/pulse.md:479 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/10.x/pulse.md:480 +#: ./docs/11.x/pulse.md:541 +#: ./docs/master/pulse.md:480 +msgid "Custom Cards" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:482 +#: ./docs/11.x/pulse.md:543 +#: ./docs/master/pulse.md:482 +msgid "Pulse allows you to build custom cards to display data relevant to your application's specific needs. Pulse uses [Livewire](https://livewire.laravel.com), so you may want to [review its documentation](https://livewire.laravel.com/docs) before building your first custom card." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:484 +#: ./docs/11.x/pulse.md:545 +#: ./docs/master/pulse.md:484 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:485 +#: ./docs/11.x/pulse.md:546 +#: ./docs/master/pulse.md:485 +msgid "Card Components" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:487 +#: ./docs/11.x/pulse.md:548 +#: ./docs/master/pulse.md:487 +msgid "Creating a custom card in Laravel Pulse starts with extending the base `Card` Livewire component and defining a corresponding view:" +msgstr "" + +# CODE: php +#: ./docs/10.x/pulse.md:489 +#: ./docs/11.x/pulse.md:550 +#: ./docs/master/pulse.md:489 +msgid "namespace App\\Livewire\\Pulse;\n\n" +"use Laravel\\Pulse\\Livewire\\Card;\n" +"use Livewire\\Attributes\\Lazy;\n\n" +"#[Lazy]\n" +"class TopSellers extends Card\n" +"{\n" +" public function render()\n" +" {\n" +" return view('livewire.pulse.top-sellers');\n" +" }\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:505 +#: ./docs/11.x/pulse.md:566 +#: ./docs/master/pulse.md:505 +msgid "When using Livewire's [lazy loading](https://livewire.laravel.com/docs/lazy) feature, The `Card` component will automatically provide a placeholder that respects the `cols` and `rows` attributes passed to your component." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:507 +#: ./docs/11.x/pulse.md:568 +#: ./docs/master/pulse.md:507 +msgid "When writing your Pulse card's corresponding view, you may leverage Pulse's Blade components for a consistent look and feel:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/pulse.md:509 +#: ./docs/11.x/pulse.md:570 +#: ./docs/master/pulse.md:509 +msgid "\n" +" \n" +" \n" +" ...\n" +" \n" +" \n\n" +" \n" +" ...\n" +" \n" +"" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:523 +#: ./docs/11.x/pulse.md:584 +#: ./docs/master/pulse.md:523 +msgid "The `$cols`, `$rows`, `$class`, and `$expand` variables should be passed to their respective Blade components so the card layout may be customized from the dashboard view. You may also wish to include the `wire:poll.5s=\"\"` attribute in your view to have the card automatically update." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:525 +#: ./docs/11.x/pulse.md:586 +#: ./docs/master/pulse.md:525 +msgid "Once you have defined your Livewire component and template, the card may be included in your [dashboard view](#dashboard-customization):" +msgstr "" + +# CODE: blade +#: ./docs/10.x/pulse.md:527 +#: ./docs/11.x/pulse.md:588 +#: ./docs/master/pulse.md:527 +msgid "\n" +" ...\n\n" +" \n" +"" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:536 +#: ./docs/11.x/pulse.md:597 +#: ./docs/master/pulse.md:536 +msgid "If your card is included in a package, you will need to register the component with Livewire using the `Livewire::component` method." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:538 +#: ./docs/11.x/pulse.md:599 +#: ./docs/master/pulse.md:538 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/10.x/pulse.md:539 +#: ./docs/11.x/pulse.md:600 +#: ./docs/master/pulse.md:539 +msgid "Styling" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:541 +#: ./docs/11.x/pulse.md:602 +#: ./docs/master/pulse.md:541 +msgid "If your card requires additional styling beyond the classes and components included with Pulse, there are a few options for including custom CSS for your cards." +msgstr "" + +# P +#: ./docs/10.x/pulse.md:543 +#: ./docs/11.x/pulse.md:604 +#: ./docs/master/pulse.md:543 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:544 +#: ./docs/11.x/pulse.md:605 +#: ./docs/master/pulse.md:544 +msgid "Laravel Vite Integration" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:546 +#: ./docs/11.x/pulse.md:607 +#: ./docs/master/pulse.md:546 +msgid "If your custom card lives within your application's code base and you are using Laravel's [Vite integration](/docs/{{version}}/vite), you may update your `vite.config.js` file to include a dedicated CSS entry point for your card:" +msgstr "" + +# CODE: js +#: ./docs/10.x/pulse.md:548 +#: ./docs/11.x/pulse.md:609 +#: ./docs/master/pulse.md:548 +msgid "laravel({\n" +" input: [\n" +" 'resources/css/pulse/top-sellers.css',\n" +" // ...\n" +" ],\n" +"})," +msgstr "" + +# P +#: ./docs/10.x/pulse.md:557 +#: ./docs/11.x/pulse.md:618 +#: ./docs/master/pulse.md:557 +msgid "You may then use the `@vite` Blade directive in your [dashboard view](#dashboard-customization), specifying the CSS entrypoint for your card:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/pulse.md:559 +#: ./docs/11.x/pulse.md:620 +#: ./docs/master/pulse.md:559 +msgid "\n" +" @vite('resources/css/pulse/top-sellers.css')\n\n" +" ...\n" +"" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:567 +#: ./docs/11.x/pulse.md:628 +#: ./docs/master/pulse.md:567 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/pulse.md:568 +#: ./docs/11.x/pulse.md:629 +#: ./docs/master/pulse.md:568 +msgid "CSS Files" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:570 +#: ./docs/11.x/pulse.md:631 +#: ./docs/master/pulse.md:570 +msgid "For other use cases, including Pulse cards contained within a package, you may instruct Pulse to load additional stylesheets by defining a `css` method on your Livewire component that returns the file path to your CSS file:" +msgstr "" + +# CODE: php +#: ./docs/10.x/pulse.md:572 +#: ./docs/11.x/pulse.md:633 +#: ./docs/master/pulse.md:572 +msgid "class TopSellers extends Card\n" +"{\n" +" // ...\n\n" +" protected function css()\n" +" {\n" +" return __DIR__.'/../../dist/top-sellers.css';\n" +" }\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/pulse.md:584 +#: ./docs/11.x/pulse.md:645 +#: ./docs/master/pulse.md:584 +msgid "When this card is included on the dashboard, Pulse will automatically include the contents of this file within a `\n" -" \n" -"\n" +" @vite('resources/js/app.js')\n" +"" msgstr "" -#: docs/10.x/vite.md:block 65 (header) +# H2 +#: ./docs/9.x/vite.md:215 +#: ./docs/10.x/vite.md:260 +#: ./docs/11.x/vite.md:259 +#: ./docs/master/vite.md:260 msgid "Running Vite" -msgstr "執行 Vite" +msgstr "" -#: docs/10.x/vite.md:block 66 (paragraph) +# P +#: ./docs/9.x/vite.md:217 +#: ./docs/10.x/vite.md:262 +#: ./docs/11.x/vite.md:261 +#: ./docs/master/vite.md:262 msgid "There are two ways you can run Vite. You may run the development server via the `dev` command, which is useful while developing locally. The development server will automatically detect changes to your files and instantly reflect them in any open browser windows." -msgstr "要執行 Vite 有兩種方法。一種是使用 `dev` 指令來執行開發伺服器,適合用在本機環境開發時。開發伺服器會自動偵測任何檔案的修改,並自動反應到所有開啟的瀏覽器視窗中。" +msgstr "" -#: docs/10.x/vite.md:block 67 (paragraph) +# P +#: ./docs/9.x/vite.md:219 +#: ./docs/10.x/vite.md:264 +#: ./docs/11.x/vite.md:263 +#: ./docs/master/vite.md:264 msgid "Or, running the `build` command will version and bundle your application's assets and get them ready for you to deploy to production:" -msgstr "或者,也可以執行 `build` 指令。`build` 指令會為專案的素材加上版本,並打包這些素材,讓我們可以將其部署到正式環境中:" +msgstr "" -#: docs/10.x/vite.md:block 68 (code) +# CODE: shell +#: ./docs/9.x/vite.md:221 +#: ./docs/10.x/vite.md:266 +#: ./docs/11.x/vite.md:265 +#: ./docs/master/vite.md:266 msgid "# Run the Vite development server...\n" "npm run dev\n\n" "# Build and version the assets for production...\n" -"npm run build\n" -msgstr "# 執行 Vite 的開發伺服器...\n" -"npm run dev\n\n" -"# 建置素材並加上版本以在正式環境下使用...\n" -"npm run build\n" - -#: docs/10.x/vite.md:block 69 (paragraph) -msgid "If you are running the development server in [Sail](/docs/{{version}}/sail) on WSL2, you may need some [additional configuration](#configuring-hmr-in-sail-on-wsl2) options." +"npm run build" msgstr "" -#: docs/10.x/vite.md:block 71 (header) +# P +#: ./docs/9.x/vite.md:229 +#: ./docs/10.x/vite.md:276 +#: ./docs/11.x/vite.md:275 +#: ./docs/master/vite.md:276 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/vite.md:230 +#: ./docs/10.x/vite.md:277 +#: ./docs/11.x/vite.md:276 +#: ./docs/master/vite.md:277 msgid "Working With JavaScript" -msgstr "處理 JavaScript" +msgstr "" -#: docs/10.x/vite.md:block 73 (header) +# P +#: ./docs/9.x/vite.md:232 +#: ./docs/10.x/vite.md:279 +#: ./docs/11.x/vite.md:278 +#: ./docs/master/vite.md:279 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/vite.md:233 +#: ./docs/9.x/vite.md:498 +#: ./docs/10.x/vite.md:280 +#: ./docs/10.x/vite.md:548 +#: ./docs/11.x/vite.md:279 +#: ./docs/11.x/vite.md:550 +#: ./docs/master/vite.md:280 +#: ./docs/master/vite.md:548 msgid "Aliases" -msgstr "別名" +msgstr "" -#: docs/10.x/vite.md:block 74 (paragraph) +# P +#: ./docs/9.x/vite.md:235 +#: ./docs/10.x/vite.md:282 +#: ./docs/11.x/vite.md:281 +#: ./docs/master/vite.md:282 msgid "By default, The Laravel plugin provides a common alias to help you hit the ground running and conveniently import your application's assets:" -msgstr "預設情況下,Laravel 的 Vite 外掛提供了一個常見的別名,來讓你快速開始並方便地匯入專案素材:" +msgstr "" + +# P +#: ./docs/10.x/vite.md:236 +#: ./docs/11.x/vite.md:237 +#: ./docs/master/vite.md:236 +#~ msgid "" +#~ msgstr "" + +# H4 +#: ./docs/10.x/vite.md:237 +#: ./docs/11.x/vite.md:238 +#: ./docs/master/vite.md:237 +msgid "Inline Assets" +msgstr "" -#: docs/10.x/vite.md:block 75 (code) +# CODE: js +#: ./docs/9.x/vite.md:237 +#: ./docs/10.x/vite.md:284 +#: ./docs/11.x/vite.md:283 +#: ./docs/master/vite.md:284 msgid "{\n" " '@' => '/resources/js'\n" -"}\n" -msgstr "{\n" -" '@' => '/resources/js'\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/10.x/vite.md:239 +#: ./docs/11.x/vite.md:240 +#: ./docs/master/vite.md:239 +msgid "Sometimes it may be necessary to include the raw content of assets rather than linking to the versioned URL of the asset. For example, you may need to include asset content directly into your page when passing HTML content to a PDF generator. You may output the content of Vite assets using the `content` method provided by the `Vite` facade:" +msgstr "" + +# CODE: blade +#: ./docs/10.x/vite.md:241 +#: ./docs/master/vite.md:241 +msgid "@php\n" +"use Illuminate\\Support\\Facades\\Vite;\n" +"@endphp\n\n" +"\n" +"\n" +" {{-- ... --}}\n\n" +" \n" +" \n" +"" +msgstr "" + +# CODE: blade +#: ./docs/11.x/vite.md:242 +msgid "@use('Illuminate\\Support\\Facades\\Vite')\n\n" +"\n" +"\n" +" {{-- ... --}}\n\n" +" \n" +" \n" +"" +msgstr "" -#: docs/10.x/vite.md:block 76 (paragraph) +# P +#: ./docs/9.x/vite.md:243 +#: ./docs/10.x/vite.md:290 +#: ./docs/11.x/vite.md:289 +#: ./docs/master/vite.md:290 msgid "You may overwrite the `'@'` alias by adding your own to the `vite.config.js` configuration file:" -msgstr "也可以在 `vite.config.js` 設定檔中加上你自己的設定來複寫這個 `'@'` 別名:" +msgstr "" -#: docs/10.x/vite.md:block 77 (code) +# CODE: js +#: ./docs/9.x/vite.md:245 +#: ./docs/10.x/vite.md:292 +#: ./docs/11.x/vite.md:291 +#: ./docs/master/vite.md:292 msgid "import { defineConfig } from 'vite';\n" "import laravel from 'laravel-vite-plugin';\n\n" "export default defineConfig({\n" @@ -511,37 +1030,51 @@ msgid "import { defineConfig } from 'vite';\n" " '@': '/resources/ts',\n" " },\n" " },\n" -"});\n" -msgstr "import { defineConfig } from 'vite';\n" -"import laravel from 'laravel-vite-plugin';\n\n" -"export default defineConfig({\n" -" plugins: [\n" -" laravel(['resources/ts/app.tsx']),\n" -" ],\n" -" resolve: {\n" -" alias: {\n" -" '@': '/resources/ts',\n" -" },\n" -" },\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/vite.md:block 79 (header) +# P +#: ./docs/9.x/vite.md:261 +#: ./docs/10.x/vite.md:308 +#: ./docs/11.x/vite.md:307 +#: ./docs/master/vite.md:308 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/vite.md:262 +#: ./docs/10.x/vite.md:309 +#: ./docs/11.x/vite.md:308 +#: ./docs/master/vite.md:309 msgid "Vue" -msgstr "Vue" +msgstr "" -#: docs/10.x/vite.md:block 80 (paragraph) -msgid "If you would like to build your frontend using the [Vue](https://vuejs.org/) framework, then you will also need to install the `@vitejs/plugin-vue` plugin:" +# P +#: ./docs/9.x/vite.md:264 +msgid "If you would like to build your front-end using the [Vue](https://vuejs.org/) framework, then you will also need to install the `@vitejs/plugin-vue` plugin:" msgstr "" -#: docs/10.x/vite.md:block 81 (code) -msgid "npm install --save-dev @vitejs/plugin-vue\n" -msgstr "npm install --save-dev @vitejs/plugin-vue\n" +# CODE: sh +#: ./docs/9.x/vite.md:266 +#: ./docs/10.x/vite.md:313 +#: ./docs/11.x/vite.md:312 +#: ./docs/master/vite.md:313 +msgid "npm install --save-dev @vitejs/plugin-vue" +msgstr "" -#: docs/10.x/vite.md:block 82 (paragraph) +# P +#: ./docs/9.x/vite.md:270 +#: ./docs/10.x/vite.md:317 +#: ./docs/11.x/vite.md:316 +#: ./docs/master/vite.md:317 msgid "You may then include the plugin in your `vite.config.js` configuration file. There are a few additional options you will need when using the Vue plugin with Laravel:" -msgstr "接著,就可以在 `vite.config.js` 設定檔中加上該外掛。接著,要將 Vue 外掛與 Laravel 搭配使用還需要進行一些步驟:" +msgstr "" -#: docs/10.x/vite.md:block 83 (code) +# CODE: js +#: ./docs/9.x/vite.md:272 +#: ./docs/10.x/vite.md:319 +#: ./docs/11.x/vite.md:318 +#: ./docs/master/vite.md:319 msgid "import { defineConfig } from 'vite';\n" "import laravel from 'laravel-vite-plugin';\n" "import vue from '@vitejs/plugin-vue';\n\n" @@ -566,51 +1099,73 @@ msgid "import { defineConfig } from 'vite';\n" " },\n" " }),\n" " ],\n" -"});\n" -msgstr "import { defineConfig } from 'vite';\n" -"import laravel from 'laravel-vite-plugin';\n" -"import vue from '@vitejs/plugin-vue';\n\n" -"export default defineConfig({\n" -" plugins: [\n" -" laravel(['resources/js/app.js']),\n" -" vue({\n" -" template: {\n" -" transformAssetUrls: {\n" -" // Vue 外掛會在使用 SFC (單檔案元件) 時複寫 (Re-write) 素材 URL\n" -" // 以指向 Laravel 網頁伺服器。將此設定值改為 `null`,可讓 Laravel\n" -" // 外掛改將複寫的素材 URL 重新指向 Vite 伺服器。\n" -" base: null,\n\n" -" // Vue 外掛會解析絕對 URL,並將這些 URL 視為磁碟上的檔案路徑。\n" -" // 將此設定改為 `false`,就會使這些 URL 保持不動,以按照逾期地\n" -" // 參照到 public 目錄下的素材。\n" -" includeAbsolute: false,\n" -" },\n" -" },\n" -" }),\n" -" ],\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/vite.md:274 +#: ./docs/11.x/vite.md:273 +#: ./docs/master/vite.md:274 +msgid "If you are running the development server in [Sail](/docs/{{version}}/sail) on WSL2, you may need some [additional configuration](#configuring-hmr-in-sail-on-wsl2) options." +msgstr "" -#: docs/10.x/vite.md:block 84 (quote) -msgid "**Note** Laravel's [starter kits](/docs/{{version}}/starter-kits) already include the proper Laravel, Vue, and Vite configuration. Check out [Laravel Breeze](/docs/{{version}}/starter-kits#breeze-and-inertia) for the fastest way to get started with Laravel, Vue, and Vite." -msgstr "**Note** Laravel 的[入門套件](/docs/{{version}}/starter-kits)中已經包含了適當的 Laravel、Vue、與 Vite 設定。請參考看看使用 [Laravel Breeze](/docs/{{version}}/starter-kits#breeze-and-inertia),來用最快的速度開始使用 Laravel、Vue、與 Vite。" +# P +#: ./docs/9.x/vite.md:303 +#: ./docs/10.x/vite.md:350 +#: ./docs/11.x/vite.md:349 +#: ./docs/master/vite.md:350 +msgid "Laravel's [starter kits](/docs/{{version}}/starter-kits) already include the proper Laravel, Vue, and Vite configuration. Check out [Laravel Breeze](/docs/{{version}}/starter-kits#breeze-and-inertia) for the fastest way to get started with Laravel, Vue, and Vite." +msgstr "" -#: docs/10.x/vite.md:block 86 (header) +# P +#: ./docs/9.x/vite.md:305 +#: ./docs/10.x/vite.md:352 +#: ./docs/11.x/vite.md:351 +#: ./docs/master/vite.md:352 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/vite.md:306 +#: ./docs/10.x/vite.md:353 +#: ./docs/11.x/vite.md:352 +#: ./docs/master/vite.md:353 msgid "React" -msgstr "React" +msgstr "" -#: docs/10.x/vite.md:block 87 (paragraph) -msgid "If you would like to build your frontend using the [React](https://reactjs.org/) framework, then you will also need to install the `@vitejs/plugin-react` plugin:" +# P +#: ./docs/9.x/vite.md:308 +msgid "If you would like to build your front-end using the [React](https://reactjs.org/) framework, then you will also need to install the `@vitejs/plugin-react` plugin:" +msgstr "" + +# CODE: sh +#: ./docs/9.x/vite.md:310 +#: ./docs/10.x/vite.md:357 +#: ./docs/11.x/vite.md:356 +#: ./docs/master/vite.md:357 +msgid "npm install --save-dev @vitejs/plugin-react" msgstr "" -#: docs/10.x/vite.md:block 88 (code) -msgid "npm install --save-dev @vitejs/plugin-react\n" -msgstr "npm install --save-dev @vitejs/plugin-react\n" +# P +#: ./docs/10.x/vite.md:311 +#: ./docs/11.x/vite.md:310 +#: ./docs/master/vite.md:311 +msgid "If you would like to build your frontend using the [Vue](https://vuejs.org/) framework, then you will also need to install the `@vitejs/plugin-vue` plugin:" +msgstr "" -#: docs/10.x/vite.md:block 89 (paragraph) +# P +#: ./docs/9.x/vite.md:314 +#: ./docs/10.x/vite.md:361 +#: ./docs/11.x/vite.md:360 +#: ./docs/master/vite.md:361 msgid "You may then include the plugin in your `vite.config.js` configuration file:" -msgstr "可以在 `vite.config.js` 設定檔中加上該外掛:" +msgstr "" -#: docs/10.x/vite.md:block 90 (code) +# CODE: js +#: ./docs/9.x/vite.md:316 +#: ./docs/10.x/vite.md:363 +#: ./docs/11.x/vite.md:362 +#: ./docs/master/vite.md:363 msgid "import { defineConfig } from 'vite';\n" "import laravel from 'laravel-vite-plugin';\n" "import react from '@vitejs/plugin-react';\n\n" @@ -619,48 +1174,78 @@ msgid "import { defineConfig } from 'vite';\n" " laravel(['resources/js/app.jsx']),\n" " react(),\n" " ],\n" -"});\n" -msgstr "import { defineConfig } from 'vite';\n" -"import laravel from 'laravel-vite-plugin';\n" -"import react from '@vitejs/plugin-react';\n\n" -"export default defineConfig({\n" -" plugins: [\n" -" laravel(['resources/js/app.jsx']),\n" -" react(),\n" -" ],\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/vite.md:block 91 (paragraph) +# P +#: ./docs/9.x/vite.md:329 +#: ./docs/10.x/vite.md:376 +#: ./docs/11.x/vite.md:375 +#: ./docs/master/vite.md:376 msgid "You will need to ensure that any files containing JSX have a `.jsx` or `.tsx` extension, remembering to update your entry point, if required, as [shown above](#configuring-vite)." -msgstr "請確認包含 JSX 的檔案都使用 `.jsx` 或 `.tsx` 副檔名。若有需要,請記得更新 Entry Point,像[上文所提到的](#configuring-vite)。" +msgstr "" -#: docs/10.x/vite.md:block 92 (paragraph) +# P +#: ./docs/9.x/vite.md:331 +#: ./docs/10.x/vite.md:378 +#: ./docs/11.x/vite.md:377 +#: ./docs/master/vite.md:378 msgid "You will also need to include the additional `@viteReactRefresh` Blade directive alongside your existing `@vite` directive." -msgstr "還需要在現有的 `@vite` Blade 指示詞旁一起使用 `@viteReactRefresh` 指示詞。" +msgstr "" -#: docs/10.x/vite.md:block 93 (code) +# CODE: blade +#: ./docs/9.x/vite.md:333 +#: ./docs/10.x/vite.md:380 +#: ./docs/11.x/vite.md:379 +#: ./docs/master/vite.md:380 msgid "@viteReactRefresh\n" -"@vite('resources/js/app.jsx')\n" -msgstr "@viteReactRefresh\n" -"@vite('resources/js/app.jsx')\n" +"@vite('resources/js/app.jsx')" +msgstr "" -#: docs/10.x/vite.md:block 94 (paragraph) +# P +#: ./docs/9.x/vite.md:338 +#: ./docs/10.x/vite.md:385 +#: ./docs/11.x/vite.md:384 +#: ./docs/master/vite.md:385 msgid "The `@viteReactRefresh` directive must be called before the `@vite` directive." -msgstr "`@viteReactRefresh` 指示詞必須在 `@vite` 指示詞前呼叫。" +msgstr "" -#: docs/10.x/vite.md:block 95 (quote) -msgid "**Note** Laravel's [starter kits](/docs/{{version}}/starter-kits) already include the proper Laravel, React, and Vite configuration. Check out [Laravel Breeze](/docs/{{version}}/starter-kits#breeze-and-inertia) for the fastest way to get started with Laravel, React, and Vite." -msgstr "**Note** Laravel 的[入門套件](/docs/{{version}}/starter-kits)中已經包含了適當的 Laravel、React、與 Vite 設定。請參考看看使用 [Laravel Breeze](/docs/{{version}}/starter-kits#breeze-and-inertia),來用最快的速度開始使用 Laravel、React、與 Vite。" +# P +#: ./docs/9.x/vite.md:341 +#: ./docs/10.x/vite.md:388 +#: ./docs/11.x/vite.md:387 +#: ./docs/master/vite.md:388 +msgid "Laravel's [starter kits](/docs/{{version}}/starter-kits) already include the proper Laravel, React, and Vite configuration. Check out [Laravel Breeze](/docs/{{version}}/starter-kits#breeze-and-inertia) for the fastest way to get started with Laravel, React, and Vite." +msgstr "" -#: docs/10.x/vite.md:block 97 (header) +# P +#: ./docs/9.x/vite.md:343 +#: ./docs/10.x/vite.md:390 +#: ./docs/11.x/vite.md:389 +#: ./docs/master/vite.md:390 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/vite.md:344 +#: ./docs/10.x/vite.md:391 +#: ./docs/11.x/vite.md:390 +#: ./docs/master/vite.md:391 msgid "Inertia" -msgstr "Inertia" +msgstr "" -#: docs/10.x/vite.md:block 98 (paragraph) +# P +#: ./docs/9.x/vite.md:346 +#: ./docs/10.x/vite.md:393 +#: ./docs/11.x/vite.md:392 +#: ./docs/master/vite.md:393 msgid "The Laravel Vite plugin provides a convenient `resolvePageComponent` function to help you resolve your Inertia page components. Below is an example of the helper in use with Vue 3; however, you may also utilize the function in other frameworks such as React:" -msgstr "Laravel 的 Vite 外掛中提供了一個方便的 `resolvePageComponent` 函式,來協助我們解析 Inertia 的頁面元件。下面是搭配 Vue 3 使用該輔助函式的範例。除了在 Vue 3 上使用外,也可以在如 React 等其他的框架上使用該函式:" +msgstr "" -#: docs/10.x/vite.md:block 99 (code) +# CODE: js +#: ./docs/9.x/vite.md:348 +#: ./docs/10.x/vite.md:395 +#: ./docs/master/vite.md:395 msgid "import { createApp, h } from 'vue';\n" "import { createInertiaApp } from '@inertiajs/vue3';\n" "import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';\n\n" @@ -671,40 +1256,68 @@ msgid "import { createApp, h } from 'vue';\n" " .use(plugin)\n" " .mount(el)\n" " },\n" -"});\n" -msgstr "import { createApp, h } from 'vue';\n" -"import { createInertiaApp } from '@inertiajs/vue3';\n" -"import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';\n\n" -"createInertiaApp({\n" -" resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),\n" -" setup({ el, App, props, plugin }) {\n" -" return createApp({ render: () => h(App, props) })\n" -" .use(plugin)\n" -" .mount(el)\n" -" },\n" -"});\n" +"});" +msgstr "" + +# P +#: ./docs/10.x/vite.md:355 +#: ./docs/11.x/vite.md:354 +#: ./docs/master/vite.md:355 +msgid "If you would like to build your frontend using the [React](https://reactjs.org/) framework, then you will also need to install the `@vitejs/plugin-react` plugin:" +msgstr "" -#: docs/10.x/vite.md:block 100 (quote) -msgid "**Note** Laravel's [starter kits](/docs/{{version}}/starter-kits) already include the proper Laravel, Inertia, and Vite configuration. Check out [Laravel Breeze](/docs/{{version}}/starter-kits#breeze-and-inertia) for the fastest way to get started with Laravel, Inertia, and Vite." -msgstr "**Note** Laravel 的[入門套件](/docs/{{version}}/starter-kits)中已經包含了適當的 Laravel、Inertia、與 Vite 設定。請參考看看使用 [Laravel Breeze](/docs/{{version}}/starter-kits#breeze-and-inertia),來用最快的速度開始使用 Laravel、Inertia、與 Vite。" +# P +#: ./docs/9.x/vite.md:364 +#: ./docs/10.x/vite.md:411 +#: ./docs/11.x/vite.md:412 +#: ./docs/master/vite.md:411 +msgid "Laravel's [starter kits](/docs/{{version}}/starter-kits) already include the proper Laravel, Inertia, and Vite configuration. Check out [Laravel Breeze](/docs/{{version}}/starter-kits#breeze-and-inertia) for the fastest way to get started with Laravel, Inertia, and Vite." +msgstr "" -#: docs/10.x/vite.md:block 102 (header) +# P +#: ./docs/9.x/vite.md:366 +#: ./docs/10.x/vite.md:413 +#: ./docs/11.x/vite.md:414 +#: ./docs/master/vite.md:413 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/vite.md:367 +#: ./docs/10.x/vite.md:414 +#: ./docs/11.x/vite.md:415 +#: ./docs/master/vite.md:414 msgid "URL Processing" -msgstr "URL 的處理" +msgstr "" -#: docs/10.x/vite.md:block 103 (paragraph) +# P +#: ./docs/9.x/vite.md:369 +#: ./docs/10.x/vite.md:416 +#: ./docs/master/vite.md:416 msgid "When using Vite and referencing assets in your application's HTML, CSS, or JS, there are a couple of caveats to consider. First, if you reference assets with an absolute path, Vite will not include the asset in the build; therefore, you should ensure that the asset is available in your public directory." -msgstr "使用 Vite 並在專案的 HTML、CSS、JS 等地方參照素材時,還需要考慮到幾點。首先,若要參照的資源使用絕對路徑,則 Vite 將不會在建置的結果中包含該資源;同時,還需要確定該素材是否在 public 目錄下可用。" +msgstr "" -#: docs/10.x/vite.md:block 104 (paragraph) +# P +#: ./docs/9.x/vite.md:371 +#: ./docs/10.x/vite.md:418 +#: ./docs/11.x/vite.md:419 +#: ./docs/master/vite.md:418 msgid "When referencing relative asset paths, you should remember that the paths are relative to the file where they are referenced. Any assets referenced via a relative path will be re-written, versioned, and bundled by Vite." -msgstr "使用相對路徑參照素材時,請記得,路徑是相對於正在參照該資源的檔案。Vite 會複寫使用相對路徑所參照的素材,並為其加上版本,然後進行打包。" +msgstr "" -#: docs/10.x/vite.md:block 105 (paragraph) +# P +#: ./docs/9.x/vite.md:373 +#: ./docs/10.x/vite.md:420 +#: ./docs/11.x/vite.md:421 +#: ./docs/master/vite.md:420 msgid "Consider the following project structure:" -msgstr "來看一下下面這樣的專案結構:" +msgstr "" -#: docs/10.x/vite.md:block 106 (code) +# CODE: nothing +#: ./docs/9.x/vite.md:375 +#: ./docs/10.x/vite.md:422 +#: ./docs/11.x/vite.md:423 +#: ./docs/master/vite.md:422 msgid "public/\n" " taylor.png\n" "resources/\n" @@ -712,94 +1325,185 @@ msgid "public/\n" " Pages/\n" " Welcome.vue\n" " images/\n" -" abigail.png\n" -msgstr "public/\n" -" taylor.png\n" -"resources/\n" -" js/\n" -" Pages/\n" -" Welcome.vue\n" -" images/\n" -" abigail.png\n" +" abigail.png" +msgstr "" -#: docs/10.x/vite.md:block 107 (paragraph) +# P +#: ./docs/9.x/vite.md:386 +#: ./docs/10.x/vite.md:433 +#: ./docs/11.x/vite.md:434 +#: ./docs/master/vite.md:433 msgid "The following example demonstrates how Vite will treat relative and absolute URLs:" -msgstr "下列範例展示 Vite 如何處理相對與絕對 URL:" +msgstr "" -#: docs/10.x/vite.md:block 108 (code) +# CODE: html +#: ./docs/9.x/vite.md:388 +#: ./docs/10.x/vite.md:435 +#: ./docs/11.x/vite.md:436 +#: ./docs/master/vite.md:435 msgid "\n" "\n\n" "\n" -"\n" -msgstr "\n" -"\n\n" -"\n" -"\n" +"" +msgstr "" + +# CODE: js +#: ./docs/11.x/vite.md:394 +msgid "import { createApp, h } from 'vue';\n" +"import { createInertiaApp } from '@inertiajs/vue3';\n" +"import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';\n\n" +"createInertiaApp({\n" +" resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),\n" +" setup({ el, App, props, plugin }) {\n" +" createApp({ render: () => h(App, props) })\n" +" .use(plugin)\n" +" .mount(el)\n" +" },\n" +"});" +msgstr "" -#: docs/10.x/vite.md:block 110 (header) +# P +#: ./docs/9.x/vite.md:396 +#: ./docs/10.x/vite.md:443 +#: ./docs/11.x/vite.md:444 +#: ./docs/master/vite.md:443 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/vite.md:397 +#: ./docs/10.x/vite.md:444 +#: ./docs/11.x/vite.md:445 +#: ./docs/master/vite.md:444 msgid "Working With Stylesheets" -msgstr "處理 CSS" +msgstr "" -#: docs/10.x/vite.md:block 111 (paragraph) +# P +#: ./docs/9.x/vite.md:399 +#: ./docs/10.x/vite.md:446 +#: ./docs/11.x/vite.md:447 +#: ./docs/master/vite.md:446 msgid "You can learn more about Vite's CSS support within the [Vite documentation](https://vitejs.dev/guide/features.html#css). If you are using PostCSS plugins such as [Tailwind](https://tailwindcss.com), you may create a `postcss.config.js` file in the root of your project and Vite will automatically apply it:" -msgstr "你可以在 [Vite 說明文件](https://vitejs.dev/guide/features.html#css)中瞭解更多有關 Vite 對 CSS 的支援。若使用如 [Tailwind](https://tailwindcss.com) 等的 PostCSS 外掛,可在專案根目錄中建立一個 `postcss.config.js` 檔。Vite 會自動套用該檔案中的設定:" +msgstr "" -#: docs/10.x/vite.md:block 112 (code) -msgid "export default {\n" +# CODE: js +#: ./docs/9.x/vite.md:401 +msgid "module.exports = {\n" " plugins: {\n" " tailwindcss: {},\n" " autoprefixer: {},\n" " },\n" -"};\n" +"};" msgstr "" -#: docs/10.x/vite.md:block 113 (quote) -msgid "**Note** Laravel's [starter kits](/docs/{{version}}/starter-kits) already include the proper Tailwind, PostCSS, and Vite configuration. Or, if you would like to use Tailwind and Laravel without using one of our starter kits, check out [Tailwind's installation guide for Laravel](https://tailwindcss.com/docs/guides/laravel)." +# P +#: ./docs/11.x/vite.md:409 +msgid "If you are using Vite's code splitting feature with Inertia, we recommend configuring [asset prefetching](#asset-prefetching)." msgstr "" -#: docs/10.x/vite.md:block 115 (header) +# P +#: ./docs/9.x/vite.md:410 +#: ./docs/10.x/vite.md:460 +#: ./docs/11.x/vite.md:461 +#: ./docs/master/vite.md:460 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/vite.md:411 msgid "Working With Blade & Routes" -msgstr "處理 Blade 與 Route" +msgstr "" -#: docs/10.x/vite.md:block 117 (header) +# P +#: ./docs/9.x/vite.md:413 +#: ./docs/10.x/vite.md:463 +#: ./docs/11.x/vite.md:464 +#: ./docs/master/vite.md:463 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/vite.md:414 +#: ./docs/10.x/vite.md:464 +#: ./docs/11.x/vite.md:465 +#: ./docs/master/vite.md:464 msgid "Processing Static Assets With Vite" -msgstr "使用 Vite 處理靜態素材" +msgstr "" -#: docs/10.x/vite.md:block 118 (paragraph) +# P +#: ./docs/9.x/vite.md:416 +#: ./docs/10.x/vite.md:466 +#: ./docs/11.x/vite.md:467 +#: ./docs/master/vite.md:466 msgid "When referencing assets in your JavaScript or CSS, Vite automatically processes and versions them. In addition, when building Blade based applications, Vite can also process and version static assets that you reference solely in Blade templates." -msgstr "在 JavaScript 或 CSS 中參照素材時,Vite 會自動處理這些素材並為其加上版本。此外,在建置基於 Blade 的專案時,也可以使用 Vite 來處理只在 Blade 中被參照的靜態資源,並為這些資源加上版本。" +msgstr "" -#: docs/10.x/vite.md:block 119 (paragraph) +# P +#: ./docs/11.x/vite.md:417 +msgid "When using Vite and referencing assets in your application's HTML, CSS, or JS, there are a couple of caveats to consider. First, if you reference assets with an absolute path, Vite will not include the asset in the build; therefore, you should ensure that the asset is available in your public directory. You should avoid using absolute paths when using a [dedicated CSS entrypoint](#configuring-vite) because, during development, browsers will try to load these paths from the Vite development server, where the CSS is hosted, rather than from your public directory." +msgstr "" + +# P +#: ./docs/9.x/vite.md:418 +#: ./docs/10.x/vite.md:468 +#: ./docs/11.x/vite.md:469 +#: ./docs/master/vite.md:468 msgid "However, in order to accomplish this, you need to make Vite aware of your assets by importing the static assets into the application's entry point. For example, if you want to process and version all images stored in `resources/images` and all fonts stored in `resources/fonts`, you should add the following in your application's `resources/js/app.js` entry point:" -msgstr "不過,若要達成此目的,我們需要先在專案的 ^[Entry Point](進入點) 匯入這些素材,好讓 Vite 知道有這些素材的存在。舉例來說,若想處理並為所有 `resources/images` 下的圖片、以及 `resources/fonts` 下的所有字體加上版本,就需要在專案的 `resources/js/app.js` Entry Point 內加上下列程式碼:" +msgstr "" -#: docs/10.x/vite.md:block 120 (code) +# CODE: js +#: ./docs/9.x/vite.md:420 +#: ./docs/10.x/vite.md:470 +#: ./docs/11.x/vite.md:471 +#: ./docs/master/vite.md:470 msgid "import.meta.glob([\n" " '../images/**',\n" " '../fonts/**',\n" -"]);\n" -msgstr "import.meta.glob([\n" -" '../images/**',\n" -" '../fonts/**',\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/vite.md:block 121 (paragraph) +# P +#: ./docs/9.x/vite.md:427 +#: ./docs/10.x/vite.md:477 +#: ./docs/11.x/vite.md:478 +#: ./docs/master/vite.md:477 msgid "These assets will now be processed by Vite when running `npm run build`. You can then reference these assets in Blade templates using the `Vite::asset` method, which will return the versioned URL for a given asset:" -msgstr "接著在執行 `npm run build` 時,這些素材就會自動被 Vite 處理。我們接著就可以在 Blade 樣板中使用 `Vite::asset` 方法來參照這些素材。該方法會回傳給定資源加上版本後的 URL:" +msgstr "" + +# CODE: blade +#: ./docs/9.x/vite.md:429 +#: ./docs/10.x/vite.md:479 +#: ./docs/11.x/vite.md:480 +#: ./docs/master/vite.md:479 +msgid "" +msgstr "" -#: docs/10.x/vite.md:block 122 (code) -msgid "\n" -msgstr "\n" +# P +#: ./docs/9.x/vite.md:433 +#: ./docs/10.x/vite.md:483 +#: ./docs/11.x/vite.md:484 +#: ./docs/master/vite.md:483 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/vite.md:block 124 (header) +# H3 +#: ./docs/9.x/vite.md:434 msgid "Refreshing On Save" -msgstr "保存時重新整理" +msgstr "" -#: docs/10.x/vite.md:block 125 (paragraph) +# P +#: ./docs/9.x/vite.md:436 +#: ./docs/10.x/vite.md:486 +#: ./docs/11.x/vite.md:487 +#: ./docs/master/vite.md:486 msgid "When your application is built using traditional server-side rendering with Blade, Vite can improve your development workflow by automatically refreshing the browser when you make changes to view files in your application. To get started, you can simply specify the `refresh` option as `true`." -msgstr "若專案使用 Blade 這樣傳統式的伺服器端轉譯,則 Vite 可以在 View 檔案被修改的時候幫你自動重新整理瀏覽器來改進開發流程。若要開始讓 Vite 自動重新整理,只需要將 `refresh` 選項設為 `true` 即可。" +msgstr "" -#: docs/10.x/vite.md:block 126 (code) +# CODE: js +#: ./docs/9.x/vite.md:438 +#: ./docs/10.x/vite.md:488 +#: ./docs/11.x/vite.md:489 +#: ./docs/master/vite.md:488 msgid "import { defineConfig } from 'vite';\n" "import laravel from 'laravel-vite-plugin';\n\n" "export default defineConfig({\n" @@ -809,51 +1513,104 @@ msgid "import { defineConfig } from 'vite';\n" " refresh: true,\n" " }),\n" " ],\n" -"});\n" -msgstr "import { defineConfig } from 'vite';\n" -"import laravel from 'laravel-vite-plugin';\n\n" -"export default defineConfig({\n" -" plugins: [\n" -" laravel({\n" -" // ...\n" -" refresh: true,\n" -" }),\n" -" ],\n" -"});\n" +"});" +msgstr "" + +# CODE: js +#: ./docs/10.x/vite.md:448 +#: ./docs/11.x/vite.md:449 +#: ./docs/master/vite.md:448 +msgid "export default {\n" +" plugins: {\n" +" tailwindcss: {},\n" +" autoprefixer: {},\n" +" },\n" +"};" +msgstr "" -#: docs/10.x/vite.md:block 127 (paragraph) +# P +#: ./docs/9.x/vite.md:452 +#: ./docs/10.x/vite.md:502 +#: ./docs/11.x/vite.md:503 +#: ./docs/master/vite.md:502 msgid "When the `refresh` option is `true`, saving files in the following directories will trigger the browser to perform a full page refresh while you are running `npm run dev`:" -msgstr "當 `refresh` 選項設為 `true` 後,在執行 `npm run dev` 時,一旦在下列目錄中保存檔案,就會觸發瀏覽器進行整頁的重新整理:" +msgstr "" -#: docs/10.x/vite.md:block 128 (unordered list) +# P +#: ./docs/9.x/vite.md:454 +#: ./docs/10.x/vite.md:504 +#: ./docs/11.x/vite.md:506 +#: ./docs/master/vite.md:504 msgid "`app/View/Components/**`" -msgstr "`app/View/Components/**`" +msgstr "" -#: docs/10.x/vite.md:block 128 (unordered list) +# P +#: ./docs/9.x/vite.md:455 +#: ./docs/10.x/vite.md:505 +#: ./docs/11.x/vite.md:507 +#: ./docs/master/vite.md:505 msgid "`lang/**`" -msgstr "`lang/**`" +msgstr "" -#: docs/10.x/vite.md:block 128 (unordered list) +# P +#: ./docs/9.x/vite.md:456 +#: ./docs/10.x/vite.md:506 +#: ./docs/11.x/vite.md:508 +#: ./docs/master/vite.md:506 msgid "`resources/lang/**`" -msgstr "`resources/lang/**`" +msgstr "" -#: docs/10.x/vite.md:block 128 (unordered list) +# P +#: ./docs/9.x/vite.md:457 +#: ./docs/10.x/vite.md:507 +#: ./docs/11.x/vite.md:509 +#: ./docs/master/vite.md:507 msgid "`resources/views/**`" -msgstr "`resources/views/**`" +msgstr "" -#: docs/10.x/vite.md:block 128 (unordered list) +# P +#: ./docs/10.x/vite.md:458 +#: ./docs/11.x/vite.md:459 +#: ./docs/master/vite.md:458 +msgid "Laravel's [starter kits](/docs/{{version}}/starter-kits) already include the proper Tailwind, PostCSS, and Vite configuration. Or, if you would like to use Tailwind and Laravel without using one of our starter kits, check out [Tailwind's installation guide for Laravel](https://tailwindcss.com/docs/guides/laravel)." +msgstr "" + +# P +#: ./docs/9.x/vite.md:458 +#: ./docs/10.x/vite.md:508 +#: ./docs/11.x/vite.md:510 +#: ./docs/master/vite.md:508 msgid "`routes/**`" -msgstr "`routes/**`" +msgstr "" -#: docs/10.x/vite.md:block 129 (paragraph) +# P +#: ./docs/9.x/vite.md:460 +#: ./docs/10.x/vite.md:510 +#: ./docs/11.x/vite.md:512 +#: ./docs/master/vite.md:510 msgid "Watching the `routes/**` directory is useful if you are utilizing [Ziggy](https://github.com/tighten/ziggy) to generate route links within your application's frontend." -msgstr "若使用 [Ziggy](https://github.com/tighten/ziggy) 來在網頁前端中產生 Route 連結,監看 `routes/**` 目錄就很實用。" +msgstr "" -#: docs/10.x/vite.md:block 130 (paragraph) +# H2 +#: ./docs/10.x/vite.md:461 +#: ./docs/11.x/vite.md:462 +#: ./docs/master/vite.md:461 +msgid "Working With Blade and Routes" +msgstr "" + +# P +#: ./docs/9.x/vite.md:462 +#: ./docs/10.x/vite.md:512 +#: ./docs/11.x/vite.md:514 +#: ./docs/master/vite.md:512 msgid "If these default paths do not suit your needs, you can specify your own list of paths to watch:" -msgstr "若這些預設的路徑不符合你的需求,也可以自行指定一組要監看的路徑清單:" +msgstr "" -#: docs/10.x/vite.md:block 131 (code) +# CODE: js +#: ./docs/9.x/vite.md:464 +#: ./docs/10.x/vite.md:514 +#: ./docs/11.x/vite.md:516 +#: ./docs/master/vite.md:514 msgid "import { defineConfig } from 'vite';\n" "import laravel from 'laravel-vite-plugin';\n\n" "export default defineConfig({\n" @@ -863,23 +1620,22 @@ msgid "import { defineConfig } from 'vite';\n" " refresh: ['resources/views/**'],\n" " }),\n" " ],\n" -"});\n" -msgstr "import { defineConfig } from 'vite';\n" -"import laravel from 'laravel-vite-plugin';\n\n" -"export default defineConfig({\n" -" plugins: [\n" -" laravel({\n" -" // ...\n" -" refresh: ['resources/views/**'],\n" -" }),\n" -" ],\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/vite.md:block 132 (paragraph) +# P +#: ./docs/9.x/vite.md:478 +#: ./docs/10.x/vite.md:528 +#: ./docs/11.x/vite.md:530 +#: ./docs/master/vite.md:528 msgid "Under the hood, the Laravel Vite plugin uses the [`vite-plugin-full-reload`](https://github.com/ElMassimo/vite-plugin-full-reload) package, which offers some advanced configuration options to fine-tune this feature's behavior. If you need this level of customization, you may provide a `config` definition:" -msgstr "其實,Laravel 的 Vite 外掛使用了 [`vite-plugin-full-reload`](https://github.com/ElMassimo/vite-plugin-full-reload) 套件,該套件還提供了一些選項,能微調這個重新整理功能的行為。若有需要自定這類微調,可以加上一個 `config` 定義:" +msgstr "" -#: docs/10.x/vite.md:block 133 (code) +# CODE: js +#: ./docs/9.x/vite.md:480 +#: ./docs/10.x/vite.md:530 +#: ./docs/11.x/vite.md:532 +#: ./docs/master/vite.md:530 msgid "import { defineConfig } from 'vite';\n" "import laravel from 'laravel-vite-plugin';\n\n" "export default defineConfig({\n" @@ -892,130 +1648,253 @@ msgid "import { defineConfig } from 'vite';\n" " }],\n" " }),\n" " ],\n" -"});\n" -msgstr "import { defineConfig } from 'vite';\n" -"import laravel from 'laravel-vite-plugin';\n\n" -"export default defineConfig({\n" -" plugins: [\n" -" laravel({\n" -" // ...\n" -" refresh: [{\n" -" paths: ['path/to/watch/**'],\n" -" config: { delay: 300 }\n" -" }],\n" -" }),\n" -" ],\n" -"});\n" +"});" +msgstr "" + +# H3 +#: ./docs/10.x/vite.md:484 +#: ./docs/11.x/vite.md:485 +#: ./docs/master/vite.md:484 +msgid "Refreshing on Save" +msgstr "" -#: docs/10.x/vite.md:block 136 (paragraph) +# P +#: ./docs/9.x/vite.md:497 +#: ./docs/10.x/vite.md:547 +#: ./docs/11.x/vite.md:549 +#: ./docs/master/vite.md:547 +#~ msgid "" +#~ msgstr "" + +# P +#: ./docs/9.x/vite.md:500 +#: ./docs/10.x/vite.md:550 +#: ./docs/11.x/vite.md:552 +#: ./docs/master/vite.md:550 msgid "It is common in JavaScript applications to [create aliases](#aliases) to regularly referenced directories. But, you may also create aliases to use in Blade by using the `macro` method on the `Illuminate\\Support\\Facades\\Vite` class. Typically, \"macros\" should be defined within the `boot` method of a [service provider](/docs/{{version}}/providers):" -msgstr "在 JavaScript 專案中,為常用的目錄[建立別名](#aliases)是很常見的。不過,我們也可以使用 `Illuminate\\Support\\Facade\\Vite` 類別的 `macro` 方法來建立能在 Blade 中使用的別名。一般來說,「^[Macro](巨集)」應在某個 [Service Provider](/docs/{{version}}/providers) 內定義:" +msgstr "" -#: docs/10.x/vite.md:block 137 (code) +# CODE +#: ./docs/9.x/vite.md:502 msgid "/**\n" " * Bootstrap any application services.\n" +" *\n" +" * @return void\n" " */\n" -"public function boot(): void\n" -"{\n" -" Vite::macro('image', fn (string $asset) => $this->asset(\"resources/images/{$asset}\"));\n" -"}\n" -msgstr "/**\n" -" * Bootstrap any application services.\n" -" */\n" -"public function boot(): void\n" +"public function boot()\n" "{\n" -" Vite::macro('image', fn (string $asset) => $this->asset(\"resources/images/{$asset}\"));\n" -"}\n" +" Vite::macro('image', fn ($asset) => $this->asset(\"resources/images/{$asset}\"));\n" +"}" +msgstr "" -#: docs/10.x/vite.md:block 138 (paragraph) +# P +#: ./docs/11.x/vite.md:505 +msgid "`app/Livewire/**`" +msgstr "" + +# P +#: ./docs/9.x/vite.md:512 +#: ./docs/10.x/vite.md:560 +#: ./docs/11.x/vite.md:562 +#: ./docs/master/vite.md:560 msgid "Once a macro has been defined, it can be invoked within your templates. For example, we can use the `image` macro defined above to reference an asset located at `resources/images/logo.png`:" -msgstr "定義好 Macro 後,就可以在樣板中呼叫。舉例來說,我們可以使用 `image` Macro 定義來參照到位在 `resources/images/logo.png` 的素材:" +msgstr "" -#: docs/10.x/vite.md:block 139 (code) -msgid "\"Laravel\n" -msgstr "\"Laravel\n" +# CODE: blade +#: ./docs/9.x/vite.md:514 +#: ./docs/10.x/vite.md:562 +#: ./docs/11.x/vite.md:564 +#: ./docs/master/vite.md:562 +msgid "\"Laravel" +msgstr "" -#: docs/10.x/vite.md:block 141 (header) +# P +#: ./docs/9.x/vite.md:518 +#: ./docs/10.x/vite.md:566 +#: ./docs/11.x/vite.md:637 +#: ./docs/master/vite.md:566 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/vite.md:519 +#: ./docs/10.x/vite.md:567 +#: ./docs/11.x/vite.md:638 +#: ./docs/master/vite.md:567 msgid "Custom Base URLs" -msgstr "自定 Base URL" +msgstr "" -#: docs/10.x/vite.md:block 142 (paragraph) +# P +#: ./docs/9.x/vite.md:521 +#: ./docs/10.x/vite.md:569 +#: ./docs/11.x/vite.md:640 +#: ./docs/master/vite.md:569 msgid "If your Vite compiled assets are deployed to a domain separate from your application, such as via a CDN, you must specify the `ASSET_URL` environment variable within your application's `.env` file:" -msgstr "若由 Vite 編譯出來的素材會被部署到與專案不同的網域上,如 CDN 等,則可在專案的 `.env` 檔案中指定 `ASSET_URL` 環境變數:" +msgstr "" -#: docs/10.x/vite.md:block 143 (code) -msgid "ASSET_URL=https://cdn.example.com\n" -msgstr "ASSET_URL=https://cdn.example.com\n" +# CODE: env +#: ./docs/9.x/vite.md:523 +#: ./docs/10.x/vite.md:571 +#: ./docs/11.x/vite.md:642 +#: ./docs/master/vite.md:571 +msgid "ASSET_URL=https://cdn.example.com" +msgstr "" -#: docs/10.x/vite.md:block 144 (paragraph) +# P +#: ./docs/9.x/vite.md:527 +#: ./docs/10.x/vite.md:575 +#: ./docs/11.x/vite.md:646 +#: ./docs/master/vite.md:575 msgid "After configuring the asset URL, all re-written URLs to your assets will be prefixed with the configured value:" -msgstr "設定好素材 URL 後,所有被複寫的素材 URL 的前方都會被加上該設定值:" +msgstr "" -#: docs/10.x/vite.md:block 145 (code) -msgid "https://cdn.example.com/build/assets/app.9dce8d17.js\n" -msgstr "https://cdn.example.com/build/assets/app.9dce8d17.js\n" +# CODE: nothing +#: ./docs/9.x/vite.md:529 +#: ./docs/10.x/vite.md:577 +#: ./docs/11.x/vite.md:648 +#: ./docs/master/vite.md:577 +msgid "https://cdn.example.com/build/assets/app.9dce8d17.js" +msgstr "" -#: docs/10.x/vite.md:block 146 (paragraph) +# P +#: ./docs/9.x/vite.md:533 +#: ./docs/10.x/vite.md:581 +#: ./docs/11.x/vite.md:652 +#: ./docs/master/vite.md:581 msgid "Remember that [absolute URLs are not re-written by Vite](#url-processing), so they will not be prefixed." -msgstr "請記得,[Vite 不會複寫絕對 URL](#url-processing),所以這些絕對 URL 會被保持原樣。" +msgstr "" -#: docs/10.x/vite.md:block 148 (header) +# P +#: ./docs/9.x/vite.md:535 +#: ./docs/10.x/vite.md:583 +#: ./docs/11.x/vite.md:654 +#: ./docs/master/vite.md:583 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/vite.md:536 +#: ./docs/10.x/vite.md:584 +#: ./docs/11.x/vite.md:655 +#: ./docs/master/vite.md:584 msgid "Environment Variables" -msgstr "環境變數" +msgstr "" -#: docs/10.x/vite.md:block 149 (paragraph) +# P +#: ./docs/9.x/vite.md:538 +#: ./docs/10.x/vite.md:586 +#: ./docs/11.x/vite.md:657 +#: ./docs/master/vite.md:586 msgid "You may inject environment variables into your JavaScript by prefixing them with `VITE_` in your application's `.env` file:" -msgstr "在專案的 `.env` 檔中,只要為環境變數名稱冠上 `VITE_` 前置詞,就可將這些環境變數注入到 JavaScript 中:" +msgstr "" -#: docs/10.x/vite.md:block 150 (code) -msgid "VITE_SENTRY_DSN_PUBLIC=http://example.com\n" -msgstr "VITE_SENTRY_DSN_PUBLIC=http://example.com\n" +# CODE: env +#: ./docs/9.x/vite.md:540 +#: ./docs/10.x/vite.md:588 +#: ./docs/11.x/vite.md:659 +#: ./docs/master/vite.md:588 +msgid "VITE_SENTRY_DSN_PUBLIC=http://example.com" +msgstr "" -#: docs/10.x/vite.md:block 151 (paragraph) +# P +#: ./docs/9.x/vite.md:544 +#: ./docs/10.x/vite.md:592 +#: ./docs/11.x/vite.md:663 +#: ./docs/master/vite.md:592 msgid "You may access injected environment variables via the `import.meta.env` object:" -msgstr "可以使用 `import.meta.env` 物件來存取注入的變數:" +msgstr "" + +# CODE: js +#: ./docs/9.x/vite.md:546 +#: ./docs/10.x/vite.md:594 +#: ./docs/11.x/vite.md:665 +#: ./docs/master/vite.md:594 +msgid "import.meta.env.VITE_SENTRY_DSN_PUBLIC" +msgstr "" -#: docs/10.x/vite.md:block 152 (code) -msgid "import.meta.env.VITE_SENTRY_DSN_PUBLIC\n" -msgstr "import.meta.env.VITE_SENTRY_DSN_PUBLIC\n" +# P +#: ./docs/9.x/vite.md:550 +#: ./docs/10.x/vite.md:598 +#: ./docs/11.x/vite.md:669 +#: ./docs/master/vite.md:598 +#~ msgid "" +#~ msgstr "" -#: docs/10.x/vite.md:block 154 (header) +# H2 +#: ./docs/9.x/vite.md:551 msgid "Disabling Vite In Tests" -msgstr "在測試時禁用 Vite" +msgstr "" + +# CODE +#: ./docs/10.x/vite.md:552 +#: ./docs/11.x/vite.md:554 +#: ./docs/master/vite.md:552 +msgid "/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Vite::macro('image', fn (string $asset) => $this->asset(\"resources/images/{$asset}\"));\n" +"}" +msgstr "" -#: docs/10.x/vite.md:block 155 (paragraph) +# P +#: ./docs/9.x/vite.md:553 +#: ./docs/10.x/vite.md:601 +#: ./docs/11.x/vite.md:672 +#: ./docs/master/vite.md:601 msgid "Laravel's Vite integration will attempt to resolve your assets while running your tests, which requires you to either run the Vite development server or build your assets." -msgstr "Laravel 的 Vite 整合會在執行測試時嘗試解析素材,要能解析素材就必須要執行 Vite 開發伺服器或建置素材。" +msgstr "" -#: docs/10.x/vite.md:block 156 (paragraph) +# P +#: ./docs/9.x/vite.md:555 msgid "If you would prefer to mock Vite during testing, you may call the `withoutVite` method, which is is available for any tests that extend Laravel's `TestCase` class:" -msgstr "若想在測試時 Mock (模擬) Vite,可呼叫 `withoutVite` 方法。該方法可在任何繼承了 Laravel `TestCase` 的類別中使用:" +msgstr "" -#: docs/10.x/vite.md:block 157 (code) +# CODE: php +#: ./docs/9.x/vite.md:557 msgid "use Tests\\TestCase;\n\n" "class ExampleTest extends TestCase\n" "{\n" -" public function test_without_vite_example(): void\n" -" {\n" -" $this->withoutVite();\n\n" -" // ...\n" -" }\n" -"}\n" -msgstr "use Tests\\TestCase;\n\n" -"class ExampleTest extends TestCase\n" -"{\n" -" public function test_without_vite_example(): void\n" +" public function test_without_vite_example()\n" " {\n" " $this->withoutVite();\n\n" " // ...\n" " }\n" -"}\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/vite.md:568 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/11.x/vite.md:569 +msgid "Asset Prefetching" +msgstr "" -#: docs/10.x/vite.md:block 158 (paragraph) +# P +#: ./docs/11.x/vite.md:571 +msgid "When building an SPA using Vite's code splitting feature, required assets are fetched on each page navigation. This behavior can lead to delayed UI rendering. If this is a problem for your frontend framework of choice, Laravel offers the ability to eagerly prefetch your application's JavaScript and CSS assets on initial page load." +msgstr "" + +# P +#: ./docs/9.x/vite.md:571 +#: ./docs/10.x/vite.md:619 +#: ./docs/11.x/vite.md:698 +#: ./docs/master/vite.md:627 msgid "If you would like to disable Vite for all tests, you may call the `withoutVite` method from the `setUp` method on your base `TestCase` class:" -msgstr "若想在所有測試中禁用 Vite,可在基礎 `TestCase` 類別的 `setUp` 方法中呼叫 `withoutVite` 方法:" +msgstr "" + +# P +#: ./docs/11.x/vite.md:573 +msgid "You can instruct Laravel to eagerly prefetch your assets by invoking the `Vite::prefetch` method in the `boot` method of a [service provider](/docs/{{version}}/providers):" +msgstr "" -#: docs/10.x/vite.md:block 159 (code) +# CODE: php +#: ./docs/9.x/vite.md:573 +#: ./docs/10.x/vite.md:621 msgid "withoutVite();\n" " }// [tl! add:end]\n" -"}\n" -msgstr "withoutVite();\n" -" }// [tl! add:end]\n" -"}\n" +" // ...\n" +" }\n\n" +" /**\n" +" * Bootstrap any application services.\n" +" */\n" +" public function boot(): void\n" +" {\n" +" Vite::prefetch(concurrency: 3);\n" +" }\n" +"}" +msgstr "" -#: docs/10.x/vite.md:block 161 (header) +# P +#: ./docs/9.x/vite.md:593 +#: ./docs/10.x/vite.md:641 +#: ./docs/11.x/vite.md:718 +#: ./docs/master/vite.md:647 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/vite.md:594 +#: ./docs/10.x/vite.md:642 +#: ./docs/11.x/vite.md:719 +#: ./docs/master/vite.md:648 msgid "Server-Side Rendering (SSR)" -msgstr "伺服器端轉譯 (SSR)" +msgstr "" -#: docs/10.x/vite.md:block 162 (paragraph) +# P +#: ./docs/9.x/vite.md:596 +#: ./docs/10.x/vite.md:644 +#: ./docs/11.x/vite.md:721 +#: ./docs/master/vite.md:650 msgid "The Laravel Vite plugin makes it painless to set up server-side rendering with Vite. To get started, create an SSR entry point at `resources/js/ssr.js` and specify the entry point by passing a configuration option to the Laravel plugin:" -msgstr "使用 Laravel 的 Vite 外掛,就可以無痛在 Vite 上設定伺服器端轉譯 (SSR, Server Side Rendering)。若要開始設定 SSR,請建立一個 `resources/js/ssr.js` 來作為 SSR 的進入點,並在 Laravel 的 Vite 外掛上傳入一組設定來指定該進入點:" +msgstr "" -#: docs/10.x/vite.md:block 163 (code) +# CODE: js +#: ./docs/9.x/vite.md:598 +#: ./docs/10.x/vite.md:646 +#: ./docs/11.x/vite.md:723 +#: ./docs/master/vite.md:652 msgid "import { defineConfig } from 'vite';\n" "import laravel from 'laravel-vite-plugin';\n\n" "export default defineConfig({\n" @@ -1059,128 +1972,312 @@ msgid "import { defineConfig } from 'vite';\n" " ssr: 'resources/js/ssr.js',\n" " }),\n" " ],\n" -"});\n" -msgstr "import { defineConfig } from 'vite';\n" -"import laravel from 'laravel-vite-plugin';\n\n" -"export default defineConfig({\n" -" plugins: [\n" -" laravel({\n" -" input: 'resources/js/app.js',\n" -" ssr: 'resources/js/ssr.js',\n" -" }),\n" -" ],\n" -"});\n" - -#: docs/10.x/vite.md:block 164 (paragraph) -msgid "To ensure you don't forget to rebuild the SSR entry point, we recommend augmenting the \"build\" script in your application's `package.json` to create your SSR build:" -msgstr "為了避免我們忘記要重新建置 SSR 進入點,建議調整專案的 `package.json` 內的「build」指令來建立 SSR 建置:" - -#: docs/10.x/vite.md:block 165 (code) -msgid "\"scripts\": {\n" -" \"dev\": \"vite\",\n" -" \"build\": \"vite build\" // [tl! remove]\n" -" \"build\": \"vite build && vite build --ssr\" // [tl! add]\n" -"}\n" -msgstr "\"scripts\": {\n" -" \"dev\": \"vite\",\n" -" \"build\": \"vite build\" // [tl! remove]\n" -" \"build\": \"vite build && vite build --ssr\" // [tl! add]\n" -"}\n" - -#: docs/10.x/vite.md:block 166 (paragraph) -msgid "Then, to build and start the SSR server, you may run the following commands:" -msgstr "接著,若要開始建置並執行 SSR 伺服器,可執行下列指令:" - -#: docs/10.x/vite.md:block 167 (code) -msgid "npm run build\n" -"node bootstrap/ssr/ssr.js\n" +"});" msgstr "" -#: docs/10.x/vite.md:block 168 (paragraph) -msgid "If you are using [SSR with Inertia](https://inertiajs.com/server-side-rendering), you may instead use the `inertia:start-ssr` Artisan command to start the SSR server:" +# H2 +#: ./docs/10.x/vite.md:599 +#: ./docs/11.x/vite.md:670 +#: ./docs/master/vite.md:599 +msgid "Disabling Vite in Tests" msgstr "" -#: docs/10.x/vite.md:block 169 (code) -msgid "php artisan inertia:start-ssr\n" +# P +#: ./docs/10.x/vite.md:603 +#: ./docs/11.x/vite.md:674 +#: ./docs/master/vite.md:603 +msgid "If you would prefer to mock Vite during testing, you may call the `withoutVite` method, which is available for any tests that extend Laravel's `TestCase` class:" msgstr "" -#: docs/10.x/vite.md:block 170 (quote) -msgid "**Note** Laravel's [starter kits](/docs/{{version}}/starter-kits) already include the proper Laravel, Inertia SSR, and Vite configuration. Check out [Laravel Breeze](/docs/{{version}}/starter-kits#breeze-and-inertia) for the fastest way to get started with Laravel, Inertia SSR, and Vite." -msgstr "**Note** Laravel 的[入門套件](/docs/{{version}}/starter-kits)中已經包含了適當的 Laravel、Inertia SSR、與 Vite 設定。請參考看看使用 [Laravel Breeze](/docs/{{version}}/starter-kits#breeze-and-inertia),來用最快的速度開始使用 Laravel、Inertia SSR、與 Vite。" +# P +#: ./docs/11.x/vite.md:603 +msgid "In the example above, assets will be prefetched with a maximum of `3` concurrent downloads on each page load. You can modify the concurrency to suit your application's needs or specify no concurrency limit if the application should download all assets at once:" +msgstr "" -#: docs/10.x/vite.md:block 172 (header) -msgid "Script & Style Tag Attributes" -msgstr "Script 與 Style 標籤的屬性" +# CODE: php +# CODE: php tab=PHPUnit +#: ./docs/10.x/vite.md:605 +#: ./docs/11.x/vite.md:684 +#: ./docs/master/vite.md:613 +msgid "use Tests\\TestCase;\n\n" +"class ExampleTest extends TestCase\n" +"{\n" +" public function test_without_vite_example(): void\n" +" {\n" +" $this->withoutVite();\n\n" +" // ...\n" +" }\n" +"}" +msgstr "" + +# CODE: php +#: ./docs/11.x/vite.md:605 +msgid "/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Vite::prefetch();\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/vite.md:612 +#: ./docs/10.x/vite.md:660 +#: ./docs/11.x/vite.md:737 +#: ./docs/master/vite.md:666 +msgid "To ensure you don't forget to rebuild the SSR entry point, we recommend augmenting the \"build\" script in your application's `package.json` to create your SSR build:" +msgstr "" + +# CODE: json +#: ./docs/9.x/vite.md:614 +#: ./docs/10.x/vite.md:662 +#: ./docs/11.x/vite.md:739 +#: ./docs/master/vite.md:668 +msgid "\"scripts\": {\n" +" \"dev\": \"vite\",\n" +" \"build\": \"vite build\" // [tl! remove]\n" +" \"build\": \"vite build && vite build --ssr\" // [tl! add]\n" +"}" +msgstr "" + +# P +#: ./docs/11.x/vite.md:615 +msgid "By default, prefetching will begin when the [page *load* event](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event) fires. If you would like to customize when prefetching begins, you may specify an event that Vite will listen for:" +msgstr "" + +# CODE: php +#: ./docs/11.x/vite.md:617 +msgid "/**\n" +" * Bootstrap any application services.\n" +" */\n" +"public function boot(): void\n" +"{\n" +" Vite::prefetch(event: 'vite:prefetch');\n" +"}" +msgstr "" + +# P +#: ./docs/9.x/vite.md:622 +#: ./docs/10.x/vite.md:670 +#: ./docs/11.x/vite.md:747 +#: ./docs/master/vite.md:676 +msgid "Then, to build and start the SSR server, you may run the following commands:" +msgstr "" + +# CODE: sh +#: ./docs/9.x/vite.md:624 +msgid "npm run build\n" +"node bootstrap/ssr/ssr.mjs" +msgstr "" + +# P +#: ./docs/11.x/vite.md:627 +msgid "Given the code above, prefetching will now begin when you manually dispatch the `vite:prefetch` event on the `window` object. For example, you could have prefetching begin three seconds after the page loads:" +msgstr "" + +# CODE: html +#: ./docs/11.x/vite.md:629 +msgid "" +msgstr "" -#: docs/10.x/vite.md:block 174 (header) +# P +#: ./docs/9.x/vite.md:630 +#: ./docs/10.x/vite.md:684 +#: ./docs/11.x/vite.md:761 +#: ./docs/master/vite.md:690 +msgid "Laravel's [starter kits](/docs/{{version}}/starter-kits) already include the proper Laravel, Inertia SSR, and Vite configuration. Check out [Laravel Breeze](/docs/{{version}}/starter-kits#breeze-and-inertia) for the fastest way to get started with Laravel, Inertia SSR, and Vite." +msgstr "" + +# P +#: ./docs/9.x/vite.md:632 +#: ./docs/10.x/vite.md:686 +#: ./docs/11.x/vite.md:763 +#: ./docs/master/vite.md:692 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/vite.md:633 +msgid "Script & Style Tag Attributes" +msgstr "" + +# P +#: ./docs/9.x/vite.md:635 +#: ./docs/10.x/vite.md:689 +#: ./docs/11.x/vite.md:766 +#: ./docs/master/vite.md:695 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/vite.md:636 +#: ./docs/10.x/vite.md:690 +#: ./docs/11.x/vite.md:767 +#: ./docs/master/vite.md:696 msgid "Content Security Policy (CSP) Nonce" -msgstr "內容安全性原則 (CSP) 的 Nonce" +msgstr "" -#: docs/10.x/vite.md:block 175 (paragraph) +# P +#: ./docs/9.x/vite.md:638 +#: ./docs/10.x/vite.md:692 +#: ./docs/11.x/vite.md:769 +#: ./docs/master/vite.md:698 msgid "If you wish to include a [`nonce` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) on your script and style tags as part of your [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP), you may generate or specify a nonce using the `useCspNonce` method within a custom [middleware](/docs/{{version}}/middleware):" -msgstr "若想在 script 與 style 上為[內容安全性原則 (CSP, Content Security Policy)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) 加上 [`nonce` 屬性](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce),可以自定一個 [Middleware](/docs/{{version}}/middleware) 來使用 `useCspNonce` 方法來產生或指定一個 Nonce。" +msgstr "" -#: docs/10.x/vite.md:block 176 (code) +# CODE: php +#: ./docs/9.x/vite.md:640 msgid "withHeaders([\n" " 'Content-Security-Policy' => \"script-src 'nonce-\".Vite::cspNonce().\"'\",\n" " ]);\n" " }\n" -"}\n" +"}" msgstr "" -#: docs/10.x/vite.md:block 177 (paragraph) +# P +#: ./docs/9.x/vite.md:668 +#: ./docs/10.x/vite.md:722 +#: ./docs/11.x/vite.md:799 +#: ./docs/master/vite.md:728 msgid "After invoking the `useCspNonce` method, Laravel will automatically include the `nonce` attributes on all generated script and style tags." -msgstr "呼叫 `useCspNonce` 方法後,Laravel 就會自動在所有產生的 script 與 style 標籤上包含一個 `nonce` 屬性。" +msgstr "" -#: docs/10.x/vite.md:block 178 (paragraph) +# P +#: ./docs/9.x/vite.md:670 +#: ./docs/10.x/vite.md:724 +#: ./docs/11.x/vite.md:801 +#: ./docs/master/vite.md:730 msgid "If you need to specify the nonce elsewhere, including the [Ziggy `@route` directive](https://github.com/tighten/ziggy#using-routes-with-a-content-security-policy) included with Laravel's [starter kits](/docs/{{version}}/starter-kits), you may retrieve it using the `cspNonce` method:" -msgstr "若有需要在別處指定 Nonce,如在 Laravel [入門套件](/docs/{{version}}/starter-kits)中所包含的 [Ziggy `@route` 指示詞](https://github.com/tighten/ziggy#using-routes-with-a-content-security-policy),則可以使用 `cspNonce` 方法來取得該 Nonce:" +msgstr "" -#: docs/10.x/vite.md:block 179 (code) -msgid "@routes(nonce: Vite::cspNonce())\n" -msgstr "@routes(nonce: Vite::cspNonce())\n" +# CODE: sh +#: ./docs/10.x/vite.md:672 +#: ./docs/11.x/vite.md:749 +#: ./docs/master/vite.md:678 +msgid "npm run build\n" +"node bootstrap/ssr/ssr.js" +msgstr "" -#: docs/10.x/vite.md:block 180 (paragraph) +# CODE: blade +#: ./docs/9.x/vite.md:672 +#: ./docs/10.x/vite.md:726 +#: ./docs/11.x/vite.md:803 +#: ./docs/master/vite.md:732 +msgid "@routes(nonce: Vite::cspNonce())" +msgstr "" + +# CODE: php tab=Pest +#: ./docs/11.x/vite.md:676 +#: ./docs/master/vite.md:605 +msgid "test('without vite example', function () {\n" +" $this->withoutVite();\n\n" +" // ...\n" +"});" +msgstr "" + +# P +#: ./docs/9.x/vite.md:676 +#: ./docs/10.x/vite.md:730 +#: ./docs/11.x/vite.md:807 +#: ./docs/master/vite.md:736 msgid "If you already have a nonce that you would like to instruct Laravel to use, you may pass the nonce to the `useCspNonce` method:" -msgstr "若已有 Nonce,且想讓 Laravel 使用該 Nonce,則可傳入該 Nonce 給 `useCspNonce` 方法:" +msgstr "" -#: docs/10.x/vite.md:block 181 (code) -msgid "Vite::useCspNonce($nonce);\n" -msgstr "Vite::useCspNonce($nonce);\n" +# P +#: ./docs/10.x/vite.md:677 +#: ./docs/11.x/vite.md:754 +#: ./docs/master/vite.md:683 +msgid "If you are using [SSR with Inertia](https://inertiajs.com/server-side-rendering), you may instead use the `inertia:start-ssr` Artisan command to start the SSR server:" +msgstr "" -#: docs/10.x/vite.md:block 183 (header) +# CODE: php +#: ./docs/9.x/vite.md:678 +#: ./docs/10.x/vite.md:732 +#: ./docs/11.x/vite.md:809 +#: ./docs/master/vite.md:738 +msgid "Vite::useCspNonce($nonce);" +msgstr "" + +# CODE: sh +#: ./docs/10.x/vite.md:679 +#: ./docs/11.x/vite.md:756 +#: ./docs/master/vite.md:685 +msgid "php artisan inertia:start-ssr" +msgstr "" + +# P +#: ./docs/9.x/vite.md:682 +#: ./docs/10.x/vite.md:736 +#: ./docs/11.x/vite.md:813 +#: ./docs/master/vite.md:742 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/vite.md:683 +#: ./docs/10.x/vite.md:737 +#: ./docs/11.x/vite.md:814 +#: ./docs/master/vite.md:743 msgid "Subresource Integrity (SRI)" -msgstr "子資源完整性 (SRI)" +msgstr "" -#: docs/10.x/vite.md:block 184 (paragraph) +# P +#: ./docs/9.x/vite.md:685 +#: ./docs/10.x/vite.md:739 +#: ./docs/11.x/vite.md:816 +#: ./docs/master/vite.md:745 msgid "If your Vite manifest includes `integrity` hashes for your assets, Laravel will automatically add the `integrity` attribute on any script and style tags it generates in order to enforce [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity). By default, Vite does not include the `integrity` hash in its manifest, but you may enable it by installing the [`vite-plugin-manifest-sri`](https://www.npmjs.com/package/vite-plugin-manifest-sri) NPM plugin:" -msgstr "若 Vite Manifest 中有包含資源的 ^[`integrity`](完整性) 雜湊,則 Laravel 會自動在所有 Vite 產生的 script 與 style 標籤上加上 `integrity` 屬性,已強制確保[子資源完整性 (SRI, Subresource Integrity)](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity)。預設情況下,Vite 不會在其 Manifest 檔中包含 `integrity` 雜湊。但只要安裝 [`vite-plugin-manifest-sri`](https://www.npmjs.com/package/vite-plugin-manifest-sri) NPM 外掛,就可啟用該功能:" +msgstr "" + +# H2 +#: ./docs/10.x/vite.md:687 +#: ./docs/11.x/vite.md:764 +#: ./docs/master/vite.md:693 +msgid "Script and Style Tag Attributes" +msgstr "" -#: docs/10.x/vite.md:block 185 (code) -msgid "npm install --save-dev vite-plugin-manifest-sri\n" -msgstr "npm install --save-dev vite-plugin-manifest-sri\n" +# CODE: shell +#: ./docs/9.x/vite.md:687 +#: ./docs/10.x/vite.md:741 +#: ./docs/11.x/vite.md:818 +#: ./docs/master/vite.md:747 +msgid "npm install --save-dev vite-plugin-manifest-sri" +msgstr "" -#: docs/10.x/vite.md:block 186 (paragraph) +# P +#: ./docs/9.x/vite.md:691 +#: ./docs/10.x/vite.md:745 +#: ./docs/11.x/vite.md:822 +#: ./docs/master/vite.md:751 msgid "You may then enable this plugin in your `vite.config.js` file:" -msgstr "可以在 `vite.config.js` 檔中啟用該外掛:" +msgstr "" -#: docs/10.x/vite.md:block 187 (code) +# CODE: js +#: ./docs/9.x/vite.md:693 +#: ./docs/10.x/vite.md:747 +#: ./docs/11.x/vite.md:824 +#: ./docs/master/vite.md:753 msgid "import { defineConfig } from 'vite';\n" "import laravel from 'laravel-vite-plugin';\n" "import manifestSRI from 'vite-plugin-manifest-sri';// [tl! add]\n\n" @@ -1191,46 +2288,114 @@ msgid "import { defineConfig } from 'vite';\n" " }),\n" " manifestSRI(),// [tl! add]\n" " ],\n" -"});\n" -msgstr "import { defineConfig } from 'vite';\n" -"import laravel from 'laravel-vite-plugin';\n" -"import manifestSRI from 'vite-plugin-manifest-sri';// [tl! add]\n\n" -"export default defineConfig({\n" -" plugins: [\n" -" laravel({\n" -" // ...\n" -" }),\n" -" manifestSRI(),// [tl! add]\n" -" ],\n" -"});\n" +"});" +msgstr "" + +# CODE: php +#: ./docs/10.x/vite.md:694 +#: ./docs/11.x/vite.md:771 +#: ./docs/master/vite.md:700 +msgid "withHeaders([\n" +" 'Content-Security-Policy' => \"script-src 'nonce-\".Vite::cspNonce().\"'\",\n" +" ]);\n" +" }\n" +"}" +msgstr "" + +# CODE: php +#: ./docs/11.x/vite.md:700 +#: ./docs/master/vite.md:629 +msgid "withoutVite();\n" +" }// [tl! add:end]\n" +"}" +msgstr "" -#: docs/10.x/vite.md:block 188 (paragraph) +# P +#: ./docs/9.x/vite.md:708 +#: ./docs/10.x/vite.md:762 +#: ./docs/11.x/vite.md:839 +#: ./docs/master/vite.md:768 msgid "If required, you may also customize the manifest key where the integrity hash can be found:" -msgstr "若有需要,也可以指定 Manifest 中保存 Integrity 雜湊的索引鍵:" +msgstr "" -#: docs/10.x/vite.md:block 189 (code) +# CODE: php +#: ./docs/9.x/vite.md:710 +#: ./docs/10.x/vite.md:764 +#: ./docs/11.x/vite.md:841 +#: ./docs/master/vite.md:770 msgid "use Illuminate\\Support\\Facades\\Vite;\n\n" -"Vite::useIntegrityKey('custom-integrity-key');\n" -msgstr "use Illuminate\\Support\\Facades\\Vite;\n\n" -"Vite::useIntegrityKey('custom-integrity-key');\n" +"Vite::useIntegrityKey('custom-integrity-key');" +msgstr "" -#: docs/10.x/vite.md:block 190 (paragraph) +# P +#: ./docs/9.x/vite.md:716 +#: ./docs/10.x/vite.md:770 +#: ./docs/11.x/vite.md:847 +#: ./docs/master/vite.md:776 msgid "If you would like to disable this auto-detection completely, you may pass `false` to the `useIntegrityKey` method:" -msgstr "若有需要完全禁用自動偵測,可傳入 `false` 給 `useIntegrityKey` 方法:" +msgstr "" -#: docs/10.x/vite.md:block 191 (code) -msgid "Vite::useIntegrityKey(false);\n" -msgstr "Vite::useIntegrityKey(false);\n" +# CODE: php +#: ./docs/9.x/vite.md:718 +#: ./docs/10.x/vite.md:772 +#: ./docs/11.x/vite.md:849 +#: ./docs/master/vite.md:778 +msgid "Vite::useIntegrityKey(false);" +msgstr "" -#: docs/10.x/vite.md:block 193 (header) +# P +#: ./docs/9.x/vite.md:722 +#: ./docs/10.x/vite.md:776 +#: ./docs/11.x/vite.md:853 +#: ./docs/master/vite.md:782 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/vite.md:723 +#: ./docs/10.x/vite.md:777 +#: ./docs/11.x/vite.md:854 +#: ./docs/master/vite.md:783 msgid "Arbitrary Attributes" -msgstr "任意屬性" +msgstr "" -#: docs/10.x/vite.md:block 194 (paragraph) +# P +#: ./docs/9.x/vite.md:725 +#: ./docs/10.x/vite.md:779 +#: ./docs/11.x/vite.md:856 +#: ./docs/master/vite.md:785 msgid "If you need to include additional attributes on your script and style tags, such as the [`data-turbo-track`](https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change) attribute, you may specify them via the `useScriptTagAttributes` and `useStyleTagAttributes` methods. Typically, this methods should be invoked from a [service provider](/docs/{{version}}/providers):" -msgstr "若有需要在 script 與 style 標籤上加入其他的額外屬性,如 [`data-turbo-track`](https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change) 等,則可使用 `useScriptTagAttributes` 與 `useStyleTagAttributes` 方法。一般來說,應該在某個 [Service Provider](/docs/{{version}}/providers) 中叫用該方法:" +msgstr "" -#: docs/10.x/vite.md:block 195 (code) +# CODE: php +#: ./docs/9.x/vite.md:727 +#: ./docs/10.x/vite.md:781 +#: ./docs/11.x/vite.md:858 +#: ./docs/master/vite.md:787 msgid "use Illuminate\\Support\\Facades\\Vite;\n\n" "Vite::useScriptTagAttributes([\n" " 'data-turbo-track' => 'reload', // Specify a value for the attribute...\n" @@ -1239,50 +2404,65 @@ msgid "use Illuminate\\Support\\Facades\\Vite;\n\n" "]);\n\n" "Vite::useStyleTagAttributes([\n" " 'data-turbo-track' => 'reload',\n" -"]);\n" -msgstr "use Illuminate\\Support\\Facades\\Vite;\n\n" -"Vite::useScriptTagAttributes([\n" -" 'data-turbo-track' => 'reload', // 為屬性指定值...\n" -" 'async' => true, // 指定一個沒有值的屬性...\n" -" 'integrity' => false, // 排除掉一個原本會被包含的屬性...\n" -"]);\n\n" -"Vite::useStyleTagAttributes([\n" -" 'data-turbo-track' => 'reload',\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/vite.md:block 196 (paragraph) +# P +#: ./docs/9.x/vite.md:741 +#: ./docs/10.x/vite.md:795 +#: ./docs/11.x/vite.md:872 +#: ./docs/master/vite.md:801 msgid "If you need to conditionally add attributes, you may pass a callback that will receive the asset source path, its URL, its manifest chunk, and the entire manifest:" -msgstr "若有需要有條件地新增屬性,則可傳入一個回呼。該回呼會收到素材的原始檔路徑、其 URL、該素材的 Manifest Chunk、以及整個 Manifest:" +msgstr "" -#: docs/10.x/vite.md:block 197 (code) +# CODE: php +#: ./docs/9.x/vite.md:743 +#: ./docs/10.x/vite.md:797 +#: ./docs/11.x/vite.md:874 +#: ./docs/master/vite.md:803 msgid "use Illuminate\\Support\\Facades\\Vite;\n\n" "Vite::useScriptTagAttributes(fn (string $src, string $url, array|null $chunk, array|null $manifest) => [\n" " 'data-turbo-track' => $src === 'resources/js/app.js' ? 'reload' : false,\n" "]);\n\n" "Vite::useStyleTagAttributes(fn (string $src, string $url, array|null $chunk, array|null $manifest) => [\n" " 'data-turbo-track' => $chunk && $chunk['isEntry'] ? 'reload' : false,\n" -"]);\n" -msgstr "use Illuminate\\Support\\Facades\\Vite;\n\n" -"Vite::useScriptTagAttributes(fn (string $src, string $url, array|null $chunk, array|null $manifest) => [\n" -" 'data-turbo-track' => $src === 'resources/js/app.js' ? 'reload' : false,\n" -"]);\n\n" -"Vite::useStyleTagAttributes(fn (string $src, string $url, array|null $chunk, array|null $manifest) => [\n" -" 'data-turbo-track' => $chunk && $chunk['isEntry'] ? 'reload' : false,\n" -"]);\n" +"]);" +msgstr "" -#: docs/10.x/vite.md:block 198 (quote) -msgid "**Warning** The `$chunk` and `$manifest` arguments will be `null` while the Vite development server is running." -msgstr "**Warning** 在執行 Vite 開發伺服器時,`$chunk` 與 `$manifest` 屬性會是 `null`。" +# P +#: ./docs/9.x/vite.md:756 +#: ./docs/10.x/vite.md:810 +#: ./docs/11.x/vite.md:887 +#: ./docs/master/vite.md:816 +msgid "The `$chunk` and `$manifest` arguments will be `null` while the Vite development server is running." +msgstr "" -#: docs/10.x/vite.md:block 200 (header) +# P +#: ./docs/9.x/vite.md:758 +#: ./docs/10.x/vite.md:812 +#: ./docs/11.x/vite.md:889 +#: ./docs/master/vite.md:818 +#~ msgid "" +#~ msgstr "" + +# H2 +#: ./docs/9.x/vite.md:759 +#: ./docs/10.x/vite.md:813 +#: ./docs/11.x/vite.md:890 +#: ./docs/master/vite.md:819 msgid "Advanced Customization" -msgstr "進階客製化" +msgstr "" -#: docs/10.x/vite.md:block 201 (paragraph) +# P +#: ./docs/9.x/vite.md:761 +#: ./docs/10.x/vite.md:815 +#: ./docs/11.x/vite.md:892 +#: ./docs/master/vite.md:821 msgid "Out of the box, Laravel's Vite plugin uses sensible conventions that should work for the majority of applications; however, sometimes you may need to customize Vite's behavior. To enable additional customization options, we offer the following methods and options which can be used in place of the `@vite` Blade directive:" -msgstr "在新安裝好的 Laravel Vite 外掛中使用到了一些合理的慣例。這些慣例應該適用於大多數專案。不過,有時候我們還是需要自定 Vite 的姓外。若要啟用額外的客製化選項,Laravel 提供了下列方法與選項,可用於替代 `@vite` Blade 指示詞:" +msgstr "" -#: docs/10.x/vite.md:block 202 (code) +# CODE: blade +#: ./docs/9.x/vite.md:763 msgid "\n" "\n" " {{-- ... --}}\n\n" @@ -1292,23 +2472,22 @@ msgid "\n" " ->useManifestFilename('assets.json') // Customize the manifest filename...\n" " ->withEntryPoints(['resources/js/app.js']) // Specify the entry points...\n" " }}\n" -"\n" -msgstr "\n" -"\n" -" {{-- ... --}}\n\n" -" {{\n" -" Vite::useHotFile(storage_path('vite.hot')) // 自定「Hot」檔...\n" -" ->useBuildDirectory('bundle') // 自定建置目錄...\n" -" ->useManifestFilename('assets.json') // 自定 Manifest 檔名...\n" -" ->withEntryPoints(['resources/js/app.js']) // 指定 Entry Point...\n" -" }}\n" -"\n" +"" +msgstr "" -#: docs/10.x/vite.md:block 203 (paragraph) +# P +#: ./docs/9.x/vite.md:777 +#: ./docs/10.x/vite.md:834 +#: ./docs/11.x/vite.md:911 +#: ./docs/master/vite.md:840 msgid "Within the `vite.config.js` file, you should then specify the same configuration:" -msgstr "在 `vite.config.js` 中,也可以指定相同的設定:" +msgstr "" -#: docs/10.x/vite.md:block 204 (code) +# CODE: js +#: ./docs/9.x/vite.md:779 +#: ./docs/10.x/vite.md:836 +#: ./docs/11.x/vite.md:913 +#: ./docs/master/vite.md:842 msgid "import { defineConfig } from 'vite';\n" "import laravel from 'laravel-vite-plugin';\n\n" "export default defineConfig({\n" @@ -1322,47 +2501,67 @@ msgid "import { defineConfig } from 'vite';\n" " build: {\n" " manifest: 'assets.json', // Customize the manifest filename...\n" " },\n" -"});\n" -msgstr "import { defineConfig } from 'vite';\n" -"import laravel from 'laravel-vite-plugin';\n\n" -"export default defineConfig({\n" -" plugins: [\n" -" laravel({\n" -" hotFile: 'storage/vite.hot', // 自定「Hot」檔名...\n" -" buildDirectory: 'bundle', // 自定建置目錄...\n" -" input: ['resources/js/app.js'], // 自定 Entry Point...\n" -" }),\n" -" ],\n" -" build: {\n" -" manifest: 'assets.json', // 自定 Manifest 檔名...\n" -" },\n" -"});\n" +"});" +msgstr "" -#: docs/10.x/vite.md:block 206 (header) +# P +#: ./docs/9.x/vite.md:797 +#: ./docs/10.x/vite.md:854 +#: ./docs/11.x/vite.md:931 +#: ./docs/master/vite.md:860 +#~ msgid "" +#~ msgstr "" + +# H3 +#: ./docs/9.x/vite.md:798 +#: ./docs/10.x/vite.md:855 +#: ./docs/11.x/vite.md:932 +#: ./docs/master/vite.md:861 msgid "Correcting Dev Server URLs" -msgstr "修正開發伺服器的 URL" +msgstr "" -#: docs/10.x/vite.md:block 207 (paragraph) +# P +#: ./docs/9.x/vite.md:800 +#: ./docs/10.x/vite.md:857 +#: ./docs/11.x/vite.md:934 +#: ./docs/master/vite.md:863 msgid "Some plugins within the Vite ecosystem assume that URLs which begin with a forward-slash will always point to the Vite dev server. However, due to the nature of the Laravel integration, this is not the case." -msgstr "在 Vite 生態系統中,有些外掛會假設 URL 以斜線 (`/`) 開頭的 URL 是指向 Vite 開發伺服器的。不過,由於 Laravel 整合的特性,這個假設在 Laravel 中並不成立。" +msgstr "" -#: docs/10.x/vite.md:block 208 (paragraph) +# P +#: ./docs/9.x/vite.md:802 +#: ./docs/10.x/vite.md:859 +#: ./docs/11.x/vite.md:936 +#: ./docs/master/vite.md:865 msgid "For example, the `vite-imagetools` plugin outputs URLs like the following while Vite is serving your assets:" -msgstr "舉例來說,在使用 Vite 伺服器提供素材時,`vite-imagetools` 外掛會像下面這樣輸出 URL:" +msgstr "" -#: docs/10.x/vite.md:block 209 (code) -msgid "\n" -msgstr "\n" +# CODE: html +#: ./docs/9.x/vite.md:804 +#: ./docs/10.x/vite.md:861 +#: ./docs/11.x/vite.md:938 +#: ./docs/master/vite.md:867 +msgid "" +msgstr "" -#: docs/10.x/vite.md:block 210 (paragraph) +# P +#: ./docs/9.x/vite.md:808 +#: ./docs/10.x/vite.md:865 +#: ./docs/11.x/vite.md:942 +#: ./docs/master/vite.md:871 msgid "The `vite-imagetools` plugin is expecting that the output URL will be intercepted by Vite and the plugin may then handle all URLs that start with `/@imagetools`. If you are using plugins that are expecting this behaviour, you will need to manually correct the URLs. You can do this in your `vite.config.js` file by using the `transformOnServe` option." -msgstr "`vite-imagetools` 外掛預期這個輸出 URL 會被 Vite 攔截,讓這個外掛能處理所有以 `/@imagetools` 開頭的所有 URL。若你使用的外掛有預期這樣的行為,就需要手動修正 URL。可以在 `vite.config.js` 檔案中修改 `transformOnServe` 選項來修正 URL。" +msgstr "" -#: docs/10.x/vite.md:block 211 (paragraph) -msgid "In this particular example, we will prepend the dev server URL to all occurrences of `/@imagetools` within the generated code:" +# P +#: ./docs/9.x/vite.md:810 +msgid "In this particular example, we will append the dev server URL to all occurrences of `/@imagetools` within the generated code:" msgstr "" -#: docs/10.x/vite.md:block 212 (code) +# CODE: js +#: ./docs/9.x/vite.md:812 +#: ./docs/10.x/vite.md:869 +#: ./docs/11.x/vite.md:946 +#: ./docs/master/vite.md:875 msgid "import { defineConfig } from 'vite';\n" "import laravel from 'laravel-vite-plugin';\n" "import { imagetools } from 'vite-imagetools';\n\n" @@ -1374,221 +2573,49 @@ msgid "import { defineConfig } from 'vite';\n" " }),\n" " imagetools(),\n" " ],\n" -"});\n" -msgstr "import { defineConfig } from 'vite';\n" -"import laravel from 'laravel-vite-plugin';\n" -"import { imagetools } from 'vite-imagetools';\n\n" -"export default defineConfig({\n" -" plugins: [\n" -" laravel({\n" -" // ...\n" -" transformOnServe: (code, devServerUrl) => code.replaceAll('/@imagetools', devServerUrl+'/@imagetools'),\n" -" }),\n" -" imagetools(),\n" -" ],\n" -"});\n" +"});" +msgstr "" + +# CODE: blade +#: ./docs/10.x/vite.md:817 +#: ./docs/11.x/vite.md:894 +#: ./docs/master/vite.md:823 +msgid "\n" +"\n" +" {{-- ... --}}\n\n" +" {{\n" +" Vite::useHotFile(storage_path('vite.hot')) // Customize the \"hot\" file...\n" +" ->useBuildDirectory('bundle') // Customize the build directory...\n" +" ->useManifestFilename('assets.json') // Customize the manifest filename...\n" +" ->withEntryPoints(['resources/js/app.js']) // Specify the entry points...\n" +" ->createAssetPathsUsing(function (string $path, ?bool $secure) { // Customize the backend path generation for built assets...\n" +" return \"https://cdn.example.com/{$path}\";\n" +" })\n" +" }}\n" +"" +msgstr "" -#: docs/10.x/vite.md:block 213 (paragraph) +# P +#: ./docs/9.x/vite.md:828 +#: ./docs/10.x/vite.md:885 +#: ./docs/11.x/vite.md:962 +#: ./docs/master/vite.md:891 msgid "Now, while Vite is serving Assets, it will output URLs that point to the Vite dev server:" -msgstr "現在,Vite 伺服器在提供素材時,就會輸出指向 Vite 開發伺服器的 URL:" +msgstr "" -#: docs/10.x/vite.md:block 214 (code) +# CODE: html +#: ./docs/9.x/vite.md:830 +#: ./docs/10.x/vite.md:887 +#: ./docs/11.x/vite.md:964 +#: ./docs/master/vite.md:893 msgid "- \n" -"+ \n" -msgstr "- \n" -"+ \n" - -#: docs/9.x/vite.md:block 11 (paragraph) -msgid "Vite also works well with traditional server-side rendered applications with JavaScript \"sprinkles\", including those using [Livewire](https://laravel-livewire.com). However, it lacks some features that Laravel Mix supports, such as the ability to copy arbitrary assets into the build that are not referenced directly in your JavaScript application." -msgstr "若在開發的專案是一些只使用 JavaScript 來「點綴」的傳統伺服器端轉譯的專案,或是使用 [Livewire](https://laravel-livewire.com) 時,也可以使用 Vite。不過,有一些功能是只有 Laravel Mix 支援而 Vite 不支援的,例如將一些資源直接複製到建置結果中,並且不直接在 JavaScript 程式中參照這些資源。" - -#: docs/9.x/vite.md:block 41 (paragraph) -msgid "If you are using [Laravel Valet](/docs/{{version}}/valet) for local development and have run the [secure command](/docs/{{version}}/valet#securing-sites) against your application, you may configure the Vite development server to automatically use Valet's generated TLS certificates:" -msgstr "如果你使用 [Laravel Valet](/docs/{{version}}/valet) 來作為本機開發環境,並對專案使用了 [secure 指令](/docs/{{version}}/valet#securing-sites),那麼可以設定讓 Vite 開發伺服器自動使用 Valet 所產生的 TLS 憑證:" - -#: docs/9.x/vite.md:block 42 (code) -msgid "import { defineConfig } from 'vite';\n" -"import laravel from 'laravel-vite-plugin';\n\n" -"export default defineConfig({\n" -" plugins: [\n" -" laravel({\n" -" // ...\n" -" valetTls: 'my-app.test', // [tl! add]\n" -" }),\n" -" ],\n" -"});\n" -msgstr "import { defineConfig } from 'vite';\n" -"import laravel from 'laravel-vite-plugin';\n\n" -"export default defineConfig({\n" -" plugins: [\n" -" laravel({\n" -" // ...\n" -" valetTls: 'my-app.test', // [tl! add]\n" -" }),\n" -" ],\n" -"});\n" - -#: docs/9.x/vite.md:block 48 (paragraph) -msgid "With your Vite entry points configured, you only need reference them in a `@vite()` Blade directive that you add to the `` of your application's root template:" -msgstr "設定好 Vite 的 Entry Point 後,我們接著就只需要在專案根樣板中的 `` 內使用 `@vite()` Blade 指示詞來參照這些 Entry Point 即可:" - -#: docs/9.x/vite.md:block 70 (paragraph) -msgid "If you would like to build your front-end using the [Vue](https://vuejs.org/) framework, then you will also need to install the `@vitejs/plugin-vue` plugin:" -msgstr "若想使用 [Vue](https://vuejs.org/) 框架來建置前端,則也需要安裝 `@vitejs/plugin-vue` 外掛:" - -#: docs/9.x/vite.md:block 77 (paragraph) -msgid "If you would like to build your front-end using the [React](https://reactjs.org/) framework, then you will also need to install the `@vitejs/plugin-react` plugin:" -msgstr "若想使用 [React](https://reactjs.org/) 框架來建置前端,則也需要安裝 `@vitejs/plugin-react` 外掛:" - -#: docs/9.x/vite.md:block 102 (code) -msgid "module.exports = {\n" -" plugins: {\n" -" tailwindcss: {},\n" -" autoprefixer: {},\n" -" },\n" -"};\n" -msgstr "module.exports = {\n" -" plugins: {\n" -" tailwindcss: {},\n" -" autoprefixer: {},\n" -" },\n" -"};\n" - -#: docs/9.x/vite.md:block 126 (code) -msgid "/**\n" -" * Bootstrap any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Vite::macro('image', fn ($asset) => $this->asset(\"resources/images/{$asset}\"));\n" -"}\n" -msgstr "/**\n" -" * Bootstrap any application services.\n" -" *\n" -" * @return void\n" -" */\n" -"public function boot()\n" -"{\n" -" Vite::macro('image', fn ($asset) => $this->asset(\"resources/images/{$asset}\"));\n" -"}\n" - -#: docs/9.x/vite.md:block 146 (code) -msgid "use Tests\\TestCase;\n\n" -"class ExampleTest extends TestCase\n" -"{\n" -" public function test_without_vite_example()\n" -" {\n" -" $this->withoutVite();\n\n" -" // ...\n" -" }\n" -"}\n" -msgstr "use Tests\\TestCase;\n\n" -"class ExampleTest extends TestCase\n" -"{\n" -" public function test_without_vite_example()\n" -" {\n" -" $this->withoutVite();\n\n" -" // ...\n" -" }\n" -"}\n" - -#: docs/9.x/vite.md:block 156 (code) -msgid "npm run build\n" -"node bootstrap/ssr/ssr.mjs\n" -msgstr "npm run build\n" -"node bootstrap/ssr/ssr.mjs\n" - -#: docs/9.x/vite.md:block 163 (code) -msgid "withHeaders([\n" -" 'Content-Security-Policy' => \"script-src 'nonce-\".Vite::cspNonce().\"'\",\n" -" ]);\n" -" }\n" -"}\n" -msgstr "withHeaders([\n" -" 'Content-Security-Policy' => \"script-src 'nonce-\".Vite::cspNonce().\"'\",\n" -" ]);\n" -" }\n" -"}\n" - -#: docs/9.x/vite.md:block 198 (paragraph) -msgid "In this particular example, we will append the dev server URL to all occurrences of `/@imagetools` within the generated code:" -msgstr "在這個範例中,我們在產生的程式碼中,為所有的 `/@imagetools` 網址前方加上開發伺服器的 URL:" +"+ " +msgstr "" -#: docs/master/vite.md:block 164 (code) -msgid "withHeaders([\n" -" 'Content-Security-Policy' => \"script-src 'nonce-\".Vite::cspNonce().\"'\",\n" -" ]);\n" -" }\n" -"}\n" -msgstr "withHeaders([\n" -" 'Content-Security-Policy' => \"script-src 'nonce-\".Vite::cspNonce().\"'\",\n" -" ]);\n" -" }\n" -"}\n" +# P +#: ./docs/10.x/vite.md:867 +#: ./docs/11.x/vite.md:944 +#: ./docs/master/vite.md:873 +msgid "In this particular example, we will prepend the dev server URL to all occurrences of `/@imagetools` within the generated code:" +msgstr ""