I'm trying to get the product Id from the database by using the hidden input but am stuck; I'm getting the error General error: 1366 Incorrect integer value: '[{"id":1}]' for column 'product_id'
. How do I get the product Id from the database?
Blade
<input type="hidden" name="id" value="" />
Controller
Image::create(array_merge($formInput,
[
$id = $request->input('id'),
$product_id = Product::find('id'),
'product_id' => $product_id,
]));
Updated
This is my updated controller.
Image::create(array_merge($formInput,
[
$id = $request->input('id'),
$product = Product::get($id),
'product_id' =>$product->id,
]));