Readouble

Laravel 5.0 Templates

Blade Templating

Blade is a simple, yet powerful templating engine provided with Laravel. Unlike controller layouts, Blade is driven by template inheritance and sections. All Blade templates should use the .blade.php extension.

Defining A Blade Layout

<!-- Stored in resources/views/layouts/master.blade.php -->

<html>
	<head>
		<title>App Name - @yield('title')</title>
	</head>
	<body>
		@section('sidebar')
			This is the master sidebar.
		@show

		<div class="container">
			@yield('content')
		</div>
	</body>
</html>

Using A Blade Layout

@extends('layouts.master')

@section('title', 'Page Title')

@section('sidebar')
	@@parent

	<p>This is appended to the master sidebar.</p>
@stop

@section('content')
	<p>This is my body content.</p>
@stop

Note that views which extend a Blade layout simply override sections from the layout. Content of the layout can be included in a child view using the @@parent directive in a section, allowing you to append to the contents of a layout section such as a sidebar or footer.

Sometimes, such as when you are not sure if a section has been defined, you may wish to pass a default value to the @yield directive. You may pass the default value as the second argument:

@yield('section', 'Default Content')

Other Blade Control Structures

Echoing Data

Hello, {{ $name }}.

The current UNIX timestamp is {{ time() }}.

Echoing Data After Checking For Existence

Sometimes you may wish to echo a variable, but you aren't sure if the variable has been set. Basically, you want to do this:

{{ isset($name) ? $name : 'Default' }}

However, instead of writing a ternary statement, Blade allows you to use the following convenient short-cut:

{{ $name or 'Default' }}

Displaying Raw Text With Curly Braces

If you need to display a string that is wrapped in curly braces, you may escape the Blade behavior by prefixing your text with an @ symbol:

@{{ This will not be processed by Blade }}

If you don't want the data to be escaped, you may use the following syntax:

Hello, {!! $name !!}.

Note: Be very careful when echoing content that is supplied by users of your application. Always use the double curly brace syntax to escape any HTML entities in the content.

If Statements

@if (count($records) === 1)
	I have one record!
@elseif (count($records) > 1)
	I have multiple records!
@else
	I don't have any records!
@endif

@unless (Auth::check())
	You are not signed in.
@endunless

Loops

@for ($i = 0; $i < 10; $i++)
	The current value is {{ $i }}
@endfor

@foreach ($users as $user)
	<p>This is user {{ $user->id }}</p>
@endforeach

@forelse($users as $user)
	<li>{{ $user->name }}</li>
@empty
	<p>No users</p>
@endforelse

@while (true)
	<p>I'm looping forever.</p>
@endwhile

Including Sub-Views

@include('view.name')

You may also pass an array of data to the included view:

@include('view.name', ['some' => 'data'])

Overwriting Sections

To overwrite a section entirely, you may use the overwrite statement:

@extends('list.item.container')

@section('list.item.content')
	<p>This is an item of type {{ $item->type }}</p>
@overwrite

Displaying Language Lines

@lang('language.line')

@choice('language.line', 1)

Comments

{{-- This comment will not be in the rendered 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のみ表示
OS表示
全OS表示
macOSのみ表示
windowsのみ表示
linuxのみ表示
和文変換

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

本文フォント

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

コードフォント

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

保存内容リセット

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

ヘッダー項目移動

キーボード操作