本文整理匯總了PHP中app\Item::withTrashed方法的典型用法代碼示例。如果您正苦於以下問題:PHP Item::withTrashed方法的具體用法?PHP Item::withTrashed怎麽用?PHP Item::withTrashed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Item
的用法示例。
在下文中一共展示了Item::withTrashed方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
<th>Item</th>
<th>Units</th>
<th>Quantity</th>
<th>Selling Price per Unit</th>
<th>Subtotal</th>
</tr>
</thead>
<tbody>
@foreach ($items as $item)
<tr>
<td><?php
echo Item::withTrashed()->find($item->item_id)->name;
?>
</td>
<td><?php
echo Item::withTrashed()->find($item->item_id)->unit;
?>
</td>
<td>{{ $item->quantity }}</td>
<td>Php {{ number_format($item->unit_price, 2, '.', ',') }}</td>
<td>Php {{ number_format($item->total_price, 2, '.', ',') }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<br><br>
<div class="panel panel-default">
<div class="panel-heading"><strong>Controls</strong></div>
<div class="panel-body">
<table class="button-tables">
示例2: destroyAll
public function destroyAll()
{
Item::withTrashed()->where('user_id', \Auth::user()->id)->forceDelete();
\Session::flash('flash_message', "All items have been permanently deleted");
return redirect('items');
}