dimanche 30 juin 2019

How to get product Id from hidden field Laravel

I'm trying to get the Id of a product when I submit the form using the hidden input field but am getting an error Trying to get property of non-object . How can I fix this issue?

code

Controller

 Image::create(array_merge($formInput,
   [

    $id=$request->input('id'),
    $product=Product::find($id),
     'product_id' =>$product->id,

    ])); 

blade

  <input type="hidden" name="id" value="" />

Any help will be appriciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire