I have a foreach in my view which displays tasks.
@foreach($project_item->getVisibleTasks($tasklist->id) as $task)
And in my model I have the following function:
public function getVisibleTasks($tasklist_id)
{
return $this->hasMany('App\Task', 'project_id')->where('tasklist_id', $tasklist_id)->orderBy('order', 'asc');
}
The function does work when I delete the parameters. (But shows all the results. Because the where clause is deleted). When I pass a static number (for example 1) in my view, it still doesnt work.
How can I make this work?
Regards,
Dylan