Laravel – Fetch an array of ids instead of an array objects using a "with" statement
I have the following method: public static function list() { return static::with(['links' => function($query) { $query->select('link_id'); }])->get(); } That returns the following output: "objects": [ { "id": 6, "links": [ { link_id: 6, pivot: { object_id: 6, link_id: 6 }…