[Solved] How do I loop a nested array in laravel to get an array based on conditions of key values from that array


Suppose if your $request->option contain array then

$filtered = collect($request->option)->whereNotNull('option')->all()->toArray();

Ref: https://laravel.com/docs/8.x/collections#method-wherenotnull

solved How do I loop a nested array in laravel to get an array based on conditions of key values from that array