title: No query results for model Laravel 5.4
body: <p>I got problem with edit events. 
  No query results for model [App\HomeModel] {id}
  I really dont know how to fix my problem.
  I trying change findorfail to find but still got some problems.
  I change findorfail to HomeModel::where('id', $id)->first();
  and still i got error: Creating default object from empty value</p>
  
  <p>Controller with edit and update function:</p>
  
  <pre><code>&lt;?php
  /**
       * Show the form for editing the specified resource.
       *
       * @param  int  $id
       * @return \Illuminate\Http\Response
       */
      public function edit($id)
      {
          $event = HomeModel::findOrFail($id);
          $event-&gt;start;
          $event-&gt;end;
  
          $data = [
              'page_title'    =&gt; 'Edit '.$event-&gt;title,
              'event'         =&gt; $event,
          ];
          return view('edit',$data);
      }
      /**
       * Update the specified resource in storage.
       *
       * @param  \Illuminate\Http\Request  $request
       * @return \Illuminate\Http\Response
       */
      public function update(Request $request, $id)
      {
  
          $time = explode(" - ", $request-&gt;input('daterange'));        
          $event                  = HomeModel::findOrFail($id);
          $event-&gt;name            = $request-&gt;input('name');
          $event-&gt;title           = $request-&gt;input('title');
          $event-&gt;start      = $time[0];
          $event-&gt;end        = $time[1];
          $event-&gt;save();
  
          return redirect('/home/list');
  
      }
  </code></pre>
  
  <p>Model:</p>
  
  <pre class="lang-php prettyprint-override"><code>namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class HomeModel extends Model
  {
      protected $table = 'events'; 
      public $timestamps = true; 
      protected $primaryKey = 'id';
        /**
       * Is it an all day event?
       *
       * @return bool
       */
      public function isAllDay()
      {
          return (bool)$this-&gt;day;
      }
  
  
  }
  </code></pre>
  
  <p>Edit view:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>@extends('layouts.app')
  
  @section('content')
     
  &lt;div class="panel-heading"&gt;
   &lt;div class="col-md-6 col-md-offset-4"&gt;Edit Event&lt;/div&gt;    
  &lt;/div&gt;
  
  &lt;div class="panel-body"&gt;
  &lt;form class="form-horizontal" role="form" method="POST" action="{{ url('/list/edit/{id}') }}"&gt;
      {{ csrf_field() }}
      &lt;div class="form-group"&gt;    
                  &lt;label for="name" class="col-md-4 control-label"&gt;Name Event&lt;/label&gt;
                      &lt;div class="col-md-6"&gt;
                          &lt;input id="name" type="text" class="form-control" name="name"&gt;
                      &lt;/div&gt;    
                  &lt;label for="title" class="col-md-4 control-label"&gt;Title Event&lt;/label&gt;
                      &lt;div class="col-md-6"&gt;
                          &lt;input id="title" type="text" class="form-control" name="title"&gt;
                      &lt;/div&gt;
                      &lt;div class="col-md-4 col-md-offset-4"&gt;    
                          &lt;input type="text" name="daterange"/&gt;
                      &lt;/div&gt;      
              &lt;div class="col-md-5 col-md-offset-4"&gt; 
                  &lt;button type="submit" class="btn btn-primary"&gt;
                      Edit Event
                  &lt;/button&gt;
              &lt;/div&gt;
          
      &lt;/div&gt;
  &lt;/form&gt;                   
                            
          &lt;script src="{{ asset('js/jquery.js') }}"&gt;&lt;/script&gt;
          &lt;script src="{{ asset('js/moment.js') }}"&gt;&lt;/script&gt;
          &lt;script src="{{ asset('js/daterangepicker.js') }}"&gt;&lt;/script&gt;                                   
          &lt;div class="form-group"&gt;
              &lt;div class="col-md-6 col-md-offset-4"&gt;
                  
          &lt;script type="text/javascript"&gt;
              $(function() {
              $('input[name="daterange"]').daterangepicker({
              timePicker: true,
                          timePicker24Hour: true,
              slotLabelFormat: 'HH:mm:ss',
              locale: {
                      format: 'YYYY/MM/DD HH:mm:ss',
                                  separator: " - ",      
                      }
                  });
              });
          &lt;/script&gt;              
         &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  @endsection</code></pre>
  </div>
  </div>
  </p>