Best practice for passing id values between different controllers
Let's say I have an ItemController with CRUD functions. Edit blade view has 2 forms, one for editing textual input for all item input fields, and another form that handles multiple image uploads by a separate ImageController that writes image file name along with parent item_id to images database table.
I wasn't sure how to pass $item->id value to the ImageController correctly. Here's what I've done and it's working....
Put a hidden field in the form that handles image uploads.
That's one way to go about it. But another more of a CRUD approach would be to pass it through the URL. So for example in your URL for the images you can have {item}/images where item is the ID of the item for which you upload the images.
Then in your controller action you can bind it directly.. For example:
public function store(Request $request, Item $item)
{
// Your code here
}