mapWithKeys(fn ($value) => [$value => $this->option($value)]) ->filter() ->keys() ->all(); $input = array_filter($items, fn ($item) => in_array($item, $allowed)); if (count($input) < count($items)) { $this->error('Invalid publishable item supplied.'); return; } $items = empty($input) ? $allowed : $input; collect($items) ->map( fn ($item) => $this->call('vendor:publish', ['--tag' => "payu-{$item}"]) ); } }