Hi I'm getting an error when I try to Update image in the postman
My Controller
   $validator =    Validator::make($request->all(), [
    'category_id'=> 'required',      
    'product_name'=> 'required', 
    'product_description'=> 'required',      
    'product_img'=> 'required' 
 ] );
    if ($validator -> fails()) {
        return $this->sendError('error validation', $validator->errors());
    }
    $product = Product::findOrFail($id) ;
    $product->category_id = $request->input('category_id');
    $product->subcat_id = $request->input('subcat_id');
    $product->product_name = $request->input('product_name');
    $product->product_description = $request->input('product_description');
    $product->product_properties = $request->input('product_properties');
    $product->product_img =  $request->file('product_img')->store('images');
    $product->product_pdf =  $request->file('product_pdf')->store('files');
    if($product->update()){
        return $this->sendResponse($product->toArray() , 'Product Updated Succesfully');
    }
My PostMan row
"product_img":"Downloads/screencapture-file-C-Users-gkpro-Desktop-ui-Semantic-UI-master-examples-navbar-html-2019-01-03-20_31_47.png"
I get this error
Call to a member function store() on null
If you wanna use form-data to upload image with PUT method, here the trick,
add _method: PUT in form-data

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With