Package Data | |
---|---|
Maintainer Username: | trexology |
Maintainer Contact: | trexlim@gmail.com (trexology) |
Package Create Date: | 2015-12-01 |
Package Last Update: | 2020-10-31 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-14 15:03:51 |
Package Statistics | |
---|---|
Total Downloads: | 121 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 9 |
Total Watchers: | 3 |
Total Forks: | 2 |
Total Open Issues: | 3 |
Basic Ordering Package for Laravel 5+
composer require trexology/laravel-order:2.*
After installation,go to config/app.php
under providers
section to add the following:
Trexology\LaravelOrder\LaravelOrderServiceProvider::class
and under "aliases" add:
'Order' => Trexology\LaravelOrder\Facades\OrderFacade::class
publish the migration and config files with the commands:
php artisan vendor:publish
Edit additional settings at config/order.php
return [
/*
|--------------------------------------------------------------------------
| Order Status Name
|--------------------------------------------------------------------------
| Customize the status name recorded
|
*/
'init' => "init",
'complete' => "complete",
'ignoredFields' => []
];
• This package uses VentureCraft/revisionable to track order changes
• Remove the old migration file '2015_12_02_150448_create_orderLogs_table.php'
• Column line_item_id
in Orderitems
table has been changed from integer to string for greater flexibility (version 1 user have to change the column type manually)
Order Order::order(int $user_id, array $data = null, bool $draft = FALSE)
$data = [
//Custom fields
'cust_first_name' => $cust->first_name,
'cust_last_name' => $cust->last_name
];
$order = Order::order($cust->id, $data);
Order Order::addItem(Order $order, Model $object, double $price, int $quantity, array $data = null, double $vat = 0);
$data = [
'description' => "My item descriptions",
'currency' => "SGD"
];
$order = Order::addItem($order, $object, 25.5, 2, $data, 7);
Order Order::addItemManual(Order $order, string $object_id, string $object_type, double $price, int $quantity, array $data = null, double $vat = 0)
$data = [
'description' => "My item descriptions",
'currency' => "SGD"
];
$order = Order::addItem($order, 22, "App\Model\Object", 25.5, 2, $data, 7);
Order Order::batchAddItems(Order $order, array $order_Items)
$order_Items = [
[
"description" => "Some Description",
"currency" => "USD",
"line_item_id" => 1,
"line_item_type" => "App\\Models\\Package",
"price" => 1802,
"quantity" => 1,
"vat" => 0,
],
[
"description" => "Some Description",
"currency" => "USD",
"line_item_id" => 1,
"line_item_type" => "App\\Models\\Package",
"price" => 1802,
"quantity" => 1,
"vat" => 0,
]
];
$order = Order::batchAddItems($order, $order_Items);
Order Order::getOrder(int $order_id);
Collection Order::getUserOrders(int $user_id);
boolean Order::updateStatus(int $order_id, string $status);
boolean Order::deleteOrder(int $order_id);
OrderItem Order::updateQty(int $item_id, int qty);
float Order::total(Order $order);
int Order::count(Order $order);