I have two models, User and Enumerator. I want to search certain columns in enumerator model and it's relationship in the user model. Here is what i have;
Enumerator
- unique_id
User
- first_name
I want to write a query that'll fetch both unique_id and first_name in the same collection.
Here is what i have;
Enumerator::with(['user' => function($query) {
$query->select('id', 'first_name', 'last_name', 'email');
}])->get(['first_name', 'unique_id']);
How can i go about it?