commit
150d4f7342
|
|
@ -3,7 +3,7 @@ root = true
|
|||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
insert_final_newline = false
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_VERSION=0.1.6
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
|
@ -16,7 +17,7 @@ DB_PASSWORD=secret
|
|||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_LIFETIME=10
|
||||
QUEUE_DRIVER=sync
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
|
|
@ -30,6 +31,11 @@ MAIL_USERNAME=null
|
|||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
|
||||
SHOP_MAIL_FROM=shop@bagsaas.com
|
||||
ADMIN_MAIL_TO=admin@bagsaas.com
|
||||
|
||||
fixer_api_key=
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
|
|
|
|||
|
|
@ -18,3 +18,4 @@ yarn-error.log
|
|||
/ignorables/*
|
||||
composer.lock
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
|
|
|
|||
|
|
@ -2,6 +2,243 @@
|
|||
|
||||
#### This changelog consists the bug & security fixes and new features being included in the releases listed below.
|
||||
|
||||
## **v0.1.6(28th of June, 2019)** - *Release*
|
||||
|
||||
* [feature] - Cart rules for providing discount with coupons and without coupons.
|
||||
|
||||
* [feature] - Take notes on customers.
|
||||
|
||||
* [feature] - Added swatch type attribute for products.
|
||||
|
||||
* [feature] - Added file type attribute for products.
|
||||
|
||||
* [feature] - Added image type attribute for products.
|
||||
|
||||
* [feature] - Admins can now export products.
|
||||
|
||||
* [feature] - Activate/Deactivate customers from admin panel.
|
||||
|
||||
* [feature] - Added backorders as global level configuration for Admin.
|
||||
|
||||
* [feature] - REST APIs added as a separate package.
|
||||
|
||||
* [enhancement] - Each channel can choose their respective root category.
|
||||
|
||||
* [enhancement] - Added customer group 'Guest' for guest type user comparison (reference usage in cart rule create and edit).
|
||||
|
||||
* [enhancement] - Global configuration to allow reviews from guests.
|
||||
|
||||
* [enhancement] - Weight unit options added as global configuration.
|
||||
|
||||
* [enhancement] - Dynamic footer bottom text input added as global level configuration.
|
||||
|
||||
* [enhancement] - Admin can now change their logo added as global level configuration.
|
||||
|
||||
* [enhancement] - Added global configuration for news letter subscription.
|
||||
|
||||
* [enhancement] - Added configuration to enable email verification on customer registration.
|
||||
|
||||
* [enhancement] - Dependent field added in system configuration.
|
||||
|
||||
* [optimization] - Removed products dependency from products_datagrid table and that table had been phased out of the system successfully.
|
||||
|
||||
* [optimization] - Massive performance improvements in page load from last stable release of v0.1.5.
|
||||
|
||||
* #636 [fixed] - Getting exception in shipment grid.
|
||||
|
||||
* #638 [fixed] - Colors are not available in swatch on selecting Swatch Type as "Color Swatch".
|
||||
|
||||
* #639 [fixed] - Broken link of image, on edit page of attribute in case of Swatch Type "Image" when editing first time.
|
||||
|
||||
* #642 [fixed] - Getting exception on search in Products, Categories, Shipments & Product Reviews datagrids.
|
||||
|
||||
* #654 [fixed] - Getting Exception while adding product images by gui installer.
|
||||
|
||||
* #646 [fixed] - Warning: array_combine() expects parameter 1 to be array, null given ( install.php on line 32 ).
|
||||
|
||||
* #647 [fixed] - Special price not working.
|
||||
|
||||
* #655 [fixed] - Not able to create category with images, category doesn't get save if image is used.
|
||||
|
||||
* #656 [fixed] - Getting checkout page blank when product is added in cart first and then proceed for checkout.Getting this issue in case of logged-in customer.Getting same issue in case of Buy-now also.
|
||||
|
||||
* #657 [fixed] - Not able to export order.Not getting any response after clicking on Export.Getting this issue for all export functionality
|
||||
|
||||
* #666 [enhancement] - Create possibility of choose the qty os address line.
|
||||
|
||||
* #671 [fixed] - Having these errors Undefined variable: key/value.
|
||||
|
||||
* #730 [fixed] - Add a word limitation for Category name so that after that limit category name should display in different line.
|
||||
|
||||
* #729 [fixed] - Price Slider overlap with category menu.
|
||||
|
||||
* #728 [fixed] - If multiple products are added in cart and we update the quantity of product which is not available then in this case its not showing a message that request quantity is not available, it shows success message that products in cart is updated.
|
||||
|
||||
* #727 [fixed] - Quantity of Product doesn't get updated at product page after generating shipment.
|
||||
|
||||
* #720 [fixed] - Case issue HomeController.php.
|
||||
|
||||
* #718 [fixed] - If user with custom role doesn't have access of Products and if he click on product link given in dashboard then getting exception.It should display unauthorised access message.
|
||||
|
||||
* #717 [fixed] - Url is not working "Add to Cart" in drop shipping manager.
|
||||
|
||||
* #713 [fixed] - Getting exception on deleting default channel.
|
||||
|
||||
* #712 [fixed] - Correct the filter option in Invoice grid.
|
||||
|
||||
* #710 [fixed] - Getting exception when applying filter on Product according to Status.
|
||||
|
||||
* #709 [fixed] - Getting exception when applying filter according to Order Date of Order grid of Admin.
|
||||
|
||||
* #707 [fixed] - If in display mode for categories "Only Product" is selected then description should not display on front-end and if Only "Description" is selected than product should not display for category.
|
||||
|
||||
* #705 [fixed] - For 3 level menu option if access is given for only first menu and third menu , then getting unauthorized access.
|
||||
|
||||
* #699 [fixed] - Active category class missing
|
||||
|
||||
* #765 [fixed] - Getting issue in mass deletion for the configurable products if we have saved the products but variation and name of products has not saved.Getting this issue when App_Debug mode is false.
|
||||
|
||||
* #764 [fixed] - Make "Sliders" and "Image" field as required.While creating slider if image is not uploaded then slider is not created and its not showing that this field is required validation message.
|
||||
|
||||
* #763 [fixed] - Add a validation in tax rate that it should not be negative.
|
||||
|
||||
* #762 [fixed] - In Order Section of Customer Account no column is available in filter dropdown.
|
||||
|
||||
* #761 [fixed] - Issue in creating products if special characters are used in sku field.On add Product page if we use special character then it will be saved but when we click on Save Product button it gives validation error message that "The sku must be valid slug." admin.
|
||||
|
||||
* #760 [fixed] - Not able to add product to Wishlist from product page.
|
||||
|
||||
* #759 [fixed] - Text for Add to Cart button is not properly visible on product page for locale pt_BR.
|
||||
|
||||
* #757 [fixed] - Product getting save if price and weight is negative in variants of configurable product.
|
||||
|
||||
* #755 [fixed] - When trying to change display mode for product to list view when locale is "arabic" , it changes to default locale.
|
||||
|
||||
* #753 [fixed] - While creating attribute of type swatch, admin name and name according to locale is showing as required but get saved if field is left as blank, and while creating product this attribute field is blank.
|
||||
|
||||
* #752 [fixed] - On creating custom theme for shop it was also affecting admin panel's frontend.
|
||||
|
||||
* #750 [fixed] - Cross site request forgery.
|
||||
|
||||
* #749 [fixed] - Broken access control.
|
||||
|
||||
* #742 [fixed] - Getting exception when we change locale from Search result page.
|
||||
|
||||
* #741 [fixed] - Trying to get property 'permission_type' of non-object.
|
||||
|
||||
* #825 [fixed] - unable to update ( is_filterable ) in attributes.
|
||||
|
||||
* #818 [fixed] - Email should sent to the respective inventory from which shipment has been created.
|
||||
|
||||
* #817 [fixed] - Admin should receive an email when an order is placed.
|
||||
|
||||
* #815 [fixed] - Issue in Attribute while creating configurable product.
|
||||
|
||||
* #814 [fixed] - Implement sort order feature for payment methods, so that payment method should display on front-end according to sort-order.
|
||||
|
||||
* #783 [fixed] - Image display issue of product on front-end when installation is done through GUI Installer.
|
||||
|
||||
* #771 [fixed] - Getting exception when login with custom role.
|
||||
|
||||
* #767 [fixed] - After applying filter of status , the result display in boolean for Active/True and Inactive/False.
|
||||
|
||||
* #879 [fixed] - Getting validation error message for locale while editing attribute.Attribute value is required for all locale.
|
||||
|
||||
* #867 [fixed] - Getting exception if user create shipment for product which has been deleted from catalog.
|
||||
|
||||
* #842 [fixed] - Not able to export. This functionality is not working everywhere, where export is used.
|
||||
|
||||
* #841 [fixed] - Layout issue on 404 Page.
|
||||
|
||||
* #835 [fixed] - Parent Products show instock when all children have quantity 0.
|
||||
|
||||
* #939 [fixed] - Not able to save price in decimal for configurable products.
|
||||
|
||||
* #932 [fixed] - Getting incorrect price of product in case of configurable product if custom attribute of select type is used.
|
||||
|
||||
* #923 [fixed] - Required validation is not working for Lines in a Street Address, and add 1 as default line for address field.
|
||||
|
||||
* #917 [fixed] - Attribute name should display with attribute value.
|
||||
|
||||
* #916 [fixed] - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'phone'.
|
||||
|
||||
* #897 [fixed] - Product get saved without image, if used image is large in size.It should throw an error message.
|
||||
|
||||
* #896 [fixed] - getVariantMinPrice does not look at special_price.
|
||||
|
||||
* #894 [fixed] - Storage link command is missing when installing framework through installer.
|
||||
|
||||
* #890 [fixed] - An error message should show if uploaded mage size is large, while saving the category.
|
||||
|
||||
* #1003 [fixed] - Getting exception if on editing any cart rule we select " Use Coupon" as Yes.
|
||||
|
||||
* #1001 [fixed] - Getting error while placing an order.
|
||||
|
||||
* #997 [fixed] - Change the validation for description.
|
||||
|
||||
* #995 [fixed] - [default] en field of labels section disappear after entering data in "Global Label" field.
|
||||
|
||||
* #994 [fixed] - Getting exception while creating cart rules.
|
||||
|
||||
* #993 [fixed] - Rule Name should be alphanumeric.
|
||||
|
||||
* #957 [fixed] - Typo in event fire.
|
||||
|
||||
* #949 [fixed] - Refresh order summary on every checkout step.
|
||||
|
||||
* #1075 [fixed] - Validation error message is not showing for Customer Group.
|
||||
|
||||
* #1069 [fixed] - Getting exception on editing the second customer.
|
||||
|
||||
* #1068 [fixed] - Product Inventory is "Zero" but in product page showing In Stock.
|
||||
|
||||
* #1065 [fixed] - On editing any cart rule if user need to add any new condition then he need to select value from Add Conditions again.
|
||||
|
||||
* #1061 [fixed] - Cart rule not working For Shipping code.
|
||||
|
||||
* #1060 [fixed] - If cart rule is not created for guest then also it is applicable for guest user.
|
||||
|
||||
* #1059 [fixed] - Cart Rule not working for Shipping state. Created a non coupon cart rule for Condition Shipping state but it doesn't get applied.
|
||||
|
||||
* #1053 [fixed] - Discount amount is not displaying in orders.
|
||||
|
||||
* #1052 [fixed] - Coupon is not applicable in case of payment methods.
|
||||
|
||||
* #1051 [fixed] - If cart rule is create for customer having group guest, then also general group customer is also able to use the same coupon.
|
||||
|
||||
* #1050 [fixed] - Coupon code discount amount is not displaying on checkout page.
|
||||
|
||||
* #1011 [fixed] - Channel, Add Condition and Global label field not showing validation error message if user save without entering any data in these fields.
|
||||
|
||||
* #1007 [fixed] - Applying zero discount amount in case of percentage.
|
||||
|
||||
* #1006 [fixed] - Not able to remove coupon if once applied.
|
||||
|
||||
* #1005 [fixed] - Cart rule not working correctly with coupon code.Fixed discount of amount 10 is created but after applying amount need to pay by customer is 10.
|
||||
|
||||
* #1131 [fixed] - If "does not contain" is used in case of Shipping city, then discount amount get implemented before selecting any address.
|
||||
|
||||
* #1127 [fixed] - Getting wrong grandtotal if in cart rule shipping is selected as free.
|
||||
|
||||
* #1113 [fixed] - Cart rule is not working for guest user.
|
||||
|
||||
* #1114 [fixed] - Unable to search cart rule by name.
|
||||
|
||||
* #1112 [fixed] - Provide an option to delete the note added for a customer.
|
||||
|
||||
* #1103 [fixed] - If entered coupon is incorrect then after clicking on Apply coupon button once the button should get disabled until the coupon code changes.
|
||||
|
||||
* #1102 [fixed] - If in condition percentage of product is selected , then also fixed amount discount is applied.
|
||||
|
||||
* #1097 [fixed] - Coupon get applied if only one product is added in cart and from action it is saved as buy atleast 2.
|
||||
|
||||
* #1096 [fixed] - If any discount is already applied on cart and customer uses his coupon to get discount then in this case coupon discount should be applied.
|
||||
|
||||
* #1095 [fixed] - If maximum quantity allowed to discount is selected as 2 then on both product discount should be applied.
|
||||
|
||||
* #1080 [fixed] - Customer should be logged out if admin blocked the user, and a message should display "Your account has been blocked by admin".
|
||||
|
||||
|
||||
## **v0.1.5(15th of March, 2019)** - *Release*
|
||||
|
||||
* [feature] - Category display mode.
|
||||
|
|
|
|||
63
README.md
63
README.md
|
|
@ -10,14 +10,15 @@
|
|||
<a href="#sponsors"><img src="https://opencollective.com/bagisto/sponsors/badge.svg" alt="Sponsors on Open Collective"></a>
|
||||
</p>
|
||||
|
||||
# Topics
|
||||
1. ### [Introduction](#1-introduction-)
|
||||
2. ### [Requirements](#2-requirements-)
|
||||
3. ### [Installation & Configuration](#3-installation--configuration-)
|
||||
4. ### [License](#4-license-)
|
||||
5. ### [Miscellaneous](#5-miscellaneous-)
|
||||
## Topics
|
||||
1. [Introduction](#introduction)
|
||||
2. [Documentation](#documentation)
|
||||
3. [Requirements](#requirements)
|
||||
4. [Installation & Configuration](#installation-and-configuration)
|
||||
5. [License](#license)
|
||||
6. [Miscellaneous](#miscellaneous)
|
||||
|
||||
### 1. Introduction <a name="#1-introduction-"></a>:
|
||||
### Introduction
|
||||
|
||||
[Bagisto](https://www.bagisto.com) is a hand tailored E-Commerce framework designed on some of the hottest opensource technologies
|
||||
such as [Laravel](https://laravel.com) a [PHP](https://secure.php.net/) framework, [Vue.js](https://vuejs.org)
|
||||
|
|
@ -26,6 +27,8 @@ a progressive Javascript framework.
|
|||
**Bagisto is viable attempt to cut down your time, cost and workforce for building online stores or migrating from physical stores
|
||||
to the ever demanding online world. Your business whether small or huge it suits all and very simple to set it up.**
|
||||
|
||||
**Read our documentation: [Bagisto Docs](https://devdocs.bagisto.com/)**
|
||||
|
||||
**We are also having a forum for any type of your concern, feature request discussions. Please visit: [Bagisto Forums](https://forums.bagisto.com/)**
|
||||
|
||||
# Visit our live [Demo](https://demo.bagisto.com)
|
||||
|
|
@ -44,16 +47,21 @@ It packs in lots of demanding features that allows your business to scale in no
|
|||
* Orders Management System.
|
||||
* Customer Cart, Wishlist, Product Reviews.
|
||||
* Simple and Configurable Products.
|
||||
* Price rules (Discount) inbuilt.
|
||||
* Check out [click here](https://bagisto.com/features/).
|
||||
|
||||
**For Developers**:
|
||||
Dev guys can take advantage of two of the hottest frameworks used in this project Laravel and Vue.js, both of these frameworks have been used in Bagisto.
|
||||
Bagisto is using power of both of these frameworks and making best out of it out of the box.
|
||||
|
||||
### 2. Requirements <a name="#requirements"></a>:
|
||||
### Documentation
|
||||
|
||||
* **OS**: Ubuntu 16.04 LTS or higher.
|
||||
* **SERVER**: Apache 2 or NGINX
|
||||
#### Bagisto Documentation [https://devdocs.bagisto.com](https://devdocs.bagisto.com)
|
||||
|
||||
### Requirements
|
||||
|
||||
* **OS**: Ubuntu 16.04 LTS or higher / Windows 7 or Higher (WAMP / XAMP).
|
||||
* **SERVER**: Apache 2 or NGINX.
|
||||
* **RAM**: 3 GB or higher.
|
||||
* **PHP**: 7.1.17 or higher.
|
||||
* **Processor**: Clock Cycle 1 Ghz or higher.
|
||||
|
|
@ -62,13 +70,13 @@ Bagisto is using power of both of these frameworks and making best out of it out
|
|||
* **Node**: 8.11.3 LTS or higher.
|
||||
* **Composer**: 1.6.5 or higher.
|
||||
|
||||
### 3. Installation & Configuration <a name="#configuration"></a>:
|
||||
### Installation and Configuration
|
||||
|
||||
**1. Try our new GUI installer to install Bagisto:**
|
||||
|
||||
##### a. Download zip from the link below:
|
||||
|
||||
[Download](https://github.com/bagisto/bagisto/archive/v0.1.5.zip)
|
||||
[Download](https://github.com/bagisto/bagisto/archive/v0.1.6.zip)
|
||||
|
||||
##### b. Extract the contents of zip and execute the project in browser:
|
||||
|
||||
|
|
@ -132,6 +140,11 @@ Although, mailer environment variables are also required to be set up as **Bagis
|
|||
|
||||
##### On server:
|
||||
|
||||
Warning: Before going full on production mode we recommend you to install developer dependencies.
|
||||
In order to do that, run the command below:
|
||||
|
||||
> composer install --no-dev
|
||||
|
||||
~~~
|
||||
Open the specified entry point in your hosts file in browser or make entry in hosts file if not done.
|
||||
~~~
|
||||
|
|
@ -159,36 +172,26 @@ password:admin123
|
|||
> *http(s)://example.com/customer/register*
|
||||
|
||||
|
||||
### 5. License <a name="#license"></a>:
|
||||
### License
|
||||
Bagisto is a truly opensource E-Commerce framework which will always be free under the [MIT License](https://github.com/bagisto/bagisto/blob/master/LICENSE).
|
||||
|
||||
|
||||
### 6. Miscellaneous <a name="#miscellaneous"></a>:
|
||||
### Miscellaneous
|
||||
|
||||
#### Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute.
|
||||
<a href="https://github.com/bagisto/bagisto/graphs/contributors"><img src="https://opencollective.com/bagisto/contributors.svg?width=890&button=false" /></a>
|
||||
This project is on [Open Collective](https://opencollective.com/bagisto) and it exists thanks to this people who contribute.
|
||||
|
||||
<a href="https://github.com/bagisto/bagisto/graphs/contributors"><img src="https://opencollective.com/bagisto/contributors.svg?width=890&button=false"/></a>
|
||||
|
||||
#### Backers
|
||||
|
||||
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/bagisto#backer)]
|
||||
|
||||
<a href="https://opencollective.com/bagisto#backers" target="_blank"><img src="https://opencollective.com/bagisto/backers.svg?width=890"></a>
|
||||
Thank you to all our backers! 🙏
|
||||
|
||||
<a href="https://opencollective.com/bagisto#contributors" target="_blank"><img src="https://opencollective.com/bagisto/backers.svg?width=890"></a>
|
||||
|
||||
#### Sponsors
|
||||
|
||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/bagisto#sponsor)]
|
||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.
|
||||
|
||||
<a href="https://opencollective.com/bagisto/sponsor/0/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/bagisto/sponsor/1/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/bagisto/sponsor/2/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/bagisto/sponsor/3/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/bagisto/sponsor/4/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/bagisto/sponsor/5/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/bagisto/sponsor/6/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/bagisto/sponsor/7/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/bagisto/sponsor/8/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/bagisto/sponsor/9/website" target="_blank"><img src="https://opencollective.com/bagisto/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/bagisto/contribute/sponsor-7372/checkout" target="_blank"><img src="https://images.opencollective.com/static/images/become_sponsor.svg"></a>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class BagistoVersion extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'bagisto:version';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Displays current version of Bagisto installed';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->comment('v' . config('app.version'));
|
||||
}
|
||||
}
|
||||
|
|
@ -23,8 +23,6 @@ class RouteServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,19 @@
|
|||
"type": "project",
|
||||
"require": {
|
||||
"php": "^7.1.3",
|
||||
"ext-curl": "*",
|
||||
"ext-intl": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-openssl": "*",
|
||||
"ext-pdo": "*",
|
||||
"ext-pdo_mysql": "*",
|
||||
"ext-tokenizer": "*",
|
||||
"barryvdh/laravel-dompdf": "^0.8.0@dev",
|
||||
"dimsav/laravel-translatable": "^9.0",
|
||||
"doctrine/dbal": "^2.9@dev",
|
||||
"fideloper/proxy": "^4.0",
|
||||
"flynsarmy/db-blade-compiler": "*",
|
||||
"guzzlehttp/guzzle": "~6.0",
|
||||
"intervention/image": "^2.4",
|
||||
"intervention/imagecache": "^2.3",
|
||||
"kalnoy/nestedset": "^4.3",
|
||||
|
|
@ -23,12 +31,13 @@
|
|||
"maatwebsite/excel": "3.1.x-dev",
|
||||
"nwidart/laravel-modules": "^3.2",
|
||||
"prettus/l5-repository": "^2.6",
|
||||
"propaganistas/laravel-intl": "^2.0"
|
||||
"tymon/jwt-auth": "dev-develop"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.1",
|
||||
"filp/whoops": "^2.0",
|
||||
"fzaninotto/faker": "^1.4",
|
||||
"laravel/dusk": "^4.0",
|
||||
"mockery/mockery": "^1.0",
|
||||
"nunomaduro/collision": "^2.0",
|
||||
"phpunit/phpunit": "^7.0"
|
||||
|
|
@ -49,7 +58,10 @@
|
|||
"bagisto/laravel-shipping": "v0.1.0",
|
||||
"bagisto/laravel-payment": "v0.1.0",
|
||||
"bagisto/laravel-sales": "v0.1.0",
|
||||
"bagisto/laravel-tax": "v0.1.0"
|
||||
"bagisto/laravel-tax": "v0.1.0",
|
||||
"bagisto/laravel-api": "v0.1.0",
|
||||
"bagisto/laravel-paypal": "v0.1.0",
|
||||
"bagisto/laravel-discount": "v0.1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
|
|
@ -76,7 +88,9 @@
|
|||
"Webkul\\Paypal\\": "packages/Webkul/Paypal/src",
|
||||
"Webkul\\Sales\\": "packages/Webkul/Sales/src",
|
||||
"Webkul\\Tax\\": "packages/Webkul/Tax/src",
|
||||
"Webkul\\API\\": "packages/Webkul/API"
|
||||
"Webkul\\API\\": "packages/Webkul/API",
|
||||
"Webkul\\Discount\\": "packages/Webkul/Discount/src",
|
||||
"Webkul\\CMS\\": "packages/Webkul/CMS/src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
|
|
@ -86,7 +100,9 @@
|
|||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
"dont-discover": [
|
||||
"barryvdh/laravel-debugbar"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -130,22 +130,16 @@ return [
|
|||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The service providers listed here will be automatically loaded on the
|
||||
| request to your application. Feel free to add your own services to
|
||||
| this array to grant expanded functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
/*
|
||||
Code Editor
|
||||
*/
|
||||
'editor' =>'vscode',
|
||||
|
||||
/*
|
||||
Application Version
|
||||
*/
|
||||
'version' => env('APP_VERSION', '0.1.6'),
|
||||
|
||||
/**
|
||||
* Blacklisting attributes while debugging
|
||||
*/
|
||||
|
|
@ -165,6 +159,17 @@ return [
|
|||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The service providers listed here will be automatically loaded on the
|
||||
| request to your application. Feel free to add your own services to
|
||||
| this array to grant expanded functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
|
||||
/*
|
||||
|
|
@ -198,7 +203,6 @@ return [
|
|||
*/
|
||||
|
||||
Dimsav\Translatable\TranslatableServiceProvider::class,
|
||||
Propaganistas\LaravelIntl\IntlServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
|
|
@ -240,6 +244,8 @@ return [
|
|||
Webkul\Sales\Providers\SalesServiceProvider::class,
|
||||
Webkul\Tax\Providers\TaxServiceProvider::class,
|
||||
Webkul\API\Providers\APIServiceProvider::class,
|
||||
Webkul\Discount\Providers\DiscountServiceProvider::class,
|
||||
Webkul\CMS\Providers\CMSServiceProvider::class
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
@ -296,5 +302,7 @@ return [
|
|||
'DbView' => Flynsarmy\DbBladeCompiler\Facades\DbView::class,
|
||||
'PDF' => Barryvdh\DomPDF\Facade::class,
|
||||
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
|
||||
'Concord' => Konekt\Concord\Facades\Concord::class,
|
||||
'Helper' => Konekt\Concord\Facades\Helper::class,
|
||||
],
|
||||
];
|
||||
|
|
@ -13,7 +13,7 @@ return [
|
|||
],
|
||||
|
||||
'api' => [
|
||||
'driver' => 'token',
|
||||
'driver' => 'jwt',
|
||||
'provider' => 'customers',
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -8,5 +8,16 @@ return [
|
|||
* VendorB\ModuleY\Providers\ModuleServiceProvider::class
|
||||
*
|
||||
*/
|
||||
|
||||
\Webkul\Attribute\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Category\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Checkout\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Core\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Customer\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Inventory\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Product\Providers\ModuleServiceProvider::class,\Webkul\Sales\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Tax\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\User\Providers\ModuleServiceProvider::class,\Webkul\Discount\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\CMS\Providers\ModuleServiceProvider::class
|
||||
]
|
||||
];
|
||||
];
|
||||
|
|
@ -9,13 +9,13 @@ return array(
|
|||
|
|
||||
| Enter the routes name to enable dynamic imagecache manipulation.
|
||||
| This handle will define the first part of the URI:
|
||||
|
|
||||
|
|
||||
| {route}/{template}/{filename}
|
||||
|
|
||||
|
|
||||
| Examples: "images", "img/cache"
|
||||
|
|
||||
*/
|
||||
|
||||
|
||||
'route' => 'cache',
|
||||
|
||||
/*
|
||||
|
|
@ -23,13 +23,13 @@ return array(
|
|||
| Storage paths
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following paths will be searched for the image filename, submited
|
||||
| by URI.
|
||||
|
|
||||
| The following paths will be searched for the image filename, submited
|
||||
| by URI.
|
||||
|
|
||||
| Define as many directories as you like.
|
||||
|
|
||||
*/
|
||||
|
||||
|
||||
'paths' => array(
|
||||
storage_path('app/public'),
|
||||
public_path('storage')
|
||||
|
|
@ -41,7 +41,7 @@ return array(
|
|||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify your own manipulation filter templates.
|
||||
| The keys of this array will define which templates
|
||||
| The keys of this array will define which templates
|
||||
| are available in the URI:
|
||||
|
|
||||
| {route}/{template}/{filename}
|
||||
|
|
@ -50,7 +50,7 @@ return array(
|
|||
| will be applied, by its fully qualified name.
|
||||
|
|
||||
*/
|
||||
|
||||
|
||||
'templates' => array(
|
||||
'small' => 'Webkul\Product\CacheFilters\Small',
|
||||
'medium' => 'Webkul\Product\CacheFilters\Medium',
|
||||
|
|
@ -65,7 +65,7 @@ return array(
|
|||
| Lifetime in minutes of the images handled by the imagecache route.
|
||||
|
|
||||
*/
|
||||
|
||||
|
||||
'lifetime' => 43200,
|
||||
|
||||
);
|
||||
);
|
||||
|
|
@ -0,0 +1,304 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of jwt-auth.
|
||||
*
|
||||
* (c) Sean Tymon <tymon148@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| JWT Authentication Secret
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Don't forget to set this in your .env file, as it will be used to sign
|
||||
| your tokens. A helper command is provided for this:
|
||||
| `php artisan jwt:secret`
|
||||
|
|
||||
| Note: This will be used for Symmetric algorithms only (HMAC),
|
||||
| since RSA and ECDSA use a private/public key combo (See below).
|
||||
|
|
||||
*/
|
||||
|
||||
'secret' => env('JWT_SECRET'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| JWT Authentication Keys
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The algorithm you are using, will determine whether your tokens are
|
||||
| signed with a random string (defined in `JWT_SECRET`) or using the
|
||||
| following public & private keys.
|
||||
|
|
||||
| Symmetric Algorithms:
|
||||
| HS256, HS384 & HS512 will use `JWT_SECRET`.
|
||||
|
|
||||
| Asymmetric Algorithms:
|
||||
| RS256, RS384 & RS512 / ES256, ES384 & ES512 will use the keys below.
|
||||
|
|
||||
*/
|
||||
|
||||
'keys' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Public Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| A path or resource to your public key.
|
||||
|
|
||||
| E.g. 'file://path/to/public/key'
|
||||
|
|
||||
*/
|
||||
|
||||
'public' => env('JWT_PUBLIC_KEY'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Private Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| A path or resource to your private key.
|
||||
|
|
||||
| E.g. 'file://path/to/private/key'
|
||||
|
|
||||
*/
|
||||
|
||||
'private' => env('JWT_PRIVATE_KEY'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Passphrase
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The passphrase for your private key. Can be null if none set.
|
||||
|
|
||||
*/
|
||||
|
||||
'passphrase' => env('JWT_PASSPHRASE'),
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| JWT time to live
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the length of time (in minutes) that the token will be valid for.
|
||||
| Defaults to 1 hour.
|
||||
|
|
||||
| You can also set this to null, to yield a never expiring token.
|
||||
| Some people may want this behaviour for e.g. a mobile app.
|
||||
| This is not particularly recommended, so make sure you have appropriate
|
||||
| systems in place to revoke the token if necessary.
|
||||
| Notice: If you set this to null you should remove 'exp' element from 'required_claims' list.
|
||||
|
|
||||
*/
|
||||
|
||||
'ttl' => env('JWT_TTL', 60),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Refresh time to live
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the length of time (in minutes) that the token can be refreshed
|
||||
| within. I.E. The user can refresh their token within a 2 week window of
|
||||
| the original token being created until they must re-authenticate.
|
||||
| Defaults to 2 weeks.
|
||||
|
|
||||
| You can also set this to null, to yield an infinite refresh time.
|
||||
| Some may want this instead of never expiring tokens for e.g. a mobile app.
|
||||
| This is not particularly recommended, so make sure you have appropriate
|
||||
| systems in place to revoke the token if necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'refresh_ttl' => env('JWT_REFRESH_TTL', 20160),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| JWT hashing algorithm
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the hashing algorithm that will be used to sign the token.
|
||||
|
|
||||
| See here: https://github.com/namshi/jose/tree/master/src/Namshi/JOSE/Signer/OpenSSL
|
||||
| for possible values.
|
||||
|
|
||||
*/
|
||||
|
||||
'algo' => env('JWT_ALGO', 'HS256'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Required Claims
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the required claims that must exist in any token.
|
||||
| A TokenInvalidException will be thrown if any of these claims are not
|
||||
| present in the payload.
|
||||
|
|
||||
*/
|
||||
|
||||
'required_claims' => [
|
||||
'iss',
|
||||
'iat',
|
||||
'exp',
|
||||
'nbf',
|
||||
'sub',
|
||||
'jti',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Persistent Claims
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the claim keys to be persisted when refreshing a token.
|
||||
| `sub` and `iat` will automatically be persisted, in
|
||||
| addition to the these claims.
|
||||
|
|
||||
| Note: If a claim does not exist then it will be ignored.
|
||||
|
|
||||
*/
|
||||
|
||||
'persistent_claims' => [
|
||||
// 'foo',
|
||||
// 'bar',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Lock Subject
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This will determine whether a `prv` claim is automatically added to
|
||||
| the token. The purpose of this is to ensure that if you have multiple
|
||||
| authentication models e.g. `App\User` & `App\OtherPerson`, then we
|
||||
| should prevent one authentication request from impersonating another,
|
||||
| if 2 tokens happen to have the same id across the 2 different models.
|
||||
|
|
||||
| Under specific circumstances, you may want to disable this behaviour
|
||||
| e.g. if you only have one authentication model, then you would save
|
||||
| a little on token size.
|
||||
|
|
||||
*/
|
||||
|
||||
'lock_subject' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Leeway
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This property gives the jwt timestamp claims some "leeway".
|
||||
| Meaning that if you have any unavoidable slight clock skew on
|
||||
| any of your servers then this will afford you some level of cushioning.
|
||||
|
|
||||
| This applies to the claims `iat`, `nbf` and `exp`.
|
||||
|
|
||||
| Specify in seconds - only if you know you need it.
|
||||
|
|
||||
*/
|
||||
|
||||
'leeway' => env('JWT_LEEWAY', 0),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Blacklist Enabled
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| In order to invalidate tokens, you must have the blacklist enabled.
|
||||
| If you do not want or need this functionality, then set this to false.
|
||||
|
|
||||
*/
|
||||
|
||||
'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Blacklist Grace Period
|
||||
| -------------------------------------------------------------------------
|
||||
|
|
||||
| When multiple concurrent requests are made with the same JWT,
|
||||
| it is possible that some of them fail, due to token regeneration
|
||||
| on every request.
|
||||
|
|
||||
| Set grace period in seconds to prevent parallel request failure.
|
||||
|
|
||||
*/
|
||||
|
||||
'blacklist_grace_period' => env('JWT_BLACKLIST_GRACE_PERIOD', 0),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cookies encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default Laravel encrypt cookies for security reason.
|
||||
| If you decide to not decrypt cookies, you will have to configure Laravel
|
||||
| to not encrypt your cookie token by adding its name into the $except
|
||||
| array available in the middleware "EncryptCookies" provided by Laravel.
|
||||
| see https://laravel.com/docs/master/responses#cookies-and-encryption
|
||||
| for details.
|
||||
|
|
||||
| Set it to true if you want to decrypt cookies.
|
||||
|
|
||||
*/
|
||||
|
||||
'decrypt_cookies' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the various providers used throughout the package.
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| JWT Provider
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the provider that is used to create and decode the tokens.
|
||||
|
|
||||
*/
|
||||
|
||||
'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Provider
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the provider that is used to authenticate users.
|
||||
|
|
||||
*/
|
||||
|
||||
'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Storage Provider
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the provider that is used to store tokens in the blacklist.
|
||||
|
|
||||
*/
|
||||
|
||||
'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class,
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
|
|
@ -56,8 +56,8 @@ return [
|
|||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
'address' => env('SHOP_MAIL_FROM'),
|
||||
'name' => env('MAIL_FROM_NAME')
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
];
|
||||
|
||||
?>
|
||||
];
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
];
|
||||
|
|
@ -29,10 +29,18 @@ return [
|
|||
'secret' => env('SPARKPOST_SECRET'),
|
||||
],
|
||||
|
||||
'exchange-api' => [
|
||||
'default' => 'fixer',
|
||||
'fixer' => [
|
||||
'paid_account' => false,
|
||||
'key' => env('fixer_api_key'),
|
||||
'class' => 'Webkul\Core\Helpers\Exchange\FixerExchange'
|
||||
]
|
||||
],
|
||||
|
||||
'stripe' => [
|
||||
'model' => App\User::class,
|
||||
'key' => env('STRIPE_KEY'),
|
||||
'secret' => env('STRIPE_SECRET'),
|
||||
],
|
||||
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||
'lifetime' => env('SESSION_LIFETIME', 30),
|
||||
|
||||
'expire_on_close' => false,
|
||||
'expire_on_close' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ return [
|
|||
| $useTranslationFallback when defined
|
||||
|
|
||||
*/
|
||||
'use_fallback' => true,
|
||||
'use_fallback' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -20,4 +20,4 @@ $factory->define(App\User::class, function (Faker $faker) {
|
|||
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
|
||||
'remember_token' => str_random(10),
|
||||
];
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Controllers\Shop;
|
||||
|
||||
use Webkul\Customer\Repositories\CustomerAddressRepository;
|
||||
use Webkul\API\Http\Resources\Customer\CustomerAddress as CustomerAddressResource;
|
||||
|
||||
/**
|
||||
* Address controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class AddressController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains current guard
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guard;
|
||||
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* CustomerAddressRepository object
|
||||
*
|
||||
* @var Object
|
||||
*/
|
||||
protected $customerAddressRepository;
|
||||
|
||||
/**
|
||||
* Controller instance
|
||||
*
|
||||
* @param Webkul\Customer\Repositories\CustomerAddressRepository $customerAddressRepository
|
||||
*/
|
||||
public function __construct(
|
||||
CustomerAddressRepository $customerAddressRepository
|
||||
)
|
||||
{
|
||||
$this->guard = request()->has('token') ? 'api' : 'customer';
|
||||
|
||||
auth()->setDefaultDriver($this->guard);
|
||||
|
||||
$this->middleware('auth:' . $this->guard);
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->customerAddressRepository = $customerAddressRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
$customer = auth($this->guard)->user();
|
||||
|
||||
request()->merge([
|
||||
'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))),
|
||||
'customer_id' => $customer->id
|
||||
]);
|
||||
|
||||
$this->validate(request(), [
|
||||
'address1' => 'string|required',
|
||||
'country' => 'string|required',
|
||||
'state' => 'string|required',
|
||||
'city' => 'string|required',
|
||||
'postcode' => 'required',
|
||||
'phone' => 'required'
|
||||
]);
|
||||
|
||||
$customerAddress = $this->customerAddressRepository->create(request()->all());
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Your address has been created successfully.',
|
||||
'data' => new CustomerAddressResource($customerAddress)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$customer = auth($this->guard)->user();
|
||||
|
||||
request()->merge(['address1' => implode(PHP_EOL, array_filter(request()->input('address1')))]);
|
||||
|
||||
$this->validate(request(), [
|
||||
'address1' => 'string|required',
|
||||
'country' => 'string|required',
|
||||
'state' => 'string|required',
|
||||
'city' => 'string|required',
|
||||
'postcode' => 'required',
|
||||
'phone' => 'required'
|
||||
]);
|
||||
|
||||
$this->customerAddressRepository->update(request()->all(), request()->input('id'));
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Your address has been updated successfully.',
|
||||
'data' => new CustomerAddressResource($this->customerAddressRepository->find(request()->input('id')))
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,215 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Checkout\Repositories\CartRepository;
|
||||
use Webkul\Checkout\Repositories\CartItemRepository;
|
||||
use Webkul\API\Http\Resources\Checkout\Cart as CartResource;
|
||||
use Cart;
|
||||
|
||||
/**
|
||||
* Cart controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CartController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains current guard
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guard;
|
||||
|
||||
/**
|
||||
* CartRepository object
|
||||
*
|
||||
* @var Object
|
||||
*/
|
||||
protected $cartRepository;
|
||||
|
||||
/**
|
||||
* CartItemRepository object
|
||||
*
|
||||
* @var Object
|
||||
*/
|
||||
protected $cartItemRepository;
|
||||
|
||||
/**
|
||||
* Controller instance
|
||||
*
|
||||
* @param Webkul\Checkout\Repositories\CartRepository $cartRepository
|
||||
* @param Webkul\Checkout\Repositories\CartItemRepository $cartItemRepository
|
||||
*/
|
||||
public function __construct(
|
||||
CartRepository $cartRepository,
|
||||
CartItemRepository $cartItemRepository
|
||||
)
|
||||
{
|
||||
$this->guard = request()->has('token') ? 'api' : 'customer';
|
||||
|
||||
auth()->setDefaultDriver($this->guard);
|
||||
|
||||
// $this->middleware('auth:' . $this->guard);
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->cartRepository = $cartRepository;
|
||||
|
||||
$this->cartItemRepository = $cartItemRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get customer cart
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
$customer = auth($this->guard)->user();
|
||||
|
||||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'data' => $cart ? new CartResource($cart) : null
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store($id)
|
||||
{
|
||||
Event::fire('checkout.cart.item.add.before', $id);
|
||||
|
||||
$result = Cart::add($id, request()->except('_token'));
|
||||
|
||||
if (! $result) {
|
||||
$message = session()->get('warning') ?? session()->get('error');
|
||||
return response()->json([
|
||||
'error' => session()->get('warning')
|
||||
], 400);
|
||||
}
|
||||
|
||||
Event::fire('checkout.cart.item.add.after', $result);
|
||||
|
||||
Cart::collectTotals();
|
||||
|
||||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Product added to cart successfully.',
|
||||
'data' => $cart ? new CartResource($cart) : null
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
foreach (request()->get('qty') as$qty) {
|
||||
if ($qty <= 0) {
|
||||
return response()->json([
|
||||
'message' => trans('shop::app.checkout.cart.quantity.illegal')
|
||||
], 401);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (request()->get('qty') as $itemId => $qty) {
|
||||
$item = $this->cartItemRepository->findOneByField('id', $itemId);
|
||||
|
||||
Event::fire('checkout.cart.item.update.before', $itemId);
|
||||
|
||||
Cart::updateItem($item->product_id, ['quantity' => $qty], $itemId);
|
||||
|
||||
Event::fire('checkout.cart.item.update.after', $item);
|
||||
}
|
||||
|
||||
Cart::collectTotals();
|
||||
|
||||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Cart updated successfully.',
|
||||
'data' => $cart ? new CartResource($cart) : null
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy()
|
||||
{
|
||||
Event::fire('checkout.cart.delete.before');
|
||||
|
||||
Cart::deActivateCart();
|
||||
|
||||
Event::fire('checkout.cart.delete.after');
|
||||
|
||||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Cart removed successfully.',
|
||||
'data' => $cart ? new CartResource($cart) : null
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroyItem($id)
|
||||
{
|
||||
Event::fire('checkout.cart.item.delete.before', $id);
|
||||
|
||||
Cart::removeItem($id);
|
||||
|
||||
Event::fire('checkout.cart.item.delete.after', $id);
|
||||
|
||||
Cart::collectTotals();
|
||||
|
||||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Cart removed successfully.',
|
||||
'data' => $cart ? new CartResource($cart) : null
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to move a already added product to wishlist
|
||||
* will run only on customer authentication.
|
||||
*
|
||||
* @param instance cartItem $id
|
||||
*/
|
||||
public function moveToWishlist($id)
|
||||
{
|
||||
Event::fire('checkout.cart.item.move-to-wishlist.before', $id);
|
||||
|
||||
Cart::moveToWishlist($id);
|
||||
|
||||
Event::fire('checkout.cart.item.move-to-wishlist.after', $id);
|
||||
|
||||
Cart::collectTotals();
|
||||
|
||||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Cart item moved to wishlist successfully.',
|
||||
'data' => $cart ? new CartResource($cart) : null
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
namespace Webkul\API\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\Category\Repositories\CategoryRepository;
|
||||
use Webkul\API\Http\Resources\Catalog\Category as CategoryResource;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Checkout\Repositories\CartRepository;
|
||||
use Webkul\Checkout\Repositories\CartItemRepository;
|
||||
use Webkul\Shipping\Facades\Shipping;
|
||||
use Webkul\Payment\Facades\Payment;
|
||||
use Webkul\API\Http\Resources\Checkout\Cart as CartResource;
|
||||
use Webkul\API\Http\Resources\Checkout\CartShippingRate as CartShippingRateResource;
|
||||
use Webkul\API\Http\Resources\Sales\Order as OrderResource;
|
||||
use Webkul\Checkout\Http\Requests\CustomerAddressForm;
|
||||
use Webkul\Sales\Repositories\OrderRepository;
|
||||
use Cart;
|
||||
|
||||
/**
|
||||
* Checkout controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CheckoutController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains current guard
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guard;
|
||||
|
||||
/**
|
||||
* CartRepository object
|
||||
*
|
||||
* @var Object
|
||||
*/
|
||||
protected $cartRepository;
|
||||
|
||||
/**
|
||||
* CartItemRepository object
|
||||
*
|
||||
* @var Object
|
||||
*/
|
||||
protected $cartItemRepository;
|
||||
|
||||
/**
|
||||
* Controller instance
|
||||
*
|
||||
* @param Webkul\Checkout\Repositories\CartRepository $cartRepository
|
||||
* @param Webkul\Checkout\Repositories\CartItemRepository $cartItemRepository
|
||||
* @param Webkul\Sales\Repositories\OrderRepository $orderRepository
|
||||
*/
|
||||
public function __construct(
|
||||
CartRepository $cartRepository,
|
||||
CartItemRepository $cartItemRepository,
|
||||
OrderRepository $orderRepository
|
||||
)
|
||||
{
|
||||
$this->guard = request()->has('token') ? 'api' : 'customer';
|
||||
|
||||
auth()->setDefaultDriver($this->guard);
|
||||
|
||||
|
||||
// $this->middleware('auth:' . $this->guard);
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->cartRepository = $cartRepository;
|
||||
|
||||
$this->cartItemRepository = $cartItemRepository;
|
||||
|
||||
$this->orderRepository = $orderRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves customer address.
|
||||
*
|
||||
* @param \Webkul\Checkout\Http\Requests\CustomerAddressForm $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function saveAddress(CustomerAddressForm $request)
|
||||
{
|
||||
$data = request()->all();
|
||||
|
||||
$data['billing']['address1'] = implode(PHP_EOL, array_filter($data['billing']['address1']));
|
||||
$data['shipping']['address1'] = implode(PHP_EOL, array_filter($data['shipping']['address1']));
|
||||
|
||||
if (isset($data['billing']['id']) && str_contains($data['billing']['id'], 'address_')) {
|
||||
unset($data['billing']['id']);
|
||||
unset($data['billing']['address_id']);
|
||||
}
|
||||
|
||||
if (isset($data['shipping']['id']) && str_contains($data['shipping']['id'], 'address_')) {
|
||||
unset($data['shipping']['id']);
|
||||
unset($data['shipping']['address_id']);
|
||||
}
|
||||
|
||||
|
||||
if (Cart::hasError() || ! Cart::saveCustomerAddress($data) || ! Shipping::collectRates())
|
||||
abort(400);
|
||||
|
||||
$rates = [];
|
||||
|
||||
foreach (Shipping::getGroupedAllShippingRates() as $code => $shippingMethod) {
|
||||
$rates[] = [
|
||||
'carrier_title' => $shippingMethod['carrier_title'],
|
||||
'rates' => CartShippingRateResource::collection(collect($shippingMethod['rates']))
|
||||
];
|
||||
}
|
||||
|
||||
Cart::collectTotals();
|
||||
|
||||
return response()->json([
|
||||
'data' => [
|
||||
'rates' => $rates,
|
||||
'cart' => new CartResource(Cart::getCart())
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves shipping method.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function saveShipping()
|
||||
{
|
||||
$shippingMethod = request()->get('shipping_method');
|
||||
|
||||
if (Cart::hasError() || !$shippingMethod || ! Cart::saveShippingMethod($shippingMethod))
|
||||
abort(400);
|
||||
|
||||
Cart::collectTotals();
|
||||
|
||||
return response()->json([
|
||||
'data' => [
|
||||
'methods' => Payment::getPaymentMethods(),
|
||||
'cart' => new CartResource(Cart::getCart())
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves payment method.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function savePayment()
|
||||
{
|
||||
$payment = request()->get('payment');
|
||||
|
||||
if (Cart::hasError() || ! $payment || ! Cart::savePaymentMethod($payment))
|
||||
abort(400);
|
||||
|
||||
return response()->json([
|
||||
'data' => [
|
||||
'cart' => new CartResource(Cart::getCart())
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves order.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function saveOrder()
|
||||
{
|
||||
if (Cart::hasError())
|
||||
abort(400);
|
||||
|
||||
Cart::collectTotals();
|
||||
|
||||
$this->validateOrder();
|
||||
|
||||
$cart = Cart::getCart();
|
||||
|
||||
if ($redirectUrl = Payment::getRedirectUrl($cart)) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'redirect_url' => $redirectUrl
|
||||
]);
|
||||
}
|
||||
|
||||
$order = $this->orderRepository->create(Cart::prepareDataForOrder());
|
||||
|
||||
Cart::deActivateCart();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'order' => new OrderResource($order),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate order before creation
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function validateOrder()
|
||||
{
|
||||
$cart = Cart::getCart();
|
||||
|
||||
if (! $cart->shipping_address) {
|
||||
throw new \Exception(trans('Please check shipping address.'));
|
||||
}
|
||||
|
||||
if (! $cart->billing_address) {
|
||||
throw new \Exception(trans('Please check billing address.'));
|
||||
}
|
||||
|
||||
if (! $cart->selected_shipping_rate) {
|
||||
throw new \Exception(trans('Please specify shipping method.'));
|
||||
}
|
||||
|
||||
if (! $cart->payment) {
|
||||
throw new \Exception(trans('Please specify payment method.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
namespace Webkul\API\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
/**
|
||||
* Core controller
|
||||
|
|
@ -13,6 +12,36 @@ use Illuminate\Http\Response;
|
|||
*/
|
||||
class CoreController extends Controller
|
||||
{
|
||||
/**
|
||||
* Returns a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
$configValues = [];
|
||||
|
||||
foreach (explode(',', request()->input('_config')) as $config) {
|
||||
$configValues[$config] = core()->getConfigData($config);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'data' => $configValues
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getCountryStateGroup()
|
||||
{
|
||||
return response()->json([
|
||||
'data' => core()->groupedStatesByCountries()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a listing of the resource.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
|
||||
/**
|
||||
* Customer controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CustomerController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* Repository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $customerRepository;
|
||||
|
||||
/**
|
||||
* @param CustomerRepository object $customer
|
||||
*/
|
||||
public function __construct(CustomerRepository $customerRepository)
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->customerRepository = $customerRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to store user's sign up form data to DB.
|
||||
*
|
||||
* @return Mixed
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
request()->validate([
|
||||
'first_name' => 'required',
|
||||
'last_name' => 'required',
|
||||
'email' => 'email|required|unique:customers,email',
|
||||
'password' => 'confirmed|min:6|required'
|
||||
]);
|
||||
|
||||
$data = request()->input();
|
||||
|
||||
$data = array_merge($data, [
|
||||
'password' => bcrypt($data['password']),
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'is_verified' => 1,
|
||||
'customer_group_id' => 1
|
||||
]);
|
||||
|
||||
Event::fire('customer.registration.before');
|
||||
|
||||
$customer = $this->customerRepository->create($data);
|
||||
|
||||
Event::fire('customer.registration.after', $customer);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Your account has been created successfully.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
|
||||
/**
|
||||
* Forgot Password controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
use SendsPasswordResetEmails;
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'email' => 'required|email'
|
||||
]);
|
||||
|
||||
$response = $this->broker()->sendResetLink(request(['email']));
|
||||
|
||||
if ($response == Password::RESET_LINK_SENT) {
|
||||
return response()->json([
|
||||
'message' => trans($response)
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'error' => trans($response)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the broker to be used during password reset.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Auth\PasswordBroker
|
||||
*/
|
||||
public function broker()
|
||||
{
|
||||
return Password::broker('customers');
|
||||
}
|
||||
}
|
||||
|
|
@ -30,8 +30,6 @@ class ProductController extends Controller
|
|||
*/
|
||||
public function __construct(ProductRepository $productRepository)
|
||||
{
|
||||
// $this->middleware('auth:api');
|
||||
|
||||
$this->productRepository = $productRepository;
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +40,7 @@ class ProductController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
return ProductResource::collection($this->productRepository->getAll());
|
||||
return ProductResource::collection($this->productRepository->getAll(request()->input('category_id')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -56,4 +54,28 @@ class ProductController extends Controller
|
|||
$this->productRepository->findOrFail($id)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns product's additional information.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function additionalInformation($id)
|
||||
{
|
||||
return response()->json([
|
||||
'data' => app('Webkul\Product\Helpers\View')->getAdditionalData($this->productRepository->findOrFail($id))
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns product's additional information.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function configurableConfig($id)
|
||||
{
|
||||
return response()->json([
|
||||
'data' => app('Webkul\Product\Helpers\ConfigurableOption')->getConfigurationConfig($this->productRepository->findOrFail($id))
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace Webkul\API\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
/**
|
||||
* Resource Controller
|
||||
|
|
@ -13,6 +12,13 @@ use Illuminate\Http\Response;
|
|||
*/
|
||||
class ResourceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains current guard
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guard;
|
||||
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
|
|
@ -34,10 +40,17 @@ class ResourceController extends Controller
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// $this->middleware('auth:api');
|
||||
$this->guard = request()->has('token') ? 'api' : 'customer';
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
||||
if (isset($this->_config['authorization_required']) && $this->_config['authorization_required']) {
|
||||
|
||||
auth()->setDefaultDriver($this->guard);
|
||||
|
||||
$this->middleware('auth:' . $this->guard);
|
||||
}
|
||||
|
||||
$this->repository = app($this->_config['repository']);
|
||||
}
|
||||
|
||||
|
|
@ -49,12 +62,14 @@ class ResourceController extends Controller
|
|||
public function index()
|
||||
{
|
||||
$query = $this->repository->scopeQuery(function($query) {
|
||||
foreach (request()->except(['page', 'limit', 'pagination', 'sort', 'order']) as $input => $value) {
|
||||
$query = $query->where($input, $value);
|
||||
foreach (request()->except(['page', 'limit', 'pagination', 'sort', 'order', 'token']) as $input => $value) {
|
||||
$query = $query->whereIn($input, array_map('trim', explode(',', $value)));
|
||||
}
|
||||
|
||||
if ($sort = request()->input('sort')) {
|
||||
$query = $query->orderBy($sort, request()->input('order') ?? 'desc');
|
||||
} else {
|
||||
$query = $query->orderBy('id', 'desc');
|
||||
}
|
||||
|
||||
return $query;
|
||||
|
|
@ -80,4 +95,20 @@ class ResourceController extends Controller
|
|||
$this->repository->findOrFail($id)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete's a individual resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$wishlistProduct = $this->repository->findOrFail($id);
|
||||
|
||||
$this->repository->delete($id);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Item removed successfully.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Webkul\Product\Repositories\ProductReviewRepository;
|
||||
use Webkul\API\Http\Resources\Catalog\ProductReview as ProductReviewResource;
|
||||
|
||||
/**
|
||||
* Review controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class ReviewController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains current guard
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guard;
|
||||
|
||||
/**
|
||||
* ProductReviewRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $reviewRepository;
|
||||
|
||||
/**
|
||||
* Controller instance
|
||||
*
|
||||
* @param Webkul\Product\Repositories\ProductReviewRepository $reviewRepository
|
||||
*/
|
||||
public function __construct(ProductReviewRepository $reviewRepository)
|
||||
{
|
||||
$this->guard = request()->has('token') ? 'api' : 'customer';
|
||||
|
||||
auth()->setDefaultDriver($this->guard);
|
||||
|
||||
$this->reviewRepository = $reviewRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request, $id)
|
||||
{
|
||||
$customer = auth($this->guard)->user();
|
||||
|
||||
$this->validate(request(), [
|
||||
'comment' => 'required',
|
||||
'rating' => 'required|numeric|min:1|max:5',
|
||||
'title' => 'required',
|
||||
]);
|
||||
|
||||
$data = array_merge(request()->all(), [
|
||||
'customer_id' => $customer ? $customer->id : null,
|
||||
'name' => $customer ? $customer->name : request()->input('name'),
|
||||
'status' => 'pending',
|
||||
'product_id' => $id
|
||||
]);
|
||||
|
||||
$productReview = $this->reviewRepository->create($data);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Your review submitted successfully.',
|
||||
'data' => new ProductReviewResource($this->reviewRepository->find($productReview->id))
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
use Webkul\API\Http\Resources\Customer\Customer as CustomerResource;
|
||||
|
||||
/**
|
||||
* Session controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class SessionController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains current guard
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guard;
|
||||
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* Controller instance
|
||||
*
|
||||
* @param Webkul\Customer\Repositories\CustomerRepository $customerRepository
|
||||
*/
|
||||
public function __construct(CustomerRepository $customerRepository)
|
||||
{
|
||||
$this->guard = request()->has('token') ? 'api' : 'customer';
|
||||
|
||||
auth()->setDefaultDriver($this->guard);
|
||||
|
||||
$this->middleware('auth:' . $this->guard, ['only' => ['get', 'update', 'destroy']]);
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->customerRepository = $customerRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to store user's sign up form data to DB.
|
||||
*
|
||||
* @return Mixed
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
request()->validate([
|
||||
'email' => 'required|email',
|
||||
'password' => 'required'
|
||||
]);
|
||||
|
||||
$jwtToken = null;
|
||||
|
||||
if (! $jwtToken = auth()->guard($this->guard)->attempt(request()->only('email', 'password'))) {
|
||||
return response()->json([
|
||||
'error' => 'Invalid Email or Password',
|
||||
], 401);
|
||||
}
|
||||
|
||||
Event::fire('customer.after.login', request()->input('email'));
|
||||
|
||||
$customer = auth($this->guard)->user();
|
||||
|
||||
return response()->json([
|
||||
'token' => $jwtToken,
|
||||
'message' => 'Logged in successfully.',
|
||||
'data' => new CustomerResource($customer)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get details for current logged in customer
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
$customer = auth($this->guard)->user();
|
||||
|
||||
return response()->json([
|
||||
'data' => new CustomerResource($customer)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$customer = auth($this->guard)->user();
|
||||
|
||||
$this->validate(request(), [
|
||||
'first_name' => 'required',
|
||||
'last_name' => 'required',
|
||||
'gender' => 'required',
|
||||
'date_of_birth' => 'nullable|date|before:today',
|
||||
'email' => 'email|unique:customers,email,' . $customer->id,
|
||||
'password' => 'confirmed|min:6'
|
||||
]);
|
||||
|
||||
$data = request()->all();
|
||||
|
||||
if (! $data['date_of_birth']) {
|
||||
unset($data['date_of_birth']);
|
||||
}
|
||||
|
||||
if (!isset($data['password']) || ! $data['password']) {
|
||||
unset($data['password']);
|
||||
} else {
|
||||
$data['password'] = bcrypt($data['password']);
|
||||
}
|
||||
|
||||
$this->customerRepository->update($data, $customer->id);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Your account has been created successfully.',
|
||||
'data' => new CustomerResource($this->customerRepository->find($customer->id))
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy()
|
||||
{
|
||||
auth()->guard($this->guard)->logout();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Logged out successfully.',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Customer\Repositories\WishlistRepository;
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\API\Http\Resources\Customer\Wishlist as WishlistResource;
|
||||
use Cart;
|
||||
|
||||
/**
|
||||
* Wishlist controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class WishlistController extends Controller
|
||||
{
|
||||
/**
|
||||
* WishlistRepository object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $wishlistRepository;
|
||||
|
||||
/**
|
||||
* ProductRepository object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $productRepository;
|
||||
|
||||
/**
|
||||
* @param Webkul\Customer\Repositories\WishlistRepository $wishlistRepository
|
||||
* @param Webkul\Product\Repositories\ProductRepository $productRepository
|
||||
*/
|
||||
public function __construct(
|
||||
WishlistRepository $wishlistRepository,
|
||||
ProductRepository $productRepository
|
||||
)
|
||||
{
|
||||
$this->guard = request()->has('token') ? 'api' : 'customer';
|
||||
|
||||
auth()->setDefaultDriver($this->guard);
|
||||
|
||||
$this->middleware('auth:' . $this->guard);
|
||||
|
||||
$this->wishlistRepository = $wishlistRepository;
|
||||
|
||||
$this->productRepository = $productRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to add item to the wishlist.
|
||||
*
|
||||
* @param integer $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create($id)
|
||||
{
|
||||
$product = $this->productRepository->findOrFail($id);
|
||||
|
||||
$customer = auth()->guard($this->guard)->user();
|
||||
|
||||
$wishlistItem = $this->wishlistRepository->findOneWhere([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $id,
|
||||
'customer_id' => $customer->id
|
||||
]);
|
||||
|
||||
if (! $wishlistItem) {
|
||||
$wishlistItem = $this->wishlistRepository->create([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $id,
|
||||
'customer_id' => $customer->id
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'data' => new WishlistResource($wishlistItem),
|
||||
'message' => trans('customer::app.wishlist.success')
|
||||
]);
|
||||
} else {
|
||||
$this->wishlistRepository->delete($wishlistItem->id);
|
||||
|
||||
return response()->json([
|
||||
'data' => null,
|
||||
'message' => 'Item removed from wishlist successfully.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move product from wishlist to cart.
|
||||
*
|
||||
* @param integer $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function moveToCart($id)
|
||||
{
|
||||
$wishlistItem = $this->wishlistRepository->findOrFail($id);
|
||||
|
||||
if ($wishlistItem->customer_id != auth()->guard($this->guard)->user()->id)
|
||||
return response()->json([
|
||||
'message' => trans('shop::app.security-warning')
|
||||
], 400);
|
||||
|
||||
$result = Cart::moveToCart($wishlistItem);
|
||||
|
||||
if ($result == 1) {
|
||||
if ($wishlistItem->delete()) {
|
||||
Cart::collectTotals();
|
||||
|
||||
return response()->json([
|
||||
'data' => 1,
|
||||
'message' => trans('shop::app.wishlist.moved')
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'data' => 1,
|
||||
'error' => trans('shop::app.wishlist.move-error')
|
||||
], 400);
|
||||
}
|
||||
} else if ($result == 0) {
|
||||
return response()->json([
|
||||
'data' => 0,
|
||||
'error' => trans('shop::app.wishlist.error')
|
||||
], 400);
|
||||
} else if ($result == -1) {
|
||||
return response()->json([
|
||||
'data' => -1,
|
||||
'error' => trans('shop::app.checkout.cart.add-config-warning')
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ class Attribute extends JsonResource
|
|||
return [
|
||||
'id' => $this->id,
|
||||
'code' => $this->code,
|
||||
'type' => $this->type,
|
||||
'name' => $this->name,
|
||||
'swatch_type' => $this->swatch_type,
|
||||
'options' => AttributeOption::collection($this->options),
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class Category extends JsonResource
|
|||
'code' => $this->code,
|
||||
'name' => $this->name,
|
||||
'slug' => $this->slug,
|
||||
'display_mode' => $this->display_mode,
|
||||
'description' => $this->description,
|
||||
'meta_title' => $this->meta_title,
|
||||
'meta_description' => $this->meta_description,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ class Product extends JsonResource
|
|||
|
||||
$this->productImageHelper = app('Webkul\Product\Helpers\ProductImage');
|
||||
|
||||
$this->productReviewHelper = app('Webkul\Product\Helpers\Review');
|
||||
|
||||
parent::__construct($resource);
|
||||
}
|
||||
|
||||
|
|
@ -34,14 +36,16 @@ class Product extends JsonResource
|
|||
'id' => $product->id,
|
||||
'type' => $product->type,
|
||||
'name' => $this->name,
|
||||
'price' => $this->price,
|
||||
'formated_price' => core()->currency($this->price),
|
||||
'url_key' => $this->url_key,
|
||||
'price' => $product->type == 'configurable' ? $this->productPriceHelper->getVariantMinPrice($product) : $this->price,
|
||||
'formated_price' => $product->type == 'configurable' ? core()->currency($this->productPriceHelper->getVariantMinPrice($product)) : core()->currency($this->price),
|
||||
'short_description' => $this->short_description,
|
||||
'description' => $this->description,
|
||||
'sku' => $this->sku,
|
||||
'images' => ProductImage::collection($product->images),
|
||||
'base_image' => $this->productImageHelper->getProductBaseImage($product),
|
||||
'variants' => Self::collection($this->variants),
|
||||
'in_stock' => $product->haveSufficientQuantity(1),
|
||||
'in_stock' => $product->type == 'configurable' ? 1 : $product->haveSufficientQuantity(1),
|
||||
$this->mergeWhen($product->type == 'configurable', [
|
||||
'super_attributes' => Attribute::collection($product->super_attributes),
|
||||
]),
|
||||
|
|
@ -53,6 +57,13 @@ class Product extends JsonResource
|
|||
$this->productPriceHelper->haveSpecialPrice($product),
|
||||
core()->currency($this->productPriceHelper->getSpecialPrice($product))
|
||||
),
|
||||
'reviews' => [
|
||||
'total' => $total = $this->productReviewHelper->getTotalReviews($product),
|
||||
'total_rating' => $total ? $this->productReviewHelper->getTotalRating($product) : 0,
|
||||
'average_rating' => $total ? $this->productReviewHelper->getAverageRating($product) : 0,
|
||||
'percentage' => $total ? json_encode($this->productReviewHelper->getPercentageRating($product)) : [],
|
||||
],
|
||||
'is_saved' => false,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class ProductImage extends JsonResource
|
|||
'id' => $this->id,
|
||||
'path' => $this->path,
|
||||
'url' => $this->url,
|
||||
'original_image_url' => $this->url,
|
||||
'small_image_url' => url('cache/small/' . $this->path),
|
||||
'medium_image_url' => url('cache/medium/' . $this->path),
|
||||
'large_image_url' => url('cache/large/' . $this->path)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class ProductReview extends JsonResource
|
|||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'rating' => $this->rating,
|
||||
'rating' => number_format($this->rating, 1, '.', ''),
|
||||
'comment' => $this->comment,
|
||||
'name' => $this->name,
|
||||
'status' => $this->status,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Resources\Checkout;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Webkul\API\Http\Resources\Core\Channel as ChannelResource;
|
||||
use Webkul\API\Http\Resources\Customer\Customer as CustomerResource;
|
||||
|
||||
class Cart extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'customer_email' => $this->customer_email,
|
||||
'customer_first_name' => $this->customer_first_name,
|
||||
'customer_last_name' => $this->customer_last_name,
|
||||
'shipping_method' => $this->shipping_method,
|
||||
'coupon_code' => $this->coupon_code,
|
||||
'is_gift' => $this->is_gift,
|
||||
'items_count' => $this->items_count,
|
||||
'items_qty' => $this->items_qty,
|
||||
'exchange_rate' => $this->exchange_rate,
|
||||
'global_currency_code' => $this->global_currency_code,
|
||||
'base_currency_code' => $this->base_currency_code,
|
||||
'channel_currency_code' => $this->channel_currency_code,
|
||||
'cart_currency_code' => $this->cart_currency_code,
|
||||
'grand_total' => $this->grand_total,
|
||||
'formated_grand_total' => core()->formatPrice($this->grand_total, $this->cart_currency_code),
|
||||
'base_grand_total' => $this->base_grand_total,
|
||||
'formated_base_grand_total' => core()->formatBasePrice($this->base_grand_total),
|
||||
'sub_total' => $this->sub_total,
|
||||
'formated_sub_total' => core()->formatPrice($this->sub_total, $this->cart_currency_code),
|
||||
'base_sub_total' => $this->base_sub_total,
|
||||
'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total),
|
||||
'tax_total' => $this->tax_total,
|
||||
'formated_tax_total' => core()->formatPrice($this->tax_total, $this->cart_currency_code),
|
||||
'base_tax_total' => $this->base_tax_total,
|
||||
'formated_base_tax_total' => core()->formatBasePrice($this->base_tax_total),
|
||||
'discount' => $this->discount,
|
||||
'formated_discount' => core()->formatPrice($this->discount, $this->cart_currency_code),
|
||||
'base_discount' => $this->base_discount,
|
||||
'formated_base_discount' => core()->formatBasePrice($this->base_discount),
|
||||
'checkout_method' => $this->checkout_method,
|
||||
'is_guest' => $this->is_guest,
|
||||
'is_active' => $this->is_active,
|
||||
'conversion_time' => $this->conversion_time,
|
||||
'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)),
|
||||
'channel' => $this->when($this->channel_id, new ChannelResource($this->channel)),
|
||||
'items' => CartItem::collection($this->items),
|
||||
'selected_shipping_rate' => new CartShippingRate($this->selected_shipping_rate),
|
||||
'payment' => new CartPayment($this->payment),
|
||||
'billing_address' => new CartAddress($this->billing_address),
|
||||
'shipping_address' => new CartAddress($this->shipping_address),
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Resources\Checkout;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class CartAddress extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'first_name' => $this->first_name,
|
||||
'last_name' => $this->last_name,
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'address1' => explode(PHP_EOL, $this->address1),
|
||||
'country' => $this->country,
|
||||
'country_name' => core()->country_name($this->country),
|
||||
'state' => $this->state,
|
||||
'city' => $this->city,
|
||||
'postcode' => $this->postcode,
|
||||
'phone' => $this->phone,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Resources\Checkout;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Webkul\API\Http\Resources\Catalog\Product as ProductResource;
|
||||
|
||||
class CartItem extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'quantity' => $this->quantity,
|
||||
'sku' => $this->sku,
|
||||
'type' => $this->type,
|
||||
'name' => $this->name,
|
||||
'coupon_code' => $this->coupon_code,
|
||||
'weight' => $this->weight,
|
||||
'total_weight' => $this->total_weight,
|
||||
'base_total_weight' => $this->base_total_weight,
|
||||
'price' => $this->price,
|
||||
'formated_price' => core()->formatPrice($this->price, $this->cart->cart_currency_code),
|
||||
'base_price' => $this->base_price,
|
||||
'formated_base_price' => core()->formatBasePrice($this->base_price),
|
||||
'custom_price' => $this->custom_price,
|
||||
'formated_custom_price' => core()->formatPrice($this->custom_price, $this->cart->cart_currency_code),
|
||||
'total' => $this->total,
|
||||
'formated_total' => core()->formatPrice($this->total, $this->cart->cart_currency_code),
|
||||
'base_total' => $this->base_total,
|
||||
'formated_base_total' => core()->formatBasePrice($this->base_total),
|
||||
'tax_percent' => $this->tax_percent,
|
||||
'tax_amount' => $this->tax_amount,
|
||||
'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->cart->cart_currency_code),
|
||||
'base_tax_amount' => $this->base_tax_amount,
|
||||
'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount),
|
||||
'discount_percent' => $this->discount_percent,
|
||||
'discount_amount' => $this->discount_amount,
|
||||
'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->cart->cart_currency_code),
|
||||
'base_discount_amount' => $this->base_discount_amount,
|
||||
'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount),
|
||||
'additional' => is_array($this->resource->additional)
|
||||
? $this->resource->additional
|
||||
: json_decode($this->resource->additional, true),
|
||||
'child' => new self($this->child),
|
||||
'product' => $this->when($this->product_id, new ProductResource($this->product)),
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Resources\Checkout;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class CartPayment extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'method' => $this->method,
|
||||
'method_title' => core()->getConfigData('sales.paymentmethods.' . $this->method . '.title'),
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Resources\Checkout;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Cart;
|
||||
|
||||
class CartShippingRate extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$cart = Cart::getCart();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'carrier' => $this->carrier,
|
||||
'carrier_title' => $this->carrier_title,
|
||||
'method' => $this->method,
|
||||
'method_title' => $this->method_title,
|
||||
'method_description' => $this->method_description,
|
||||
'price' => $this->price,
|
||||
'formated_price' => core()->formatPrice($this->price, $cart->cart_currency_code),
|
||||
'base_price' => $this->base_price,
|
||||
'formated_base_price' => core()->formatBasePrice($this->base_price),
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ class Channel extends JsonResource
|
|||
'favicon_url' => $this->favicon_url,
|
||||
'default_locale' => $this->when($this->default_locale_id, new LocaleResource($this->default_locale)),
|
||||
'base_currency' => $this->when($this->default_currency_id, new CurrencyResource($this->default_currency)),
|
||||
'root_category_id' => $this->root_category_id,
|
||||
'root_category' => $this->when($this->root_category_id, new CategoryResource($this->root_category)),
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\API\Http\Resources\Core;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class Country extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'code' => $this->code,
|
||||
'name' => $this->name
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -16,9 +16,9 @@ class CustomerAddress extends JsonResource
|
|||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'address1' => $this->address1,
|
||||
'address2' => $this->address2,
|
||||
'address1' => explode(PHP_EOL, $this->address1),
|
||||
'country' => $this->country,
|
||||
'country_name' => core()->country_name($this->country),
|
||||
'state' => $this->state,
|
||||
'city' => $this->city,
|
||||
'postcode' => $this->postcode,
|
||||
|
|
|
|||
|
|
@ -23,18 +23,29 @@ class Invoice extends JsonResource
|
|||
'channel_currency_code' => $this->channel_currency_code,
|
||||
'order_currency_code' => $this->order_currency_code,
|
||||
'sub_total' => $this->sub_total,
|
||||
'formated_sub_total' => core()->formatPrice($this->sub_total, $this->order_currency_code),
|
||||
'base_sub_total' => $this->base_sub_total,
|
||||
'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total),
|
||||
'grand_total' => $this->grand_total,
|
||||
'formated_grand_total' => core()->formatPrice($this->grand_total, $this->order_currency_code),
|
||||
'base_grand_total' => $this->base_grand_total,
|
||||
'formated_base_grand_total' => core()->formatBasePrice($this->base_grand_total),
|
||||
'shipping_amount' => $this->shipping_amount,
|
||||
'formated_shipping_amount' => core()->formatPrice($this->shipping_amount, $this->order_currency_code),
|
||||
'base_shipping_amount' => $this->base_shipping_amount,
|
||||
'formated_base_shipping_amount' => core()->formatBasePrice($this->base_shipping_amount),
|
||||
'tax_amount' => $this->tax_amount,
|
||||
'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order_currency_code),
|
||||
'base_tax_amount' => $this->base_tax_amount,
|
||||
'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount),
|
||||
'discount_amount' => $this->discount_amount,
|
||||
'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order_currency_code),
|
||||
'base_discount_amount' => $this->base_discount_amount,
|
||||
'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount),
|
||||
'order_address' => new OrderAddress($this->address),
|
||||
'transaction_id' => $this->transaction_id,
|
||||
'items' => InvoiceItem::collection($this->items),
|
||||
'created_at' => $this->created_at
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -17,16 +17,27 @@ class InvoiceItem extends JsonResource
|
|||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
// 'product' => $this->when($this->product, new ProductResource($this->product)),
|
||||
'description' => $this->description,
|
||||
'sku' => $this->sku,
|
||||
'description' => $this->description,
|
||||
'qty' => $this->qty,
|
||||
'price' => $this->price,
|
||||
'formated_price' => core()->formatPrice($this->price, $this->invoice->order_currency_code),
|
||||
'base_price' => $this->base_price,
|
||||
'formated_base_price' => core()->formatBasePrice($this->base_price),
|
||||
'total' => $this->total,
|
||||
'formated_total' => core()->formatPrice($this->total, $this->invoice->order_currency_code),
|
||||
'base_total' => $this->base_total,
|
||||
'formated_base_total' => core()->formatBasePrice($this->base_total),
|
||||
'tax_amount' => $this->tax_amount,
|
||||
'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->invoice->order_currency_code),
|
||||
'base_tax_amount' => $this->base_tax_amount,
|
||||
'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount),
|
||||
'grand_total' => $this->total + $this->tax_amount,
|
||||
'formated_grand_total' => core()->formatPrice($this->total + $this->tax_amount, $this->invoice->order_currency_code),
|
||||
'base_grand_total' => $this->base_total + $this->base_tax_amount,
|
||||
'formated_base_grand_total' => core()->formatBasePrice($this->base_total + $this->base_tax_amount),
|
||||
'additional' => is_array($this->resource->additional)
|
||||
? $this->resource->additional
|
||||
: json_decode($this->resource->additional, true),
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class Order extends JsonResource
|
|||
return [
|
||||
'id' => $this->id,
|
||||
'status' => $this->status,
|
||||
'status_label' => $this->status_label,
|
||||
'channel_name' => $this->channel_name,
|
||||
'is_guest' => $this->is_guest,
|
||||
'customer_email' => $this->customer_email,
|
||||
|
|
@ -26,6 +27,7 @@ class Order extends JsonResource
|
|||
'customer_last_name' => $this->customer_last_name,
|
||||
'shipping_method' => $this->shipping_method,
|
||||
'shipping_title' => $this->shipping_title,
|
||||
'payment_title' => core()->getConfigData('sales.paymentmethods.' . $this->payment->method . '.title'),
|
||||
'shipping_description' => $this->shipping_description,
|
||||
'coupon_code' => $this->coupon_code,
|
||||
'is_gift' => $this->is_gift,
|
||||
|
|
@ -35,37 +37,68 @@ class Order extends JsonResource
|
|||
'channel_currency_code' => $this->channel_currency_code,
|
||||
'order_currency_code' => $this->order_currency_code,
|
||||
'grand_total' => $this->grand_total,
|
||||
'formated_grand_total' => core()->formatPrice($this->grand_total, $this->order_currency_code),
|
||||
'base_grand_total' => $this->base_grand_total,
|
||||
'formated_base_grand_total' => core()->formatBasePrice($this->base_grand_total),
|
||||
'grand_total_invoiced' => $this->grand_total_invoiced,
|
||||
'formated_grand_total_invoiced' => core()->formatPrice($this->grand_total_invoiced, $this->order_currency_code),
|
||||
'base_grand_total_invoiced' => $this->base_grand_total_invoiced,
|
||||
'formated_base_grand_total_invoiced' => core()->formatBasePrice($this->base_grand_total_invoiced),
|
||||
'grand_total_refunded' => $this->grand_total_refunded,
|
||||
'formated_grand_total_refunded' => core()->formatPrice($this->grand_total_refunded, $this->order_currency_code),
|
||||
'base_grand_total_refunded' => $this->base_grand_total_refunded,
|
||||
'formated_base_grand_total_refunded' => core()->formatBasePrice($this->base_grand_total_refunded),
|
||||
'sub_total' => $this->sub_total,
|
||||
'formated_sub_total' => core()->formatPrice($this->sub_total, $this->order_currency_code),
|
||||
'base_sub_total' => $this->base_sub_total,
|
||||
'formated_base_sub_total' => core()->formatBasePrice($this->base_sub_total),
|
||||
'sub_total_invoiced' => $this->sub_total_invoiced,
|
||||
'formated_sub_total_invoiced' => core()->formatPrice($this->sub_total_invoiced, $this->order_currency_code),
|
||||
'base_sub_total_invoiced' => $this->base_sub_total_invoiced,
|
||||
'formated_base_sub_total_invoiced' => core()->formatBasePrice($this->base_sub_total_invoiced),
|
||||
'sub_total_refunded' => $this->sub_total_refunded,
|
||||
'formated_sub_total_refunded' => core()->formatPrice($this->sub_total_refunded, $this->order_currency_code),
|
||||
'discount_percent' => $this->discount_percent,
|
||||
'discount_amount' => $this->discount_amount,
|
||||
'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order_currency_code),
|
||||
'base_discount_amount' => $this->base_discount_amount,
|
||||
'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount),
|
||||
'discount_invoiced' => $this->discount_invoiced,
|
||||
'formated_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->order_currency_code),
|
||||
'base_discount_invoiced' => $this->base_discount_invoiced,
|
||||
'formated_base_discount_invoiced' => core()->formatBasePrice($this->base_discount_invoiced),
|
||||
'discount_refunded' => $this->discount_refunded,
|
||||
'formated_discount_refunded' => core()->formatPrice($this->discount_refunded, $this->order_currency_code),
|
||||
'base_discount_refunded' => $this->base_discount_refunded,
|
||||
'formated_base_discount_refunded' => core()->formatBasePrice($this->base_discount_refunded),
|
||||
'tax_amount' => $this->tax_amount,
|
||||
'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order_currency_code),
|
||||
'base_tax_amount' => $this->base_tax_amount,
|
||||
'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount),
|
||||
'tax_amount_invoiced' => $this->tax_amount_invoiced,
|
||||
'formated_tax_amount_invoiced' => core()->formatPrice($this->tax_amount_invoiced, $this->order_currency_code),
|
||||
'base_tax_amount_invoiced' => $this->base_tax_amount_invoiced,
|
||||
'formated_base_tax_amount_invoiced' => core()->formatBasePrice($this->base_tax_amount_invoiced),
|
||||
'tax_amount_refunded' => $this->tax_amount_refunded,
|
||||
'formated_tax_amount_refunded' => core()->formatPrice($this->tax_amount_refunded, $this->order_currency_code),
|
||||
'base_tax_amount_refunded' => $this->base_tax_amount_refunded,
|
||||
'formated_base_tax_amount_refunded' => core()->formatBasePrice($this->base_tax_amount_refunded),
|
||||
'shipping_amount' => $this->shipping_amount,
|
||||
'formated_shipping_amount' => core()->formatPrice($this->shipping_amount, $this->order_currency_code),
|
||||
'base_shipping_amount' => $this->base_shipping_amount,
|
||||
'formated_base_shipping_amount' => core()->formatBasePrice($this->base_shipping_amount),
|
||||
'shipping_invoiced' => $this->shipping_invoiced,
|
||||
'formated_shipping_invoiced' => core()->formatPrice($this->shipping_invoiced, $this->order_currency_code),
|
||||
'base_shipping_invoiced' => $this->base_shipping_invoiced,
|
||||
'formated_base_shipping_invoiced' => core()->formatBasePrice($this->base_shipping_invoiced),
|
||||
'shipping_refunded' => $this->shipping_refunded,
|
||||
'formated_shipping_refunded' => core()->formatPrice($this->shipping_refunded, $this->order_currency_code),
|
||||
'base_shipping_refunded' => $this->base_shipping_refunded,
|
||||
'formated_base_shipping_refunded' => core()->formatBasePrice($this->base_shipping_refunded),
|
||||
'customer' => $this->when($this->customer_id, new CustomerResource($this->customer)),
|
||||
'channel' => $this->when($this->channel_id, new ChannelResource($this->channel)),
|
||||
'shipping_address' => new OrderAddress($this->shipping_address),
|
||||
'billing_address' => new OrderAddress($this->billing_address),
|
||||
'updated_at' => $this->updated_at,
|
||||
'items' => OrderItem::collection($this->items),
|
||||
'invoices' => Invoice::collection($this->invoices),
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ class OrderAddress extends JsonResource
|
|||
'email' => $this->email,
|
||||
'first_name' => $this->first_name,
|
||||
'last_name' => $this->last_name,
|
||||
'address1' => $this->address1,
|
||||
'address2' => $this->address2,
|
||||
'address1' => explode(PHP_EOL, $this->address1),
|
||||
'country' => $this->country,
|
||||
'country_name' => core()->country_name($this->country),
|
||||
'state' => $this->state,
|
||||
'city' => $this->city,
|
||||
'postcode' => $this->postcode,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Webkul\API\Http\Resources\Sales;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Webkul\API\Http\Resources\Catalog\Product as ProductResource;
|
||||
|
||||
class OrderItem extends JsonResource
|
||||
{
|
||||
|
|
@ -19,35 +20,61 @@ class OrderItem extends JsonResource
|
|||
'sku' => $this->sku,
|
||||
'type' => $this->type,
|
||||
'name' => $this->name,
|
||||
'product' => $this->when($this->product, new ProductResource($this->product)),
|
||||
'coupon_code' => $this->coupon_code,
|
||||
'weight' => $this->weight,
|
||||
'total_weight' => $this->total_weight,
|
||||
'qty_ordered' => $this->qty_ordered,
|
||||
'qty_canceled' => $this->qty_canceled,
|
||||
'qty_invoiced' => $this->qty_invoiced,
|
||||
'qty_shipped' => $this->qty_shipped,
|
||||
'qty_refunded' => $this->qty_refunded,
|
||||
'price' => $this->price,
|
||||
'formated_price' => core()->formatPrice($this->price, $this->order->order_currency_code),
|
||||
'base_price' => $this->base_price,
|
||||
'formated_base_price' => core()->formatBasePrice($this->base_price),
|
||||
'total' => $this->total,
|
||||
'formated_total' => core()->formatPrice($this->total, $this->order->order_currency_code),
|
||||
'base_total' => $this->base_total,
|
||||
'formated_base_total' => core()->formatBasePrice($this->base_total),
|
||||
'total_invoiced' => $this->total_invoiced,
|
||||
'formated_total_invoiced' => core()->formatPrice($this->total_invoiced, $this->order->order_currency_code),
|
||||
'base_total_invoiced' => $this->base_total_invoiced,
|
||||
'formated_base_total_invoiced' => core()->formatBasePrice($this->base_total_invoiced),
|
||||
'amount_refunded' => $this->amount_refunded,
|
||||
'formated_amount_refunded' => core()->formatPrice($this->amount_refunded, $this->order->order_currency_code),
|
||||
'base_amount_refunded' => $this->base_amount_refunded,
|
||||
'formated_base_amount_refunded' => core()->formatBasePrice($this->base_amount_refunded),
|
||||
'discount_percent' => $this->discount_percent,
|
||||
'discount_amount' => $this->discount_amount,
|
||||
'formated_discount_amount' => core()->formatPrice($this->discount_amount, $this->order->order_currency_code),
|
||||
'base_discount_amount' => $this->base_discount_amount,
|
||||
'formated_base_discount_amount' => core()->formatBasePrice($this->base_discount_amount),
|
||||
'discount_invoiced' => $this->discount_invoiced,
|
||||
'formated_discount_invoiced' => core()->formatPrice($this->discount_invoiced, $this->order->order_currency_code),
|
||||
'base_discount_invoiced' => $this->base_discount_invoiced,
|
||||
'formated_base_discount_invoiced' => core()->formatBasePrice($this->base_discount_invoiced),
|
||||
'discount_refunded' => $this->discount_refunded,
|
||||
'formated_discount_refunded' => core()->formatPrice($this->discount_refunded, $this->order->order_currency_code),
|
||||
'base_discount_refunded' => $this->base_discount_refunded,
|
||||
'formated_base_discount_refunded' => core()->formatBasePrice($this->base_discount_refunded),
|
||||
'tax_percent' => $this->tax_percent,
|
||||
'tax_amount' => $this->tax_amount,
|
||||
'formated_tax_amount' => core()->formatPrice($this->tax_amount, $this->order->order_currency_code),
|
||||
'base_tax_amount' => $this->base_tax_amount,
|
||||
'formated_base_tax_amount' => core()->formatBasePrice($this->base_tax_amount),
|
||||
'tax_amount_invoiced' => $this->tax_amount_invoiced,
|
||||
'formated_tax_amount_invoiced' => core()->formatPrice($this->tax_amount_invoiced, $this->order->order_currency_code),
|
||||
'base_tax_amount_invoiced' => $this->base_tax_amount_invoiced,
|
||||
'formated_base_tax_amount_invoiced' => core()->formatBasePrice($this->base_tax_amount_invoiced),
|
||||
'tax_amount_refunded' => $this->tax_amount_refunded,
|
||||
'formated_tax_amount_refunded' => core()->formatPrice($this->tax_amount_refunded, $this->order->order_currency_code),
|
||||
'base_tax_amount_refunded' => $this->base_tax_amount_refunded,
|
||||
'formated_base_tax_amount_refunded' => core()->formatBasePrice($this->base_tax_amount_refunded),
|
||||
'grant_total' => $this->total + $this->tax_amount,
|
||||
'formated_grant_total' => core()->formatPrice($this->total + $this->tax_amount, $this->order->order_currency_code),
|
||||
'base_grant_total' => $this->base_total + $this->base_tax_amount,
|
||||
'formated_base_grant_total' => core()->formatPrice($this->base_total + $this->base_tax_amount, $this->order->order_currency_code),
|
||||
'additional' => is_array($this->resource->additional)
|
||||
? $this->resource->additional
|
||||
: json_decode($this->resource->additional, true),
|
||||
|
|
|
|||
|
|
@ -22,9 +22,13 @@ class ShipmentItem extends JsonResource
|
|||
'qty' => $this->qty,
|
||||
'weight' => $this->weight,
|
||||
'price' => $this->price,
|
||||
'formated_price' => core()->formatPrice($this->price, $this->shipment->order->order_currency_code),
|
||||
'base_price' => $this->base_price,
|
||||
'formated_base_price' => core()->formatBasePrice($this->base_price),
|
||||
'total' => $this->total,
|
||||
'formated_total' => core()->formatPrice($this->total, $this->shipment->order->order_currency_code),
|
||||
'base_total' => $this->base_total,
|
||||
'formated_base_total' => core()->formatBasePrice($this->base_total),
|
||||
'additional' => is_array($this->resource->additional)
|
||||
? $this->resource->additional
|
||||
: json_decode($this->resource->additional, true)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Route::group(['prefix' => 'api'], function ($router) {
|
||||
|
||||
Route::group(['namespace' => 'Webkul\API\Http\Controllers\Shop', 'middleware' => ['locale', 'currency']], function ($router) {
|
||||
Route::group(['namespace' => 'Webkul\API\Http\Controllers\Shop', 'middleware' => ['locale', 'theme', 'currency']], function ($router) {
|
||||
//Currency and Locale switcher
|
||||
Route::get('switch-currency', 'CoreController@switchCurrency');
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ Route::group(['prefix' => 'api'], function ($router) {
|
|||
'resource' => 'Webkul\API\Http\Resources\Catalog\Category'
|
||||
]);
|
||||
|
||||
Route::get('descendants-categories', 'CategoryController@index');
|
||||
Route::get('descendant-categories', 'CategoryController@index');
|
||||
|
||||
Route::get('categories/{id}', 'ResourceController@get')->defaults('_config', [
|
||||
'repository' => 'Webkul\Category\Repositories\CategoryRepository',
|
||||
|
|
@ -52,6 +52,10 @@ Route::group(['prefix' => 'api'], function ($router) {
|
|||
|
||||
Route::get('products/{id}', 'ProductController@get');
|
||||
|
||||
Route::get('product-additional-information/{id}', 'ProductController@additionalInformation');
|
||||
|
||||
Route::get('product-configurable-config/{id}', 'ProductController@configurableConfig');
|
||||
|
||||
|
||||
//Product Review routes
|
||||
Route::get('reviews', 'ResourceController@index')->defaults('_config', [
|
||||
|
|
@ -64,6 +68,8 @@ Route::group(['prefix' => 'api'], function ($router) {
|
|||
'resource' => 'Webkul\API\Http\Resources\Catalog\ProductReview'
|
||||
]);
|
||||
|
||||
Route::post('reviews/{id}/create', 'ReviewController@store');
|
||||
|
||||
|
||||
//Channel routes
|
||||
Route::get('channels', 'ResourceController@index')->defaults('_config', [
|
||||
|
|
@ -89,6 +95,20 @@ Route::group(['prefix' => 'api'], function ($router) {
|
|||
]);
|
||||
|
||||
|
||||
//Country routes
|
||||
Route::get('countries', 'ResourceController@index')->defaults('_config', [
|
||||
'repository' => 'Webkul\Core\Repositories\CountryRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Core\Country'
|
||||
]);
|
||||
|
||||
Route::get('countries/{id}', 'ResourceController@get')->defaults('_config', [
|
||||
'repository' => 'Webkul\Core\Repositories\CountryRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Core\Country'
|
||||
]);
|
||||
|
||||
Route::get('country-states', 'CoreController@getCountryStateGroup');
|
||||
|
||||
|
||||
//Slider routes
|
||||
Route::get('sliders', 'ResourceController@index')->defaults('_config', [
|
||||
'repository' => 'Webkul\Core\Repositories\SliderRepository',
|
||||
|
|
@ -112,71 +132,138 @@ Route::group(['prefix' => 'api'], function ($router) {
|
|||
'resource' => 'Webkul\API\Http\Resources\Core\Currency'
|
||||
]);
|
||||
|
||||
Route::get('config', 'CoreController@getConfig');
|
||||
|
||||
|
||||
//Customer routes
|
||||
Route::get('customers', 'ResourceController@index')->defaults('_config', [
|
||||
'repository' => 'Webkul\Customer\Repositories\CustomerRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Customer\Customer'
|
||||
]);
|
||||
Route::post('customer/login', 'SessionController@create');
|
||||
|
||||
Route::post('customer/forgot-password', 'ForgotPasswordController@store');
|
||||
|
||||
Route::get('customer/logout', 'SessionController@destroy');
|
||||
|
||||
Route::get('customer/get', 'SessionController@get');
|
||||
|
||||
Route::put('customer/profile', 'SessionController@update');
|
||||
|
||||
Route::post('customer/register', 'CustomerController@create');
|
||||
|
||||
Route::get('customers/{id}', 'ResourceController@get')->defaults('_config', [
|
||||
'repository' => 'Webkul\Customer\Repositories\CustomerRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Customer\Customer'
|
||||
'resource' => 'Webkul\API\Http\Resources\Customer\Customer',
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
|
||||
//Customer Address routes
|
||||
Route::get('addresses', 'ResourceController@index')->defaults('_config', [
|
||||
'repository' => 'Webkul\Customer\Repositories\CustomerAddressRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Customer\CustomerAddress'
|
||||
'resource' => 'Webkul\API\Http\Resources\Customer\CustomerAddress',
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
Route::get('addresses/{id}', 'ResourceController@get')->defaults('_config', [
|
||||
'repository' => 'Webkul\Customer\Repositories\CustomerAddressRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Customer\CustomerAddress'
|
||||
'resource' => 'Webkul\API\Http\Resources\Customer\CustomerAddress',
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
Route::delete('addresses/{id}', 'ResourceController@destroy')->defaults('_config', [
|
||||
'repository' => 'Webkul\Customer\Repositories\CustomerAddressRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Customer\CustomerAddress',
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
Route::put('addresses/{id}', 'AddressController@update')->defaults('_config', [
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
Route::post('addresses/create', 'AddressController@store')->defaults('_config', [
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
|
||||
//Order routes
|
||||
Route::get('orders', 'ResourceController@index')->defaults('_config', [
|
||||
'repository' => 'Webkul\Sales\Repositories\OrderRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Sales\Order'
|
||||
'resource' => 'Webkul\API\Http\Resources\Sales\Order',
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
Route::get('orders/{id}', 'ResourceController@get')->defaults('_config', [
|
||||
'repository' => 'Webkul\Sales\Repositories\OrderRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Sales\Order'
|
||||
'resource' => 'Webkul\API\Http\Resources\Sales\Order',
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
|
||||
//Invoice routes
|
||||
Route::get('invoices', 'ResourceController@index')->defaults('_config', [
|
||||
'repository' => 'Webkul\Sales\Repositories\InvoiceRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Sales\Invoice'
|
||||
'resource' => 'Webkul\API\Http\Resources\Sales\Invoice',
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
Route::get('invoices/{id}', 'ResourceController@get')->defaults('_config', [
|
||||
'repository' => 'Webkul\Sales\Repositories\InvoiceRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Sales\Invoice'
|
||||
'resource' => 'Webkul\API\Http\Resources\Sales\Invoice',
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
|
||||
//Invoice routes
|
||||
Route::get('shipments', 'ResourceController@index')->defaults('_config', [
|
||||
'repository' => 'Webkul\Sales\Repositories\ShipmentRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Sales\Shipment'
|
||||
'resource' => 'Webkul\API\Http\Resources\Sales\Shipment',
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
Route::get('shipments/{id}', 'ResourceController@get')->defaults('_config', [
|
||||
'repository' => 'Webkul\Sales\Repositories\ShipmentRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Sales\Shipment'
|
||||
'resource' => 'Webkul\API\Http\Resources\Sales\Shipment',
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
|
||||
//Wishlist routes
|
||||
Route::get('wishlist', 'ResourceController@index')->defaults('_config', [
|
||||
'repository' => 'Webkul\Customer\Repositories\WishlistRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Customer\Wishlist'
|
||||
'resource' => 'Webkul\API\Http\Resources\Customer\Wishlist',
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
Route::delete('wishlist/{id}', 'ResourceController@destroy')->defaults('_config', [
|
||||
'repository' => 'Webkul\Customer\Repositories\WishlistRepository',
|
||||
'resource' => 'Webkul\API\Http\Resources\Customer\Wishlist',
|
||||
'authorization_required' => true
|
||||
]);
|
||||
|
||||
Route::get('move-to-cart/{id}', 'WishlistController@moveToCart');
|
||||
|
||||
Route::get('wishlist/add/{id}', 'WishlistController@create');
|
||||
|
||||
|
||||
//Checkout routes
|
||||
Route::group(['prefix' => 'checkout'], function ($router) {
|
||||
Route::post('cart/add/{id}', 'CartController@store');
|
||||
|
||||
Route::get('cart', 'CartController@get');
|
||||
|
||||
Route::get('cart/empty', 'CartController@destroy');
|
||||
|
||||
Route::put('cart/update', 'CartController@update');
|
||||
|
||||
Route::get('cart/remove-item/{id}', 'CartController@destroyItem');
|
||||
|
||||
Route::get('cart/move-to-wishlist/{id}', 'CartController@moveToWishlist');
|
||||
|
||||
Route::post('save-address', 'CheckoutController@saveAddress');
|
||||
|
||||
Route::post('save-shipping', 'CheckoutController@saveShipping');
|
||||
|
||||
Route::post('save-payment', 'CheckoutController@savePayment');
|
||||
|
||||
Route::post('save-order', 'CheckoutController@saveOrder');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -3,6 +3,8 @@
|
|||
namespace Webkul\API\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Routing\Router;
|
||||
use Webkul\API\Http\Middleware\JwtMiddleware;
|
||||
|
||||
class APIServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -11,7 +13,7 @@ class APIServiceProvider extends ServiceProvider
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
public function boot(Router $router)
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__.'/../Http/routes.php');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,4 +26,4 @@
|
|||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/admin.js": "/js/admin.js?id=80929525e1dbb0ab9cd1",
|
||||
"/css/admin.css": "/css/admin.css?id=a71a72c31d6ac0fe375f"
|
||||
}
|
||||
"/js/admin.js": "/js/admin.js?id=d27aed3da0c62eb237be",
|
||||
"/css/admin.css": "/css/admin.css?id=96d341f257529071e8e7"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,41 +36,141 @@ return [
|
|||
'name' => 'admin::app.acl.products',
|
||||
'route' => 'admin.catalog.products.index',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'catalog.products.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.catalog.products.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'catalog.products.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.catalog.products.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'catalog.products.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.catalog.products.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'catalog.categories',
|
||||
'name' => 'admin::app.acl.categories',
|
||||
'route' => 'admin.catalog.categories.index',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'catalog.categories.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.catalog.categories.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'catalog.categories.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.catalog.categories.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'catalog.categories.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.catalog.categories.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'catalog.attributes',
|
||||
'name' => 'admin::app.acl.attributes',
|
||||
'route' => 'admin.catalog.attributes.index',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'catalog.attributes.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.catalog.attributes.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'catalog.attributes.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.catalog.attributes.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'catalog.attributes.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.catalog.attributes.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'catalog.families',
|
||||
'name' => 'admin::app.acl.attribute-families',
|
||||
'route' => 'admin.catalog.families.index',
|
||||
'sort' => 4
|
||||
], [
|
||||
'key' => 'catalog.families.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.catalog.families.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'catalog.families.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.catalog.families.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'catalog.families.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.catalog.families.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'customers',
|
||||
'name' => 'admin::app.acl.customers',
|
||||
'route' => 'admin.customers.index',
|
||||
'route' => 'admin.customer.index',
|
||||
'sort' => 4
|
||||
], [
|
||||
'key' => 'customers.customers',
|
||||
'name' => 'admin::app.acl.customers',
|
||||
'route' => 'admin.customers.index',
|
||||
'route' => 'admin.customer.index',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'customers.customers.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.customer.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'customers.customers.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.customer.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'customers.customers.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.customer.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'customers.groups',
|
||||
'name' => 'admin::app.acl.groups',
|
||||
'route' => 'admin.groups.index',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'customers.groups.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.groups.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'customers.groups.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.groups.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'customers.groups.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.groups.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'customers.reviews',
|
||||
'name' => 'admin::app.acl.reviews',
|
||||
'route' => 'admin.customers.reviews.index',
|
||||
'route' => 'admin.customer.review.index',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'customers.reviews.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.customer.review.edit',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'customers.reviews.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.customer.review.delete',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'configuration',
|
||||
'name' => 'admin::app.acl.configure',
|
||||
|
|
@ -86,26 +186,101 @@ return [
|
|||
'name' => 'admin::app.acl.locales',
|
||||
'route' => 'admin.locales.index',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.locales.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.locales.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.locales.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.locales.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'settings.locales.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.locales.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'settings.currencies',
|
||||
'name' => 'admin::app.acl.currencies',
|
||||
'route' => 'admin.currencies.index',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'settings.currencies.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.currencies.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.currencies.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.currencies.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'settings.currencies.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.currencies.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'settings.exchange_rates',
|
||||
'name' => 'admin::app.acl.exchange-rates',
|
||||
'route' => 'admin.exchange_rates.index',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'settings.exchange_rates.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.exchange_rates.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.exchange_rates.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.exchange_rates.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'settings.exchange_rates.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.exchange_rates.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'settings.inventory_sources',
|
||||
'name' => 'admin::app.acl.inventory-sources',
|
||||
'route' => 'admin.inventory_sources.index',
|
||||
'sort' => 4
|
||||
], [
|
||||
'key' => 'settings.inventory_sources.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.inventory_sources.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.inventory_sources.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.inventory_sources.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'settings.inventory_sources.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.inventory_sources.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'settings.channels',
|
||||
'name' => 'admin::app.acl.channels',
|
||||
'route' => 'admin.channels.index',
|
||||
'sort' => 5
|
||||
], [
|
||||
'key' => 'settings.channels.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.channels.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.channels.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.channels.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'settings.channels.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.channels.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'settings.users',
|
||||
'name' => 'admin::app.acl.users',
|
||||
|
|
@ -116,16 +291,61 @@ return [
|
|||
'name' => 'admin::app.acl.users',
|
||||
'route' => 'admin.users.index',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.users.users.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.users.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.users.users.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.users.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'settings.users.users.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.users.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'settings.users.roles',
|
||||
'name' => 'admin::app.acl.roles',
|
||||
'route' => 'admin.roles.index',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'settings.users.roles.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.roles.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.users.roles.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.roles.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'settings.users.roles.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.roles.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'settings.sliders',
|
||||
'name' => 'admin::app.acl.sliders',
|
||||
'route' => 'admin.sliders.index',
|
||||
'sort' => 7
|
||||
], [
|
||||
'key' => 'settings.sliders.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.sliders.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.sliders.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.sliders.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'settings.sliders.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.sliders.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'settings.taxes',
|
||||
'name' => 'admin::app.acl.taxes',
|
||||
|
|
@ -136,12 +356,67 @@ return [
|
|||
'name' => 'admin::app.acl.tax-categories',
|
||||
'route' => 'admin.tax-categories.index',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.taxes.tax-categories.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.tax-categories.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.taxes.tax-categories.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.tax-categories.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'settings.taxes.tax-categories.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.tax-categories.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'settings.taxes.tax-rates',
|
||||
'name' => 'admin::app.acl.tax-rates',
|
||||
'route' => 'admin.tax-rates.index',
|
||||
'sort' => 2
|
||||
]
|
||||
], [
|
||||
'key' => 'settings.taxes.tax-rates.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.tax-rates.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'settings.taxes.tax-rates.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.tax-rates.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'settings.taxes.tax-rates.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.tax-rates.delete',
|
||||
'sort' => 3
|
||||
], [
|
||||
'key' => 'promotions',
|
||||
'name' => 'admin::app.acl.promotions',
|
||||
'route' => 'admin.cart-rule.index',
|
||||
'sort' => 7
|
||||
], [
|
||||
'key' => 'promotions.cart-rule',
|
||||
'name' => 'admin::app.acl.cart-rules',
|
||||
'route' => 'admin.cart-rule.index',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'promotions.cart-rule.create',
|
||||
'name' => 'admin::app.acl.create',
|
||||
'route' => 'admin.cart-rule.create',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'promotions.cart-rule.edit',
|
||||
'name' => 'admin::app.acl.edit',
|
||||
'route' => 'admin.cart-rule.edit',
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'promotions.cart-rule.delete',
|
||||
'name' => 'admin::app.acl.delete',
|
||||
'route' => 'admin.cart-rule.delete',
|
||||
'sort' => 3
|
||||
],
|
||||
];
|
||||
|
||||
?>
|
||||
|
|
@ -6,175 +6,205 @@ return [
|
|||
'name' => 'admin::app.layouts.dashboard',
|
||||
'route' => 'admin.dashboard.index',
|
||||
'sort' => 1,
|
||||
'icon-class' => 'dashboard-icon',
|
||||
'icon-class' => 'dashboard-icon'
|
||||
], [
|
||||
'key' => 'sales',
|
||||
'name' => 'admin::app.layouts.sales',
|
||||
'route' => 'admin.sales.orders.index',
|
||||
'sort' => 2,
|
||||
'icon-class' => 'sales-icon',
|
||||
'icon-class' => 'sales-icon'
|
||||
], [
|
||||
'key' => 'sales.orders',
|
||||
'name' => 'admin::app.layouts.orders',
|
||||
'route' => 'admin.sales.orders.index',
|
||||
'sort' => 1,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'sales.shipments',
|
||||
'name' => 'admin::app.layouts.shipments',
|
||||
'route' => 'admin.sales.shipments.index',
|
||||
'sort' => 2,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'sales.invoices',
|
||||
'name' => 'admin::app.layouts.invoices',
|
||||
'route' => 'admin.sales.invoices.index',
|
||||
'sort' => 3,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
],
|
||||
[
|
||||
'key' => 'catalog',
|
||||
'name' => 'admin::app.layouts.catalog',
|
||||
'route' => 'admin.catalog.products.index',
|
||||
'sort' => 3,
|
||||
'icon-class' => 'catalog-icon',
|
||||
'icon-class' => 'catalog-icon'
|
||||
], [
|
||||
'key' => 'catalog.products',
|
||||
'name' => 'admin::app.layouts.products',
|
||||
'route' => 'admin.catalog.products.index',
|
||||
'sort' => 1,
|
||||
'icon-class' => '',
|
||||
'sort' => 4,
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'catalog.categories',
|
||||
'name' => 'admin::app.layouts.categories',
|
||||
'route' => 'admin.catalog.categories.index',
|
||||
'sort' => 2,
|
||||
'icon-class' => '',
|
||||
'sort' => 3,
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'catalog.attributes',
|
||||
'name' => 'admin::app.layouts.attributes',
|
||||
'route' => 'admin.catalog.attributes.index',
|
||||
'sort' => 3,
|
||||
'icon-class' => '',
|
||||
'sort' => 1,
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'catalog.families',
|
||||
'name' => 'admin::app.layouts.attribute-families',
|
||||
'route' => 'admin.catalog.families.index',
|
||||
'sort' => 4,
|
||||
'icon-class' => '',
|
||||
'sort' => 2,
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'customers',
|
||||
'name' => 'admin::app.layouts.customers',
|
||||
'route' => 'admin.customer.index',
|
||||
'sort' => 4,
|
||||
'icon-class' => 'customer-icon',
|
||||
'icon-class' => 'customer-icon'
|
||||
], [
|
||||
'key' => 'customers.customers',
|
||||
'name' => 'admin::app.layouts.customers',
|
||||
'route' => 'admin.customer.index',
|
||||
'sort' => 1,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'customers.groups',
|
||||
'name' => 'admin::app.layouts.groups',
|
||||
'route' => 'admin.groups.index',
|
||||
'sort' => 2,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'customers.reviews',
|
||||
'name' => 'admin::app.layouts.reviews',
|
||||
'route' => 'admin.customer.review.index',
|
||||
'sort' => 3,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'customers.subscribers',
|
||||
'name' => 'admin::app.layouts.newsletter-subscriptions',
|
||||
'route' => 'admin.customers.subscribers.index',
|
||||
'sort' => 4,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'configuration',
|
||||
'name' => 'admin::app.layouts.configure',
|
||||
'route' => 'admin.configuration.index',
|
||||
'sort' => 5,
|
||||
'icon-class' => 'configuration-icon',
|
||||
'sort' => 7,
|
||||
'icon-class' => 'configuration-icon'
|
||||
], [
|
||||
'key' => 'settings',
|
||||
'name' => 'admin::app.layouts.settings',
|
||||
'route' => 'admin.locales.index',
|
||||
'sort' => 6,
|
||||
'icon-class' => 'settings-icon',
|
||||
'icon-class' => 'settings-icon'
|
||||
], [
|
||||
'key' => 'settings.locales',
|
||||
'name' => 'admin::app.layouts.locales',
|
||||
'route' => 'admin.locales.index',
|
||||
'sort' => 1,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'settings.currencies',
|
||||
'name' => 'admin::app.layouts.currencies',
|
||||
'route' => 'admin.currencies.index',
|
||||
'sort' => 2,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'settings.exchange_rates',
|
||||
'name' => 'admin::app.layouts.exchange-rates',
|
||||
'route' => 'admin.exchange_rates.index',
|
||||
'sort' => 3,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'settings.inventory_sources',
|
||||
'name' => 'admin::app.layouts.inventory-sources',
|
||||
'route' => 'admin.inventory_sources.index',
|
||||
'sort' => 4,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'settings.channels',
|
||||
'name' => 'admin::app.layouts.channels',
|
||||
'route' => 'admin.channels.index',
|
||||
'sort' => 5,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'settings.users',
|
||||
'name' => 'admin::app.layouts.users',
|
||||
'route' => 'admin.users.index',
|
||||
'sort' => 6,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'settings.users.users',
|
||||
'name' => 'admin::app.layouts.users',
|
||||
'route' => 'admin.users.index',
|
||||
'sort' => 1,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'settings.users.roles',
|
||||
'name' => 'admin::app.layouts.roles',
|
||||
'route' => 'admin.roles.index',
|
||||
'sort' => 2,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'settings.sliders',
|
||||
'name' => 'admin::app.layouts.sliders',
|
||||
'route' => 'admin.sliders.index',
|
||||
'sort' => 7,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'settings.taxes',
|
||||
'name' => 'admin::app.layouts.taxes',
|
||||
'route' => 'admin.tax-categories.index',
|
||||
'sort' => 8,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'settings.taxes.tax-categories',
|
||||
'name' => 'admin::app.layouts.tax-categories',
|
||||
'route' => 'admin.tax-categories.index',
|
||||
'sort' => 1,
|
||||
'icon-class' => '',
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'settings.taxes.tax-rates',
|
||||
'name' => 'admin::app.layouts.tax-rates',
|
||||
'route' => 'admin.tax-rates.index',
|
||||
'sort' => 2,
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'promotions',
|
||||
'name' => 'admin::app.layouts.promotion',
|
||||
'route' => 'admin.cart-rule.index',
|
||||
'sort' => 5,
|
||||
'icon-class' => 'promotion-icon'
|
||||
], [
|
||||
'key' => 'promotions.cart-rule',
|
||||
'name' => 'admin::app.promotion.cart-rule',
|
||||
'route' => 'admin.cart-rule.index',
|
||||
'sort' => 1,
|
||||
'icon-class' => ''
|
||||
], [
|
||||
'key' => 'promotions.catalog-rule',
|
||||
'name' => 'admin::app.promotion.catalog-rule',
|
||||
'route' => 'admin.catalog-rule.index',
|
||||
'sort' => 1,
|
||||
'icon-class' => '',
|
||||
], [
|
||||
'key' => 'cms',
|
||||
'name' => 'admin::app.layouts.cms',
|
||||
'route' => 'admin.cms.index',
|
||||
'sort' => 6,
|
||||
'icon-class' => 'cms-icon'
|
||||
], [
|
||||
'key' => 'cms.pages',
|
||||
'name' => 'admin::app.cms.pages.pages',
|
||||
'route' => 'admin.cms.index',
|
||||
'sort' => 1,
|
||||
'icon-class' => ''
|
||||
]
|
||||
];
|
||||
|
|
@ -8,7 +8,7 @@ return [
|
|||
], [
|
||||
'key' => 'catalog.products',
|
||||
'name' => 'admin::app.admin.system.products',
|
||||
'sort' => 1,
|
||||
'sort' => 2
|
||||
], [
|
||||
'key' => 'catalog.products.review',
|
||||
'name' => 'admin::app.admin.system.review',
|
||||
|
|
@ -20,6 +20,22 @@ return [
|
|||
'type' => 'boolean'
|
||||
]
|
||||
]
|
||||
], [
|
||||
'key' => 'catalog.inventory',
|
||||
'name' => 'admin::app.admin.system.inventory',
|
||||
'sort' => 1,
|
||||
], [
|
||||
'key' => 'catalog.inventory.stock_options',
|
||||
'name' => 'admin::app.admin.system.stock-options',
|
||||
'sort' => 1,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'backorders',
|
||||
'title' => 'admin::app.admin.system.allow-backorders',
|
||||
'type' => 'boolean',
|
||||
'channel_based' => true
|
||||
]
|
||||
]
|
||||
], [
|
||||
'key' => 'customer',
|
||||
'name' => 'admin::app.admin.system.customer',
|
||||
|
|
@ -41,5 +57,89 @@ return [
|
|||
'channel_based' => true
|
||||
]
|
||||
]
|
||||
]
|
||||
], [
|
||||
'key' => 'customer.settings.newsletter',
|
||||
'name' => 'admin::app.admin.system.newsletter',
|
||||
'sort' => 2,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'subscription',
|
||||
'title' => 'admin::app.admin.system.newsletter-subscription',
|
||||
'type' => 'boolean',
|
||||
]
|
||||
],
|
||||
], [
|
||||
'key' => 'customer.settings.email',
|
||||
'name' => 'admin::app.admin.system.email',
|
||||
'sort' => 3,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'verification',
|
||||
'title' => 'admin::app.admin.system.email-verification',
|
||||
'type' => 'boolean'
|
||||
]
|
||||
],
|
||||
], [
|
||||
'key' => 'general',
|
||||
'name' => 'admin::app.admin.system.general',
|
||||
'sort' => 4,
|
||||
], [
|
||||
'key' => 'general.general',
|
||||
'name' => 'admin::app.admin.system.general',
|
||||
'sort' => 1,
|
||||
], [
|
||||
'key' => 'general.general.locale_options',
|
||||
'name' => 'admin::app.admin.system.locale-options',
|
||||
'sort' => 1,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'weight_unit',
|
||||
'title' => 'admin::app.admin.system.weight-unit',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
[
|
||||
'title' => 'lbs',
|
||||
'value' => 'lbs'
|
||||
], [
|
||||
'title' => 'kgs',
|
||||
'value' => 'kgs'
|
||||
]
|
||||
],
|
||||
'channel_based' => true,
|
||||
]
|
||||
]
|
||||
],[
|
||||
'key' => 'general.content',
|
||||
'name' => 'admin::app.admin.system.content',
|
||||
'sort' => 2,
|
||||
], [
|
||||
'key' => 'general.content.footer',
|
||||
'name' => 'admin::app.admin.system.footer',
|
||||
'sort' => 1,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'footer_content',
|
||||
'title' => 'admin::app.admin.system.footer-content',
|
||||
'type' => 'text',
|
||||
'channel_based' => true,
|
||||
'locale_based' => true
|
||||
]
|
||||
]
|
||||
], [
|
||||
'key' => 'general.design',
|
||||
'name' => 'admin::app.admin.system.design',
|
||||
'sort' => 3,
|
||||
], [
|
||||
'key' => 'general.design.admin_logo',
|
||||
'name' => 'admin::app.admin.system.admin-logo',
|
||||
'sort' => 1,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'logo_image',
|
||||
'title' => 'admin::app.admin.system.logo-image',
|
||||
'type' => 'image',
|
||||
'channel_based' => true,
|
||||
]
|
||||
]
|
||||
],
|
||||
];
|
||||
|
|
@ -8,14 +8,14 @@ use DB;
|
|||
/**
|
||||
* AttributeDataGrid class
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class AttributeDataGrid extends DataGrid
|
||||
{
|
||||
protected $index = 'id'; //the column that needs to be treated as index column
|
||||
protected $index = 'id'; // column that needs to be treated as index column
|
||||
|
||||
protected $sortOrder = 'desc'; //asc or desc
|
||||
protected $sortOrder = 'desc'; // asc or desc
|
||||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
|
|
@ -128,12 +128,14 @@ class AttributeDataGrid extends DataGrid
|
|||
{
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', //use post only for redirects only
|
||||
'route' => 'admin.catalog.attributes.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', //use post only for requests other than redirects
|
||||
'route' => 'admin.catalog.attributes.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
|
|
@ -145,7 +147,8 @@ class AttributeDataGrid extends DataGrid
|
|||
'type' => 'delete',
|
||||
'action' => route('admin.catalog.attributes.massdelete'),
|
||||
'label' => 'Delete',
|
||||
'index' => 'admin_name',
|
||||
'method' => 'DELETE'
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ use DB;
|
|||
/**
|
||||
* AttributeFamilyDataGrid Class
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class AttributeFamilyDataGrid extends DataGrid
|
||||
{
|
||||
|
|
@ -57,12 +57,14 @@ class AttributeFamilyDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.catalog.families.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes and POST for rest
|
||||
'route' => 'admin.catalog.families.delete',
|
||||
// 'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use DB;
|
||||
|
||||
/**
|
||||
* CMSPagesDataGrid class
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CMSPageDataGrid extends DataGrid
|
||||
{
|
||||
protected $index = 'id'; //the column that needs to be treated as index column
|
||||
|
||||
protected $sortOrder = 'desc'; //asc or desc
|
||||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('cms_pages')->select('id', 'url_key', 'page_title', 'channel_id', 'locale_id');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$channels = app('Webkul\Core\Repositories\ChannelRepository');
|
||||
|
||||
$locales = app('Webkul\Core\Repositories\LocaleRepository');
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'label' => trans('admin::app.datagrid.id'),
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'url_key',
|
||||
'label' => trans('admin::app.datagrid.url-key'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'page_title',
|
||||
'label' => trans('admin::app.cms.pages.page-title'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'locale_id',
|
||||
'label' => trans('admin::app.cms.pages.locale'),
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($row) use($locales) {
|
||||
$localeCode = $locales->find($row->locale_id)->code;
|
||||
|
||||
return $row->locale_id.' ('. $localeCode. ')';
|
||||
}
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'channel_id',
|
||||
'label' => trans('admin::app.cms.pages.channel'),
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($row) use($channels) {
|
||||
$channelCode = $channels->find($row->channel_id)->name;
|
||||
|
||||
return $row->channel_id.' ('. $channelCode. ')';
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.cms.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.cms.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareMassActions()
|
||||
{
|
||||
$this->addMassAction([
|
||||
'type' => 'delete',
|
||||
'label' => 'Delete',
|
||||
'action' => route('admin.cms.mass-delete'),
|
||||
'method' => 'DELETE'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use DB;
|
||||
|
||||
/**
|
||||
* Cart Rule DataGrid class
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CartRuleDataGrid extends DataGrid
|
||||
{
|
||||
protected $index = 'id'; //the column that needs to be treated as index column
|
||||
|
||||
protected $sortOrder = 'desc'; //asc or desc
|
||||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('cart_rules')
|
||||
->select('id')
|
||||
->addSelect('id', 'name', 'starts_from', 'ends_till', 'priority', 'status', 'end_other_rules', 'action_type', 'disc_quantity', 'disc_threshold', 'use_coupon');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'label' => trans('admin::app.datagrid.id'),
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'name',
|
||||
'label' => trans('admin::app.datagrid.name'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'priority',
|
||||
'label' => trans('admin::app.datagrid.priority'),
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'status',
|
||||
'label' => trans('admin::app.datagrid.status'),
|
||||
'type' => 'boolean',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
if ($value->status == 1)
|
||||
return 'Active';
|
||||
else
|
||||
return 'In Active';
|
||||
}
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'end_other_rules',
|
||||
'label' => 'End Other Rules',
|
||||
'type' => 'boolean',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
if ($value->end_other_rules == 1)
|
||||
return 'True';
|
||||
else
|
||||
return 'False';
|
||||
}
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'action_type',
|
||||
'label' => 'Action Type',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
return config('pricerules.cart.actions')[$value->action_type];
|
||||
}
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'disc_quantity',
|
||||
'label' => 'Quantity',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'disc_threshold',
|
||||
'label' => 'Threshold',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'use_coupon',
|
||||
'label' => 'Use Coupon',
|
||||
'type' => 'boolean',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
if ($value->use_coupon == 1) {
|
||||
return 'True';
|
||||
} else {
|
||||
return 'False';
|
||||
}
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', //use post only for redirects only
|
||||
'route' => 'admin.cart-rule.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', //use post only for requests other than redirects
|
||||
'route' => 'admin.cart-rule.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareMassActions()
|
||||
{
|
||||
// $this->addMassAction([
|
||||
// 'type' => 'delete',
|
||||
// 'action' => route('admin.catalog.attributes.massdelete'),
|
||||
// 'label' => 'Delete',
|
||||
// 'method' => 'DELETE'
|
||||
// ]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use DB;
|
||||
|
||||
/**
|
||||
* Catalog Rule DataGrid class
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CatalogRuleDataGrid extends DataGrid
|
||||
{
|
||||
protected $index = 'id'; //the column that needs to be treated as index column
|
||||
|
||||
protected $sortOrder = 'desc'; //asc or desc
|
||||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('catalog_rules')
|
||||
->select('id')
|
||||
->addSelect('id', 'name', 'starts_from', 'ends_till', 'status', 'end_other_rules', 'action_code');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'label' => trans('admin::app.datagrid.id'),
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'name',
|
||||
'label' => trans('admin::app.datagrid.name'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'starts_from',
|
||||
'label' => trans('admin::app.datagrid.starts-from'),
|
||||
'type' => 'datetime',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'ends_till',
|
||||
'label' => trans('admin::app.datagrid.ends-till'),
|
||||
'type' => 'datetime',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'status',
|
||||
'label' => trans('admin::app.datagrid.status'),
|
||||
'type' => 'boolean',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
if ($value->status == 1)
|
||||
return 'True';
|
||||
else
|
||||
return 'False';
|
||||
}
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'end_other_rules',
|
||||
'label' => 'End Other Rules',
|
||||
'type' => 'boolean',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
if ($value->end_other_rules == 1)
|
||||
return 'True';
|
||||
else
|
||||
return 'False';
|
||||
}
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'action_code',
|
||||
'label' => 'Action Type',
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', //use post only for redirects only
|
||||
'route' => 'admin.catalog-rule.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', //use post only for requests other than redirects
|
||||
'route' => 'admin.catalog-rule.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareMassActions()
|
||||
{
|
||||
// $this->addMassAction([
|
||||
// 'type' => 'delete',
|
||||
// 'action' => route('admin.catalog.attributes.massdelete'),
|
||||
// 'label' => 'Delete',
|
||||
// 'method' => 'DELETE'
|
||||
// ]);
|
||||
}
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ class CategoryDataGrid extends DataGrid
|
|||
$this->addColumn([
|
||||
'index' => 'position',
|
||||
'label' => trans('admin::app.datagrid.position'),
|
||||
'type' => 'string',
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
|
|
@ -92,12 +92,14 @@ class CategoryDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.catalog.categories.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.catalog.categories.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
|
|||
|
|
@ -66,12 +66,14 @@ class ChannelDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.channels.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.channels.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use DB;
|
||||
|
||||
/**
|
||||
* Cart Rule DataGrid class
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CartRuleCouponsDataGrid extends DataGrid
|
||||
{
|
||||
protected $index = 'id'; //the column that needs to be treated as index column
|
||||
|
||||
protected $sortOrder = 'desc'; //asc or desc
|
||||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('cart_rules')
|
||||
->select('id')
|
||||
->addSelect('id', 'code', 'limit', 'usage_per_customer', 'usage_throttle');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'label' => trans('admin::app.datagrid.id'),
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'code',
|
||||
'label' => trans('admin::app.datagrid.code'),
|
||||
'type' => 'string',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'limit',
|
||||
'label' => trans('admin::app.datagrid.limit'),
|
||||
'type' => 'string',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'limit',
|
||||
'label' => trans('admin::app.datagrid.limit'),
|
||||
'type' => 'string',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'usage_per_customer',
|
||||
'label' => trans('admin::app.datagrid.usage-per-customer'),
|
||||
'type' => 'boolean',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function($value) {
|
||||
if ($value->end_other_rules == 1)
|
||||
return 'true';
|
||||
else
|
||||
return 'false';
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareActions()
|
||||
{
|
||||
}
|
||||
|
||||
public function prepareMassActions()
|
||||
{
|
||||
// $this->addMassAction([
|
||||
// 'type' => 'delete',
|
||||
// 'action' => route('admin.catalog.attributes.massdelete'),
|
||||
// 'label' => 'Delete',
|
||||
// 'method' => 'DELETE'
|
||||
// ]);
|
||||
}
|
||||
}
|
||||
|
|
@ -57,12 +57,14 @@ class CurrencyDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.currencies.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.currencies.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -21,12 +21,13 @@ class CustomerDataGrid extends DataGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('customers as custs')
|
||||
->addSelect('custs.id as customer_id', 'custs.email', 'cg.name')
|
||||
->addSelect(DB::raw('CONCAT(custs.first_name, " ", custs.last_name) as full_name'))->leftJoin('customer_groups as cg', 'custs.customer_group_id', '=', 'cg.id');
|
||||
$queryBuilder = DB::table('customers')
|
||||
->leftJoin('customer_groups', 'customers.customer_group_id', '=', 'customer_groups.id')
|
||||
->addSelect('customers.id as customer_id', 'customers.email', 'customer_groups.name', 'status')
|
||||
->addSelect(DB::raw('CONCAT(customers.first_name, " ", customers.last_name) as full_name'));
|
||||
|
||||
$this->addFilter('customer_id', 'custs.id');
|
||||
$this->addFilter('full_name', DB::raw('CONCAT(custs.first_name, " ", custs.last_name)'));
|
||||
$this->addFilter('customer_id', 'customers.id');
|
||||
$this->addFilter('full_name', DB::raw('CONCAT(customers.first_name, " ", customers.last_name)'));
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
|
@ -68,19 +69,73 @@ class CustomerDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'status',
|
||||
'label' => trans('admin::app.datagrid.status'),
|
||||
'type' => 'boolean',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($row) {
|
||||
if ($row->status == 1) {
|
||||
return 'Activated';
|
||||
} else {
|
||||
return 'Blocked';
|
||||
}
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.customer.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
'icon' => 'icon pencil-lg-icon',
|
||||
'title' => trans('admin::app.customers.customers.edit-help-title')
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.customer.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
'icon' => 'icon trash-icon',
|
||||
'title' => trans('admin::app.customers.customers.delete-help-title')
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Add Note',
|
||||
'method' => 'GET',
|
||||
'route' => 'admin.customer.note.create',
|
||||
'icon' => 'icon note-icon',
|
||||
'title' => trans('admin::app.customers.note.help-title')
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Customer Mass Action To Delete And Change Their
|
||||
*/
|
||||
public function prepareMassActions()
|
||||
{
|
||||
$this->addMassAction([
|
||||
'type' => 'delete',
|
||||
'label' => 'Delete',
|
||||
'action' => route('admin.customer.mass-delete'),
|
||||
'method' => 'PUT',
|
||||
]);
|
||||
|
||||
$this->addMassAction([
|
||||
'type' => 'update',
|
||||
'label' => 'Update Status',
|
||||
'action' => route('admin.customer.mass-update'),
|
||||
'method' => 'PUT',
|
||||
'options' => [
|
||||
'Active' => 1,
|
||||
'Inactive' => 0
|
||||
]
|
||||
]);
|
||||
|
||||
$this->enableMassAction = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ class CustomerGroupDataGrid extends DataGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('customer_groups')->addSelect('id', 'name');
|
||||
$queryBuilder = DB::table('customer_groups')->addSelect('id', 'code', 'name');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
|
@ -35,6 +35,15 @@ class CustomerGroupDataGrid extends DataGrid
|
|||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'code',
|
||||
'label' => 'Code',
|
||||
'type' => 'string',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'name',
|
||||
'label' => 'Name',
|
||||
|
|
@ -48,12 +57,14 @@ class CustomerGroupDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.groups.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.groups.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -20,12 +20,14 @@ class CustomerReviewDataGrid extends DataGrid
|
|||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('product_reviews as pr')
|
||||
->leftjoin('products_grid as pg', 'pr.product_id', '=', 'pg.id')
|
||||
->select('pr.id as product_review_id', 'pr.title', 'pr.comment', 'pg.name as product_name', 'pr.status as product_review_status');
|
||||
->leftjoin('product_flat as pf', 'pr.product_id', '=', 'pf.product_id')
|
||||
->select('pr.id as product_review_id', 'pr.title', 'pr.comment', 'pf.name as product_name', 'pr.status as product_review_status')
|
||||
->where('channel', core()->getCurrentChannelCode())
|
||||
->where('locale', app()->getLocale());
|
||||
|
||||
$this->addFilter('product_review_id', 'pr.id');
|
||||
$this->addFilter('product_review_status', 'pr.status');
|
||||
$this->addFilter('product_name', 'pg.name');
|
||||
$this->addFilter('product_name', 'pf.name');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
|
@ -91,12 +93,14 @@ class CustomerReviewDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.customer.review.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.customer.review.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -59,12 +59,14 @@ class ExchangeRatesDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.exchange_rates.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.exchange_rates.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']),
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
|
|||
|
|
@ -81,12 +81,14 @@ class InventorySourcesDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.inventory_sources.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.inventory_sources.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']),
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class LocalesDataGrid extends DataGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('locales')->addSelect('id', 'code', 'name');
|
||||
$queryBuilder = DB::table('locales')->addSelect('id', 'code', 'name', 'direction');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
|
@ -52,17 +52,28 @@ class LocalesDataGrid extends DataGrid
|
|||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'direction',
|
||||
'label' => trans('admin::app.datagrid.direction'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.locales.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.locales.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']),
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
|
|||
|
|
@ -63,12 +63,14 @@ class NewsLetterDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.customers.subscribers.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.customers.subscribers.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Exchange Rate']),
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ class OrderDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'View',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.sales.orders.view',
|
||||
'icon' => 'icon eye-icon'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ class OrderInvoicesDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'View',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.sales.invoices.view',
|
||||
'icon' => 'icon eye-icon'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ class OrderShipmentsDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'View',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.sales.shipments.view',
|
||||
'icon' => 'icon eye-icon'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -21,15 +21,19 @@ class ProductDataGrid extends DataGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('products_grid')
|
||||
->leftJoin('products', 'products_grid.product_id', '=', 'products.id')
|
||||
->leftJoin('attribute_families', 'products.attribute_family_id', '=', 'attribute_families.id')
|
||||
->select('products_grid.product_id as product_id', 'products_grid.sku as product_sku', 'products_grid.name as product_name', 'products.type as product_type', 'products_grid.status', 'products_grid.price', 'products_grid.quantity', 'attribute_families.name as attribute_family');
|
||||
$queryBuilder = DB::table('product_flat')
|
||||
->leftJoin('products', 'product_flat.product_id', '=', 'products.id')
|
||||
->leftJoin('attribute_families', 'products.attribute_family_id', '=', 'attribute_families.id')
|
||||
->leftJoin('product_inventories', 'product_flat.product_id', '=', 'product_inventories.product_id')
|
||||
->select('product_flat.product_id as product_id', 'product_flat.sku as product_sku', 'product_flat.name as product_name', 'products.type as product_type', 'product_flat.status', 'product_flat.price', 'attribute_families.name as attribute_family', DB::raw('SUM(product_inventories.qty) as quantity'))
|
||||
->where('channel', core()->getCurrentChannelCode())
|
||||
->where('locale', app()->getLocale())
|
||||
->groupBy('product_flat.product_id');
|
||||
|
||||
$this->addFilter('product_id', 'products_grid.product_id');
|
||||
$this->addFilter('product_name', 'products_grid.name');
|
||||
$this->addFilter('product_sku', 'products_grid.sku');
|
||||
$this->addFilter('status', 'products_grid.status');
|
||||
$this->addFilter('product_id', 'product_flat.product_id');
|
||||
$this->addFilter('product_name', 'product_flat.name');
|
||||
$this->addFilter('product_sku', 'product_flat.sku');
|
||||
$this->addFilter('status', 'product_flat.status');
|
||||
$this->addFilter('product_type', 'products.type');
|
||||
$this->addFilter('attribute_family', 'attribute_families.name');
|
||||
|
||||
|
|
@ -54,7 +58,6 @@ class ProductDataGrid extends DataGrid
|
|||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
// 'width' => '100px'
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
|
|
@ -114,19 +117,27 @@ class ProductDataGrid extends DataGrid
|
|||
'type' => 'number',
|
||||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'filterable' => false
|
||||
'filterable' => false,
|
||||
'wrapper' => function($value) {
|
||||
if (is_null($value->quantity))
|
||||
return 0;
|
||||
else
|
||||
return $value->quantity;
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.catalog.products.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.catalog.products.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||
'icon' => 'icon trash-icon'
|
||||
|
|
|
|||
|
|
@ -58,8 +58,16 @@ class RolesDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.roles.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.roles.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -61,12 +61,14 @@ class SliderDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.sliders.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.sliders.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -57,12 +57,14 @@ class TaxCategoryDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.tax-categories.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.tax-categories.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class TaxRateDataGrid extends DataGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('tax_rates')->addSelect('id', 'identifier', 'state', 'country', 'tax_rate');
|
||||
$queryBuilder = DB::table('tax_rates')->addSelect('id', 'identifier', 'state', 'country', 'zip_code', 'zip_from', 'zip_to', 'tax_rate');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
|
@ -62,10 +62,37 @@ class TaxRateDataGrid extends DataGrid
|
|||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'zip_code',
|
||||
'label' => trans('admin::app.configuration.tax-rates.zip_code'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'zip_from',
|
||||
'label' => trans('admin::app.configuration.tax-rates.zip_from'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'zip_to',
|
||||
'label' => trans('admin::app.configuration.tax-rates.zip_to'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'tax_rate',
|
||||
'label' => trans('admin::app.datagrid.tax-rate'),
|
||||
'type' => 'string',
|
||||
'type' => 'number',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
|
|
@ -75,12 +102,14 @@ class TaxRateDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.tax-rates.store',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.tax-rates.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -86,12 +86,14 @@ class UserDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET', // use GET request only for redirect purposes
|
||||
'route' => 'admin.users.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.users.delete',
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class Handler extends ExceptionHandler
|
|||
*/
|
||||
public function render($request, Exception $exception)
|
||||
{
|
||||
$path = $this->isAdminUri() ? 'admin' : 'shop';
|
||||
$path = 'admin';
|
||||
|
||||
if ($exception instanceof HttpException) {
|
||||
$statusCode = in_array($exception->getStatusCode(), [401, 403, 404, 503]) ? $exception->getStatusCode() : 500;
|
||||
|
|
|
|||
|
|
@ -2,13 +2,10 @@
|
|||
|
||||
namespace Webkul\Admin\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Admin\Facades\Configuration;
|
||||
use Webkul\Core\Repositories\CoreConfigRepository as CoreConfig;
|
||||
use Webkul\Core\Tree;
|
||||
use Webkul\Admin\Http\Requests\ConfigurationForm;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
|
|
@ -42,7 +39,7 @@ class ConfigurationController extends Controller
|
|||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Core\Repositories\CoreConfigRepository $coreConfig
|
||||
* @param \Webkul\Core\Repositories\CoreConfigRepository $coreConfig
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(CoreConfig $coreConfig)
|
||||
|
|
@ -98,32 +95,20 @@ class ConfigurationController extends Controller
|
|||
*/
|
||||
public function getDefaultConfigSlugs()
|
||||
{
|
||||
$slugs = [];
|
||||
|
||||
if (! request()->route('slug')) {
|
||||
$firstItem = current($this->configTree->items);
|
||||
$secondItem = current($firstItem['children']);
|
||||
|
||||
$temp = explode('.', $secondItem['key']);
|
||||
|
||||
$slugs = [
|
||||
'slug' => current($temp),
|
||||
'slug2' => end($temp)
|
||||
];
|
||||
} else {
|
||||
if (! request()->route('slug2')) {
|
||||
$secondItem = current($this->configTree->items[request()->route('slug')]['children']);
|
||||
|
||||
$temp = explode('.', $secondItem['key']);
|
||||
|
||||
$slugs = [
|
||||
'slug' => current($temp),
|
||||
'slug2' => end($temp)
|
||||
];
|
||||
}
|
||||
return $this->getSlugs($secondItem);
|
||||
}
|
||||
|
||||
return $slugs;
|
||||
if (! request()->route('slug2')) {
|
||||
$secondItem = current($this->configTree->items[request()->route('slug')]['children']);
|
||||
|
||||
return $this->getSlugs($secondItem);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -134,7 +119,7 @@ class ConfigurationController extends Controller
|
|||
*/
|
||||
public function store()
|
||||
{
|
||||
Event::fire('core.configuration.save.after');
|
||||
Event::fire('core.configuration.save.before');
|
||||
|
||||
$this->coreConfig->create(request()->all());
|
||||
|
||||
|
|
@ -160,4 +145,16 @@ class ConfigurationController extends Controller
|
|||
|
||||
return Storage::download($config['value']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $secondItem
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getSlugs($secondItem): array
|
||||
{
|
||||
$temp = explode('.', $secondItem['key']);
|
||||
|
||||
return ['slug' => current($temp), 'slug2' => end($temp)];
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,8 @@ use Webkul\Admin\Http\Controllers\Controller;
|
|||
use Webkul\Customer\Repositories\CustomerRepository as Customer;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository as CustomerGroup;
|
||||
use Webkul\Core\Repositories\ChannelRepository as Channel;
|
||||
use Webkul\Admin\Mail\NewCustomerNotification;
|
||||
use Mail;
|
||||
|
||||
/**
|
||||
* Customer controlller
|
||||
|
|
@ -45,13 +47,12 @@ class CustomerController extends Controller
|
|||
*/
|
||||
protected $channel;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Customer\Repositories\CustomerRepository as customer;
|
||||
* @param Webkul\Customer\Repositories\CustomerGroupRepository as customerGroup;
|
||||
* @param Webkul\Core\Repositories\ChannelRepository as Channel;
|
||||
* @return void
|
||||
* @param \Webkul\Customer\Repositories\CustomerRepository $customer
|
||||
* @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroup
|
||||
* @param \Webkul\Core\Repositories\ChannelRepository $channel
|
||||
*/
|
||||
public function __construct(Customer $customer, CustomerGroup $customerGroup, Channel $channel)
|
||||
{
|
||||
|
|
@ -84,7 +85,7 @@ class CustomerController extends Controller
|
|||
*/
|
||||
public function create()
|
||||
{
|
||||
$customerGroup = $this->customerGroup->all();
|
||||
$customerGroup = $this->customerGroup->findWhere([['code', '<>', 'guest']]);
|
||||
|
||||
$channelName = $this->channel->all();
|
||||
|
||||
|
|
@ -109,13 +110,19 @@ class CustomerController extends Controller
|
|||
|
||||
$data = request()->all();
|
||||
|
||||
$password = bcrypt(rand(100000,10000000));
|
||||
$password = rand(100000,10000000);
|
||||
|
||||
$data['password'] = $password;
|
||||
$data['password'] = bcrypt($password);
|
||||
|
||||
$data['is_verified'] = 1;
|
||||
|
||||
$this->customer->create($data);
|
||||
$customer = $this->customer->create($data);
|
||||
|
||||
try {
|
||||
Mail::queue(new NewCustomerNotification($customer, $password));
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Customer']));
|
||||
|
||||
|
|
@ -130,9 +137,9 @@ class CustomerController extends Controller
|
|||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$customer = $this->customer->findOneWhere(['id'=>$id]);
|
||||
$customer = $this->customer->findOrFail($id);
|
||||
|
||||
$customerGroup = $this->customerGroup->all();
|
||||
$customerGroup = $this->customerGroup->findWhere([['code', '<>', 'guest']]);
|
||||
|
||||
$channelName = $this->channel->all();
|
||||
|
||||
|
|
@ -153,7 +160,6 @@ class CustomerController extends Controller
|
|||
'first_name' => 'string|required',
|
||||
'last_name' => 'string|required',
|
||||
'gender' => 'required',
|
||||
'phone' => 'nullable|numeric|unique:customers,phone,'. $id,
|
||||
'email' => 'required|unique:customers,email,'. $id,
|
||||
'date_of_birth' => 'date|before:today'
|
||||
]);
|
||||
|
|
@ -173,10 +179,99 @@ class CustomerController extends Controller
|
|||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->customer->delete($id);
|
||||
$customer = $this->customer->findorFail($id);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Customer']));
|
||||
try {
|
||||
$this->customer->delete($id);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Customer']));
|
||||
|
||||
return response()->json(['message' => true], 200);
|
||||
} catch(\Exception $e) {
|
||||
session()->flash('error', trans('admin::app.response.delete-failed', ['name' => 'Customer']));
|
||||
}
|
||||
|
||||
return response()->json(['message' => false], 400);
|
||||
}
|
||||
|
||||
/**
|
||||
* To load the note taking screen for the customers
|
||||
*
|
||||
* @return view
|
||||
*/
|
||||
public function createNote($id)
|
||||
{
|
||||
$customer = $this->customer->find($id);
|
||||
|
||||
return view($this->_config['view'])->with('customer', $customer);
|
||||
}
|
||||
|
||||
/**
|
||||
* To store the response of the note in storage
|
||||
*
|
||||
* @return redirect
|
||||
*/
|
||||
public function storeNote()
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'notes' => 'string|nullable'
|
||||
]);
|
||||
|
||||
$customer = $this->customer->find(request()->input('_customer'));
|
||||
|
||||
$noteTaken = $customer->update([
|
||||
'notes' => request()->input('notes')
|
||||
]);
|
||||
|
||||
if ($noteTaken) {
|
||||
session()->flash('success', 'Note taken');
|
||||
} else {
|
||||
session()->flash('error', 'Note cannot be taken');
|
||||
}
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* To mass update the customer
|
||||
*
|
||||
* @return redirect
|
||||
*/
|
||||
public function massUpdate()
|
||||
{
|
||||
$customerIds = explode(',', request()->input('indexes'));
|
||||
$updateOption = request()->input('update-options');
|
||||
|
||||
foreach ($customerIds as $customerId) {
|
||||
$customer = $this->customer->find($customerId);
|
||||
|
||||
$customer->update([
|
||||
'status' => $updateOption
|
||||
]);
|
||||
}
|
||||
|
||||
session()->flash('success', trans('admin::app.customers.customers.mass-update-success'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To mass delete the customer
|
||||
*
|
||||
* @return redirect
|
||||
*/
|
||||
public function massDestroy()
|
||||
{
|
||||
$customerIds = explode(',', request()->input('indexes'));
|
||||
|
||||
foreach ($customerIds as $customerId) {
|
||||
$this->customer->deleteWhere([
|
||||
'id' => $customerId
|
||||
]);
|
||||
}
|
||||
|
||||
session()->flash('success', trans('admin::app.customers.customers.mass-destroy-success'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ use Webkul\Admin\Http\Controllers\Controller;
|
|||
use Webkul\Customer\Repositories\CustomerGroupRepository as CustomerGroup;
|
||||
|
||||
/**
|
||||
* CustomerGroup controlller
|
||||
* Customer Group controlller
|
||||
*
|
||||
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
|
|
@ -32,7 +32,7 @@ class CustomerGroupController extends Controller
|
|||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Customer\Repositories\CustomerGroupRepository as customerGroup;
|
||||
* @param \Webkul\Customer\Repositories\CustomerGroupRepository as customerGroup;
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(CustomerGroup $customerGroup)
|
||||
|
|
@ -72,7 +72,8 @@ class CustomerGroupController extends Controller
|
|||
public function store()
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'name' => 'string|required',
|
||||
'code' => ['required', 'unique:customer_groups,code', new \Webkul\Core\Contracts\Validations\Code],
|
||||
'name' => 'required',
|
||||
]);
|
||||
|
||||
$data = request()->all();
|
||||
|
|
@ -94,7 +95,7 @@ class CustomerGroupController extends Controller
|
|||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$group = $this->customerGroup->findOneWhere(['id'=>$id]);
|
||||
$group = $this->customerGroup->findOrFail($id);
|
||||
|
||||
return view($this->_config['view'], compact('group'));
|
||||
}
|
||||
|
|
@ -109,7 +110,8 @@ class CustomerGroupController extends Controller
|
|||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'name' => 'string|required',
|
||||
'code' => ['required', 'unique:customer_groups,code,' . $id, new \Webkul\Core\Contracts\Validations\Code],
|
||||
'name' => 'required',
|
||||
]);
|
||||
|
||||
$this->customerGroup->update(request()->all(), $id);
|
||||
|
|
@ -127,18 +129,24 @@ class CustomerGroupController extends Controller
|
|||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$group = $this->customerGroup->findOneByField('id', $id);
|
||||
$customerGroup = $this->customerGroup->findOrFail($id);
|
||||
|
||||
if ($group->is_user_defined == 0) {
|
||||
if ($customerGroup->is_user_defined == 0) {
|
||||
session()->flash('warning', trans('admin::app.customers.customers.group-default'));
|
||||
} else if (count($group->customer) > 0) {
|
||||
} else if (count($customerGroup->customer) > 0) {
|
||||
session()->flash('warning', trans('admin::app.response.customer-associate', ['name' => 'Customer Group']));
|
||||
} else {
|
||||
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Customer Group']));
|
||||
try {
|
||||
$this->customerGroup->delete($id);
|
||||
|
||||
$this->customerGroup->delete($id);
|
||||
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Customer Group']));
|
||||
|
||||
return response()->json(['message' => true], 200);
|
||||
} catch(\Exception $e) {
|
||||
session()->flash('error', trans('admin::app.response.delete-failed', ['name' => 'Customer Group']));
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
return response()->json(['message' => false], 400);
|
||||
}
|
||||
}
|
||||
|
|
@ -54,28 +54,28 @@ class DashboardController extends Controller
|
|||
* @var array
|
||||
*/
|
||||
protected $productInventory;
|
||||
|
||||
|
||||
/**
|
||||
* string object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $startDate;
|
||||
|
||||
|
||||
/**
|
||||
* string object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $lastStartDate;
|
||||
|
||||
|
||||
/**
|
||||
* string object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $endDate;
|
||||
|
||||
|
||||
/**
|
||||
* string object
|
||||
*
|
||||
|
|
@ -86,10 +86,10 @@ class DashboardController extends Controller
|
|||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Sales\Repositories\OrderRepository $order
|
||||
* @param Webkul\Sales\Repositories\OrderItemRepository $orderItem
|
||||
* @param Webkul\Customer\Repositories\CustomerRepository $customer
|
||||
* @param Webkul\Product\Repositories\ProductInventoryRepository $productInventory
|
||||
* @param \Webkul\Sales\Repositories\OrderRepository $order
|
||||
* @param \Webkul\Sales\Repositories\OrderItemRepository $orderItem
|
||||
* @param \Webkul\Customer\Repositories\CustomerRepository $customer
|
||||
* @param \Webkul\Product\Repositories\ProductInventoryRepository $productInventory
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
@ -131,47 +131,23 @@ class DashboardController extends Controller
|
|||
|
||||
$statistics = [
|
||||
'total_customers' => [
|
||||
'previous' => $previous = $this->customer->scopeQuery(function($query) {
|
||||
return $query->where('customers.created_at', '>=', $this->lastStartDate)
|
||||
->where('customers.created_at', '<=', $this->lastEndDate);
|
||||
})->count(),
|
||||
'current' => $current = $this->customer->scopeQuery(function($query) {
|
||||
return $query->where('customers.created_at', '>=', $this->startDate)
|
||||
->where('customers.created_at', '<=', $this->endDate);
|
||||
})->count(),
|
||||
'previous' => $previous = $this->getCustomersBetweenDates($this->lastStartDate, $this->lastEndDate)->count(),
|
||||
'current' => $current = $this->getCustomersBetweenDates($this->startDate, $this->endDate)->count(),
|
||||
'progress' => $this->getPercentageChange($previous, $current)
|
||||
],
|
||||
'total_orders' => [
|
||||
'previous' => $previous = $this->order->scopeQuery(function($query) {
|
||||
return $query->where('orders.created_at', '>=', $this->lastStartDate)
|
||||
->where('orders.created_at', '<=', $this->lastEndDate);
|
||||
})->count(),
|
||||
'current' => $current = $this->order->scopeQuery(function($query) {
|
||||
return $query->where('orders.created_at', '>=', $this->startDate)
|
||||
->where('orders.created_at', '<=', $this->endDate);
|
||||
})->count(),
|
||||
'previous' => $previous = $this->previousOrders()->count(),
|
||||
'current' => $current = $this->currentOrders()->count(),
|
||||
'progress' => $this->getPercentageChange($previous, $current)
|
||||
],
|
||||
'total_sales' => [
|
||||
'previous' => $previous = $this->order->scopeQuery(function($query) {
|
||||
return $query->where('orders.created_at', '>=', $this->lastStartDate)
|
||||
->where('orders.created_at', '<=', $this->lastEndDate);
|
||||
})->sum('base_grand_total'),
|
||||
'current' => $current = $this->order->scopeQuery(function($query) {
|
||||
return $query->where('orders.created_at', '>=', $this->startDate)
|
||||
->where('orders.created_at', '<=', $this->endDate);
|
||||
})->sum('base_grand_total'),
|
||||
'previous' => $previous = $this->previousOrders()->sum('base_grand_total'),
|
||||
'current' => $current = $this->currentOrders()->sum('base_grand_total'),
|
||||
'progress' => $this->getPercentageChange($previous, $current)
|
||||
],
|
||||
'avg_sales' => [
|
||||
'previous' => $previous = $this->order->scopeQuery(function($query) {
|
||||
return $query->where('orders.created_at', '>=', $this->lastStartDate)
|
||||
->where('orders.created_at', '<=', $this->lastEndDate);
|
||||
})->avg('base_grand_total'),
|
||||
'current' => $current = $this->order->scopeQuery(function($query) {
|
||||
return $query->where('orders.created_at', '>=', $this->startDate)
|
||||
->where('orders.created_at', '<=', $this->endDate);
|
||||
})->avg('base_grand_total'),
|
||||
'previous' => $previous = $this->previousOrders()->avg('base_grand_total'),
|
||||
'current' => $current = $this->currentOrders()->avg('base_grand_total'),
|
||||
'progress' => $this->getPercentageChange($previous, $current)
|
||||
],
|
||||
'top_selling_categories' => $this->getTopSellingCategories(),
|
||||
|
|
@ -180,15 +156,11 @@ class DashboardController extends Controller
|
|||
'stock_threshold' => $this->getStockThreshold(),
|
||||
];
|
||||
|
||||
|
||||
foreach (core()->getTimeInterval($this->startDate, $this->endDate) as $interval) {
|
||||
$statistics['sale_graph']['label'][] = $interval['start']->format('d M');
|
||||
|
||||
$total = $this->order->scopeQuery(function($query) use($interval) {
|
||||
return $query->where('orders.created_at', '>=', $interval['start'])
|
||||
->where('orders.created_at', '<=', $interval['end']);
|
||||
})->sum('base_grand_total');
|
||||
|
||||
$total = $this->getOrdersBetweenDate($interval['start'], $interval['end'])->sum('base_grand_total');
|
||||
|
||||
$statistics['sale_graph']['total'][] = $total;
|
||||
$statistics['sale_graph']['formated_total'][] = core()->formatBasePrice($total);
|
||||
}
|
||||
|
|
@ -283,11 +255,11 @@ class DashboardController extends Controller
|
|||
*/
|
||||
public function setStartEndDate()
|
||||
{
|
||||
$this->startDate = request()->get('start')
|
||||
$this->startDate = request()->get('start')
|
||||
? Carbon::createFromTimeString(request()->get('start') . " 00:00:01")
|
||||
: Carbon::createFromTimeString(Carbon::now()->subDays(30)->format('Y-m-d') . " 00:00:01");
|
||||
|
||||
$this->endDate = request()->get('end')
|
||||
$this->endDate = request()->get('end')
|
||||
? Carbon::createFromTimeString(request()->get('end') . " 23:59:59")
|
||||
: Carbon::now();
|
||||
|
||||
|
|
@ -300,4 +272,28 @@ class DashboardController extends Controller
|
|||
$this->lastStartDate->subDays($this->startDate->diffInDays($this->endDate));
|
||||
// $this->lastEndDate->subDays($this->lastStartDate->diffInDays($this->lastEndDate));
|
||||
}
|
||||
|
||||
private function previousOrders()
|
||||
{
|
||||
return $this->getOrdersBetweenDate($this->lastStartDate, $this->lastEndDate);
|
||||
}
|
||||
|
||||
private function currentOrders()
|
||||
{
|
||||
return $this->getOrdersBetweenDate($this->startDate, $this->endDate);
|
||||
}
|
||||
|
||||
private function getOrdersBetweenDate($start, $end)
|
||||
{
|
||||
return $this->order->scopeQuery(function ($query) use ($start, $end) {
|
||||
return $query->where('orders.created_at', '>=', $start)->where('orders.created_at', '<=', $end);
|
||||
});
|
||||
}
|
||||
|
||||
private function getCustomersBetweenDates($start, $end)
|
||||
{
|
||||
return $this->customer->scopeQuery(function ($query) use ($start, $end) {
|
||||
return $query->where('customers.created_at', '>=', $start)->where('customers.created_at', '<=', $end);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ use Excel;
|
|||
class ExportController extends Controller
|
||||
{
|
||||
protected $exportableGrids = [
|
||||
'OrderDataGrid', 'OrderInvoicesDataGrid', 'OrderShipmentsDataGrid', 'CustomerDataGrid', 'TaxRateDataGrid'
|
||||
'OrderDataGrid', 'OrderInvoicesDataGrid', 'OrderShipmentsDataGrid', 'CustomerDataGrid', 'TaxRateDataGrid', 'ProductDataGrid', 'CMSPageDataGrid'
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -37,6 +37,7 @@ class ExportController extends Controller
|
|||
public function export()
|
||||
{
|
||||
$criteria = request()->all();
|
||||
|
||||
$format = $criteria['format'];
|
||||
|
||||
$gridName = explode('\\', $criteria['gridName']);
|
||||
|
|
@ -44,36 +45,35 @@ class ExportController extends Controller
|
|||
|
||||
$proceed = false;
|
||||
|
||||
foreach($this->exportableGrids as $exportableGrid) {
|
||||
if(last($gridName) == $exportableGrid) {
|
||||
foreach ($this->exportableGrids as $exportableGrid) {
|
||||
if (last($gridName) == $exportableGrid) {
|
||||
$proceed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if($proceed) {
|
||||
$gridInstance = new $path;
|
||||
|
||||
$records = array();
|
||||
$records = $gridInstance->export();
|
||||
|
||||
if(count($records) == 0) {
|
||||
session()->flash('warning', trans('admin::app.export.no-records'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
if ($format == 'csv') {
|
||||
return Excel::download(new DataGridExport($records), last($gridName).'.csv');
|
||||
} else if($format == 'xls') {
|
||||
return Excel::download(new DataGridExport($records), last($gridName).'.xlsx');
|
||||
} else {
|
||||
session()->flash('warning', trans('admin::app.export.illegal-format'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
} else {
|
||||
if (! $proceed) {
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$gridInstance = new $path;
|
||||
$records = $gridInstance->export();
|
||||
|
||||
if (count($records) == 0) {
|
||||
session()->flash('warning', trans('admin::app.export.no-records'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
if ($format == 'csv') {
|
||||
return Excel::download(new DataGridExport($records), last($gridName).'.csv');
|
||||
}
|
||||
|
||||
if ($format == 'xls') {
|
||||
return Excel::download(new DataGridExport($records), last($gridName).'.xlsx');
|
||||
}
|
||||
|
||||
session()->flash('warning', trans('admin::app.export.illegal-format'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
|
@ -41,8 +41,8 @@ class InvoiceController extends Controller
|
|||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Sales\Repositories\OrderRepository $order
|
||||
* @param Webkul\Sales\Repositories\InvoiceRepository $invoice
|
||||
* @param \Webkul\Sales\Repositories\OrderRepository $order
|
||||
* @param \Webkul\Sales\Repositories\InvoiceRepository $invoice
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Invoice $invoice, Order $order)
|
||||
|
|
@ -75,7 +75,7 @@ class InvoiceController extends Controller
|
|||
*/
|
||||
public function create($orderId)
|
||||
{
|
||||
$order = $this->order->find($orderId);
|
||||
$order = $this->order->findOrFail($orderId);
|
||||
|
||||
return view($this->_config['view'], compact('order'));
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ class InvoiceController extends Controller
|
|||
*/
|
||||
public function store(Request $request, $orderId)
|
||||
{
|
||||
$order = $this->order->find($orderId);
|
||||
$order = $this->order->findOrFail($orderId);
|
||||
|
||||
if (! $order->canInvoice()) {
|
||||
session()->flash('error', trans('admin::app.sales.invoices.creation-error'));
|
||||
|
|
@ -132,7 +132,7 @@ class InvoiceController extends Controller
|
|||
*/
|
||||
public function view($id)
|
||||
{
|
||||
$invoice = $this->invoice->find($id);
|
||||
$invoice = $this->invoice->findOrFail($id);
|
||||
|
||||
return view($this->_config['view'], compact('invoice'));
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ class InvoiceController extends Controller
|
|||
*/
|
||||
public function print($id)
|
||||
{
|
||||
$invoice = $this->invoice->find($id);
|
||||
$invoice = $this->invoice->findOrFail($id);
|
||||
|
||||
$pdf = PDF::loadView('admin::sales.invoices.pdf', compact('invoice'))->setPaper('a4');
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class OrderController extends Controller
|
|||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Sales\Repositories\OrderRepository $order
|
||||
* @param \Webkul\Sales\Repositories\OrderRepository $order
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Order $order)
|
||||
|
|
@ -63,7 +63,7 @@ class OrderController extends Controller
|
|||
*/
|
||||
public function view($id)
|
||||
{
|
||||
$order = $this->order->find($id);
|
||||
$order = $this->order->findOrFail($id);
|
||||
|
||||
return view($this->_config['view'], compact('order'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ class ShipmentController extends Controller
|
|||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Sales\Repositories\ShipmentRepository $shipment
|
||||
* @param Webkul\Sales\Repositories\OrderRepository $order
|
||||
* @param Webkul\Sales\Repositories\OrderitemRepository $orderItem
|
||||
* @param \Webkul\Sales\Repositories\ShipmentRepository $shipment
|
||||
* @param \Webkul\Sales\Repositories\OrderRepository $order
|
||||
* @param \Webkul\Sales\Repositories\OrderitemRepository $orderItem
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
@ -89,7 +89,7 @@ class ShipmentController extends Controller
|
|||
*/
|
||||
public function create($orderId)
|
||||
{
|
||||
$order = $this->order->find($orderId);
|
||||
$order = $this->order->findOrFail($orderId);
|
||||
|
||||
if (! $order->channel || !$order->canShip()) {
|
||||
session()->flash('error', trans('admin::app.sales.shipments.creation-error'));
|
||||
|
|
@ -109,7 +109,7 @@ class ShipmentController extends Controller
|
|||
*/
|
||||
public function store(Request $request, $orderId)
|
||||
{
|
||||
$order = $this->order->find($orderId);
|
||||
$order = $this->order->findOrFail($orderId);
|
||||
|
||||
if (! $order->canShip()) {
|
||||
session()->flash('error', trans('admin::app.sales.shipments.order-error'));
|
||||
|
|
@ -149,6 +149,9 @@ class ShipmentController extends Controller
|
|||
{
|
||||
$valid = false;
|
||||
|
||||
if (! isset($data['shipment']['items']))
|
||||
return ;
|
||||
|
||||
foreach ($data['shipment']['items'] as $itemId => $inventorySource) {
|
||||
if ($qty = $inventorySource[$data['shipment']['source']]) {
|
||||
$orderItem = $this->orderItem->find($itemId);
|
||||
|
|
@ -182,7 +185,7 @@ class ShipmentController extends Controller
|
|||
*/
|
||||
public function view($id)
|
||||
{
|
||||
$shipment = $this->shipment->find($id);
|
||||
$shipment = $this->shipment->findOrFail($id);
|
||||
|
||||
return view($this->_config['view'], compact('shipment'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'view' => 'admin::dashboard.index'
|
||||
])->name('admin.dashboard.index');
|
||||
|
||||
//Customers Management Routes
|
||||
//Customer Management Routes
|
||||
Route::get('customers', 'Webkul\Admin\Http\Controllers\Customer\CustomerController@index')->defaults('_config', [
|
||||
'view' => 'admin::customers.index'
|
||||
])->name('admin.customer.index');
|
||||
|
|
@ -60,11 +60,23 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'view' => 'admin::customers.edit'
|
||||
])->name('admin.customer.edit');
|
||||
|
||||
Route::get('customers/note/{id}', 'Webkul\Admin\Http\Controllers\Customer\CustomerController@createNote')->defaults('_config',[
|
||||
'view' => 'admin::customers.note'
|
||||
])->name('admin.customer.note.create');
|
||||
|
||||
Route::put('customers/note/{id}', 'Webkul\Admin\Http\Controllers\Customer\CustomerController@storeNote')->defaults('_config',[
|
||||
'redirect' => 'admin.customer.index'
|
||||
])->name('admin.customer.note.store');
|
||||
|
||||
Route::put('customers/edit/{id}', 'Webkul\Admin\Http\Controllers\Customer\CustomerController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.customer.index'
|
||||
])->name('admin.customer.update');
|
||||
|
||||
Route::get('customers/delete/{id}', 'Webkul\Admin\Http\Controllers\Customer\CustomerController@destroy')->name('admin.customer.delete');
|
||||
Route::post('customers/delete/{id}', 'Webkul\Admin\Http\Controllers\Customer\CustomerController@destroy')->name('admin.customer.delete');
|
||||
|
||||
Route::post('customers/masssdelete', 'Webkul\Admin\Http\Controllers\Customer\CustomerController@massDestroy')->name('admin.customer.mass-delete');
|
||||
|
||||
Route::post('customers/masssupdate', 'Webkul\Admin\Http\Controllers\Customer\CustomerController@massUpdate')->name('admin.customer.mass-update');
|
||||
|
||||
Route::get('reviews', 'Webkul\Product\Http\Controllers\ReviewController@index')->defaults('_config',[
|
||||
'view' => 'admin::customers.reviews.index'
|
||||
|
|
@ -92,7 +104,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.customer.review.index'
|
||||
])->name('admin.customer.review.update');
|
||||
|
||||
Route::get('reviews/delete/{id}', 'Webkul\Product\Http\Controllers\ReviewController@destroy')->defaults('_config', [
|
||||
Route::post('reviews/delete/{id}', 'Webkul\Product\Http\Controllers\ReviewController@destroy')->defaults('_config', [
|
||||
'redirect' => 'admin.customer.review.index'
|
||||
])->name('admin.customer.review.delete');
|
||||
|
||||
|
|
@ -127,7 +139,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.groups.index'
|
||||
])->name('admin.groups.update');
|
||||
|
||||
Route::get('groups/delete/{id}', 'Webkul\Admin\Http\Controllers\Customer\CustomerGroupController@destroy')->name('admin.groups.delete');
|
||||
Route::post('groups/delete/{id}', 'Webkul\Admin\Http\Controllers\Customer\CustomerGroupController@destroy')->name('admin.groups.delete');
|
||||
|
||||
|
||||
// Sales Routes
|
||||
|
|
@ -186,7 +198,6 @@ Route::group(['middleware' => ['web']], function () {
|
|||
])->name('admin.sales.shipments.view');
|
||||
});
|
||||
|
||||
|
||||
// Catalog Routes
|
||||
Route::prefix('catalog')->group(function () {
|
||||
Route::get('/sync', 'Webkul\Product\Http\Controllers\ProductController@sync');
|
||||
|
|
@ -213,7 +224,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
])->name('admin.catalog.products.update');
|
||||
|
||||
//product delete
|
||||
Route::get('/products/delete/{id}', 'Webkul\Product\Http\Controllers\ProductController@destroy')->name('admin.catalog.products.delete');
|
||||
Route::post('/products/delete/{id}', 'Webkul\Product\Http\Controllers\ProductController@destroy')->name('admin.catalog.products.delete');
|
||||
|
||||
//product massaction
|
||||
Route::post('products/massaction', 'Webkul\Product\Http\Controllers\ProductController@massActionHandler')->name('admin.catalog.products.massaction');
|
||||
|
|
@ -233,6 +244,10 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'view' => 'admin::catalog.products.edit'
|
||||
])->name('admin.catalog.products.productlinksearch');
|
||||
|
||||
Route::get('/products/{id}/{attribute_id}', 'Webkul\Product\Http\Controllers\ProductController@download')->defaults('_config', [
|
||||
'view' => 'admin.catalog.products.edit'
|
||||
])->name('admin.catalog.products.file.download');
|
||||
|
||||
// Catalog Category Routes
|
||||
Route::get('/categories', 'Webkul\Category\Http\Controllers\CategoryController@index')->defaults('_config', [
|
||||
'view' => 'admin::catalog.categories.index'
|
||||
|
|
@ -254,7 +269,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.catalog.categories.index'
|
||||
])->name('admin.catalog.categories.update');
|
||||
|
||||
Route::get('/categories/delete/{id}', 'Webkul\Category\Http\Controllers\CategoryController@destroy')->name('admin.catalog.categories.delete');
|
||||
Route::post('/categories/delete/{id}', 'Webkul\Category\Http\Controllers\CategoryController@destroy')->name('admin.catalog.categories.delete');
|
||||
|
||||
|
||||
// Catalog Attribute Routes
|
||||
|
|
@ -278,7 +293,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.catalog.attributes.index'
|
||||
])->name('admin.catalog.attributes.update');
|
||||
|
||||
Route::get('/attributes/delete/{id}', 'Webkul\Attribute\Http\Controllers\AttributeController@destroy')->name('admin.catalog.attributes.delete');
|
||||
Route::post('/attributes/delete/{id}', 'Webkul\Attribute\Http\Controllers\AttributeController@destroy')->name('admin.catalog.attributes.delete');
|
||||
|
||||
Route::post('/attributes/massdelete', 'Webkul\Attribute\Http\Controllers\AttributeController@massDestroy')->name('admin.catalog.attributes.massdelete');
|
||||
|
||||
|
|
@ -303,7 +318,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.catalog.families.index'
|
||||
])->name('admin.catalog.families.update');
|
||||
|
||||
Route::get('/families/delete/{id}', 'Webkul\Attribute\Http\Controllers\AttributeFamilyController@destroy')->name('admin.catalog.families.delete');
|
||||
Route::post('/families/delete/{id}', 'Webkul\Attribute\Http\Controllers\AttributeFamilyController@destroy')->name('admin.catalog.families.delete');
|
||||
});
|
||||
|
||||
// User Routes
|
||||
|
|
@ -333,7 +348,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
])->name('admin.users.update');
|
||||
|
||||
//delete backend user
|
||||
Route::get('/users/delete/{id}', 'Webkul\User\Http\Controllers\UserController@destroy')->name('admin.users.delete');
|
||||
Route::post('/users/delete/{id}', 'Webkul\User\Http\Controllers\UserController@destroy')->name('admin.users.delete');
|
||||
|
||||
Route::post('/confirm/destroy', 'Webkul\User\Http\Controllers\UserController@destroySelf')->defaults('_config', [
|
||||
'redirect' => 'admin.users.index'
|
||||
|
|
@ -360,6 +375,8 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.roles.index'
|
||||
])->name('admin.roles.update');
|
||||
|
||||
Route::post('/roles/delete/{id}', 'Webkul\User\Http\Controllers\RoleController@destroy')->name('admin.roles.delete');
|
||||
|
||||
|
||||
// Locale Routes
|
||||
Route::get('/locales', 'Webkul\Core\Http\Controllers\LocaleController@index')->defaults('_config', [
|
||||
|
|
@ -382,7 +399,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.locales.index'
|
||||
])->name('admin.locales.update');
|
||||
|
||||
Route::get('/locales/delete/{id}', 'Webkul\Core\Http\Controllers\LocaleController@destroy')->name('admin.locales.delete');
|
||||
Route::post('/locales/delete/{id}', 'Webkul\Core\Http\Controllers\LocaleController@destroy')->name('admin.locales.delete');
|
||||
|
||||
|
||||
// Currency Routes
|
||||
|
|
@ -406,7 +423,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.currencies.index'
|
||||
])->name('admin.currencies.update');
|
||||
|
||||
Route::get('/currencies/delete/{id}', 'Webkul\Core\Http\Controllers\CurrencyController@destroy')->name('admin.currencies.delete');
|
||||
Route::post('/currencies/delete/{id}', 'Webkul\Core\Http\Controllers\CurrencyController@destroy')->name('admin.currencies.delete');
|
||||
|
||||
Route::post('/currencies/massdelete', 'Webkul\Core\Http\Controllers\CurrencyController@massDestroy')->name('admin.currencies.massdelete');
|
||||
|
||||
|
|
@ -428,11 +445,13 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'view' => 'admin::settings.exchange_rates.edit'
|
||||
])->name('admin.exchange_rates.edit');
|
||||
|
||||
Route::get('/exchange_rates/update-rates/{service}', 'Webkul\Core\Http\Controllers\ExchangeRateController@updateRates')->name('admin.exchange_rates.update-rates');
|
||||
|
||||
Route::put('/exchange_rates/edit/{id}', 'Webkul\Core\Http\Controllers\ExchangeRateController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.exchange_rates.index'
|
||||
])->name('admin.exchange_rates.update');
|
||||
|
||||
Route::get('/exchange_rates/delete/{id}', 'Webkul\Core\Http\Controllers\ExchangeRateController@destroy')->name('admin.exchange_rates.delete');
|
||||
Route::post('/exchange_rates/delete/{id}', 'Webkul\Core\Http\Controllers\ExchangeRateController@destroy')->name('admin.exchange_rates.delete');
|
||||
|
||||
|
||||
// Inventory Source Routes
|
||||
|
|
@ -456,7 +475,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.inventory_sources.index'
|
||||
])->name('admin.inventory_sources.update');
|
||||
|
||||
Route::get('/inventory_sources/delete/{id}', 'Webkul\Inventory\Http\Controllers\InventorySourceController@destroy')->name('admin.inventory_sources.delete');
|
||||
Route::post('/inventory_sources/delete/{id}', 'Webkul\Inventory\Http\Controllers\InventorySourceController@destroy')->name('admin.inventory_sources.delete');
|
||||
|
||||
// Channel Routes
|
||||
Route::get('/channels', 'Webkul\Core\Http\Controllers\ChannelController@index')->defaults('_config', [
|
||||
|
|
@ -479,7 +498,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.channels.index'
|
||||
])->name('admin.channels.update');
|
||||
|
||||
Route::get('/channels/delete/{id}', 'Webkul\Core\Http\Controllers\ChannelController@destroy')->name('admin.channels.delete');
|
||||
Route::post('/channels/delete/{id}', 'Webkul\Core\Http\Controllers\ChannelController@destroy')->name('admin.channels.delete');
|
||||
|
||||
|
||||
// Admin Profile route
|
||||
|
|
@ -489,21 +508,6 @@ Route::group(['middleware' => ['web']], function () {
|
|||
|
||||
Route::put('/account', 'Webkul\User\Http\Controllers\AccountController@update')->name('admin.account.update');
|
||||
|
||||
//API Authorizations
|
||||
// Route::get('/api/clients', 'Webkul\Admin\Http\Controllers\AuthorizationController@show')->defaults('_config', [
|
||||
// 'view' => 'admin::apiauth.client'
|
||||
// ])->name('admin.index.oauth.client');
|
||||
|
||||
// //view an OAuth API Client
|
||||
// Route::get('/api/clients/view/{id}', 'Webkul\Admin\Http\Controllers\AuthorizationController@view')->defaults('_config', [
|
||||
// 'view' => 'admin::apiauth.view'
|
||||
// ])->name('admin.view.oauth.client');
|
||||
|
||||
// //edit an OAuth API Client
|
||||
// Route::get('/api/clients/delete/{id}', 'Webkul\Admin\Http\Controllers\AuthorizationController@delete')->defaults('_config', [
|
||||
// 'view' => 'admin::apiauth.edit'
|
||||
// ])->name('admin.delete.oauth.client');
|
||||
|
||||
|
||||
// Admin Store Front Settings Route
|
||||
Route::get('/subscribers','Webkul\Core\Http\Controllers\SubscriptionController@index')->defaults('_config',[
|
||||
|
|
@ -511,7 +515,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
])->name('admin.customers.subscribers.index');
|
||||
|
||||
//destroy a newsletter subscription item
|
||||
Route::get('subscribers/delete/{id}', 'Webkul\Core\Http\Controllers\SubscriptionController@destroy')->name('admin.customers.subscribers.delete');
|
||||
Route::post('subscribers/delete/{id}', 'Webkul\Core\Http\Controllers\SubscriptionController@destroy')->name('admin.customers.subscribers.delete');
|
||||
|
||||
Route::get('subscribers/edit/{id}', 'Webkul\Core\Http\Controllers\SubscriptionController@edit')->defaults('_config', [
|
||||
'view' => 'admin::customers.subscribers.edit'
|
||||
|
|
@ -547,7 +551,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
])->name('admin.sliders.update');
|
||||
|
||||
//destroy a slider item
|
||||
Route::get('slider/delete/{id}', 'Webkul\Core\Http\Controllers\SliderController@destroy')->name('admin.sliders.delete');
|
||||
Route::post('slider/delete/{id}', 'Webkul\Core\Http\Controllers\SliderController@destroy')->name('admin.sliders.delete');
|
||||
|
||||
//tax routes
|
||||
Route::get('/tax-categories', 'Webkul\Tax\Http\Controllers\TaxController@index')->defaults('_config', [
|
||||
|
|
@ -572,7 +576,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.tax-categories.index'
|
||||
])->name('admin.tax-categories.update');
|
||||
|
||||
Route::get('/tax-categories/delete/{id}', 'Webkul\Tax\Http\Controllers\TaxCategoryController@destroy')->name('admin.tax-categories.delete');
|
||||
Route::post('/tax-categories/delete/{id}', 'Webkul\Tax\Http\Controllers\TaxCategoryController@destroy')->name('admin.tax-categories.delete');
|
||||
//tax category ends
|
||||
|
||||
|
||||
|
|
@ -597,7 +601,7 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'admin.tax-rates.index'
|
||||
])->name('admin.tax-rates.update');
|
||||
|
||||
Route::get('/tax-rates/delete/{id}', 'Webkul\Tax\Http\Controllers\TaxRateController@destroy')->name('admin.tax-rates.delete');
|
||||
Route::post('/tax-rates/delete/{id}', 'Webkul\Tax\Http\Controllers\TaxRateController@destroy')->name('admin.tax-rates.delete');
|
||||
|
||||
Route::post('/tax-rates/import', 'Webkul\Tax\Http\Controllers\TaxRateController@import')->defaults('_config', [
|
||||
'redirect' => 'admin.tax-rates.index'
|
||||
|
|
@ -607,6 +611,97 @@ Route::group(['middleware' => ['web']], function () {
|
|||
//DataGrid Export
|
||||
Route::post('admin/export', 'Webkul\Admin\Http\Controllers\ExportController@export')->name('admin.datagrid.export');
|
||||
|
||||
Route::prefix('promotion')->group(function () {
|
||||
Route::get('/catalog-rules', 'Webkul\Discount\Http\Controllers\CatalogRuleController@index')->defaults('_config', [
|
||||
'view' => 'admin::promotions.catalog-rule.index'
|
||||
])->name('admin.catalog-rule.index');
|
||||
|
||||
Route::get('/catalog-rules/create', 'Webkul\Discount\Http\Controllers\CatalogRuleController@create')->defaults('_config', [
|
||||
'view' => 'admin::promotions.catalog-rule.create'
|
||||
])->name('admin.catalog-rule.create');
|
||||
|
||||
Route::post('/catalog-rules/create', 'Webkul\Discount\Http\Controllers\CatalogRuleController@store')->defaults('_config', [
|
||||
'redirect' => 'admin.catalog-rule.index'
|
||||
])->name('admin.catalog-rule.store');
|
||||
|
||||
Route::get('/catalog-rules/edit/{id}', 'Webkul\Discount\Http\Controllers\CatalogRuleController@edit')->defaults('_config', [
|
||||
'view' => 'admin::promotions.catalog-rule.edit'
|
||||
])->name('admin.catalog-rule.edit');
|
||||
|
||||
Route::post('/catalog-rules/edit/{id}', 'Webkul\Discount\Http\Controllers\CatalogRuleController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.catalog-rule.index'
|
||||
])->name('admin.catalog-rule.update');
|
||||
|
||||
Route::get('/catalog-rules/apply', 'Webkul\Discount\Http\Controllers\CatalogRuleController@applyRules')->defaults('_config', [
|
||||
'view' => 'admin::promotions.catalog-rule.index'
|
||||
])->name('admin.catalog-rule.apply');
|
||||
|
||||
Route::post('/catalog-rules/delete/{id}', 'Webkul\Discount\Http\Controllers\CatalogRuleController@destroy')->name('admin.catalog-rule.delete');
|
||||
|
||||
Route::get('/catalog-rules/declutter', 'Webkul\Discount\Http\Controllers\CatalogRuleController@deClutter')->defaults('_config', [
|
||||
'redirect' => 'admin.catalog-rule.index'
|
||||
])->name('admin.catalog-rule.declut');
|
||||
|
||||
Route::post('fetch/options', 'Webkul\Discount\Http\Controllers\CatalogRuleController@fetchAttributeOptions')->name('admin.catalog-rule.options');
|
||||
|
||||
Route::get('cart-rules', 'Webkul\Discount\Http\Controllers\CartRuleController@index')->defaults('_config', [
|
||||
'view' => 'admin::promotions.cart-rule.index'
|
||||
])->name('admin.cart-rule.index');
|
||||
|
||||
Route::get('cart-rules/create', 'Webkul\Discount\Http\Controllers\CartRuleController@create')->defaults('_config', [
|
||||
'view' => 'admin::promotions.cart-rule.create'
|
||||
])->name('admin.cart-rule.create');
|
||||
|
||||
Route::post('cart-rules/store', 'Webkul\Discount\Http\Controllers\CartRuleController@store')->defaults('_config', [
|
||||
'redirect' => 'admin.cart-rule.index'
|
||||
])->name('admin.cart-rule.store');
|
||||
|
||||
Route::get('cart-rules/edit/{id}', 'Webkul\Discount\Http\Controllers\CartRuleController@edit')->defaults('_config', [
|
||||
'view' => 'admin::promotions.cart-rule.edit'
|
||||
])->name('admin.cart-rule.edit');
|
||||
|
||||
Route::post('cart-rules/update/{id}', 'Webkul\Discount\Http\Controllers\CartRuleController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.cart-rule.index'
|
||||
])->name('admin.cart-rule.update');
|
||||
|
||||
Route::post('cart-rules/delete/{id}', 'Webkul\Discount\Http\Controllers\CartRuleController@destroy')->name('admin.cart-rule.delete');
|
||||
});
|
||||
|
||||
Route::prefix('cms')->group(function () {
|
||||
Route::get('/', 'Webkul\CMS\Http\Controllers\Admin\PageController@index')->defaults('_config', [
|
||||
'view' => 'admin::cms.index'
|
||||
])->name('admin.cms.index');
|
||||
|
||||
Route::get('preview/{url_key}', 'Webkul\CMS\Http\Controllers\Admin\PageController@preview')->name('admin.cms.preview');
|
||||
|
||||
Route::get('create', 'Webkul\CMS\Http\Controllers\Admin\PageController@create')->defaults('_config', [
|
||||
'view' => 'admin::cms.create'
|
||||
])->name('admin.cms.create');
|
||||
|
||||
Route::post('create', 'Webkul\CMS\Http\Controllers\Admin\PageController@store')->defaults('_config', [
|
||||
'redirect' => 'admin.cms.index'
|
||||
])->name('admin.cms.store');
|
||||
|
||||
Route::get('update/{id}', 'Webkul\CMS\Http\Controllers\Admin\PageController@edit')->defaults('_config', [
|
||||
'view' => 'admin::cms.edit'
|
||||
])->name('admin.cms.edit');
|
||||
|
||||
Route::post('update/{id}', 'Webkul\CMS\Http\Controllers\Admin\PageController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.cms.index'
|
||||
])->name('admin.cms.update');
|
||||
|
||||
Route::post('/delete/{id}', 'Webkul\CMS\Http\Controllers\Admin\PageController@delete')->defaults('_config', [
|
||||
'redirect' => 'admin.cms.index'
|
||||
])->name('admin.cms.delete');
|
||||
|
||||
Route::post('/massdelete', 'Webkul\CMS\Http\Controllers\Admin\PageController@massDelete')->defaults('_config', [
|
||||
'redirect' => 'admin.cms.index'
|
||||
])->name('admin.cms.mass-delete');
|
||||
|
||||
// Route::post('/delete/{id}', 'Webkul\CMS\Http\Controllers\Admin\PageController@delete')->defaults('_config', [
|
||||
// 'redirect' => 'admin.cms.index'
|
||||
// ])->name('admin.cms.delete');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -4,8 +4,10 @@ namespace Webkul\Admin\Listeners;
|
|||
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Webkul\Admin\Mail\NewOrderNotification;
|
||||
use Webkul\Admin\Mail\NewAdminNotification;
|
||||
use Webkul\Admin\Mail\NewInvoiceNotification;
|
||||
use Webkul\Admin\Mail\NewShipmentNotification;
|
||||
use Webkul\Admin\Mail\NewInventorySourceNotification;
|
||||
|
||||
/**
|
||||
* Order event handler
|
||||
|
|
@ -18,17 +20,20 @@ class Order {
|
|||
/**
|
||||
* @param mixed $order
|
||||
*
|
||||
* Send new order confirmation mail to the customer
|
||||
* Send new order Mail to the customer and admin
|
||||
*/
|
||||
public function sendNewOrderMail($order)
|
||||
{
|
||||
try {
|
||||
Mail::send(new NewOrderNotification($order));
|
||||
Mail::queue(new NewOrderNotification($order));
|
||||
|
||||
Mail::queue(new NewAdminNotification($order));
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $invoice
|
||||
*
|
||||
|
|
@ -37,7 +42,10 @@ class Order {
|
|||
public function sendNewInvoiceMail($invoice)
|
||||
{
|
||||
try {
|
||||
Mail::send(new NewInvoiceNotification($invoice));
|
||||
if ($invoice->email_sent)
|
||||
return;
|
||||
|
||||
Mail::queue(new NewInvoiceNotification($invoice));
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
|
@ -51,7 +59,12 @@ class Order {
|
|||
public function sendNewShipmentMail($shipment)
|
||||
{
|
||||
try {
|
||||
Mail::send(new NewShipmentNotification($shipment));
|
||||
if ($shipment->email_sent)
|
||||
return;
|
||||
|
||||
Mail::queue(new NewShipmentNotification($shipment));
|
||||
|
||||
Mail::queue(new NewInventorySourceNotification($shipment));
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace Webkul\Admin\Listeners;
|
||||
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\Product\Repositories\ProductGridRepository;
|
||||
use Webkul\Product\Repositories\ProductFlatRepository;
|
||||
use Webkul\Product\Helpers\Price;
|
||||
|
||||
|
|
@ -38,196 +37,19 @@ class Product {
|
|||
*/
|
||||
protected $productGrid;
|
||||
|
||||
public function __construct(ProductRepository $product, ProductGridRepository $productGrid, ProductFlatRepository $productFlat, Price $price)
|
||||
public function __construct(
|
||||
ProductRepository $product,
|
||||
ProductFlatRepository $productFlat,
|
||||
Price $price
|
||||
)
|
||||
{
|
||||
$this->product = $product;
|
||||
|
||||
$this->productGrid = $productGrid;
|
||||
|
||||
$this->productFlat = $productFlat;
|
||||
|
||||
$this->price = $price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new entry in the product grid whenever a new product is created.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function afterProductCreated($product) {
|
||||
$result = $this->productCreated($product);
|
||||
|
||||
if ($result) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the product to the product as the product data grid instance
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function productCreated($product) {
|
||||
$gridObject = [
|
||||
'product_id' => $product->id,
|
||||
'sku' => $product->sku,
|
||||
'type' => $product->type,
|
||||
'attribute_family_name' => $product->toArray()['attribute_family']['name'],
|
||||
'name' => $product->name,
|
||||
'quantity' => 0,
|
||||
'status' => $product->status,
|
||||
'price' => $product->price
|
||||
];
|
||||
|
||||
$variants = [];
|
||||
|
||||
$found = $this->productGrid->findOneByField('product_id', $product->id);
|
||||
|
||||
//extra measure to stop duplicate entries
|
||||
if ($found == null) {
|
||||
$this->productGrid->create($gridObject);
|
||||
|
||||
if ($product->type == 'configurable') {
|
||||
$variants = $product->variants()->get();
|
||||
|
||||
foreach ($variants as $variant) {
|
||||
$variantObj = [
|
||||
'product_id' => $variant->id,
|
||||
'sku' => $variant->sku,
|
||||
'type' => $variant->type,
|
||||
'attribute_family_name' => $variant->toArray()['attribute_family']['name'],
|
||||
'name' => $variant->name,
|
||||
'quantity' => 0,
|
||||
'status' => $variant->status,
|
||||
'price' => $variant->price
|
||||
];
|
||||
|
||||
$this->productGrid->create($variantObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event before the product update
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
// public function beforeProductUpdate($productId) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Event handle for after.product.update
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function afterProductUpdate($product) {
|
||||
$result = $this->productUpdated($product);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This will be invoked from afterProductUpdate
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function productUpdated($product) {
|
||||
$productGridObject = $this->productGrid->findOneByField('product_id', $product->id);
|
||||
|
||||
if (! $productGridObject) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$gridObject = [
|
||||
'product_id' => $product->id,
|
||||
'sku' => $product->sku,
|
||||
'type' => $product->type,
|
||||
'attribute_family_name' => $product->toArray()['attribute_family']['name'],
|
||||
'name' => $product->name,
|
||||
'status' => $product->status,
|
||||
];
|
||||
|
||||
if ($product->type == 'configurable') {
|
||||
$gridObject['quantity'] = 0;
|
||||
$gridObject['price'] = 0;
|
||||
} else {
|
||||
$qty = 0;
|
||||
//inventories and inventory sources relation for the variants return empty or null collection objects only
|
||||
foreach ($product->inventories()->get() as $inventory_source) {
|
||||
$qty = $qty + $inventory_source->qty;
|
||||
}
|
||||
|
||||
$gridObject['quantity'] = $qty;
|
||||
$gridObject['price'] = $product->price;
|
||||
}
|
||||
|
||||
$this->productGrid->update($gridObject, $productGridObject->id);
|
||||
|
||||
if ($product->type == 'configurable') {
|
||||
$variants = $product->variants()->get();
|
||||
|
||||
foreach ($variants as $variant) {
|
||||
$variantObj = [
|
||||
'product_id' => $variant->id,
|
||||
'sku' => $variant->sku,
|
||||
'type' => $variant->type,
|
||||
'attribute_family_name' => $variant->toArray()['attribute_family']['name'],
|
||||
'name' => $variant->name,
|
||||
'status' => $variant->status,
|
||||
'price' => $variant->price,
|
||||
];
|
||||
|
||||
$qty = 0;
|
||||
|
||||
//inventories and inventory sources relation for the variants return empty or null collection objects only
|
||||
foreach ($variant->inventories()->get() as $inventory_source) {
|
||||
$qty = $qty + $inventory_source->qty;
|
||||
}
|
||||
|
||||
$variantObj['quantity'] = $qty;
|
||||
|
||||
$qty = 0;
|
||||
|
||||
$productGridVariant = $this->productGrid->findOneByField('product_id', $variant->id);
|
||||
|
||||
if (isset($productGridVariant)) {
|
||||
$this->productGrid->update($variantObj, $productGridVariant->id);
|
||||
} else {
|
||||
$variantObj = [
|
||||
'product_id' => $variant->id,
|
||||
'sku' => $variant->sku,
|
||||
'type' => $variant->type,
|
||||
'attribute_family_name' => $variant->toArray()['attribute_family']['name'],
|
||||
'name' => $variant->name,
|
||||
'status' => $variant->status,
|
||||
'price' => $variant->price,
|
||||
];
|
||||
|
||||
$qty = 0;
|
||||
|
||||
//inventories and inventory sources relation for the variants return empty or null collection objects only
|
||||
foreach ($variant->inventories()->get() as $inventory_source) {
|
||||
$qty = $qty + $inventory_source->qty;
|
||||
}
|
||||
|
||||
$variantObj['quantity'] = $qty;
|
||||
|
||||
$qty = 0;
|
||||
|
||||
$this->productGrid->create($variantObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manually invoke this function when you have created the products by importing or seeding or factory.
|
||||
*/
|
||||
|
|
@ -274,10 +96,4 @@ class Product {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function findRepeated() {
|
||||
//find if there is duplicacy in the products grid here
|
||||
}
|
||||
|
||||
public function syncFlat() {}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
/**
|
||||
* New Admin Mail class
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class NewAdminNotification extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* The order instance.
|
||||
*
|
||||
* @var Order
|
||||
*/
|
||||
public $order;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($order)
|
||||
{
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->to(env('ADMIN_MAIL_TO'))
|
||||
->subject(trans('shop::app.mail.order.subject'))
|
||||
->view('shop::emails.sales.new-admin-order');
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue