Laravel - dont update photo if $request->file('photo') is null
<p>Here I have Laravel update function,so with this function I update fields and here is imporant input <strong>PHOTO</strong></p>

<p>My code is:</p>

<pre><code>public function update($id, Requests\ArticleRequest $request)
    {
        $this-&gt;validate($request, [
            'photo' =&gt; 'image|max:10000',
            // validate also other fields here
        ]);
        // checking file is valid.
        if (!$request-&gt;file('photo')-&gt;isValid()) return redirect()-&gt;back()-&gt;withErrors(["photo" =&gt; "File is corrupt"]);

        // file is valid
        $destinationPath = public_path().'/images'; // upload path
        $extension = $request-&gt;file('photo')-&gt;getClientOriginalExtension(); // getting image extension
        $filename  = str_random(5).'.'.$extension; // give a name to the image
        $request-&gt;file('photo')-&gt;move($destinationPath, $filename); // uploading file to given path
         // sending back with message

        $article = Auth::user()-&gt;articles()-&gt;findOrFail($id); //if article id is unique just write Article::findOrFail($id)
        $article_fields = $request-&gt;except('photo');
        $article_fields['photo'] = $filename;
        $article-&gt;update($article_fields);

        Alert::message('Your auction is updated', 'Wonderful!');

        return redirect('auctions');
            }
</code></pre>

<p>so when I choose some image to update photo everything is fine,but when I want to update other fileds and photo to stay the same at database... I get error:</p>

<pre><code>Call to a member function isValid() on a non-object
</code></pre>

<p>How I can skip photo if $request->file('photo') is blank, so no new image choosen...</p>