2017 © Pedro Peláez
 

library laravel-shop

Order for Laravel Application.

image

neyromanser/laravel-shop

Order for Laravel Application.

  • Friday, August 26, 2016
  • by RaSta
  • Repository
  • 2 Watchers
  • 2 Stars
  • 103 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 4 % Grown

The README.md

laravel-shop

Shop module for Laravel 5 Include Cart and Order, (*1)

Installation

composer require "neyromanser/laravel-shop:1.*"

After installation,go to config/app.php under providers section to add the following:, (*2)

Neyromanser\LaravelShop\LaravelShopServiceProvider::class

and under "aliases" add:, (*3)

'Shop' => Neyromanser\LaravelShop\Facades\ShopFacade::class

publish the migration and config files with the command:, (*4)

php artisan vendor:publish

Edit additional settings at config/shop.php, (*5)

    return [
        'currency' => "грн."
    ];

Usage

Cart

# Add to cart
Shop::Cart()->add([
    'id'      => $id,
    'name'    => $name,
    'qty'     => $request->input('qty', 1),
    'price'   => $item->price,
    'options' => $options
]);

# Remove from cart
Shop::Cart()->remove($id);

# Update cart
Shop::Cart()->update($id, $quantity);

# Cart total sum
Shop::Cart()->total()

# Cart positions amount
Shop::Cart()->count()

# Cart total products units
Shop::Cart()->count(false)

# Search in cart
Shop::Cart()->search(['id' => 123]);

# Associate cart with App\Model\Product
Shop::Cart()->associate('Product', 'App\\Model')

# New cart instance
Shop::Cart()->instance('wishlist')

Order

# Create order
Shop::Order()->order(Auth::user()->id, [
    'shipping_method_id' => $request->input('shipping_method',0),
    'payment_method_id' => $request->input('payment_method',0),
    'shipping_address' => $request->input('address',''),
    'shipping_city' => $request->input('city',''),
    'shipping_name' => $request->input('name',''),
    'shipping_email' => $request->input('email',''),
    'shipping_phone' => $request->input('phone',''),
    'note' => $request->input('note','')
]);

# Add items to order
Shop::Order()->addItems($order, [
    [
        "description" => $name,
        "currency" => $currency,
        "line_item_id" => $item->id,
        "line_item_type" => "App\\ProductVariant",
        "price" => $item->price,
        "quantity" => $item->qty,
        "vat" => 0
    ],[
        "description" => $name,
        "currency" => $currency,
        "line_item_id" => $item->id,
        "line_item_type" => "App\\ProductVariant",
        "price" => $item->price,
        "quantity" => $item->qty,
        "vat" => 0
    ],

]);

Demo

Shop::Cart()->instance('wishlist')->associate('Product', 'App')->add($addItem);

based on

https://github.com/Trexology/laravel-order
https://github.com/Crinsane/LaravelShoppingcart, (*6)

look at

https://github.com/amsgames/laravel-shop, (*7)

upd, (*8)

The Versions

31/05 2016

v1.2.3

1.2.3.0

Order for Laravel Application.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar RaSta

laravel shop cart order

31/05 2016

v1.2.2

1.2.2.0

Order for Laravel Application.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar RaSta

laravel shop cart order

30/05 2016

v1.2

1.2.0.0

Order for Laravel Application.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar RaSta

laravel shop cart order

25/05 2016

v1.1

1.1.0.0

Order for Laravel Application.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar RaSta

laravel shop cart order

18/05 2016

v1.0

1.0.0.0

Order for Laravel Application.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar RaSta

laravel shop cart order