The collect function creates a collection instance from the given value:
<?php $collection = collect(['taylor', 'abigail']);
<?php     protected function getRouteParameters(): array

    {

        try {

            return collect(optional($this->request->route())->parameters ?? [])->toArray();

        } catch (Throwable $e) {

            return [];

        }
<?php                 return null;

            }



            $telescopeEntry = collect(Telescope::$entriesQueue)->first(function ($entry) {

                return $entry instanceof IncomingExceptionEntry;

            });
<?php     public static function styles(): array

    {

        return collect(static::$tabs)->flatMap(function ($tab) {

            return $tab->styles;

        })

            ->unique()
<?php     public static function scripts(): array

    {

        return collect(static::$tabs)->flatMap(function ($tab) {

            return $tab->scripts;

        })

            ->unique()
<?php         $middlewares[] = AddSolutions::class;



        $middleware = collect($middlewares)

            ->map(function (string $middlewareClass) {

                return $this->app->make($middlewareClass);

            });
<?php             $throwable = $report['context']['exception'];



            collect(Ignition::$tabs)

                ->each(function (Tab $tab) use ($throwable) {

                    $tab->beforeRenderingErrorPage($this->flare, $throwable);

                });
<?php     {

        $composerClassMap = app(ComposerClassMap::class);



        $controllers = collect($composerClassMap->listClasses())

            ->filter(function (string $file, string $fqcn) {

                return Str::endsWith($fqcn, 'Controller');

            })
<?php         string $variableName,

        string $viewFile

    ): array {

        return collect($throwable->getViewData())->map(function ($value, $key) use ($variableName) {

            similar_text($variableName, $key, $percentage);



            return ['match' => $percentage, 'value' => $value];
<?php         $extensions = $fileViewFinder->getExtensions();



        $viewsForHints = collect($fileViewFinder->getHints())

            ->flatMap(function ($paths, string $namespace) use ($extensions) {

                $paths = Arr::wrap($paths);
<?php             ->flatMap(function ($paths, string $namespace) use ($extensions) {

                $paths = Arr::wrap($paths);



                return collect($paths)

                    ->flatMap(function (string $path) use ($extensions) {

                        return $this->getViewsInPath($path, $extensions);

                    })
<?php                     ->toArray();

            });



        $viewsForViewPaths = collect($fileViewFinder->getPaths())

            ->flatMap(function (string $path) use ($extensions) {

                return $this->getViewsInPath($path, $extensions);

            });
<?php     {

        $details = json_decode(file_get_contents("https://packagist.org/packages/{$this->name}.json"), true);



        return collect($details['package']['versions'])

            ->map(function ($version) {

                return collect($version['autoload'] ?? [])

                    ->map(function ($autoload) {
<?php         return collect($details['package']['versions'])

            ->map(function ($version) {

                return collect($version['autoload'] ?? [])

                    ->map(function ($autoload) {

                        return array_keys($autoload);

                    })
<?php         }



        try {

            collect([])->faltten();

        } catch (\Exception $exception) {

            $solution = new BadMethodCallSolutionProvider();
<?php         }



        try {

            collect([])->frist(function ($item) {

            });

        } catch (\Exception $exception) {

            $solution = new BadMethodCallSolutionProvider();