The collect function creates a collection instance from the given value:
<?php $collection = collect(['taylor', 'abigail']);
<?php     public function check($abilities, $arguments = [])

    {

        return collect($abilities)->every(

            fn ($ability) => $this->inspect($ability, $arguments)->allowed()

        );

    }
<?php     public function any($abilities, $arguments = [])

    {

        return collect($abilities)->contains(fn ($ability) => $this->check($ability, $arguments));

    }
<?php             return [];

        }



        return collect($models)->map(function ($model) use ($request) {

            return $model instanceof Model ? $model : $this->getModel($request, $model);

        })->all();

    }
<?php     {

        $this->payload = $payload instanceof Arrayable

            ? $payload->toArray()

            : collect($payload)->map(

                fn ($p) => $p instanceof Arrayable ? $p->toArray() : $p

            )->all();
<?php     {

        $callbackParameters = $this->extractParameters($callback);



        return collect($this->extractChannelKeys($pattern, $channel))->reject(function ($value, $key) {

            return is_numeric($key);

        })->map(function ($value, $key) use ($callbackParameters) {

            return $this->resolveBinding($key, $value, $callbackParameters);
<?php     public function getChannels()

    {

        return collect($this->channels);

    }

}
<?php     protected function prepareBatchedChain(array $chain)

    {

        return collect($chain)->map(function ($job) {

            $job = $job instanceof Closure ? CallQueuedClosure::create($job) : $job;



            return $job->withBatchId($this->id);
<?php         if ($this->hasProgressCallbacks()) {

            $batch = $this->fresh();



            collect($this->options['progress'])->each(function ($handler) use ($batch) {

                $this->invokeHandlerCallback($handler, $batch);

            });

        }
<?php         if ($counts->pendingJobs === 0 && $this->hasThenCallbacks()) {

            $batch = $this->fresh();



            collect($this->options['then'])->each(function ($handler) use ($batch) {

                $this->invokeHandlerCallback($handler, $batch);

            });

        }
<?php         if ($counts->allJobsHaveRanExactlyOnce() && $this->hasFinallyCallbacks()) {

            $batch = $this->fresh();



            collect($this->options['finally'])->each(function ($handler) use ($batch) {

                $this->invokeHandlerCallback($handler, $batch);

            });

        }
<?php         if ($this->hasProgressCallbacks() && $this->allowsFailures()) {

            $batch = $this->fresh();



            collect($this->options['progress'])->each(function ($handler) use ($batch, $e) {

                $this->invokeHandlerCallback($handler, $batch, $e);

            });

        }
<?php         if ($counts->failedJobs === 1 && $this->hasCatchCallbacks()) {

            $batch = $this->fresh();



            collect($this->options['catch'])->each(function ($handler) use ($batch, $e) {

                $this->invokeHandlerCallback($handler, $batch, $e);

            });

        }
<?php         if ($counts->allJobsHaveRanExactlyOnce() && $this->hasFinallyCallbacks()) {

            $batch = $this->fresh();



            collect($this->options['finally'])->each(function ($handler) use ($batch, $e) {

                $this->invokeHandlerCallback($handler, $batch, $e);

            });

        }
<?php     public static function prepareNestedBatches(Collection $jobs): Collection

    {

        return $jobs->map(fn ($job) => match (true) {

            is_array($job) => static::prepareNestedBatches(collect($job))->all(),

            $job instanceof Collection => static::prepareNestedBatches($job),

            $job instanceof PendingBatch => new ChainedBatch($job),

            default => $job,
<?php     {

        $batch = $repository->store($this);



        collect($this->beforeCallbacks())->each(function ($handler) use ($batch) {

            try {

                return $handler($batch);

            } catch (Throwable $e) {