Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bashy's avatar

@rin4ik But you just said

but in controller he expects id :(

1 like
Snapey's avatar

@rin4ik Laravel magic. If you pass model as the second parameter the route helper takes what it needs

@Vilfago Laravel magic. if you only need to pass one parameter to the route then the helper accepts it as the second parameter. If you need more than one parameter then they must be posted as an array

towhid's avatar

@Cronix this is your code you suggest me first with id

<form class="col-md-6" method="POST" action="/posts/{{ $post->id }}">

but @rin4ik suggest me

@csrf and my problem is solve 

so both are right :) don't fight , we are a family .... :) thanks

rin4ik's avatar

@bashy he is newbie and doesn't know about route model binding. I didn't want to change his controller :)

jlrdw's avatar

Well was a csrf token ever added in?

bashy's avatar

@jlrdw It's like no one reads the basic docs of Laravel and comes on here for a 35 reply 10 human convo to solve it.

Previous

Please or to participate in this conversation.