Reputation: 1491
I am getting the relation of an relation like this:
Application::select()->where('id', $id)->with('vacancie.company:id,title')->get()
now I am getting the full vacancie
model. How can I only get the company id
and title
, excluding the full vacancie
model?
Upvotes: 0
Views: 63
Reputation: 5455
If i remember correctly, should be something like this:
Application::where('id', $id)->with([
'vacancie' => function($query) {
$query->select(['id','company_id'])->with([
'company' => function($query) {
$query->select(['id','title']);
}
]);
}
])->get()
Upvotes: 2
Reputation: 775
try this query :
$details = Application::where('id', $id)->pluck('id','title');
Upvotes: 0