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)
But when I click on a ce
I see your issue is resolved but this might help someone else :D
The following piece of code might work for you, but it's not that we can't call count() on the array.
count($project->tasks)
Instead of this
h2>{{{ $project->name }}}
@if ( !$project->tasks->count()) // tasks is plural -> wrong.
There are no tasks for this project.
@else
@foreach( $project->tasks as $task) // here too!
- {{ $task->name }}
@endforeach
@endif
Try doing this
h2>{{{ $project->name }}}
@if ( !$project->task->count())
There are no tasks for this project.
@else
@foreach( $project->task as $task)
- {{ $task->name }}
@endforeach
@endif