feat: create PostCategoryFactory for generating post category data feat: create PostFactory for generating post data feat: add retry_requested_at column to services table feat: add vcenter provisioning fields to products table feat: add module_host_id to os table feat: create email_notification_templates table for email templates feat: add scenario and format fields to template table feat: add admin fields to transactions table fix: update ticket table columns and types feat: add uuid to ticket table and backfill existing records fix: make ticket_reply user_id nullable feat: create notifications table for user notifications fix: make ticket uuid nullable feat: create post_categories table for blog categories feat: create posts table for blog posts feat: add invoice email template for PDF generation
38 lines
887 B
PHP
38 lines
887 B
PHP
<?php
|
|
|
|
namespace App\Http\Services;
|
|
|
|
use Illuminate\Support\Facades\Http;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class NextjsRevalidationService
|
|
{
|
|
public function revalidateProducts(): void
|
|
{
|
|
$this->dispatch(['products']);
|
|
}
|
|
|
|
public function revalidateDocs(): void
|
|
{
|
|
$this->dispatch(['docs']);
|
|
}
|
|
|
|
private function dispatch(array $tags): void
|
|
{
|
|
$url = rtrim(config('services.nextjs.url'), '/') . '/api/revalidate';
|
|
$secret = config('services.nextjs.revalidate_secret');
|
|
|
|
if (!$url || !$secret) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
Http::withHeaders(['x-revalidate-secret' => $secret])
|
|
->timeout(5)
|
|
->post($url, ['tags' => $tags]);
|
|
} catch (\Throwable $e) {
|
|
Log::warning('Next.js revalidation failed: ' . $e->getMessage());
|
|
}
|
|
}
|
|
}
|