定制 a4anthony/cartavel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

a4anthony/cartavel

Composer 安装命令:

composer require a4anthony/cartavel

包简介

E-commerce cart system

README 文档

README

Total Downloads Latest Stable Version License

Prerequisite

To use this package, migration files for users and items/inventory/products table must have been set up.

Installation Steps

After creating your new Laravel application you can include the cartavel package with the following command:

composer require a4anthony/cartavel

Laravel ^5.5 uses Package Auto-Discovery, so it doesn't require you to manually add the ServiceProvider/Facade.

After updating composer, add the ServiceProvider to the providers array in config > app.php

A4anthony\Cartavel\CartavelServiceProvider::class

Optionally you can use the Facade for shorter code. Add this to your facades in the aliases array in config > app.php:

"Cartavel" => \A4anthony\Cartavel\Facades\Cartavel::class

To configure this package to suit your project, publish the cartavel config file

 php artisan vendor:publish --tag=config

Go to config > cartavel.php and adjust the settings to suit your project

<?php

return [
    /*
    |--------------------------------------------------------------------------
    | Users Table Name
    |--------------------------------------------------------------------------
    |
    | Here you can specify the users table name.
    |
    */

    'users_table_name' => 'users',

    /*
    |--------------------------------------------------------------------------
    | User Table Unique Column
    |--------------------------------------------------------------------------
    |
    | Here you can specify the unique column to be used from your users table
    |
    */

    'users_table_unique_column' => 'id',

    /*
    |--------------------------------------------------------------------------
    | Cart Table Name
    |--------------------------------------------------------------------------
    |
    | Here you can specify the cart table name.
    |
    */

    'cart_table_name' => 'carts',

    /*
    |--------------------------------------------------------------------------
    | Items/Products Table Name
    |--------------------------------------------------------------------------
    |
    | Here you can specify the table name for your items/products
    |
    */

    'items_table_name' => 'products',

    /*
    |--------------------------------------------------------------------------
    | Items/Products Table Name Unique Column
    |--------------------------------------------------------------------------
    |
    | Here you can specify the unique column to be used from your items/products table
    |
    */

    'items_table_unique_column' => 'id',
];

Next make sure to create a new database and add your database credentials to your .env file:

DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

Run migrations

php artisan migrate

To seed the cart with dummy data, it will require that you first seed your users and items/inventory/products table first and the run

php artisan cartavel:seed

To use this package, import the cartavel package

use A4anthony\Cartavel\Facades\Cartavel;

List of all available methods

Cartavel::get($userId, true); //gets users cart items

Cartavel::add($userId, $itemId, $quantity); //adds item to user's cart

Cartavel::update($userId, $itemId, $quantity); //updates quantity o item in user's cart

Cartavel::delete($userId, $itemId); //deletes item from user's cart

Cartavel::clear($userId); //clears user's cart

ENJOY!!!

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

License

MIT

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固