Order management
PHP >=7.4
$ composer require rockbuzz/lara-orders
$ php artisan vendor:publish --provider="Rockbuzz\LaraOrders\ServiceProvider" --tag="migrations"
$ php artisan migrate
Add the HasOrder
trait to the template for which you will be ordering
use Rockbuzz\LaraOrders\Transaction;
use Rockbuzz\LaraOrders\Models\Order;
use Rockbuzz\LaraOrders\Models\OrderCoupon;
use Rockbuzz\LaraOrders\Traits\HasOrder;
class YourBuyer
{
use HasOrder
}
$buyer->orders(): MorphMany;
$buyer->createOrder(array $notes = []): Order;
$buyer->orderById(int $id): ?Order;
$buyer->orderByUuid(string $uuid): ?Order;
$order->buyer(): BelongsTo;
$order->coupon(): BelongsTo;
$order->applyCoupon(OrderCoupon $coupon);
$order->items(): HasMany;
$order->total; //98.99
$order->totalInCents; //9899
$order->totalWithCoupon; //88.99
$order->totalWithCouponInCents; //8899
$order->transactions(): HasMany;
- Events
Rockbuzz\LaraOrders\Events\OrderCreated::class
Rockbuzz\LaraOrders\Events\OrderTransactionCreated::class
Rockbuzz\LaraOrders\Events\CouponApplied::class
The Lara Orders is open-sourced software licensed under the MIT license.