我在删除表中所有记录的货币时出现了此错误,请告诉我发生了什么。
这是我在控制器中的代码
public function massDestroy(Request $request)
{
if (! Gate::allows('currency_delete')) {
return abort(401);
}
if ($request->input('ids')) {
$entries = Currency::whereIn('id', $request->input('ids'))->get();
foreach ($entries as $entry) {
$entry->delete();
}
}
}
而这是我在javascript.php 中的代码
@if (auth()->check())
$('#moneyFormat').maskMoney({
// The symbol to be displayed before the value entered by the user
prefix:'{{ auth()->user()->currency->symbol }}',
// The thousands separator
thousands:'{{ auth()->user()->currency->money_format_thousands }}',
// The decimal separator
decimal:'{{ auth()->user()->currency->money_format_decimal }}'
});
$('#expense, #income').submit(function(){
var value = $('#moneyFormat').maskMoney('unmasked')[0];
$('#moneyFormat').val(value);
});
@endif
尽管这可能不是一个直接的答案,而是一个建议,即在使用数据之前,我们应该始终通过使用var_dump转储数据来跟踪数据。这将减少我们的错误。