https://github.com/bhavinjr/laravel-wishlist
wishlist for laravel 5.*.*
https://github.com/bhavinjr/laravel-wishlist
bookmark ecommerce-wishlist laravel laravel-bookmark laravel-wishlist wishlist wishlist-ecommerce wishlist-laravel
Last synced: about 1 month ago
JSON representation
wishlist for laravel 5.*.*
- Host: GitHub
- URL: https://github.com/bhavinjr/laravel-wishlist
- Owner: bhavinjr
- Created: 2017-12-11T11:43:06.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-11-25T14:47:31.000Z (almost 6 years ago)
- Last Synced: 2025-04-15T06:55:42.406Z (6 months ago)
- Topics: bookmark, ecommerce-wishlist, laravel, laravel-bookmark, laravel-wishlist, wishlist, wishlist-ecommerce, wishlist-laravel
- Language: PHP
- Size: 10.7 KB
- Stars: 8
- Watchers: 1
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# laravel-wishlist
A simple Wishlist implementation for Laravel 5.*.*.
[](https://packagist.org/packages/bhavinjr/laravel-wishlist)
[](https://packagist.org/packages/bhavinjr/laravel-wishlist)
[](https://packagist.org/packages/bhavinjr/laravel-wishlist)## Installation
First, you'll need to install the package via Composer:
```shell
$ composer require bhavinjr/laravel-wishlist
```If you are don't use using Laravel 5.5.* Then, update `config/app.php` by adding an entry for the service provider.
```php
'providers' => [
// ...
Bhavinjr\Wishlist\Providers\WishlistServiceProvider::class,
];'aliases' => [
//...
"Wishlist": "Bhavinjr\Wishlist\Facades\Wishlist",
];
```In command line paste this command:
```shell
php artisan config:cache
```In command line again, publish the default configuration file:
```shell
php artisan vendor:publish --provider="Bhavinjr\Wishlist\Providers\WishlistServiceProvider"
```In command line paste this command:
```shell
php artisan migrate
```## Configuration
Configuration was designed to be as flexible.
global configuration can be set in the `config/wishlist.php` file.``` 'App\Models\Product',
];
```after update `config/wishlist.php` file.
```shell
php artisan config:cache
```## Usage
The package gives you the following methods to use:
Adding an item to the wishlist is really simple
you need specify product_id and user_id respectively all parameter are compulsory
### Wishlist::add()
```php
Wishlist::add(15, 1);
```### Wishlist::remove()
To remove an item from the wishlist, specify the wishlist_id.
```php
Wishlist::remove(2);
```### Wishlist::getUserWishlist()
To get users all wishlist item, specify the user_id.
```php
Wishlist::getUserWishlist(1);
```### Wishlist::removeUserWishlist()
To remove users all wishlist item, specify the user_id.
```php
Wishlist::removeUserWishlist(1);
```### Wishlist::removeByProduct()
To remove particular product using product_id, specify the product_id and user_id respectively.
```php
Wishlist::removeByProduct(15, 1);
```### Wishlist::count()
To count users all wishlist item, specify the user_id.
```php
Wishlist::count(1);
```### Wishlist::getWishlistItem()
To get particular wishlist item, specify the product_id and user_id respectively
```php
Wishlist::getWishlistItem(15, 1);
```You can also load product detail
```php
$result = Wishlist::getUserWishlist(1)->load('product');or you can also access directly
```