PHP code example of foodticket / takeaway-pos-client
1. Go to this page and download the library: Download foodticket/takeaway-pos-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Foodticket\Takeaway\Enums\OrderStatus;
use Carbon\Carbon;
$api->setOrderStatus(
statusUrl: $statusUrl, // URL provided in the incoming order payload
id: $orderId,
status: OrderStatus::CONFIRMED,
key: $orderKey,
changedDeliveryTime: Carbon::now()->addMinutes(30), //
Event::listen('takeaway-pos.keep-alive', function (string $restaurantId) {
// mark restaurant as online, etc.
});
Event::listen('takeaway-pos.order-created', function (TakeawayWebhook $webhook) {
$webhook->eventName(); // 'takeaway-pos.order-created'
$webhook->restaurantId(); // restaurant identifier from the payload
$webhook->resourceId(); // order id from the payload
$webhook->payload(); // full raw payload array
});
bash
php artisan vendor:publish --tag=config
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.