Call to a member function count() on null code example
Example 1: Call to a member function count() on string
count($project->tasks)
Example 2: Call to a member function count() on string
h2>{{{ $project->name }}}</h2>
@if ( count($project->tasks)==0)
There are no tasks for this project.
@else
<ul>
@foreach( $project->tasks as $task)
<li><a href="{{ route('projects.tasks.show', [$project->slug, $task->slug]) }}">{{ $task->name }}</a></li>
@endforeach
</ul>
@endif