1. Go to this page and download the library: Download a4anthony/cartavel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
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',
];
use A4anthony\Cartavel\Facades\Cartavel;
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
bash
php artisan vendor:publish --tag=config
bash
php artisan migrate
bash
php artisan cartavel:seed
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.