Laravel Eloquent Pluck without losing the key

This can be simply achieved by passing a second argument to pluck. From the documentation:

You may also specify how you wish the resulting collection to be keyed:

$plucked = $collection->pluck('name', 'product_id');

$plucked->all();

// ['prod-100' => 'Desk', 'prod-200' => 'Chair']

Try something like this, it should work using map...

return $TheEpisode->TheNumbers->map(function ($episode) {
    return ['episodeNumber' => $episode['episodeNumber']];
});

Pluck() can take two params. The second of which is what the value can be keyed by.

You should be able to do:

$TheEpisode->TheNumbers->pluck('episodeNumber', 'episodeID');

Hope this helps!