I want to get all IDs from with, at the moment I get all data (id, name, pivot, etc..)
$teacher = Teacher::where('id', $id)->with(['subjects' => function($q) {
$q->select('id')->value('id');
}])->orderByDesc('id')->first();
I tried:
$q->pluck('id')->all();
$q->pluck('id');
$q->get('id');
$q->value('id');
$q->pluck('id')->all();
At the end result I only idee an array of ids [1, 2, 3].