Skip to content
Advertisement

Laravel Model not loaded with data when trying to delete

I have one link as below:

JavaScript

It gets parsed by the following route:

JavaScript

But the destroy method in the TransferController class is empty. On the other hand, the second parameter gets the correct ID (as expected):

JavaScript

Is there a way to make $transfer be pointing to transfer_id=$bla, without explicitly doing a Transfer::find($bla)?

Advertisement

Answer

You need to match the route parameter name to the name of the typehinted parameter of the Controller method if you want Implicit Route Model Binding to take place:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement