This package provides basic "add to cart" and "add to wishlist" functionalities for building e-commerce project with Laravel framework
composer require hridoyraisul/cartwishlistlaravel
RaisulHridoy\CartWishList\CartWishlistServiceProvider::class,
php artisan optimize
php artisan migrate
Done !!! Let's have some fun now 😉
use RaisulHridoy\CartWishList\Http\Interfaces\CartWishlistInterface;
protected $cartWishlist;
public function __construct(CartWishlistInterface $cartWishlistInterface)
{
$this->cartWishlist = $cartWishlistInterface;
}
public function example()
{
$user_id = 1; //as example
$this->cartWishlist->getUserCart($user_id);
}
Here the parameter "$item" is an array which includes attributes like below,
$item = [
'product_id' => 1,
'user_id' => 2,
'quantity' => 3,
'unit_price' => 200, //Nullable Field
'total_price'=> 600 //Nullable Field
];
Here the 1st parameter "$cart_id" is an integer value of specific cart's id to update and the 2nd parameter "$item" is an array which includes attributes like below,
$item = [
'quantity' => 3,
'unit_price' => 200, //Nullable Field
'total_price'=> 600 //Nullable Field
];
Here parameter "$cart_id" is an integer value of specific cart's id to retrieve.
This function require user's id as parameter and retrieve all cart items for specific user.
This function retrieve all cart items on the project.
This function will delete specific cart item for a user. It requires cart's id as parameter.
This function will delete all cart items for a user. It requires user's id as parameter.
Here the parameter "$item" is an array which includes attributes like below,
$item = [
'product_id' => 1,
'user_id' => 2
];
This function require user's id as parameter and retrieve all wishlist items for specific user.
This function will delete specific wishlist item for a user. It requires wishlist's id as parameter.
This function will delete all wishlist items for a user. It requires user's id as parameter.
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.
MIT License
Copyright (c) 2023 || Developed by Raisul Islam Hridoy
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.