title: Laravel Relationships Trying to get property of non-object
body: <p>I am fighting this 2 days already. I am trying to set up a relationship and it's not working.</p>
  
  <p>I have a database table "<strong>contracts</strong>" and a column "<strong>status</strong>". And for all rows status is 1</p>
  
  <pre><code>id: 1
  contract_id: '0005898BC'
  status: 1
  </code></pre>
  
  <p>I also have a contract_statuses table with one row:</p>
  
  <pre><code>id: 1
  status_name: "New status"
  </code></pre>
  
  <p>So the relationship is that contracts table points to the <strong>contract_statuses</strong> table via "status" which is the id in the <strong>contract_statuses</strong> table.</p>
  
  <p><strong>Here is my code.</strong></p>
  
  <p>C<strong>ontracts Model:</strong></p>
  
  <pre><code>public function givemestatus()
  {
     return $this-&gt;belongsTo('App\Models\ContractStatuses');
  }
  </code></pre>
  
  <p><strong>ContractStatuses Model:</strong></p>
  
  <pre><code>public function contract()
  {
     return $this-&gt;hasMany('App\Models\Contracts', 'status', 'id');
  }
  </code></pre>
  
  <p><strong>My View:</strong></p>
  
  <pre><code>@foreach ($contracts as $contract)
     {{ $contract-&gt;givemestatus-&gt;status_name }}
  @endforeach
  </code></pre>