What seems to be the problem: I was using some standard examples for a relatively simple CRUD component for one of my app’s resources. A lot of the links, like for editing or deleting have something like this (where $resource
is an eloquent model):
wire:click="editResource({{ $resource->id }})
Then, the component code deals with the ID, at times refetching the actual resource from the DB.
But…I tried this instead:
wire:click="editResource({{ $resource }})
And, of course, it works…but with less “mess”.
So, I guess my question is, what are the pros/cons of using IDs versus using the models themselves…especially since (in cases like this), we already have them when we iterate over the collection to build the front-end…?
Any help/advice/wisdom is welcome.
Are you using the latest version of Livewire: yes