Skip to content

Commit

Permalink
added initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavinjr committed Dec 12, 2017
1 parent ff78d54 commit c22cdb9
Show file tree
Hide file tree
Showing 10 changed files with 803 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor
124 changes: 124 additions & 0 deletions README.md
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
```
35 changes: 35 additions & 0 deletions composer.json
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"
}
}
}
}
Loading

0 comments on commit c22cdb9

Please sign in to comment.