D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
forge
/
ghanempharmacy.com
/
scripts
/
Filename :
manual_restock.php
back
Copy
<?php // define constants required by helper files when bootstrapping outside HTTP 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(); // create restock and customer entry $restock = App\Models\RestockProduct::create(['product_id' => 1, 'variant' => null]); App\Models\RestockProductCustomer::create([ 'restock_product_id' => $restock->id, 'customer_id' => App\Models\User::first()?->id, 'guest_email' => null, 'variant' => null, ]); // manually dispatch event without using ProductService $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 "manual triggered\n";