php - Call to a member function count() on a non-object (Laravel 5) -
i have list of projects, can click on , (needs to) show project name, , list of projects' tasks (todo application)
but when click on project error.
(the "h2" project name show up)
h2>{{{ $project->name }}}</h2> @if ( !$project->tasks->count()) there no tasks project. @else <ul> @foreach( $project->tasks $task) <li><a href="{{ route('projects.tasks.show', [$project->slug, $task->slug]) }}">{{ $task->name }}</a></li> @endforeach </ul> @endif
$project->tasks
array , cant call count()
on array. try -
count($project->tasks)
Comments
Post a Comment