请问我做错了什么,Paymentdetails 拒绝删除,它的加载服务器错误。我的代码有问题。
这是我的控制器
public function destroy(Paymentdetail $paymentdetail)
{
// dd($id);
if(Auth::user()->role_id == '1'){
$this->paymentdetails->delete($paymentdetail->id);
event(new Deleted($paymentdetail));
return redirect()->route('paymentdetails.index')
->withSuccess(__('Payment details deleted successfully.'));
}
else{
return redirect()->back()
->withErrors(__('Sorry! You Are Not Authorized To Delete Payment Details.'));
}
}
索引刀片
<a href="{{ route('paymentdetails.edit', $paymentdetail) }}"
class="btn btn-icon edit"
title="@lang('Edit Paymentdetail')"
data-toggle="tooltip" data-placement="top">
<i class="fas fa-edit"></i>
</a>
<a href="{{ route('paymentdetails.destroy', $paymentdetail) }}"
class="btn btn-icon"
title="@lang('Delete Paymentdetail')"
data-toggle="tooltip"
data-placement="top"
data-method="DELETE"
data-confirm-title="@lang('Please Confirm')"
data-confirm-text="@lang('Are you sure that you want to delete this payment details?')"
data-confirm-delete="@lang('Yes, delete details!')">
<i class="fas fa-trash"></i>
</a></a>