Readouble

Laravel 5.0 コレクション

イントロダクションIntroduction

Illuminate\Support\Collectionクラスは、配列データを操作するための、書きやすく使いやすいラッパーです。以下の例をご覧ください。配列から、新しいコレクションインスタンスを作成するために、collectヘルパを使用しています。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:

$collection = collect(['taylor', 'abigail', null])->map(function($name)
{
	return strtoupper($name);
})
->reject(function($name)
{
	return empty($name);
});

ご覧の通り、Collectionクラスは、裏にある配列をマップ操作してから要素削除するメソッドをチェーンでスムーズにつなげてくれます。つまり、全てのCollectionメソッドは、新しいCollectionインスタンスを返します。より掘り下げますので、続けて読み進めてください!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, every Collection method returns an entirely new Collection instance. To dig in further, keep reading!

基本的な使用法Basic Usage

コレクションの生成Creating Collections

上記の通り、collectヘルパは指定された配列を元に、新しいIlluminate\Support\Collectionインスタンスを返します。また、Collectionクラスのmakeメソッドを使うこともできます。As mentioned above, the collect helper will return a new Illuminate\Support\Collection instance for the given array. You may also use the make command on the Collection class:

$collection = collect([1, 2, 3]);

$collection = Collection::make([1, 2, 3]);

もちろん、Eloquentオブジェクトのコレクションは、いつもCollectionインスタンスを返します。しかし、アプリケーションで便利に使えるなら、どこででも自由にCollectionクラスを使ってください。Of course, collections of Eloquent[/docs/{{version}}/eloquent] objects are always returned as Collection instances; however, you should feel free to use the Collection class wherever it is convenient for your application.

コレクションの詳細Explore The Collection

コレクションで使用できるメソッド全部をここではリストできません。(たくさんあります。)代わりに、クラスのAPIドキュメントをご覧ください。Instead of listing all of the methods (there are a lot) the Collection makes available, check out the API documentation for the class[http://laravel.com/api/master/Illuminate/Support/Collection.html]!

章選択

Artisan CLI

設定

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

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

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

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

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

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

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

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

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

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

本文フォント

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

コードフォント

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

保存内容リセット

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

ヘッダー項目移動

キーボード操作