title: Laravel 5 Creating default object from empty value
body: <p>I have a simple model and I'm trying to create a new instance.</p>
  
  <p>Can anybody tell me what I'm doing wrong!</p>
  
  <p>I'm getting the error "<strong>Creating default object from empty value</strong>"</p>
  
  <p>Within my controller I have the model defined:</p>
  
  <pre><code>    &lt;?php
  
      namespace App\Http\Controllers;
  
      use Illuminate\Http\Request;
  
      use App\Keygen;
  
      use Auth;
      use Response;
      use App\Http\Requests;
      use App\Http\Controllers\Controller;
  
      class APIController extends Controller
      { 
  
  
  
      public function addKey(){
                  $Key = NEW Keygen;
                  $key-&gt;key = 'test';
                  $key-&gt;save();
      }
  
  }
  </code></pre>
  
  <p>To test this very basic function I have sent a get request to the url and routed it to the function on the controller.</p>