From 1c7ea33817ee2e5aebb3a59a5834a8ebc43b97e6 Mon Sep 17 00:00:00 2001 From: Rene Hrdina Date: Wed, 18 Nov 2020 15:37:08 +0100 Subject: [PATCH 001/151] Allow to disable actions on a per-row (per-record) basis When adding actions to a dataGrid the `condition` key can be specified. It can hold a function which currently doesn't receive any parameters. When we pass the record here we allow developers to decide whether or not to show a action on a per-row (per-record) basis, so showing an action for some items, hiding it for others. --- packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php b/packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php index 6e48f0526..962bf7811 100644 --- a/packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php +++ b/packages/Webkul/Ui/src/Resources/views/datagrid/body.blade.php @@ -43,7 +43,7 @@
@foreach ($actions as $action) @php - $toDisplay = (isset($action['condition']) && gettype($action['condition']) == 'object') ? $action['condition']() : true; + $toDisplay = (isset($action['condition']) && gettype($action['condition']) == 'object') ? $action['condition']($record) : true; @endphp @if ($toDisplay) From 4388bc8dbcda93d4fd1a88856c481740a8f4731b Mon Sep 17 00:00:00 2001 From: devansh bawari Date: Mon, 4 Jan 2021 12:36:54 +0530 Subject: [PATCH 002/151] Dependency Updates --- composer.json | 84 ++++++++++++++------------------ composer.lock | 132 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 127 insertions(+), 89 deletions(-) diff --git a/composer.json b/composer.json index bda61cbbb..459f9ca38 100755 --- a/composer.json +++ b/composer.json @@ -1,13 +1,12 @@ { "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": "*", @@ -37,12 +36,11 @@ "laravel/socialite": "^4.4", "laravel/tinker": "^2.0", "laravel/ui": "^2.0", - "maatwebsite/excel": "3.1.19", + "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": { "codeception/codeception": "4.1.1", "codeception/module-asserts": "^1.1", @@ -54,7 +52,6 @@ "nunomaduro/collision": "^4.1", "phpunit/phpunit": "^8.5" }, - "replace": { "bagisto/laravel-user": "v0.1.0", "bagisto/laravel-admin": "v0.1.0", @@ -76,43 +73,41 @@ "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", - "Webkul\\DebugBar\\": "packages/Webkul/DebugBar/src" - } + "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", + "Webkul\\DebugBar\\": "packages/Webkul/DebugBar/src" + } }, - "autoload-dev": { "psr-4": { "Tests\\Acceptance\\": "tests/acceptance/", @@ -121,7 +116,6 @@ "Tests\\Trigger\\": "tests/trigger/" } }, - "extra": { "laravel": { "dont-discover": [ @@ -129,22 +123,18 @@ ] } }, - "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" ], - "test": [ "set -e", "@php artisan migrate:fresh --env=testing", @@ -152,7 +142,7 @@ "vendor/bin/codecept run functional", "vendor/bin/codecept run trigger" ], - "test-win": [ + "test-win": [ "@set -e", "@php artisan migrate:fresh --env=testing", "vendor\\bin\\codecept.bat run unit", @@ -167,4 +157,4 @@ }, "minimum-stability": "dev", "prefer-stable": true - } +} \ No newline at end of file diff --git a/composer.lock b/composer.lock index 93cffc317..dcd4cb83f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "35194c542c75bb48f7c73bcc0197ab2b", + "content-hash": "8c9e174a92fc1924daca20c89f718a0e", "packages": [ { "name": "algolia/algoliasearch-client-php", @@ -1056,16 +1056,16 @@ }, { "name": "egulias/email-validator", - "version": "2.1.24", + "version": "2.1.25", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "ca90a3291eee1538cd48ff25163240695bd95448" + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ca90a3291eee1538cd48ff25163240695bd95448", - "reference": "ca90a3291eee1538cd48ff25163240695bd95448", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4", "shasum": "" }, "require": { @@ -1110,7 +1110,7 @@ "validation", "validator" ], - "time": "2020-11-14T15:56:27+00:00" + "time": "2020-12-29T14:50:06+00:00" }, { "name": "elasticsearch/elasticsearch", @@ -1278,6 +1278,56 @@ "description": "Fork of guzzle/RingPHP (abandoned) to be used with elasticsearch-php", "time": "2020-02-14T23:51:21+00:00" }, + { + "name": "ezyang/htmlpurifier", + "version": "v4.13.0", + "source": { + "type": "git", + "url": "https://github.com/ezyang/htmlpurifier.git", + "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/08e27c97e4c6ed02f37c5b2b20488046c8d90d75", + "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "require-dev": { + "simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd" + }, + "type": "library", + "autoload": { + "psr-0": { + "HTMLPurifier": "library/" + }, + "files": [ + "library/HTMLPurifier.composer.php" + ], + "exclude-from-classmap": [ + "/library/HTMLPurifier/Language/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1-or-later" + ], + "authors": [ + { + "name": "Edward Z. Yang", + "email": "admin@htmlpurifier.org", + "homepage": "http://ezyang.com" + } + ], + "description": "Standards compliant HTML filter written in PHP", + "homepage": "http://htmlpurifier.org/", + "keywords": [ + "html" + ], + "time": "2020-06-29T00:56:53+00:00" + }, { "name": "fideloper/proxy", "version": "4.4.1", @@ -2138,16 +2188,16 @@ }, { "name": "laravel/scout", - "version": "v8.5.1", + "version": "v8.5.2", "source": { "type": "git", "url": "https://github.com/laravel/scout.git", - "reference": "b8b8a35cc3ac82cbc07dfa83955492d2ef6e237b" + "reference": "ece6758b82c51ff7f5e011f243a7c6b33711a847" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/scout/zipball/b8b8a35cc3ac82cbc07dfa83955492d2ef6e237b", - "reference": "b8b8a35cc3ac82cbc07dfa83955492d2ef6e237b", + "url": "https://api.github.com/repos/laravel/scout/zipball/ece6758b82c51ff7f5e011f243a7c6b33711a847", + "reference": "ece6758b82c51ff7f5e011f243a7c6b33711a847", "shasum": "" }, "require": { @@ -2199,7 +2249,7 @@ "laravel", "search" ], - "time": "2020-12-22T17:29:20+00:00" + "time": "2020-12-30T15:52:14+00:00" }, { "name": "laravel/socialite", @@ -2704,29 +2754,26 @@ }, { "name": "maatwebsite/excel", - "version": "3.1.19", + "version": "3.1.26", "source": { "type": "git", "url": "https://github.com/Maatwebsite/Laravel-Excel.git", - "reference": "96527a9ebc2e79e9a5fa7eaef7e23c9e9bcc587c" + "reference": "66f7c9584304ad0b6a267a5d8ffbfa2ff4272e85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/96527a9ebc2e79e9a5fa7eaef7e23c9e9bcc587c", - "reference": "96527a9ebc2e79e9a5fa7eaef7e23c9e9bcc587c", + "url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/66f7c9584304ad0b6a267a5d8ffbfa2ff4272e85", + "reference": "66f7c9584304ad0b6a267a5d8ffbfa2ff4272e85", "shasum": "" }, "require": { "ext-json": "*", - "illuminate/support": "5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0", - "php": "^7.0", - "phpoffice/phpspreadsheet": "^1.10" + "illuminate/support": "5.8.*|^6.0|^7.0|^8.0", + "php": "^7.0|^8.0", + "phpoffice/phpspreadsheet": "^1.15" }, "require-dev": { - "mockery/mockery": "^1.1", - "orchestra/database": "^4.0", - "orchestra/testbench": "^4.0", - "phpunit/phpunit": "^8.0", + "orchestra/testbench": "^6.0", "predis/predis": "^1.1" }, "type": "library", @@ -2767,7 +2814,7 @@ "php", "phpspreadsheet" ], - "time": "2020-02-28T15:47:45+00:00" + "time": "2020-11-27T16:17:38+00:00" }, { "name": "maennchen/zipstream-php", @@ -3607,16 +3654,16 @@ }, { "name": "phpoffice/phpspreadsheet", - "version": "1.15.0", + "version": "1.16.1", "source": { "type": "git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "a8e8068b31b8119e1daa5b1eb5715a3a8ea8305f" + "reference": "76d4323b85129d0c368149c831a07a3e258b2b50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/a8e8068b31b8119e1daa5b1eb5715a3a8ea8305f", - "reference": "a8e8068b31b8119e1daa5b1eb5715a3a8ea8305f", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/76d4323b85129d0c368149c831a07a3e258b2b50", + "reference": "76d4323b85129d0c368149c831a07a3e258b2b50", "shasum": "" }, "require": { @@ -3633,10 +3680,11 @@ "ext-xmlwriter": "*", "ext-zip": "*", "ext-zlib": "*", + "ezyang/htmlpurifier": "^4.13", "maennchen/zipstream-php": "^2.1", - "markbaker/complex": "^1.5|^2.0", - "markbaker/matrix": "^1.2|^2.0", - "php": "^7.2|^8.0", + "markbaker/complex": "^1.5||^2.0", + "markbaker/matrix": "^1.2||^2.0", + "php": "^7.2||^8.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", "psr/simple-cache": "^1.0" @@ -3647,7 +3695,7 @@ "jpgraph/jpgraph": "^4.0", "mpdf/mpdf": "^8.0", "phpcompatibility/php-compatibility": "^9.3", - "phpunit/phpunit": "^8.5|^9.3", + "phpunit/phpunit": "^8.5||^9.3", "squizlabs/php_codesniffer": "^3.5", "tecnickcom/tcpdf": "^6.3" }, @@ -3699,7 +3747,7 @@ "xls", "xlsx" ], - "time": "2020-10-11T13:20:59+00:00" + "time": "2020-12-31T18:03:49+00:00" }, { "name": "phpoption/phpoption", @@ -6860,16 +6908,16 @@ }, { "name": "codeception/lib-innerbrowser", - "version": "1.3.4", + "version": "1.3.5", "source": { "type": "git", "url": "https://github.com/Codeception/lib-innerbrowser.git", - "reference": "fd921e089147057b456ca3660de72112167e40a4" + "reference": "956101b060a0d898a1ed8c106fd4d81adf25fd87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/lib-innerbrowser/zipball/fd921e089147057b456ca3660de72112167e40a4", - "reference": "fd921e089147057b456ca3660de72112167e40a4", + "url": "https://api.github.com/repos/Codeception/lib-innerbrowser/zipball/956101b060a0d898a1ed8c106fd4d81adf25fd87", + "reference": "956101b060a0d898a1ed8c106fd4d81adf25fd87", "shasum": "" }, "require": { @@ -6912,7 +6960,7 @@ "keywords": [ "codeception" ], - "time": "2020-10-22T05:45:03+00:00" + "time": "2021-01-02T18:59:34+00:00" }, { "name": "codeception/module-asserts", @@ -7118,16 +7166,16 @@ }, { "name": "codeception/phpunit-wrapper", - "version": "8.1.3", + "version": "8.1.4", "source": { "type": "git", "url": "https://github.com/Codeception/phpunit-wrapper.git", - "reference": "8c2c9b49d20b6e2d61e926a16b1bf2cee5f4db9c" + "reference": "f41335f0b4dd17cf7bbc63e87943b3ae72a8bbc3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/8c2c9b49d20b6e2d61e926a16b1bf2cee5f4db9c", - "reference": "8c2c9b49d20b6e2d61e926a16b1bf2cee5f4db9c", + "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/f41335f0b4dd17cf7bbc63e87943b3ae72a8bbc3", + "reference": "f41335f0b4dd17cf7bbc63e87943b3ae72a8bbc3", "shasum": "" }, "require": { @@ -7158,7 +7206,7 @@ } ], "description": "PHPUnit classes used by Codeception", - "time": "2020-10-11T18:16:48+00:00" + "time": "2020-12-28T14:00:08+00:00" }, { "name": "codeception/stub", From 2b2ff45614b0e36e2917c40cb4c28f52183a7a3a Mon Sep 17 00:00:00 2001 From: devansh bawari Date: Mon, 4 Jan 2021 12:37:18 +0530 Subject: [PATCH 003/151] Some Publishables That Came With Package --- config/excel.php | 230 +++++++++++++++++++++++++++------- config/repository.php | 3 +- stubs/export.model.stub | 17 +++ stubs/export.plain.stub | 16 +++ stubs/export.query-model.stub | 17 +++ stubs/export.query.stub | 16 +++ stubs/import.collection.stub | 17 +++ stubs/import.model.stub | 21 ++++ 8 files changed, 292 insertions(+), 45 deletions(-) create mode 100644 stubs/export.model.stub create mode 100644 stubs/export.plain.stub create mode 100644 stubs/export.query-model.stub create mode 100644 stubs/export.query.stub create mode 100644 stubs/import.collection.stub create mode 100644 stubs/import.model.stub diff --git a/config/excel.php b/config/excel.php index fa3e12b28..c3199b925 100755 --- a/config/excel.php +++ b/config/excel.php @@ -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, ], ]; diff --git a/config/repository.php b/config/repository.php index 3123c2789..f8498b8db 100755 --- a/config/repository.php +++ b/config/repository.php @@ -169,7 +169,8 @@ return [ */ 'acceptedConditions' => [ '=', - 'like' + 'like', + 'in' ], /* |-------------------------------------------------------------------------- diff --git a/stubs/export.model.stub b/stubs/export.model.stub new file mode 100644 index 000000000..af6f6b839 --- /dev/null +++ b/stubs/export.model.stub @@ -0,0 +1,17 @@ + Date: Mon, 4 Jan 2021 13:57:45 +0530 Subject: [PATCH 004/151] product image facade added --- config/app.php | 1 + .../Product/src/Facades/ProductImage.php | 18 +++ packages/Webkul/Product/src/ProductImage.php | 124 ++++++++++++++++++ .../src/Providers/ProductServiceProvider.php | 57 ++++++++ 4 files changed, 200 insertions(+) create mode 100644 packages/Webkul/Product/src/Facades/ProductImage.php create mode 100644 packages/Webkul/Product/src/ProductImage.php diff --git a/config/app.php b/config/app.php index c79026ded..79bf8456c 100755 --- a/config/app.php +++ b/config/app.php @@ -340,5 +340,6 @@ return [ 'Concord' => Konekt\Concord\Facades\Concord::class, 'Helper' => Konekt\Concord\Facades\Helper::class, 'Debugbar' => Barryvdh\Debugbar\Facade::class, + 'ProductImage' => Webkul\Product\Facades\ProductImage::class ], ]; \ No newline at end of file diff --git a/packages/Webkul/Product/src/Facades/ProductImage.php b/packages/Webkul/Product/src/Facades/ProductImage.php new file mode 100644 index 000000000..d8a1aa62f --- /dev/null +++ b/packages/Webkul/Product/src/Facades/ProductImage.php @@ -0,0 +1,18 @@ +productRepository = $productRepository; + } + + public function sampleText() + { + echo "Sample Text"; + } + + /** + * Retrieve collection of gallery images + * + * @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $product + * @return array + */ + public function getGalleryImages($product) + { + if (! $product) { + return []; + } + + $images = []; + + foreach ($product->images as $image) { + if (! Storage::has($image->path)) { + continue; + } + + $images[] = [ + 'small_image_url' => url('cache/small/' . $image->path), + 'medium_image_url' => url('cache/medium/' . $image->path), + 'large_image_url' => url('cache/large/' . $image->path), + 'original_image_url' => url('cache/original/' . $image->path), + ]; + } + + if (! $product->parent_id && ! count($images) && ! count($product->videos)) { + $images[] = [ + 'small_image_url' => asset('vendor/webkul/ui/assets/images/product/small-product-placeholder.webp'), + 'medium_image_url' => asset('vendor/webkul/ui/assets/images/product/meduim-product-placeholder.webp'), + 'large_image_url' => asset('vendor/webkul/ui/assets/images/product/large-product-placeholder.webp'), + 'original_image_url' => asset('vendor/webkul/ui/assets/images/product/large-product-placeholder.webp'), + ]; + } + + return $images; + } + + /** + * Get product's base image + * + * @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $product + * @return array + */ + public function getProductBaseImage($product) + { + $images = $product ? $product->images : null; + + if ($images && $images->count()) { + $image = [ + 'small_image_url' => url('cache/small/' . $images[0]->path), + 'medium_image_url' => url('cache/medium/' . $images[0]->path), + 'large_image_url' => url('cache/large/' . $images[0]->path), + 'original_image_url' => url('cache/original/' . $images[0]->path), + ]; + } else { + $image = [ + 'small_image_url' => asset('vendor/webkul/ui/assets/images/product/small-product-placeholder.webp'), + 'medium_image_url' => asset('vendor/webkul/ui/assets/images/product/meduim-product-placeholder.webp'), + 'large_image_url' => asset('vendor/webkul/ui/assets/images/product/large-product-placeholder.webp'), + 'original_image_url' => asset('vendor/webkul/ui/assets/images/product/large-product-placeholder.webp'), + ]; + } + + return $image; + } + + /** + * Get product varient image if available otherwise product base image + * + * @param \Webkul\Customer\Contracts\Wishlist $item + * @return array + */ + public function getProductImage($item) + { + if ($item instanceof \Webkul\Customer\Contracts\Wishlist) { + if (isset($item->additional['selected_configurable_option'])) { + $product = $this->productRepository->find($item->additional['selected_configurable_option']); + } else { + $product = $item->product; + } + } else { + $product = $item->product; + } + + return $this->getProductBaseImage($product); + } +} \ No newline at end of file diff --git a/packages/Webkul/Product/src/Providers/ProductServiceProvider.php b/packages/Webkul/Product/src/Providers/ProductServiceProvider.php index 36da00135..8d2471001 100755 --- a/packages/Webkul/Product/src/Providers/ProductServiceProvider.php +++ b/packages/Webkul/Product/src/Providers/ProductServiceProvider.php @@ -8,6 +8,9 @@ use Webkul\Product\Models\ProductProxy; use Webkul\Product\Observers\ProductObserver; use Webkul\Product\Console\Commands\PriceUpdate; use Webkul\Product\Console\Commands\GenerateProducts; +use Illuminate\Foundation\AliasLoader; +use Webkul\Product\Facades\ProductImage as ProductImageFacade; +use Webkul\Product\ProductImage; class ProductServiceProvider extends ServiceProvider { @@ -42,6 +45,8 @@ class ProductServiceProvider extends ServiceProvider $this->registerCommands(); + $this->registerFacades(); + $this->registerEloquentFactoriesFrom(__DIR__ . '/../Database/Factories'); } @@ -79,4 +84,56 @@ class ProductServiceProvider extends ServiceProvider { $this->app->make(EloquentFactory::class)->load($path); } + + + /** + * Register Bouncer as a singleton. + * + * @return void + */ + protected function registerFacades() + { + $loader = AliasLoader::getInstance(); + $loader->alias('productimage', ProductImageFacade::class); + + $this->app->singleton('productimage', function () { + return app()->make(ProductImage::class); + }); + } + + /** + * Register facade + * + */ + public function registerFacadesd() + { + //to make the cart facade and bind the + //alias to the class needed to be called. + // $loader = AliasLoader::getInstance(); + + // $loader->alias('productimage', ProductImageFacade::class); + + // $this->app->singleton('productimage', function () { + // return new cart(); + // }); + + // $this->app->bind('productimage', 'Webkul\Checkout\Cart'); + + + // \App::bind('mysiteclass', function() + // { + // return new \Webkul\Product\Helpers\ProductImage; + // }); + + $this->app->bind('ProductImage', function() { + return new ProductImage; + }); + + // $loader = AliasLoader::getInstance(); + // $loader->alias('productimage', ProductImageFacade::class); + + // $this->app->singleton('productimage', function () { + // return app()->make(ProductImage::class); + // }); + } } \ No newline at end of file From b57bcdc39e5504498379c87fd225adc7af520fad Mon Sep 17 00:00:00 2001 From: prateek srivastava Date: Mon, 4 Jan 2021 16:38:38 +0530 Subject: [PATCH 005/151] product video facade added --- config/app.php | 3 +- .../Product/src/Facades/ProductVideo.php | 18 +++++++++ packages/Webkul/Product/src/ProductImage.php | 5 --- packages/Webkul/Product/src/ProductVideo.php | 37 +++++++++++++++++++ .../src/Providers/ProductServiceProvider.php | 11 ++++++ 5 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 packages/Webkul/Product/src/Facades/ProductVideo.php create mode 100644 packages/Webkul/Product/src/ProductVideo.php diff --git a/config/app.php b/config/app.php index 79bf8456c..ba239157e 100755 --- a/config/app.php +++ b/config/app.php @@ -340,6 +340,7 @@ return [ 'Concord' => Konekt\Concord\Facades\Concord::class, 'Helper' => Konekt\Concord\Facades\Helper::class, 'Debugbar' => Barryvdh\Debugbar\Facade::class, - 'ProductImage' => Webkul\Product\Facades\ProductImage::class + 'ProductImage' => Webkul\Product\Facades\ProductImage::class, + 'ProductVideo' => Webkul\Product\Facades\ProductVideo::class ], ]; \ No newline at end of file diff --git a/packages/Webkul/Product/src/Facades/ProductVideo.php b/packages/Webkul/Product/src/Facades/ProductVideo.php new file mode 100644 index 000000000..b9c3bf971 --- /dev/null +++ b/packages/Webkul/Product/src/Facades/ProductVideo.php @@ -0,0 +1,18 @@ +productRepository = $productRepository; } - public function sampleText() - { - echo "Sample Text"; - } - /** * Retrieve collection of gallery images * diff --git a/packages/Webkul/Product/src/ProductVideo.php b/packages/Webkul/Product/src/ProductVideo.php new file mode 100644 index 000000000..1cf130863 --- /dev/null +++ b/packages/Webkul/Product/src/ProductVideo.php @@ -0,0 +1,37 @@ +videos as $video) { + if (! Storage::has($video->path)) { + continue; + } + + $videos[] = [ + 'type' => $video->type, + 'video_url' => Storage::url($video->path), + ]; + } + + return $videos; + } +} \ No newline at end of file diff --git a/packages/Webkul/Product/src/Providers/ProductServiceProvider.php b/packages/Webkul/Product/src/Providers/ProductServiceProvider.php index 8d2471001..7384af873 100755 --- a/packages/Webkul/Product/src/Providers/ProductServiceProvider.php +++ b/packages/Webkul/Product/src/Providers/ProductServiceProvider.php @@ -10,7 +10,9 @@ use Webkul\Product\Console\Commands\PriceUpdate; use Webkul\Product\Console\Commands\GenerateProducts; use Illuminate\Foundation\AliasLoader; use Webkul\Product\Facades\ProductImage as ProductImageFacade; +use Webkul\Product\Facades\ProductVideo as ProductVideoFacade; use Webkul\Product\ProductImage; +use Webkul\Product\ProductVideo; class ProductServiceProvider extends ServiceProvider { @@ -93,12 +95,21 @@ class ProductServiceProvider extends ServiceProvider */ protected function registerFacades() { + // Product image $loader = AliasLoader::getInstance(); $loader->alias('productimage', ProductImageFacade::class); $this->app->singleton('productimage', function () { return app()->make(ProductImage::class); }); + + // Product video + $loader = AliasLoader::getInstance(); + $loader->alias('productvideo', ProductVideoFacade::class); + + $this->app->singleton('productvideo', function () { + return app()->make(ProductVideo::class); + }); } /** From 5935fbf28ce50b1f4bcbeee031f63bd9496b8abe Mon Sep 17 00:00:00 2001 From: prateek srivastava Date: Mon, 4 Jan 2021 17:44:33 +0530 Subject: [PATCH 006/151] product Image helper removed --- config/repository.php | 3 ++- .../Resources/views/dashboard/index.blade.php | 6 ++---- .../src/Helpers/ConfigurableOption.php | 20 +------------------ .../Webkul/Product/src/Type/AbstractType.php | 2 +- .../views/checkout/cart/index.blade.php | 2 -- .../views/checkout/cart/mini-cart.blade.php | 2 -- .../views/checkout/onepage/review.blade.php | 2 -- .../customers/account/reviews/index.blade.php | 4 +--- .../account/reviews/reviews.blade.php | 4 +--- .../account/wishlist/wishlist.blade.php | 2 -- .../views/products/list/card.blade.php | 4 +--- .../views/products/reviews/create.blade.php | 3 +-- .../views/products/reviews/index.blade.php | 4 +--- .../Resources/views/products/view.blade.php | 2 +- .../views/products/view/gallery.blade.php | 7 +++---- .../Webkul/Velocity/src/Helpers/Helper.php | 5 ++--- .../views/shop/checkout/cart/index.blade.php | 1 - .../shop/checkout/onepage/review.blade.php | 2 -- .../customers/account/reviews/index.blade.php | 4 +--- .../Resources/views/shop/home/index.blade.php | 1 - .../views/shop/products/list/card.blade.php | 7 +++---- .../shop/products/reviews/create.blade.php | 2 -- .../views/shop/products/view.blade.php | 5 ++--- .../view/configurable-options.blade.php | 3 +-- .../shop/products/view/gallery.blade.php | 3 +-- .../shop/products/view/small-view.blade.php | 4 +--- 26 files changed, 26 insertions(+), 78 deletions(-) diff --git a/config/repository.php b/config/repository.php index 3123c2789..f8498b8db 100755 --- a/config/repository.php +++ b/config/repository.php @@ -169,7 +169,8 @@ return [ */ 'acceptedConditions' => [ '=', - 'like' + 'like', + 'in' ], /* |-------------------------------------------------------------------------- diff --git a/packages/Webkul/Admin/src/Resources/views/dashboard/index.blade.php b/packages/Webkul/Admin/src/Resources/views/dashboard/index.blade.php index 930a6a8df..020d74d3f 100755 --- a/packages/Webkul/Admin/src/Resources/views/dashboard/index.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/dashboard/index.blade.php @@ -192,8 +192,6 @@
- @inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage') -
@@ -208,7 +206,7 @@
  • - getProductBaseImage($item->product); ?> + product); ?>
    @@ -318,7 +316,7 @@
  • - getProductBaseImage($item->product); ?> + product); ?>
    diff --git a/packages/Webkul/Product/src/Helpers/ConfigurableOption.php b/packages/Webkul/Product/src/Helpers/ConfigurableOption.php index 004ede9e5..ef0ca45b3 100755 --- a/packages/Webkul/Product/src/Helpers/ConfigurableOption.php +++ b/packages/Webkul/Product/src/Helpers/ConfigurableOption.php @@ -7,24 +7,6 @@ use Webkul\Product\Models\ProductAttributeValue; class ConfigurableOption extends AbstractProduct { - /** - * ProductImage object - * - * @var array - */ - protected $productImage; - - /** - * Create a new controller instance. - * - * @param \Webkul\Product\Helpers\ProductImage $productImage - * @return void - */ - public function __construct(ProductImage $productImage) - { - $this->productImage = $productImage; - } - /** * Returns the allowed variants * @@ -223,7 +205,7 @@ class ConfigurableOption extends AbstractProduct $variantId = $variant->id; } - $images[$variantId] = $this->productImage->getGalleryImages($variant); + $images[$variantId] = ProductImage::getGalleryImages($variant); } return $images; diff --git a/packages/Webkul/Product/src/Type/AbstractType.php b/packages/Webkul/Product/src/Type/AbstractType.php index 5ac820274..76ef5491e 100644 --- a/packages/Webkul/Product/src/Type/AbstractType.php +++ b/packages/Webkul/Product/src/Type/AbstractType.php @@ -849,7 +849,7 @@ abstract class AbstractType */ public function getBaseImage($item) { - return $this->productImageHelper->getProductBaseImage($item->product); + return ProductImage::getProductBaseImage($item->product); } /** diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php index d44caa83c..f14a10383 100755 --- a/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php @@ -5,8 +5,6 @@ @stop @section('content-wrapper') - @inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage') -
    @if ($cart)
    diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/cart/mini-cart.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/cart/mini-cart.blade.php index 4477af9b0..6750f8fdd 100755 --- a/packages/Webkul/Shop/src/Resources/views/checkout/cart/mini-cart.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/cart/mini-cart.blade.php @@ -1,5 +1,3 @@ -@inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage') - getCart(); ?> @if ($cart) diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/onepage/review.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/onepage/review.blade.php index 223514041..43950ef85 100755 --- a/packages/Webkul/Shop/src/Resources/views/checkout/onepage/review.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/onepage/review.blade.php @@ -68,8 +68,6 @@
    - @inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage') -
    @foreach ($cart->items as $item) @php diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/reviews/index.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/reviews/index.blade.php index 28683a5c4..5f0c93482 100755 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/reviews/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/reviews/index.blade.php @@ -1,5 +1,3 @@ -@inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage') - @extends('shop::layouts.master') @section('page_title') @@ -34,7 +32,7 @@ @foreach ($reviews as $review)