{{$barang->stock}}
这是查看我的数据库值的代码。我想用它来治疗-
“ if({{{$ barang-> stock}}> = 1;“就绪库存”;“库存空”)”
<table>
<thead>
<tr>
<th>ID</th>
<th>Jacket Color</th>
<th>Stock</th>
<th>Product Sales</th>
<th>Price</th>
<th>Product Status</th>
<th>Create At</th>
<th>Setting</th>
</tr>
</thead>
<tbody>
@foreach($barang as $barang)
<tr>
<td>{{$barang->id}}</td>
<td>{{$barang->color}}</td>
<td>{{$barang->stock}}</td>
<td>{{$barang->sales}}</td>
<td>Rp {{$barang->price}}</td>
<td>{{if ($barang->stock >= 1)}}</td>
<td>{{$barang->created_at}}</td>
<td>
<button href="{{ route('barang.edit',$barang->id)}}" data-toggle="tooltip" title="Edit" class="pd-setting-ed"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></button>
<form action="{{ route('barang.destroy', $barang->id)}}" method="post">
@csrf
@method('DELETE')
<button data-toggle="tooltip" title="Trash" class="pd-setting-ed"><i class="fa fa-trash-o" aria-hidden="true"></i></button>
</form>
</td>
</tr>
@endforeach
<tbody>
</table>
答案 0 :(得分:1)
gcloud