From 2922b4a002dd2ea5f8807ec33ef31376c555a136 Mon Sep 17 00:00:00 2001 From: merdan Date: Sun, 24 Oct 2021 20:19:08 +0500 Subject: [PATCH 01/12] Bulk Demo Category Seeder --- README.md | 114 +----- composer.json | 3 +- config/app.php | 18 +- database/seeders/DatabaseSeeder.php | 6 +- packages/Sarga/Shop/composer.json | 30 ++ .../Database/Seeders/ChannelTableSeeder.php | 17 + .../src/Database/Seeders/DatabaseSeeder.php | 21 ++ .../Seeders/DemoCategoryTableSeeder.php | 52 +++ .../Database/Seeders/SLocalesTableSeeder.php | 10 + .../src/Providers/ShopServiceProvider.php | 93 +++++ public/installer/AdminConfig.php | 115 ------ public/installer/CSS/style.css | 350 ------------------ public/installer/Classes/Requirement.php | 161 -------- public/installer/Classes/Welcome.php | 17 - public/installer/Cleanup.php | 21 -- public/installer/Composer.php | 6 - public/installer/EmailConfig.php | 96 ----- public/installer/EnvConfig.php | 143 ------- public/installer/Images/favicon.ico | Bin 5430 -> 0 bytes public/installer/Images/green-check.svg | 19 - public/installer/Images/logo.svg | 19 - public/installer/Images/red-check.svg | 20 - public/installer/MigrationRun.php | 15 - public/installer/Seeder.php | 41 -- public/installer/Views/admin.blade.php | 119 ------ public/installer/Views/email.blade.php | 136 ------- public/installer/Views/environment.blade.php | 259 ------------- public/installer/Views/finish.blade.php | 32 -- public/installer/Views/migration.blade.php | 232 ------------ public/installer/Views/requirements.blade.php | 66 ---- public/installer/Views/welcome.blade.php | 44 --- public/installer/index.php | 138 ------- public/installer/install.php | 89 ----- public/installer/js/script.js | 85 ----- 34 files changed, 244 insertions(+), 2343 deletions(-) create mode 100644 packages/Sarga/Shop/composer.json create mode 100644 packages/Sarga/Shop/src/Database/Seeders/ChannelTableSeeder.php create mode 100644 packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php create mode 100644 packages/Sarga/Shop/src/Database/Seeders/DemoCategoryTableSeeder.php create mode 100644 packages/Sarga/Shop/src/Database/Seeders/SLocalesTableSeeder.php create mode 100644 packages/Sarga/Shop/src/Providers/ShopServiceProvider.php delete mode 100755 public/installer/AdminConfig.php delete mode 100755 public/installer/CSS/style.css delete mode 100755 public/installer/Classes/Requirement.php delete mode 100755 public/installer/Classes/Welcome.php delete mode 100644 public/installer/Cleanup.php delete mode 100755 public/installer/Composer.php delete mode 100644 public/installer/EmailConfig.php delete mode 100755 public/installer/EnvConfig.php delete mode 100755 public/installer/Images/favicon.ico delete mode 100755 public/installer/Images/green-check.svg delete mode 100755 public/installer/Images/logo.svg delete mode 100755 public/installer/Images/red-check.svg delete mode 100755 public/installer/MigrationRun.php delete mode 100755 public/installer/Seeder.php delete mode 100644 public/installer/Views/admin.blade.php delete mode 100644 public/installer/Views/email.blade.php delete mode 100644 public/installer/Views/environment.blade.php delete mode 100644 public/installer/Views/finish.blade.php delete mode 100644 public/installer/Views/migration.blade.php delete mode 100755 public/installer/Views/requirements.blade.php delete mode 100755 public/installer/Views/welcome.blade.php delete mode 100755 public/installer/index.php delete mode 100755 public/installer/install.php delete mode 100644 public/installer/js/script.js diff --git a/README.md b/README.md index 6f8331e9b..071093b88 100755 --- a/README.md +++ b/README.md @@ -1,46 +1,20 @@ -

-Total Downloads -

+

+Sarga +

-

-Total Downloads -Latest Stable Version -License -Backers on Open Collective -Backers on Open Collective -Sponsors on Open Collective -

-## Hactoberfest Rules -- On four successful PR merges, Bagisto will provide a T-Shirt, Stickers, Notebook, Pen, and Bagisto Elephant. -- We have added the 'Hactoberfest' label to the issues with the difficulty level label. -- Although we have added the 'hactoberfest' topic in our repo, we will consider only PRs whose issue is labelled with 'Hactoberfest'. Below is the link, -- [Hacktoberfest Labelled Issues](https://github.com/bagisto/bagisto/issues?q=is%3Aopen+is%3Aissue+label%3AHacktoberfest) - -## Topics -1. [Introduction](#introduction) -2. [Documentation](#documentation) -3. [Requirements](#requirements) -4. [Installation & Configuration](#installation-and-configuration) -5. [License](#license) -6. [Security Vulnerabilities](#security-vulnerabilities) -7. [Modules](#modules) -8. [Miscellaneous](#miscellaneous) ### Introduction -[Bagisto](https://www.bagisto.com) is a hand-tailored E-Commerce framework built on some of the hottest opensource technologies +[Sarga](https://www.sarga.com.tr) is a hand-tailored E-Commerce framework built on some of the hottest opensource technologies such as [Laravel](https://laravel.com) (a [PHP](https://secure.php.net/) framework) and [Vue.js](https://vuejs.org) a progressive Javascript framework. -**Bagisto can help you cut down your time, cost, and workforce for building online stores or migrating from physical stores +**Sarga can help you cut down your time, cost, and workforce for building online stores or migrating from physical stores to the ever-demanding online world. Your business -- whether small or huge -- can benefit. And it's straightforward to set it up.** -**Read our documentation: [Bagisto Docs](https://devdocs.bagisto.com/)** +**Read our documentation: [Sarga Docs](https://devdocs.bagisto.com/)** -**We also have a forum for any concerns, feature requests, or discussions. Please visit: [Bagisto Forums](https://forums.bagisto.com/)** - -# Visit our live [Demo](https://demo.bagisto.com) It packs in lots of features that will allow your E-Commerce business to scale in no time: @@ -59,14 +33,6 @@ It packs in lots of features that will allow your E-Commerce business to scale i * Price rules (Discount) inbuilt. * Theme (Velocity). * CMS Pages. -* Check out [these features and more](https://bagisto.com/features/). - -**For Developers**: -Take advantage of two of the hottest frameworks used in this project -- Laravel and Vue.js -- both have been used in Bagisto. - -### Documentation - -#### Bagisto Documentation [https://devdocs.bagisto.com](https://devdocs.bagisto.com) ### Requirements @@ -78,31 +44,6 @@ Take advantage of two of the hottest frameworks used in this project -- Laravel * **Node**: 8.11.3 LTS or higher. * **Composer**: 1.6.5 or higher. -### Installation and Configuration - -**1. You can install Bagisto by using the GUI installer.** - -##### a. Download zip from the link below: - -[Download the latest release](https://github.com/bagisto/bagisto/releases/latest) - -##### b. Extract the contents of the zip and execute the project in your browser: - -~~~ -http(s)://example.com -~~~ - -**2. Or you can install Bagisto from your console.** - -##### Execute these commands below, in order - -~~~ -1. composer create-project bagisto/bagisto -~~~ - -~~~ -2. PHP artisan bagisto: install -~~~ **To execute Bagisto**: @@ -146,46 +87,3 @@ Bagisto is a truly open-source E-Commerce framework that will always be free und ### Security Vulnerabilities Would you please not disclose security vulnerabilities publicly? If you find any security vulnerability in Bagisto, then please email us: mailto:support@bagisto.com. -### Modules -[Available Modules](https://bagisto.com/en/extensions) - -Need something else? Please email us at support@bagisto.com. - -### Miscellaneous - -#### Contribute - -Bagisto is a community-driven project; we appreciate every contribution from the community. - -- If you found an issue that you think we should know about, or if you have a suggestion, please submit an issue. -- If you want to submit a solution or offer a new feature, please create a pull request. - -Please read our [contributing guide](https://github.com/bagisto/bagisto/blob/master/.github/CONTRIBUTING.md) for more info. - -#### Contributors - -This project is on [Open Collective](https://opencollective.com/bagisto), and it exists thanks to the people who contribute. - - - -#### Backers - -Thank you to all our backers! 🙏 - - - -#### Sponsors - -Support this project by becoming a sponsor. Your logo will show up here with a link to your website. - -
- - - -
- - - - - - diff --git a/composer.json b/composer.json index cad0c2a67..bc5cefa9d 100755 --- a/composer.json +++ b/composer.json @@ -101,7 +101,8 @@ "Webkul\\BookingProduct\\": "packages/Webkul/BookingProduct/src", "Webkul\\SocialLogin\\": "packages/Webkul/SocialLogin/src", "Webkul\\DebugBar\\": "packages/Webkul/DebugBar/src", - "Webkul\\Marketing\\": "packages/Webkul/Marketing/src" + "Webkul\\Marketing\\": "packages/Webkul/Marketing/src", + "Sarga\\Shop\\": "packages/Sarga/Shop/src" } }, "autoload-dev": { diff --git a/config/app.php b/config/app.php index f4fffff28..cc79426c2 100755 --- a/config/app.php +++ b/config/app.php @@ -13,7 +13,7 @@ return [ | */ - 'name' => env('APP_NAME', 'Bagisto'), + 'name' => env('APP_NAME', 'Sarga'), /* |-------------------------------------------------------------------------- @@ -77,7 +77,7 @@ return [ | */ - 'timezone' => env('APP_TIMEZONE', 'Asia/Kolkata'), + 'timezone' => env('APP_TIMEZONE', 'Asia/Ashgabat'), /* |-------------------------------------------------------------------------- @@ -118,7 +118,7 @@ return [ | (use capital letters!) */ - 'default_country' => null, + 'default_country' => 'TM', /* |-------------------------------------------------------------------------- @@ -129,7 +129,7 @@ return [ | */ - 'currency' => env('APP_CURRENCY', 'USD'), + 'currency' => env('APP_CURRENCY', 'TMT'), /* |-------------------------------------------------------------------------- @@ -140,7 +140,7 @@ return [ | */ - 'channel' => 'default', + 'channel' => 'trendyol', /* |-------------------------------------------------------------------------- @@ -269,16 +269,16 @@ return [ Webkul\Checkout\Providers\CheckoutServiceProvider::class, Webkul\Shipping\Providers\ShippingServiceProvider::class, Webkul\Payment\Providers\PaymentServiceProvider::class, - Webkul\Paypal\Providers\PaypalServiceProvider::class, +// Webkul\Paypal\Providers\PaypalServiceProvider::class, Webkul\Sales\Providers\SalesServiceProvider::class, Webkul\Tax\Providers\TaxServiceProvider::class, Webkul\API\Providers\APIServiceProvider::class, Webkul\CatalogRule\Providers\CatalogRuleServiceProvider::class, Webkul\CartRule\Providers\CartRuleServiceProvider::class, Webkul\Rule\Providers\RuleServiceProvider::class, - Webkul\CMS\Providers\CMSServiceProvider::class, - Webkul\Velocity\Providers\VelocityServiceProvider::class, - Webkul\BookingProduct\Providers\BookingProductServiceProvider::class, +// Webkul\CMS\Providers\CMSServiceProvider::class, +// 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, diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index a74fd0aa3..da85a52bb 100755 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -5,6 +5,7 @@ namespace Database\Seeders; use Illuminate\Database\Seeder; use Webkul\Velocity\Database\Seeders\VelocityMetaDataSeeder; use Webkul\Admin\Database\Seeders\DatabaseSeeder as BagistoDatabaseSeeder; +use Sarga\Shop\Database\Seeders\DatabaseSeeder as SargaDatabaseSeeder; class DatabaseSeeder extends Seeder { @@ -15,7 +16,8 @@ class DatabaseSeeder extends Seeder */ public function run() { - $this->call(BagistoDatabaseSeeder::class); - $this->call(VelocityMetaDataSeeder::class); +// $this->call(BagistoDatabaseSeeder::class); +// $this->call(VelocityMetaDataSeeder::class); + $this->call(SargaDatabaseSeeder::class); } } diff --git a/packages/Sarga/Shop/composer.json b/packages/Sarga/Shop/composer.json new file mode 100644 index 000000000..81c6818bc --- /dev/null +++ b/packages/Sarga/Shop/composer.json @@ -0,0 +1,30 @@ +{ + "name": "sarga/shop", + "description": "Shop for Sarga.", + "license": "MIT", + + "authors": [ + { + "name": "merdan muhammedow", + "email": "merdan.m@gmail.com" + } + ], + + "require": {}, + "autoload": { + "psr-4": { + "Sarga\\Shop\\": "src/" + } + }, + + "extra": { + "laravel": { + "providers": [ + "Sarga\\Shop\\Providers\\ShopServiceProvider" + ], + "aliases": {} + } + }, + + "minimum-stability": "dev" +} diff --git a/packages/Sarga/Shop/src/Database/Seeders/ChannelTableSeeder.php b/packages/Sarga/Shop/src/Database/Seeders/ChannelTableSeeder.php new file mode 100644 index 000000000..e44695905 --- /dev/null +++ b/packages/Sarga/Shop/src/Database/Seeders/ChannelTableSeeder.php @@ -0,0 +1,17 @@ +call(SLocalesTableSeeder::class); + $this->call(DemoCategoryTableSeeder::class); + $this->call(ChannelTableSeeder::class); + + } +} \ No newline at end of file diff --git a/packages/Sarga/Shop/src/Database/Seeders/DemoCategoryTableSeeder.php b/packages/Sarga/Shop/src/Database/Seeders/DemoCategoryTableSeeder.php new file mode 100644 index 000000000..103e5b240 --- /dev/null +++ b/packages/Sarga/Shop/src/Database/Seeders/DemoCategoryTableSeeder.php @@ -0,0 +1,52 @@ +faker = $faker; + $this->categoryRepository = $categoryRepository; + } + + public function run() + { + $this->categoryRepository->deleteWhere([['id', '!=', 1]]); + for ($i = 2; $i < $this->numberOfParentCategories; $i++) { + $createdCategory = $this->categoryRepository->create([ + 'id' => $i, + 'slug' => $this->faker->slug, + 'name' => $this->faker->firstName, + 'description' => $this->faker->text(), + 'parent_id' => 1, + 'status' => 1, + ]); + + if ($createdCategory) { + for ($j = ($i-1)*$this->numberOfParentCategories; $j < ($i-1)*$this->numberOfParentCategories+$this->numberOfChildCategories; ++$j) { + + $this->categoryRepository->create([ + 'id' => $j, + 'slug' => $this->faker->slug, + 'name' => $this->faker->firstName, + 'description' => $this->faker->text(), + 'parent_id' => $createdCategory->id, + 'status' => 1 + ]); + } + } + } + } +} diff --git a/packages/Sarga/Shop/src/Database/Seeders/SLocalesTableSeeder.php b/packages/Sarga/Shop/src/Database/Seeders/SLocalesTableSeeder.php new file mode 100644 index 000000000..d8030dec3 --- /dev/null +++ b/packages/Sarga/Shop/src/Database/Seeders/SLocalesTableSeeder.php @@ -0,0 +1,10 @@ +publishes([ +// __DIR__ . '/../../publishable/assets' => public_path('themes/default/assets'), +// __DIR__ . '/../Resources/views' => resource_path('themes/default/views'), +// __DIR__ . '/../Resources/lang' => resource_path('lang/vendor/shop'), +// ]); + + /* loaders */ +// $this->loadRoutesFrom(__DIR__ . '/../Http/routes.php'); +// $this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations'); +// $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'shop'); +// $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'shop'); + + /* aliases */ +// $router->aliasMiddleware('locale', Locale::class); +// $router->aliasMiddleware('theme', Theme::class); +// $router->aliasMiddleware('currency', Currency::class); + + /* view composers */ +// $this->composeView(); + + /* paginators */ +// Paginator::defaultView('shop::partials.pagination'); +// Paginator::defaultSimpleView('shop::partials.pagination'); + } + + /** + * Register services. + * + * @return void + */ + public function register() + { +// $this->registerConfig(); + } + + /** + * Bind the the data to the views. + * + * @return void + */ + protected function composeView() + { + view()->composer('shop::customers.account.partials.sidemenu', function ($view) { + $tree = Tree::create(); + + foreach (config('menu.customer') as $item) { + $tree->add($item, 'menu'); + } + + $tree->items = core()->sortItems($tree->items); + + $view->with('menu', $tree); + }); + } + + /** + * Register package config. + * + * @return void + */ + protected function registerConfig() + { + $this->mergeConfigFrom( + dirname(__DIR__) . '/Config/menu.php', 'menu.customer' + ); + + $this->mergeConfigFrom( + dirname(__DIR__) . '/Config/system.php', 'core' + ); + } +} diff --git a/public/installer/AdminConfig.php b/public/installer/AdminConfig.php deleted file mode 100755 index daebea11e..000000000 --- a/public/installer/AdminConfig.php +++ /dev/null @@ -1,115 +0,0 @@ -connect_error) { - $data['connection'] = $conn->connect_error; - } - - $email = $_POST['admin_email']; - $name = $_POST['admin_name']; - $password = password_hash($_POST['admin_password'], PASSWORD_BCRYPT, ['cost' => 10]); - - // Deleting migrated admin - $deleteAdmin = "DELETE FROM admins WHERE id=1"; - $conn->query($deleteAdmin); - - // query for insertion - $sql = "INSERT INTO admins (name, email, password, role_id, status) - VALUES ('".$name."', '".$email."', '".$password."', '1', '1')"; - - if ($conn->query($sql) === TRUE) { - $data['insert_success'] = 'Data Successfully inserted into database'; - } else { - $data['insert_fail'] = "Error: " . $sql . "
" . $conn->error; - } - - $conn->close(); - } else { - $data['support_error'] = 'Bagisto currently support MySQL only. Press OK to still continue or change you DB connection to MySQL'; - } - - $storage_output = exec('cd ../.. && '. $phpbin .' artisan storage:link 2>&1'); - - // if there are no errors process our form, then return a message - // show a message of success and provide a true success variable - $data['success'] = true; - $data['message'] = 'Success!'; - } - - // return all our data to an AJAX call - echo json_encode($data); \ No newline at end of file diff --git a/public/installer/CSS/style.css b/public/installer/CSS/style.css deleted file mode 100755 index 91467bf8b..000000000 --- a/public/installer/CSS/style.css +++ /dev/null @@ -1,350 +0,0 @@ -body { - margin: 0; - font-size: 16px; - font-family: "Montserrat", sans-serif; - color: #000311; - background: #fff; - position: relative; - height: 100%; -} - -a { color: rgb(0, 65, 255); text-decoration: none;} - -.initial-display{ - padding-top: 50px; - text-align: center; -} - -.initial-display .logo { - width: 150px; -} - -.initial-display p { - font-size: 24px; - color: #333333; - text-align: center; - font-weight: 600; - margin-top: 10px; - padding-bottom: 10px; -} - -.card { - border-radius: 5px; - box-shadow: 1px 9px 18px rgba(62, 85, 120, 0.45); -} - -.btn-primary { - background-color: #0041FF; -} - -.warning { - margin-left: 15%; -} - -.footer { - bottom: 0; - position: absolute; - width: 100%; - padding-bottom: 20px; -} - -.form-control{ - border: 2px solid #C7C7C7; - border-radius: 3px; - -webkit-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); - transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); - padding: 0px 10px; - font-size: 15px; - margin-top: 10px; -} - -.form-control:focus { - border-color: #0041FF; - box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset, 0px 0px 8px rgba(11, 50, 139, 0.5); -} - -.form-group label.required::after { - margin-left: 1px; - content: "*"; - color: #FC6868; - font-weight: 700; - display: inline-block; -} - -.form-error { - color: #ff5656 !important; -} - -.control-group.has-error .control { - border-color: #FC6868 !important; -} - -.requirements_list { - width: 90%; - list-style: none; - margin-left: 4%; - padding:0; -} - -.requirements_list li { - padding: 0 10px 10px; - margin-bottom: 10px; - border-bottom: 1px dashed #dcdcdc; - line-height: normal; -} - -.requirements_list li:last-child { border-bottom: 0;} - -.requirements_list small { - font-size: 13px; - color:#9b9b9b; -} - -.title { - font-size: 16px; - color: #151515; - line-height: 30px; - text-align: left; - margin-top: 30px; - margin-bottom: 10px; - text-align: center; -} - -.welcome, .environment, .migration, .permission, .admin, .finish { - display : none; -} - -.check { - line-height: 35px; - margin-left: 25%; -} - -.composer { - position: auto; - top: calc(50% + 24px); - display: none; -} - -.message { - padding-left: 140px; -} - -.cp-round { - position: auto !important; - padding-bottom: 130px; -} - -.cp-round:before { - border-radius: 50%; - content: " "; - width: 48px; - height: 48px; - display: inline-block; - box-sizing: border-box; - border-top: solid 6px #bababa; - border-right: solid 6px #bababa; - border-bottom: solid 6px #bababa; - border-left: solid 6px #bababa; - position: absolute; - top: calc(40% - 14px); - left: calc(50% - 24px); -} - -.cp-round:after { - border-radius: 50%; - content: " "; - width: 48px; - height: 48px; - display: inline-block; - box-sizing: border-box; - border-top: solid 6px #0041FF; - border-right: solid 6px #bababa; - border-bottom: solid 6px #bababa; - border-left: solid 6px #bababa; - position: absolute; - top: calc(40% - 14px); - left: calc(50% - 24px); - animation: spin 1s ease-in-out infinite; -} - -@keyframes spin { - 0% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } -} - -@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) { - .initial-display{ - padding-top: 15px; - } - - .initial-display p { - margin-top: 4px; - } -} - -/* Select */ - -.select2-container--bootstrap4 .select2-selection--single { - height: calc(2.25rem + 2px) !important; } - .select2-container--bootstrap4 .select2-selection--single .select2-selection__placeholder { - color: #757575; - line-height: 2.25rem; } - .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow { - position: absolute; - top: 50%; - right: 3px; - width: 20px; } - .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b { - top: 60%; - border-color: #343a40 transparent transparent transparent; - border-style: solid; - border-width: 5px 4px 0 4px; - width: 0; - height: 0; - left: 50%; - margin-left: -4px; - margin-top: -2px; - position: absolute; } - .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered { - line-height: 2.25rem; } - - .select2-search--dropdown .select2-search__field { - border: 1px solid #ced4da; - border-radius: 0.25rem; } - - .select2-results__message { - color: #6c757d; } - - .select2-container--bootstrap4 .select2-selection--multiple { - min-height: calc(2.25rem + 2px) !important; } - .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__rendered { - -webkit-box-sizing: border-box; - box-sizing: border-box; - list-style: none; - margin: 0; - padding: 0 5px; - width: 100%; } - .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice { - color: #343a40; - border: 1px solid #bdc6d0; - border-radius: 0.2rem; - padding: 0; - padding-right: 5px; - cursor: pointer; - float: left; - margin-top: 0.3em; - margin-right: 5px; } - .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove { - color: #bdc6d0; - font-weight: bold; - margin-left: 3px; - margin-right: 1px; - padding-right: 3px; - padding-left: 3px; - float: left; } - .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove:hover { - color: #343a40; } - - .select2-container { - display: block; } - .select2-container *:focus { - outline: 0; } - - .input-group .select2-container--bootstrap4 { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; } - - .input-group-prepend ~ .select2-container--bootstrap4 .select2-selection { - border-top-left-radius: 0; - border-bottom-left-radius: 0; } - - .input-group > .select2-container--bootstrap4:not(:last-child) .select2-selection { - border-top-right-radius: 0; - border-bottom-right-radius: 0; } - - .select2-container--bootstrap4 .select2-selection { - background-color: #fff; - border: 1px solid #ced4da; - border-radius: 0.25rem; - -webkit-transition: border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out; - transition: border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out; - transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; - transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out; - width: 100%; } - @media screen and (prefers-reduced-motion: reduce) { - .select2-container--bootstrap4 .select2-selection { - -webkit-transition: none; - transition: none; } } - - .select2-container--bootstrap4.select2-container--focus .select2-selection { - border-color: #0041FF; - -webkit-box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); - box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); } - - .select2-container--bootstrap4.select2-container--focus.select2-container--open .select2-selection { - border-bottom: none; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; } - - .select2-container--bootstrap4.select2-container--disabled .select2-selection, .select2-container--bootstrap4.select2-container--disabled.select2-container--focus .select2-selection { - background-color: #e9ecef; - cursor: not-allowed; - border-color: #ced4da; - -webkit-box-shadow: none; - box-shadow: none; } - - .select2-container--bootstrap4.select2-container--disabled .select2-search__field, .select2-container--bootstrap4.select2-container--disabled.select2-container--focus .select2-search__field { - background-color: transparent; } - - select.is-invalid ~ .select2-container--bootstrap4 .select2-selection, - form.was-validated select:invalid ~ .select2-container--bootstrap4 .select2-selection { - border-color: #dc3545; } - - select.is-valid ~ .select2-container--bootstrap4 .select2-selection, - form.was-validated select:valid ~ .select2-container--bootstrap4 .select2-selection { - border-color: #28a745; } - - .select2-container--bootstrap4 .select2-dropdown { - border-color: #ced4da; - border-top: none; - border-top-left-radius: 0; - border-top-right-radius: 0; } - .select2-container--bootstrap4 .select2-dropdown.select2-dropdown--above { - border-top: 1px solid #ced4da; - border-top-left-radius: 0.25rem; - border-top-right-radius: 0.25rem; } - .select2-container--bootstrap4 .select2-dropdown .select2-results__option[aria-selected=true] { - background-color: #e9ecef; } - - .select2-container--bootstrap4 .select2-results__option--highlighted, - .select2-container--bootstrap4 .select2-results__option--highlighted.select2-results__option[aria-selected=true] { - background-color: #0041FF; - color: #f8f9fa; } - - .select2-container--bootstrap4 .select2-results__option[role=group] { - padding: 0; } - - .select2-container--bootstrap4 .select2-results > .select2-results__options { - max-height: 15em; - overflow-y: auto; } - - .select2-container--bootstrap4 .select2-results__group { - padding: 6px; - display: list-item; - color: #6c757d; } - - .select2-container--bootstrap4 .select2-selection__clear { - width: 1.2em; - height: 1.2em; - line-height: 1.15em; - padding-left: 0.3em; - margin-top: 0.5em; - border-radius: 100%; - background-color: #6c757d; - color: #f8f9fa; - float: right; - margin-right: 0.3em; } - .select2-container--bootstrap4 .select2-selection__clear:hover { - background-color: #343a40; } - \ No newline at end of file diff --git a/public/installer/Classes/Requirement.php b/public/installer/Classes/Requirement.php deleted file mode 100755 index 8919934ff..000000000 --- a/public/installer/Classes/Requirement.php +++ /dev/null @@ -1,161 +0,0 @@ - [ - 'openssl', - 'pdo', - 'mbstring', - 'tokenizer', - 'JSON', - 'cURL', - ], - // 'apache' => [ - // 'mod_rewrite', - // ] - ]; - - $results = []; - - foreach($requirements as $type => $requirement) - { - switch ($type) { - // check php requirements - case 'php': - foreach($requirements[$type] as $requirement) - { - $results['requirements'][$type][$requirement] = true; - - if(!extension_loaded($requirement)) - { - $results['requirements'][$type][$requirement] = false; - - $results['errors'] = true; - } - } - break; - - // check apache requirements - // case 'apache': - // foreach ($requirements[$type] as $requirement) { - // // if function doesn't exist we can't check apache modules - // if(function_exists('apache_get_modules')) - // { - // $results['requirements'][$type][$requirement] = true; - - // if(!in_array($requirement,apache_get_modules())) - // { - // $results['requirements'][$type][$requirement] = false; - - // $results['errors'] = true; - // } - // } - // } - //break; - } - } - - return $results; - } - - /** - * Check PHP version requirement. - * - * @return array - */ - public function checkPHPversion() - { - /** - * Minimum PHP Version Supported (Override is in installer.php config file). - * - * @var _minPhpVersion - */ - $_minPhpVersion = '7.3.0'; - - $currentPhpVersion = $this->getPhpVersionInfo(); - $supported = false; - - if (version_compare((str_pad($currentPhpVersion['version'], 6, "0")), $_minPhpVersion) >= 0) { - $supported = true; - } - - $phpStatus = [ - 'full' => $currentPhpVersion['full'], - 'current' => $currentPhpVersion['version'], - 'minimum' => $_minPhpVersion, - 'supported' => $supported - ]; - - return $phpStatus; - } - - /** - * Get current Php version information - * - * @return array - */ - private static function getPhpVersionInfo() - { - $currentVersionFull = PHP_VERSION; - preg_match("#^\d+(\.\d+)*#", $currentVersionFull, $filtered); - $currentVersion = $filtered[0]; - - return [ - 'full' => $currentVersionFull, - 'version' => $currentVersion - ]; - } - - /** - * Check composer installation. - * - * @return array - */ - public function composerInstall() - { - $location = str_replace('\\', '/', getcwd()); - $currentLocation = explode("/", $location); - array_pop($currentLocation); - array_pop($currentLocation); - $desiredLocation = implode("/", $currentLocation); - $autoLoadFile = $desiredLocation . '/' . 'vendor' . '/' . 'autoload.php'; - - if (file_exists($autoLoadFile)) { - $data['composer_install'] = 0; - } else { - $data['composer_install'] = 1; - $data['composer'] = 'Bagisto has detected that the required composer dependencies are not installed.
Go to the root directory of Bagisto and run "composer install".'; - } - - return $data; - } - - /** - * Render view for class. - * - */ - public function render() - { - $requirements = $this->checkRequirements(); - - $phpVersion = $this->checkPHPversion(); - - $composerInstall = $this->composerInstall(); - - ob_start(); - - include __DIR__ . '/../Views/requirements.blade.php'; - - return ob_get_clean(); - } -} diff --git a/public/installer/Classes/Welcome.php b/public/installer/Classes/Welcome.php deleted file mode 100755 index a18c507fa..000000000 --- a/public/installer/Classes/Welcome.php +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/public/installer/Composer.php b/public/installer/Composer.php deleted file mode 100755 index 05205e11e..000000000 --- a/public/installer/Composer.php +++ /dev/null @@ -1,6 +0,0 @@ - $value) { - $changedData[] = $key . '=' . $value; - } - - // inserting new form-data to env - $changedData = implode(PHP_EOL, $changedData); - file_put_contents($envFile, $changedData); - - $data['success'] = true; - $data['message'] = 'Success!'; - } - - // return all our data to an AJAX call - echo json_encode($data); \ No newline at end of file diff --git a/public/installer/EnvConfig.php b/public/installer/EnvConfig.php deleted file mode 100755 index 7ab0df389..000000000 --- a/public/installer/EnvConfig.php +++ /dev/null @@ -1,143 +0,0 @@ - $value) { - $changedData[] = $key . '=' . $value; - } - - // inserting new form-data to env - $changedData = implode(PHP_EOL, $changedData); - file_put_contents($envFile, $changedData); - - // checking database connection(mysql only) - if ($_POST["database_connection"] == 'mysql') { - // create connection - @$conn = new mysqli($_POST["host_name"], $_POST["user_name"], $_POST["user_password"], $_POST["database_name"], $_POST['port_name']); - - // check connection - if ($conn->connect_error) { - $errors['database_error'] = $conn->connect_error; - $data['errors'] = $errors; - $data['success'] = false; - } else { - $data['success'] = true; - $data['message'] = 'Success!'; - } - } else { - $data['success'] = true; - $data['message'] = 'Success!'; - } -} - -// return all our data to an AJAX call -echo json_encode($data); diff --git a/public/installer/Images/favicon.ico b/public/installer/Images/favicon.ico deleted file mode 100755 index e9c217bb395c0bd8eb3ea6755633f62b0781ff2c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5430 zcmeHLJx?1!6dYm`qwwj&1+tKE1*sww=zrc()9%jBd$XQfpS=f6;0+cQz_y3|Ca?;i*BgwFiT@z> zo*27i3~)BVtKEQD!Y^jYRj!{eI}l6M`NIxayi@LQHZZRItvSf2+5Elq@iP5vANlL? z@p0#8^{DfpTAfKOWmwX}QmX%uVP!3OXDRnMVGRwAPg3lxEHA^`O{|l9pYq-B|Hze#QLvzu)5?*ZN@x#_hLXFRX6=z47bE#Sdpod2}%>-pmt->UEbzwq_^ag1NIyJdAPIBV;f)pqt{ zjzuHHZMQMUHC$C*gL0V@s%f3;bTE_K3k9AiN4eJeRr!4Xu}L2exd;AI>+U7kS4`)s i*2#D`!2D~5%-_gMwE807e~WyZ5IJv%^jjj2EAkA9Xf6r> diff --git a/public/installer/Images/green-check.svg b/public/installer/Images/green-check.svg deleted file mode 100755 index 25fbb6ab7..000000000 --- a/public/installer/Images/green-check.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - Check-Accent - Created with Sketch. - - - - - - - - - - - - - - \ No newline at end of file diff --git a/public/installer/Images/logo.svg b/public/installer/Images/logo.svg deleted file mode 100755 index 412899b60..000000000 --- a/public/installer/Images/logo.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - Logo+Text - Created with Sketch. - - - - - - - - - - \ No newline at end of file diff --git a/public/installer/Images/red-check.svg b/public/installer/Images/red-check.svg deleted file mode 100755 index 6911d37d2..000000000 --- a/public/installer/Images/red-check.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - Check-Accent Copy - Created with Sketch. - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/public/installer/MigrationRun.php b/public/installer/MigrationRun.php deleted file mode 100755 index ffc1d5ad9..000000000 --- a/public/installer/MigrationRun.php +++ /dev/null @@ -1,15 +0,0 @@ - [ - 'key' => 'seeder_results', - 'command' => 'cd ../.. && '. $phpbin .' artisan db:seed 2>&1' - ], - 'publish' => [ - 'key' => 'publish_results', - 'command' => 'cd ../.. && '. $phpbin .' artisan vendor:publish --all --force 2>&1' - ], - 'storage_link' => [ - 'key' => 'storage_link_results', - 'command' => 'cd ../.. && '. $phpbin .' artisan storage:link 2>&1' - ], - 'key' => [ - 'key' => 'key_results', - 'command' => 'cd ../.. && '. $phpbin .' artisan key:generate 2>&1' - ], - 'optimize' => [ - 'key' => 'optimize_results', - 'command' => 'cd ../.. && '. $phpbin .' artisan optimize 2>&1' - ], -]; - -// run command on terminal -$data = []; -foreach ($commands as $key => $value) { - exec($value['command'], $data[$key], $data[$value['key']]); -} - -// return a response -// return all our data to an AJAX call -echo json_encode($data); diff --git a/public/installer/Views/admin.blade.php b/public/installer/Views/admin.blade.php deleted file mode 100644 index 736c28658..000000000 --- a/public/installer/Views/admin.blade.php +++ /dev/null @@ -1,119 +0,0 @@ -
-
-

Create a Administrator

-
- -
-
-
-
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
-
-
-
-
-
-
- - \ No newline at end of file diff --git a/public/installer/Views/email.blade.php b/public/installer/Views/email.blade.php deleted file mode 100644 index 33bb189f9..000000000 --- a/public/installer/Views/email.blade.php +++ /dev/null @@ -1,136 +0,0 @@ - - - - - \ No newline at end of file diff --git a/public/installer/Views/environment.blade.php b/public/installer/Views/environment.blade.php deleted file mode 100644 index d8aa96a55..000000000 --- a/public/installer/Views/environment.blade.php +++ /dev/null @@ -1,259 +0,0 @@ -
-
-

Environment Configuration

-
- -
-
-
-
-
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
- -
-
- -
- - -
- -
-
- - -
- -
- - -
-
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
-
-
-
-
-
-
- - diff --git a/public/installer/Views/finish.blade.php b/public/installer/Views/finish.blade.php deleted file mode 100644 index 85b61bc39..000000000 --- a/public/installer/Views/finish.blade.php +++ /dev/null @@ -1,32 +0,0 @@ -
-
-

Installation completed

-
- -
-
-
-
-
- Bagisto is successfully installed on your system.
-
-
-
- -
 
-
- - Bagisto Extensions - Bagisto Forums -
-
-
-
- - \ No newline at end of file diff --git a/public/installer/Views/migration.blade.php b/public/installer/Views/migration.blade.php deleted file mode 100644 index d503e545f..000000000 --- a/public/installer/Views/migration.blade.php +++ /dev/null @@ -1,232 +0,0 @@ - - -
-
-

Ready for installation

-
- -
-
-
-
-
- -
- - -
- -
-
-

Click the button below to:

-
- -
- Create the database tables -
- -
- Populate the database tables -
- -
- Publishing the vendor files -
-
- -
-
-

Checking Composer dependencies

-

Creating the database tables, this can take a few moments.

-

Populating the database tables

-
-
- -
 
- -
-
- - -
- -
- back -
-
-
-
-
-
-
- - - diff --git a/public/installer/Views/requirements.blade.php b/public/installer/Views/requirements.blade.php deleted file mode 100755 index 57ab742ba..000000000 --- a/public/installer/Views/requirements.blade.php +++ /dev/null @@ -1,66 +0,0 @@ - - -
-
-

Server Requirements

-
- -
-
-
-
-
    -
  • - - - - PHP - ( or higher) -
    - - - Bagisto has detected that your PHP version () is not supported.
    - Contact your provider if you are not the server administrator. -
    - -
  • - - $require): ?> - $enabled) : ?> -
  • - - - - -
  • - - - -
  • - - - composer - -
    - - - - - -
  • -
- - -
- -
- -
-
-
-
-
diff --git a/public/installer/Views/welcome.blade.php b/public/installer/Views/welcome.blade.php deleted file mode 100755 index 4230adedd..000000000 --- a/public/installer/Views/welcome.blade.php +++ /dev/null @@ -1,44 +0,0 @@ - - - - -
-
-

Welcome to Bagisto

- -
-
- - Have you ever heard of an old saying, “No man is an island”? We probably heard that a million times. That saying is actually true because when we became successful, we usually achieve that because someone has helped us. And our thank-you speech skills could be the best thing we can do in return. You may also see - - -
- INTRODUCTION -
- - - Have you ever heard of an old saying, “No man is an island”? We probably heard that a million times. That saying is actually true because when we became successful, we usually achieve that because someone has helped us. And our thank-you speech skills could be the best thing we can do in return. You may also see - -
-
- -
- -
-
-
- - - - - - - - - - - - - - - diff --git a/public/installer/index.php b/public/installer/index.php deleted file mode 100755 index a5c04aa6e..000000000 --- a/public/installer/index.php +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - Bagisto Installer - - - - - - - - - - - - - - - - - -
-
- -
-
- - connect_error) { - // retrieving admin entry - $prefix = $dbPrefix . 'admins'; - $sql = "SELECT id, name FROM $prefix"; - $result = $conn->query($sql); - - if ($result) { - $installed = true; - } - } - - $conn->close(); - } else { - $installed = true; - } - } - - if (! $installed) { - // including classes - include __DIR__ . '/Classes/Requirement.php'; - - // including php files - include __DIR__ . '/Views/environment.blade.php'; - include __DIR__ . '/Views/migration.blade.php'; - include __DIR__ . '/Views/admin.blade.php'; - include __DIR__ . '/Views/email.blade.php'; - include __DIR__ . '/Views/finish.blade.php'; - - // object creation - $requirement = new Requirement(); - echo $requirement->render(); - } else { - // getting url - $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; - - $url = explode("/", $actual_link); - array_pop($url); - array_pop($url); - $url = implode("/", $url); - $url = $url . '/404'; - - // redirecting to 404 error page - header("Location: $url"); - } - ?> - -
- Bagisto a community project by Webkul -
- - - - - - \ No newline at end of file diff --git a/public/installer/install.php b/public/installer/install.php deleted file mode 100755 index 6bf86ea79..000000000 --- a/public/installer/install.php +++ /dev/null @@ -1,89 +0,0 @@ -connect_error) { - // retrieving admin entry - $prefix = $databaseData['DB_PREFIX'].'admins'; - $sql = "SELECT id, name FROM $prefix"; - $result = $conn->query($sql); - - if ($result) { - $installed = true; - } - } - - $conn->close(); - } else { - $installed = true; - } - } - - if (! $installed) { - // getting url - $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; - - $url = explode("/", $actual_link); - array_pop($url); - $url = implode("/", $url); - $url = $url . '/installer'; - - return $url; - } else { - return null; - } -?> - - - diff --git a/public/installer/js/script.js b/public/installer/js/script.js deleted file mode 100644 index 314d3eda8..000000000 --- a/public/installer/js/script.js +++ /dev/null @@ -1,85 +0,0 @@ -window.onload = function() { - - var welcome = document.getElementById('welcome'); - var requirement = document.getElementById('requirement'); - var environment = document.getElementById('environment'); - var migration = document.getElementById('migration'); - var admin = document.getElementById('admin'); - - var welcomeCheck = document.getElementById('welcome-check'); - var requirementCheck = document.getElementById('requirement-check'); - var requirementsRefresh = document.getElementById('requirements-refresh'); - - var permisssionCheck = document.getElementById('permission-check'); - var environmentCheck = document.getElementById('environment-check'); - var continue_to_admin = document.getElementById('continue'); - - var permissionBack = document.getElementById('permission-back'); - var requirementBack = document.getElementById('requirement-back'); - var envBack = document.getElementById('envronment-back'); - var migrationBack = document.getElementById('migration-back'); - - if (requirementCheck) { - requirementCheck.addEventListener('click', myFunction); - } - - if (requirementsRefresh) { - requirementsRefresh.addEventListener('click', myFunction); - } - - if (welcomeCheck) { - welcomeCheck.addEventListener('click', myFunction); - } - - if (permisssionCheck) { - permisssionCheck.addEventListener('click', myFunction); - } - - if (environmentCheck) { - environmentCheck.addEventListener('click', myFunction); - } - - if (continue_to_admin) { - continue_to_admin.addEventListener('click', myFunction); - } - - if (envBack) { - envBack.addEventListener('click', myFunction); - } - - if (requirementBack) { - requirementBack.addEventListener('click', myFunction); - } - - if (permissionBack) { - permissionBack.addEventListener('click', myFunction); - } - - if (migrationBack) { - migrationBack.addEventListener('click', myFunction); - } - - function myFunction() { - if(this.id == 'welcome-check') { - requirement.style.display = "block"; - welcome.style.display = "none"; - } else if (this.id == 'requirement-check') { - environment.style.display = "block"; - requirement.style.display = "none"; - } else if (this.id == 'continue') { - migration.style.display = "none"; - admin.style.display ="block"; - } else if (this.id == 'requirement-back') { - welcome.style.display = "block"; - requirement.style.display = "none"; - } else if (this.id == 'envronment-back') { - environment.style.display ="none"; - requirement.style.display = "block"; - } else if (this.id == 'migration-back') { - migration.style.display = "none"; - environment.style.display ="block"; - } else if (this.id == 'requirements-refresh') { - location.reload(); - } - } -}; From c6ea8f60c7a6a2e9bbe6e9649d38bc21e9a47049 Mon Sep 17 00:00:00 2001 From: merdan Date: Sun, 24 Oct 2021 20:19:25 +0500 Subject: [PATCH 02/12] Bulk Demo Category Seeder --- config/db-blade-compiler.php | 19 ++ config/debugbar.php | 233 +++++++++++++++++++++++ config/dompdf.php | 244 ++++++++++++++++++++++++ config/elastic.client.php | 7 + config/elastic.scout_driver.php | 5 + config/excel.php | 328 ++++++++++++++++++++++++++++++++ config/flare.php | 62 ++++++ config/ignition.php | 126 ++++++++++++ config/image.php | 20 ++ config/imagecache.php | 71 +++++++ config/jwt.php | 304 +++++++++++++++++++++++++++++ config/repository.php | 246 ++++++++++++++++++++++++ config/scout.php | 91 +++++++++ config/tinker.php | 50 +++++ config/translatable.php | 149 +++++++++++++++ config/trustedproxy.php | 50 +++++ 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 ++ 22 files changed, 2109 insertions(+) create mode 100644 config/db-blade-compiler.php create mode 100644 config/debugbar.php create mode 100644 config/dompdf.php create mode 100644 config/elastic.client.php create mode 100644 config/elastic.scout_driver.php create mode 100644 config/excel.php create mode 100644 config/flare.php create mode 100644 config/ignition.php create mode 100644 config/image.php create mode 100644 config/imagecache.php create mode 100644 config/jwt.php create mode 100644 config/repository.php create mode 100644 config/scout.php create mode 100644 config/tinker.php create mode 100644 config/translatable.php create mode 100644 config/trustedproxy.php 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/db-blade-compiler.php b/config/db-blade-compiler.php new file mode 100644 index 000000000..4241b72aa --- /dev/null +++ b/config/db-blade-compiler.php @@ -0,0 +1,19 @@ + '__db_blade_compiler_content_field', + + /** + * The default model field to be compiled when not explicitly specified + * with DbView::field() + */ + 'model_default_field' => 'content', + + 'cache' => false +); diff --git a/config/debugbar.php b/config/debugbar.php new file mode 100644 index 000000000..e7f6b0999 --- /dev/null +++ b/config/debugbar.php @@ -0,0 +1,233 @@ + env('DEBUGBAR_ENABLED', null), + 'except' => [ + 'telescope*', + 'horizon*', + ], + + /* + |-------------------------------------------------------------------------- + | Storage settings + |-------------------------------------------------------------------------- + | + | DebugBar stores data for session/ajax requests. + | You can disable this, so the debugbar stores data in headers/session, + | but this can cause problems with large data collectors. + | By default, file storage (in the storage folder) is used. Redis and PDO + | can also be used. For PDO, run the package migrations first. + | + */ + 'storage' => [ + 'enabled' => true, + '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 + 'hostname' => '127.0.0.1', // Hostname to use with the "socket" driver + 'port' => 2304, // Port to use with the "socket" driver + ], + + /* + |-------------------------------------------------------------------------- + | Vendors + |-------------------------------------------------------------------------- + | + | Vendor files are included by default, but can be set to false. + | This can also be set to 'js' or 'css', to only include javascript or css vendor files. + | Vendor files are for css: font-awesome (including fonts) and highlight.js (css files) + | and for js: jquery and and highlight.js + | So if you want syntax highlighting, set it to true. + | jQuery is set to not conflict with existing jQuery scripts. + | + */ + + 'include_vendors' => true, + + /* + |-------------------------------------------------------------------------- + | Capture Ajax Requests + |-------------------------------------------------------------------------- + | + | The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors), + | you can use this option to disable sending the data through the headers. + | + | Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools. + | + | Note for your request to be identified as ajax requests they must either send the header + | X-Requested-With with the value XMLHttpRequest (most JS libraries send this), or have application/json as a Accept header. + */ + + 'capture_ajax' => true, + 'add_ajax_timing' => false, + + /* + |-------------------------------------------------------------------------- + | Custom Error Handler for Deprecated warnings + |-------------------------------------------------------------------------- + | + | When enabled, the Debugbar shows deprecated warnings for Symfony components + | in the Messages tab. + | + */ + 'error_handler' => false, + + /* + |-------------------------------------------------------------------------- + | Clockwork integration + |-------------------------------------------------------------------------- + | + | The Debugbar can emulate the Clockwork headers, so you can use the Chrome + | Extension, without the server-side code. It uses Debugbar collectors instead. + | + */ + 'clockwork' => false, + + /* + |-------------------------------------------------------------------------- + | DataCollectors + |-------------------------------------------------------------------------- + | + | Enable/disable DataCollectors + | + */ + + 'collectors' => [ + 'phpinfo' => true, // Php version + 'messages' => true, // Messages + 'time' => true, // Time Datalogger + 'memory' => true, // Memory usage + 'exceptions' => true, // Exception displayer + 'log' => true, // Logs from Monolog (merged in messages if enabled) + 'db' => true, // Show database (PDO) queries and bindings + 'views' => true, // Views with their data + 'route' => true, // Current route information + 'auth' => false, // Display Laravel authentication status + 'gate' => true, // Display Laravel Gate checks + 'session' => true, // Display session data + 'symfony_request' => true, // Only one can be enabled.. + 'mail' => true, // Catch mail messages + 'laravel' => false, // Laravel version and environment + 'events' => false, // All events fired + 'default_request' => false, // Regular or special Symfony request logger + 'logs' => false, // Add the latest log messages + 'files' => false, // Show the included files + 'config' => false, // Display config settings + 'cache' => false, // Display cache events + 'models' => true, // Display models + 'livewire' => true, // Display Livewire (when available) + ], + + /* + |-------------------------------------------------------------------------- + | Extra options + |-------------------------------------------------------------------------- + | + | Configure some DataCollectors + | + */ + + 'options' => [ + 'auth' => [ + 'show_name' => true, // Also show the users name/email in the debugbar + ], + '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 + 'duration_background' => true, // Show shaded background on each query relative to how long it took to execute. + 'explain' => [ // Show EXPLAIN output on queries + 'enabled' => false, + 'types' => ['SELECT'], // Deprecated setting, is always only SELECT + ], + 'hints' => false, // Show hints for common mistakes + 'show_copy' => false, // Show copy button next to the query + ], + 'mail' => [ + 'full_log' => false, + ], + 'views' => [ + 'timeline' => false, // Add the views to the timeline (Experimental) + 'data' => false, //Note: Can slow down the application, because the data can be quite large.. + ], + 'route' => [ + 'label' => true, // show complete route on bar + ], + 'logs' => [ + 'file' => null, + ], + 'cache' => [ + 'values' => true, // collect cache values + ], + ], + + /* + |-------------------------------------------------------------------------- + | Inject Debugbar in Response + |-------------------------------------------------------------------------- + | + | Usually, the debugbar is added just before , by listening to the + | Response after the App is done. If you disable this, you have to add them + | in your template yourself. See http://phpdebugbar.com/docs/rendering.html + | + */ + + 'inject' => true, + + /* + |-------------------------------------------------------------------------- + | DebugBar route prefix + |-------------------------------------------------------------------------- + | + | Sometimes you want to set route prefix to be used by DebugBar to load + | its resources from. Usually the need comes from misconfigured web server or + | from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97 + | + */ + 'route_prefix' => '_debugbar', + + /* + |-------------------------------------------------------------------------- + | DebugBar route domain + |-------------------------------------------------------------------------- + | + | By default DebugBar route served from the same domain that request served. + | 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' => env('DEBUGBAR_THEME', 'auto'), + + /* + |-------------------------------------------------------------------------- + | Backtrace stack limit + |-------------------------------------------------------------------------- + | + | By default, the DebugBar limits the number of frames returned by the 'debug_backtrace()' function. + | If you need larger stacktraces, you can increase this number. Setting it to 0 will result in no limit. + */ + 'debug_backtrace_limit' => 50, +]; diff --git a/config/dompdf.php b/config/dompdf.php new file mode 100644 index 000000000..9a9930583 --- /dev/null +++ b/config/dompdf.php @@ -0,0 +1,244 @@ + false, // Throw an Exception on warnings from dompdf + 'orientation' => 'portrait', + 'defines' => array( + /** + * The location of the DOMPDF font directory + * + * The location of the directory where DOMPDF will store fonts and font metrics + * Note: This directory must exist and be writable by the webserver process. + * *Please note the trailing slash.* + * + * Notes regarding fonts: + * Additional .afm font metrics can be added by executing load_font.php from command line. + * + * Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must + * be embedded in the pdf file or the PDF may not display correctly. This can significantly + * increase file size unless font subsetting is enabled. Before embedding a font please + * review your rights under the font license. + * + * Any font specification in the source HTML is translated to the closest font available + * in the font directory. + * + * The pdf standard "Base 14 fonts" are: + * Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique, + * Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique, + * Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic, + * Symbol, ZapfDingbats. + */ + "font_dir" => storage_path('fonts/'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782) + + /** + * The location of the DOMPDF font cache directory + * + * This directory contains the cached font metrics for the fonts used by DOMPDF. + * This directory can be the same as DOMPDF_FONT_DIR + * + * Note: This directory must exist and be writable by the webserver process. + */ + "font_cache" => storage_path('fonts/'), + + /** + * The location of a temporary directory. + * + * The directory specified must be writeable by the webserver process. + * The temporary directory is required to download remote images and when + * using the PFDLib back end. + */ + "temp_dir" => sys_get_temp_dir(), + + /** + * ==== IMPORTANT ==== + * + * dompdf's "chroot": Prevents dompdf from accessing system files or other + * files on the webserver. All local files opened by dompdf must be in a + * subdirectory of this directory. DO NOT set it to '/' since this could + * allow an attacker to use dompdf to read any files on the server. This + * should be an absolute path. + * This is only checked on command line call by dompdf.php, but not by + * direct class use like: + * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output(); + */ + "chroot" => realpath(base_path()), + + /** + * Whether to enable font subsetting or not. + */ + "enable_font_subsetting" => false, + + /** + * The PDF rendering backend to use + * + * Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and + * 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will + * fall back on CPDF. 'GD' renders PDFs to graphic files. {@link + * Canvas_Factory} ultimately determines which rendering class to instantiate + * based on this setting. + * + * Both PDFLib & CPDF rendering backends provide sufficient rendering + * capabilities for dompdf, however additional features (e.g. object, + * image and font support, etc.) differ between backends. Please see + * {@link PDFLib_Adapter} for more information on the PDFLib backend + * and {@link CPDF_Adapter} and lib/class.pdf.php for more information + * on CPDF. Also see the documentation for each backend at the links + * below. + * + * The GD rendering backend is a little different than PDFLib and + * CPDF. Several features of CPDF and PDFLib are not supported or do + * not make any sense when creating image files. For example, + * multiple pages are not supported, nor are PDF 'objects'. Have a + * look at {@link GD_Adapter} for more information. GD support is + * experimental, so use it at your own risk. + * + * @link http://www.pdflib.com + * @link http://www.ros.co.nz/pdf + * @link http://www.php.net/image + */ + "pdf_backend" => "CPDF", + + /** + * PDFlib license key + * + * If you are using a licensed, commercial version of PDFlib, specify + * your license key here. If you are using PDFlib-Lite or are evaluating + * the commercial version of PDFlib, comment out this setting. + * + * @link http://www.pdflib.com + * + * If pdflib present in web server and auto or selected explicitely above, + * a real license code must exist! + */ + //"DOMPDF_PDFLIB_LICENSE" => "your license key here", + + /** + * html target media view which should be rendered into pdf. + * List of types and parsing rules for future extensions: + * http://www.w3.org/TR/REC-html40/types.html + * screen, tty, tv, projection, handheld, print, braille, aural, all + * Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3. + * Note, even though the generated pdf file is intended for print output, + * the desired content might be different (e.g. screen or projection view of html file). + * Therefore allow specification of content here. + */ + "default_media_type" => "screen", + + /** + * The default paper size. + * + * North America standard is "letter"; other countries generally "a4" + * + * @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.) + */ + "default_paper_size" => "a4", + + /** + * The default font family + * + * Used if no suitable fonts can be found. This must exist in the font folder. + * @var string + */ + "default_font" => "serif", + + /** + * Image DPI setting + * + * This setting determines the default DPI setting for images and fonts. The + * DPI may be overridden for inline images by explictly setting the + * image's width & height style attributes (i.e. if the image's native + * width is 600 pixels and you specify the image's width as 72 points, + * the image will have a DPI of 600 in the rendered PDF. The DPI of + * background images can not be overridden and is controlled entirely + * via this parameter. + * + * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI). + * If a size in html is given as px (or without unit as image size), + * this tells the corresponding size in pt. + * This adjusts the relative sizes to be similar to the rendering of the + * html page in a reference browser. + * + * In pdf, always 1 pt = 1/72 inch + * + * Rendering resolution of various browsers in px per inch: + * Windows Firefox and Internet Explorer: + * SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:? + * Linux Firefox: + * about:config *resolution: Default:96 + * (xorg screen dimension in mm and Desktop font dpi settings are ignored) + * + * Take care about extra font/image zoom factor of browser. + * + * In images, size in pixel attribute, img css style, are overriding + * the real image dimension in px for rendering. + * + * @var int + */ + "dpi" => 96, + + /** + * Enable inline PHP + * + * If this setting is set to true then DOMPDF will automatically evaluate + * inline PHP contained within tags. + * + * Enabling this for documents you do not trust (e.g. arbitrary remote html + * pages) is a security risk. Set this option to false if you wish to process + * untrusted documents. + * + * @var bool + */ + "enable_php" => false, + + /** + * Enable inline Javascript + * + * If this setting is set to true then DOMPDF will automatically insert + * JavaScript code contained within tags. + * + * @var bool + */ + "enable_javascript" => true, + + /** + * Enable remote file access + * + * If this setting is set to true, DOMPDF will access remote sites for + * images and CSS files as required. + * This is required for part of test case www/test/image_variants.html through www/examples.php + * + * Attention! + * This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and + * allowing remote access to dompdf.php or on allowing remote html code to be passed to + * $dompdf = new DOMPDF(, $dompdf->load_html(..., + * This allows anonymous users to download legally doubtful internet content which on + * tracing back appears to being downloaded by your server, or allows malicious php code + * in remote html pages to be executed by your server with your account privileges. + * + * @var bool + */ + "enable_remote" => true, + + /** + * A ratio applied to the fonts height to be more like browsers' line height + */ + "font_height_ratio" => 1.1, + + /** + * Use the more-than-experimental HTML5 Lib parser + */ + "enable_html5_parser" => false, + ), + + +); diff --git a/config/elastic.client.php b/config/elastic.client.php new file mode 100644 index 000000000..f627ebab8 --- /dev/null +++ b/config/elastic.client.php @@ -0,0 +1,7 @@ + [ + env('ELASTIC_HOST', 'localhost:9200'), + ] +]; diff --git a/config/elastic.scout_driver.php b/config/elastic.scout_driver.php new file mode 100644 index 000000000..a5d123aa8 --- /dev/null +++ b/config/elastic.scout_driver.php @@ -0,0 +1,5 @@ + env('ELASTIC_SCOUT_DRIVER_REFRESH_DOCUMENTS', false), +]; diff --git a/config/excel.php b/config/excel.php new file mode 100644 index 000000000..c3199b925 --- /dev/null +++ b/config/excel.php @@ -0,0 +1,328 @@ + [ + + /* + |-------------------------------------------------------------------------- + | Chunk size + |-------------------------------------------------------------------------- + | + | When using FromQuery, the query is automatically chunked. + | Here you can specify how big the chunk should be. + | + */ + 'chunk_size' => 1000, + + /* + |-------------------------------------------------------------------------- + | Pre-calculate formulas during export + |-------------------------------------------------------------------------- + */ + '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 + |-------------------------------------------------------------------------- + | + | Configure e.g. delimiter, enclosure and line ending for CSV exports. + | + */ + 'csv' => [ + 'delimiter' => ',', + 'enclosure' => '"', + 'line_ending' => PHP_EOL, + 'use_bom' => false, + '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, + + /* + |-------------------------------------------------------------------------- + | 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' => 'slug', + ], + + /* + |-------------------------------------------------------------------------- + | CSV Settings + |-------------------------------------------------------------------------- + | + | Configure e.g. delimiter, enclosure and line ending for CSV imports. + | + */ + 'csv' => [ + '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' => '', + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Extension detector + |-------------------------------------------------------------------------- + | + | 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' => [ + 'xlsx' => Excel::XLSX, + 'xlsm' => Excel::XLSX, + 'xltx' => Excel::XLSX, + 'xltm' => Excel::XLSX, + 'xls' => Excel::XLS, + 'xlt' => Excel::XLS, + 'ods' => Excel::ODS, + 'ots' => Excel::ODS, + 'slk' => Excel::SLK, + 'xml' => Excel::XML, + 'gnumeric' => Excel::GNUMERIC, + 'htm' => Excel::HTML, + 'html' => Excel::HTML, + 'csv' => Excel::CSV, + 'tsv' => Excel::TSV, + + /* + |-------------------------------------------------------------------------- + | PDF Extension + |-------------------------------------------------------------------------- + | + | Configure here which Pdf driver should be used by default. + | Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF + | + */ + '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' => Maatwebsite\Excel\DefaultValueBinder::class, + ], + + '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', + + /* + |-------------------------------------------------------------------------- + | Batch memory caching + |-------------------------------------------------------------------------- + | + | 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', + ], + + 'temporary_files' => [ + + /* + |-------------------------------------------------------------------------- + | Local Temporary Path + |-------------------------------------------------------------------------- + | + | When exporting and importing files, we use a temporary file, before + | storing reading or downloading. Here you can customize that path. + | + */ + 'local_path' => storage_path('framework/laravel-excel'), + + /* + |-------------------------------------------------------------------------- + | Remote Temporary Disk + |-------------------------------------------------------------------------- + | + | When dealing with a multi server setup with queues in which you + | cannot rely on having a shared local temporary path, you might + | want to store the temporary file on a shared disk. During the + | queue executing, we'll retrieve the temporary file from that + | location instead. When left to null, it will always use + | the local path. This setting only has effect when using + | in conjunction with queued imports and exports. + | + */ + '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/flare.php b/config/flare.php new file mode 100644 index 000000000..48fc07dfd --- /dev/null +++ b/config/flare.php @@ -0,0 +1,62 @@ + 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, + 'censor_request_body_fields' => ['password'], + ], + + /* + |-------------------------------------------------------------------------- + | Reporting Log statements + |-------------------------------------------------------------------------- + | + | If this setting is `false` log statements won't be sent as events to Flare, + | no matter which error level you specified in the Flare log channel. + | + */ + + 'send_logs_as_events' => true, + + /* + |-------------------------------------------------------------------------- + | Censor request body fields + |-------------------------------------------------------------------------- + | + | These fields will be censored from your request when sent to Flare. + | + */ + + 'censor_request_body_fields' => ['password'], +]; diff --git a/config/ignition.php b/config/ignition.php new file mode 100644 index 000000000..b46542319 --- /dev/null +++ b/config/ignition.php @@ -0,0 +1,126 @@ + env('IGNITION_EDITOR', 'phpstorm'), + + /* + |-------------------------------------------------------------------------- + | Theme + |-------------------------------------------------------------------------- + | + | Here you may specify which theme Ignition should use. + | + | Supported: "light", "dark", "auto" + | + */ + + 'theme' => env('IGNITION_THEME', 'dark'), + + /* + |-------------------------------------------------------------------------- + | 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//Code", "C:\Users\\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', + +]; diff --git a/config/image.php b/config/image.php new file mode 100644 index 000000000..2b1d2c3e1 --- /dev/null +++ b/config/image.php @@ -0,0 +1,20 @@ + 'gd' + +]; diff --git a/config/imagecache.php b/config/imagecache.php new file mode 100644 index 000000000..af29594b0 --- /dev/null +++ b/config/imagecache.php @@ -0,0 +1,71 @@ + 'cache', + + /* + |-------------------------------------------------------------------------- + | Storage paths + |-------------------------------------------------------------------------- + | + | The following paths will be searched for the image filename, submited + | by URI. + | + | Define as many directories as you like. + | + */ + + 'paths' => array( + storage_path('app/public'), + public_path('storage') + ), + + /* + |-------------------------------------------------------------------------- + | Manipulation templates + |-------------------------------------------------------------------------- + | + | Here you may specify your own manipulation filter templates. + | The keys of this array will define which templates + | are available in the URI: + | + | {route}/{template}/{filename} + | + | The values of this array will define which filter class + | will be applied, by its fully qualified name. + | + */ + + 'templates' => array( + 'small' => 'Webkul\Product\CacheFilters\Small', + 'medium' => 'Webkul\Product\CacheFilters\Medium', + 'large' => 'Webkul\Product\CacheFilters\Large', + ), + + /* + |-------------------------------------------------------------------------- + | Image Cache Lifetime + |-------------------------------------------------------------------------- + | + | Lifetime in minutes of the images handled by the imagecache route. + | + */ + + 'lifetime' => 525600, + +); \ No newline at end of file diff --git a/config/jwt.php b/config/jwt.php new file mode 100644 index 000000000..8b7843b6b --- /dev/null +++ b/config/jwt.php @@ -0,0 +1,304 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return [ + + /* + |-------------------------------------------------------------------------- + | JWT Authentication Secret + |-------------------------------------------------------------------------- + | + | Don't forget to set this in your .env file, as it will be used to sign + | your tokens. A helper command is provided for this: + | `php artisan jwt:secret` + | + | Note: This will be used for Symmetric algorithms only (HMAC), + | since RSA and ECDSA use a private/public key combo (See below). + | + */ + + 'secret' => env('JWT_SECRET'), + + /* + |-------------------------------------------------------------------------- + | JWT Authentication Keys + |-------------------------------------------------------------------------- + | + | The algorithm you are using, will determine whether your tokens are + | signed with a random string (defined in `JWT_SECRET`) or using the + | following public & private keys. + | + | Symmetric Algorithms: + | HS256, HS384 & HS512 will use `JWT_SECRET`. + | + | Asymmetric Algorithms: + | RS256, RS384 & RS512 / ES256, ES384 & ES512 will use the keys below. + | + */ + + 'keys' => [ + + /* + |-------------------------------------------------------------------------- + | Public Key + |-------------------------------------------------------------------------- + | + | A path or resource to your public key. + | + | E.g. 'file://path/to/public/key' + | + */ + + 'public' => env('JWT_PUBLIC_KEY'), + + /* + |-------------------------------------------------------------------------- + | Private Key + |-------------------------------------------------------------------------- + | + | A path or resource to your private key. + | + | E.g. 'file://path/to/private/key' + | + */ + + 'private' => env('JWT_PRIVATE_KEY'), + + /* + |-------------------------------------------------------------------------- + | Passphrase + |-------------------------------------------------------------------------- + | + | The passphrase for your private key. Can be null if none set. + | + */ + + 'passphrase' => env('JWT_PASSPHRASE'), + + ], + + /* + |-------------------------------------------------------------------------- + | JWT time to live + |-------------------------------------------------------------------------- + | + | Specify the length of time (in minutes) that the token will be valid for. + | Defaults to 1 hour. + | + | You can also set this to null, to yield a never expiring token. + | Some people may want this behaviour for e.g. a mobile app. + | This is not particularly recommended, so make sure you have appropriate + | systems in place to revoke the token if necessary. + | Notice: If you set this to null you should remove 'exp' element from 'required_claims' list. + | + */ + + 'ttl' => env('JWT_TTL', 60), + + /* + |-------------------------------------------------------------------------- + | Refresh time to live + |-------------------------------------------------------------------------- + | + | Specify the length of time (in minutes) that the token can be refreshed + | within. I.E. The user can refresh their token within a 2 week window of + | the original token being created until they must re-authenticate. + | Defaults to 2 weeks. + | + | You can also set this to null, to yield an infinite refresh time. + | Some may want this instead of never expiring tokens for e.g. a mobile app. + | This is not particularly recommended, so make sure you have appropriate + | systems in place to revoke the token if necessary. + | + */ + + 'refresh_ttl' => env('JWT_REFRESH_TTL', 20160), + + /* + |-------------------------------------------------------------------------- + | JWT hashing algorithm + |-------------------------------------------------------------------------- + | + | Specify the hashing algorithm that will be used to sign the token. + | + | See here: https://github.com/namshi/jose/tree/master/src/Namshi/JOSE/Signer/OpenSSL + | for possible values. + | + */ + + 'algo' => env('JWT_ALGO', 'HS256'), + + /* + |-------------------------------------------------------------------------- + | Required Claims + |-------------------------------------------------------------------------- + | + | Specify the required claims that must exist in any token. + | A TokenInvalidException will be thrown if any of these claims are not + | present in the payload. + | + */ + + 'required_claims' => [ + 'iss', + 'iat', + 'exp', + 'nbf', + 'sub', + 'jti', + ], + + /* + |-------------------------------------------------------------------------- + | Persistent Claims + |-------------------------------------------------------------------------- + | + | Specify the claim keys to be persisted when refreshing a token. + | `sub` and `iat` will automatically be persisted, in + | addition to the these claims. + | + | Note: If a claim does not exist then it will be ignored. + | + */ + + 'persistent_claims' => [ + // 'foo', + // 'bar', + ], + + /* + |-------------------------------------------------------------------------- + | Lock Subject + |-------------------------------------------------------------------------- + | + | This will determine whether a `prv` claim is automatically added to + | the token. The purpose of this is to ensure that if you have multiple + | authentication models e.g. `App\User` & `App\OtherPerson`, then we + | should prevent one authentication request from impersonating another, + | if 2 tokens happen to have the same id across the 2 different models. + | + | Under specific circumstances, you may want to disable this behaviour + | e.g. if you only have one authentication model, then you would save + | a little on token size. + | + */ + + 'lock_subject' => true, + + /* + |-------------------------------------------------------------------------- + | Leeway + |-------------------------------------------------------------------------- + | + | This property gives the jwt timestamp claims some "leeway". + | Meaning that if you have any unavoidable slight clock skew on + | any of your servers then this will afford you some level of cushioning. + | + | This applies to the claims `iat`, `nbf` and `exp`. + | + | Specify in seconds - only if you know you need it. + | + */ + + 'leeway' => env('JWT_LEEWAY', 0), + + /* + |-------------------------------------------------------------------------- + | Blacklist Enabled + |-------------------------------------------------------------------------- + | + | In order to invalidate tokens, you must have the blacklist enabled. + | If you do not want or need this functionality, then set this to false. + | + */ + + 'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true), + + /* + | ------------------------------------------------------------------------- + | Blacklist Grace Period + | ------------------------------------------------------------------------- + | + | When multiple concurrent requests are made with the same JWT, + | it is possible that some of them fail, due to token regeneration + | on every request. + | + | Set grace period in seconds to prevent parallel request failure. + | + */ + + 'blacklist_grace_period' => env('JWT_BLACKLIST_GRACE_PERIOD', 0), + + /* + |-------------------------------------------------------------------------- + | Cookies encryption + |-------------------------------------------------------------------------- + | + | By default Laravel encrypt cookies for security reason. + | If you decide to not decrypt cookies, you will have to configure Laravel + | to not encrypt your cookie token by adding its name into the $except + | array available in the middleware "EncryptCookies" provided by Laravel. + | see https://laravel.com/docs/master/responses#cookies-and-encryption + | for details. + | + | Set it to true if you want to decrypt cookies. + | + */ + + 'decrypt_cookies' => false, + + /* + |-------------------------------------------------------------------------- + | Providers + |-------------------------------------------------------------------------- + | + | Specify the various providers used throughout the package. + | + */ + + 'providers' => [ + + /* + |-------------------------------------------------------------------------- + | JWT Provider + |-------------------------------------------------------------------------- + | + | Specify the provider that is used to create and decode the tokens. + | + */ + + 'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class, + + /* + |-------------------------------------------------------------------------- + | Authentication Provider + |-------------------------------------------------------------------------- + | + | Specify the provider that is used to authenticate users. + | + */ + + 'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class, + + /* + |-------------------------------------------------------------------------- + | Storage Provider + |-------------------------------------------------------------------------- + | + | Specify the provider that is used to store tokens in the blacklist. + | + */ + + 'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class, + + ], + +]; diff --git a/config/repository.php b/config/repository.php new file mode 100644 index 000000000..f8498b8db --- /dev/null +++ b/config/repository.php @@ -0,0 +1,246 @@ + [ + 'limit' => 15 + ], + + /* + |-------------------------------------------------------------------------- + | Fractal Presenter Config + |-------------------------------------------------------------------------- + | + + Available serializers: + ArraySerializer + DataArraySerializer + JsonApiSerializer + + */ + 'fractal' => [ + 'params' => [ + 'include' => 'include' + ], + 'serializer' => League\Fractal\Serializer\DataArraySerializer::class + ], + + /* + |-------------------------------------------------------------------------- + | Cache Config + |-------------------------------------------------------------------------- + | + */ + 'cache' => [ + /* + |-------------------------------------------------------------------------- + | Cache Status + |-------------------------------------------------------------------------- + | + | Enable or disable cache + | + */ + 'enabled' => false, + + /* + |-------------------------------------------------------------------------- + | Cache Minutes + |-------------------------------------------------------------------------- + | + | Time of expiration cache + | + */ + 'minutes' => 30, + + /* + |-------------------------------------------------------------------------- + | Cache Repository + |-------------------------------------------------------------------------- + | + | Instance of Illuminate\Contracts\Cache\Repository + | + */ + 'repository' => 'cache', + + /* + |-------------------------------------------------------------------------- + | Cache Clean Listener + |-------------------------------------------------------------------------- + | + | + | + */ + 'clean' => [ + + /* + |-------------------------------------------------------------------------- + | Enable clear cache on repository changes + |-------------------------------------------------------------------------- + | + */ + 'enabled' => true, + + /* + |-------------------------------------------------------------------------- + | Actions in Repository + |-------------------------------------------------------------------------- + | + | create : Clear Cache on create Entry in repository + | update : Clear Cache on update Entry in repository + | delete : Clear Cache on delete Entry in repository + | + */ + 'on' => [ + 'create' => true, + 'update' => true, + 'delete' => true, + ] + ], + + 'params' => [ + /* + |-------------------------------------------------------------------------- + | Skip Cache Params + |-------------------------------------------------------------------------- + | + | + | Ex: http://prettus.local/?search=lorem&skipCache=true + | + */ + 'skipCache' => 'skipCache' + ], + + /* + |-------------------------------------------------------------------------- + | Methods Allowed + |-------------------------------------------------------------------------- + | + | methods cacheable : all, paginate, find, findByField, findWhere, getByCriteria + | + | Ex: + | + | 'only' =>['all','paginate'], + | + | or + | + | 'except' =>['find'], + */ + 'allowed' => [ + 'only' => null, + 'except' => null + ] + ], + + /* + |-------------------------------------------------------------------------- + | Criteria Config + |-------------------------------------------------------------------------- + | + | Settings of request parameters names that will be used by Criteria + | + */ + 'criteria' => [ + /* + |-------------------------------------------------------------------------- + | Accepted Conditions + |-------------------------------------------------------------------------- + | + | Conditions accepted in consultations where the Criteria + | + | Ex: + | + | 'acceptedConditions'=>['=','like'] + | + | $query->where('foo','=','bar') + | $query->where('foo','like','bar') + | + */ + 'acceptedConditions' => [ + '=', + 'like', + 'in' + ], + /* + |-------------------------------------------------------------------------- + | Request Params + |-------------------------------------------------------------------------- + | + | Request parameters that will be used to filter the query in the repository + | + | Params : + | + | - search : Searched value + | Ex: http://prettus.local/?search=lorem + | + | - searchFields : Fields in which research should be carried out + | Ex: + | http://prettus.local/?search=lorem&searchFields=name;email + | http://prettus.local/?search=lorem&searchFields=name:like;email + | http://prettus.local/?search=lorem&searchFields=name:like + | + | - filter : Fields that must be returned to the response object + | Ex: + | http://prettus.local/?search=lorem&filter=id,name + | + | - orderBy : Order By + | Ex: + | http://prettus.local/?search=lorem&orderBy=id + | + | - sortedBy : Sort + | Ex: + | http://prettus.local/?search=lorem&orderBy=id&sortedBy=asc + | http://prettus.local/?search=lorem&orderBy=id&sortedBy=desc + | + | - searchJoin: Specifies the search method (AND / OR), by default the + | application searches each parameter with OR + | EX: + | http://prettus.local/?search=lorem&searchJoin=and + | http://prettus.local/?search=lorem&searchJoin=or + | + */ + 'params' => [ + 'search' => 'search', + 'searchFields' => 'searchFields', + 'filter' => 'filter', + 'orderBy' => 'orderBy', + 'sortedBy' => 'sortedBy', + 'with' => 'with', + 'searchJoin' => 'searchJoin', + 'withCount' => 'withCount' + ] + ], + /* + |-------------------------------------------------------------------------- + | Generator Config + |-------------------------------------------------------------------------- + | + */ + 'generator' => [ + 'basePath' => app()->path(), + 'rootNamespace' => 'App\\', + 'stubsOverridePath' => app()->path(), + 'paths' => [ + 'models' => 'Entities', + 'repositories' => 'Repositories', + 'interfaces' => 'Repositories', + 'transformers' => 'Transformers', + 'presenters' => 'Presenters', + 'validators' => 'Validators', + 'controllers' => 'Http/Controllers', + 'provider' => 'RepositoryServiceProvider', + 'criteria' => 'Criteria' + ] + ] +]; diff --git a/config/scout.php b/config/scout.php new file mode 100644 index 000000000..b2f0f4d22 --- /dev/null +++ b/config/scout.php @@ -0,0 +1,91 @@ + 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', ''), + ], + +]; diff --git a/config/tinker.php b/config/tinker.php new file mode 100644 index 000000000..c187942d0 --- /dev/null +++ b/config/tinker.php @@ -0,0 +1,50 @@ + [ + // App\Console\Commands\ExampleCommand::class, + ], + + /* + |-------------------------------------------------------------------------- + | Auto Aliased Classes + |-------------------------------------------------------------------------- + | + | Tinker will not automatically alias classes in your vendor namespaces + | but you may explicitly allow a subset of classes to get aliased by + | adding the names of each of those classes to the following list. + | + */ + + 'alias' => [ + // + ], + + /* + |-------------------------------------------------------------------------- + | Classes That Should Not Be Aliased + |-------------------------------------------------------------------------- + | + | Typically, Tinker automatically aliases classes as you require them in + | Tinker. However, you may wish to never alias certain classes, which + | you may accomplish by listing the classes in the following array. + | + */ + + 'dont_alias' => [ + 'App\Nova', + ], + +]; diff --git a/config/translatable.php b/config/translatable.php new file mode 100644 index 000000000..ddf71d08c --- /dev/null +++ b/config/translatable.php @@ -0,0 +1,149 @@ + [ + 'en', + 'fr', + 'es' => [ + 'MX', // mexican spanish + 'CO', // colombian spanish + ], + ], + + /* + |-------------------------------------------------------------------------- + | Locale separator + |-------------------------------------------------------------------------- + | + | This is a string used to glue the language and the country when defining + | the available locales. Example: if set to '-', then the locale for + | colombian spanish will be saved as 'es-CO' into the database. + | + */ + 'locale_separator' => '-', + + /* + |-------------------------------------------------------------------------- + | Default locale + |-------------------------------------------------------------------------- + | + | As a default locale, Translatable takes the locale of Laravel's + | translator. If for some reason you want to override this, + | you can specify what default should be used here. + | If you set a value here it will only use the current config value + | and never fallback to the translator one. + | + */ + 'locale' => null, + + /* + |-------------------------------------------------------------------------- + | Use fallback + |-------------------------------------------------------------------------- + | + | Determine if fallback locales are returned by default or not. To add + | more flexibility and configure this option per "translatable" + | instance, this value will be overridden by the property + | $useTranslationFallback when defined + | + */ + 'use_fallback' => false, + + /* + |-------------------------------------------------------------------------- + | Use fallback per property + |-------------------------------------------------------------------------- + | + | The property fallback feature will return the translated value of + | the fallback locale if the property is empty for the selected + | locale. Note that 'use_fallback' must be enabled. + | + */ + 'use_property_fallback' => true, + + /* + |-------------------------------------------------------------------------- + | Fallback Locale + |-------------------------------------------------------------------------- + | + | A fallback locale is the locale being used to return a translation + | when the requested translation is not existing. To disable it + | set it to false. + | If set to null it will loop through all configured locales until + | one existing is found or end of list reached. The locales are looped + | from top to bottom and for country based locales the simple one + | is used first. So "es" will be checked before "es_MX". + | + */ + 'fallback_locale' => 'en', + + /* + |-------------------------------------------------------------------------- + | Translation Model Namespace + |-------------------------------------------------------------------------- + | + | Defines the default 'Translation' class namespace. For example, if + | you want to use App\Translations\CountryTranslation instead of App\CountryTranslation + | set this to 'App\Translations'. + | + */ + 'translation_model_namespace' => null, + + /* + |-------------------------------------------------------------------------- + | Translation Suffix + |-------------------------------------------------------------------------- + | + | Defines the default 'Translation' class suffix. For example, if + | you want to use CountryTrans instead of CountryTranslation + | application, set this to 'Trans'. + | + */ + 'translation_suffix' => 'Translation', + + /* + |-------------------------------------------------------------------------- + | Locale key + |-------------------------------------------------------------------------- + | + | Defines the 'locale' field name, which is used by the + | translation model. + | + */ + 'locale_key' => 'locale', + + /* + |-------------------------------------------------------------------------- + | Always load translations when converting to array + |-------------------------------------------------------------------------- + | Setting this to false will have a performance improvement but will + | not return the translations when using toArray(), unless the + | translations relationship is already loaded. + | + */ + 'to_array_always_loads_translations' => true, + + /* + |-------------------------------------------------------------------------- + | Configure the default behavior of the rule factory + |-------------------------------------------------------------------------- + | The default values used to control the behavior of the RuleFactory. + | Here you can set your own default format and delimiters for + | your whole app. + * + */ + 'rule_factory' => [ + 'format' => \Astrotomic\Translatable\Validation\RuleFactory::FORMAT_ARRAY, + 'prefix' => '%', + 'suffix' => '%', + ], +]; diff --git a/config/trustedproxy.php b/config/trustedproxy.php new file mode 100644 index 000000000..e618ae247 --- /dev/null +++ b/config/trustedproxy.php @@ -0,0 +1,50 @@ + null, // [,], '*', ',' + + /* + * To trust one or more specific proxies that connect + * directly to your server, use an array or a string separated by comma of IP addresses: + */ + // 'proxies' => ['192.168.1.1'], + // 'proxies' => '192.168.1.1, 192.168.1.2', + + /* + * Or, to trust all proxies that connect + * directly to your server, use a "*" + */ + // 'proxies' => '*', + + /* + * Which headers to use to detect proxy related data (For, Host, Proto, Port) + * + * Options include: + * + * - Illuminate\Http\Request::HEADER_X_FORWARDED_ALL (use all x-forwarded-* headers to establish trust) + * - Illuminate\Http\Request::HEADER_FORWARDED (use the FORWARDED header to establish trust) + * - Illuminate\Http\Request::HEADER_X_FORWARDED_AWS_ELB (If you are using AWS Elastic Load Balancer) + * + * - 'HEADER_X_FORWARDED_ALL' (use all x-forwarded-* headers to establish trust) + * - 'HEADER_FORWARDED' (use the FORWARDED header to establish trust) + * - 'HEADER_X_FORWARDED_AWS_ELB' (If you are using AWS Elastic Load Balancer) + * + * @link https://symfony.com/doc/current/deployment/proxies.html + */ + 'headers' => Illuminate\Http\Request::HEADER_X_FORWARDED_ALL, + +]; 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: Sun, 24 Oct 2021 20:35:38 +0500 Subject: [PATCH 03/12] Locales seeder turkmenche ruscha --- .../src/Database/Seeders/SLocalesTableSeeder.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/Sarga/Shop/src/Database/Seeders/SLocalesTableSeeder.php b/packages/Sarga/Shop/src/Database/Seeders/SLocalesTableSeeder.php index d8030dec3..4017bbf83 100644 --- a/packages/Sarga/Shop/src/Database/Seeders/SLocalesTableSeeder.php +++ b/packages/Sarga/Shop/src/Database/Seeders/SLocalesTableSeeder.php @@ -3,8 +3,21 @@ namespace Sarga\Shop\Database\Seeders; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\DB; class SLocalesTableSeeder extends Seeder { - public function run(){} + public function run(){ + DB::table('locales')->insert([ + + [ + 'id' => 6, + 'code' => 'tm', + 'name' => 'Türkmençe', + ], [ + 'id' => 7, + 'code' => 'ru', + 'name' => 'Rusça', + ]]); + } } \ No newline at end of file From 915d0933ff6ea52e851e4db7d93669a5828781ff Mon Sep 17 00:00:00 2001 From: merdan Date: Sun, 24 Oct 2021 20:39:36 +0500 Subject: [PATCH 04/12] Currency seeder manat lira --- .../Database/Seeders/SCurrencyTableSeeder.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 packages/Sarga/Shop/src/Database/Seeders/SCurrencyTableSeeder.php diff --git a/packages/Sarga/Shop/src/Database/Seeders/SCurrencyTableSeeder.php b/packages/Sarga/Shop/src/Database/Seeders/SCurrencyTableSeeder.php new file mode 100644 index 000000000..61dbd0b97 --- /dev/null +++ b/packages/Sarga/Shop/src/Database/Seeders/SCurrencyTableSeeder.php @@ -0,0 +1,25 @@ +insert([ + [ + 'id' => 3, + 'code' => 'TL', + 'name' => 'Lira', + 'symbol' => 't', + ], [ + 'id' => 4, + 'code' => 'TMT', + 'name' => 'Manat', + 'symbol' => 'm', + ] + ]); + } +} \ No newline at end of file From 8d1dfe363ab5402b89ffdaadd7b8c8ff4e612dcb Mon Sep 17 00:00:00 2001 From: merdan Date: Sun, 24 Oct 2021 20:49:12 +0500 Subject: [PATCH 05/12] Custom database seeder --- database/seeders/DatabaseSeeder.php | 2 +- .../Database/Seeders/ChannelTableSeeder.php | 112 ++++++++++++++++++ .../src/Database/Seeders/DatabaseSeeder.php | 3 +- 3 files changed, 115 insertions(+), 2 deletions(-) diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index da85a52bb..1ed314700 100755 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -16,7 +16,7 @@ class DatabaseSeeder extends Seeder */ public function run() { -// $this->call(BagistoDatabaseSeeder::class); + $this->call(BagistoDatabaseSeeder::class); // $this->call(VelocityMetaDataSeeder::class); $this->call(SargaDatabaseSeeder::class); } diff --git a/packages/Sarga/Shop/src/Database/Seeders/ChannelTableSeeder.php b/packages/Sarga/Shop/src/Database/Seeders/ChannelTableSeeder.php index e44695905..f42539824 100644 --- a/packages/Sarga/Shop/src/Database/Seeders/ChannelTableSeeder.php +++ b/packages/Sarga/Shop/src/Database/Seeders/ChannelTableSeeder.php @@ -12,6 +12,118 @@ class ChannelTableSeeder extends Seeder */ public function run() { + DB::table('channels')->insert([ + 'id' => 2, + 'code' => 'test', + 'theme' => 'default', + 'hostname' => config('app.url').'/test', + 'root_category_id' => 2, + 'default_locale_id' => 1, + 'base_currency_id' => 1, + ]); + DB::table('channel_translations')->insert([ + [ + 'id' => 6, + 'channel_id' => 2, + 'locale' => 'en', + 'name' => 'Test', + 'home_page_content' => ' +

@include("shop::home.slider") @include("shop::home.featured-products") @include("shop::home.new-products")

+ + ', + 'footer_content' => ' + + + ', + 'home_seo' => '{"meta_title": "Demo store", "meta_keywords": "Demo store meta keyword", "meta_description": "Demo store meta description"}', + ], [ + 'id' => 7, + 'channel_id' => 2, + 'locale' => 'tr', + 'name' => 'Test', + 'home_page_content' => ' +

@include("shop::home.slider") @include("shop::home.featured-products") @include("shop::home.new-products")

+ + ', + 'footer_content' => ' + + + ', + 'home_seo' => '{"meta_title": "Demo store", "meta_keywords": "Demo store meta keyword", "meta_description": "Demo store meta description"}', + ] + ]); + DB::table('channel_currencies')->insert([[ + 'channel_id' => 2, + 'currency_id' => 3, + ],[ + 'channel_id' => 2, + 'currency_id' => 4, + ]]); + + DB::table('channel_locales')->insert([[ + 'channel_id' => 2, + 'locale_id' => 6, + ],[ + 'channel_id' => 2, + 'locale_id' => 7, + ]]); + + DB::table('channel_inventory_sources')->insert([ + 'channel_id' => 2, + 'inventory_source_id' => 1, + ]); } } \ No newline at end of file diff --git a/packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php b/packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php index 57a2655de..1a28a6183 100644 --- a/packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php +++ b/packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php @@ -14,7 +14,8 @@ class DatabaseSeeder extends Seeder public function run() { $this->call(SLocalesTableSeeder::class); - $this->call(DemoCategoryTableSeeder::class); + $this->call(SCurrencyTableSeeder::class); +// $this->call(DemoCategoryTableSeeder::class); $this->call(ChannelTableSeeder::class); } From 3b1b47358b1c1aad98913fbfbf5e49c5cce3aed1 Mon Sep 17 00:00:00 2001 From: merdan Date: Mon, 25 Oct 2021 00:33:53 +0500 Subject: [PATCH 06/12] Custom database seeder --- packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php b/packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php index 1a28a6183..ae804c09d 100644 --- a/packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php +++ b/packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php @@ -15,7 +15,7 @@ class DatabaseSeeder extends Seeder { $this->call(SLocalesTableSeeder::class); $this->call(SCurrencyTableSeeder::class); -// $this->call(DemoCategoryTableSeeder::class); + $this->call(DemoCategoryTableSeeder::class); $this->call(ChannelTableSeeder::class); } From 3929e7f0518480a3bb52836309bd3dfda16ebc2e Mon Sep 17 00:00:00 2001 From: merdan Date: Mon, 25 Oct 2021 22:16:18 +0500 Subject: [PATCH 07/12] Custom database seeder with bagisto faker --- composer.json | 2 + composer.lock | 225 ++++++- database/factories/CustomerAddressFactory.php | 9 + database/factories/CustomerFactory.php | 9 + .../ProductAttributeValueFactory.php | 7 + database/factories/ProductFactory.php | 15 + database/factories/ProductFlatFactory.php | 60 ++ database/factories/ProductImageFactory.php | 7 + .../factories/ProductInventoryFactory.php | 11 + .../src/Database/Seeders/DatabaseSeeder.php | 1 - .../Seeders/DemoCategoryTableSeeder.php | 52 -- .../Repositories/AttributeValueRepository.php | 199 ++++++ .../CustomerAddressRepository.php | 69 ++ .../src/Repositories/CustomerRepository.php | 85 +++ .../Repositories/ProductFlatRepository.php | 614 ++++++++++++++++++ .../Repositories/RelatedProductRepository.php | 66 ++ 16 files changed, 1377 insertions(+), 54 deletions(-) create mode 100644 database/factories/CustomerAddressFactory.php create mode 100644 database/factories/CustomerFactory.php create mode 100644 database/factories/ProductAttributeValueFactory.php create mode 100644 database/factories/ProductFactory.php create mode 100644 database/factories/ProductFlatFactory.php create mode 100644 database/factories/ProductImageFactory.php create mode 100644 database/factories/ProductInventoryFactory.php delete mode 100644 packages/Sarga/Shop/src/Database/Seeders/DemoCategoryTableSeeder.php create mode 100644 packages/Sarga/Shop/src/Repositories/AttributeValueRepository.php create mode 100644 packages/Sarga/Shop/src/Repositories/CustomerAddressRepository.php create mode 100644 packages/Sarga/Shop/src/Repositories/CustomerRepository.php create mode 100644 packages/Sarga/Shop/src/Repositories/ProductFlatRepository.php create mode 100644 packages/Sarga/Shop/src/Repositories/RelatedProductRepository.php diff --git a/composer.json b/composer.json index bc5cefa9d..1448994eb 100755 --- a/composer.json +++ b/composer.json @@ -13,6 +13,7 @@ "astrotomic/laravel-translatable": "^11.0.0", "aws/aws-sdk-php": "^3.171", "babenkoivan/elastic-scout-driver": "^1.1", + "bagisto/laravel-datafaker": "dev-master", "bagistobrasil/bagisto-product-social-share": "^0.1.2", "barryvdh/laravel-debugbar": "^3.1", "barryvdh/laravel-dompdf": "^0.8.5|^0.9.0", @@ -29,6 +30,7 @@ "khaled.alshamaa/ar-php": "^6.0.0", "konekt/concord": "^1.2", "laravel/framework": "^8.0", + "laravel/legacy-factories": "^1.1", "laravel/scout": "^8.0", "laravel/socialite": "^5.0", "laravel/tinker": "^2.0", diff --git a/composer.lock b/composer.lock index 199bce18a..ff5fa5b0b 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": "46b4c37f75642ba14f3a2913f0f345cd", + "content-hash": "b1710279cb7cc769d4ed404692c85082", "packages": [ { "name": "algolia/algoliasearch-client-php", @@ -516,6 +516,65 @@ ], "time": "2021-08-09T21:09:19+00:00" }, + { + "name": "bagisto/laravel-datafaker", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/bagisto/laravel-data-faker.git", + "reference": "c67d840a0fc2416acf854bd5a0a9cb47a52a417e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bagisto/laravel-data-faker/zipball/c67d840a0fc2416acf854bd5a0a9cb47a52a417e", + "reference": "c67d840a0fc2416acf854bd5a0a9cb47a52a417e", + "shasum": "" + }, + "require": { + "konekt/concord": "^1.2", + "laravel/helpers": "^1.3", + "mbezhanov/faker-provider-collection": "^2.0" + }, + "default-branch": true, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Webkul\\DataFaker\\Providers\\DataFakerServiceProvider" + ], + "aliases": [] + } + }, + "autoload": { + "psr-4": { + "Webkul\\DataFaker\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Naresh Verma", + "email": "naresh.verma327@webkul.com", + "homepage": "https://bagisto.com", + "role": "Developer" + } + ], + "description": "Add fake data of products and customers in Bagisto.", + "homepage": "https://github.com/bagisto/laravel-data-faker", + "keywords": [ + "bagisto", + "fake customers", + "fake products" + ], + "support": { + "issues": "https://github.com/bagisto/laravel-data-faker/issues", + "source": "https://github.com/bagisto/laravel-data-faker/tree/master" + }, + "time": "2021-09-23T12:08:32+00:00" + }, { "name": "bagistobrasil/bagisto-product-social-share", "version": "0.1.3", @@ -3053,6 +3112,118 @@ }, "time": "2021-05-19T13:03:18+00:00" }, + { + "name": "laravel/helpers", + "version": "v1.4.1", + "source": { + "type": "git", + "url": "https://github.com/laravel/helpers.git", + "reference": "febb10d8daaf86123825de2cb87f789a3371f0ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/helpers/zipball/febb10d8daaf86123825de2cb87f789a3371f0ac", + "reference": "febb10d8daaf86123825de2cb87f789a3371f0ac", + "shasum": "" + }, + "require": { + "illuminate/support": "~5.8.0|^6.0|^7.0|^8.0", + "php": "^7.1.3|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0|^8.0|^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + }, + { + "name": "Dries Vints", + "email": "dries.vints@gmail.com" + } + ], + "description": "Provides backwards compatibility for helpers in the latest Laravel release.", + "keywords": [ + "helpers", + "laravel" + ], + "support": { + "source": "https://github.com/laravel/helpers/tree/v1.4.1" + }, + "time": "2021-02-16T15:27:11+00:00" + }, + { + "name": "laravel/legacy-factories", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/laravel/legacy-factories.git", + "reference": "8091d6d64e0e6ea22fb3326ef0b21936d0a0217c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/legacy-factories/zipball/8091d6d64e0e6ea22fb3326ef0b21936d0a0217c", + "reference": "8091d6d64e0e6ea22fb3326ef0b21936d0a0217c", + "shasum": "" + }, + "require": { + "illuminate/macroable": "^8.0", + "php": "^7.3|^8.0", + "symfony/finder": "^3.4|^4.0|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "laravel": { + "providers": [ + "Illuminate\\Database\\Eloquent\\LegacyFactoryServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "helpers.php" + ], + "psr-4": { + "Illuminate\\Database\\Eloquent\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The legacy version of the Laravel Eloquent factories.", + "homepage": "http://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-10-19T13:10:37+00:00" + }, { "name": "laravel/scout", "version": "v8.6.1", @@ -4089,6 +4260,57 @@ }, "time": "2021-08-01T09:19:02+00:00" }, + { + "name": "mbezhanov/faker-provider-collection", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/mbezhanov/faker-provider-collection.git", + "reference": "ae3a9ba9421c3a593836689f08da1443b4065bc0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mbezhanov/faker-provider-collection/zipball/ae3a9ba9421c3a593836689f08da1443b4065bc0", + "reference": "ae3a9ba9421c3a593836689f08da1443b4065bc0", + "shasum": "" + }, + "require": { + "fakerphp/faker": "^1.13", + "php": "^7.4|^8.0" + }, + "require-dev": { + "php-mock/php-mock": "^2.3", + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Bezhanov\\Faker\\": "src/Faker" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marin Bezhanov", + "email": "marin.bezhanov@gmail.com", + "homepage": "http://marinbezhanov.com" + } + ], + "description": "A collection of custom providers for the Faker library", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/mbezhanov/faker-provider-collection/issues", + "source": "https://github.com/mbezhanov/faker-provider-collection/tree/2.0.1" + }, + "time": "2021-03-12T06:57:05+00:00" + }, { "name": "monolog/monolog", "version": "2.3.5", @@ -11691,6 +11913,7 @@ "aliases": [], "minimum-stability": "dev", "stability-flags": { + "bagisto/laravel-datafaker": 20, "tymon/jwt-auth": 20 }, "prefer-stable": true, diff --git a/database/factories/CustomerAddressFactory.php b/database/factories/CustomerAddressFactory.php new file mode 100644 index 000000000..1373d40af --- /dev/null +++ b/database/factories/CustomerAddressFactory.php @@ -0,0 +1,9 @@ +define(\Webkul\Customer\Models\CustomerAddress::class, function (Faker $faker) { + $fakeData = app('Webkul\DataFaker\Repositories\CustomerAddressRepository')->customerAddressDummyData($faker); + + return $fakeData; +}); diff --git a/database/factories/CustomerFactory.php b/database/factories/CustomerFactory.php new file mode 100644 index 000000000..add773f67 --- /dev/null +++ b/database/factories/CustomerFactory.php @@ -0,0 +1,9 @@ +define(\Webkul\Customer\Models\Customer::class, function (Faker $faker) { + $fakeData = app('Webkul\DataFaker\Repositories\CustomerRepository')->customerDummyData($faker); + + return $fakeData; +}); diff --git a/database/factories/ProductAttributeValueFactory.php b/database/factories/ProductAttributeValueFactory.php new file mode 100644 index 000000000..05baff703 --- /dev/null +++ b/database/factories/ProductAttributeValueFactory.php @@ -0,0 +1,7 @@ +define(\Webkul\Product\Models\ProductAttributeValue::class, function (Faker $faker, $attributeValue) { + return $attributeValue; +}); diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php new file mode 100644 index 000000000..cf4777485 --- /dev/null +++ b/database/factories/ProductFactory.php @@ -0,0 +1,15 @@ +define(\Webkul\Product\Models\Product::class, function (Faker $faker) { + $productName = $faker->userName; + + $sku = substr(strtolower(str_replace(array('a','e','i','o','u'), '', $productName)), 0, 6); + + $productSku = str_replace(' ', '', $sku) . "-". str_replace(' ', '', $sku) . "-" . rand(1,9999999) . "-" . rand(1,9999999); + + return [ + 'sku' => $productSku, + 'attribute_family_id'=>1 + ]; +}); diff --git a/database/factories/ProductFlatFactory.php b/database/factories/ProductFlatFactory.php new file mode 100644 index 000000000..cd9a15df6 --- /dev/null +++ b/database/factories/ProductFlatFactory.php @@ -0,0 +1,60 @@ +define(\Webkul\Product\Models\ProductFlat::class, function (Faker $faker, $data) { + $products = $data['product_id']; + + if ($products->type == 'simple') { + + $product = ['product_id' => $products->id]; + + $fakeData = app('Webkul\DataFaker\Repositories\ProductFlatRepository')->GetProductFlatDummyData($faker, $products->type); + + $attributes = app('Webkul\Attribute\Repositories\AttributeRepository')->get(); + + foreach ($attributes as $attribute) { + + if (! isset($fakeData[$attribute->code]) || (in_array($attribute->type, ['date', 'datetime']) && ! $fakeData[$attribute->code])) + continue; + + if ($attribute->type == 'multiselect' || $attribute->type == 'checkbox') { + $fakeData[$attribute->code] = implode(",", $fakeData[$attribute->code]); + } + + if ($attribute->type == 'image' || $attribute->type == 'file') { + $dir = 'product'; + if (gettype($fakeData[$attribute->code]) == 'object') { + $fakeData[$attribute->code] = request()->file($attribute->code)->store($dir); + } else { + $fakeData[$attribute->code] = NULL; + } + } + + $attributeValue = [ + 'product_id' => $product['product_id'], + 'attribute_id' => $attribute->id, + 'value' => $fakeData[$attribute->code], + 'channel' => $attribute->value_per_channel ? $fakeData['channel'] : null, + 'locale' => $attribute->value_per_locale ? $fakeData['locale'] : null + ]; + + $attributeValue[ProductAttributeValue::$attributeTypeFields[$attribute->type]] = $attributeValue['value']; + + unset($attributeValue['value']); + + factory(\Webkul\Product\Models\ProductAttributeValue::class)->create($attributeValue); + } + + $fakeImage = app('Webkul\DataFaker\Repositories\ProductFlatRepository')->uploadImages($faker, $product); + + factory(\Webkul\Product\Models\ProductImage::class, 5)->create($fakeImage); + + + $category = app('Webkul\DataFaker\Repositories\ProductFlatRepository')->createProductCategories($product, $faker); + + return $fakeData; + } +}); diff --git a/database/factories/ProductImageFactory.php b/database/factories/ProductImageFactory.php new file mode 100644 index 000000000..96e5a1144 --- /dev/null +++ b/database/factories/ProductImageFactory.php @@ -0,0 +1,7 @@ +define(\Webkul\Product\Models\ProductImage::class, function ($faker,$fakeImage) { + return $fakeImage; +}); \ No newline at end of file diff --git a/database/factories/ProductInventoryFactory.php b/database/factories/ProductInventoryFactory.php new file mode 100644 index 000000000..10bbe487f --- /dev/null +++ b/database/factories/ProductInventoryFactory.php @@ -0,0 +1,11 @@ +define(\Webkul\Product\Models\ProductInventory::class, function (Faker $faker,$data) { + + return [ + 'product_id' => $data['product_id'], + 'inventory_source_id' => $data['inventory_source_id'], + 'qty' =>rand(1,999) + ]; +}); \ No newline at end of file diff --git a/packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php b/packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php index ae804c09d..b4be5270b 100644 --- a/packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php +++ b/packages/Sarga/Shop/src/Database/Seeders/DatabaseSeeder.php @@ -15,7 +15,6 @@ class DatabaseSeeder extends Seeder { $this->call(SLocalesTableSeeder::class); $this->call(SCurrencyTableSeeder::class); - $this->call(DemoCategoryTableSeeder::class); $this->call(ChannelTableSeeder::class); } diff --git a/packages/Sarga/Shop/src/Database/Seeders/DemoCategoryTableSeeder.php b/packages/Sarga/Shop/src/Database/Seeders/DemoCategoryTableSeeder.php deleted file mode 100644 index 103e5b240..000000000 --- a/packages/Sarga/Shop/src/Database/Seeders/DemoCategoryTableSeeder.php +++ /dev/null @@ -1,52 +0,0 @@ -faker = $faker; - $this->categoryRepository = $categoryRepository; - } - - public function run() - { - $this->categoryRepository->deleteWhere([['id', '!=', 1]]); - for ($i = 2; $i < $this->numberOfParentCategories; $i++) { - $createdCategory = $this->categoryRepository->create([ - 'id' => $i, - 'slug' => $this->faker->slug, - 'name' => $this->faker->firstName, - 'description' => $this->faker->text(), - 'parent_id' => 1, - 'status' => 1, - ]); - - if ($createdCategory) { - for ($j = ($i-1)*$this->numberOfParentCategories; $j < ($i-1)*$this->numberOfParentCategories+$this->numberOfChildCategories; ++$j) { - - $this->categoryRepository->create([ - 'id' => $j, - 'slug' => $this->faker->slug, - 'name' => $this->faker->firstName, - 'description' => $this->faker->text(), - 'parent_id' => $createdCategory->id, - 'status' => 1 - ]); - } - } - } - } -} diff --git a/packages/Sarga/Shop/src/Repositories/AttributeValueRepository.php b/packages/Sarga/Shop/src/Repositories/AttributeValueRepository.php new file mode 100644 index 000000000..1593c20ba --- /dev/null +++ b/packages/Sarga/Shop/src/Repositories/AttributeValueRepository.php @@ -0,0 +1,199 @@ +attribute = $attribute; + + $this->baseProductRepository = $baseProductRepository; + + $this->attributeValue = $attributeValue; + + $this->productInventory = $productInventory; + + parent::__construct($app); + } + + /** + * Specify Model class name + * + * @return mixed + */ + function model() + { + return 'Webkul\Product\Contracts\ProductAttributeValue'; + } + + /** + * Dummy Data For Customer Table. + * + * @return mixed + */ + public function createAttributeValue($data) + { + $localeCode = core()->getCurrentLocale()->code; + + $channelCode = core()->getCurrentChannel()->code; + + $product = $this->baseProductRepository->find($data['product_id']); + + $attributeValues = [ + 'channel' => $channelCode, + 'locale' => $localeCode, + 'sku' => $data['sku'], + 'name' => $data['name'], + 'url_key' => $data['url_key'], + 'new' => $data['new'], + 'featured' => $data['featured'], + 'visible_individually' => $data['visible_individually'], + 'status' => $data['status'], + 'color' => $data['color'], + 'size' => $data['size'], + 'short_description' => $data['short_description'], + 'description' => $data['description'], + 'meta_title' => $data['meta_title'], + 'meta_keywords' => $data['meta_keywords'], + 'meta_description' => $data['meta_description'], + 'price' => $data['price'], + 'cost' => '', + 'special_price' => $data['special_price'], + 'special_price_from' => $data['special_price_from'], + 'special_price_to' => $data['special_price_to'], + 'width' => $data['width'], + 'height' => $data['height'], + 'depth' => $data['depth'], + 'weight' => $data['weight'], + 'channels' => [ + 0 => 1 + ], + ]; + + $attributes = $product->attribute_family->custom_attributes; + + foreach ($attributes as $attribute) { + if (! isset($attributeValues[$attribute->code]) || (in_array($attribute->type, ['date', 'datetime']) && ! $attributeValues[$attribute->code])) + continue; + + if ($attribute->type == 'multiselect' || $attribute->type == 'checkbox') { + $attributeValues[$attribute->code] = implode(",", $attributeValues[$attribute->code]); + } + + if ($attribute->type == 'image' || $attribute->type == 'file') { + $dir = 'product'; + if (gettype($attributeValues[$attribute->code]) == 'object') { + $attributeValues[$attribute->code] = request()->file($attribute->code)->store($dir); + } else { + $attributeValues[$attribute->code] = NULL; + } + } + + $attributeValue = $this->attributeValue->findOneWhere([ + 'product_id' => $product->id, + 'attribute_id' => $attribute->id, + 'channel' => $attribute->value_per_channel ? $channelCode : null, + 'locale' => $attribute->value_per_locale ? $localeCode : null + ]); + + if (! $attributeValue) { + $attributeValue = $this->createValue([ + 'product_id' => $product->id, + 'attribute_id' => $attribute->id, + 'value' => $attributeValues[$attribute->code], + 'channel' => $attribute->value_per_channel ? $channelCode : null, + 'locale' => $attribute->value_per_locale ? $localeCode : null + ]); + } + + $this->attributeValue->update([ + ProductAttributeValue::$attributeTypeFields[$attribute->type] => $attributeValues[$attribute->code] + ], $attributeValue->id + ); + } + } + + /** + * Create The Attribute Value + * + * @param array $data + * @return mixed + */ + public function createValue(array $data) + { + $data['value'] = 1; + + if (isset($data['attribute_id'])) { + + $attribute = $this->attribute->find($data['attribute_id']); + } else { + $attribute = $this->attribute->findOneByField('code', $data['attribute_code']); + } + + if (! $attribute) + return; + + $data[ProductAttributeValue::$attributeTypeFields[$attribute->type]] = $data['value']; + + unset($data['value']); + + return $this->model->create($data); + } +} \ No newline at end of file diff --git a/packages/Sarga/Shop/src/Repositories/CustomerAddressRepository.php b/packages/Sarga/Shop/src/Repositories/CustomerAddressRepository.php new file mode 100644 index 000000000..c1d84e7cf --- /dev/null +++ b/packages/Sarga/Shop/src/Repositories/CustomerAddressRepository.php @@ -0,0 +1,69 @@ +countryRepository = $countryRepository; + + $this->countryStateRepository = $countryStateRepository; + } + + /** + * Dummy Data For Customer Table. + * + * @param $faker + * @return mixed + */ + public function customerAddressDummyData($faker) + { + $countries = $this->countryRepository->get()->random(); + $default_address = $faker->randomElement([1,0]); + + return [ + 'customer_id' => factory('Webkul\Customer\Models\Customer')->create()->id, + 'address1' => $faker->address, + 'country' => $countries->code, + 'state' => $faker->state, + 'city' => $faker->city, + 'postcode' => $faker->postcode, + 'phone' => $faker->phoneNumber, + 'default_address' => $default_address, + 'address_type' => 'customer' + ]; + } +} \ No newline at end of file diff --git a/packages/Sarga/Shop/src/Repositories/CustomerRepository.php b/packages/Sarga/Shop/src/Repositories/CustomerRepository.php new file mode 100644 index 000000000..4fdf862f9 --- /dev/null +++ b/packages/Sarga/Shop/src/Repositories/CustomerRepository.php @@ -0,0 +1,85 @@ +countryRepository = $countryRepository; + + $this->countryStateRepository = $countryStateRepository; + + $this->customerGroupRepository = $customerGroupRepository; + } + + /** + * Dummy Data For Customer Table. + * + * @return mixed + */ + public function customerDummyData($faker) + { + $gender = $faker->randomElement(['male', 'female']); + + $customerGroup = $this->customerGroupRepository->get()->random(); + + return [ + 'first_name' => $faker->firstName($gender), + 'last_name' => $faker->lastName, + 'gender' => $gender, + 'date_of_birth' => $faker->date($format = 'Y-m-d', $max = 'now'), + 'email' => $faker->unique()->safeEmail(), + 'phone' => $faker->e164PhoneNumber, + 'password' => bcrypt('admin123'), + 'customer_group_id' => $customerGroup->id, + 'is_verified' => 1, + 'remember_token' =>str_random(10) + ]; + } +} \ No newline at end of file diff --git a/packages/Sarga/Shop/src/Repositories/ProductFlatRepository.php b/packages/Sarga/Shop/src/Repositories/ProductFlatRepository.php new file mode 100644 index 000000000..6987321f9 --- /dev/null +++ b/packages/Sarga/Shop/src/Repositories/ProductFlatRepository.php @@ -0,0 +1,614 @@ +attribute = $attribute; + + $this->attributeFamilyRepository = $attributeFamilyRepository; + + $this->productAttributeValue = $productAttributeValue; + + $this->baseProductRepository = $baseProductRepository; + + $this->productInventory = $productInventory; + + $this->productImage = $productImage; + + $this->productFlat = $productFlat; + + $this->product = $product; + + $this->relatedProduct = $relatedProduct; + + $this->categoryRepository = $categoryRepository; + + parent::__construct($app); + } + + /** + * Specify Model class name + * + * @return mixed + */ + function model() + { + return 'Webkul\Product\Contracts\Product'; + } + + /** + * Create Product Dummy Data. + * + * @param $faker + * @return mixed + */ + public function getProductFlatDummyData($faker, $productType) + { + switch( $productType ) { + case 'simple': + $fakeData = $this->getSimpleProductDummyData($faker ,$productType); + return $fakeData; + case 'configurable': + $fakeData = $this->getConfigurableProductDummyData($faker, $productType); + return $fakeData; + } + } + + /** + * Dummy Data For Simple Product + * + * @param $faker, $productType + * @return array + */ + public function getSimpleProductDummyData($faker, $productType) + { + $productName = $faker->userName; + + $sku = substr(strtolower(str_replace(array('a','e','i','o','u'), '', $productName)), 0, 6); + + $productSku = str_replace(' ', '', $sku) . "-". str_replace(' ', '', $sku) . "-" . rand(1,9999999) . "-" . rand(1,9999999); + + $price = $faker->numberBetween($min = 0, $max = 500); + + $specialPrice = rand('0', $faker->numberBetween($min = 0, $max = 500)); + + if ($specialPrice == 0) { + $max = $price; + $min = $price; + } else { + $max = $specialPrice; + $min = $specialPrice; + } + + $localeCode = core()->getCurrentLocale()->code; + + $channelCode = core()->getCurrentChannel()->code; + + $productFaker = \Faker\Factory::create(); + + $productFaker->addProvider(new \Bezhanov\Faker\Provider\Commerce($productFaker)); + + $data = [ + 'sku' => $productSku, + 'name' => $productFaker->productName, + 'url_key' => $faker->unique(true)->word . '-' . rand(1,9999999), + 'new' => 1, + 'featured' => 1, + 'visible_individually' => 1, + 'min_price' => $min, + 'max_price' => $max, + 'status' => 1, + 'color' => 1, + 'price' => $price, + 'special_price' => 0, + 'special_price_from' => null, + 'special_price_to' => null, + 'width' => $faker->randomNumber(2), + 'height' => $faker->randomNumber(2), + 'depth' => $faker->randomNumber(2), + 'meta_title' => '', + 'meta_keywords' => '', + 'meta_description' => '', + 'weight' => $faker->randomNumber(2), + 'color_label' => $faker->colorName, + 'size' => 6, + 'size_label' => 'S', + 'short_description' => '

' . $faker->paragraph . '

', + 'description' => '

' . $faker->paragraph . '

', + 'channel' => $channelCode, + 'locale' => $localeCode, + ]; + + return $data; + } + + /** + * Dummy Data For Configurable Product + * + * @param $faker, $productType + * @return array + */ + public function getConfigurableProductDummyData($faker, $productType) + { + $productFaker = \Faker\Factory::create(); + + $productFaker->addProvider(new \Bezhanov\Faker\Provider\Commerce($productFaker)); + + $productName = $productFaker->productName; + + $sku = substr(strtolower(str_replace(array('a','e','i','o','u'), '', $productName)), 0, 6); + + $productSku = str_replace(' ', '', $sku) . "-" . rand(100,9999999); + + $attributeFamily = $this->attributeFamilyRepository->get()->random(); + + $productsTableData = [ + 'type' =>'configurable', + 'attribute_family_id' => $attributeFamily->id, + 'sku' => $productSku, + ]; + + $this->createConfigurableProduct($productsTableData, $faker, $productFaker); + } + + /** + * Create Configurable Product + * + * @param $faker, $data, $productFaker + * @return void + */ + public function createConfigurableProduct($product, $faker, $productFaker) + { + $parentData = $this->createProduct($product,$faker,$productFaker); + $data = [ + 'super_attributes' =>[ + 'size' => [ + 0 => 6, + 1 => 7, + // 2 => 8, + // 3 => 9 + ] + ], + 'family' => 1 + ]; + + $nameAttribute = $this->attribute->findOneByField('code', 'status'); + + $addttribute = $this->productAttributeValue->createValue([ + 'product_id' => $product->id, + 'attribute_id' => $nameAttribute->id, + 'value' => 1 + ]); + + if (isset($data['super_attributes'])) { + + $super_attributes = []; + + foreach ($data['super_attributes'] as $attributeCode => $attributeOptions) { + $attribute = $this->attribute->findOneByField('code', $attributeCode); + + $super_attributes[$attribute->id] = $attributeOptions; + + $product->super_attributes()->attach($attribute->id); + } + + foreach (array_permutation($super_attributes) as $permutation) { + $variantProduct = $this->createVariant($product, $permutation, $faker); + + if (isset($variantProduct)) { + //insert data into product flat + $this->createVariantProduct($variantProduct->getOriginal(), $faker, $productFaker, $permutation['24']); + } + } + } + } + + /** + * Create Product Variant + * + * @param mixed $product + * @param array $permutation + * @param array $data + * @return mixed + */ + public function createVariant($product, $permutation, $faker, $data = []) + { + if (! count($data)) { + $data = [ + "sku" => $product->sku . '-variant-' . implode('-', $permutation), + "name" => "", + "inventories" => [], + "price" => 0, + "weight" => 0, + "status" => 1 + ]; + } + + $variant = $this->model->create([ + 'parent_id' => $product->id, + 'type' => 'simple', + 'attribute_family_id' => $product->attribute_family_id, + 'sku' => $data['sku'], + ]); + + foreach (['sku', 'name', 'price', 'weight', 'status'] as $attributeCode) { + $attribute = $this->attribute->findOneByField('code', $attributeCode); + + if ($attribute->value_per_channel) { + if ($attribute->value_per_locale) { + foreach (core()->getAllChannels() as $channel) { + foreach (core()->getAllLocales() as $locale) { + $datas = $this->productAttributeValue->createValue([ + 'product_id' => $variant->id, + 'attribute_id' => $attribute->id, + 'channel' => $channel->code, + 'locale' => $locale->code, + 'value' => $data[$attributeCode] + ]); + } + } + } else { + foreach (core()->getAllChannels() as $channel) { + $datas = $this->productAttributeValue->createValue([ + 'product_id' => $variant->id, + 'attribute_id' => $attribute->id, + 'channel' => $channel->code, + 'value' => $data[$attributeCode] + ]); + } + } + } else { + if ($attribute->value_per_locale) { + foreach (core()->getAllLocales() as $locale) { + $datas = $this->productAttributeValue->createValue([ + 'product_id' => $variant->id, + 'attribute_id' => $attribute->id, + 'locale' => $locale->code, + 'value' => $data[$attributeCode] + ]); + } + } else { + $datas = $this->productAttributeValue->createValue([ + 'product_id' => $variant->id, + 'attribute_id' => $attribute->id, + 'value' => $data[$attributeCode] + ]); + } + } + } + + foreach ($permutation as $attributeId => $optionId) { + $this->productAttributeValue->createValue([ + 'product_id' => $variant->id, + 'attribute_id' => $attributeId, + 'value' => $optionId + ]); + } + + $inventory = [ + 'inventories' => [ + 1 => $faker->randomNumber(2) + ] + ]; + + $this->productInventory->saveInventories($inventory, $variant); + + return $variant; + } + + /** + * Create Product + * + * @param mixed $product + * @param array $productFaker + * @param array $faker + * @return mixed + */ + public function createProduct($product, $faker, $productFaker) + { + $localeCode = core()->getCurrentLocale()->code; + $channelCode = core()->getCurrentChannel()->code; + + if ($product['type'] == 'configurable') { + $price = null; + $parentId = null; + $urlKey = $faker->unique(true)->word . '-' . rand(1,9999999); + $new = 1; + $feature = 1; + $description = $faker->paragraph; + $description = $faker->paragraph; + $visibleIndividually = 1; + } + + $data = [ + 'product_id' => $product['id'], + 'sku' => $faker->word, + 'name' => $productFaker->productName, + 'url_key' => $urlKey, + 'new' => $new, + 'featured' => $feature, + 'visible_individually' => $visibleIndividually, + 'min_price' => $faker->numberBetween($min = 100, $max = 200), + 'max_price' => $faker->numberBetween($min = 200, $max = 500), + 'parent_id' => $parentId, + 'status' => 1, + 'color' => 1, + 'price' => $price, + 'width' => null, + 'height' =>null, + 'depth' => null, + 'meta_title' => '', + 'meta_keywords' => '', + 'meta_description' => '', + 'weight' => null, + 'color_label' => 'Red', + 'size' => null, + 'size_label' => null, + 'short_description' => '

' . $description . '

', + 'description' => '

' . $description . '

', + 'channel' => $channelCode, + 'locale' => $localeCode, + 'special_price' => null, + 'special_price_from' => null, + 'special_price_to' => null, + ]; + + $this->productAttributeValue->createAttributeValue($data); + + $this->productFlat->create($data); + } + + /** + * Create Variant Product + * + * @param mixed $product + * @param array $productFaker + * @param array $faker + * @return mixed + */ + public function createVariantProduct($variantProduct, $faker, $productFaker, $size) + { + $localeCode = core()->getCurrentLocale()->code; + + $channelCode = core()->getCurrentChannel()->code; + + if ($variantProduct['type'] == 'simple') { + $price = $faker->numberBetween($min = 0, $max = 500); + $parentId = $variantProduct['id']; + } + + switch($size) { + case '6': $sizeLabel = 'S'; + break; + case '7': $sizeLabel = 'M'; + break; + case '8': $sizeLabel = 'L'; + break; + case '9': $sizeLabel = 'XL'; + } + + $data = [ + 'product_id' => $variantProduct['id'], + 'sku' => $variantProduct['sku'], + 'name' => $productFaker->productName, + 'url_key' => null, + 'new' => null, + 'featured' => null, + 'visible_individually' => null, + 'min_price' => $price, + 'max_price' => $price, + 'parent_id' => $parentId, + 'status' => 1, + 'color' => null, + 'price' => $price, + 'width' => $faker->randomNumber(2), + 'height' => $faker->randomNumber(2), + 'depth' => $faker->randomNumber(2), + 'meta_title' => '', + 'meta_keywords' => '', + 'meta_description' => '', + 'weight' => $faker->randomNumber(2), + 'color_label' => null, + 'size' => $size, + 'size_label' => $sizeLabel, + 'short_description' => null, + 'description' => null, + 'channel' => $channelCode, + 'locale' => $localeCode, + 'special_price' => null, + 'special_price_from' => null, + 'special_price_to' => null, + ]; + + $parentId = $this->productFlat->findOneWhere(['product_id' => $variantProduct['parent_id']])->id; + + $data['parent_id'] = $parentId; + + $this->productAttributeValue->createAttributeValue($data); + + $this->productFlat->create($data); + } + + /** + * Upload Product Images + * + * @param mixed $product + * @param array $productFaker + * @return mixed + */ + public function uploadImages($faker, $product) + { + + $filepath = storage_path('app/public/product/'); + + Storage::makeDirectory('/product/'. $product['product_id']); + + $path = $faker->image($filepath. $product['product_id'], 800, 800, 'food', true, true); + + + $pos = strpos($path, 'product'); + + $imagePath = substr($path, $pos); + + $data = [ + 'path' => $imagePath, + 'product_id' => $product['product_id'] + ]; + + return $data; + } + + /** + * Create Product Categories + * + * @param mixed $product + * @param array $productFaker + * @return mixed + */ + public function createProductCategories($product, $faker) + { + $categories = $this->categoryRepository->all()->random(3); + + $filterableAttribute = ['11', '23', '24', '25']; + + foreach ($categories as $category) { + if (! empty($category->translations) && count($category->translations) > 0) { + foreach ($category->translations as $translation) { + + DB::table('product_categories')->insert([ + 'product_id' => $product['product_id'], + 'category_id' => $translation->category_id, + ]); + + foreach ($filterableAttribute as $categoryFilterableAttribute) { + + $categoryExist = DB::table('category_filterable_attributes')->where('category_id',$translation->category_id)->count(); + + if ($categoryExist < 4) { + DB::table('category_filterable_attributes')->insert([ + 'attribute_id' => $categoryFilterableAttribute, + 'category_id' => $translation->category_id, + ]); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/Sarga/Shop/src/Repositories/RelatedProductRepository.php b/packages/Sarga/Shop/src/Repositories/RelatedProductRepository.php new file mode 100644 index 000000000..a50540306 --- /dev/null +++ b/packages/Sarga/Shop/src/Repositories/RelatedProductRepository.php @@ -0,0 +1,66 @@ +product = $product; + } + + /** + * Dummy Data For Customer Table. + * + * @return mixed + */ + public function getRelatedProducts($product) + { + // $productCount = $this->product->count(); + + // if ($productCount > 4) { + + // $products = $this->product->get()->random(4); + + // foreach ($products as $relatedProduct) { + // if ( $product['product_id'] != $relatedProduct->id) { + // DB::table('product_up_sells')->insert([ + // 'parent_id' => $product['product_id'], + // 'child_id' => $relatedProduct->id, + // ]); + + // DB::table('product_cross_sells')->insert([ + // 'parent_id' => $product['product_id'], + // 'child_id' => $relatedProduct->id, + // ]); + // } + // } + // } + } +} From 9254d048b539306897f223ef034402c2c71871e4 Mon Sep 17 00:00:00 2001 From: merdan Date: Wed, 27 Oct 2021 21:06:17 +0500 Subject: [PATCH 08/12] Channels list with sliders --- composer.json | 3 +- config/app.php | 2 ++ .../Sarga/API/Http/Controllers/Channels.php | 36 +++++++++++++++++++ .../API/Http/Resources/Catalog/Category.php | 36 +++++++++++++++++++ .../Sarga/API/Http/Resources/Core/Channel.php | 32 +++++++++++++++++ .../Sarga/API/Http/Resources/Core/Slider.php | 27 ++++++++++++++ packages/Sarga/API/Http/routes.php | 10 ++++++ .../API/Providers/APIServiceProvider.php | 17 +++++++++ packages/Sarga/API/composer.json | 30 ++++++++++++++++ packages/Sarga/Shop/src/Models/Channel.php | 11 ++++++ .../Shop/src/Models/ChannelTranslation.php | 9 +++++ .../src/Repositories/ChannelRepository.php | 14 ++++++++ .../API/Http/Resources/Checkout/Cart.php | 2 +- .../Webkul/API/Http/Resources/Sales/Order.php | 2 +- packages/Webkul/API/Http/routes.php | 6 ++-- 15 files changed, 231 insertions(+), 6 deletions(-) create mode 100644 packages/Sarga/API/Http/Controllers/Channels.php create mode 100644 packages/Sarga/API/Http/Resources/Catalog/Category.php create mode 100644 packages/Sarga/API/Http/Resources/Core/Channel.php create mode 100644 packages/Sarga/API/Http/Resources/Core/Slider.php create mode 100644 packages/Sarga/API/Http/routes.php create mode 100644 packages/Sarga/API/Providers/APIServiceProvider.php create mode 100644 packages/Sarga/API/composer.json create mode 100644 packages/Sarga/Shop/src/Models/Channel.php create mode 100644 packages/Sarga/Shop/src/Models/ChannelTranslation.php create mode 100644 packages/Sarga/Shop/src/Repositories/ChannelRepository.php diff --git a/composer.json b/composer.json index 1448994eb..ed4908421 100755 --- a/composer.json +++ b/composer.json @@ -104,7 +104,8 @@ "Webkul\\SocialLogin\\": "packages/Webkul/SocialLogin/src", "Webkul\\DebugBar\\": "packages/Webkul/DebugBar/src", "Webkul\\Marketing\\": "packages/Webkul/Marketing/src", - "Sarga\\Shop\\": "packages/Sarga/Shop/src" + "Sarga\\Shop\\": "packages/Sarga/Shop/src", + "Sarga\\API\\": "packages/Sarga/API" } }, "autoload-dev": { diff --git a/config/app.php b/config/app.php index cc79426c2..d0674a98f 100755 --- a/config/app.php +++ b/config/app.php @@ -282,6 +282,8 @@ return [ Webkul\SocialLogin\Providers\SocialLoginServiceProvider::class, Webkul\DebugBar\Providers\DebugBarServiceProvider::class, Webkul\Marketing\Providers\MarketingServiceProvider::class, + Sarga\Shop\Providers\ShopServiceProvider::class, + Sarga\API\Providers\APIServiceProvider::class ], /* diff --git a/packages/Sarga/API/Http/Controllers/Channels.php b/packages/Sarga/API/Http/Controllers/Channels.php new file mode 100644 index 000000000..e9d6d14f3 --- /dev/null +++ b/packages/Sarga/API/Http/Controllers/Channels.php @@ -0,0 +1,36 @@ +channelRepository = $channelRepository; + + } + + public function index() + { + + $channels = $this->channelRepository->with('sliders')->get(); + + if($channels) + { + return Channel::collection($channels); + } + else + { + return response()->json(['not found'],404); + } + } + + public function get($channel_id){ + $this->categoryRepository->getVisibleCategoryTree(request()->input('parent_id')); + } + +} \ No newline at end of file diff --git a/packages/Sarga/API/Http/Resources/Catalog/Category.php b/packages/Sarga/API/Http/Resources/Catalog/Category.php new file mode 100644 index 000000000..88dde44c6 --- /dev/null +++ b/packages/Sarga/API/Http/Resources/Catalog/Category.php @@ -0,0 +1,36 @@ + $this->id, + 'code' => $this->code, + 'name' => $this->name, + 'slug' => $this->slug, + 'display_mode' => $this->display_mode, + 'description' => $this->description, + '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), + + ]; + } +} diff --git a/packages/Sarga/API/Http/Resources/Core/Channel.php b/packages/Sarga/API/Http/Resources/Core/Channel.php new file mode 100644 index 000000000..e8bd2c3b7 --- /dev/null +++ b/packages/Sarga/API/Http/Resources/Core/Channel.php @@ -0,0 +1,32 @@ + $this->id, + 'code' => $this->code, + 'name' => $this->name, + 'hostname' => $this->hostname, + 'root_category_id' => $this->root_category_id, + 'is_maintenance_on' => $this->is_maintenance_on, + 'sliders' => Slider::collection($this->sliders) +// 'root_category' => $this->when($this->root_category_id, new CategoryResource($this->root_category)), +// 'main_categories' => $this->when(request()->has('channel_id'),Category::collection($this->categories)) + + ]; + } +} \ No newline at end of file diff --git a/packages/Sarga/API/Http/Resources/Core/Slider.php b/packages/Sarga/API/Http/Resources/Core/Slider.php new file mode 100644 index 000000000..dd3e38b7f --- /dev/null +++ b/packages/Sarga/API/Http/Resources/Core/Slider.php @@ -0,0 +1,27 @@ + $this->id, + 'title' => $this->title, + 'image_url' => $this->image_url, + 'content' => $this->content, + 'expired_at'=> $this->expired_at, + 'sort_order'=> $this->sort_order, + 'slider_path'=>$this->slider_path + ]; + } +} \ No newline at end of file diff --git a/packages/Sarga/API/Http/routes.php b/packages/Sarga/API/Http/routes.php new file mode 100644 index 000000000..b16d0eb23 --- /dev/null +++ b/packages/Sarga/API/Http/routes.php @@ -0,0 +1,10 @@ + 'api'], function ($router) { + Route::group(['middleware' => ['locale', 'currency']], function ($router) { + //Channel routes + Route::get('channels',[Channels::class, 'index']); + Route::get('channels/{channel_id}',[Channels::class, 'get']); + }); +}); diff --git a/packages/Sarga/API/Providers/APIServiceProvider.php b/packages/Sarga/API/Providers/APIServiceProvider.php new file mode 100644 index 000000000..12096e054 --- /dev/null +++ b/packages/Sarga/API/Providers/APIServiceProvider.php @@ -0,0 +1,17 @@ +loadRoutesFrom(__DIR__.'/../Http/routes.php'); + } +} \ No newline at end of file diff --git a/packages/Sarga/API/composer.json b/packages/Sarga/API/composer.json new file mode 100644 index 000000000..e1a3340c5 --- /dev/null +++ b/packages/Sarga/API/composer.json @@ -0,0 +1,30 @@ +{ + "name": "sarga/api", + "description": "API for Sarga.", + "license": "MIT", + + "authors": [ + { + "name": "merdan muhammedow", + "email": "merdan.m@gmail.com" + } + ], + + "require": {}, + "autoload": { + "psr-4": { + "Sarga\\Shop\\": "src/" + } + }, + + "extra": { + "laravel": { + "providers": [ + "Sarga\\API\\Providers\\APIerviceProvider" + ], + "aliases": {} + } + }, + + "minimum-stability": "dev" +} diff --git a/packages/Sarga/Shop/src/Models/Channel.php b/packages/Sarga/Shop/src/Models/Channel.php new file mode 100644 index 000000000..70717affd --- /dev/null +++ b/packages/Sarga/Shop/src/Models/Channel.php @@ -0,0 +1,11 @@ +hasMany(SliderProxy::modelClass()); + } +} \ No newline at end of file diff --git a/packages/Sarga/Shop/src/Models/ChannelTranslation.php b/packages/Sarga/Shop/src/Models/ChannelTranslation.php new file mode 100644 index 000000000..fe7de38d7 --- /dev/null +++ b/packages/Sarga/Shop/src/Models/ChannelTranslation.php @@ -0,0 +1,9 @@ + 'api'], function ($router) { //Channel routes Route::get('channels', [ResourceController::class, 'index'])->defaults('_config', [ 'repository' => ChannelRepository::class, - 'resource' => Channel::class, + 'resource' => ChannelResource::class, ]); Route::get('channels/{id}', [ResourceController::class, 'get'])->defaults('_config', [ 'repository' => ChannelRepository::class, - 'resource' => Channel::class, + 'resource' => ChannelResource::class, ]); From 3b5700ad49cd5d5a0c8aa60024d44c86d38e5516 Mon Sep 17 00:00:00 2001 From: merdan Date: Wed, 27 Oct 2021 22:13:21 +0500 Subject: [PATCH 09/12] categories tree --- .../Sarga/API/Http/Controllers/Categories.php | 21 +++++++++++++++++++ .../API/Http/Resources/Catalog/Category.php | 16 +++++++------- packages/Sarga/API/Http/routes.php | 8 ++++++- 3 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 packages/Sarga/API/Http/Controllers/Categories.php diff --git a/packages/Sarga/API/Http/Controllers/Categories.php b/packages/Sarga/API/Http/Controllers/Categories.php new file mode 100644 index 000000000..3d57041de --- /dev/null +++ b/packages/Sarga/API/Http/Controllers/Categories.php @@ -0,0 +1,21 @@ +categoryRepository->getVisibleCategoryTree(request()->input('parent_id')) + ); + } + + public function brands($id) + { + + } +} \ No newline at end of file diff --git a/packages/Sarga/API/Http/Resources/Catalog/Category.php b/packages/Sarga/API/Http/Resources/Catalog/Category.php index 88dde44c6..1c3fa7768 100644 --- a/packages/Sarga/API/Http/Resources/Catalog/Category.php +++ b/packages/Sarga/API/Http/Resources/Catalog/Category.php @@ -17,20 +17,20 @@ class Category extends JsonResource { return [ 'id' => $this->id, - 'code' => $this->code, +// 'code' => $this->code, 'name' => $this->name, - 'slug' => $this->slug, - 'display_mode' => $this->display_mode, +// 'slug' => $this->slug, +// 'display_mode' => $this->display_mode, 'description' => $this->description, - 'status' => $this->status, +// '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), - +// 'additional' => is_array($this->resource->additional) +// ? $this->resource->additional +// : json_decode($this->resource->additional, true), + 'children' => Category::collection($this->children) ]; } } diff --git a/packages/Sarga/API/Http/routes.php b/packages/Sarga/API/Http/routes.php index b16d0eb23..8357ec301 100644 --- a/packages/Sarga/API/Http/routes.php +++ b/packages/Sarga/API/Http/routes.php @@ -1,10 +1,16 @@ 'api'], function ($router) { Route::group(['middleware' => ['locale', 'currency']], function ($router) { //Channel routes Route::get('channels',[Channels::class, 'index']); - Route::get('channels/{channel_id}',[Channels::class, 'get']); + + //category routes + Route::get('descendant-categories', [Categories::class, 'index']); + Route::get('category-brands/{id}', [Categories::class, 'brands']); + }); }); From 89ad2541e9b65a1efd5f96450958379c0edd576d Mon Sep 17 00:00:00 2001 From: merdan Date: Thu, 28 Oct 2021 20:30:35 +0500 Subject: [PATCH 10/12] brendler --- .../Sarga/API/Http/Controllers/Categories.php | 4 --- .../Sarga/API/Http/Controllers/Resources.php | 19 ++++++++++++++ .../API/Http/Resources/Catalog/Attribute.php | 25 +++++++++++++++++++ .../Resources/Catalog/AttributeOption.php | 25 +++++++++++++++++++ .../API/Http/Resources/Catalog/Category.php | 2 +- packages/Sarga/API/Http/routes.php | 9 +++++++ 6 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 packages/Sarga/API/Http/Controllers/Resources.php create mode 100644 packages/Sarga/API/Http/Resources/Catalog/Attribute.php create mode 100644 packages/Sarga/API/Http/Resources/Catalog/AttributeOption.php diff --git a/packages/Sarga/API/Http/Controllers/Categories.php b/packages/Sarga/API/Http/Controllers/Categories.php index 3d57041de..8b1109bcd 100644 --- a/packages/Sarga/API/Http/Controllers/Categories.php +++ b/packages/Sarga/API/Http/Controllers/Categories.php @@ -14,8 +14,4 @@ class Categories extends CategoryController ); } - public function brands($id) - { - - } } \ No newline at end of file diff --git a/packages/Sarga/API/Http/Controllers/Resources.php b/packages/Sarga/API/Http/Controllers/Resources.php new file mode 100644 index 000000000..a86480d87 --- /dev/null +++ b/packages/Sarga/API/Http/Controllers/Resources.php @@ -0,0 +1,19 @@ +_config['authorization_required']) && $this->_config['authorization_required'] ? + $this->repository->where(['customer_id'=>auth()->user()->id,'code'=>$code])->first() : + $this->repository->where('code',$code)->first(); + + if($query) + return new $this->_config['resource']($query); + else + return response()->json(['status'=>false,'message'=>'Not found'],404); + } +} \ No newline at end of file diff --git a/packages/Sarga/API/Http/Resources/Catalog/Attribute.php b/packages/Sarga/API/Http/Resources/Catalog/Attribute.php new file mode 100644 index 000000000..4a4949240 --- /dev/null +++ b/packages/Sarga/API/Http/Resources/Catalog/Attribute.php @@ -0,0 +1,25 @@ + $this->id, + 'code' => $this->code, + 'name' => $this->name, + 'options' => AttributeOption::collection($this->options), + ]; + } + +} \ No newline at end of file diff --git a/packages/Sarga/API/Http/Resources/Catalog/AttributeOption.php b/packages/Sarga/API/Http/Resources/Catalog/AttributeOption.php new file mode 100644 index 000000000..0d26e822e --- /dev/null +++ b/packages/Sarga/API/Http/Resources/Catalog/AttributeOption.php @@ -0,0 +1,25 @@ + $this->id, +// 'admin_name' => $this->admin_name, + 'label' => $this->label, +// 'swatch_value' => $this->swatch_value, + 'image' => $this->swatch_value_url + ]; + } +} \ No newline at end of file diff --git a/packages/Sarga/API/Http/Resources/Catalog/Category.php b/packages/Sarga/API/Http/Resources/Catalog/Category.php index 1c3fa7768..d8dd69993 100644 --- a/packages/Sarga/API/Http/Resources/Catalog/Category.php +++ b/packages/Sarga/API/Http/Resources/Catalog/Category.php @@ -19,7 +19,7 @@ class Category extends JsonResource 'id' => $this->id, // 'code' => $this->code, 'name' => $this->name, -// 'slug' => $this->slug, + 'slug' => $this->slug, // 'display_mode' => $this->display_mode, 'description' => $this->description, // 'status' => $this->status, diff --git a/packages/Sarga/API/Http/routes.php b/packages/Sarga/API/Http/routes.php index 8357ec301..e91effada 100644 --- a/packages/Sarga/API/Http/routes.php +++ b/packages/Sarga/API/Http/routes.php @@ -2,6 +2,9 @@ use Sarga\API\Http\Controllers\Categories; use Sarga\API\Http\Controllers\Channels; +use Sarga\API\Http\Controllers\Resources; +use Webkul\Attribute\Repositories\AttributeRepository; +use Sarga\API\Http\Resources\Catalog\Attribute; Route::group(['prefix' => 'api'], function ($router) { Route::group(['middleware' => ['locale', 'currency']], function ($router) { @@ -12,5 +15,11 @@ Route::group(['prefix' => 'api'], function ($router) { Route::get('descendant-categories', [Categories::class, 'index']); Route::get('category-brands/{id}', [Categories::class, 'brands']); + //attributes by code + Route::get('attribute-by-code/{code}', [Resources::class, 'get'])->defaults('_config', [ + 'repository' => AttributeRepository::class, + 'resource' => Attribute::class, + ]); + }); }); From 76c6ad0514b30db406f1f53a14f5809bbbaa6435 Mon Sep 17 00:00:00 2001 From: merdan Date: Thu, 28 Oct 2021 21:36:04 +0500 Subject: [PATCH 11/12] brendler --- .../Sarga/API/Http/Controllers/Resources.php | 19 ------------------- .../Sarga/API/Http/Resources/Core/Channel.php | 3 ++- packages/Sarga/API/Http/routes.php | 12 ++++++------ 3 files changed, 8 insertions(+), 26 deletions(-) delete mode 100644 packages/Sarga/API/Http/Controllers/Resources.php diff --git a/packages/Sarga/API/Http/Controllers/Resources.php b/packages/Sarga/API/Http/Controllers/Resources.php deleted file mode 100644 index a86480d87..000000000 --- a/packages/Sarga/API/Http/Controllers/Resources.php +++ /dev/null @@ -1,19 +0,0 @@ -_config['authorization_required']) && $this->_config['authorization_required'] ? - $this->repository->where(['customer_id'=>auth()->user()->id,'code'=>$code])->first() : - $this->repository->where('code',$code)->first(); - - if($query) - return new $this->_config['resource']($query); - else - return response()->json(['status'=>false,'message'=>'Not found'],404); - } -} \ No newline at end of file diff --git a/packages/Sarga/API/Http/Resources/Core/Channel.php b/packages/Sarga/API/Http/Resources/Core/Channel.php index e8bd2c3b7..51ee54dff 100644 --- a/packages/Sarga/API/Http/Resources/Core/Channel.php +++ b/packages/Sarga/API/Http/Resources/Core/Channel.php @@ -23,7 +23,8 @@ class Channel extends JsonResource 'hostname' => $this->hostname, 'root_category_id' => $this->root_category_id, 'is_maintenance_on' => $this->is_maintenance_on, - 'sliders' => Slider::collection($this->sliders) + 'sliders' => Slider::collection($this->sliders), + 'brand_attribute_id' => 25 //todo vremenno goyuldy. id admindan bazadan settingsden almaly(2 marketplace goshulanda) // 'root_category' => $this->when($this->root_category_id, new CategoryResource($this->root_category)), // 'main_categories' => $this->when(request()->has('channel_id'),Category::collection($this->categories)) diff --git a/packages/Sarga/API/Http/routes.php b/packages/Sarga/API/Http/routes.php index e91effada..005955550 100644 --- a/packages/Sarga/API/Http/routes.php +++ b/packages/Sarga/API/Http/routes.php @@ -2,9 +2,9 @@ use Sarga\API\Http\Controllers\Categories; use Sarga\API\Http\Controllers\Channels; -use Sarga\API\Http\Controllers\Resources; -use Webkul\Attribute\Repositories\AttributeRepository; -use Sarga\API\Http\Resources\Catalog\Attribute; +use Webkul\API\Http\Controllers\Shop\ResourceController; +use Webkul\Attribute\Repositories\AttributeOptionRepository; +use Sarga\API\Http\Resources\Catalog\AttributeOption; Route::group(['prefix' => 'api'], function ($router) { Route::group(['middleware' => ['locale', 'currency']], function ($router) { @@ -16,9 +16,9 @@ Route::group(['prefix' => 'api'], function ($router) { Route::get('category-brands/{id}', [Categories::class, 'brands']); //attributes by code - Route::get('attribute-by-code/{code}', [Resources::class, 'get'])->defaults('_config', [ - 'repository' => AttributeRepository::class, - 'resource' => Attribute::class, + Route::get('attribute-options', [ResourceController::class, 'index'])->defaults('_config', [ + 'repository' => AttributeOptionRepository::class, + 'resource' => AttributeOption::class, ]); }); From 1b49a93bdce87eb6d9bd28eae9a3bccba56ccb61 Mon Sep 17 00:00:00 2001 From: merdan Date: Tue, 2 Nov 2021 16:28:02 +0500 Subject: [PATCH 12/12] categor fields for api changed --- packages/Sarga/API/Http/Resources/Catalog/Category.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/Sarga/API/Http/Resources/Catalog/Category.php b/packages/Sarga/API/Http/Resources/Catalog/Category.php index d8dd69993..88fad7be2 100644 --- a/packages/Sarga/API/Http/Resources/Catalog/Category.php +++ b/packages/Sarga/API/Http/Resources/Catalog/Category.php @@ -19,10 +19,11 @@ class Category extends JsonResource 'id' => $this->id, // 'code' => $this->code, 'name' => $this->name, - 'slug' => $this->slug, +// 'slug' => $this->slug, // 'display_mode' => $this->display_mode, - 'description' => $this->description, +// 'description' => $this->description, // 'status' => $this->status, + 'menu' => $this->visible_in_menu, 'image_url' => $this->image_url, 'category_icon_path' => $this->category_icon_path ? Storage::url($this->category_icon_path)