dimanche 26 avril 2020

how to pass multiple parameters through route using Laravel collective Forms & HTML Addins?

lets assume we have a Delete button inside a form :

 {!! Form::open(['route' => ['posts.destroy','id'=>$post->id], 'method' => 'delete']) !!}
 {!! Form::submit('Delete', ['class' => 'btn btn-danger']) !!}
 {!! Form::close() !!}

i need to pass two or more variables through the Form Route like this:

{!! Form::open(['route' => ['posts.destroy','id'=>$post->id,'title'=>$post->title], 'method' => 'delete']) !!}
{!! Form::submit('Delete', ['class' => 'btn btn-danger']) !!}
{!! Form::close() !!}

I try to different ways , to take these two parameters but still I couldn't retrieve data

ErrorException in PostController.php line 99:
Missing argument 2 for App\Http\Controllers\PostController::destroy()


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire