练习一下blade模板的语法。如:变量渲染、foreach、if…else…2、include、section
if 语局
@if (count($records) === 1)
I have one record!
@elseif (count($records) > 1)
I have multiple records!
@else
I don't have any records!
@endif
Switch 语句
@switch($i)
@case(1)
First case...
@break
@case(2)
Second case...
@break
@default
Default case...
@endswitch
注释
{{-- 注释内容 --}}
PHP代码声明
@php
//
@endphp
for循环和foreach循环
@for ($i = 0; $i < 10; $i++)
The current value is {{ $i }}
@endfor
@foreach ($users as $user)
<p>This is user {{ $user->id }}</p>
@endforeach
引入子视图
@include('shared.errors')