标签:引入 foreach check ati ext -- 传递 tle while
@extends(‘layouts.master‘)
@section(‘title‘, ‘Page Title‘)
@section(‘sidebar‘)
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section(‘content‘)
<p>This is my body content.</p>
@endsection
{{ isset($name) ? $name : ‘Default‘ }} = {{ $name or ‘Default‘ }} 等价
@{{ name }} 直接输出
@if (count($records) === 1)
I have one record!
@elseif (count($records) > 1)
I have multiple records!
@else
I don‘t have any records!
@endif
和IF相反
@unless (Auth::check())
You are not signed in.
@endunless
@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
@foreach ($users as $user)
@if ($loop->first)
This is the first iteration.
@endif
@if ($loop->last)
This is the last iteration.
@endif
<p>This is user {{ $user->id }}</p>
@endforeach
@foreach ($users as $user)
@foreach ($user->posts as $post)
@if ($loop->parent->first)
This is first iteration of the parent loop.
@endif
@endforeach
@endforeach
@include(‘shared.errors‘)
Blade允许你推送内容到命名堆栈,以便在其他视图或布局中渲染。这在子视图中引入指定JavaScript库时很有用:
@push(‘scripts‘)
<script src="/example.js"></script>
@endpush
推送次数不限,要渲染完整的堆栈内容,传递堆栈名称到 @stack 指令即可:
<head>
<!-- Head Contents -->
@stack(‘scripts‘)
</head>
{{time()}}
标签:引入 foreach check ati ext -- 传递 tle while
原文地址:https://www.cnblogs.com/vxianfeng/p/9746933.html