来自数据库记录的 if else 语句 laravel 5.2
if else statement from database record laravel 5.2
我想从数据库记录创建 if else。
例如:我在 "status" 行中记录了“1”。
"if status = "1"
echo Show Button
else
don't show button"
控制器和视图中的代码是什么?
只需在视图中输入您的 if
@foreach ($itens as $item)
@if ($item->status == 1)
<input type="button"/>
@endif
@endforeach
在你的控制器中你不需要关心它
您可以为此使用 Laravel Blade 模板控制结构
即
@if($status == 1)
...
<!-- HTML Code to generate button -->
...
@endif
阅读更多 here
我想从数据库记录创建 if else。
例如:我在 "status" 行中记录了“1”。
"if status = "1"
echo Show Button
else
don't show button"
控制器和视图中的代码是什么?
只需在视图中输入您的 if
@foreach ($itens as $item)
@if ($item->status == 1)
<input type="button"/>
@endif
@endforeach
在你的控制器中你不需要关心它
您可以为此使用 Laravel Blade 模板控制结构
即
@if($status == 1)
...
<!-- HTML Code to generate button -->
...
@endif
阅读更多 here