title: Why my many-to-one laravel relationship does not work?
body: <p>I know this has been asked many times but none of the solutions apply to my issue.
  I'm having trouble with one to many relationships (one file can have one status but status can be assigned to many files), it just always returns null when I try to use it as so:</p>
  
  <pre><code>$file = File::orderBy('updated_at', 'DESC')-&gt;first();
  return $file-&gt;status;
  </code></pre>
  
  <p>And when I try using the relationship as so:</p>
  
  <pre><code>$file = File::orderBy('updated_at', 'DESC')-&gt;with('status')-&gt;first();
  return $file-&gt;status;
  </code></pre>
  
  <p>I get an error </p>
  
  <pre><code>Call to undefined relationship [status] on model [App\File]
  </code></pre>
  
  <p>I'm sure everything is set up correctly, see models bellow
  File.php</p>
  
  <pre><code>public function status()
  {
    return $this-&gt;belongsTo('App\Status', 'status_id');
  }
  </code></pre>
  
  <p>"Files" table
  <a href="https://i.stack.imgur.com/mP5Pl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mP5Pl.png" alt="enter image description here"></a></p>
  
  <p>"Statuses" table:</p>
  
  <p><a href="https://i.stack.imgur.com/cIQ8q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cIQ8q.png" alt="enter image description here"></a></p>
  
  <p>Also, inverse relationship works (when I try to get files of a specific status)</p>
  
  <pre><code>public function files()
  {
      return $this-&gt;hasMany('App\File', 'status_id'); //This works
  }
  </code></pre>