Ha, well figured out why it didn't work. Without also selecting the key (id), Laravel/Eloquent had no idea what to bind the tables to. Removed the protected $with from the User model and then in the controller modified to this...
$collaborators = \App\User::with(['profilePicture' => function($query) {
$query->select('url');
}])->select(['email','name','id'])->get();
Works like a charm now. Stumbled upon this as I tested the relationship getting with \App\User::all() which worked so figured it was something that I was chaining with constraints that muxed it, and lo and behold, bam.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.