我需要一些帮助。我想在前端页面上创建一个删除功能,单击该功能时,它将删除表格上的该行。我已经尝试过他的尝试,但对我没有任何帮助。这是我的代码
function onDelete(){
$model = Accounts::where('id', $id)->first()->delete();
}
```
here is the twig
<tbody>
{% for log in logs %}
<tr>
<td>{{log.name}}</td>
<td>{{log.account_no}}</td>
<td>{{log.code}}</td>
<td>
<button data-request="onDelete"
data-request-data="id:{{ log.id }}"
data-request-confirm="Are you sure ?"
class="btn btn-sm btn-default">
delete
</button>
</td>
</tr>
{% endfor %}
</tbody>