-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
bhavinjr
committed
Dec 12, 2017
1 parent
ff78d54
commit c22cdb9
Showing
10 changed files
with
803 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
# laravel-wishlist | ||
|
||
A simple Wishlist implementation for Laravel 5.*.*. | ||
|
||
|
||
## 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. | ||
|
||
|
||
```<?php | ||
return [ | ||
'product_model' => 'App\Models\Product', | ||
]; | ||
``` | ||
|
||
after update `config/wishlist.php` file. | ||
```shell | ||
php artisan migrate | ||
``` | ||
|
||
## 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::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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "bhavinjr/laravel-wishlist", | ||
"description": "wishlist for laravel 5.*.*", | ||
"keywords": [ | ||
"laravel wishlist", "wishlist laravel", "wishlist","ecommerce laravel wishlist", "laravel ecommerce" | ||
], | ||
"type": "library", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Bhavin Rudani", | ||
"email": "bhavinrudani94@gmail.com" | ||
} | ||
], | ||
"minimum-stability": "stable", | ||
"require": { | ||
"php": ">=5.6.0", | ||
"illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Bhavinjr\\Wishlist\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Bhavinjr\\Wishlist\\Providers\\WishlistServiceProvider" | ||
], | ||
"aliases": { | ||
"Wishlist": "Bhavinjr\\Wishlist\\Facades\\Wishlist" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.