title: Laravel 5.1 - Relationships on model with null values
body: <p>I'm having problem with Relationships on model with null values on Laravel 5.1.</p>
  
  <p>I Have 2 Tables Tasks and Users. In Tasks i have the column id_requester and id_responsible.</p>
  
  <p>I want to show all tasks, i always have a requester, but some times i don't have a responsible yet.</p>
  
  <p>So the id_responsible is null in this cases.</p>
  
  <p>My Model is:</p>
  
  <pre><code> protected $table = 'tasks';
  
   protected $fillable = array(
              'id_requester',
              'id_responsible',
          );
  
  public function requester()
      {
          return $this-&gt;hasOne('app\User', 'id', 'id_requester');
      }
  
  public function responsible()
      {
          return $this-&gt;hasOne('app\User', 'id', 'id_responsible');
      }
  </code></pre>
  
  <p>The query in my controller is:</p>
  
  <pre><code>$tasks = Tasks::get();
  </code></pre>
  
  <p>I'm try to show in view like this:</p>
  
  <pre><code>&lt;table&gt;
  ...
  @foreach($tasks as $task)
     &lt;td&gt;{{ $task-&gt;requester-&gt;name }}&lt;/td&gt;
  
     &lt;td&gt;{{ $task-&gt;responsible-&gt;name }}&lt;/td&gt;
  @endforeach
  ...
  &lt;/table&gt;
  </code></pre>
  
  <p>The problem is that when i try access the page I get an error 'Trying to get property of non-object'.</p>
  
  <p>I already test and this is only when i have a id_responsible = Null.</p>
  
  <p>How can i fix this to show all registers?</p>
  
  <p>Thanks!!!</p>