conflict resolve

This commit is contained in:
rahulcs0082 2021-04-27 19:24:04 +05:30
commit 3e3af212f4
991 changed files with 43852 additions and 15783 deletions

View File

@ -1,9 +1,10 @@
APP_NAME=Bagisto
APP_ENV=local
APP_VERSION=1.1.2
APP_VERSION=1.3.1
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_ADMIN_URL=admin
APP_TIMEZONE=Asia/Kolkata
APP_LOCALE=en
LOG_CHANNEL=stack
@ -56,9 +57,9 @@ TWITTER_CLIENT_ID=
TWITTER_CLIENT_SECRET=
TWITTER_CALLBACK_URL=https://yourhost.com/customer/social-login/twitter/callback
GOGGLE_CLIENT_ID=
GOGGLE_CLIENT_SECRET=
GOGGLE_CALLBACK_URL=https://yourhost.com/customer/social-login/google/callback
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_CALLBACK_URL=https://yourhost.com/customer/social-login/google/callback
LINKEDIN_CLIENT_ID=
LINKEDIN_CLIENT_SECRET=
@ -66,4 +67,4 @@ LINKEDIN_CALLBACK_URL=https://yourhost.com/customer/social-login/linkedin/callba
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_CALLBACK_URL=https://yourhost.com/customer/social-login/github/callback
GITHUB_CALLBACK_URL=https://yourhost.com/customer/social-login/github/callback

View File

@ -1,9 +1,10 @@
APP_NAME=Laravel
APP_ENV=local
APP_VERSION=1.1.2
APP_VERSION=1.3.1
APP_KEY=base64:G4KY3tUsTaY9ONo1n/QyJvVLQZdJDgbIkSJswFK01HE=
APP_DEBUG=true
APP_URL=http://localhost
APP_ADMIN_URL=admin
LOG_CHANNEL=stack
@ -42,4 +43,4 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
SHOP_MAIL_FROM=test@example.com
ADMIN_MAIL_TO=test@example.com
ADMIN_MAIL_TO=test@example.com

View File

@ -1,11 +1,10 @@
**BUGS:**
## Description
<!--- Please mention issue #id and use comma if your PR solves multiple issues -->
<!--- Please describe your changes in detail -->
>Please describe the issue that you solved if its not filed.
## How to test this
<!--- Please describe in detail how to test the changes made in this PR -->
>Otherwise please mention issue #id and use comma if your PR
>solves multiple issues.
**For things other than bugs:**
> Describe that thing in very short line, word limit is 200.
> Otherwise use **issue #id** if the issue was filed as **feature** request.
## Documentation
- [ ] My pull request requires a update on the documentation repository.
<!--- Please describe in detail what needs to be changed --->

View File

@ -4,8 +4,12 @@ on: [push, pull_request]
jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.3', '7.4', '8.0']
name: PHP ${{ matrix.php-versions }} test on ${{ matrix.operating-system }}
services:
mysql:
@ -23,13 +27,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Setup php
uses: shivammathur/setup-php@v1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
extensions: intl, curl, mbstring, openssl, pdo, pdo_mysql, tokenizer
php-version: ${{ matrix.php-versions }}
extensions: curl, gd, intl, mbstring, openssl, pdo, pdo_mysql, tokenizer, zip
- name: Set environment
- name: Set Environment
run: |
set -e
sed -i "s|^\(DB_HOST=\s*\).*$|\1127.0.0.1|" .env.testing
@ -37,25 +41,33 @@ jobs:
printf "the complete .env.testing ...\n\n"
cat .env.testing
- name: Composer install
- name: Composer Install
run: |
set -e
composer global require hirak/prestissimo
composer install --no-interaction --ansi --no-progress --no-suggest --optimize-autoloader
composer install --no-cache
- name: Migrate database
- name: Migrate Database
run: set -e && php artisan migrate --env=testing
- name: Execute unit tests
- name: Seed Database
run: set -e && php artisan db:seed --env=testing
- name: Vendor Publish
run: set -e && php artisan vendor:publish --all --force --env=testing
- name: Optimize Stuffs
run: set -e && php artisan optimize --env=testing
- name: Execute Unit Tests
run: set -e && vendor/bin/codecept run unit
- name: Execute functional tests
- name: Execute Functional Tests
run: set -e && vendor/bin/codecept run functional
- name: Execute trigger tests
- name: Execute Trigger Tests
run: set -e && vendor/bin/codecept run trigger
- name: Persist test artifacts
- name: Persist Test Artifacts
uses: actions/upload-artifact@v1
if: always()
with:

40
.gitignore vendored
View File

@ -1,26 +1,26 @@
.env
.idea
.php_cs.cache
.vscode
.vagrant
/data
/docker-compose-collection
/node_modules
/public/hot
/public/storage
/public/css
/public/js
/public/vendor
/public/themes
/public/fonts
/vendor
/.idea
/.vscode
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
/ignorables/*
yarn.lock
/node_modules
npm-debug.log
package-lock.json
/public/css
/public/fonts
/public/js
/public/hot
/public/storage
/public/themes
/public/vendor
/resources/lang/vendor
/storage/*.key
/storage/dcc-data/
/vendor
yarn.lock
.php_cs.cache
storage/*.key
/docker-compose-collection/
/resources/themes/velocity/*
yarn-error.log

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,17 @@
# CHANGELOG for v0.2.x
#### This changelog consists the bug & security fixes and new features being included in the releases listed below.
This changelog consists the bug & security fixes and new features being included in the releases listed below.
## **v0.2.0 (23th of December, 2019)** - *Release*
* #1955 [fixed] - Message need to be changed on mouse hover on cross symbol next to applied coupon.
* #1959 [fixed] - if admin has set the same condition twice, then catalog rule is not getting apply
* #1958 [fixed] - getting exception on front end, if action type is Buy x get y free in non couponable cart rule.
* #1957 [fixed] - if action type is Fixed Amount to Whole Cart, then apply to shipping option should get hide.
* #1955 [fixed] - Message need to be changed on mouse hover on cross symbol next to applied coupon.
* #1954 [fixed] - If any different tax category has been assigned to variants in configurable product, then while using tax category condition in cart rule, rule is not working properly.
* #1950 [fixed] - multiple catalog rule should not get get applied, if 1st one has been created as End Other Rules = yes
* #1950 [fixed] - multiple catalog rule should not get get applied, if 1st one has been created as End Other Rules = yes

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@
<a href="https://packagist.org/packages/bagisto/bagisto"><img src="https://poser.pugx.org/bagisto/bagisto/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/bagisto/bagisto"><img src="https://poser.pugx.org/bagisto/bagisto/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/bagisto/bagisto"><img src="https://poser.pugx.org/bagisto/bagisto/license.svg" alt="License"></a>
<a href="https://github.com/bagisto/bagisto/actions"><img src="https://github.com/bagisto/bagisto/workflows/CI/badge.svg" alt="Backers on Open Collective"></a>
<a href="#backers"><img src="https://opencollective.com/bagisto/backers/badge.svg" alt="Backers on Open Collective"></a>
<a href="#sponsors"><img src="https://opencollective.com/bagisto/sponsors/badge.svg" alt="Sponsors on Open Collective"></a>
</p>
@ -62,11 +63,9 @@ Take advantage of two of the hottest frameworks used in this project -- Laravel
### Requirements
* **OS**: Ubuntu 16.04 LTS or higher / Windows 7 or Higher (WampServer / XAMPP).
* **SERVER**: Apache 2 or NGINX.
* **RAM**: 3 GB or higher.
* **PHP**: 7.2.0 or higher.
* **Processor**: Clock Cycle 1 Ghz or higher.
* **PHP**: 7.3 or higher.
* **For MySQL users**: 5.7.23 or higher.
* **For MariaDB users**: 10.2.7 or Higher.
* **Node**: 8.11.3 LTS or higher.
@ -83,13 +82,7 @@ Take advantage of two of the hottest frameworks used in this project -- Laravel
##### b. Extract the contents of zip and execute the project in your browser:
~~~
http(s)://localhost/bagisto/public
~~~
or
~~~
http(s)://example.com/public
http(s)://example.com
~~~
**2. Or you can install Bagisto from your console.**
@ -97,7 +90,7 @@ http(s)://example.com/public
##### Execute these commands below, in order
~~~
1. composer create-project bagisto/bagisto-standard
1. composer create-project bagisto/bagisto
~~~
~~~
@ -164,4 +157,14 @@ Thank you to all our backers! 🙏
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/contribute/sponsor-7372/checkout" target="_blank"><img src="https://images.opencollective.com/static/images/become_sponsor.svg"></a>
<div>
<a href="https://opencollective.com/bagisto/contribute/sponsor-7372/checkout" target="_blank">
<img src="https://images.opencollective.com/static/images/become_sponsor.svg">
</a>
</div>
<kbd>
<a href="http://e.ventures/" target="_blank">
<img src="https://images.opencollective.com/e-ventures1/7d61db2/logo.png" height="75">
</a>
</kbd>

View File

@ -14,7 +14,7 @@ class Kernel extends HttpKernel
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Webkul\Core\Http\Middleware\CheckForMaintenanceMode::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,

View File

@ -13,7 +13,7 @@ class AuthServiceProvider extends ServiceProvider
* @var array
*/
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
// 'App\Model' => 'App\Policies\ModelPolicy',
];
/**

View File

@ -3,6 +3,8 @@
namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
@ -13,8 +15,8 @@ class EventServiceProvider extends ServiceProvider
* @var array
*/
// protected $listen = [
// 'App\Events\Event' => [
// 'App\Listeners\EventListener',
// Registered::class => [
// SendEmailVerificationNotification::class,
// ],
// ];
@ -26,7 +28,5 @@ class EventServiceProvider extends ServiceProvider
public function boot()
{
parent::boot();
//
}
}
}

View File

@ -14,7 +14,7 @@ class RouteServiceProvider extends ServiceProvider
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
// protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
@ -36,8 +36,6 @@ class RouteServiceProvider extends ServiceProvider
$this->mapApiRoutes();
$this->mapWebRoutes();
//
}
/**

View File

@ -1,57 +1,55 @@
{
"name": "bagisto/bagisto",
"description": "Bagisto Laravel ECommerce",
"description": "Bagisto Laravel E-Commerce",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.2.5",
"ext-curl": "*",
"ext-intl": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-pdo": "*",
"ext-pdo_mysql": "*",
"ext-tokenizer": "*",
"php": "^7.3|^8.0",
"algolia/algoliasearch-client-php": "^2.2",
"astrotomic/laravel-translatable": "^11.0.0",
"aws/aws-sdk-php": "^3.171",
"babenkoivan/elastic-scout-driver": "^1.1",
"bagistobrasil/bagisto-product-social-share": "^0.1.2",
"barryvdh/laravel-debugbar": "^3.1",
"barryvdh/laravel-dompdf": "0.8.6",
"doctrine/dbal": "2.9.2",
"barryvdh/laravel-dompdf": "^0.8",
"doctrine/dbal": "^2.9",
"enshrined/svg-sanitize": "^0.14.0",
"facade/ignition": "^2.3.6",
"fakerphp/faker": "^1.14",
"fideloper/proxy": "^4.2",
"flynsarmy/db-blade-compiler": "^5.5",
"fzaninotto/faker": "^1.9.1",
"guzzlehttp/guzzle": "~6.3",
"guzzlehttp/guzzle": "^7.0.1",
"intervention/image": "^2.4",
"intervention/imagecache": "^2.3",
"kalnoy/nestedset": "5.0.1",
"kalnoy/nestedset": "^5.0",
"khaled.alshamaa/ar-php": "^6.0.0",
"konekt/concord": "^1.2",
"laravel/framework": "^7.0",
"laravel/socialite": "^4.4",
"laravel/framework": "^8.0",
"laravel/legacy-factories": "^1.1",
"laravel/scout": "^8.0",
"laravel/socialite": "^5.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.0",
"maatwebsite/excel": "3.1.19",
"laravel/ui": "^3.0",
"maatwebsite/excel": "^3.1.26",
"paypal/paypal-checkout-sdk": "1.0.1",
"prettus/l5-repository": "^2.6",
"tymon/jwt-auth": "^1.0.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.1",
"codeception/codeception": "4.1.1",
"codeception/codeception": "^4.1",
"codeception/module-asserts": "^1.1",
"codeception/module-filesystem": "^1.0",
"codeception/module-laravel5": "^1.0",
"codeception/module-webdriver": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
"nunomaduro/collision": "^5.3",
"phpunit/phpunit": "^9.5"
},
"replace": {
"bagisto/laravel-user": "v0.1.0",
"bagisto/laravel-admin": "v0.1.0",
@ -73,42 +71,40 @@
"bagisto/laravel-paypal": "v0.1.0",
"bagisto/laravel-discount": "v0.1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/",
"Webkul\\User\\": "packages/Webkul/User/src",
"Webkul\\Admin\\": "packages/Webkul/Admin/src",
"Webkul\\Ui\\": "packages/Webkul/Ui/src",
"Webkul\\Category\\": "packages/Webkul/Category/src",
"Webkul\\Checkout\\": "packages/Webkul/Checkout/src",
"Webkul\\Attribute\\": "packages/Webkul/Attribute/src",
"Webkul\\Shop\\": "packages/Webkul/Shop/src",
"Webkul\\Core\\": "packages/Webkul/Core/src",
"Webkul\\Customer\\": "packages/Webkul/Customer/src",
"Webkul\\Inventory\\": "packages/Webkul/Inventory/src",
"Webkul\\Product\\": "packages/Webkul/Product/src",
"Webkul\\Theme\\": "packages/Webkul/Theme/src",
"Webkul\\Shipping\\": "packages/Webkul/Shipping/src",
"Webkul\\Payment\\": "packages/Webkul/Payment/src",
"Webkul\\Paypal\\": "packages/Webkul/Paypal/src",
"Webkul\\Sales\\": "packages/Webkul/Sales/src",
"Webkul\\Tax\\": "packages/Webkul/Tax/src",
"Webkul\\API\\": "packages/Webkul/API",
"Webkul\\CatalogRule\\": "packages/Webkul/CatalogRule/src",
"Webkul\\CartRule\\": "packages/Webkul/CartRule/src",
"Webkul\\Rule\\": "packages/Webkul/Rule/src",
"Webkul\\CMS\\": "packages/Webkul/CMS/src",
"Webkul\\Velocity\\": "packages/Webkul/Velocity/src",
"Webkul\\BookingProduct\\": "packages/Webkul/BookingProduct/src",
"Webkul\\SocialLogin\\": "packages/Webkul/SocialLogin/src"
}
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/",
"Webkul\\User\\": "packages/Webkul/User/src",
"Webkul\\Admin\\": "packages/Webkul/Admin/src",
"Webkul\\Ui\\": "packages/Webkul/Ui/src",
"Webkul\\Category\\": "packages/Webkul/Category/src",
"Webkul\\Checkout\\": "packages/Webkul/Checkout/src",
"Webkul\\Attribute\\": "packages/Webkul/Attribute/src",
"Webkul\\Shop\\": "packages/Webkul/Shop/src",
"Webkul\\Core\\": "packages/Webkul/Core/src",
"Webkul\\Customer\\": "packages/Webkul/Customer/src",
"Webkul\\Inventory\\": "packages/Webkul/Inventory/src",
"Webkul\\Product\\": "packages/Webkul/Product/src",
"Webkul\\Theme\\": "packages/Webkul/Theme/src",
"Webkul\\Shipping\\": "packages/Webkul/Shipping/src",
"Webkul\\Payment\\": "packages/Webkul/Payment/src",
"Webkul\\Paypal\\": "packages/Webkul/Paypal/src",
"Webkul\\Sales\\": "packages/Webkul/Sales/src",
"Webkul\\Tax\\": "packages/Webkul/Tax/src",
"Webkul\\API\\": "packages/Webkul/API",
"Webkul\\CatalogRule\\": "packages/Webkul/CatalogRule/src",
"Webkul\\CartRule\\": "packages/Webkul/CartRule/src",
"Webkul\\Rule\\": "packages/Webkul/Rule/src",
"Webkul\\CMS\\": "packages/Webkul/CMS/src",
"Webkul\\Velocity\\": "packages/Webkul/Velocity/src",
"Webkul\\BookingProduct\\": "packages/Webkul/BookingProduct/src",
"Webkul\\SocialLogin\\": "packages/Webkul/SocialLogin/src",
"Webkul\\DebugBar\\": "packages/Webkul/DebugBar/src",
"Webkul\\Marketing\\": "packages/Webkul/Marketing/src"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\Acceptance\\": "tests/acceptance/",
@ -117,26 +113,21 @@
"Tests\\Trigger\\": "tests/trigger/"
}
},
"extra": {
"laravel": {
"dont-discover": [
"barryvdh/laravel-debugbar",
"laravel/dusk"
]
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate",
"Webkul\\Core\\Events\\ComposerEvents::postCreateProject"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
@ -147,6 +138,13 @@
"vendor/bin/codecept run unit",
"vendor/bin/codecept run functional",
"vendor/bin/codecept run trigger"
],
"test-win": [
"@set -e",
"@php artisan migrate:fresh --env=testing",
"vendor\\bin\\codecept.bat run unit",
"vendor\\bin\\codecept.bat run functional",
"vendor\\bin\\codecept.bat run trigger"
]
},
"config": {
@ -156,4 +154,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}

5922
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -54,6 +54,18 @@ return [
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Admin URL
|--------------------------------------------------------------------------
|
| This URL suffix is used to define the admin url for example
| admin/ or backend/
|
*/
'admin_url' => env('APP_ADMIN_URL', 'admin'),
/*
|--------------------------------------------------------------------------
| Application Timezone
@ -116,7 +128,7 @@ return [
| Here you may specify the base currency code for your application.
|
*/
'currency' => env('APP_CURRENCY', 'USD'),
/*
@ -234,8 +246,6 @@ return [
//Laravel Maatwebsite
Maatwebsite\Excel\ExcelServiceProvider::class,
Barryvdh\Debugbar\ServiceProvider::class,
//Repository
Prettus\Repository\Providers\RepositoryServiceProvider::class,
Konekt\Concord\ConcordServiceProvider::class,
@ -251,6 +261,7 @@ return [
Webkul\Category\Providers\CategoryServiceProvider::class,
Webkul\Attribute\Providers\AttributeServiceProvider::class,
Webkul\Core\Providers\CoreServiceProvider::class,
Webkul\Core\Providers\EnvValidatorServiceProvider::class,
Webkul\Shop\Providers\ShopServiceProvider::class,
Webkul\Customer\Providers\CustomerServiceProvider::class,
Webkul\Inventory\Providers\InventoryServiceProvider::class,
@ -269,6 +280,8 @@ return [
Webkul\Velocity\Providers\VelocityServiceProvider::class,
Webkul\BookingProduct\Providers\BookingProductServiceProvider::class,
Webkul\SocialLogin\Providers\SocialLoginServiceProvider::class,
Webkul\DebugBar\Providers\DebugBarServiceProvider::class,
Webkul\Marketing\Providers\MarketingServiceProvider::class,
],
/*
@ -326,6 +339,9 @@ return [
'PDF' => Barryvdh\DomPDF\Facade::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'Concord' => Konekt\Concord\Facades\Concord::class,
'Helper' => Konekt\Concord\Facades\Helper::class
'Helper' => Konekt\Concord\Facades\Helper::class,
'Debugbar' => Barryvdh\Debugbar\Facade::class,
'ProductImage' => Webkul\Product\Facades\ProductImage::class,
'ProductVideo' => Webkul\Product\Facades\ProductVideo::class
],
];

View File

@ -28,7 +28,7 @@ return [
],
'admin-api' => [
'driver' => 'token',
'driver' => 'jwt',
'provider' => 'admins',
]
],

View File

@ -69,20 +69,8 @@ return [
],
'redis' => [
'client' => 'predis',
'clusters' => [
'default' => [
[
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
],
'driver' => 'redis',
'connection' => env('CACHE_CONNECTION', 'cache'),
],
],

View File

@ -1,6 +1,9 @@
<?php
return [
'convention' => Webkul\Core\CoreConvention::class,
'modules' => [
/**
* Example:
@ -9,21 +12,31 @@ return [
*
*/
\Webkul\Admin\Providers\ModuleServiceProvider::class,
\Webkul\API\Providers\ModuleServiceProvider::class,
\Webkul\Attribute\Providers\ModuleServiceProvider::class,
\Webkul\BookingProduct\Providers\ModuleServiceProvider::class,
\Webkul\CartRule\Providers\ModuleServiceProvider::class,
\Webkul\CatalogRule\Providers\ModuleServiceProvider::class,
\Webkul\Category\Providers\ModuleServiceProvider::class,
\Webkul\Checkout\Providers\ModuleServiceProvider::class,
\Webkul\Core\Providers\ModuleServiceProvider::class,
\Webkul\CMS\Providers\ModuleServiceProvider::class,
\Webkul\Customer\Providers\ModuleServiceProvider::class,
\Webkul\Inventory\Providers\ModuleServiceProvider::class,
\Webkul\Marketing\Providers\ModuleServiceProvider::class,
\Webkul\Payment\Providers\ModuleServiceProvider::class,
\Webkul\Paypal\Providers\ModuleServiceProvider::class,
\Webkul\Product\Providers\ModuleServiceProvider::class,
\Webkul\Rule\Providers\ModuleServiceProvider::class,
\Webkul\Sales\Providers\ModuleServiceProvider::class,
\Webkul\Tax\Providers\ModuleServiceProvider::class,
\Webkul\User\Providers\ModuleServiceProvider::class,
\Webkul\CatalogRule\Providers\ModuleServiceProvider::class,
\Webkul\CartRule\Providers\ModuleServiceProvider::class,
\Webkul\CMS\Providers\ModuleServiceProvider::class,
\Webkul\Velocity\Providers\ModuleServiceProvider::class,
\Webkul\Shipping\Providers\ModuleServiceProvider::class,
\Webkul\Shop\Providers\ModuleServiceProvider::class,
\Webkul\SocialLogin\Providers\ModuleServiceProvider::class,
\Webkul\Tax\Providers\ModuleServiceProvider::class,
\Webkul\Theme\Providers\ModuleServiceProvider::class,
\Webkul\Ui\Providers\ModuleServiceProvider::class,
\Webkul\User\Providers\ModuleServiceProvider::class,
\Webkul\Velocity\Providers\ModuleServiceProvider::class,
]
];

View File

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Str;
return [
/*
@ -112,7 +114,21 @@ return [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
'database' => env('REDIS_DEFAULT_DATABASE', '0'),
],
'cache' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_CACHE_DATABASE', '1'),
],
'session' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_SESSION_DATABASE', '2'),
],
],

View File

@ -16,7 +16,8 @@ return [
'enabled' => env('DEBUGBAR_ENABLED', null),
'except' => [
'telescope*'
'telescope*',
'horizon*',
],
/*
@ -33,10 +34,12 @@ return [
*/
'storage' => [
'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom
'driver' => 'file', // redis, file, pdo, socket, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
'provider' => '' // Instance of StorageInterface for custom driver
'provider' => '', // Instance of StorageInterface for custom driver
'hostname' => '127.0.0.1', // Hostname to use with the "socket" driver
'port' => 2304, // Port to use with the "socket" driver
],
/*
@ -123,6 +126,7 @@ return [
'config' => false, // Display config settings
'cache' => false, // Display cache events
'models' => true, // Display models
'livewire' => true, // Display Livewire (when available)
],
/*
@ -141,27 +145,29 @@ return [
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
'timeline' => false, // Add the queries to the timeline
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
'types' => ['SELECT'], // // workaround ['SELECT'] only. https://github.com/barryvdh/laravel-debugbar/issues/888 ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
'types' => ['SELECT'], // Deprecated setting, is always only SELECT
],
'hints' => true, // Show hints for common mistakes
'hints' => false, // Show hints for common mistakes
'show_copy' => false, // Show copy button next to the query
],
'mail' => [
'full_log' => false
'full_log' => false,
],
'views' => [
'data' => false, //Note: Can slow down the application, because the data can be quite large..
],
'route' => [
'label' => true // show complete route on bar
'label' => true, // show complete route on bar
],
'logs' => [
'file' => null
'file' => null,
],
'cache' => [
'values' => true // collect cache values
'values' => true, // collect cache values
],
],
@ -199,4 +205,14 @@ return [
| To override default domain, specify it as a non-empty value.
*/
'route_domain' => null,
/*
|--------------------------------------------------------------------------
| DebugBar theme
|--------------------------------------------------------------------------
|
| Switches between light and dark theme. If set to auto it will respect system preferences
| Possible values: auto, light, dark
*/
'theme' => 'auto',
];

View File

@ -0,0 +1,7 @@
<?php declare(strict_types=1);
return [
'hosts' => [
env('ELASTIC_HOST', 'localhost:9200'),
]
];

View File

@ -0,0 +1,5 @@
<?php declare(strict_types=1);
return [
'refresh_documents' => env('ELASTIC_SCOUT_DRIVER_REFRESH_DOCUMENTS', false),
];

View File

@ -3,7 +3,6 @@
use Maatwebsite\Excel\Excel;
return [
'exports' => [
/*
@ -24,6 +23,16 @@ return [
*/
'pre_calculate_formulas' => false,
/*
|--------------------------------------------------------------------------
| Enable strict null comparison
|--------------------------------------------------------------------------
|
| When enabling strict null comparison empty cells ('') will
| be added to the sheet.
*/
'strict_null_comparison' => false,
/*
|--------------------------------------------------------------------------
| CSV Settings
@ -40,23 +49,66 @@ return [
'include_separator_line' => false,
'excel_compatibility' => false,
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
'imports' => [
/*
|--------------------------------------------------------------------------
| Read Only
|--------------------------------------------------------------------------
|
| When dealing with imports, you might only be interested in the
| data that the sheet exists. By default we ignore all styles,
| however if you want to do some logic based on style data
| you can enable it by setting read_only to false.
|
*/
'read_only' => true,
'heading_row' => [
/*
|--------------------------------------------------------------------------
| Ignore Empty
|--------------------------------------------------------------------------
|
| When dealing with imports, you might be interested in ignoring
| rows that have null values or empty strings. By default rows
| containing empty strings or empty values are not ignored but can be
| ignored by enabling the setting ignore_empty to true.
|
*/
'ignore_empty' => false,
/*
|--------------------------------------------------------------------------
| Heading Row Formatter
|--------------------------------------------------------------------------
|
| Configure the heading row formatter.
| Available options: none|slug|custom
|
*/
/*
|--------------------------------------------------------------------------
| Heading Row Formatter
|--------------------------------------------------------------------------
|
| Configure the heading row formatter.
| Available options: none|slug|custom
|
*/
'heading_row' => [
'formatter' => 'slug',
],
@ -69,12 +121,33 @@ return [
|
*/
'csv' => [
'delimiter' => ',',
'enclosure' => '"',
'escape_character' => '\\',
'contiguous' => false,
'input_encoding' => 'UTF-8',
'delimiter' => ',',
'enclosure' => '"',
'escape_character' => '\\',
'contiguous' => false,
'input_encoding' => 'UTF-8',
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
/*
@ -82,9 +155,8 @@ return [
| Extension detector
|--------------------------------------------------------------------------
|
| Configure here which writer type should be used when
| the package needs to guess the correct type
| based on the extension alone.
| Configure here which writer/reader type should be used when the package
| needs to guess the correct type based on the extension alone.
|
*/
'extension_detector' => [
@ -116,39 +188,93 @@ return [
'pdf' => Excel::DOMPDF,
],
/*
|--------------------------------------------------------------------------
| Value Binder
|--------------------------------------------------------------------------
|
| PhpSpreadsheet offers a way to hook into the process of a value being
| written to a cell. In there some assumptions are made on how the
| value should be formatted. If you want to change those defaults,
| you can implement your own default value binder.
|
| Possible value binders:
|
| [x] Maatwebsite\Excel\DefaultValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
|
*/
'value_binder' => [
/*
|--------------------------------------------------------------------------
| Default Value Binder
|--------------------------------------------------------------------------
|
| PhpSpreadsheet offers a way to hook into the process of a value being
| written to a cell. In there some assumptions are made on how the
| value should be formatted. If you want to change those defaults,
| you can implement your own default value binder.
|
*/
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
],
'transactions' => [
'cache' => [
/*
|--------------------------------------------------------------------------
| Default cell caching driver
|--------------------------------------------------------------------------
|
| By default PhpSpreadsheet keeps all cell values in memory, however when
| dealing with large files, this might result into memory issues. If you
| want to mitigate that, you can configure a cell caching driver here.
| When using the illuminate driver, it will store each value in a the
| cache store. This can slow down the process, because it needs to
| store each value. You can use the "batch" store if you want to
| only persist to the store when the memory limit is reached.
|
| Drivers: memory|illuminate|batch
|
*/
'driver' => 'memory',
/*
|--------------------------------------------------------------------------
| Transaction Handler
| Batch memory caching
|--------------------------------------------------------------------------
|
| By default the import is wrapped in a transaction. This is useful
| for when an import may fail and you want to retry it. With the
| transactions, the previous import gets rolled-back.
|
| You can disable the transaction handler by setting this to null.
| Or you can choose a custom made transaction handler here.
|
| Supported handlers: null|db
| When dealing with the "batch" caching driver, it will only
| persist to the store when the memory limit is reached.
| Here you can tweak the memory limit to your liking.
|
*/
'batch' => [
'memory_limit' => 60000,
],
/*
|--------------------------------------------------------------------------
| Illuminate cache
|--------------------------------------------------------------------------
|
| When using the "illuminate" caching driver, it will automatically use
| your default cache store. However if you prefer to have the cell
| cache on a separate store, you can configure the store name here.
| You can use any store defined in your cache config. When leaving
| at "null" it will use the default store.
|
*/
'illuminate' => [
'store' => null,
],
],
/*
|--------------------------------------------------------------------------
| Transaction Handler
|--------------------------------------------------------------------------
|
| By default the import is wrapped in a transaction. This is useful
| for when an import may fail and you want to retry it. With the
| transactions, the previous import gets rolled-back.
|
| You can disable the transaction handler by setting this to null.
| Or you can choose a custom made transaction handler here.
|
| Supported handlers: null|db
|
*/
'transactions' => [
'handler' => 'db',
],
@ -163,7 +289,7 @@ return [
| storing reading or downloading. Here you can customize that path.
|
*/
'local_path' => sys_get_temp_dir(),
'local_path' => storage_path('framework/laravel-excel'),
/*
|--------------------------------------------------------------------------
@ -179,8 +305,24 @@ return [
| in conjunction with queued imports and exports.
|
*/
'remote_disk' => null,
'remote_prefix' => null,
'remote_disk' => null,
'remote_prefix' => null,
/*
|--------------------------------------------------------------------------
| Force Resync
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup as above, it's possible
| for the clean up that occurs after entire queue has been run to only
| cleanup the server that the last AfterImportJob runs on. The rest of the server
| would still have the local temporary file stored on it. In this case your
| local storage limits can be exceeded and future imports won't be processed.
| To mitigate this you can set this config value to be true, so that after every
| queued chunk is processed the local temporary file is deleted on the server that
| processed it.
|
*/
'force_resync_remote' => null,
],
];

50
config/flare.php Normal file
View File

@ -0,0 +1,50 @@
<?php
return [
/*
|
|--------------------------------------------------------------------------
| Flare API key
|--------------------------------------------------------------------------
|
| Specify Flare's API key below to enable error reporting to the service.
|
| More info: https://flareapp.io/docs/general/projects
|
*/
'key' => env('FLARE_KEY'),
/*
|--------------------------------------------------------------------------
| Reporting Options
|--------------------------------------------------------------------------
|
| These options determine which information will be transmitted to Flare.
|
*/
'reporting' => [
'anonymize_ips' => true,
'collect_git_information' => false,
'report_queries' => true,
'maximum_number_of_collected_queries' => 200,
'report_query_bindings' => true,
'report_view_data' => true,
'grouping_type' => null,
'report_logs' => true,
'maximum_number_of_collected_logs' => 200,
],
/*
|--------------------------------------------------------------------------
| Reporting Log statements
|--------------------------------------------------------------------------
|
| If this setting is `false` log statements won't be send as events to Flare,
| no matter which error level you specified in the Flare log channel.
|
*/
'send_logs_as_events' => true,
];

125
config/ignition.php Normal file
View File

@ -0,0 +1,125 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Editor
|--------------------------------------------------------------------------
|
| Choose your preferred editor to use when clicking any edit button.
|
| Supported: "phpstorm", "vscode", "vscode-insiders",
| "sublime", "atom", "nova"
|
*/
'editor' => env('IGNITION_EDITOR', 'phpstorm'),
/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Here you may specify which theme Ignition should use.
|
| Supported: "light", "dark", "auto"
|
*/
'theme' => env('IGNITION_THEME', 'light'),
/*
|--------------------------------------------------------------------------
| Sharing
|--------------------------------------------------------------------------
|
| You can share local errors with colleagues or others around the world.
| Sharing is completely free and doesn't require an account on Flare.
|
| If necessary, you can completely disable sharing below.
|
*/
'enable_share_button' => env('IGNITION_SHARING_ENABLED', true),
/*
|--------------------------------------------------------------------------
| Register Ignition commands
|--------------------------------------------------------------------------
|
| Ignition comes with an additional make command that lets you create
| new solution classes more easily. To keep your default Laravel
| installation clean, this command is not registered by default.
|
| You can enable the command registration below.
|
*/
'register_commands' => env('REGISTER_IGNITION_COMMANDS', false),
/*
|--------------------------------------------------------------------------
| Ignored Solution Providers
|--------------------------------------------------------------------------
|
| You may specify a list of solution providers (as fully qualified class
| names) that shouldn't be loaded. Ignition will ignore these classes
| and possible solutions provided by them will never be displayed.
|
*/
'ignored_solution_providers' => [
\Facade\Ignition\SolutionProviders\MissingPackageSolutionProvider::class,
],
/*
|--------------------------------------------------------------------------
| Runnable Solutions
|--------------------------------------------------------------------------
|
| Some solutions that Ignition displays are runnable and can perform
| various tasks. Runnable solutions are enabled when your app has
| debug mode enabled. You may also fully disable this feature.
|
*/
'enable_runnable_solutions' => env('IGNITION_ENABLE_RUNNABLE_SOLUTIONS', null),
/*
|--------------------------------------------------------------------------
| Remote Path Mapping
|--------------------------------------------------------------------------
|
| If you are using a remote dev server, like Laravel Homestead, Docker, or
| even a remote VPS, it will be necessary to specify your path mapping.
|
| Leaving one, or both of these, empty or null will not trigger the remote
| URL changes and Ignition will treat your editor links as local files.
|
| "remote_sites_path" is an absolute base path for your sites or projects
| in Homestead, Vagrant, Docker, or another remote development server.
|
| Example value: "/home/vagrant/Code"
|
| "local_sites_path" is an absolute base path for your sites or projects
| on your local computer where your IDE or code editor is running on.
|
| Example values: "/Users/<name>/Code", "C:\Users\<name>\Documents\Code"
|
*/
'remote_sites_path' => env('IGNITION_REMOTE_SITES_PATH', ''),
'local_sites_path' => env('IGNITION_LOCAL_SITES_PATH', ''),
/*
|--------------------------------------------------------------------------
| Housekeeping Endpoint Prefix
|--------------------------------------------------------------------------
|
| Ignition registers a couple of routes when it is enabled. Below you may
| specify a route prefix that will be used to host all internal links.
|
*/
'housekeeping_endpoint_prefix' => '_ignition',
];

View File

@ -66,6 +66,6 @@ return array(
|
*/
'lifetime' => 43200,
'lifetime' => 525600,
);

View File

@ -1,188 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Module Namespace
|--------------------------------------------------------------------------
|
| Default module namespace.
|
*/
'namespace' => 'Modules',
/*
|--------------------------------------------------------------------------
| Module Stubs
|--------------------------------------------------------------------------
|
| Default module stubs.
|
*/
'stubs' => [
'enabled' => false,
'path' => base_path() . '/vendor/nwidart/laravel-modules/src/Commands/stubs',
'files' => [
'start' => 'start.php',
'routes' => 'Http/routes.php',
'views/index' => 'Resources/views/index.blade.php',
'views/master' => 'Resources/views/layouts/master.blade.php',
'scaffold/config' => 'Config/config.php',
'composer' => 'composer.json',
'assets/js/app' => 'Resources/assets/js/app.js',
'assets/sass/app' => 'Resources/assets/sass/app.scss',
'webpack' => 'webpack.mix.js',
'package' => 'package.json',
],
'replacements' => [
'start' => ['LOWER_NAME', 'ROUTES_LOCATION'],
'routes' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
'webpack' => ['LOWER_NAME'],
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
'views/index' => ['LOWER_NAME'],
'views/master' => ['LOWER_NAME', 'STUDLY_NAME'],
'scaffold/config' => ['STUDLY_NAME'],
'composer' => [
'LOWER_NAME',
'STUDLY_NAME',
'VENDOR',
'AUTHOR_NAME',
'AUTHOR_EMAIL',
'MODULE_NAMESPACE',
],
],
'gitkeep' => true,
],
'paths' => [
/*
|--------------------------------------------------------------------------
| Modules path
|--------------------------------------------------------------------------
|
| This path used for save the generated module. This path also will be added
| automatically to list of scanned folders.
|
*/
'modules' => base_path('Modules'),
/*
|--------------------------------------------------------------------------
| Modules assets path
|--------------------------------------------------------------------------
|
| Here you may update the modules assets path.
|
*/
'assets' => public_path('modules'),
/*
|--------------------------------------------------------------------------
| The migrations path
|--------------------------------------------------------------------------
|
| Where you run 'module:publish-migration' command, where do you publish the
| the migration files?
|
*/
'migration' => base_path('database/migrations'),
/*
|--------------------------------------------------------------------------
| Generator path
|--------------------------------------------------------------------------
| Customise the paths where the folders will be generated.
| Set the generate key to false to not generate that folder
*/
'generator' => [
'config' => ['path' => 'Config', 'generate' => true],
'command' => ['path' => 'Console', 'generate' => true],
'migration' => ['path' => 'Database/Migrations', 'generate' => true],
'seeder' => ['path' => 'Database/Seeders', 'generate' => true],
'factory' => ['path' => 'Database/factories', 'generate' => true],
'model' => ['path' => 'Entities', 'generate' => true],
'controller' => ['path' => 'Http/Controllers', 'generate' => true],
'filter' => ['path' => 'Http/Middleware', 'generate' => true],
'request' => ['path' => 'Http/Requests', 'generate' => true],
'provider' => ['path' => 'Providers', 'generate' => true],
'assets' => ['path' => 'Resources/assets', 'generate' => true],
'lang' => ['path' => 'Resources/lang', 'generate' => true],
'views' => ['path' => 'Resources/views', 'generate' => true],
'test' => ['path' => 'Tests', 'generate' => true],
'repository' => ['path' => 'Repositories', 'generate' => false],
'event' => ['path' => 'Events', 'generate' => false],
'listener' => ['path' => 'Listeners', 'generate' => false],
'policies' => ['path' => 'Policies', 'generate' => false],
'rules' => ['path' => 'Rules', 'generate' => false],
'jobs' => ['path' => 'Jobs', 'generate' => false],
'emails' => ['path' => 'Emails', 'generate' => false],
'notifications' => ['path' => 'Notifications', 'generate' => false],
'resource' => ['path' => 'Transformers', 'generate' => false],
],
],
/*
|--------------------------------------------------------------------------
| Scan Path
|--------------------------------------------------------------------------
|
| Here you define which folder will be scanned. By default will scan vendor
| directory. This is useful if you host the package in packagist website.
|
*/
'scan' => [
'enabled' => false,
'paths' => [
base_path('vendor/*/*'),
],
],
/*
|--------------------------------------------------------------------------
| Composer File Template
|--------------------------------------------------------------------------
|
| Here is the config for composer.json file, generated by this package
|
*/
'composer' => [
'vendor' => 'nwidart',
'author' => [
'name' => 'Nicolas Widart',
'email' => 'n.widart@gmail.com',
],
],
/*
|--------------------------------------------------------------------------
| Caching
|--------------------------------------------------------------------------
|
| Here is the config for setting up caching feature.
|
*/
'cache' => [
'enabled' => false,
'key' => 'laravel-modules',
'lifetime' => 60,
],
/*
|--------------------------------------------------------------------------
| Choose what laravel-modules will register as custom namespaces.
| Setting one to false will require you to register that part
| in your own Service Provider class.
|--------------------------------------------------------------------------
*/
'register' => [
'translations' => true,
/**
* load files on boot or register method
*
* Note: boot not compatible with asgardcms
*
* @example boot|register
*/
'files' => 'register',
],
];

21
config/products.php Normal file
View File

@ -0,0 +1,21 @@
<?php
use Webkul\Product\Models\Product;
return [
// use the 'code' of the 'attributes' table here to be able to control which attributes
// should be skipped when doing a copy (admin->catalog->products->copy product).
// you can also add every relation that should not be copied here to skip them.
// defaults to none (which means everything is copied).
'skipAttributesOnCopy' => [
],
// Make the original and source product 'related' via the 'product_relations' table
'linkProductsOnCopy' => false,
// Ability to set a global callable that defines if a product is saleable.
// Return neither true nor false but null by default to not interrupt the default chain that
// defines if a product is saleable. It depends on the isSaleable() method of the product
// type if this callable is obeyed.
'isSaleable' => null,
];

View File

@ -169,7 +169,8 @@ return [
*/
'acceptedConditions' => [
'=',
'like'
'like',
'in'
],
/*
|--------------------------------------------------------------------------

91
config/scout.php Normal file
View File

@ -0,0 +1,91 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Search Engine
|--------------------------------------------------------------------------
|
| This option controls the default search connection that gets used while
| using Laravel Scout. This connection is used when syncing all models
| to the search service. You should adjust this based on your needs.
|
| Supported: "algolia", "null"
|
*/
'driver' => env('SCOUT_DRIVER', null),
/*
|--------------------------------------------------------------------------
| Index Prefix
|--------------------------------------------------------------------------
|
| Here you may specify a prefix that will be applied to all search index
| names used by Scout. This prefix may be useful if you have multiple
| "tenants" or applications sharing the same search infrastructure.
|
*/
'prefix' => env('SCOUT_PREFIX', ''),
/*
|--------------------------------------------------------------------------
| Queue Data Syncing
|--------------------------------------------------------------------------
|
| This option allows you to control if the operations that sync your data
| with your search engines are queued. When this is set to "true" then
| all automatic data syncing will get queued for better performance.
|
*/
'queue' => env('SCOUT_QUEUE', true),
/*
|--------------------------------------------------------------------------
| Chunk Sizes
|--------------------------------------------------------------------------
|
| These options allow you to control the maximum chunk size when you are
| mass importing data into the search engine. This allows you to fine
| tune each of these chunk sizes based on the power of the servers.
|
*/
'chunk' => [
'searchable' => 500,
'unsearchable' => 500,
],
/*
|--------------------------------------------------------------------------
| Soft Deletes
|--------------------------------------------------------------------------
|
| This option allows to control whether to keep soft deleted records in
| the search indexes. Maintaining soft deleted records can be useful
| if your application still needs to search for the records later.
|
*/
'soft_delete' => false,
/*
|--------------------------------------------------------------------------
| Algolia Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your Algolia settings. Algolia is a cloud hosted
| search engine which works great with Scout out of the box. Just plug
| in your application ID and admin API key to get started searching.
|
*/
'algolia' => [
'id' => env('ALGOLIA_APP_ID', ''),
'secret' => env('ALGOLIA_SECRET', ''),
],
];

View File

@ -70,7 +70,7 @@ return [
|
*/
'connection' => null,
'connection' => env('SESSION_CONNECTION', 'session'),
/*
|--------------------------------------------------------------------------
@ -96,7 +96,7 @@ return [
|
*/
'store' => null,
'store' => env('SESSION_STORE', NULL),
/*
|--------------------------------------------------------------------------

View File

@ -23,5 +23,15 @@ return [
'name' => 'Velocity',
'parent' => 'default'
],
],
'admin-default' => 'default',
'admin-themes' => [
'default' => [
'views_path' => 'resources/admin-themes/default/views',
'assets_path' => 'public/admin-themes/default/assets',
'name' => 'Default'
]
]
];

View File

@ -19,7 +19,7 @@ return [
/*
|--------------------------------------------------------------------------
| Alias Whitelist
| Auto Aliased Classes
|--------------------------------------------------------------------------
|
| Tinker will not automatically alias classes in your vendor namespaces
@ -34,7 +34,7 @@ return [
/*
|--------------------------------------------------------------------------
| Alias Blacklist
| Classes That Should Not Be Aliased
|--------------------------------------------------------------------------
|
| Typically, Tinker automatically aliases classes as you require them in

View File

@ -1,6 +1,16 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Blade File Tracer
|--------------------------------------------------------------------------
|
| Shows blade file path in front
|
*/
'tracer' => false,
/*
|--------------------------------------------------------------------------

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddColumnUrlPathToCategoryTranslations extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('category_translations', function (Blueprint $table) {
$table->string('url_path', 2048)
->comment('maintained by database triggers');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('category_translations', function (Blueprint $table) {
$table->dropColumn('url_path');
});
}
}

View File

@ -0,0 +1,70 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;
class AddStoredFunctionToGetUrlPathOfCategory extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$dbPrefix = DB::getTablePrefix();
$functionSQL = <<< SQL
DROP FUNCTION IF EXISTS `get_url_path_of_category`;
CREATE FUNCTION get_url_path_of_category(
categoryId INT,
localeCode VARCHAR(255)
)
RETURNS VARCHAR(255)
DETERMINISTIC
BEGIN
DECLARE urlPath VARCHAR(255);
-- Category with id 1 is root by default
IF categoryId <> 1
THEN
SELECT
GROUP_CONCAT(parent_translations.slug SEPARATOR '/') INTO urlPath
FROM
${dbPrefix}categories AS node,
${dbPrefix}categories AS parent
JOIN ${dbPrefix}category_translations AS parent_translations ON parent.id = parent_translations.category_id
WHERE
node._lft >= parent._lft
AND node._rgt <= parent._rgt
AND node.id = categoryId
AND parent.id <> 1
AND parent_translations.locale = localeCode
GROUP BY
node.id;
IF urlPath IS NULL
THEN
SET urlPath = (SELECT slug FROM ${dbPrefix}category_translations WHERE ${dbPrefix}category_translations.category_id = categoryId);
END IF;
ELSE
SET urlPath = '';
END IF;
RETURN urlPath;
END;
SQL;
DB::unprepared($functionSQL);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::unprepared('DROP FUNCTION IF EXISTS `get_url_path_of_category`;');
}
}

View File

@ -0,0 +1,103 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;
use Webkul\Category\Models\CategoryTranslation;
class AddTriggerToCategoryTranslations extends Migration
{
private const TRIGGER_NAME_INSERT = 'trig_category_translations_insert';
private const TRIGGER_NAME_UPDATE = 'trig_category_translations_update';
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$dbPrefix = DB::getTablePrefix();
$triggerBody = $this->getTriggerBody();
$insertTrigger = <<< SQL
CREATE TRIGGER %s
BEFORE INSERT ON ${dbPrefix}category_translations
FOR EACH ROW
BEGIN
$triggerBody
END;
SQL;
$updateTrigger = <<< SQL
CREATE TRIGGER %s
BEFORE UPDATE ON ${dbPrefix}category_translations
FOR EACH ROW
BEGIN
$triggerBody
END;
SQL;
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_INSERT));
DB::unprepared(sprintf($insertTrigger, self::TRIGGER_NAME_INSERT));
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_UPDATE));
DB::unprepared(sprintf($updateTrigger, self::TRIGGER_NAME_UPDATE));
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_INSERT));
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_UPDATE));
}
/**
* Returns trigger body as string
*
* @return string
*/
private function getTriggerBody()
{
$dbPrefix = DB::getTablePrefix();
return <<<SQL
DECLARE parentUrlPath varchar(255);
DECLARE urlPath varchar(255);
-- Category with id 1 is root by default
IF NEW.category_id <> 1
THEN
SELECT
GROUP_CONCAT(parent_translations.slug SEPARATOR '/') INTO parentUrlPath
FROM
${dbPrefix}categories AS node,
${dbPrefix}categories AS parent
JOIN ${dbPrefix}category_translations AS parent_translations ON parent.id = parent_translations.category_id
WHERE
node._lft >= parent._lft
AND node._rgt <= parent._rgt
AND node.id = (SELECT parent_id FROM categories WHERE id = NEW.category_id)
AND parent.id <> 1
AND parent_translations.locale = NEW.locale
GROUP BY
node.id;
IF parentUrlPath IS NULL
THEN
SET urlPath = NEW.slug;
ELSE
SET urlPath = concat(parentUrlPath, '/', NEW.slug);
END IF;
SET NEW.url_path = urlPath;
END IF;
SQL;
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;
use Webkul\Category\Models\CategoryTranslation;
class AddUrlPathToExistingCategoryTranslations extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$sqlStoredFunction = <<< SQL
SELECT get_url_path_of_category(:category_id, :locale_code) AS url_path;
SQL;
$categoryTranslationsTableName = app(CategoryTranslation::class)->getTable();
foreach (DB::table($categoryTranslationsTableName)->get() as $categoryTranslation) {
$urlPathQueryResult = DB::selectOne($sqlStoredFunction, [
'category_id' => $categoryTranslation->category_id,
'locale_code' => $categoryTranslation->locale,
]);
$url_path = $urlPathQueryResult ? $urlPathQueryResult->url_path : '';
DB::table($categoryTranslationsTableName)
->where('id', $categoryTranslation->id)
->update(['url_path' => $url_path]);
}
}
}

View File

@ -0,0 +1,102 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;
class AddTriggerToCategories extends Migration
{
private const TRIGGER_NAME_INSERT = 'trig_categories_insert';
private const TRIGGER_NAME_UPDATE = 'trig_categories_update';
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$triggerBody = $this->getTriggerBody();
$dbPrefix = DB::getTablePrefix();
$insertTrigger = <<< SQL
CREATE TRIGGER %s
AFTER INSERT ON ${dbPrefix}categories
FOR EACH ROW
BEGIN
$triggerBody
END;
SQL;
$updateTrigger = <<< SQL
CREATE TRIGGER %s
AFTER UPDATE ON ${dbPrefix}categories
FOR EACH ROW
BEGIN
$triggerBody
END;
SQL;
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_INSERT));
DB::unprepared(sprintf($insertTrigger, self::TRIGGER_NAME_INSERT));
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_UPDATE));
DB::unprepared(sprintf($updateTrigger, self::TRIGGER_NAME_UPDATE));
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_INSERT));
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_UPDATE));
}
/**
* Returns trigger body as string
*
* @return string
*/
private function getTriggerBody(): string
{
$dbPrefix = DB::getTablePrefix();
return <<< SQL
DECLARE urlPath VARCHAR(255);
DECLARE localeCode VARCHAR(255);
DECLARE done INT;
DECLARE curs CURSOR FOR (SELECT ${dbPrefix}category_translations.locale
FROM ${dbPrefix}category_translations
WHERE category_id = NEW.id);
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
IF EXISTS (
SELECT *
FROM ${dbPrefix}category_translations
WHERE category_id = NEW.id
)
THEN
OPEN curs;
SET done = 0;
REPEAT
FETCH curs INTO localeCode;
SELECT get_url_path_of_category(NEW.id, localeCode) INTO urlPath;
UPDATE ${dbPrefix}category_translations
SET url_path = urlPath
WHERE ${dbPrefix}category_translations.category_id = NEW.id;
UNTIL done END REPEAT;
CLOSE curs;
END IF;
SQL;
}
}

View File

@ -0,0 +1,115 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;
class AlterTriggerCategoryTranslations extends Migration
{
private const TRIGGER_NAME_INSERT = 'trig_category_translations_insert';
private const TRIGGER_NAME_UPDATE = 'trig_category_translations_update';
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$triggerBody = $this->getTriggerBody();
$dbPrefix = DB::getTablePrefix();
$insertTrigger = <<< SQL
CREATE TRIGGER %s
BEFORE INSERT ON ${dbPrefix}category_translations
FOR EACH ROW
BEGIN
$triggerBody
END;
SQL;
$updateTrigger = <<< SQL
CREATE TRIGGER %s
BEFORE UPDATE ON ${dbPrefix}category_translations
FOR EACH ROW
BEGIN
$triggerBody
END;
SQL;
$this->dropTriggers();
DB::unprepared(sprintf($insertTrigger, self::TRIGGER_NAME_INSERT));
DB::unprepared(sprintf($updateTrigger, self::TRIGGER_NAME_UPDATE));
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$this->dropTriggers();
}
/**
* Drop the triggers
*/
private function dropTriggers()
{
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_INSERT));
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_UPDATE));
}
/**
* Returns trigger body as string
*
* @return string
*/
private function getTriggerBody()
{
$dbPrefix = DB::getTablePrefix();
return <<<SQL
DECLARE parentUrlPath varchar(255);
DECLARE urlPath varchar(255);
IF NOT EXISTS (
SELECT id
FROM ${dbPrefix}categories
WHERE
id = NEW.category_id
AND parent_id IS NULL
)
THEN
SELECT
GROUP_CONCAT(parent_translations.slug SEPARATOR '/') INTO parentUrlPath
FROM
${dbPrefix}categories AS node,
${dbPrefix}categories AS parent
JOIN ${dbPrefix}category_translations AS parent_translations ON parent.id = parent_translations.category_id
WHERE
node._lft >= parent._lft
AND node._rgt <= parent._rgt
AND node.id = (SELECT parent_id FROM ${dbPrefix}categories WHERE id = NEW.category_id)
AND node.parent_id IS NOT NULL
AND parent.parent_id IS NOT NULL
AND parent_translations.locale = NEW.locale
GROUP BY
node.id;
IF parentUrlPath IS NULL
THEN
SET urlPath = NEW.slug;
ELSE
SET urlPath = concat(parentUrlPath, '/', NEW.slug);
END IF;
SET NEW.url_path = urlPath;
END IF;
SQL;
}
}

View File

@ -0,0 +1,77 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;
class AlterStoredFunctionUrlPathCategory extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$dbPrefix = DB::getTablePrefix();
$functionSQL = <<< SQL
DROP FUNCTION IF EXISTS `get_url_path_of_category`;
CREATE FUNCTION get_url_path_of_category(
categoryId INT,
localeCode VARCHAR(255)
)
RETURNS VARCHAR(255)
DETERMINISTIC
BEGIN
DECLARE urlPath VARCHAR(255);
IF NOT EXISTS (
SELECT id
FROM ${dbPrefix}categories
WHERE
id = categoryId
AND parent_id IS NULL
)
THEN
SELECT
GROUP_CONCAT(parent_translations.slug SEPARATOR '/') INTO urlPath
FROM
${dbPrefix}categories AS node,
${dbPrefix}categories AS parent
JOIN ${dbPrefix}category_translations AS parent_translations ON parent.id = parent_translations.category_id
WHERE
node._lft >= parent._lft
AND node._rgt <= parent._rgt
AND node.id = categoryId
AND node.parent_id IS NOT NULL
AND parent.parent_id IS NOT NULL
AND parent_translations.locale = localeCode
GROUP BY
node.id;
IF urlPath IS NULL
THEN
SET urlPath = (SELECT slug FROM ${dbPrefix}category_translations WHERE ${dbPrefix}category_translations.category_id = categoryId);
END IF;
ELSE
SET urlPath = '';
END IF;
RETURN urlPath;
END;
SQL;
DB::unprepared($functionSQL);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::unprepared('DROP FUNCTION IF EXISTS `get_url_path_of_category`;');
}
}

View File

@ -0,0 +1,117 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AlterTriggerOnCategories extends Migration
{
private const TRIGGER_NAME_INSERT = 'trig_categories_insert';
private const TRIGGER_NAME_UPDATE = 'trig_categories_update';
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$triggerBody = $this->getTriggerBody();
$dbPrefix = DB::getTablePrefix();
$insertTrigger = <<< SQL
CREATE TRIGGER %s
AFTER INSERT ON ${dbPrefix}categories
FOR EACH ROW
BEGIN
$triggerBody
END;
SQL;
$updateTrigger = <<< SQL
CREATE TRIGGER %s
AFTER UPDATE ON ${dbPrefix}categories
FOR EACH ROW
BEGIN
$triggerBody
END;
SQL;
$this->dropTriggers();
DB::unprepared(sprintf($insertTrigger, self::TRIGGER_NAME_INSERT));
DB::unprepared(sprintf($updateTrigger, self::TRIGGER_NAME_UPDATE));
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$this->dropTriggers();
}
private function dropTriggers()
{
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_INSERT));
DB::unprepared(sprintf('DROP TRIGGER IF EXISTS %s;', self::TRIGGER_NAME_UPDATE));
}
/**
* Returns trigger body as string
*
* @return string
*/
private function getTriggerBody(): string
{
$dbPrefix = DB::getTablePrefix();
return <<< SQL
DECLARE urlPath VARCHAR(255);
DECLARE localeCode VARCHAR(255);
DECLARE done INT;
DECLARE curs CURSOR FOR (SELECT ${dbPrefix}category_translations.locale
FROM ${dbPrefix}category_translations
WHERE category_id = NEW.id);
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
IF EXISTS (
SELECT *
FROM ${dbPrefix}category_translations
WHERE category_id = NEW.id
)
THEN
OPEN curs;
SET done = 0;
REPEAT
FETCH curs INTO localeCode;
SELECT get_url_path_of_category(NEW.id, localeCode) INTO urlPath;
IF NEW.parent_id IS NULL
THEN
SET urlPath = '';
END IF;
UPDATE ${dbPrefix}category_translations
SET url_path = urlPath
WHERE
${dbPrefix}category_translations.category_id = NEW.id
AND ${dbPrefix}category_translations.locale = localeCode;
UNTIL done END REPEAT;
CLOSE curs;
END IF;
SQL;
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');
}
}

View File

@ -1,5 +1,7 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Webkul\Velocity\Database\Seeders\VelocityMetaDataSeeder;
use Webkul\Admin\Database\Seeders\DatabaseSeeder as BagistoDatabaseSeeder;

View File

@ -16,7 +16,7 @@
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.4",
"lodash": "^4.17.19",
"popper.js": "^1.12",
"resolve-url-loader": "^3.1.0",
"sass": "^1.24.5",

View File

@ -31,7 +31,7 @@ class AddressController extends Controller
/**
* Controller instance
*
* @param Webkul\Customer\Repositories\CustomerAddressRepository $customerAddressRepository
* @param CustomerAddressRepository $customerAddressRepository
*/
public function __construct(CustomerAddressRepository $customerAddressRepository)
{
@ -49,12 +49,12 @@ class AddressController extends Controller
/**
* Get user address.
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
*/
public function get()
{
$customer = auth($this->guard)->user();
$addresses = $customer->addresses()->get();
return CustomerAddressResource::collection($addresses);
@ -63,24 +63,35 @@ class AddressController extends Controller
/**
* Store a newly created resource in storage.
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\JsonResponse
* @throws \Illuminate\Validation\ValidationException
*/
public function store()
{
$customer = auth($this->guard)->user();
request()->merge([
'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))),
'customer_id' => $customer->id,
]);
if (request()->input('address1') && ! is_array(request()->input('address1'))) {
return response()->json([
'message' => 'address1 must be an array.',
]);
}
if (request()->input('address1')) {
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',
'company' => 'string|nullable',
'vat_id' => 'string|nullable',
'country' => 'string|required',
'state' => 'string|nullable',
'city' => 'string|required',
'postcode' => 'required',
'phone' => 'required',
'phone' => 'required',
]);
$customerAddress = $this->customerAddressRepository->create(request()->all());
@ -93,29 +104,37 @@ class AddressController extends Controller
/**
* Update the specified resource in storage.
*
* @return \Illuminate\Http\Response
* @param int $id
*
* @return \Illuminate\Http\JsonResponse
* @throws \Illuminate\Validation\ValidationException
*/
public function update()
public function update(int $id)
{
$customer = auth($this->guard)->user();
if (request()->input('address1') && ! is_array(request()->input('address1'))) {
return response()->json([
'message' => 'address1 must be an array.',
]);
}
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',
'company' => 'string|nullable',
'vat_id' => 'string|nullable',
'country' => 'string|required',
'state' => 'string|nullable',
'city' => 'string|required',
'postcode' => 'required',
'phone' => 'required',
'phone' => 'required',
]);
$this->customerAddressRepository->update(request()->all(), request()->input('id'));
$customerAddress = $this->customerAddressRepository->update(request()->all(), $id);
return response()->json([
'message' => 'Your address has been updated successfully.',
'data' => new CustomerAddressResource($this->customerAddressRepository->find(request()->input('id'))),
'data' => new CustomerAddressResource($customerAddress),
]);
}
}

View File

@ -2,15 +2,17 @@
namespace Webkul\API\Http\Controllers\Shop;
use Cart;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Log;
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;
use Webkul\Customer\Repositories\WishlistRepository;
use Webkul\API\Http\Resources\Checkout\Cart as CartResource;
class CartController extends Controller
{
@ -70,7 +72,7 @@ class CartController extends Controller
}
/**
* Get customer cart
* Get customer cart.
*
* @return \Illuminate\Http\JsonResponse
*/
@ -142,22 +144,28 @@ class CartController extends Controller
*
* @return \Illuminate\Http\JsonResponse
*/
public function update()
public function update(Request $request)
{
foreach (request()->get('qty') as $qty) {
$this->validate($request, [
'qty' => 'required|array',
]);
$requestedQuantity = $request->get('qty');
foreach ($requestedQuantity as $qty) {
if ($qty <= 0) {
return response()->json([
'message' => trans('shop::app.checkout.cart.quantity.illegal'),
], 401);
], Response::HTTP_UNAUTHORIZED);
}
}
foreach (request()->get('qty') as $itemId => $qty) {
foreach ($requestedQuantity as $itemId => $qty) {
$item = $this->cartItemRepository->findOneByField('id', $itemId);
Event::dispatch('checkout.cart.item.update.before', $itemId);
Cart::updateItems(request()->all());
Cart::updateItems(['qty' => $requestedQuantity]);
Event::dispatch('checkout.cart.item.update.after', $item);
}
@ -242,4 +250,55 @@ class CartController extends Controller
'data' => $cart ? new CartResource($cart) : null,
]);
}
/**
* Apply coupon code.
*
* @return \Illuminate\Http\JsonResponse
*/
public function applyCoupon()
{
$couponCode = request()->get('code');
try {
if (strlen($couponCode)) {
Cart::setCouponCode($couponCode)->collectTotals();
if (Cart::getCart()->coupon_code == $couponCode) {
return response()->json([
'success' => true,
'message' => trans('shop::app.checkout.total.success-coupon'),
]);
}
}
return response()->json([
'success' => false,
'message' => trans('shop::app.checkout.total.invalid-coupon'),
]);
} catch (\Exception $e) {
report($e);
return response()->json([
'success' => false,
'message' => trans('shop::app.checkout.total.coupon-apply-issue'),
]);
}
}
/**
* Remove coupon code.
*
* @return \Illuminate\Http\JsonResponse
*/
public function removeCoupon()
{
Cart::removeCouponCode()->collectTotals();
return response()->json([
'success' => true,
'message' => trans('shop::app.checkout.total.remove-coupon'),
]);
}
}

View File

@ -2,20 +2,19 @@
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 Illuminate\Support\Str;
use Cart;
use Exception;
use Illuminate\Support\Str;
use Webkul\Payment\Facades\Payment;
use Webkul\Shipping\Facades\Shipping;
use Webkul\Sales\Repositories\OrderRepository;
use Webkul\Checkout\Repositories\CartRepository;
use Webkul\Shop\Http\Controllers\OnepageController;
use Webkul\Checkout\Repositories\CartItemRepository;
use Webkul\Checkout\Http\Requests\CustomerAddressForm;
use Webkul\API\Http\Resources\Sales\Order as OrderResource;
use Webkul\API\Http\Resources\Checkout\Cart as CartResource;
use Webkul\API\Http\Resources\Checkout\CartShippingRate as CartShippingRateResource;
class CheckoutController extends Controller
{
@ -162,6 +161,26 @@ class CheckoutController extends Controller
]);
}
/**
* Check for minimum order.
*
* @return \Illuminate\Http\Response
*/
public function checkMinimumOrder()
{
$minimumOrderAmount = (float) core()->getConfigData('sales.orderSettings.minimum-order.minimum_order_amount') ?? 0;
$status = Cart::checkMinimumOrder();
return response()->json([
'status' => ! $status ? false : true,
'message' => ! $status ? trans('shop::app.checkout.cart.minimum-order-message', ['amount' => core()->currency($minimumOrderAmount)]) : 'Success',
'data' => [
'cart' => new CartResource(Cart::getCart()),
]
]);
}
/**
* Saves order.
*

View File

@ -2,12 +2,21 @@
namespace Webkul\API\Http\Controllers\Shop;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Event;
use Webkul\Customer\Repositories\CustomerRepository;
use Webkul\Customer\Repositories\CustomerGroupRepository;
class CustomerController extends Controller
{
/**
* Contains current guard
*
* @var array
*/
protected $guard;
/**
* Contains route related configuration
*
@ -40,8 +49,17 @@ class CustomerController extends Controller
CustomerRepository $customerRepository,
CustomerGroupRepository $customerGroupRepository
) {
$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->customerRepository = $customerRepository;
$this->customerGroupRepository = $customerGroupRepository;
@ -52,24 +70,25 @@ class CustomerController extends Controller
*
* @return \Illuminate\Http\Response
*/
public function create()
public function create(Request $request)
{
request()->validate([
$this->validate($request, [
'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,
]);
$data['customer_group_id'] = $this->customerGroupRepository->findOneWhere(['code' => 'general'])->id;
$data = [
'first_name' => $request->get('first_name'),
'last_name' => $request->get('last_name'),
'email' => $request->get('email'),
'password' => $request->get('password'),
'password' => bcrypt($request->get('password')),
'channel_id' => core()->getCurrentChannel()->id,
'is_verified' => 1,
'customer_group_id' => $this->customerGroupRepository->findOneWhere(['code' => 'general'])->id
];
Event::dispatch('customer.registration.before');
@ -81,4 +100,23 @@ class CustomerController extends Controller
'message' => 'Your account has been created successfully.',
]);
}
/**
* Returns a current user data.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function get($id)
{
if (Auth::user($this->guard)->id === (int) $id) {
return new $this->_config['resource'](
$this->customerRepository->findOrFail($id)
);
}
return response()->json([
'message' => 'Invalid Request.',
], 403);
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace Webkul\API\Http\Controllers\Shop;
class InvoiceController extends Controller
{
/**
* Contains current guard.
*
* @var array
*/
protected $guard;
/**
* Contains route related configuration.
*
* @var array
*/
protected $_config;
/**
* Repository object.
*
* @var \Webkul\Core\Eloquent\Repository
*/
protected $repository;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$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);
}
if ($this->_config) {
$this->repository = app($this->_config['repository']);
}
}
/**
* Returns a listing of the invoices.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$query = $this->repository->scopeQuery(function($query) {
$query = $query->leftJoin('orders', 'invoices.order_id', '=', 'orders.id')->select('invoices.*', 'orders.customer_id');
if (isset($this->_config['authorization_required']) && $this->_config['authorization_required']) {
$query = $query->where('customer_id', auth()->user()->id);
}
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;
});
if (is_null(request()->input('pagination')) || request()->input('pagination')) {
$results = $query->paginate(request()->input('limit') ?? 10);
} else {
$results = $query->get();
}
return $this->_config['resource']::collection($results);
}
/**
* Returns an individual invoice.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function get($id)
{
if (isset($this->_config['authorization_required']) && $this->_config['authorization_required']) {
$query = $this->repository->leftJoin('orders', 'invoices.order_id', '=', 'orders.id')
->select('invoices.*', 'orders.customer_id')
->where('customer_id', auth()->user()->id)
->findOrFail($id);
} else {
$query = $this->repository->findOrFail($id);
}
return new $this->_config['resource']($query);
}
}

View File

@ -12,7 +12,7 @@ class ResourceController extends Controller
* @var array
*/
protected $guard;
/**
* Contains route related configuration
*
@ -45,7 +45,9 @@ class ResourceController extends Controller
$this->middleware('auth:' . $this->guard);
}
$this->repository = app($this->_config['repository']);
if ($this->_config) {
$this->repository = app($this->_config['repository']);
}
}
/**
@ -56,6 +58,10 @@ class ResourceController extends Controller
public function index()
{
$query = $this->repository->scopeQuery(function($query) {
if (isset($this->_config['authorization_required']) && $this->_config['authorization_required']) {
$query = $query->where('customer_id', auth()->user()->id );
}
foreach (request()->except(['page', 'limit', 'pagination', 'sort', 'order', 'token']) as $input => $value) {
$query = $query->whereIn($input, array_map('trim', explode(',', $value)));
}
@ -86,9 +92,11 @@ class ResourceController extends Controller
*/
public function get($id)
{
return new $this->_config['resource'](
$this->repository->findOrFail($id)
);
$query = isset($this->_config['authorization_required']) && $this->_config['authorization_required'] ?
$this->repository->where('customer_id', auth()->user()->id)->findOrFail($id) :
$this->repository->findOrFail($id);
return new $this->_config['resource']($query);
}
/**
@ -102,7 +110,7 @@ class ResourceController extends Controller
$wishlistProduct = $this->repository->findOrFail($id);
$this->repository->delete($id);
return response()->json([
'message' => 'Item removed successfully.',
]);

View File

@ -9,21 +9,21 @@ use Webkul\API\Http\Resources\Catalog\ProductReview as ProductReviewResource;
class ReviewController extends Controller
{
/**
* Contains current guard
* Contains current guard.
*
* @var array
*/
protected $guard;
/**
* ProductReviewRepository object
* ProductReviewRepository $reviewRepository
*
* @var \Webkul\Product\Repositories\ProductReviewRepository
*/
protected $reviewRepository;
/**
* Controller instance
* Controller instance.
*
* @param Webkul\Product\Repositories\ProductReviewRepository $reviewRepository
*/
@ -47,24 +47,25 @@ class ReviewController extends Controller
{
$customer = auth($this->guard)->user();
$this->validate(request(), [
$this->validate($request, [
'comment' => 'required',
'rating' => 'required|numeric|min:1|max:5',
'title' => 'required',
]);
$data = array_merge(request()->all(), [
$productReview = $this->reviewRepository->create([
'customer_id' => $customer ? $customer->id : null,
'name' => $customer ? $customer->name : request()->input('name'),
'name' => $customer ? $customer->name : $request->get('name'),
'status' => 'pending',
'product_id' => $id,
'comment' => $request->comment,
'rating' => $request->rating,
'title' => $request->title
]);
$productReview = $this->reviewRepository->create($data);
return response()->json([
'message' => 'Your review submitted successfully.',
'data' => new ProductReviewResource($this->reviewRepository->find($productReview->id)),
'data' => new ProductReviewResource($productReview),
]);
}
}

View File

@ -103,23 +103,19 @@ class SessionController extends Controller
'password' => 'confirmed|min:6',
]);
$data = request()->all();
$data = request()->only('first_name', 'last_name', 'gender', 'date_of_birth', 'email', 'password');
if (! $data['date_of_birth']) {
unset($data['date_of_birth']);
}
if (!isset($data['password']) || ! $data['password']) {
if (! isset($data['password']) || ! $data['password']) {
unset($data['password']);
} else {
$data['password'] = bcrypt($data['password']);
}
$this->customerRepository->update($data, $customer->id);
$updatedCustomer = $this->customerRepository->update($data, $customer->id);
return response()->json([
'message' => 'Your account has been created successfully.',
'data' => new CustomerResource($this->customerRepository->find($customer->id)),
'message' => 'Your account has been updated successfully.',
'data' => new CustomerResource($updatedCustomer),
]);
}
@ -136,4 +132,4 @@ class SessionController extends Controller
'message' => 'Logged out successfully.',
]);
}
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace Webkul\API\Http\Controllers\Shop;
class TransactionController extends Controller
{
/**
* Contains current guard.
*
* @var array
*/
protected $guard;
/**
* Contains route related configuration.
*
* @var array
*/
protected $_config;
/**
* Repository object.
*
* @var \Webkul\Core\Eloquent\Repository
*/
protected $repository;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$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);
}
if ($this->_config) {
$this->repository = app($this->_config['repository']);
}
}
/**
* Returns a listing of the Order Transactions.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$query = $this->repository->scopeQuery(function($query) {
$query = $query->leftJoin('orders', 'order_transactions.order_id', '=', 'orders.id')->select('order_transactions.*', 'orders.customer_id');
if (isset($this->_config['authorization_required']) && $this->_config['authorization_required']) {
$query = $query->where('customer_id', auth()->user()->id);
}
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;
});
if (is_null(request()->input('pagination')) || request()->input('pagination')) {
$results = $query->paginate(request()->input('limit') ?? 10);
} else {
$results = $query->get();
}
return $this->_config['resource']::collection($results);
}
/**
* Returns an individual invoice.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function get($id)
{
if (isset($this->_config['authorization_required']) && $this->_config['authorization_required']) {
$query = $this->repository->leftJoin('orders', 'order_transactions.order_id', '=', 'orders.id')
->select('order_transactions.*', 'orders.customer_id')
->where('customer_id', auth()->user()->id)
->findOrFail($id);
} else {
$query = $this->repository->findOrFail($id);
}
return new $this->_config['resource']($query);
}
}

View File

@ -2,6 +2,7 @@
namespace Webkul\API\Http\Resources\Catalog;
use Illuminate\Support\Facades\Storage;
use Illuminate\Http\Resources\Json\JsonResource;
class Category extends JsonResource
@ -15,19 +16,25 @@ class Category extends JsonResource
public function toArray($request)
{
return [
'id' => $this->id,
'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,
'meta_keywords' => $this->meta_keywords,
'status' => $this->status,
'image_url' => $this->image_url,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'id' => $this->id,
'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,
'meta_keywords' => $this->meta_keywords,
'status' => $this->status,
'image_url' => $this->image_url,
'category_icon_path' => $this->category_icon_path
? Storage::url($this->category_icon_path)
: null,
'additional' => is_array($this->resource->additional)
? $this->resource->additional
: json_decode($this->resource->additional, true),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}
}

View File

@ -3,7 +3,7 @@
namespace Webkul\API\Http\Resources\Catalog;
use Illuminate\Http\Resources\Json\JsonResource;
use Webkul\Product\Helpers\ProductType;
use Webkul\Product\Facades\ProductImage as ProductImageFacade;
class Product extends JsonResource
{
@ -14,10 +14,10 @@ class Product extends JsonResource
*/
public function __construct($resource)
{
$this->productImageHelper = app('Webkul\Product\Helpers\ProductImage');
$this->productReviewHelper = app('Webkul\Product\Helpers\Review');
$this->wishlistHelper = app('Webkul\Customer\Helpers\Wishlist');
parent::__construct($resource);
}
@ -29,42 +29,265 @@ class Product extends JsonResource
*/
public function toArray($request)
{
/* assign product */
$product = $this->product ? $this->product : $this;
/* get type instance */
$productTypeInstance = $product->getTypeInstance();
/* generating resource */
return [
/* product's information */
'id' => $product->id,
'sku' => $product->sku,
'type' => $product->type,
'name' => $this->name,
'url_key' => $this->url_key,
'price' => $product->getTypeInstance()->getMinimalPrice(),
'formated_price' => core()->currency($product->getTypeInstance()->getMinimalPrice()),
'short_description' => $this->short_description,
'description' => $this->description,
'sku' => $this->sku,
'name' => $product->name,
'url_key' => $product->url_key,
'price' => $productTypeInstance->getMinimalPrice(),
'formated_price' => core()->currency($productTypeInstance->getMinimalPrice()),
'short_description' => $product->short_description,
'description' => $product->description,
'images' => ProductImage::collection($product->images),
'base_image' => $this->productImageHelper->getProductBaseImage($product),
'variants' => Self::collection($this->variants),
'in_stock' => $product->haveSufficientQuantity(1),
$this->mergeWhen($product->getTypeInstance()->isComposite(), [
'super_attributes' => Attribute::collection($product->super_attributes),
]),
'special_price' => $this->when(
$product->getTypeInstance()->haveSpecialPrice(),
$product->getTypeInstance()->getSpecialPrice()
),
'formated_special_price' => $this->when(
$product->getTypeInstance()->haveSpecialPrice(),
core()->currency($product->getTypeInstance()->getSpecialPrice())
),
'videos' => ProductVideo::collection($product->videos),
'base_image' => ProductImageFacade::getProductBaseImage($product),
'created_at' => $product->created_at,
'updated_at' => $product->updated_at,
/* product's reviews */
'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)) : [],
],
/* product's checks */
'in_stock' => $product->haveSufficientQuantity(1),
'is_saved' => false,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'is_wishlisted' => $this->wishlistHelper->getWishlistProduct($product) ? true : false,
'is_item_in_cart' => \Cart::hasProduct($product),
'show_quantity_changer' => $this->when(
$product->type !== 'grouped',
$product->getTypeInstance()->showQuantityBox()
),
/* product's extra information */
$this->merge($this->allProductExtraInfo()),
/* special price cases */
$this->merge($this->specialPriceInfo()),
/* super attributes */
$this->mergeWhen($productTypeInstance->isComposite(), [
'super_attributes' => Attribute::collection($product->super_attributes),
]),
];
}
}
/**
* Get special price information.
*
* @return array
*/
private function specialPriceInfo()
{
$product = $this->product ? $this->product : $this;
$productTypeInstance = $product->getTypeInstance();
return [
'special_price' => $this->when(
$productTypeInstance->haveSpecialPrice(),
$productTypeInstance->getSpecialPrice()
),
'formated_special_price' => $this->when(
$productTypeInstance->haveSpecialPrice(),
core()->currency($productTypeInstance->getSpecialPrice())
),
'regular_price' => $this->when(
$productTypeInstance->haveSpecialPrice(),
data_get($productTypeInstance->getProductPrices(), 'regular_price.price')
),
'formated_regular_price' => $this->when(
$productTypeInstance->haveSpecialPrice(),
data_get($productTypeInstance->getProductPrices(), 'regular_price.formated_price')
),
];
}
/**
* Get all product's extra information.
*
* @return array
*/
private function allProductExtraInfo()
{
$product = $this->product ? $this->product : $this;
$productTypeInstance = $product->getTypeInstance();
return [
/* grouped product */
$this->mergeWhen(
$productTypeInstance instanceof \Webkul\Product\Type\Grouped,
$product->type == 'grouped'
? $this->getGroupedProductInfo($product)
: null
),
/* bundle product */
$this->mergeWhen(
$productTypeInstance instanceof \Webkul\Product\Type\Bundle,
$product->type == 'bundle'
? $this->getBundleProductInfo($product)
: null
),
/* configurable product */
$this->mergeWhen(
$productTypeInstance instanceof \Webkul\Product\Type\Configurable,
$product->type == 'configurable'
? $this->getConfigurableProductInfo($product)
: null
),
/* downloadable product */
$this->mergeWhen(
$productTypeInstance instanceof \Webkul\Product\Type\Downloadable,
$product->type == 'downloadable'
? $this->getDownloadableProductInfo($product)
: null
),
/* booking product */
$this->mergeWhen(
$product->type == 'booking',
$product->type == 'booking'
? $this->getBookingProductInfo($product)
: null
),
];
}
/**
* Get grouped product's extra information.
*
* @param \Webkul\Product\Models\Product
* @return array
*/
private function getGroupedProductInfo($product)
{
return [
'grouped_products' => $product->grouped_products->map(function($groupedProduct) {
$associatedProduct = $groupedProduct->associated_product;
$data = $associatedProduct->toArray();
return array_merge($data, [
'qty' => $groupedProduct->qty,
'isSaleable' => $associatedProduct->getTypeInstance()->isSaleable(),
'formated_price' => $associatedProduct->getTypeInstance()->getPriceHtml(),
'show_quantity_changer' => $associatedProduct->getTypeInstance()->showQuantityBox(),
]);
})
];
}
/**
* Get bundle product's extra information.
*
* @param \Webkul\Product\Models\Product
* @return array
*/
private function getBundleProductInfo($product)
{
return [
'currency_options' => core()->getAccountJsSymbols(),
'bundle_options' => app('Webkul\Product\Helpers\BundleOption')->getBundleConfig($product)
];
}
/**
* Get configurable product's extra information.
*
* @param \Webkul\Product\Models\Product
* @return array
*/
private function getConfigurableProductInfo($product)
{
return [
'variants' => $product->variants
];
}
/**
* Get downloadable product's extra information.
*
* @param \Webkul\Product\Models\Product
* @return array
*/
private function getDownloadableProductInfo($product)
{
return [
'downloadable_links' => $product->downloadable_links->map(function ($downloadableLink) {
$data = $downloadableLink->toArray();
if (isset($data['sample_file'])) {
$data['price'] = core()->currency($downloadableLink->price);
$data['sample_download_url'] = route('shop.downloadable.download_sample', ['type' => 'link', 'id' => $downloadableLink['id']]);
}
return $data;
}),
'downloadable_samples' => $product->downloadable_samples->map(function ($downloadableSample) {
$sample = $downloadableSample->toArray();
$data = $sample;
$data['download_url'] = route('shop.downloadable.download_sample', ['type' => 'sample', 'id' => $sample['id']]);
return $data;
})
];
}
/**
* Get booking product's extra information.
*
* @param \Webkul\Product\Models\Product
* @return array
*/
private function getBookingProductInfo($product)
{
$bookingProduct = app('\Webkul\BookingProduct\Repositories\BookingProductRepository')->findOneByField('product_id', $product->id);
$data['slot_index_route'] = route('booking_product.slots.index', $bookingProduct->id);
if ($bookingProduct->type == 'appointment') {
$bookingSlotHelper = app('\Webkul\BookingProduct\Helpers\AppointmentSlot');
$data['today_slots_html'] = $bookingSlotHelper->getTodaySlotsHtml($bookingProduct);
$data['week_slot_durations'] = $bookingSlotHelper->getWeekSlotDurations($bookingProduct);
$data['appointment_slot'] = $bookingProduct->appointment_slot;
}
if ($bookingProduct->type == 'event') {
$bookingSlotHelper = app('\Webkul\BookingProduct\Helpers\EventTicket');
$data['tickets'] = $bookingSlotHelper->getTickets($bookingProduct);
$data['event_date'] = $bookingSlotHelper->getEventDate($bookingProduct);
}
if ($bookingProduct->type == 'rental') {
$data['renting_type'] = $bookingProduct->rental_slot->renting_type;
}
if ($bookingProduct->type == 'table') {
$bookingSlotHelper = app('\Webkul\BookingProduct\Helpers\TableSlot');
$data['today_slots_html'] = $bookingSlotHelper->getTodaySlotsHtml($bookingProduct);
$data['week_slot_durations'] = $bookingSlotHelper->getWeekSlotDurations($bookingProduct);
$data['table_slot'] = $bookingProduct->table_slot;
}
return $data;
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Webkul\API\Http\Resources\Catalog;
use Illuminate\Http\Resources\Json\JsonResource;
class ProductVideo extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'type' => $this->type,
'url' => $this->url
];
}
}

View File

@ -5,71 +5,75 @@ 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;
use Webkul\Tax\Helpers\Tax;
class Cart extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @param \Illuminate\Http\Request
*
* @return array
*/
public function toArray($request)
public function toArray($request): array
{
$taxes = \Webkul\Tax\Helpers\Tax::getTaxRatesWithAmount($this, false);
$baseTaxes = \Webkul\Tax\Helpers\Tax::getTaxRatesWithAmount($this, true);
$taxes = Tax::getTaxRatesWithAmount($this, false);
$baseTaxes = Tax::getTaxRatesWithAmount($this, true);
$formatedTaxes = $this->formatTaxAmounts($taxes, false);
$formatedBaseTaxes = $this->formatTaxAmounts($baseTaxes, true);
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_amount,
'formated_discount' => core()->formatPrice($this->discount_amount, $this->cart_currency_code),
'base_discount' => $this->base_discount_amount,
'formated_base_discount' => core()->formatBasePrice($this->base_discount_amount),
'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,
'taxes' => json_encode($taxes, JSON_FORCE_OBJECT),
'formated_taxes' => json_encode($formatedTaxes, JSON_FORCE_OBJECT),
'base_taxes' => json_encode($baseTaxes, JSON_FORCE_OBJECT),
'formated_base_taxes' => json_encode($formatedBaseTaxes, JSON_FORCE_OBJECT),
'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_amount,
'formated_discount' => core()->formatPrice($this->discount_amount, $this->cart_currency_code),
'base_discount' => $this->base_discount_amount,
'formated_base_discount' => core()->formatBasePrice($this->base_discount_amount),
'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,
'taxes' => json_encode($taxes, JSON_FORCE_OBJECT),
'formated_taxes' => json_encode($formatedTaxes, JSON_FORCE_OBJECT),
'base_taxes' => json_encode($baseTaxes, JSON_FORCE_OBJECT),
'formated_base_taxes' => json_encode($formatedBaseTaxes, JSON_FORCE_OBJECT),
'formated_discounted_sub_total' => core()->formatPrice($this->sub_total - $this->discount_amount, $this->cart_currency_code),
'formated_base_discounted_sub_total' => core()->formatPrice($this->base_sub_total - $this->base_discount_amount, $this->cart_currency_code),
];
}

View File

@ -19,6 +19,7 @@ class CustomerAddress extends JsonResource
'first_name' => $this->first_name,
'last_name' => $this->last_name,
'company_name' => $this->company_name,
'vat_id' => $this->vat_id,
'address1' => explode(PHP_EOL, $this->address1),
'country' => $this->country,
'country_name' => core()->country_name($this->country),
@ -26,6 +27,7 @@ class CustomerAddress extends JsonResource
'city' => $this->city,
'postcode' => $this->postcode,
'phone' => $this->phone,
'is_default' => $this->default_address,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];

View File

@ -19,6 +19,7 @@ class Order extends JsonResource
{
return [
'id' => $this->id,
'increment_id' => $this->increment_id,
'status' => $this->status,
'status_label' => $this->status_label,
'channel_name' => $this->channel_name,
@ -103,7 +104,6 @@ class Order extends JsonResource
'items' => OrderItem::collection($this->items),
'invoices' => Invoice::collection($this->invoices),
'shipments' => Shipment::collection($this->shipments),
'downloadable_links' => $this->downloadable_link_purchased,
'updated_at' => $this->updated_at,
'created_at' => $this->created_at,
];

View File

@ -10,7 +10,8 @@ class OrderItem extends JsonResource
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @param \Illuminate\Http\Request
*
* @return array
*/
public function toArray($request)
@ -75,6 +76,7 @@ class OrderItem extends JsonResource
'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),
'downloadable_links' => $this->downloadable_link_purchased,
'additional' => is_array($this->resource->additional)
? $this->resource->additional
: json_decode($this->resource->additional, true),

View File

@ -0,0 +1,28 @@
<?php
namespace Webkul\API\Http\Resources\Sales;
use Illuminate\Http\Resources\Json\JsonResource;
class OrderTransaction extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'transaction_id' => $this->transaction_id,
'status' => $this->status,
'type' => $this->type,
'payment_method' => $this->payment_method,
'data' => $this->data,
'updated_at' => $this->updated_at,
'created_at' => $this->created_at,
];
}
}

View File

@ -75,7 +75,7 @@ Route::group(['prefix' => 'api'], function ($router) {
'resource' => 'Webkul\API\Http\Resources\Catalog\ProductReview',
'authorization_required' => true
]);
//Channel routes
Route::get('channels', 'ResourceController@index')->defaults('_config', [
@ -154,7 +154,7 @@ Route::group(['prefix' => 'api'], function ($router) {
Route::post('customer/register', 'CustomerController@create');
Route::get('customers/{id}', 'ResourceController@get')->defaults('_config', [
Route::get('customers/{id}', 'CustomerController@get')->defaults('_config', [
'repository' => 'Webkul\Customer\Repositories\CustomerRepository',
'resource' => 'Webkul\API\Http\Resources\Customer\Customer',
'authorization_required' => true
@ -202,20 +202,20 @@ Route::group(['prefix' => 'api'], function ($router) {
//Invoice routes
Route::get('invoices', 'ResourceController@index')->defaults('_config', [
Route::get('invoices', 'InvoiceController@index')->defaults('_config', [
'repository' => 'Webkul\Sales\Repositories\InvoiceRepository',
'resource' => 'Webkul\API\Http\Resources\Sales\Invoice',
'authorization_required' => true
]);
Route::get('invoices/{id}', 'ResourceController@get')->defaults('_config', [
Route::get('invoices/{id}', 'InvoiceController@get')->defaults('_config', [
'repository' => 'Webkul\Sales\Repositories\InvoiceRepository',
'resource' => 'Webkul\API\Http\Resources\Sales\Invoice',
'authorization_required' => true
]);
//Invoice routes
//Shipment routes
Route::get('shipments', 'ResourceController@index')->defaults('_config', [
'repository' => 'Webkul\Sales\Repositories\ShipmentRepository',
'resource' => 'Webkul\API\Http\Resources\Sales\Shipment',
@ -228,6 +228,18 @@ Route::group(['prefix' => 'api'], function ($router) {
'authorization_required' => true
]);
//Transaction routes
Route::get('transactions', 'TransactionController@index')->defaults('_config', [
'repository' => 'Webkul\Sales\Repositories\OrderTransactionRepository',
'resource' => 'Webkul\API\Http\Resources\Sales\OrderTransaction',
'authorization_required' => true
]);
Route::get('transactions/{id}', 'TransactionController@get')->defaults('_config', [
'repository' => 'Webkul\Sales\Repositories\OrderTransactionRepository',
'resource' => 'Webkul\API\Http\Resources\Sales\OrderTransaction',
'authorization_required' => true
]);
//Wishlist routes
Route::get('wishlist', 'ResourceController@index')->defaults('_config', [
@ -246,7 +258,6 @@ Route::group(['prefix' => 'api'], function ($router) {
Route::get('wishlist/add/{id}', 'WishlistController@create');
//Checkout routes
Route::group(['prefix' => 'checkout'], function ($router) {
Route::post('cart/add/{id}', 'CartController@store');
@ -259,6 +270,10 @@ Route::group(['prefix' => 'api'], function ($router) {
Route::get('cart/remove-item/{id}', 'CartController@destroyItem');
Route::post('cart/coupon', 'CartController@applyCoupon');
Route::delete('cart/coupon', 'CartController@removeCoupon');
Route::get('cart/move-to-wishlist/{id}', 'CartController@moveToWishlist');
Route::post('save-address', 'CheckoutController@saveAddress');
@ -267,6 +282,8 @@ Route::group(['prefix' => 'api'], function ($router) {
Route::post('save-payment', 'CheckoutController@savePayment');
Route::post('check-minimum-order', 'CheckoutController@checkMinimumOrder');
Route::post('save-order', 'CheckoutController@saveOrder');
});
});

View File

@ -0,0 +1,11 @@
<?php
namespace Webkul\API\Providers;
use Webkul\Core\Providers\CoreModuleServiceProvider;
class ModuleServiceProvider extends CoreModuleServiceProvider
{
protected $models = [
];
}

View File

@ -1,5 +1,5 @@
{
"name": "webkul/laravel-api",
"name": "bagisto/laravel-api",
"license": "MIT",
"authors": [
{
@ -8,14 +8,14 @@
}
],
"require": {
"webkul/laravel-user": "dev-master",
"webkul/laravel-core": "dev-master",
"webkul/laravel-product": "dev-master",
"webkul/laravel-shop": "dev-master",
"webkul/laravel-category": "dev-master",
"webkul/laravel-tax": "dev-master",
"webkul/laravel-inventory": "dev-master",
"webkul/laravel-checkout": "dev-master"
"bagisto/laravel-user": "dev-master",
"bagisto/laravel-core": "dev-master",
"bagisto/laravel-product": "dev-master",
"bagisto/laravel-shop": "dev-master",
"bagisto/laravel-category": "dev-master",
"bagisto/laravel-tax": "dev-master",
"bagisto/laravel-inventory": "dev-master",
"bagisto/laravel-checkout": "dev-master"
},
"autoload": {
"psr-4": {
@ -25,7 +25,7 @@
"extra": {
"laravel": {
"providers": [
"Webkul\\API\\AdminServiceProvider"
"Webkul\\API\\Providers\\APIServiceProvider"
],
"aliases": {}
}

View File

@ -20,7 +20,7 @@
"extra": {
"laravel": {
"providers": [
"Webkul\\Admin\\AdminServiceProvider"
"Webkul\\Admin\\Providers\\AdminServiceProvider"
],
"aliases": {}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,22 +1,22 @@
/*!
* Sizzle CSS Selector Engine v2.3.4
* Sizzle CSS Selector Engine v2.3.5
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2019-04-08
* Date: 2020-03-14
*/
/*!
* Vue.js v2.6.11
* (c) 2014-2019 Evan You
* Vue.js v2.6.12
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
/*!
* jQuery JavaScript Library v3.4.1
* jQuery JavaScript Library v3.5.1
* https://jquery.com/
*
* Includes Sizzle.js
@ -26,7 +26,7 @@
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2019-05-01T21:04Z
* Date: 2020-05-04T22:49Z
*/
/**

View File

@ -1,4 +1,4 @@
{
"/js/admin.js": "/js/admin.js?id=a14c779523092ac32b88",
"/css/admin.css": "/css/admin.css?id=56c882a611bdf3c058cb"
"/js/admin.js": "/js/admin.js?id=f3d20a6568f3b4473dcc",
"/css/admin.css": "/css/admin.css?id=9f04992b0f1ac9f91e6c"
}

View File

@ -1,12 +1,31 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Dashboard
|--------------------------------------------------------------------------
|
| All ACLs related to dashboard will be placed here.
|
*/
[
'key' => 'dashboard',
'name' => 'admin::app.acl.dashboard',
'route' => 'admin.dashboard.index',
'sort' => 1,
], [
],
/*
|--------------------------------------------------------------------------
| Sales
|--------------------------------------------------------------------------
|
| All ACLs related to sales will be placed here.
|
*/
[
'key' => 'sales',
'name' => 'admin::app.acl.sales',
'route' => 'admin.sales.orders.index',
@ -16,17 +35,72 @@ return [
'name' => 'admin::app.acl.orders',
'route' => 'admin.sales.orders.index',
'sort' => 1,
], [
'key' => 'sales.orders.view',
'name' => 'admin::app.acl.view',
'route' => 'admin.sales.orders.view',
'sort' => 1,
], [
'key' => 'sales.orders.cancel',
'name' => 'admin::app.acl.cancel',
'route' => 'admin.sales.orders.cancel',
'sort' => 2,
], [
'key' => 'sales.invoices',
'name' => 'admin::app.acl.invoices',
'route' => 'admin.sales.invoices.index',
'sort' => 2,
], [
'key' => 'sales.invoices.view',
'name' => 'admin::app.acl.view',
'route' => 'admin.sales.invoices.view',
'sort' => 1,
], [
'key' => 'sales.invoices.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.sales.invoices.create',
'sort' => 2,
], [
'key' => 'sales.shipments',
'name' => 'admin::app.acl.shipments',
'route' => 'admin.sales.shipments.index',
'sort' => 3,
], [
'key' => 'sales.shipments.view',
'name' => 'admin::app.acl.view',
'route' => 'admin.sales.shipments.view',
'sort' => 1,
], [
'key' => 'sales.shipments.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.sales.shipments.create',
'sort' => 2,
], [
'key' => 'sales.refunds',
'name' => 'admin::app.acl.refunds',
'route' => 'admin.sales.refunds.index',
'sort' => 4,
], [
'key' => 'sales.refunds.view',
'name' => 'admin::app.acl.view',
'route' => 'admin.sales.refunds.view',
'sort' => 1,
], [
'key' => 'sales.refunds.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.sales.refunds.create',
'sort' => 2,
],
/*
|--------------------------------------------------------------------------
| Catalog
|--------------------------------------------------------------------------
|
| All ACLs related to catalog will be placed here.
|
*/
[
'key' => 'catalog',
'name' => 'admin::app.acl.catalog',
'route' => 'admin.catalog.index',
@ -41,16 +115,31 @@ return [
'name' => 'admin::app.acl.create',
'route' => 'admin.catalog.products.create',
'sort' => 1,
], [
'key' => 'catalog.products.copy',
'name' => 'admin::app.acl.copy',
'route' => 'admin.catalog.products.copy',
'sort' => 2,
], [
'key' => 'catalog.products.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.catalog.products.edit',
'sort' => 2,
'sort' => 3,
], [
'key' => 'catalog.products.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.catalog.products.delete',
'sort' => 3,
'sort' => 4,
], [
'key' => 'catalog.products.mass-update',
'name' => 'admin::app.acl.mass-update',
'route' => 'admin.catalog.products.massupdate',
'sort' => 5,
], [
'key' => 'catalog.products.mass-delete',
'name' => 'admin::app.acl.mass-delete',
'route' => 'admin.catalog.products.massdelete',
'sort' => 6,
], [
'key' => 'catalog.categories',
'name' => 'admin::app.acl.categories',
@ -71,6 +160,11 @@ return [
'name' => 'admin::app.acl.delete',
'route' => 'admin.catalog.categories.delete',
'sort' => 3,
], [
'key' => 'catalog.categories.mass-delete',
'name' => 'admin::app.acl.mass-delete',
'route' => 'admin.catalog.categories.massdelete',
'sort' => 4,
], [
'key' => 'catalog.attributes',
'name' => 'admin::app.acl.attributes',
@ -91,6 +185,11 @@ return [
'name' => 'admin::app.acl.delete',
'route' => 'admin.catalog.attributes.delete',
'sort' => 3,
], [
'key' => 'catalog.attributes.mass-delete',
'name' => 'admin::app.acl.mass-delete',
'route' => 'admin.catalog.attributes.massdelete',
'sort' => 4,
], [
'key' => 'catalog.families',
'name' => 'admin::app.acl.attribute-families',
@ -111,7 +210,17 @@ return [
'name' => 'admin::app.acl.delete',
'route' => 'admin.catalog.families.delete',
'sort' => 3,
], [
],
/*
|--------------------------------------------------------------------------
| Customers
|--------------------------------------------------------------------------
|
| All ACLs related to customers will be placed here.
|
*/
[
'key' => 'customers',
'name' => 'admin::app.acl.customers',
'route' => 'admin.customer.index',
@ -136,11 +245,46 @@ return [
'name' => 'admin::app.acl.delete',
'route' => 'admin.customer.delete',
'sort' => 3,
], [
'key' => 'customers.customers.mass-update',
'name' => 'admin::app.acl.mass-update',
'route' => 'admin.customer.mass-update',
'sort' => 4,
], [
'key' => 'customers.customers.mass-delete',
'name' => 'admin::app.acl.mass-delete',
'route' => 'admin.customer.mass-delete',
'sort' => 5,
], [
'key' => 'customers.addresses',
'name' => 'admin::app.acl.addresses',
'route' => 'admin.customer.addresses.index',
'sort' => 2,
], [
'key' => 'customers.addresses.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.customer.addresses.create',
'sort' => 1,
], [
'key' => 'customers.addresses.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.customer.addresses.edit',
'sort' => 2,
], [
'key' => 'customers.addresses.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.customer.addresses.delete',
'sort' => 3,
], [
'key' => 'customers.note',
'name' => 'admin::app.acl.note',
'route' => 'admin.customer.note.create',
'sort' => 3,
], [
'key' => 'customers.groups',
'name' => 'admin::app.acl.groups',
'route' => 'admin.groups.index',
'sort' => 2,
'sort' => 4,
], [
'key' => 'customers.groups.create',
'name' => 'admin::app.acl.create',
@ -160,7 +304,7 @@ return [
'key' => 'customers.reviews',
'name' => 'admin::app.acl.reviews',
'route' => 'admin.customer.review.index',
'sort' => 3,
'sort' => 5,
], [
'key' => 'customers.reviews.edit',
'name' => 'admin::app.acl.edit',
@ -172,15 +316,215 @@ return [
'route' => 'admin.customer.review.delete',
'sort' => 2,
], [
'key' => 'configuration',
'name' => 'admin::app.acl.configure',
'route' => 'admin.configuration.index',
'sort' => 5,
'key' => 'customers.reviews.mass-update',
'name' => 'admin::app.acl.mass-update',
'route' => 'admin.customer.review.massupdate',
'sort' => 3,
], [
'key' => 'customers.reviews.mass-delete',
'name' => 'admin::app.acl.mass-delete',
'route' => 'admin.customer.review.massdelete',
'sort' => 4,
],
/*
|--------------------------------------------------------------------------
| Marketing
|--------------------------------------------------------------------------
|
| All ACLs related to marketing will be placed here.
|
*/
[
'key' => 'marketing',
'name' => 'admin::app.acl.marketing',
'route' => 'admin.cart-rules.index',
'sort' => 6,
], [
'key' => 'marketing.promotions',
'name' => 'admin::app.acl.promotions',
'route' => 'admin.cart-rules.index',
'sort' => 6,
], [
'key' => 'marketing.promotions.cart-rules',
'name' => 'admin::app.acl.cart-rules',
'route' => 'admin.cart-rules.index',
'sort' => 1,
], [
'key' => 'marketing.promotions.cart-rules.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.cart-rules.create',
'sort' => 1,
], [
'key' => 'marketing.promotions.cart-rules.copy',
'name' => 'admin::app.acl.copy',
'route' => 'admin.cart-rules.copy',
'sort' => 1,
], [
'key' => 'marketing.promotions.cart-rules.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.cart-rules.edit',
'sort' => 2,
], [
'key' => 'marketing.promotions.cart-rules.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.cart-rules.delete',
'sort' => 3,
], [
'key' => 'marketing.promotions.catalog-rules',
'name' => 'admin::app.acl.catalog-rules',
'route' => 'admin.catalog-rules.index',
'sort' => 1,
], [
'key' => 'marketing.promotions.catalog-rules.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.catalog-rules.index',
'sort' => 1,
], [
'key' => 'marketing.promotions.catalog-rules.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.catalog-rules.edit',
'sort' => 2,
], [
'key' => 'marketing.promotions.catalog-rules.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.catalog-rules.delete',
'sort' => 3,
], [
'key' => 'marketing.email-marketing',
'name' => 'admin::app.acl.email-marketing',
'route' => 'admin.email-templates.index',
'sort' => 7,
], [
'key' => 'marketing.email-marketing.email-templates',
'name' => 'admin::app.acl.email-templates',
'route' => 'admin.email-templates.index',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.email-templates.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.email-templates.create',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.email-templates.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.email-templates.edit',
'sort' => 2,
], [
'key' => 'marketing.email-marketing.email-templates.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.email-templates.delete',
'sort' => 3,
], [
'key' => 'marketing.email-marketing.events',
'name' => 'admin::app.acl.events',
'route' => 'admin.events.index',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.events.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.events.create',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.events.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.events.edit',
'sort' => 2,
], [
'key' => 'marketing.email-marketing.events.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.events.delete',
'sort' => 3,
], [
'key' => 'marketing.email-marketing.campaigns',
'name' => 'admin::app.acl.campaigns',
'route' => 'admin.campaigns.index',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.campaigns.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.campaigns.create',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.campaigns.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.campaigns.edit',
'sort' => 2,
], [
'key' => 'marketing.email-marketing.campaigns.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.campaigns.delete',
'sort' => 3,
], [
'key' => 'marketing.email-marketing.subscribers',
'name' => 'admin::app.acl.subscribers',
'route' => 'admin.customers.subscribers.index',
'sort' => 1,
], [
'key' => 'marketing.email-marketing.subscribers.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.customers.subscribers.edit',
'sort' => 2,
], [
'key' => 'marketing.email-marketing.subscribers.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.customers.subscribers.delete',
'sort' => 3,
],
/*
|--------------------------------------------------------------------------
| CMS
|--------------------------------------------------------------------------
|
| All ACLs related to cms will be placed here.
|
*/
[
'key' => 'cms',
'name' => 'admin::app.layouts.cms',
'route' => 'admin.cms.index',
'sort' => 7,
], [
'key' => 'cms.pages',
'name' => 'admin::app.cms.pages.pages',
'route' => 'admin.cms.index',
'sort' => 7,
], [
'key' => 'cms.pages.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.cms.create',
'sort' => 1,
], [
'key' => 'cms.pages.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.cms.edit',
'sort' => 2,
], [
'key' => 'cms.pages.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.cms.delete',
'sort' => 3,
], [
'key' => 'cms.pages.mass-delete',
'name' => 'admin::app.acl.mass-delete',
'route' => 'admin.cms.mass-delete',
'sort' => 4,
],
/*
|--------------------------------------------------------------------------
| Settings
|--------------------------------------------------------------------------
|
| All ACLs related to settings will be placed here.
|
*/
[
'key' => 'settings',
'name' => 'admin::app.acl.settings',
'route' => 'admin.users.index',
'sort' => 6,
'sort' => 8,
], [
'key' => 'settings.locales',
'name' => 'admin::app.acl.locales',
@ -391,52 +735,20 @@ return [
'name' => 'admin::app.acl.delete',
'route' => 'admin.tax-rates.delete',
'sort' => 3,
], [
'key' => 'promotions',
'name' => 'admin::app.acl.promotions',
'route' => 'admin.cart-rules.index',
'sort' => 7,
], [
'key' => 'promotions.cart-rules',
'name' => 'admin::app.acl.cart-rules',
'route' => 'admin.cart-rules.index',
'sort' => 1,
], [
'key' => 'promotions.cart-rules.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.cart-rules.create',
'sort' => 1,
], [
'key' => 'promotions.cart-rules.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.cart-rules.edit',
'sort' => 2,
], [
'key' => 'promotions.cart-rules.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.cart-rules.delete',
'sort' => 3,
], [
'key' => 'promotions.catalog-rules',
'name' => 'admin::app.acl.catalog-rules',
'route' => 'admin.catalog-rules.index',
'sort' => 1,
], [
'key' => 'promotions.catalog-rules.create',
'name' => 'admin::app.acl.create',
'route' => 'admin.catalog-rules.index',
'sort' => 1,
], [
'key' => 'promotions.catalog-rules.edit',
'name' => 'admin::app.acl.edit',
'route' => 'admin.catalog-rules.edit',
'sort' => 2,
], [
'key' => 'promotions.catalog-rules.delete',
'name' => 'admin::app.acl.delete',
'route' => 'admin.catalog-rules.delete',
'sort' => 3,
],
];
?>
/*
|--------------------------------------------------------------------------
| Configuration
|--------------------------------------------------------------------------
|
| All ACLs related to configuration will be placed here.
|
*/
[
'key' => 'configuration',
'name' => 'admin::app.acl.configure',
'route' => 'admin.configuration.index',
'sort' => 9,
]
];

View File

@ -37,6 +37,12 @@ return [
'route' => 'admin.sales.refunds.index',
'sort' => 4,
'icon-class' => '',
], [
'key' => 'sales.transactions',
'name' => 'admin::app.layouts.transactions',
'route' => 'admin.sales.transactions.index',
'sort' => 5,
'icon-class' => '',
], [
'key' => 'catalog',
'name' => 'admin::app.layouts.catalog',
@ -91,12 +97,6 @@ return [
'route' => 'admin.customer.review.index',
'sort' => 3,
'icon-class' => '',
], [
'key' => 'customers.subscribers',
'name' => 'admin::app.layouts.newsletter-subscriptions',
'route' => 'admin.customers.subscribers.index',
'sort' => 4,
'icon-class' => '',
], [
'key' => 'configuration',
'name' => 'admin::app.layouts.configure',
@ -182,23 +182,59 @@ return [
'sort' => 2,
'icon-class' => '',
], [
'key' => 'promotions',
'name' => 'admin::app.layouts.promotions',
'key' => 'marketing',
'name' => 'admin::app.layouts.marketing',
'route' => 'admin.catalog-rules.index',
'sort' => 5,
'icon-class' => 'promotion-icon',
], [
'key' => 'promotions.catalog-rules',
'key' => 'marketing.promotions',
'name' => 'admin::app.layouts.promotions',
'route' => 'admin.catalog-rules.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'marketing.promotions.catalog-rules',
'name' => 'admin::app.promotions.catalog-rules.title',
'route' => 'admin.catalog-rules.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'promotions.cart-rules',
'key' => 'marketing.promotions.cart-rules',
'name' => 'admin::app.promotions.cart-rules.title',
'route' => 'admin.cart-rules.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'marketing.email-marketing',
'name' => 'admin::app.layouts.email-marketing',
'route' => 'admin.email-templates.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'marketing.email-marketing.email-templates',
'name' => 'admin::app.layouts.email-templates',
'route' => 'admin.email-templates.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'marketing.email-marketing.events',
'name' => 'admin::app.layouts.events',
'route' => 'admin.events.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'marketing.email-marketing.campaigns',
'name' => 'admin::app.layouts.campaigns',
'route' => 'admin.campaigns.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'marketing.email-marketing.subscribers',
'name' => 'admin::app.layouts.newsletter-subscriptions',
'route' => 'admin.customers.subscribers.index',
'sort' => 3,
'icon-class' => '',
], [
'key' => 'cms',
'name' => 'admin::app.layouts.cms',

View File

@ -27,7 +27,7 @@ return [
'value' => 'kgs',
],
],
'channel_based' => true,
'channel_based' => true
],
],
], [
@ -41,24 +41,28 @@ return [
'type' => 'text',
'validation' => 'required|max:50',
'channel_based' => true,
'default_value' => config('mail.from.name'),
], [
'name' => 'shop_email_from',
'title' => 'admin::app.admin.system.shop-email-from',
'type' => 'text',
'validation' => 'required|email',
'channel_based' => true,
'default_value' => config('mail.from.address'),
], [
'name' => 'admin_name',
'title' => 'admin::app.admin.system.admin-name',
'type' => 'text',
'validation' => 'required|max:50',
'channel_based' => true,
'default_value' => config('mail.admin.name'),
], [
'name' => 'admin_email',
'title' => 'admin::app.admin.system.admin-email',
'type' => 'text',
'validation' => 'required|email',
'channel_based' => true,
'default_value' => config('mail.admin.address'),
],
],
], [
@ -84,6 +88,25 @@ return [
'channel_based' => true,
],
],
], [
'key' => 'general.content.custom_scripts',
'name' => 'admin::app.admin.system.custom-scripts',
'sort' => 1,
'fields' => [
[
'name' => 'custom_css',
'title' => 'admin::app.admin.system.custom-css',
'type' => 'textarea',
'channel_based' => true,
'locale_based' => false,
], [
'name' => 'custom_javascript',
'title' => 'admin::app.admin.system.custom-javascript',
'type' => 'textarea',
'channel_based' => true,
'locale_based' => false,
]
],
], [
'key' => 'general.design',
'name' => 'admin::app.admin.system.design',
@ -98,13 +121,13 @@ return [
'title' => 'admin::app.admin.system.logo-image',
'type' => 'image',
'channel_based' => true,
'validation' => 'mimes:jpeg,bmp,png,jpg',
'validation' => 'mimes:bmp,jpeg,jpg,png,webp',
], [
'name' => 'favicon',
'title' => 'admin::app.admin.system.favicon',
'type' => 'image',
'channel_based' => true,
'validation' => 'mimes:jpeg,bmp,png,jpg',
'validation' => 'mimes:bmp,jpeg,jpg,png,webp',
],
],
], [
@ -126,10 +149,33 @@ return [
'type' => 'boolean',
],
],
], [
'key' => 'catalog.products.homepage',
'name' => 'admin::app.admin.system.homepage',
'sort' => 2,
'fields' => [
[
'name' => 'no_of_new_product_homepage',
'title' => 'admin::app.admin.system.allow-no-of-new-product-homepage',
'type' => 'number',
'validation' => 'min:0',
],
[
'name' => 'no_of_featured_product_homepage',
'title' => 'admin::app.admin.system.allow-no-of-featured-product-homepage',
'type' => 'number',
'validation' => 'min:0',
],
[
'name' => 'out_of_stock_items',
'title' => 'admin::app.admin.system.allow-out-of-stock-items',
'type' => 'boolean',
],
],
], [
'key' => 'catalog.products.storefront',
'name' => 'admin::app.admin.system.storefront',
'sort' => 2,
'sort' => 3,
'fields' => [
[
'name' => 'mode',
@ -177,12 +223,64 @@ return [
],
],
'channel_based' => true,
], [
'name' => 'buy_now_button_display',
'title' => 'admin::app.admin.system.buy-now-button-display',
'type' => 'boolean',
]
],
], [
'key' => 'catalog.products.cache-small-image',
'name' => 'admin::app.admin.system.cache-small-image',
'sort' => 4,
'fields' => [
[
'name' => 'width',
'title' => 'admin::app.admin.system.width',
'type' => 'text',
],
[
'name' => 'height',
'title' => 'admin::app.admin.system.height',
'type' => 'text',
]
],
], [
'key' => 'catalog.products.cache-medium-image',
'name' => 'admin::app.admin.system.cache-medium-image',
'sort' => 5,
'fields' => [
[
'name' => 'width',
'title' => 'admin::app.admin.system.width',
'type' => 'text',
],
[
'name' => 'height',
'title' => 'admin::app.admin.system.height',
'type' => 'text',
]
],
], [
'key' => 'catalog.products.cache-large-image',
'name' => 'admin::app.admin.system.cache-large-image',
'sort' => 6,
'fields' => [
[
'name' => 'width',
'title' => 'admin::app.admin.system.width',
'type' => 'text',
],
[
'name' => 'height',
'title' => 'admin::app.admin.system.height',
'type' => 'text',
]
],
], [
'key' => 'catalog.products.review',
'name' => 'admin::app.admin.system.review',
'sort' => 3,
'sort' => 7,
'fields' => [
[
'name' => 'guest_review',
@ -190,6 +288,21 @@ return [
'type' => 'boolean',
],
],
], [
'key' => 'catalog.products.attribute',
'name' => 'admin::app.admin.system.attribute',
'sort' => 8,
'fields' => [
[
'name' => 'image_attribute_upload_size',
'title' => 'admin::app.admin.system.image-upload-size',
'type' => 'text',
], [
'name' => 'file_attribute_upload_size',
'title' => 'admin::app.admin.system.file-upload-size',
'type' => 'text',
]
],
], [
'key' => 'catalog.inventory',
'name' => 'admin::app.admin.system.inventory',

View File

@ -98,7 +98,7 @@ class AddressDataGrid extends DataGrid
'sortable' => true,
'filterable' => true,
]);
$this->addColumn([
'index' => 'city',
'label' => trans('admin::app.customers.addresses.city'),
@ -167,7 +167,7 @@ class AddressDataGrid extends DataGrid
'type' => 'delete',
'label' => trans('admin::app.customers.addresses.delete'),
'action' => route('admin.customer.addresses.massdelete', request('id')),
'method' => 'DELETE',
'method' => 'POST',
]);
}
}

View File

@ -17,6 +17,10 @@ class AttributeDataGrid extends DataGrid
->select('id')
->addSelect('id', 'code', 'admin_name', 'type', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel');
$this->addFilter('is_unique', 'is_unique');
$this->addFilter('value_per_locale', 'value_per_locale');
$this->addFilter('value_per_channel', 'value_per_channel');
$this->setQueryBuilder($queryBuilder);
}
@ -146,7 +150,7 @@ class AttributeDataGrid extends DataGrid
'action' => route('admin.catalog.attributes.massdelete'),
'label' => trans('admin::app.datagrid.delete'),
'index' => 'admin_name',
'method' => 'DELETE',
'method' => 'POST',
]);
}
}

View File

@ -78,7 +78,7 @@ class CMSPageDataGrid extends DataGrid
'type' => 'delete',
'label' => trans('admin::app.datagrid.delete'),
'action' => route('admin.cms.mass-delete'),
'method' => 'DELETE',
'method' => 'POST',
]);
}
}

View File

@ -0,0 +1,86 @@
<?php
namespace Webkul\Admin\DataGrids;
use Illuminate\Support\Facades\DB;
use Webkul\Ui\DataGrid\DataGrid;
class CampaignDataGrid extends DataGrid
{
protected $index = 'id';
protected $sortOrder = 'desc';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('marketing_campaigns')->addSelect('id', 'name', 'subject', 'status');
$this->addFilter('status', 'marketing_campaigns.status');
$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' => 'subject',
'label' => trans('admin::app.datagrid.subject'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'filterable' => true,
]);
$this->addColumn([
'index' => 'status',
'label' => trans('admin::app.status'),
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
'filterable' => true,
'wrapper' => function ($value) {
if ($value->status == 1) {
return trans('admin::app.datagrid.active');
} else {
return trans('admin::app.datagrid.inactive');
}
},
]);
}
public function prepareActions()
{
$this->addAction([
'title' => trans('admin::app.datagrid.edit'),
'method' => 'GET',
'route' => 'admin.campaigns.edit',
'icon' => 'icon pencil-lg-icon',
]);
$this->addAction([
'title' => trans('admin::app.datagrid.delete'),
'method' => 'POST',
'route' => 'admin.campaigns.delete',
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Campaign']),
'icon' => 'icon trash-icon',
]);
}
}

View File

@ -13,9 +13,13 @@ class CartRuleCouponDataGrid extends DataGrid
public function prepareQueryBuilder()
{
$route = request()->route() ? request()->route()->getName() : "" ;
$cartRuleId = $route == 'admin.cart-rules.edit' ? collect(request()->segments())->last() : last(explode("/", url()->previous()));
$queryBuilder = DB::table('cart_rule_coupons')
->addSelect('id', 'code', 'created_at', 'expired_at', 'times_used')
->where('cart_rule_coupons.cart_rule_id', collect(request()->segments())->last());
->addSelect('id', 'code', 'created_at', 'expired_at', 'times_used')
->where('cart_rule_coupons.cart_rule_id', $cartRuleId);
$this->setQueryBuilder($queryBuilder);
}
@ -74,7 +78,7 @@ class CartRuleCouponDataGrid extends DataGrid
'type' => 'delete',
'action' => route('admin.cart-rule-coupons.mass-delete'),
'label' => trans('admin::app.datagrid.delete'),
'method' => 'DELETE',
'method' => 'POST',
]);
}
}

View File

@ -15,6 +15,12 @@ class CartRuleDataGrid extends DataGrid
protected $channel = 'all';
/** @var string[] contains the keys for which extra filters to show */
protected $extraFilters = [
'channels',
'customer_groups',
];
public function __construct()
{
parent::__construct();
@ -56,6 +62,8 @@ class CartRuleDataGrid extends DataGrid
$queryBuilder->where('cart_rule_channels.channel_id', $this->channel);
}
$this->addFilter('status', 'status');
$this->setQueryBuilder($queryBuilder);
}
@ -116,8 +124,10 @@ class CartRuleDataGrid extends DataGrid
'wrapper' => function ($value) {
if ($value->status == 1) {
return trans('admin::app.datagrid.active');
} else {
} else if ($value->status == 0) {
return trans('admin::app.datagrid.inactive');
} else {
return trans('admin::app.datagrid.draft');
}
},
]);
@ -145,7 +155,7 @@ class CartRuleDataGrid extends DataGrid
'title' => trans('admin::app.datagrid.copy'),
'method' => 'GET',
'route' => 'admin.cart-rules.copy',
'icon' => 'icon note-icon',
'icon' => 'icon copy-icon',
]);
$this->addAction([

View File

@ -16,6 +16,9 @@ class CatalogRuleDataGrid extends DataGrid
$queryBuilder = DB::table('catalog_rules')
->addSelect('catalog_rules.id', 'name', 'status', 'starts_from', 'ends_till', 'sort_order');
$this->addFilter('status', 'status');
$this->setQueryBuilder($queryBuilder);
}

View File

@ -24,6 +24,7 @@ class CategoryDataGrid extends DataGrid
->groupBy('cat.id');
$this->addFilter('status', 'cat.status');
$this->addFilter('category_id', 'cat.id');
$this->setQueryBuilder($queryBuilder);
@ -99,6 +100,14 @@ class CategoryDataGrid extends DataGrid
'route' => 'admin.catalog.categories.delete',
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
'icon' => 'icon trash-icon',
'function' => 'deleteFunction($event, "delete")'
]);
$this->addMassAction([
'type' => 'delete',
'label' => trans('admin::app.datagrid.delete'),
'action' => route('admin.catalog.categories.massdelete'),
'method' => 'POST',
]);
}
}

View File

@ -2,18 +2,63 @@
namespace Webkul\Admin\DataGrids;
use Illuminate\Support\Facades\DB;
use Webkul\Ui\DataGrid\DataGrid;
use Webkul\Core\Repositories\ChannelRepository;
class ChannelDataGrid extends DataGrid
{
/**
* Assign primary key.
*/
protected $index = 'id';
/**
* Sort order.
*/
protected $sortOrder = 'desc';
/**
* Filter Locale.
*/
protected $locale;
/**
* ChannelRepository $channelRepository
*
* @var \Webkul\Core\Repositories\ChannelRepository
*/
protected $channelRepository;
/**
* Create a new datagrid instance.
*
* @param \Webkul\Core\Repositories\ChannelRepository $channelRepository
* @return void
*/
public function __construct(
ChannelRepository $channelRepository
)
{
parent::__construct();
$this->locale = request()->get('locale') ?? app()->getLocale();
$this->channelRepository = $channelRepository;
}
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('channels')->addSelect('id', 'code', 'name', 'hostname');
$queryBuilder = $this->channelRepository->query()
->leftJoin('channel_translations', function($leftJoin) {
$leftJoin->on('channel_translations.channel_id', '=', 'channels.id')
->where('channel_translations.locale', $this->locale);
})
->addSelect('channels.id', 'channels.code', 'channel_translations.locale', 'channel_translations.name as translated_name', 'channels.hostname');
$this->addFilter('id', 'channels.id');
$this->addFilter('code', 'channels.code');
$this->addFilter('hostname', 'channels.hostname');
$this->addFilter('translated_name', 'channel_translations.name');
$this->setQueryBuilder($queryBuilder);
}
@ -39,7 +84,7 @@ class ChannelDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'name',
'index' => 'translated_name',
'label' => trans('admin::app.datagrid.name'),
'type' => 'string',
'searchable' => true,

View File

@ -2,8 +2,8 @@
namespace Webkul\Admin\DataGrids;
use Illuminate\Support\Facades\DB;
use Webkul\Ui\DataGrid\DataGrid;
use Illuminate\Support\Facades\DB;
class CustomerDataGrid extends DataGrid
{
@ -17,13 +17,15 @@ class CustomerDataGrid extends DataGrid
{
$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', 'customers.phone', 'customers.gender', 'status')
->addSelect('customers.id as customer_id', 'customers.email', 'customer_groups.name as group', 'customers.phone', 'customers.gender', 'status')
->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'customers.first_name, " ", ' . DB::getTablePrefix() . 'customers.last_name) as full_name'));
$this->addFilter('customer_id', 'customers.id');
$this->addFilter('full_name', DB::raw('CONCAT(' . DB::getTablePrefix() . 'customers.first_name, " ", ' . DB::getTablePrefix() . 'customers.last_name)'));
$this->addFilter('group', 'customer_groups.name');
$this->addFilter('phone', 'customers.phone');
$this->addFilter('gender', 'customers.gender');
$this->addFilter('status', 'status');
$this->setQueryBuilder($queryBuilder);
}
@ -58,7 +60,7 @@ class CustomerDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'name',
'index' => 'group',
'label' => trans('admin::app.datagrid.group'),
'type' => 'string',
'searchable' => false,
@ -167,14 +169,14 @@ class CustomerDataGrid extends DataGrid
'type' => 'delete',
'label' => trans('admin::app.datagrid.delete'),
'action' => route('admin.customer.mass-delete'),
'method' => 'PUT',
'method' => 'POST',
]);
$this->addMassAction([
'type' => 'update',
'label' => trans('admin::app.datagrid.update-status'),
'action' => route('admin.customer.mass-update'),
'method' => 'PUT',
'method' => 'POST',
'options' => [
'Active' => 1,
'Inactive' => 0,

View File

@ -15,7 +15,7 @@ class CustomerReviewDataGrid extends DataGrid
{
$queryBuilder = DB::table('product_reviews as pr')
->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')
->select('pr.id as product_review_id', 'pr.title', 'pr.comment', 'pf.name as product_name', 'pr.status as product_review_status', 'pr.rating')
->where('channel', core()->getCurrentChannelCode())
->where('locale', app()->getLocale());
@ -55,6 +55,15 @@ class CustomerReviewDataGrid extends DataGrid
'filterable' => true,
]);
$this->addColumn([
'index' => 'rating',
'label' => trans('admin::app.customers.reviews.rating'),
'type' => 'number',
'searchable' => true,
'sortable' => true,
'filterable' => true,
]);
$this->addColumn([
'index' => 'product_name',
'label' => trans('admin::app.datagrid.product-name'),
@ -108,14 +117,14 @@ class CustomerReviewDataGrid extends DataGrid
'type' => 'delete',
'label' => trans('admin::app.datagrid.delete'),
'action' => route('admin.customer.review.massdelete'),
'method' => 'DELETE',
'method' => 'POST',
]);
$this->addMassAction([
'type' => 'update',
'label' => trans('admin::app.datagrid.update-status'),
'action' => route('admin.customer.review.massupdate'),
'method' => 'PUT',
'method' => 'POST',
'options' => [
trans('admin::app.customers.reviews.pending') => 0,
trans('admin::app.customers.reviews.approved') => 1,

View File

@ -0,0 +1,79 @@
<?php
namespace Webkul\Admin\DataGrids;
use Illuminate\Support\Facades\DB;
use Webkul\Ui\DataGrid\DataGrid;
class EmailTemplateDataGrid extends DataGrid
{
protected $index = 'id';
protected $sortOrder = 'desc';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('marketing_templates')->addSelect('id', 'name', 'status');
$this->addFilter('status', 'status');
$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' => 'status',
'label' => trans('admin::app.status'),
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
'filterable' => true,
'wrapper' => function ($value) {
if ($value->status == 'active') {
return trans('admin::app.datagrid.active');
} else if ($value->status == 'inactive') {
return trans('admin::app.datagrid.inactive');
} else if ($value->status == 'draft') {
return trans('admin::app.datagrid.draft');
}
},
]);
}
public function prepareActions()
{
$this->addAction([
'title' => trans('admin::app.datagrid.edit'),
'method' => 'GET',
'route' => 'admin.email-templates.edit',
'icon' => 'icon pencil-lg-icon',
]);
$this->addAction([
'title' => trans('admin::app.datagrid.delete'),
'method' => 'POST',
'route' => 'admin.email-templates.delete',
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Email Template']),
'icon' => 'icon trash-icon',
]);
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace Webkul\Admin\DataGrids;
use Illuminate\Support\Facades\DB;
use Webkul\Ui\DataGrid\DataGrid;
class EventDataGrid extends DataGrid
{
protected $index = 'id';
protected $sortOrder = 'desc';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('marketing_events')->addSelect('id', 'name', 'date');
$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' => 'date',
'label' => trans('admin::app.datagrid.date'),
'type' => 'datetime',
'searchable' => true,
'sortable' => true,
'filterable' => true,
]);
}
public function prepareActions()
{
$this->addAction([
'title' => trans('admin::app.datagrid.edit'),
'method' => 'GET',
'route' => 'admin.events.edit',
'icon' => 'icon pencil-lg-icon',
]);
$this->addAction([
'title' => trans('admin::app.datagrid.delete'),
'method' => 'POST',
'route' => 'admin.events.delete',
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'Event']),
'icon' => 'icon trash-icon',
]);
}
}

View File

@ -15,6 +15,8 @@ class InventorySourcesDataGrid extends DataGrid
{
$queryBuilder = DB::table('inventory_sources')->addSelect('id', 'code', 'name', 'priority', 'status');
$this->addFilter('status', 'status');
$this->setQueryBuilder($queryBuilder);
}

View File

@ -13,7 +13,11 @@ class NewsLetterDataGrid extends DataGrid
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('subscribers_list')->addSelect('id', 'is_subscribed', 'email');
$queryBuilder = DB::table('subscribers_list')->select('subscribers_list.id', 'subscribers_list.is_subscribed as status', 'subscribers_list.email');
$this->addFilter('status', 'subscribers_list.is_subscribed');
$this->setQueryBuilder($queryBuilder);
}
@ -30,14 +34,14 @@ class NewsLetterDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'is_subscribed',
'index' => 'status',
'label' => trans('admin::app.datagrid.subscribed'),
'type' => 'string',
'searchable' => false,
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
'filterable' => true,
'wrapper' => function($value) {
if ($value->is_subscribed == 1) {
'wrapper' => function ($value) {
if ($value->status === 1) {
return trans('admin::app.datagrid.true');
} else {
return trans('admin::app.datagrid.false');

View File

@ -2,12 +2,15 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\DataGrid;
use Illuminate\Support\Facades\DB;
use Webkul\Sales\Models\OrderAddress;
use Webkul\Ui\DataGrid\DataGrid;
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus;
class OrderDataGrid extends DataGrid
{
use ProvideDataGridPlus;
protected $index = 'id';
protected $sortOrder = 'desc';
@ -15,15 +18,15 @@ class OrderDataGrid extends DataGrid
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('orders')
->leftJoin('addresses as order_address_shipping', function($leftJoin) {
->leftJoin('addresses as order_address_shipping', function ($leftJoin) {
$leftJoin->on('order_address_shipping.order_id', '=', 'orders.id')
->where('order_address_shipping.address_type', OrderAddress::ADDRESS_TYPE_SHIPPING);
->where('order_address_shipping.address_type', OrderAddress::ADDRESS_TYPE_SHIPPING);
})
->leftJoin('addresses as order_address_billing', function($leftJoin) {
->leftJoin('addresses as order_address_billing', function ($leftJoin) {
$leftJoin->on('order_address_billing.order_id', '=', 'orders.id')
->where('order_address_billing.address_type', OrderAddress::ADDRESS_TYPE_BILLING);
->where('order_address_billing.address_type', OrderAddress::ADDRESS_TYPE_BILLING);
})
->addSelect('orders.id','orders.increment_id', 'orders.base_sub_total', 'orders.base_grand_total', 'orders.created_at', 'channel_name', 'status')
->addSelect('orders.id', 'orders.increment_id', 'orders.base_sub_total', 'orders.base_grand_total', 'orders.created_at', 'channel_name', 'status')
->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_billing.first_name, " ", ' . DB::getTablePrefix() . 'order_address_billing.last_name) as billed_to'))
->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_shipping.first_name, " ", ' . DB::getTablePrefix() . 'order_address_shipping.last_name) as shipped_to'));
@ -92,19 +95,19 @@ class OrderDataGrid extends DataGrid
'filterable' => true,
'wrapper' => function ($value) {
if ($value->status == 'processing') {
return '<span class="badge badge-md badge-success">'. trans('admin::app.sales.orders.order-status-processing') .'</span>';
return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-processing') . '</span>';
} elseif ($value->status == 'completed') {
return '<span class="badge badge-md badge-success">'. trans('admin::app.sales.orders.order-status-success') .'</span>';
return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-success') . '</span>';
} elseif ($value->status == "canceled") {
return '<span class="badge badge-md badge-danger">'. trans('admin::app.sales.orders.order-status-canceled') .'</span>';
return '<span class="badge badge-md badge-danger">' . trans('admin::app.sales.orders.order-status-canceled') . '</span>';
} elseif ($value->status == "closed") {
return '<span class="badge badge-md badge-info">'. trans('admin::app.sales.orders.order-status-closed') .'</span>';
return '<span class="badge badge-md badge-info">' . trans('admin::app.sales.orders.order-status-closed') . '</span>';
} elseif ($value->status == "pending") {
return '<span class="badge badge-md badge-warning">'. trans('admin::app.sales.orders.order-status-pending') .'</span>';
return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.orders.order-status-pending') . '</span>';
} elseif ($value->status == "pending_payment") {
return '<span class="badge badge-md badge-warning">'. trans('admin::app.sales.orders.order-status-pending-payment') .'</span>';
return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.orders.order-status-pending-payment') . '</span>';
} elseif ($value->status == "fraud") {
return '<span class="badge badge-md badge-danger">'. trans('admin::app.sales.orders.order-status-fraud') . '</span>';
return '<span class="badge badge-md badge-danger">' . trans('admin::app.sales.orders.order-status-fraud') . '</span>';
}
},
]);
@ -137,4 +140,4 @@ class OrderDataGrid extends DataGrid
'icon' => 'icon eye-icon',
]);
}
}
}

View File

@ -0,0 +1,76 @@
<?php
namespace Webkul\Admin\DataGrids;
use Illuminate\Support\Facades\DB;
use Webkul\Ui\DataGrid\DataGrid;
class OrderTransactionsDataGrid extends DataGrid
{
protected $index = 'id';
protected $sortOrder = 'desc';
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('order_transactions')
->leftJoin('orders as ors', 'order_transactions.order_id', '=', 'ors.id')
->select('order_transactions.id as id', 'order_transactions.transaction_id as transaction_id', 'ors.increment_id as order_id', 'order_transactions.created_at as created_at');
$this->addFilter('id', 'order_transactions.id');
$this->addFilter('transaction_id', 'order_transactions.transaction_id');
$this->addFilter('order_id', 'ors.increment_id');
$this->addFilter('created_at', 'order_transactions.created_at');
$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' => 'transaction_id',
'label' => trans('admin::app.datagrid.transaction-id'),
'type' => 'string',
'searchable' => false,
'sortable' => true,
'filterable' => true,
]);
$this->addColumn([
'index' => 'order_id',
'label' => trans('admin::app.datagrid.order-id'),
'type' => 'number',
'searchable' => true,
'sortable' => true,
'filterable' => true,
]);
$this->addColumn([
'index' => 'created_at',
'label' => trans('admin::app.datagrid.transaction-date'),
'type' => 'datetime',
'searchable' => true,
'sortable' => true,
'filterable' => true,
]);
}
public function prepareActions()
{
$this->addAction([
'title' => trans('admin::app.datagrid.view'),
'method' => 'GET',
'route' => 'admin.sales.transactions.view',
'icon' => 'icon eye-icon',
]);
}
}

View File

@ -2,6 +2,8 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Core\Models\Locale;
use Webkul\Core\Models\Channel;
use Webkul\Ui\DataGrid\DataGrid;
use Illuminate\Support\Facades\DB;
@ -17,24 +19,54 @@ class ProductDataGrid extends DataGrid
protected $channel = 'all';
/** @var string[] contains the keys for which extra filters to render */
protected $extraFilters = [
'channels',
'locales',
];
public function __construct()
{
parent::__construct();
$this->locale = request()->get('locale') ?? 'all';
/* locale */
$this->locale = request()->get('locale') ?? app()->getLocale();
$this->channel = request()->get('channel') ?? 'all';
/* channel */
$this->channel = request()->get('channel') ?? (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
/* finding channel code */
if ($this->channel !== 'all') {
$this->channel = Channel::query()->find($this->channel);
$this->channel = $this->channel ? $this->channel->code : 'all';
}
}
public function prepareQueryBuilder()
{
if ($this->channel === 'all') {
$whereInChannels = Channel::query()->pluck('code')->toArray();
} else {
$whereInChannels = [$this->channel];
}
if ($this->locale === 'all') {
$whereInLocales = Locale::query()->pluck('code')->toArray();
} else {
$whereInLocales = [$this->locale];
}
/* query builder */
$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.locale',
'product_flat.channel',
'product_flat.product_id',
'products.sku as product_sku',
'product_flat.product_number',
'product_flat.name as product_name',
'products.type as product_type',
'product_flat.status',
@ -43,23 +75,15 @@ class ProductDataGrid extends DataGrid
DB::raw('SUM(DISTINCT ' . DB::getTablePrefix() . 'product_inventories.qty) as quantity')
);
if ($this->locale !== 'all') {
$queryBuilder->where('locale', $this->locale);
}
$queryBuilder->groupBy('product_flat.product_id', 'product_flat.locale', 'product_flat.channel');
if ($this->channel !== 'all') {
$queryBuilder->where('channel', $this->channel);
}
if ($currentLocale = app()->getLocale()) {
$queryBuilder->where('product_flat.locale', $currentLocale);
}
$queryBuilder->groupBy('product_flat.product_id');
$queryBuilder->whereIn('product_flat.locale', $whereInLocales);
$queryBuilder->whereIn('product_flat.channel', $whereInChannels);
$this->addFilter('product_id', 'product_flat.product_id');
$this->addFilter('product_name', 'product_flat.name');
$this->addFilter('product_sku', 'products.sku');
$this->addFilter('product_number', 'product_flat.product_number');
$this->addFilter('status', 'product_flat.status');
$this->addFilter('product_type', 'products.type');
$this->addFilter('attribute_family', 'attribute_families.name');
@ -87,6 +111,15 @@ class ProductDataGrid extends DataGrid
'filterable' => true,
]);
$this->addColumn([
'index' => 'product_number',
'label' => trans('admin::app.datagrid.product-number'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'filterable' => true,
]);
$this->addColumn([
'index' => 'product_name',
'label' => trans('admin::app.datagrid.name'),
@ -179,18 +212,25 @@ class ProductDataGrid extends DataGrid
public function prepareMassActions()
{
$this->addAction([
'title' => trans('admin::app.datagrid.copy'),
'method' => 'GET',
'route' => 'admin.catalog.products.copy',
'icon' => 'icon copy-icon',
]);
$this->addMassAction([
'type' => 'delete',
'label' => trans('admin::app.datagrid.delete'),
'action' => route('admin.catalog.products.massdelete'),
'method' => 'DELETE',
'method' => 'POST',
]);
$this->addMassAction([
'type' => 'update',
'label' => trans('admin::app.datagrid.update-status'),
'action' => route('admin.catalog.products.massupdate'),
'method' => 'PUT',
'method' => 'POST',
'options' => [
'Active' => 1,
'Inactive' => 0,

View File

@ -2,12 +2,13 @@
namespace Webkul\Admin\DataGrids;
use Illuminate\Support\Facades\DB;
use Webkul\Core\Models\Channel;
use Webkul\Ui\DataGrid\DataGrid;
use Illuminate\Support\Facades\DB;
class SliderDataGrid extends DataGrid
{
protected $index = 'slider_id';
protected $index = 'id';
protected $sortOrder = 'desc';
@ -15,30 +16,54 @@ class SliderDataGrid extends DataGrid
protected $channel = 'all';
/**
* Contains the keys for which extra filters to render.
*
* @var string[]
**/
protected $extraFilters = [
'channels',
'locales',
];
public function __construct()
{
parent::__construct();
$this->locale = request()->get('locale') ?? 'all';
$this->channel = request()->get('channel') ?? 'all';
/* locale */
$this->locale = request()->get('locale') ?? app()->getLocale();
/* channel */
$this->channel = request()->get('channel') ?? (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
/* finding channel code */
if ($this->channel !== 'all') {
$this->channel = Channel::query()->find($this->channel);
$this->channel = $this->channel ? $this->channel->code : 'all';
}
}
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('sliders as sl')
->addSelect('sl.id as slider_id', 'sl.title', 'sl.locale', 'ch.name', 'ch.code')
->leftJoin('channels as ch', 'sl.channel_id', '=', 'ch.id');
->select('sl.id', 'sl.title', 'sl.locale', 'ct.channel_id', 'ct.name', 'ch.code')
->leftJoin('channels as ch', 'sl.channel_id', '=', 'ch.id')
->leftJoin('channel_translations as ct', 'ch.id', '=', 'ct.channel_id')
->where('ct.locale', app()->getLocale());
if ($this->locale !== 'all') {
$queryBuilder->where('locale', $this->locale);
$queryBuilder->whereRaw("find_in_set(?, sl.locale)", [$this->locale]);
}
if ($this->channel !== 'all') {
$queryBuilder->where('ch.code', $this->channel);
}
$this->addFilter('slider_id', 'sl.id');
$this->addFilter('channel_name', 'ch.name');
$this->addFilter('id', 'sl.id');
$this->addFilter('title', 'sl.title');
$this->addFilter('locale', 'sl.locale');
$this->addFilter('channel_name', 'ct.name');
$this->addFilter('code', 'ch.code');
$this->setQueryBuilder($queryBuilder);
}
@ -46,7 +71,7 @@ class SliderDataGrid extends DataGrid
public function addColumns()
{
$this->addColumn([
'index' => 'slider_id',
'index' => 'id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'number',
'searchable' => false,

View File

@ -105,7 +105,7 @@ class TaxRateDataGrid extends DataGrid
$this->addAction([
'title' => trans('admin::app.datagrid.edit'),
'method' => 'GET',
'route' => 'admin.tax-rates.store',
'route' => 'admin.tax-rates.edit',
'icon' => 'icon pencil-lg-icon',
]);

View File

@ -20,6 +20,7 @@ class UserDataGrid extends DataGrid
$this->addFilter('user_id', 'u.id');
$this->addFilter('user_name', 'u.name');
$this->addFilter('role_name', 'ro.name');
$this->addFilter('status', 'u.status');
$this->setQueryBuilder($queryBuilder);
}

View File

@ -10,6 +10,7 @@ use Webkul\User\Database\Seeders\DatabaseSeeder as UserSeeder;
use Webkul\Customer\Database\Seeders\DatabaseSeeder as CustomerSeeder;
use Webkul\Inventory\Database\Seeders\DatabaseSeeder as InventorySeeder;
use Webkul\CMS\Database\Seeders\DatabaseSeeder as CMSSeeder;
use Webkul\SocialLogin\Database\Seeders\DatabaseSeeder as SocialLoginSeeder;
class DatabaseSeeder extends Seeder
{
@ -27,5 +28,6 @@ class DatabaseSeeder extends Seeder
$this->call(UserSeeder::class);
$this->call(CustomerSeeder::class);
$this->call(CMSSeeder::class);
$this->call(SocialLoginSeeder::class);
}
}
}

View File

@ -170,7 +170,7 @@ class AddressController extends Controller
session()->flash('success', trans('admin::app.customers.addresses.success-delete'));
return redirect()->back();
return redirect()->route($this->_config['redirect']);
}
/**

View File

@ -64,12 +64,12 @@ class CustomerController extends Controller
CustomerGroupRepository $customerGroupRepository,
ChannelRepository $channelRepository
)
{
$this->_config = request('_config');
$this->middleware('admin');
$this->customerRepository = $customerRepository;
$this->customerAddressRepository = $customerAddressRepository;
$this->customerGroupRepository = $customerGroupRepository;
$this->channelRepository = $channelRepository;
@ -200,12 +200,20 @@ class CustomerController extends Controller
$customer = $this->customerRepository->findorFail($id);
try {
$this->customerRepository->delete($id);
if (! $this->customerRepository->checkIfCustomerHasOrderPendingOrProcessing($customer)) {
$this->customerRepository->delete($id);
} else {
session()->flash('error', trans('admin::app.response.order-pending', ['name' => 'Customer']));
return response()->json(['message' => false], 400);
}
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']));
}
@ -279,12 +287,18 @@ class CustomerController extends Controller
{
$customerIds = explode(',', request()->input('indexes'));
foreach ($customerIds as $customerId) {
$this->customerRepository->deleteWhere(['id' => $customerId]);
if (!$this->customerRepository->checkBulkCustomerIfTheyHaveOrderPendingOrProcessing($customerIds)) {
foreach ($customerIds as $customerId) {
$this->customerRepository->deleteWhere(['id' => $customerId]);
}
session()->flash('success', trans('admin::app.customers.customers.mass-destroy-success'));
return redirect()->back();
}
session()->flash('success', trans('admin::app.customers.customers.mass-destroy-success'));
session()->flash('error', trans('admin::app.response.order-pending', ['name' => 'Customers']));
return redirect()->back();
}

View File

@ -124,7 +124,7 @@ class CustomerGroupController extends Controller
if ($customerGroup->is_user_defined == 0) {
session()->flash('warning', trans('admin::app.customers.customers.group-default'));
} elseif (count($customerGroup->customer) > 0) {
} elseif (count($customerGroup->customers) > 0) {
session()->flash('warning', trans('admin::app.response.customer-associate', ['name' => 'Customer Group']));
} else {
try {

View File

@ -211,7 +211,7 @@ class DashboardController extends Controller
/**
* Returns top selling products
*
*
* @return \Illuminate\Support\Collection
*/
public function getTopSellingProducts()
@ -235,12 +235,17 @@ class DashboardController extends Controller
*/
public function getCustomerWithMostSales()
{
$dbPrefix = DB::getTablePrefix();
return $this->orderRepository->getModel()
->select(DB::raw('SUM(base_grand_total) as total_base_grand_total'))
->addSelect(DB::raw('COUNT(id) as total_orders'))
->addSelect('id', 'customer_id', 'customer_email', 'customer_first_name', 'customer_last_name')
->leftJoin('refunds', 'orders.id', 'refunds.order_id')
->select(DB::raw("(SUM({$dbPrefix}orders.base_grand_total) - SUM(IFNULL({$dbPrefix}refunds.base_grand_total, 0))) as total_base_grand_total"))
->addSelect(DB::raw("COUNT({$dbPrefix}orders.id) as total_orders"))
->addSelect('orders.id', 'customer_id', 'customer_email', 'customer_first_name', 'customer_last_name')
->where('orders.created_at', '>=', $this->startDate)
->where('orders.created_at', '<=', $this->endDate)
->where('orders.status', '<>', 'closed')
->where('orders.status', '<>', 'canceled')
->groupBy('customer_email')
->orderBy('total_base_grand_total', 'DESC')
->limit(5)

Some files were not shown because too many files have changed in this diff Show More