2019年5月17日金曜日

lavavel blade

@extends
@section
@show
@yield
@parent
@component
@slot
@inculde, @includeIf, @includeWhen, @includeFirst

Hello, @{{ name }}.
In this example, the @ symbol will be removed by Blade; however, {{ name }} expression will remain untouched by the Blade engine, allowing it to instead be rendered by your JavaScript framework.

@verbatim
    <div class="container">
        Hello, {{ name }}.
    </div>
@endverbatim

@if, @elseif, @else

@unless

@isset, @empty

@auth, @guest

@switch, @case, @break, @default

@for, @foreach, @forelse/@empty, @while
@continue, @break

@php

@csrf, @method

@error directive may be used to quickly check if validation error messages exist for a given attribute. Within an @error directive, you may echo the $message variable to display the error message:

<input id="title" type="text" class="@error('title') is-invalid @enderror">

@error('title')
    <div class="alert alert-danger">{{ $message }}</div>
@enderror

You may combine loops and includes into one line with Blade's @each directive:
@each('view.name', $jobs, 'job')
@each('view.name', $jobs, 'job', 'view.empty')

@inject directive may be used to retrieve a service from the Laravel service container.
@inject('metrics', 'App\Services\MetricsService')
<div>
    Monthly Revenue: {{ $metrics->monthlyRevenue() }}.
</div>

0 件のコメント:

コメントを投稿