Dingo\Api\Console\Command\Cache::handle PHP Method

handle() public method

Execute the console command.
public handle ( ) : mixed
return mixed
    public function handle()
    {
        $this->callSilent('route:clear');
        $app = $this->getFreshApplication();
        $this->call('route:cache');
        $routes = $app['api.router']->getAdapterRoutes();
        foreach ($routes as $collection) {
            foreach ($collection as $route) {
                $app['api.router.adapter']->prepareRouteForSerialization($route);
            }
        }
        $stub = "app('api.router')->setAdapterRoutes(unserialize(base64_decode('{{routes}}')));";
        $path = $this->laravel->getCachedRoutesPath();
        if (!$this->files->exists($path)) {
            $stub = "<?php\n\n{$stub}";
        }
        $this->files->append($path, str_replace('{{routes}}', base64_encode(serialize($routes)), $stub));
    }