我是Laravel的新手。
我想在删除之前显示警告对话框
{{link_to_action('RentsController@delete', 'delete',onclick="return confirm('are you sure delete this?')",array($l->id))}}
但这对我不起作用,有人能解释一下吗?
除了您甚至没有传递正确的字符串之外,HTML属性必须是第四个参数,并且作为数组:
{{ link_to_action(
'RentsController@delete',
'delete',
null,
array(
'onclick' => "return confirm('are you sure delete this?')",
'id' => $l->id
)
) }}