The app function returns the service container instance:
<?php $container = app();
<?php     public function __invoke($string)

    {

        if (function_exists('app') && app()->has('path.base')) {

            $string = str_replace(base_path().'/', '', $string);

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

    {

        return app(Gate::class)->forUser($this)->check($abilities, $arguments);

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

    {

        return app(Gate::class)->forUser($this)->any($abilities, $arguments);

    }
<?php     {

        [$ability, $arguments] = $this->parseAbilityAndArguments($ability, $arguments);



        return app(Gate::class)->authorize($ability, $arguments);

    }
<?php     {

        [$ability, $arguments] = $this->parseAbilityAndArguments($ability, $arguments);



        return app(Gate::class)->forUser($user)->authorize($ability, $arguments);

    }
<?php     public static function dispatchSync(...$arguments)

    {

        return app(Dispatcher::class)->dispatchSync(new static(...$arguments));

    }
<?php         $firstJob->chain($this->chain);

        $firstJob->chainCatchCallbacks = $this->catchCallbacks();



        return app(Dispatcher::class)->dispatch($firstJob);

    }
<?php         if (! $this->shouldDispatch()) {

            return;

        } elseif ($this->afterResponse) {

            app(Dispatcher::class)->dispatchAfterResponse($this->job);

        } else {

            app(Dispatcher::class)->dispatch($this->job);

        }
<?php         } elseif ($this->afterResponse) {

            app(Dispatcher::class)->dispatchAfterResponse($this->job);

        } else {

            app(Dispatcher::class)->dispatch($this->job);

        }

    }

}
<?php     protected function enableBroadcastServiceProvider()

    {

        $config = ($filesystem = new Filesystem)->get(app()->configPath('app.php'));



        if (str_contains($config, '// App\Providers\BroadcastServiceProvider::class')) {

            $filesystem->replaceInFile(
<?php             $filesystem->replaceInFile(

                '// App\Providers\BroadcastServiceProvider::class',

                'App\Providers\BroadcastServiceProvider::class',

                app()->configPath('app.php'),

            );

        }

    }
<?php         $class = trim(Str::replaceFirst($basePath, '', $file->getRealPath()), DIRECTORY_SEPARATOR);



        return str_replace(

            [DIRECTORY_SEPARATOR, ucfirst(basename(app()->path())).'\\'],

            ['\\', app()->getNamespace()],

            ucfirst(Str::replaceLast('.php', '', $class))

        );
<?php         return str_replace(

            [DIRECTORY_SEPARATOR, ucfirst(basename(app()->path())).'\\'],

            ['\\', app()->getNamespace()],

            ucfirst(Str::replaceLast('.php', '', $class))

        );

    }
<?php     protected function renderExceptionContent(Throwable $e)

    {

        try {

            return config('app.debug') && app()->has(ExceptionRenderer::class)

                        ? $this->renderExceptionWithCustomRenderer($e)

                        : $this->renderExceptionWithSymfony($e, config('app.debug'));

        } catch (Throwable $e) {
<?php     protected function renderExceptionWithCustomRenderer(Throwable $e)

    {

        return app(ExceptionRenderer::class)->render($e);

    }