laravel method in href link?

后端 未结 3 742
萌比男神i
萌比男神i 2021-01-23 05:47

I want to create a dropdown with two links. A \'Delete\' and a \'Edit\' link.

For the delete function I created a form.

                        {!! Form         


        
3条回答
  •  萌比男神i
    2021-01-23 06:13

    Alternative way, try 'Laravel Collective' Html Helper.

    HTML

    {!! Form::open('delete', 
        'method' => 'delete,
        'route'  => ['show.destroy', $comment->id]
    ) !!}
    
         {!! Form::submit('Submit') !!}
    
    {!! Form::close() !!}
    

    routes.php

    Route::delete('show/{show}', [
      'uses' => 'TestController@destroy',
      'as' => 'show.destroy'
    ]);
    

提交回复
热议问题