title: Laravel 5.1 Creating default object from empty value
body: <p>I am using Laravel 5.1 PHP framework. When I try to update my record, I get the error:</p>
  
  <blockquote>
    <p>"ErrorException in AdminController.php line 108: Creating default
    object from empty value".</p>
  </blockquote>
  
  <p>I have searched in google but I can't find any results to solve my problem.</p>
  
  <p><strong>Routes</strong></p>
  
  <pre><code>Route::get('/admin/no', 'AdminController@index');
  Route::get('/admin/product/destroy/{id}', 'AdminController@destroy');
  Route::get('/admin/new', 'AdminController@newProduct');
  Route::post('/admin/product/save', 'AdminController@add');
  Route::get('/admin/{id}/edit', 'AdminController@edit');
  Route::patch('/admin/product/update/{id}', 'AdminController@update')
  </code></pre>
  
  <p><strong>AdminController</strong></p>
  
  <pre><code> public function edit($id)
      {
  
          $product = Product::find($id);
          return view('admin.edit', compact('product'));
  
      }
  
      public function update(Request $request, $id)
      {
  
          $product = Product::find($id);
          $product-&gt;id = Request::input('id');
          $product-&gt;name = Request::input('name');
          $product-&gt;description = Request::input('description');
          $product-&gt;price = Request::input('price');
          $product-&gt;imageurl = Request::input('imageurl');
  
  
          $product-&gt;save();
          //return redirect('/admin/nο');
  
      }
      enter code here
  </code></pre>
  
  <p><strong>edit.blade.php</strong></p>
  
  <pre><code>div class="panel panel-info"&gt;
          &lt;div class="panel-heading"&gt;
              &lt;div class="panel-title"&gt;Edit Product&lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="panel-body" &gt;
              &lt;form action="/admin/product/update/{id}" method="POST"&gt;&lt;input type="hidden" name="_method" value="PATCH"&gt; &lt;input type="hidden" name="_token" value="{{ csrf_token() }}"&gt;
      enter code here
  </code></pre>