title: Call to a member function count() on a non-object (Laravel 5)
body: <p>I have a list of projects, where I can click on and it (needs to) show the project name, and the list of the projects' tasks (ToDo application)</p>
  
  <p>But when I click on a certain project I get this error.</p>
  
  <p>(The "H2" project name will show up)</p>
  
  <pre><code>h2&gt;{{{ $project-&gt;name }}}&lt;/h2&gt;
  
  @if ( !$project-&gt;tasks-&gt;count())
      There are no tasks for this project.
  @else
      &lt;ul&gt;
          @foreach( $project-&gt;tasks as $task)
              &lt;li&gt;&lt;a href="{{ route('projects.tasks.show', [$project-&gt;slug, $task-&gt;slug]) }}"&gt;{{ $task-&gt;name }}&lt;/a&gt;&lt;/li&gt;
          @endforeach
      &lt;/ul&gt;
  @endif
  </code></pre>