PHPackages                             rikless/laravel-shop - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. rikless/laravel-shop

ActiveLibrary[Payment Processing](/categories/payments)

rikless/laravel-shop
====================

Package set to provide shop or e-commerce functionality (such as CART, ORDERS, TRANSACTIONS and ITEMS) to Laravel for customizable builds.

v0.2.18(5y ago)0178MITPHPPHP &gt;=7.4

Since Jun 24Pushed 5y agoCompare

[ Source](https://github.com/rikless/laravel-shop)[ Packagist](https://packagist.org/packages/rikless/laravel-shop)[ RSS](/packages/rikless-laravel-shop/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (19)Used By (0)

fork of LARAVEL SHOP (minor changes for Laravel 5.2 Compatibility)
------------------------------------------------------------------

[](#fork-of-laravel-shop-minor-changes-for-laravel-52-compatibility)

Laravel Shop is flexible way to add shop functionality to **Laravel 8.9**. Aimed to be the e-commerce solution for artisans.

Laravel shop adds shopping cart, orders and payments to your new or existing project; letting you transform any model into a shoppable item.

Contents
--------

[](#contents)

- [Scope](#scope)
- [Installation](#installation)
- [Configuration](#configuration)
    - [Database Setup](#database-setup)
    - [Models Setup](#models)
        - [Item](#item)
        - [Cart](#cart)
        - [Order](#order)
        - [Transaction](#transaction)
        - [User](#user)
        - [Existing Model Conversion](#existing-model-conversion)
    - [Dump Autoload](#dump-autoload)
    - [Payment Gateways](#payment-gateways)
        - [PayPal](#paypal)
        - [Omnipay](#omnipay)
- [Usage](#usage)
    - [Shop](#shop)
        - [Purchase Flow](#purchase-flow)
        - [Payment Gateway](#payment-gateway)
        - [Checkout](#checkout)
        - [Order placement](#exceptions)
        - [Payments](#payments)
        - [Exceptions](#order-placement)
    - [Shopping Cart](#shopping-cart)
        - [Adding Items](#adding-items)
        - [Removing Items](#removing-items)
        - [Placing Order](#placing-order)
        - [Cart Methods](#cart-methods)
        - [Displaying](#removing-items)
    - [Item](#item-1)
    - [Order](#order-1)
        - [Placing Transactions](#placing-transactions)
        - [Order Methods](#order-methods)
    - [Events](#events)
        - [Handler Example](#event-handler-example)
- [Payment Gateway Development](#payment-gateway-development)
    - [Transaction](#transaction-1)
    - [Callbacks](#callbacks)
    - [Exceptions](#exception)
- [License](#license)
- [Additional Information](#additional-information)
- [Change Log](#change-log)

Scope
-----

[](#scope)

Current version includes:

- Shop Items (transforms existing models into shoppable items that can be added to cart and orders)
- Cart
- Orders
- Transactions
- Payment gateways support
- PayPal
- Events

On the horizon:

- Guest user cart
- Shipping orders
- Coupons
- Product and variations solution
- Backend dashboard
- Frontend templates

Installation
------------

[](#installation)

With composer

```
composer require amsgames/laravel-shop
```

Or add

```
"rikless/laravel-shop": "0.2.*"
```

to your composer.json. Then run `composer install` or `composer update`.

Then in your `config/app.php` add

```
Amsgames\LaravelShop\LaravelShopProvider::class,
```

in the `providers` array.

Then add

```
'Shop'      => Amsgames\LaravelShop\LaravelShopFacade::class,
```

in the `aliases` array.

Configuration
-------------

[](#configuration)

Set the configuration values in the `config/auth.php` file. This package will use them to refer to the user table and model.

Publish the configuration for this package to further customize table names, model namespaces, currencies and other values. Run the following command:

```
php artisan vendor:publish
```

A `shop.php` file will be created in your app/config directory.

### Database Setup

[](#database-setup)

Generate package migration file:

```
php artisan laravel-shop:migration
```

The command below will generate a new migration file with database commands to create the cart and item tables. The file will be located in `database/migrations`. Add additional fields if needed to fill your software needs.

The command will also create a database seeder to fill shop catalog of status and types.

Create schema in database:

```
php artisan migrate
```

Add the seeder to `database/seeds/DatabaseSeeder.php`:

```
class DatabaseSeeder extends Seeder
{

  public function run()
  {
    Model::unguard();

    $this->call('LaravelShopSeeder');

    Model::reguard();
  }

}
```

Run seeder (do `composer dump-autoload first`):

```
php artisan db:seed
```

### Models

[](#models)

The following models must be created for the shop to function, these models can be customizable to fir your needs.

#### Item

[](#item)

Create a Item model:

```
php artisan make:model Item
```

This will create the model file `app/Item.php`, edit it and make it look like (take in consideration your app's namespace):

```
