PHP code example of onlineidentity / laravel-channable

1. Go to this page and download the library: Download onlineidentity/laravel-channable 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/ */

    

onlineidentity / laravel-channable example snippets


#Examples

# app()->make();

$channable = app()->make('channable');

//Get all orders
$channable->orders()->allOrders();

$order_id = 12345678;
$channable->orders()->shipment($order_id, [
    'tracking_code' => '3S1234567890',
    'transporter' => 'POSTNL',
    'order_item_ids' => [
        1,
        2
    ]
]);

//Get all returns with queryParameters
$channable->returns()->allReturns(['limit' => 2, 'last_modified_after' => '2022-01-01']);

//update returns status
$return_id = 12345678;
$status_accepted = \OnlineIdentity\Enums\ReturnsType::ACCEPTED;
$channable->returns()->updateReturnStatus($return_id, $status_accepted);

# Using the facade

//get all orders
$orders = \OnlineIdentity\LaravelChannable\Facades\Channable::orders()->allOrders();

//change project id
\OnlineIdentity\LaravelChannable\Facades\Channable::setProjectId(123456);

\OnlineIdentity\LaravelChannable\Facades\Channable::orders()->shipment($order_id, [
    'tracking_code' => '3S1234567890',
    'transporter' => 'POSTNL',
    'order_item_ids' => [
        1,
        2
    ]);