title: Call to a member function isvalid() on null in laravel5
body: <p>When Update an image, it shows follwing error. I cannot update this laravel5 form. can any one find what is my mistake?</p>
  
  <blockquote>
    <p>FatalErrorException in SiteadminController.php line 308:
    Call to a member function isvalid() on null</p>
  </blockquote>
  
  <p>My file are</p>
  
  <p>Controller</p>
  
  <pre><code>public function siteadmin_update_product(Request $request)
      {
          $post = $request-&gt;all();
  
          $cid=$post['product_id'];  
  
          $product_title = $request-&gt;input('product_title');
  
           $product_price = $request-&gt;input('product_price');
            $product_discount_price = $request-&gt;input('product_discount_price');
             $product_qty = $request-&gt;input('product_qty');
               $deal_description = $request-&gt;input('deal_description');
               $select_merchant = $request-&gt;input('select_merchant');
               $select_shop = $request-&gt;input('select_shop');
               $product_meta_keyword = $request-&gt;input('product_meta_keyword');
               $product_meta_description = $request-&gt;input('product_meta_description');
               $spec_type = $request-&gt;input('spec_type');
               $specification = $request-&gt;input('specification');
              $product_size = $request-&gt;input('product_size');
          $product_image=Input::file('product_image');
  
  
          $v =validator::make($request-&gt;all(),
          [
  
          ]
          );
          if($v-&gt;fails())
          {
              return redirect()-&gt;back()-&gt;withErrors($v-&gt;errors());
          }
          else
          {
  
               if($product_image-&gt;isvalid())
              {
                  $extension=$product_image-&gt;getClientOriginalName();
                  $move_img = explode('.',$extension);
                  $fileName=$move_img[0].str_random(8).".".$move_img[1];
                  $destinationPath = '../assets/productimage/';
                  $uploadSuccess=Input::file('product_image')-&gt;move($destinationPath,$fileName);
  
              $data = array(
              'product_title' =&gt; $product_title,
  
             'product_price' =&gt; $product_price,
             'product_discount_price' =&gt; $product_discount_price,
             'product_qty' =&gt; $product_qty,
             'select_merchant' =&gt; $select_merchant,
             'select_shop' =&gt; $select_shop,
             'product_meta_keyword' =&gt; $product_meta_keyword,
             'product_meta_description' =&gt; $product_meta_description,
             'spec_type' =&gt; $spec_type,
             'specification' =&gt; $specification,
             'product_size' =&gt; $product_size,
              'product_image'=&gt; $fileName,
  
              );
              $ch=Product_model::update_product($data,$cid);
              //$ch=DB::table('le_banner')-&gt;where('banner_id',$post['id'])-&gt;update($data);
              if($ch &gt; 0)
              {
                Session::flash ('message_update', 'Record Updated Successfully');
               return redirect('siteadmin_manageproduct');
              }
  
              else 
              {
              return Redirect('siteadmin_editproduct');
              }
  
      } 
      }
  }
  </code></pre>
  
  <p>Model </p>
  
  <pre><code>public static function update_product($data,$cid)
     {
  
        return DB::table('le_product')-&gt;where('product_id',$cid)-&gt;update($data);  
     }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code> &lt;form class="form-horizontal form-label-left" enctype="multipart/form-data" novalidate action="{{action('SiteadminController@siteadmin_update_product')}}" method="POST"&gt;
  
               &lt;input type="hidden" name="_token" value="&lt;?php echo csrf_token(); ?&gt;"&gt;
  &lt;input type="hidden" class="form-control" name="product_id" value="&lt;?php   echo $row-&gt;product_id ?&gt;" id="id"&gt;
                  &lt;!-- text input --&gt;
                  &lt;div class="item form-group"&gt;
                    &lt;label class="control-label col-md-3 col-sm-3 col-xs-12"&gt;Product Title*&lt;/label&gt;
                    &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                    &lt;input id="name" class="form-control col-md-7 col-xs-12" data-validate-length-range="3" name="product_title" placeholder="Product Title" required="required" type="text" value="&lt;?php echo $row-&gt;product_title ?&gt;"&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;div class="item form-group"&gt;
                                            &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="heard"&gt;Select Main Category&lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
                                              &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                                              &lt;select id="heard" class="form-control" required&gt;
  
                                                  &lt;option value="press"&gt;option 1&lt;/option&gt;
                                                  &lt;option value="net"&gt;option 2&lt;/option&gt;
                                                  &lt;option value="mouth"&gt;option 3&lt;/option&gt;
                                              &lt;/select&gt;
                                              &lt;/div&gt;
                  &lt;/div&gt;
                   &lt;div class="item form-group"&gt;
                                            &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="heard"&gt;Select Sub Category&lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
                                              &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                                              &lt;select id="heard" class="form-control" required&gt;
  
                                                  &lt;option value="press"&gt;option 1&lt;/option&gt;
                                                  &lt;option value="net"&gt;option 2&lt;/option&gt;
                                                  &lt;option value="mouth"&gt;option 3&lt;/option&gt;
                                              &lt;/select&gt;
                                              &lt;/div&gt;
                  &lt;/div&gt;
                   &lt;div class="item form-group"&gt;
                                            &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="heard"&gt;Select Second Sub Category&lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
                                              &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                                              &lt;select id="heard" class="form-control" required&gt;
  
                                                  &lt;option value="press"&gt;option 1&lt;/option&gt;
                                                  &lt;option value="net"&gt;option 2&lt;/option&gt;
                                                  &lt;option value="mouth"&gt;option 3&lt;/option&gt;
                                              &lt;/select&gt;
                                              &lt;/div&gt;
                  &lt;/div&gt;
                   &lt;div class="item form-group"&gt;
                    &lt;label class="control-label col-md-3 col-sm-3 col-xs-12"&gt;Product Quantity*&lt;/label&gt;
                    &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                   &lt;input id="name" class="form-control col-md-7 col-xs-12" data-validate-length-range="1" name="product_qty" placeholder="Product Quantity" required="required" type="number" value="&lt;?php echo $row-&gt;product_qty ?&gt;"&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                   &lt;div class="item form-group"&gt;
                    &lt;label class="control-label col-md-3 col-sm-3 col-xs-12"&gt;Original Price*&lt;/label&gt;
                    &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                    &lt;input id="number" class="form-control col-md-7 col-xs-12" data-validate-length-range="2" name="product_price" placeholder="Original Price" required="required" type="number" value="&lt;?php echo $row-&gt;product_price ?&gt;"&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                   &lt;div class="item form-group"&gt;
                    &lt;label class="control-label col-md-3 col-sm-3 col-xs-12"&gt;Discounted Price*&lt;/label&gt;
                    &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                    &lt;input id="number" class="form-control col-md-7 col-xs-12" data-validate-length-range="2" name="product_discount_price" placeholder="Discounted Price" required="required" type="number" value="&lt;?php echo $row-&gt;product_discount_price ?&gt;"&gt;
                  &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;div class="item form-group"&gt;
                  &lt;label class="control-label col-md-2 col-sm-3 col-xs-10"&gt;&lt;/label&gt;
                  &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="chkPassport"&gt;
                    &lt;input type="checkbox" id="chkSelect" checked/&gt;  ( Including tax amount )
                  &lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class="item form-group"&gt;
                  &lt;label class="control-label col-md-3 col-sm-3 col-xs-10"&gt;&lt;/label&gt;
                  &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
  
                    &lt;input type="number" id="txtUsername" class="form-control col-md-7 col-xs-12" name="product_incometax" placeholder="Tax Amound" value="&lt;?php echo $row-&gt;product_incometax ?&gt;" /&gt;
                  &lt;/div&gt;
  
                  &lt;/div&gt;
  
                &lt;div class="item form-group"&gt;
                     &lt;label class="control-label col-md-3 col-sm-3 col-xs-12"&gt;Shipping Amount*&lt;/label&gt;
                     &lt;label class="control-label col-md-2 col-sm-3 col-xs-12" for="chkNo"&gt;
                        &lt;input type="radio" id="chkNo" name="chkPassPort" checked/&gt;
                        Free
                    &lt;/label&gt;
  
                    &lt;label class="control-label col-md-2 col-sm-3 col-xs-12" for="chkYes"&gt;
                        &lt;input type="radio" id="chkYes" name="chkPassPort" /&gt;
                        Amount
                    &lt;/label&gt;
                 &lt;/div&gt;
                 &lt;div class="item form-group" id="dvPassport1" style="display: none"&gt;
                       &lt;label class="control-label col-md-3 col-sm-3 col-xs-12"&gt;Shipping Amount*&lt;/label&gt;
                       &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                        &lt;input type="number" id="txtPassportNumber" class="form-control col-md-7 col-xs-12" value="&lt;?php echo $row-&gt;product_shippement_amount ?&gt;" name="product_shippement_amount"/&gt;
                       &lt;/div&gt; 
                    &lt;/div&gt;
                 &lt;div class="item form-group"&gt;
                                          &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="textarea"&gt;Description &lt;span class="required"&gt;*&lt;/span&gt;
                                          &lt;/label&gt;
                                          &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                                              &lt;textarea id="textarea" required="required" name="product_description" class="form-control col-md-7 col-xs-12" placeholder="Description" data-validate-length-range="20"&gt;&lt;?php echo $row-&gt;product_description ?&gt;&lt;/textarea&gt;
                                          &lt;/div&gt;
                  &lt;/div&gt;
  
  
                    &lt;div class="item form-group"&gt;
                     &lt;label class="control-label col-md-3 col-sm-3 col-xs-12"&gt;Want to add specification*&lt;/label&gt;
                     &lt;label class="control-label col-md-2 col-sm-3 col-xs-12" for="Yes"&gt;
                        &lt;input type="radio" id="Yes" name="r4" /&gt;
                        Yes
                    &lt;/label&gt;
                     &lt;label class="control-label col-md-2 col-sm-3 col-xs-12" for="No"&gt;
                        &lt;input type="radio" id="No" name="r4" checked/&gt;
                        No
                    &lt;/label&gt;
  
  
                 &lt;/div&gt;
                 &lt;div class="item form-group" id="dvPassport2" style="display: none"&gt;
                       &lt;label class="control-label col-md-3 col-sm-2 col-xs-10"&gt;Specification*&lt;/label&gt;
                       &lt;div class="col-md-4 col-sm-6 col-xs-12"&gt;
                                              &lt;select id="txtPassportNumber1" class="form-control" required value="&lt;?php echo $row-&gt;spec_type?&gt;" name="spec_type"&gt;
                                                &lt;?php
  
                         foreach($specification as $roww)
                        {?&gt;  
                                                  &lt;option value="&lt;?php echo $roww-&gt;spec_id;?&gt;"&gt;&lt;?php echo $roww-&gt;specification_name;?&gt;&lt;/option&gt;
                                                  &lt;?php
        }
        ?&gt;  
                                              &lt;/select&gt;
                                              &lt;/div&gt;
                       &lt;div class="col-md-2 col-sm-6 col-xs-12"&gt;
                        &lt;input type="text" id="txtPassportNumber1" class="form-control col-md-7 col-xs-12" required data-validate-length-range="3" value="&lt;?php echo $row-&gt;specification ?&gt;" name="specification"/&gt;
                       &lt;/div&gt; 
                  &lt;/div&gt;
                &lt;div class="item form-group"&gt;
                                            &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="heard"&gt;Product Size&lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
                                              &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                                              &lt;select id="heard" class="form-control" required value="&lt;?php echo $row-&gt;product_size ?&gt;" name="product_size"&gt;
                                               &lt;?php
  
                         foreach($size as $roww)
                        {?&gt;  
                                                  &lt;option value="&lt;?php echo $roww-&gt;id;?&gt;"&gt;&lt;?php echo $roww-&gt;size;?&gt;&lt;/option&gt;
  
                                                &lt;?php
        }
        ?&gt;  
                                              &lt;/select&gt;
                                              &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="item form-group"&gt;
                  &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="states"&gt;Product Color*&lt;/label&gt;
                            &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt; 
                              &lt;select id="colorselector" class="form-control"&gt;
  
                                 &lt;option value="red"&gt;Red&lt;/option&gt;
                                 &lt;option value="yellow"&gt;Yellow&lt;/option&gt;
                                 &lt;option value="blue"&gt;Blue&lt;/option&gt;
                              &lt;/select&gt;
                            &lt;/div&gt;                           
                    &lt;/div&gt; 
                    &lt;div class="item form-group"&gt;       
                    &lt;div class="output"&gt;
                            &lt;label class="control-label col-md-3 col-sm-3 col-xs-12"&gt;&lt;/label&gt;
                              &lt;div id="red" class="colors red"&gt; &lt;input type="checkbox" checked/&gt;RED &lt;/div&gt;
                              &lt;div id="yellow" class="colors yellow"&gt; &lt;input type="checkbox" checked/&gt; YELLOW&lt;/div&gt;
                              &lt;div id="blue" class="colors blue"&gt;&lt;input type="checkbox" checked/&gt; BLUE&lt;/div&gt;
                    &lt;/div&gt;
                    &lt;/div&gt;
                  &lt;div class="item form-group"&gt;
                    &lt;label class="control-label col-md-3 col-sm-3 col-xs-12"&gt;Delivery Days*&lt;/label&gt;
                    &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                    &lt;input type="number" class="form-control" placeholder="Delivery Days" name="product_days" required value="4" value="&lt;?php echo $row-&gt;product_days ?&gt;"&gt;
                    Eg : (2-5)
                    &lt;/div&gt;
                  &lt;/div&gt;
                    &lt;div class="item form-group"&gt;
                                            &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="heard"&gt;Select Merchant&lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
                                              &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                                              &lt;select id="heard" class="form-control" required value="&lt;?php echo $row-&gt;select_merchant ?&gt;" name="select_merchant"&gt;
  
                                                   &lt;?php
  
                         foreach($merchant as $roww)
                        {?&gt;
  
            &lt;option value="&lt;?php echo $roww-&gt;merchant_id;?&gt;" &gt;
  
            &lt;?php echo $roww-&gt;merchant_firstname;?&gt;&lt;/option&gt;
        &lt;?php
        }
        ?&gt;
                                              &lt;/select&gt;
                                              &lt;/div&gt;
                  &lt;/div&gt;
                 &lt;div class="item form-group"&gt;
                                            &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="heard"&gt;Select Shop&lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
                                              &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                                              &lt;select id="heard" class="form-control" required value="&lt;?php echo $row-&gt;select_shop ?&gt;"
                                              name="select_shop"&gt;
  
                                                   &lt;?php
  
                         foreach($merchant as $roww)
                        {?&gt;
  
            &lt;option value="&lt;?php echo $roww-&gt;store_id;?&gt;" &gt;
  
            &lt;?php echo $roww-&gt;store_name;?&gt;&lt;/option&gt;
        &lt;?php
        }
        ?&gt;
                                              &lt;/select&gt;
                                              &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="item form-group"&gt;
                                          &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="textarea"&gt;Meta Keywords
                                          &lt;/label&gt;
                                          &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                                              &lt;textarea id="textarea" name="product_meta_keyword" class="form-control col-md-7 col-xs-12" placeholder="Meta Keywords"&gt;&lt;?php echo $row-&gt;product_meta_keyword ?&gt;&lt;/textarea&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;
                   &lt;div class="item form-group"&gt;
                                          &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="textarea"&gt;Meta Description
                                          &lt;/label&gt;
                                          &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                                              &lt;textarea id="textarea" name="product_meta_description" class="form-control col-md-7 col-xs-12" placeholder="Meta Description"&gt;&lt;?php echo $row-&gt;product_meta_description ?&gt;&lt;/textarea&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;
                                      &lt;div class="item form-group"&gt;
                                          &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="textarea"&gt;Product Image                                       &lt;/label&gt;
                                          &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                                            &lt;input type="file" name="product_image" value=""&gt;&lt;br&gt;
                                            &lt;img src="{{ url('../assets/productimage/').'/'.$row-&gt;product_image}}" style="height:90px;"&gt;
  
  
                                          &lt;/div&gt;
  
  
  
  
                    &lt;/div&gt;
                     &lt;div class="item form-group"&gt;
                                          &lt;label class="control-label col-md-3 col-sm-3 col-xs-12" for="textarea"&gt;Product Image                                       &lt;/label&gt;
                                          &lt;div class="col-md-6 col-sm-6 col-xs-12"&gt;
                                            &lt;input type="file" name="product_image" value=""&gt;&lt;br&gt;
                                            &lt;img src="{{ url('../assets/productimage/').'/'.$row-&gt;product_second_image}}" style="height:90px;"&gt;
  
  
                                          &lt;/div&gt;           
                    &lt;/div&gt; 
                              &lt;div class="item form-group"&gt;
                            &lt;div class="col-md-3"&gt;&lt;/div&gt;
                            &lt;div class="col-md-2 col-sm-6 col-xs-12"&gt;
  
                                  &lt;button class="btn btn-block btn-success" type="submit"&gt;Update&lt;/button&gt;
                              &lt;/div&gt;
                               &lt;div class="col-md-2 col-sm-6 col-xs-12"&gt;
                                  &lt;button class="btn btn-block btn-danger" type="reset"&gt;Cancel&lt;/button&gt;
                              &lt;/div&gt;
                &lt;/div&gt;
            &lt;/form&gt;     
  </code></pre>