In Laravel to choose only specified key from the collection?

It is necessary to select specific keys from the collection. The documentation describes that this can be done using the method only. What am I doing wrong?

Have a collection view:
$filter = collect([
 'q' => 'q', 
 'w' => 'w', 
 'e' => [
 'a' => 'a', 
 's' => 's'

To my knowledge, to refer to a nested array you can use point entry only(['e.a', 'e.s'])
for the reverse method, except this option works correctly in the case of only - does not work. either I can't notice the elephant, or this is a bug version.
By the way, the version of laravel - 5.7
March 19th 20 at 08:47
1 answer
March 19th 20 at 08:49
Well, you would in the source code climbed something...
This method uses Arr::only that simply calls array_intersect_key that no point in the keys is not supported. There seems to be only manually select from the sub-array.
I trusted the documentation that says that this is the reverse method method, except that just copes with the points :) Thanks! - Georgianna_OReilly8 commented on March 19th 20 at 08:52

Find more questions by tags Laravel