D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
forge
/
josepharmacy.online
/
scripts
/
Filename :
trigger_restock.php
back
Copy
<?php // trigger_restock.php - dispatch notification for a specific restock entry // define constants required by helpers when running from CLI if (!defined('DOMAIN_POINTED_DIRECTORY')) { define('DOMAIN_POINTED_DIRECTORY', 'public'); } require __DIR__ . '/../vendor/autoload.php'; $app = require __DIR__ . '/../bootstrap/app.php'; $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); $restock = App\Models\RestockProduct::find(19); if (!$restock) { echo "Restock entry not found\n"; exit(1); } $data = [ 'topic' => getRestockProductFCMTopic(restockRequest: $restock), 'title' => $restock->product?->name, 'product_id' => $restock->product?->id, 'slug' => $restock->product?->slug, 'description' => translate('This_product_has_restocked'), 'image' => getStorageImages(path: $restock->product?->thumbnail_full_url ?? '', type: 'product'), 'route' => route('product', $restock->product?->slug), 'type' => 'product_restock_update', 'status' => 'product_restocked', ]; event(new App\Events\RestockProductNotificationEvent(data: $data, restockRequest: $restock)); echo "event dispatched\n";