From da5ebf91af1c5a46ad851a7fd6b74d3115d03288 Mon Sep 17 00:00:00 2001 From: Mostafa El Bakly Date: Sat, 5 Aug 2017 14:59:25 +0200 Subject: [PATCH 01/13] Update ReadMe.md Now for Laravel 5.4 and changed is() to statusCodeIs() --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b9684cc..f4ef13a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -LARAVEL SHOP (Laravel 5.1 Package) +LARAVEL SHOP (Laravel 5.4 Package) -------------------------------- [![Latest Stable Version](https://poser.pugx.org/amsgames/laravel-shop/v/stable)](https://packagist.org/packages/amsgames/laravel-shop) @@ -6,7 +6,7 @@ LARAVEL SHOP (Laravel 5.1 Package) [![Latest Unstable Version](https://poser.pugx.org/amsgames/laravel-shop/v/unstable)](https://packagist.org/packages/amsgames/laravel-shop) [![License](https://poser.pugx.org/amsgames/laravel-shop/license)](https://packagist.org/packages/amsgames/laravel-shop) -Laravel Shop is flexible way to add shop functionality to **Laravel 5.1**. Aimed to be the e-commerce solution for artisans. +Laravel Shop is flexible way to add shop functionality to **Laravel 5.4**. Aimed to be the e-commerce solution for artisans. Laravel shop adds shopping cart, orders and payments to your new or existing project; letting you transform any model into a shoppable item. @@ -879,7 +879,7 @@ $transaction = $order->placeTransaction( ```php $completed = $order->isCompleted // Checks if order is in a specific status. -$success = $order->is('completed'); +$success = $order->statusCodeIs('completed'); // Quering // Get orders from specific user ID. @@ -926,7 +926,7 @@ Then use it like: ```php $myStatusCode = 'my_status'; -if ($order->is($myStatusCode)) { +if ($order->statusCodeIs($myStatusCode)) { echo 'My custom status work!'; } ``` @@ -1194,4 +1194,4 @@ Laravel Shop is free software distributed under the terms of the MIT license. This package's architecture and design was inpired by the **Zizaco/entrust** package, we'll like to thank their contributors for their awesome woek. ## Change Log -* [v0.2.8](https://github.com/amsgames/laravel-shop/releases/tag/v0.2.8) \ No newline at end of file +* [v0.2.8](https://github.com/amsgames/laravel-shop/releases/tag/v0.2.8) From 9b87bbb0011511e8182ba9055dd5c6c2f70562d8 Mon Sep 17 00:00:00 2001 From: Mostafa El Bakly Date: Sat, 5 Aug 2017 15:04:30 +0200 Subject: [PATCH 02/13] Update ShopCartTrait.php --- src/Traits/ShopCartTrait.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Traits/ShopCartTrait.php b/src/Traits/ShopCartTrait.php index 0e982e5..6588af9 100644 --- a/src/Traits/ShopCartTrait.php +++ b/src/Traits/ShopCartTrait.php @@ -38,7 +38,7 @@ public static function boot() parent::boot(); static::deleting(function($user) { - if (!method_exists(Config::get('auth.model'), 'bootSoftDeletingTrait')) { + if (!method_exists(Config::get('auth.providers.users.model'), 'bootSoftDeletingTrait')) { $user->items()->sync([]); } @@ -53,7 +53,7 @@ public static function boot() */ public function user() { - return $this->belongsTo(Config::get('auth.model'), 'user_id'); + return $this->belongsTo(Config::get('auth.providers.users.model'), 'user_id'); } /** @@ -304,4 +304,4 @@ private function getItem($sku) ->first(); } -} \ No newline at end of file +} From 995a8e4e41883607c79bc52d85c4f98a4d66595e Mon Sep 17 00:00:00 2001 From: Mostafa El Bakly Date: Sat, 5 Aug 2017 15:05:47 +0200 Subject: [PATCH 03/13] Update ShopItemModel.php --- src/Models/ShopItemModel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Models/ShopItemModel.php b/src/Models/ShopItemModel.php index 97d21db..8c2a572 100644 --- a/src/Models/ShopItemModel.php +++ b/src/Models/ShopItemModel.php @@ -68,7 +68,7 @@ public function __construct(array $attributes = []) */ public function user() { - return $this->belongsTo(Config::get('auth.model'), 'user_id'); + return $this->belongsTo(Config::get('auth.providers.users.model'), 'user_id'); } /** @@ -91,4 +91,4 @@ public function order() return $this->belongsTo(Config::get('shop.order'), 'order_id'); } -} \ No newline at end of file +} From 965cd216c9dbdb9e66139359122dd8d0d83fb523 Mon Sep 17 00:00:00 2001 From: Mostafa El Bakly Date: Sat, 5 Aug 2017 15:07:48 +0200 Subject: [PATCH 04/13] Update ShopOrderTrait.php --- src/Traits/ShopOrderTrait.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Traits/ShopOrderTrait.php b/src/Traits/ShopOrderTrait.php index 1296a5e..2587ace 100644 --- a/src/Traits/ShopOrderTrait.php +++ b/src/Traits/ShopOrderTrait.php @@ -29,7 +29,7 @@ public static function boot() parent::boot(); static::deleting(function($user) { - if (!method_exists(Config::get('auth.model'), 'bootSoftDeletingTrait')) { + if (!method_exists(Config::get('auth.providers.users.model'), 'bootSoftDeletingTrait')) { $user->items()->sync([]); } @@ -44,7 +44,7 @@ public static function boot() */ public function user() { - return $this->belongsTo(Config::get('auth.model'), 'user_id'); + return $this->belongsTo(Config::get('auth.providers.users.model'), 'user_id'); } /** @@ -258,4 +258,4 @@ private function getItem($sku) ->where('order_id', $this->attributes['id']) ->first(); } -} \ No newline at end of file +} From 4cbd514aadd1633cc621ea77322d64c94886b819 Mon Sep 17 00:00:00 2001 From: Mostafa El Bakly Date: Sat, 5 Aug 2017 15:11:04 +0200 Subject: [PATCH 05/13] Update MigrationCommand.php --- src/Commands/MigrationCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Commands/MigrationCommand.php b/src/Commands/MigrationCommand.php index 8c1df4d..941fa00 100644 --- a/src/Commands/MigrationCommand.php +++ b/src/Commands/MigrationCommand.php @@ -127,8 +127,8 @@ protected function createMigration($data) { $migrationFile = base_path('/database/migrations') . '/' . date('Y_m_d_His') . '_shop_setup_tables.php'; - $usersTable = Config::get('auth.table'); - $userModel = Config::get('auth.model'); + $usersTable = Config::get('auth.providers.users.table'); + $userModel = Config::get('auth.providers.users.model'); $userKeyName = (new $userModel())->getKeyName(); $data = array_merge($data, compact('usersTable', 'userKeyName')); @@ -165,4 +165,4 @@ protected function createSeeder($data) return false; } -} \ No newline at end of file +} From f8a333a0f08e93562b64e5b9479424cbd7a29dca Mon Sep 17 00:00:00 2001 From: Mostafa El Bakly Date: Sat, 5 Aug 2017 15:14:11 +0200 Subject: [PATCH 06/13] Update README.md --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index f4ef13a..e133386 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,18 @@ Or add to your composer.json. Then run `composer install` or `composer update`. +Then in your `config/auth.php` add `'table' => 'users',` to provdiers.users + +```php +'providers' => [ + 'users' => [ + 'driver' => 'eloquent', + 'model' => App\User::class, + 'table' => 'users', + ], + +``` + Then in your `config/app.php` add ```php From 0869d98fa1dbccf4b4c516eef502327f362ccf55 Mon Sep 17 00:00:00 2001 From: Mostafa El Bakly Date: Sat, 5 Aug 2017 15:22:56 +0200 Subject: [PATCH 07/13] Update composer.json --- composer.json | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index e4bc1d9..53a72f8 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "amsgames/laravel-shop", - "description": "Package set to provide shop or e-commerce functionality (such as CART, ORDERS, TRANSACTIONS and ITEMS) to Laravel for customizable builds.", + "name": "baklysystems/laravel-shop", + "description": "This is just an update for amsgames/laravel-shop to support 5.4 as they don't update it anymore. Package set to provide shop or e-commerce functionality (such as CART, ORDERS, TRANSACTIONS and ITEMS) to Laravel for customizable builds.", "license": "MIT", "keywords": ["shop","laravel","cart","orders","transactions","paypal","e-commerce","shopping cart","ecommerce","shopping"], "authors": [ @@ -12,6 +12,11 @@ "name": "Alejandro Mostajo", "email": "amostajo@gmail.com" } + , + { + "name": "Mostafa Elbakly", + "email": "elbakly@gmail.com" + } ], "require": { "php": ">=5.5.9", @@ -28,4 +33,4 @@ } }, "minimum-stability": "dev" -} \ No newline at end of file +} From b075a3e1b8ab33e389cee644ddb73226d20758a1 Mon Sep 17 00:00:00 2001 From: Mostafa El Bakly Date: Sat, 5 Aug 2017 16:40:25 +0200 Subject: [PATCH 08/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e133386..aecbd72 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ On the horizon: With composer ```bash -composer require amsgames/laravel-shop +composer require baklysystems/laravel-shop ``` Or add From 840187b2548980374588020d65b9162b82ec610c Mon Sep 17 00:00:00 2001 From: Mostafa Elbakly Date: Sat, 5 Aug 2017 16:58:41 +0200 Subject: [PATCH 09/13] updated service provider --- src/LaravelShopProvider.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/LaravelShopProvider.php b/src/LaravelShopProvider.php index 2484bdb..1b7d392 100644 --- a/src/LaravelShopProvider.php +++ b/src/LaravelShopProvider.php @@ -29,9 +29,8 @@ class LaravelShopProvider extends ServiceProvider * * @return void */ - public function boot(Router $router) + public function boot() { - parent::boot($router); // Publish config files $this->publishes([ From a03519e7851acd494d33abff88bc082d6c89cd33 Mon Sep 17 00:00:00 2001 From: Mostafa Elbakly Date: Sat, 5 Aug 2017 17:14:18 +0200 Subject: [PATCH 10/13] fixing is function --- src/Contracts/ShopOrderInterface.php | 4 ++-- src/Traits/ShopOrderTrait.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Contracts/ShopOrderInterface.php b/src/Contracts/ShopOrderInterface.php index c43f166..d9a17e8 100644 --- a/src/Contracts/ShopOrderInterface.php +++ b/src/Contracts/ShopOrderInterface.php @@ -140,7 +140,7 @@ public function getDisplayTotalAttribute(); * * @return bool */ - public function is($statusCode); + public function statusCodeIs($statusCode); /** * Creates the order's transaction. @@ -174,4 +174,4 @@ public function scopeWhereSKU($query, $sku); */ public function scopeWhereStatusIn($query, array $statusCodes); -} \ No newline at end of file +} diff --git a/src/Traits/ShopOrderTrait.php b/src/Traits/ShopOrderTrait.php index 2587ace..2c83e93 100644 --- a/src/Traits/ShopOrderTrait.php +++ b/src/Traits/ShopOrderTrait.php @@ -158,7 +158,7 @@ public function scopeFindByUser($query, $userId, $statusCode = null) { * * @return bool */ - public function is($statusCode) + public function statusCodeIs($statusCode) { return $this->attributes['statusCode'] == $statusCode; } From 0a539e8f1ee5ba1717b53b1e537d3858c86d6c29 Mon Sep 17 00:00:00 2001 From: Darron Park Date: Fri, 13 Oct 2017 16:59:44 +0900 Subject: [PATCH 11/13] Update MigrationCommand.php --- src/Commands/MigrationCommand.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Commands/MigrationCommand.php b/src/Commands/MigrationCommand.php index 941fa00..577b970 100644 --- a/src/Commands/MigrationCommand.php +++ b/src/Commands/MigrationCommand.php @@ -115,6 +115,16 @@ public function fire() } } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->fire(); + } /** * Create the migration. From e6fd46ad823a356459e72b294a90be14b59efd9e Mon Sep 17 00:00:00 2001 From: abdelrahmanbadr Date: Thu, 19 Oct 2017 15:33:12 +0200 Subject: [PATCH 12/13] Update ShopCartTrait.php --- src/Traits/ShopCartTrait.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Traits/ShopCartTrait.php b/src/Traits/ShopCartTrait.php index 6588af9..9d94dd4 100644 --- a/src/Traits/ShopCartTrait.php +++ b/src/Traits/ShopCartTrait.php @@ -139,6 +139,7 @@ public function remove($item, $quantity = 0) if (!empty($quantity)) { $cartItem->quantity -= $quantity; $cartItem->save(); + $this->resetCalculations(); if ($cartItem->quantity > 0) return true; } $cartItem->delete(); From 63c9fcf8da9cc345d9d0f411afce41a0700d355c Mon Sep 17 00:00:00 2001 From: Mostafa El Bakly Date: Mon, 20 Nov 2017 17:51:54 +0200 Subject: [PATCH 13/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aecbd72..fcfccc0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -LARAVEL SHOP (Laravel 5.4 Package) +LARAVEL SHOP (Laravel 5.5 Package) -------------------------------- [![Latest Stable Version](https://poser.pugx.org/amsgames/laravel-shop/v/stable)](https://packagist.org/packages/amsgames/laravel-shop)