title: Error when trying to make relation in laravel
body: <p>I'm trying to make a relationship in Laravel but always get the error:</p>
  <blockquote>
  <p>Trying to get property 'nama_guru' of non-object (View: D:\xampp\htdocs\supervisi_digital\resources\views\ManagementSupervisi\index.blade.php).</p>
  </blockquote>
  <p>Here is my code:</p>
  <p><strong>Dokumen Model</strong></p>
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Dokumen extends Model
  {
      protected $table = &quot;dokumen&quot;;
      protected $primarikey = &quot;id&quot;;
      protected $fillable =
      [
          'id', 'nama_guru', 'mapel', 'file', 'keterangan'
      ];
  
      public function supervisi()
      {
          return $this-&gt;hasMany(Supervisi::class);
      }
  }
  </code></pre>
  <p><strong>Supervisi Model</strong></p>
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
      class Supervisi extends Model
      {
          protected $table = &quot;supervisi&quot;;
          protected $primarikey = &quot;id&quot;;
          protected $fillable =
          [
              'id', 'id_guru', 'id_mapel', 'id_keterangan', 'penilaian'
          ];
      
          public function dokumen()
          {
              return $this-&gt;belongsTo(Dokumen::class);
          }
      }
  </code></pre>
  <p><strong>Blade View</strong></p>
  <pre><code>&lt;table&gt;
          &lt;thead&gt;
            &lt;tr&gt;
              &lt;th&gt;#&lt;/th&gt;
              &lt;th&gt;NAMA GURU&lt;/th&gt;
              &lt;th&gt;MAPEL&lt;/th&gt;
              &lt;th&gt;KETERANGAN&lt;/th&gt;
              &lt;th&gt;PENILAIAN&lt;/th&gt;
              &lt;th&gt;ACTION&lt;/th&gt;
            &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
              @foreach ($dtSupervisi as $item)
            &lt;tr&gt;
              &lt;td&gt;{{ $loop-&gt;iteration }}&lt;/td&gt;
              &lt;td&gt;{{ $item-&gt;dokumen-&gt;nama_guru }}&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
            @endforeach
          &lt;/tbody&gt;
        &lt;/table&gt;
  </code></pre>
  <p><strong>Controller</strong>
  public function index()
  {
  $dtSupervisi = Supervisi::with('dokumen')-&gt;paginate(10);
  return view('ManagementSupervisi.index', compact('dtSupervisi'));
  }</p>
  <p>I don't know what the problem is.</p>