I have query:
$query = Task::query()->select(['tasks.*', 'rootTask.is_public as rootPublic']);
$query->leftJoin('tasks as rootTask', function ($join) {
$join->on('tasks._lft', '>=', 'rootTask._lft')
->whereNull('rootTask.deleted_at')
->where('tasks._lft', '<=', 'rootTask._rgt')
->whereNull('rootTask.parent_id');
});
when I try to get $task->rootPublic it returns NULL But if I do $query->toSql(); and run that SQL it returns 1.
What can be an issue?