Shipping
You can manage your shipments from here with ease.
Installation
bash
composer require obelaw/shipping
php artisan twist:setup
php artisan twist:migrate
How to use
Integrating with Your Order Model
To enable shipping functionality for your orders, include the HasDeliveryOrder
trait in your Order
model:
php
use Obelaw\Shipping\Traits\HasDeliveryOrder;
class Order extends BaseModel
{
use HasDeliveryOrder;
...
Creating a Delivery Order
Utilize the Shipper facade to create a delivery order:
php
use Obelaw\Shipping\Facades\Shipper;
$order = Order::find(1);
$deliveryOrder = Shipper::createDeliveryOrder($order, $accountId, $codAmount);
$accountId
: Represents the ID of the associated Courier Account.
Delivery Order Actions (Programmatic Methods)
Once a $deliveryOrder object is created, you can perform the following actions:
$deliveryOrder->ship()
: Initiates the shipment process for this order.$deliveryOrder->printLabel()
: Generates and retrieves the shipping label for printing.$deliveryOrder->tracking()
: Retrieves the current tracking information for the shipment.$deliveryOrder->cancel()
: Cancels the delivery order, if the courier service allows.