Php 拉威尔故障链接到行动

Php 拉威尔故障链接到行动,php,laravel,warnings,confirm,Php,Laravel,Warnings,Confirm,我是拉威尔的新手 我想在删除之前显示警告对话框 {{link_to_action('RentsController@delete', 'delete',onclick="return confirm('are you sure delete this?')",array($l->id))}} 但这对我不起作用,有人能解释一下吗?除了你甚至没有传递正确的字符串之外,HTML属性必须是第四个参数和数组: {{ link_to_action( 'RentsController@dele

我是拉威尔的新手

我想在删除之前显示警告对话框

{{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
    )
) }}