Reputation: 2072
I have Eloquent query like this:
Project::with('tasks')->get([]);
I need to take from projects
table one coulmn 'name' and from tasks
I wana get all...
Anyone know how to acomplish it?
Upvotes: 1
Views: 472
Reputation: 219930
In order to be able to load the tasks, you need to load the project's id:
$projects = Project::with('tasks')->get(['id', 'name']);
Upvotes: 1