Skip to content

Warming the static cache on custom route with parameters #9228

Answered by scottmetoyer
scottmetoyer asked this question in Q&A
Discussion options

You must be logged in to vote

I tried creating a new console command that calls static:warm and then includes a little logic to loop through my collection and manually hit the routes I need. Seems to work just fine:

public function handle()
    {
        $this->call('statamic:static:warm');

        $products = Entry::query()->where('collection', 'products')->get();

        foreach($products as $product) {
            $url = url("/products/" . $product->slug . "/download");
            $this->info($url);
            Http::get($url);
        }
    }

Unless there's a built-in way I think I'll just go with this.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by scottmetoyer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
1 participant