merged with master
|
|
@ -16,6 +16,7 @@
|
|||
"laravel/framework": "5.6.*",
|
||||
"laravel/tinker": "^1.0",
|
||||
"nwidart/laravel-modules": "^3.2",
|
||||
"prettus/l5-repository": "^2.6",
|
||||
"propaganistas/laravel-intl": "^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
@ -34,7 +35,6 @@
|
|||
"webkul/laravel-attribute": "self.version",
|
||||
"webkul/laravel-customer": "self.version",
|
||||
"webkul/laravel-category": "self.version",
|
||||
"webkul/laravel-channel": "self.version",
|
||||
"webkul/laravel-product": "self.version",
|
||||
"webkul/laravel-shop": "self.version",
|
||||
"webkul/laravel-theme": "self.version"
|
||||
|
|
@ -54,7 +54,6 @@
|
|||
"Webkul\\Shop\\": "packages/Webkul/Shop/src",
|
||||
"Webkul\\Core\\": "packages/Webkul/Core/src",
|
||||
"Webkul\\Customer\\": "packages/Webkul/Customer/src",
|
||||
"Webkul\\Channel\\": "packages/Webkul/Channel/src",
|
||||
"Webkul\\Inventory\\": "packages/Webkul/Inventory/src",
|
||||
"Webkul\\Product\\": "packages/Webkul/Product/src",
|
||||
"Webkul\\Theme\\": "packages/Webkul/Theme/src"
|
||||
|
|
|
|||
|
|
@ -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": "8acd4eec85be1351459a67cfd14d039b",
|
||||
"content-hash": "ee788a0a8a86526cd58b0b4853a45c06",
|
||||
"packages": [
|
||||
{
|
||||
"name": "commerceguys/intl",
|
||||
|
|
@ -1394,6 +1394,109 @@
|
|||
],
|
||||
"time": "2018-07-02T15:55:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "prettus/l5-repository",
|
||||
"version": "2.6.32",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/andersao/l5-repository.git",
|
||||
"reference": "f6ebfffee80a38e1d2dcf479e70b1a9ead397c24"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/andersao/l5-repository/zipball/f6ebfffee80a38e1d2dcf479e70b1a9ead397c24",
|
||||
"reference": "f6ebfffee80a38e1d2dcf479e70b1a9ead397c24",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/config": "~5.0",
|
||||
"illuminate/console": "~5.0",
|
||||
"illuminate/database": "~5.0",
|
||||
"illuminate/filesystem": "~5.0",
|
||||
"illuminate/http": "~5.0",
|
||||
"illuminate/pagination": "~5.0",
|
||||
"illuminate/support": "~5.0",
|
||||
"prettus/laravel-validation": "1.1.*"
|
||||
},
|
||||
"suggest": {
|
||||
"league/fractal": "Required to use the Fractal Presenter (0.12.*).",
|
||||
"prettus/laravel-validation": "Required to provide easy validation with the repository (1.1.*)",
|
||||
"robclancy/presenter": "Required to use the Presenter Model (1.3.*)"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Prettus\\Repository\\Providers\\RepositoryServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Prettus\\Repository\\": "src/Prettus/Repository/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Anderson Andrade",
|
||||
"email": "contato@andersonandra.de",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Laravel 5 - Repositories to the database layer",
|
||||
"keywords": [
|
||||
"cache",
|
||||
"eloquent",
|
||||
"laravel",
|
||||
"model",
|
||||
"repository"
|
||||
],
|
||||
"time": "2018-01-27T15:53:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "prettus/laravel-validation",
|
||||
"version": "1.1.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/andersao/laravel-validator.git",
|
||||
"reference": "d9eb401fb3518a890b117e83bd25a4109fcdb704"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/andersao/laravel-validator/zipball/d9eb401fb3518a890b117e83bd25a4109fcdb704",
|
||||
"reference": "d9eb401fb3518a890b117e83bd25a4109fcdb704",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/support": "~5.4",
|
||||
"illuminate/validation": "~5.4",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Prettus\\Validator\\": "src/Prettus/Validator/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Anderson Andrade",
|
||||
"email": "contato@andersonandra.de"
|
||||
}
|
||||
],
|
||||
"description": "Laravel Validation Service",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"service",
|
||||
"validation"
|
||||
],
|
||||
"time": "2017-08-28T23:28:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "propaganistas/laravel-intl",
|
||||
"version": "2.0.3",
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ return [
|
|||
|
||||
//Laravel Intervention
|
||||
Intervention\Image\ImageServiceProvider::class,
|
||||
Prettus\Repository\Providers\RepositoryServiceProvider::class,
|
||||
|
||||
//Webkul packages
|
||||
Webkul\User\Providers\UserServiceProvider::class,
|
||||
|
|
@ -182,7 +183,6 @@ return [
|
|||
Webkul\Core\Providers\CoreServiceProvider::class,
|
||||
Webkul\Shop\Providers\ShopServiceProvider::class,
|
||||
Webkul\Customer\Providers\CustomerServiceProvider::class,
|
||||
Webkul\Channel\Providers\ChannelServiceProvider::class,
|
||||
Webkul\Inventory\Providers\InventoryServiceProvider::class,
|
||||
Webkul\Product\Providers\ProductServiceProvider::class,
|
||||
Webkul\Shop\Providers\ShopServiceProvider::class,
|
||||
|
|
@ -237,6 +237,7 @@ return [
|
|||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
'Datagrid' => Webkul\Ui\DataGrid\Facades\DataGrid::class,
|
||||
'ProductGrid' => Webkul\Ui\DataGrid\Facades\ProductGrid::class,
|
||||
'Image' => Intervention\Image\Facades\Image::class
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
/node_modules
|
||||
/package-lock.json
|
||||
/package-lock.json
|
||||
npm-debug.log
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
|
||||
/**
|
||||
* Attributes DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class AttributeDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
*
|
||||
* @var AttributeDataGrid
|
||||
* for countries
|
||||
*/
|
||||
|
||||
public function createAttributeDataGrid()
|
||||
{
|
||||
|
||||
return DataGrid::make([
|
||||
'name' => 'Attributes',
|
||||
'table' => 'attributes',
|
||||
'select' => 'id',
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
[
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'method' => 'DELETE',
|
||||
'label' => 'Delete',
|
||||
'type' => 'button',
|
||||
],
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'confirm_text' => 'Do you really want to do this?',
|
||||
'icon' => 'icon pencil-lg-icon',
|
||||
], [
|
||||
'type' => 'Delete',
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'confirm_text' => 'Do you really want to do this?',
|
||||
'icon' => 'icon trash-icon',
|
||||
],
|
||||
],
|
||||
|
||||
'join' => [
|
||||
// [
|
||||
// 'join' => 'leftjoin',
|
||||
// 'table' => 'roles as r',
|
||||
// 'primaryKey' => 'u.role_id',
|
||||
// 'condition' => '=',
|
||||
// 'secondaryKey' => 'r.id',
|
||||
// ]
|
||||
],
|
||||
|
||||
//use aliasing on secodary columns if join is performed
|
||||
|
||||
'columns' => [
|
||||
|
||||
[
|
||||
'name' => 'id',
|
||||
'alias' => 'attributeId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'code',
|
||||
'alias' => 'attributeCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'admin_name',
|
||||
'alias' => 'attributeAdminName',
|
||||
'type' => 'string',
|
||||
'label' => 'AdminName',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'type',
|
||||
'alias' => 'attributeType',
|
||||
'type' => 'string',
|
||||
'label' => 'Type',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'is_required',
|
||||
'alias' => 'attributeIsRequired',
|
||||
'type' => 'string',
|
||||
'label' => 'Required',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'is_unique',
|
||||
'alias' => 'attributeIsUnique',
|
||||
'type' => 'string',
|
||||
'label' => 'Unique',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'value_per_locale',
|
||||
'alias' => 'attributeValuePerLocale',
|
||||
'type' => 'string',
|
||||
'label' => 'ValuePerLocale',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'value_per_channel',
|
||||
'alias' => 'attributeValuePerChannel',
|
||||
'type' => 'string',
|
||||
'label' => 'ValuePerChannel',
|
||||
'sortable' => true,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filterable' => [
|
||||
// [
|
||||
// 'column' => 'id',
|
||||
// 'alias' => 'attribute_family_id',
|
||||
// 'type' => 'number',
|
||||
// 'label' => 'ID',
|
||||
// ],
|
||||
// [
|
||||
// 'column' => 'code',
|
||||
// 'alias' => 'attribute_family_code',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Code',
|
||||
// ],
|
||||
// [
|
||||
// 'column' => 'name',
|
||||
// 'alias' => 'attribute_family_name',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Name',
|
||||
// ],
|
||||
],
|
||||
|
||||
//don't use aliasing in case of searchables
|
||||
|
||||
'searchable' => [
|
||||
// [
|
||||
// 'column' => 'name',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Name',
|
||||
// ],
|
||||
// [
|
||||
// 'column' => 'code',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Code',
|
||||
// ],
|
||||
],
|
||||
|
||||
//list of viable operators that will be used
|
||||
'operators' => [
|
||||
'eq' => "=",
|
||||
'lt' => "<",
|
||||
'gt' => ">",
|
||||
'lte' => "<=",
|
||||
'gte' => ">=",
|
||||
'neqs' => "<>",
|
||||
'neqn' => "!=",
|
||||
'like' => "like",
|
||||
'nlike' => "not like",
|
||||
],
|
||||
// 'css' => []
|
||||
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
|
||||
return $this->createAttributeDataGrid()->render();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
|
||||
/**
|
||||
* Attributes Family DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class AttributeFamilyDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
*
|
||||
* @var CountryComposer
|
||||
* for countries
|
||||
*/
|
||||
|
||||
public function createAttributeFamilyDataGrid()
|
||||
{
|
||||
|
||||
return DataGrid::make([
|
||||
'name' => 'Attribute Family',
|
||||
'table' => 'attribute_families',
|
||||
'select' => 'id',
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
[
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'method' => 'DELETE',
|
||||
'label' => 'Delete',
|
||||
'type' => 'button',
|
||||
],
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'confirm_text' => 'Do you really want to do this?',
|
||||
'icon' => 'icon pencil-lg-icon',
|
||||
], [
|
||||
'type' => 'Delete',
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'confirm_text' => 'Do you really want to do this?',
|
||||
'icon' => 'icon trash-icon',
|
||||
],
|
||||
],
|
||||
|
||||
'join' => [
|
||||
// [
|
||||
// 'join' => 'leftjoin',
|
||||
// 'table' => 'roles as r',
|
||||
// 'primaryKey' => 'u.role_id',
|
||||
// 'condition' => '=',
|
||||
// 'secondaryKey' => 'r.id',
|
||||
// ]
|
||||
],
|
||||
|
||||
//use aliasing on secodary columns if join is performed
|
||||
|
||||
'columns' => [
|
||||
|
||||
[
|
||||
'name' => 'id',
|
||||
'alias' => 'attributeFamilyId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'code',
|
||||
'alias' => 'attributeFamilyCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'name',
|
||||
'alias' => 'attributeFamilyName',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
'sortable' => true,
|
||||
],
|
||||
],
|
||||
|
||||
'filterable' => [
|
||||
[
|
||||
'column' => 'id',
|
||||
'alias' => 'attributeFamilyId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
],
|
||||
[
|
||||
'column' => 'code',
|
||||
'alias' => 'attributeFamilyCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
],
|
||||
[
|
||||
'column' => 'name',
|
||||
'alias' => 'attributeFamilyName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
],
|
||||
],
|
||||
|
||||
//don't use aliasing in case of searchables
|
||||
|
||||
'searchable' => [
|
||||
[
|
||||
'column' => 'name',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
],
|
||||
[
|
||||
'column' => 'code',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
],
|
||||
],
|
||||
|
||||
//list of viable operators that will be used
|
||||
'operators' => [
|
||||
'eq' => "=",
|
||||
'lt' => "<",
|
||||
'gt' => ">",
|
||||
'lte' => "<=",
|
||||
'gte' => ">=",
|
||||
'neqs' => "<>",
|
||||
'neqn' => "!=",
|
||||
'like' => "like",
|
||||
'nlike' => "not like",
|
||||
],
|
||||
// 'css' => []
|
||||
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
|
||||
return $this->createAttributeFamilyDataGrid()->render();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
|
||||
/**
|
||||
* Category DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class CategoryDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
*
|
||||
* @var AttributeDataGrid
|
||||
* for countries
|
||||
*/
|
||||
|
||||
public function createCategoryDataGrid()
|
||||
{
|
||||
|
||||
return DataGrid::make([
|
||||
'name' => 'Categories',
|
||||
'table' => 'categories as cat',
|
||||
'select' => 'cat.id',
|
||||
'perpage' => 10,
|
||||
'aliased' => true, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
[
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'method' => 'DELETE',
|
||||
'label' => 'Delete',
|
||||
'type' => 'button',
|
||||
],
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'confirm_text' => 'Do you really want to do this?',
|
||||
'icon' => 'icon pencil-lg-icon',
|
||||
], [
|
||||
'type' => 'Delete',
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'confirm_text' => 'Do you really want to do this?',
|
||||
'icon' => 'icon trash-icon',
|
||||
],
|
||||
],
|
||||
|
||||
'join' => [
|
||||
[
|
||||
'join' => 'leftjoin',
|
||||
'table' => 'category_translations as ct',
|
||||
'primaryKey' => 'cat.id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'ct.category_id',
|
||||
], [
|
||||
'join' => 'leftjoin',
|
||||
'table' => 'category_translations as cta',
|
||||
'primaryKey' => 'cat.parent_id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'cta.category_id',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
//use aliasing on secodary columns if join is performed
|
||||
|
||||
'columns' => [
|
||||
[
|
||||
'name' => 'cat.id',
|
||||
'alias' => 'catID',
|
||||
'type' => 'number',
|
||||
'label' => 'Category ID',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'ct.name',
|
||||
'alias' => 'catName',
|
||||
'type' => 'string',
|
||||
'label' => 'Category Name',
|
||||
'sortable' => false,
|
||||
], [
|
||||
'name' => 'cat.position',
|
||||
'alias' => 'catPosition',
|
||||
'type' => 'string',
|
||||
'label' => 'Category Position',
|
||||
'sortable' => false,
|
||||
], [
|
||||
'name' => 'cta.name',
|
||||
'alias' => 'parentName',
|
||||
'type' => 'string',
|
||||
'label' => 'Parent Name',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'cat.status',
|
||||
'alias' => 'catStatus',
|
||||
'type' => 'string',
|
||||
'label' => 'Visible in Menu',
|
||||
'sortable' => true,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
'filterable' => [
|
||||
// [
|
||||
// 'column' => 'id',
|
||||
// 'alias' => 'attribute_family_id',
|
||||
// 'type' => 'number',
|
||||
// 'label' => 'ID',
|
||||
// ],
|
||||
// [
|
||||
// 'column' => 'code',
|
||||
// 'alias' => 'attribute_family_code',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Code',
|
||||
// ],
|
||||
// [
|
||||
// 'column' => 'name',
|
||||
// 'alias' => 'attribute_family_name',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Name',
|
||||
// ],
|
||||
],
|
||||
|
||||
//don't use aliasing in case of searchables
|
||||
|
||||
'searchable' => [
|
||||
// [
|
||||
// 'column' => 'name',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Name',
|
||||
// ],
|
||||
// [
|
||||
// 'column' => 'code',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Code',
|
||||
// ],
|
||||
],
|
||||
|
||||
//list of viable operators that will be used
|
||||
'operators' => [
|
||||
'eq' => "=",
|
||||
'lt' => "<",
|
||||
'gt' => ">",
|
||||
'lte' => "<=",
|
||||
'gte' => ">=",
|
||||
'neqs' => "<>",
|
||||
'neqn' => "!=",
|
||||
'like' => "like",
|
||||
'nlike' => "not like",
|
||||
],
|
||||
// 'css' => []
|
||||
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
|
||||
return $this->createCategoryDataGrid()->render();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\Http\ViewComposers\DataGrids;
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
// use App\Repositories\UserRepository;
|
||||
|
||||
class ChannelsComposer
|
||||
/**
|
||||
* Channels DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class ChannelDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
|
|
@ -16,17 +22,10 @@ class ChannelsComposer
|
|||
* for countries
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
public function createChannelsDataGrid()
|
||||
{
|
||||
|
||||
$datagrid = DataGrid::make([
|
||||
return DataGrid::make([
|
||||
'name' => 'Channels',
|
||||
'table' => 'channels',
|
||||
'select' => 'id',
|
||||
|
|
@ -99,19 +98,19 @@ class ChannelsComposer
|
|||
'filterable' => [
|
||||
[
|
||||
'column' => 'id',
|
||||
'alias' => 'channel_id',
|
||||
'alias' => 'channelId',
|
||||
'type' => 'number',
|
||||
'label' => 'Channel ID',
|
||||
],
|
||||
[
|
||||
'column' => 'code',
|
||||
'alias' => 'channel_code',
|
||||
'alias' => 'channelCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Channel Code',
|
||||
],
|
||||
[
|
||||
'column' => 'name',
|
||||
'alias' => 'channel_name',
|
||||
'alias' => 'channelName',
|
||||
'type' => 'string',
|
||||
'label' => 'Channel Name',
|
||||
],
|
||||
|
|
@ -148,7 +147,10 @@ class ChannelsComposer
|
|||
|
||||
]);
|
||||
|
||||
$view->with('datagrid', $datagrid);
|
||||
// $view->with('count', $this->users->count());
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->createChannelsDataGrid()->render();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\Http\ViewComposers\DataGrids;
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
// use App\Repositories\UserRepository;
|
||||
|
||||
class CountryComposer
|
||||
/**
|
||||
* Countries DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class CountryDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
|
|
@ -16,17 +22,10 @@ class CountryComposer
|
|||
* for countries
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
public function createCountryDataGrid()
|
||||
{
|
||||
|
||||
$datagrid = DataGrid::make([
|
||||
return DataGrid::make([
|
||||
'name' => 'Countries',
|
||||
'table' => 'countries',
|
||||
'select' => 'id',
|
||||
|
|
@ -72,28 +71,28 @@ class CountryComposer
|
|||
|
||||
[
|
||||
'name' => 'id',
|
||||
'alias' => 'country_id',
|
||||
'alias' => 'countryId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'code',
|
||||
'alias' => 'country_code',
|
||||
'alias' => 'countryCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'name',
|
||||
'alias' => 'country_name',
|
||||
'alias' => 'countryName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'status',
|
||||
'alias' => 'country_status',
|
||||
'alias' => 'countryStatus',
|
||||
'type' => 'number',
|
||||
'label' => 'Code',
|
||||
'sortable' => true,
|
||||
|
|
@ -106,25 +105,25 @@ class CountryComposer
|
|||
'filterable' => [
|
||||
[
|
||||
'column' => 'id',
|
||||
'alias' => 'country_id',
|
||||
'alias' => 'countryId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
],
|
||||
[
|
||||
'column' => 'code',
|
||||
'alias' => 'country_code',
|
||||
'alias' => 'countryCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
],
|
||||
[
|
||||
'column' => 'name',
|
||||
'alias' => 'country_name',
|
||||
'alias' => 'countryName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
],
|
||||
[
|
||||
'column' => 'status',
|
||||
'alias' => 'country_status',
|
||||
'alias' => 'countryStatus',
|
||||
'type' => 'number',
|
||||
'label' => 'Code',
|
||||
],
|
||||
|
|
@ -161,7 +160,12 @@ class CountryComposer
|
|||
|
||||
]);
|
||||
|
||||
$view->with('datagrid', $datagrid);
|
||||
// $view->with('count', $this->users->count());
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
|
||||
return $this->createCountryDataGrid()->render();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\Http\ViewComposers\DataGrids;
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
// use App\Repositories\UserRepository;
|
||||
/**
|
||||
* Currencies DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class CurrenciesComposer
|
||||
class CurrencyDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
*
|
||||
* @var CountryComposer
|
||||
* @var CurrenciesDataGrid
|
||||
* for countries
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
public function createCurrencyDataGrid()
|
||||
{
|
||||
|
||||
$datagrid = DataGrid::make([
|
||||
return DataGrid::make([
|
||||
'name' => 'Currencies',
|
||||
'table' => 'currencies',
|
||||
'select' => 'id',
|
||||
|
|
@ -72,21 +70,21 @@ class CurrenciesComposer
|
|||
|
||||
[
|
||||
'name' => 'id',
|
||||
'alias' => 'currency_id',
|
||||
'alias' => 'currencyId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'code',
|
||||
'alias' => 'currency_code',
|
||||
'alias' => 'currencyCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'name',
|
||||
'alias' => 'currency_name',
|
||||
'alias' => 'currencyName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
'sortable' => true,
|
||||
|
|
@ -99,19 +97,19 @@ class CurrenciesComposer
|
|||
'filterable' => [
|
||||
[
|
||||
'column' => 'id',
|
||||
'alias' => 'currency_id',
|
||||
'alias' => 'currencyId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
],
|
||||
[
|
||||
'column' => 'code',
|
||||
'alias' => 'currency_code',
|
||||
'alias' => 'currencyCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
],
|
||||
[
|
||||
'column' => 'name',
|
||||
'alias' => 'currency_name',
|
||||
'alias' => 'currencyName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
],
|
||||
|
|
@ -148,7 +146,10 @@ class CurrenciesComposer
|
|||
|
||||
]);
|
||||
|
||||
$view->with('datagrid', $datagrid);
|
||||
// $view->with('count', $this->users->count());
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->createCurrencyDataGrid()->render();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\Http\ViewComposers\DataGrids;
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
// use App\Repositories\UserRepository;
|
||||
/**
|
||||
* Exchange Rates DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class ExchangeRatesComposer
|
||||
class ExchangeRatesDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
*
|
||||
* @var CountryComposer
|
||||
* for countries
|
||||
* @var ExchangeRatesDataGrid
|
||||
* for Exchange Rates
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
public function createExchangeRatesDataGrid()
|
||||
{
|
||||
|
||||
$datagrid = DataGrid::make([
|
||||
return DataGrid::make([
|
||||
'name' => 'Exchange Rates',
|
||||
'table' => 'currency_exchange_rates',
|
||||
'select' => 'id',
|
||||
|
|
@ -72,28 +71,28 @@ class ExchangeRatesComposer
|
|||
|
||||
[
|
||||
'name' => 'id',
|
||||
'alias' => 'exch_id',
|
||||
'alias' => 'exchID',
|
||||
'type' => 'number',
|
||||
'label' => 'Rate ID',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'source_currency',
|
||||
'alias' => 'exch_source_currency',
|
||||
'alias' => 'exchSourceCurrency',
|
||||
'type' => 'string',
|
||||
'label' => 'Source Currency',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'target_currency',
|
||||
'alias' => 'exch_target_currency',
|
||||
'alias' => 'exchTargetCurrency',
|
||||
'type' => 'string',
|
||||
'label' => 'Target Currency',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'ratio',
|
||||
'alias' => 'exch_ratio',
|
||||
'alias' => 'exchRatio',
|
||||
'type' => 'string',
|
||||
'label' => 'Exchange Ratio',
|
||||
],
|
||||
|
|
@ -105,20 +104,20 @@ class ExchangeRatesComposer
|
|||
'filterable' => [
|
||||
[
|
||||
'column' => 'id',
|
||||
'alias' => 'exch_id',
|
||||
'alias' => 'exchId',
|
||||
'type' => 'number',
|
||||
'label' => 'Rate ID',
|
||||
],
|
||||
[
|
||||
'column' => 'source_currency',
|
||||
'alias' => 'exch_source_currency',
|
||||
'alias' => 'exchSourceCurrency',
|
||||
'type' => 'string',
|
||||
'label' => 'Source Currency',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'column' => 'target_currency',
|
||||
'alias' => 'exch_target_currency',
|
||||
'alias' => 'exchTargetCurrency',
|
||||
'type' => 'string',
|
||||
'label' => 'Target Currency',
|
||||
'sortable' => true,
|
||||
|
|
@ -156,7 +155,10 @@ class ExchangeRatesComposer
|
|||
|
||||
]);
|
||||
|
||||
$view->with('datagrid', $datagrid);
|
||||
// $view->with('count', $this->users->count());
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->createExchangeRatesDataGrid()->render();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\Http\ViewComposers\DataGrids;
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
// use App\Repositories\UserRepository;
|
||||
/**
|
||||
* Inventory Sources DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class InventorySourcesComposer
|
||||
class InventorySourcesDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
*
|
||||
* @var CountryComposer
|
||||
* for countries
|
||||
* @var InventorySourcesDataGrid
|
||||
* for Inventory Sources
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
public function createInventorySourcesDataGrid()
|
||||
{
|
||||
|
||||
$datagrid = DataGrid::make([
|
||||
return DataGrid::make([
|
||||
'name' => 'Inventory Sources',
|
||||
'table' => 'inventory_sources',
|
||||
'select' => 'id',
|
||||
|
|
@ -72,35 +69,35 @@ class InventorySourcesComposer
|
|||
|
||||
[
|
||||
'name' => 'id',
|
||||
'alias' => 'inventory_id',
|
||||
'alias' => 'inventoryID',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'code',
|
||||
'alias' => 'inventory_code',
|
||||
'alias' => 'inventoryCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'name',
|
||||
'alias' => 'inventory_name',
|
||||
'alias' => 'inventoryName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'priority',
|
||||
'alias' => 'inventory_priority',
|
||||
'alias' => 'inventoryPriority',
|
||||
'type' => 'string',
|
||||
'label' => 'Priority',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'status',
|
||||
'alias' => 'inventory_status',
|
||||
'alias' => 'inventoryStatus',
|
||||
'type' => 'string',
|
||||
'label' => 'Status',
|
||||
'sortable' => true,
|
||||
|
|
@ -113,19 +110,19 @@ class InventorySourcesComposer
|
|||
'filterable' => [
|
||||
[
|
||||
'column' => 'id',
|
||||
'alias' => 'inventory_id',
|
||||
'alias' => 'inventoryId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
],
|
||||
[
|
||||
'column' => 'code',
|
||||
'alias' => 'inventory_code',
|
||||
'alias' => 'inventoryCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
],
|
||||
[
|
||||
'column' => 'name',
|
||||
'alias' => 'inventory_name',
|
||||
'alias' => 'inventoryName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
],
|
||||
|
|
@ -161,7 +158,10 @@ class InventorySourcesComposer
|
|||
// 'css' => []
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
$view->with('datagrid', $datagrid);
|
||||
public function render()
|
||||
{
|
||||
return $this->createInventorySourcesDataGrid()->render();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\Http\ViewComposers\DataGrids;
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
// use App\Repositories\UserRepository;
|
||||
/**
|
||||
* Locales DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class LocalesComposer
|
||||
class LocalesDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
*
|
||||
* @var CountryComposer
|
||||
* @var CountryDataGrid
|
||||
* for countries
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
public function createCountryDataGrid()
|
||||
{
|
||||
|
||||
$datagrid = DataGrid::make([
|
||||
return DataGrid::make([
|
||||
'name' => 'Locales',
|
||||
'table' => 'locales',
|
||||
'select' => 'id',
|
||||
|
|
@ -72,21 +70,21 @@ class LocalesComposer
|
|||
|
||||
[
|
||||
'name' => 'id',
|
||||
'alias' => 'locale_id',
|
||||
'alias' => 'localeId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'code',
|
||||
'alias' => 'locale_code',
|
||||
'alias' => 'localeCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'name',
|
||||
'alias' => 'locale_name',
|
||||
'alias' => 'localeName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
'sortable' => true,
|
||||
|
|
@ -99,19 +97,19 @@ class LocalesComposer
|
|||
'filterable' => [
|
||||
[
|
||||
'column' => 'id',
|
||||
'alias' => 'locale_id',
|
||||
'alias' => 'localeId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
],
|
||||
[
|
||||
'column' => 'code',
|
||||
'alias' => 'locale_code',
|
||||
'alias' => 'localeCode',
|
||||
'type' => 'string',
|
||||
'label' => 'Code',
|
||||
],
|
||||
[
|
||||
'column' => 'name',
|
||||
'alias' => 'locale_name',
|
||||
'alias' => 'localeName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
],
|
||||
|
|
@ -148,7 +146,10 @@ class LocalesComposer
|
|||
|
||||
]);
|
||||
|
||||
$view->with('datagrid', $datagrid);
|
||||
// $view->with('count', $this->users->count());
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->createCountryDataGrid()->render();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,215 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\ProductGrid;
|
||||
use Webkul\Channel\Repositories\ChannelRepository;
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
|
||||
/**
|
||||
* Product DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class ProductDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
* @var ProductDataGrid
|
||||
* for Products
|
||||
*/
|
||||
|
||||
public function createProductDataGrid()
|
||||
{
|
||||
|
||||
return ProductGrid::make([
|
||||
'name' => 'Products',
|
||||
'table' => 'products as prods',
|
||||
'select' => 'prods.id',
|
||||
'perpage' => 10,
|
||||
'aliased' => true, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Edit',
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'confirm_text' => 'Do you really want to do this?',
|
||||
'icon' => 'icon pencil-lg-icon',
|
||||
], [
|
||||
'type' => 'Delete',
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'confirm_text' => 'Do you really want to do this?',
|
||||
'icon' => 'icon trash-icon',
|
||||
],
|
||||
],
|
||||
|
||||
'attributeColumns' => [
|
||||
'name', 'price'
|
||||
],
|
||||
|
||||
'join' => [
|
||||
|
||||
//for getting name of attrib family.
|
||||
[
|
||||
'join' => 'leftjoin',
|
||||
'table' => 'attribute_families as attfam',
|
||||
'primaryKey' => 'prods.attribute_family_id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'attfam.id',
|
||||
],
|
||||
|
||||
//for getting the attribute values.
|
||||
[
|
||||
'join' => 'leftjoin',
|
||||
'table' => 'product_attribute_values as pav',
|
||||
'primaryKey' => 'prods.id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'pav.product_id',
|
||||
'withAttributes' => true
|
||||
],
|
||||
|
||||
//for getting the inventory quantity of a product
|
||||
[
|
||||
'join' => 'leftjoin',
|
||||
'table' => 'product_inventories as pi',
|
||||
'primaryKey' => 'prods.id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'pi.product_id',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
//use aliasing on secodary columns if join is performed
|
||||
|
||||
'columns' => [
|
||||
//name, alias, type, label, sortable
|
||||
[
|
||||
'name' => 'prods.id',
|
||||
'alias' => 'productID',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'prods.sku',
|
||||
'alias' => 'productCode',
|
||||
'type' => 'string',
|
||||
'label' => 'SKU',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'attfam.name',
|
||||
'alias' => 'FamilyName',
|
||||
'type' => 'string',
|
||||
'label' => 'Family Name',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'pi.qty',
|
||||
'alias' => 'ProductQuantity',
|
||||
'type' => 'string',
|
||||
'label' => 'Product Quatity',
|
||||
'sortable' => false,
|
||||
],
|
||||
// [
|
||||
// 'name' => 'pav.attribute_id',
|
||||
// 'alias' => 'AttributeID',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Attribute ID',
|
||||
// 'sortable' => false,
|
||||
|
||||
// ],
|
||||
],
|
||||
|
||||
'filterable' => [
|
||||
//column, type, and label
|
||||
[
|
||||
'name' => 'prods.id',
|
||||
'alias' => 'productID',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
],
|
||||
[
|
||||
'name' => 'prods.sku',
|
||||
'alias' => 'productCode',
|
||||
'type' => 'string',
|
||||
'label' => 'SKU',
|
||||
],
|
||||
[
|
||||
'name' => 'attfam.name',
|
||||
'alias' => 'FamilyName',
|
||||
'type' => 'string',
|
||||
'label' => 'Family Name',
|
||||
],
|
||||
[
|
||||
'name' => 'pi.qty',
|
||||
'alias' => 'ProductQuantity',
|
||||
'type' => 'string',
|
||||
'label' => 'Product Quatity',
|
||||
],
|
||||
],
|
||||
|
||||
//don't use aliasing in case of searchables
|
||||
|
||||
'searchable' => [
|
||||
//column, type and label
|
||||
[
|
||||
'column' => 'prods.id',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
],
|
||||
[
|
||||
'column' => 'prods.sku',
|
||||
'type' => 'string',
|
||||
'label' => 'SKU',
|
||||
],
|
||||
[
|
||||
'column' => 'attfam.name',
|
||||
'type' => 'string',
|
||||
'label' => 'Family Name',
|
||||
],
|
||||
[
|
||||
'column' => 'pi.qty',
|
||||
'type' => 'string',
|
||||
'label' => 'Product Quatity',
|
||||
],
|
||||
],
|
||||
|
||||
//list of viable operators that will be used
|
||||
'operators' => [
|
||||
'eq' => "=",
|
||||
'lt' => "<",
|
||||
'gt' => ">",
|
||||
'lte' => "<=",
|
||||
'gte' => ">=",
|
||||
'neqs' => "<>",
|
||||
'neqn' => "!=",
|
||||
'like' => "like",
|
||||
'nlike' => "not like",
|
||||
],
|
||||
// 'css' => []
|
||||
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->createProductDataGrid()->render();
|
||||
// return $this->getProducts();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,32 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\Http\ViewComposers\DataGrids;
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
// use App\Repositories\UserRepository;
|
||||
/**
|
||||
* User Roles DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class RolesComposer
|
||||
class RolesDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
*
|
||||
* @var CountryComposer
|
||||
* for countries
|
||||
* @var RolesDataGrid
|
||||
* for Roles
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
public function createRolesDataGrid()
|
||||
{
|
||||
|
||||
$datagrid = DataGrid::make([
|
||||
return DataGrid::make([
|
||||
'name' => 'Roles',
|
||||
'table' => 'roles',
|
||||
'select' => 'id',
|
||||
|
|
@ -72,21 +71,21 @@ class RolesComposer
|
|||
|
||||
[
|
||||
'name' => 'id',
|
||||
'alias' => 'r_id',
|
||||
'alias' => 'roleId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'name',
|
||||
'alias' => 'r_name',
|
||||
'alias' => 'roleName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'permission_type',
|
||||
'alias' => 'r_permission_type',
|
||||
'alias' => 'rolePermissionType',
|
||||
'type' => 'string',
|
||||
'label' => 'Permission Type',
|
||||
'sortable' => true,
|
||||
|
|
@ -99,19 +98,19 @@ class RolesComposer
|
|||
'filterable' => [
|
||||
[
|
||||
'column' => 'id',
|
||||
'alias' => 'r_id',
|
||||
'alias' => 'roleId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
],
|
||||
[
|
||||
'column' => 'name',
|
||||
'alias' => 'r_name',
|
||||
'alias' => 'roleName',
|
||||
'type' => 'string',
|
||||
'label' => 'Name',
|
||||
],
|
||||
[
|
||||
'column' => 'permission_type',
|
||||
'alias' => 'r_permission_type',
|
||||
'alias' => 'rolePermissionType',
|
||||
'type' => 'string',
|
||||
'label' => 'Permission Type',
|
||||
],
|
||||
|
|
@ -148,7 +147,10 @@ class RolesComposer
|
|||
|
||||
]);
|
||||
|
||||
$view->with('datagrid', $datagrid);
|
||||
// $view->with('count', $this->users->count());
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->createRolesDataGrid()->render();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\Http\ViewComposers\DataGrids;
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
// use App\Repositories\UserRepository;
|
||||
/**
|
||||
* Sliders DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class SliderComposer
|
||||
class SliderDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
*
|
||||
* @var CountryComposer
|
||||
* for countries
|
||||
* @var SliderDataGrid
|
||||
* for Sliders
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
public function createSliderDataGrid()
|
||||
{
|
||||
|
||||
$datagrid = DataGrid::make([
|
||||
return DataGrid::make([
|
||||
'name' => 'Sliders',
|
||||
'table' => 'sliders as s',
|
||||
'select' => 's.id',
|
||||
|
|
@ -72,27 +70,27 @@ class SliderComposer
|
|||
|
||||
[
|
||||
'name' => 's.id',
|
||||
'alias' => 'slider_id',
|
||||
'alias' => 'sliderId',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 's.title',
|
||||
'alias' => 'slider_title',
|
||||
'alias' => 'sliderTitle',
|
||||
'type' => 'string',
|
||||
'label' => 'title',
|
||||
],
|
||||
[
|
||||
'name' => 's.channel_id',
|
||||
'alias' => 'channel_id',
|
||||
'alias' => 'channelId',
|
||||
'type' => 'string',
|
||||
'label' => 'Channel ID',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'c.name',
|
||||
'alias' => 'channel_name',
|
||||
'alias' => 'channelName',
|
||||
'type' => 'string',
|
||||
'label' => 'Channel Name',
|
||||
'sortable' => true,
|
||||
|
|
@ -153,7 +151,10 @@ class SliderComposer
|
|||
|
||||
]);
|
||||
|
||||
$view->with('datagrid', $datagrid);
|
||||
// $view->with('count', $this->users->count());
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->createSliderDataGrid()->render();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\Http\ViewComposers\DataGrids;
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
// use App\Repositories\UserRepository;
|
||||
/**
|
||||
* Users DataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class UserComposer
|
||||
class UserDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
*
|
||||
* @var UserComposer
|
||||
* for admin
|
||||
* @var UserDataGrid
|
||||
* for admin users
|
||||
*/
|
||||
protected $users;
|
||||
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
public function createUserDataGrid()
|
||||
{
|
||||
|
||||
$datagrid = DataGrid::make([
|
||||
return DataGrid::make([
|
||||
'name' => 'Admins',
|
||||
'table' => 'admins as u',
|
||||
'select' => 'u.id',
|
||||
|
|
@ -59,7 +56,8 @@ class UserComposer
|
|||
'route' => route('admin.datagrid.delete'),
|
||||
'confirm_text' => 'Do you really want to do this?',
|
||||
'icon' => 'icon pencil-lg-icon',
|
||||
], [
|
||||
],
|
||||
[
|
||||
'type' => 'Delete',
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'confirm_text' => 'Do you really want to do this?',
|
||||
|
|
@ -148,14 +146,16 @@ class UserComposer
|
|||
'alias' => 'Name',
|
||||
'type' => 'string',
|
||||
'label' => 'Name'
|
||||
], [
|
||||
],
|
||||
[
|
||||
'column' => 'u.id',
|
||||
'alias' => 'ID',
|
||||
'type' => 'number',
|
||||
'label' => 'Admin ID'
|
||||
], [
|
||||
],
|
||||
[
|
||||
'column' => 'r.id',
|
||||
'alias' => 'Role_ID',
|
||||
'alias' => 'xc',
|
||||
'type' => 'number',
|
||||
'label' => 'Role ID'
|
||||
]
|
||||
|
|
@ -166,7 +166,8 @@ class UserComposer
|
|||
'column' => 'u.email',
|
||||
'type' => 'string',
|
||||
'label' => 'E-Mail'
|
||||
], [
|
||||
],
|
||||
[
|
||||
'column' => 'u.name',
|
||||
'type' => 'string',
|
||||
'label' => 'Name'
|
||||
|
|
@ -187,7 +188,11 @@ class UserComposer
|
|||
|
||||
]);
|
||||
|
||||
$view->with('datagrid', $datagrid);
|
||||
// $view->with('count', $this->users->count());
|
||||
}
|
||||
|
||||
public function render() {
|
||||
|
||||
return $this->createUserDataGrid()->render();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -271,23 +271,23 @@ Route::group(['middleware' => ['web']], function () {
|
|||
|
||||
|
||||
// Channel Routes
|
||||
Route::get('/channels', 'Webkul\Channel\Http\Controllers\ChannelController@index')->defaults('_config', [
|
||||
Route::get('/channels', 'Webkul\Core\Http\Controllers\ChannelController@index')->defaults('_config', [
|
||||
'view' => 'admin::settings.channels.index'
|
||||
])->name('admin.channels.index');
|
||||
|
||||
Route::get('/channels/create', 'Webkul\Channel\Http\Controllers\ChannelController@create')->defaults('_config', [
|
||||
Route::get('/channels/create', 'Webkul\Core\Http\Controllers\ChannelController@create')->defaults('_config', [
|
||||
'view' => 'admin::settings.channels.create'
|
||||
])->name('admin.channels.create');
|
||||
|
||||
Route::post('/channels/create', 'Webkul\Channel\Http\Controllers\ChannelController@store')->defaults('_config', [
|
||||
Route::post('/channels/create', 'Webkul\Core\Http\Controllers\ChannelController@store')->defaults('_config', [
|
||||
'redirect' => 'admin.channels.index'
|
||||
])->name('admin.channels.store');
|
||||
|
||||
Route::get('/channels/edit/{id}', 'Webkul\Channel\Http\Controllers\ChannelController@edit')->defaults('_config', [
|
||||
Route::get('/channels/edit/{id}', 'Webkul\Core\Http\Controllers\ChannelController@edit')->defaults('_config', [
|
||||
'view' => 'admin::settings.channels.edit'
|
||||
])->name('admin.channels.edit');
|
||||
|
||||
Route::put('/channels/edit/{id}', 'Webkul\Channel\Http\Controllers\ChannelController@update')->defaults('_config', [
|
||||
Route::put('/channels/edit/{id}', 'Webkul\Core\Http\Controllers\ChannelController@update')->defaults('_config', [
|
||||
'redirect' => 'admin.channels.index'
|
||||
])->name('admin.channels.update');
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ use Illuminate\Support\ServiceProvider;
|
|||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Webkul\Admin\Providers\EventServiceProvider;
|
||||
use Webkul\Admin\Providers\ComposerServiceProvider;
|
||||
|
||||
class AdminServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -30,7 +29,6 @@ class AdminServiceProvider extends ServiceProvider
|
|||
$this->composeView();
|
||||
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
$this->app->register(ComposerServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use View;
|
||||
|
||||
class ComposerServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register bindings in the container.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
|
||||
//for the users in the countries dashboard
|
||||
View::composer('admin::settings.countries.index', 'Webkul\Admin\Http\ViewComposers\DataGrids\CountryComposer');
|
||||
|
||||
//for the users in the admin dashboard
|
||||
View::composer('admin::users.users.index', 'Webkul\Admin\Http\ViewComposers\DataGrids\UserComposer');
|
||||
|
||||
//for the users in the admin dashboard
|
||||
View::composer('admin::users.roles.index', 'Webkul\Admin\Http\ViewComposers\DataGrids\RolesComposer');
|
||||
|
||||
//for the locales in admin dashboard
|
||||
View::composer('admin::settings.locales.index', 'Webkul\Admin\Http\ViewComposers\DataGrids\LocalesComposer');
|
||||
|
||||
//for the currencies in admin dashboard
|
||||
View::composer('admin::settings.currencies.index', 'Webkul\Admin\Http\ViewComposers\DataGrids\CurrenciesComposer');
|
||||
|
||||
//for the Exchange Rates in admin dashboard
|
||||
View::composer('admin::settings.exchange_rates.index', 'Webkul\Admin\Http\ViewComposers\DataGrids\ExchangeRatesComposer');
|
||||
|
||||
//for inventory sources in admin dashboard
|
||||
View::composer('admin::settings.inventory_sources.index', 'Webkul\Admin\Http\ViewComposers\DataGrids\InventorySourcesComposer');
|
||||
|
||||
//for channels in admin dashboard
|
||||
View::composer('admin::settings.channels.index', 'Webkul\Admin\Http\ViewComposers\DataGrids\ChannelsComposer');
|
||||
|
||||
//for sliders in admin dashboard
|
||||
View::composer('admin::settings.sliders.index', 'Webkul\Admin\Http\ViewComposers\DataGrids\SliderComposer');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ class EventServiceProvider extends ServiceProvider
|
|||
Event::fire('admin.catalog.products.accordian.build', $accordian);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Event::listen('admin.catalog.products.accordian.build', function($accordian) {
|
||||
$accordian->add('inventories', 'Inventories', 'admin::catalog.products.accordians.inventories', 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
@inject('attributes','Webkul\Admin\DataGrids\AttributeDataGrid')
|
||||
{!! $attributes->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -15,7 +15,8 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
@inject('categories','Webkul\Admin\DataGrids\CategoryDataGrid')
|
||||
{!! $categories->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -15,7 +15,8 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
@inject('attributefamily','Webkul\Admin\DataGrids\AttributeFamilyDataGrid')
|
||||
{!! $attributefamily->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
@if ($product->type == 'configurable')
|
||||
|
||||
@section('css')
|
||||
@parent
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
@section('content')
|
||||
<div class="content">
|
||||
<?php $locale = request()->get('locale') ?: app()->getLocale(); ?>
|
||||
<?php $channel = request()->get('channel') ?: channel()->getChannel(); ?>
|
||||
<?php $channel = request()->get('channel') ?: core()->getCurrentChannelCode(); ?>
|
||||
|
||||
<form method="POST" action="" @submit.prevent="onSubmit" enctype="multipart/form-data">
|
||||
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<div class="control-group">
|
||||
<select class="control" id="channel-switcher" name="channel">
|
||||
@foreach(channel()->getAllChannels() as $channelModel)
|
||||
@foreach(core()->getAllChannels() as $channelModel)
|
||||
|
||||
<option value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
|
||||
{{ $channelModel->name }}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
{{ __('admin::app.catalog.products.products') }}
|
||||
<h1>{{ __('admin::app.catalog.products.products') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
|
|
@ -15,7 +15,8 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
@inject('product','Webkul\Admin\DataGrids\ProductDataGrid')
|
||||
{!! $product->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
<div class="control-group" :class="[errors.has('currencies[]') ? 'has-error' : '']">
|
||||
<label for="currencies" class="required">{{ __('admin::app.settings.channels.currencies') }}</label>
|
||||
<select v-validate="'required'" class="control" id="currencies" name="currencies[]" multiple>
|
||||
@foreach(core()->allCurrencies() as $currency)
|
||||
@foreach(core()->getAllCurrencies() as $currency)
|
||||
<option value="{{ $currency->id }}" {{ old('currencies') && in_array($currency->id, old('currencies')) ? 'selected' : '' }}>
|
||||
{{ $currency->name }}
|
||||
</option>
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
<div class="control-group" :class="[errors.has('base_currency') ? 'has-error' : '']">
|
||||
<label for="base_currency" class="required">{{ __('admin::app.settings.channels.base-currency') }}</label>
|
||||
<select v-validate="'required'" class="control" id="base_currency" name="base_currency">
|
||||
@foreach(core()->allCurrencies() as $currency)
|
||||
@foreach(core()->getAllCurrencies() as $currency)
|
||||
<option value="{{ $currency->id }}" {{ old('base_currency') == $currency->id ? 'selected' : '' }}>
|
||||
{{ $currency->name }}
|
||||
</option>
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('default_locale') ? 'has-error' : '']">
|
||||
<label for="default_locale" class="required">{{ __('admin::app.settings.channels.default-locale') }}</label>
|
||||
<?php $selectedOption = old('default_locale') ?: $channel->default_locale ?>
|
||||
<?php $selectedOption = old('default_locale') ?: $channel->default_locale_id ?>
|
||||
<select v-validate="'required'" class="control" id="default_locale" name="default_locale">
|
||||
@foreach(core()->getAllLocales() as $locale)
|
||||
<option value="{{ $locale->id }}" {{ $selectedOption == $locale->id ? 'selected' : '' }}>
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
<label for="currencies" class="required">{{ __('admin::app.settings.channels.currencies') }}</label>
|
||||
<?php $selectedOptionIds = old('currencies') ?: $channel->currencies->pluck('id')->toArray() ?>
|
||||
<select v-validate="'required'" class="control" id="currencies" name="currencies[]" multiple>
|
||||
@foreach(core()->allCurrencies() as $currency)
|
||||
@foreach(core()->getAllCurrencies() as $currency)
|
||||
<option value="{{ $currency->id }}" {{ in_array($currency->id, $selectedOptionIds) ? 'selected' : '' }}>
|
||||
{{ $currency->name }}
|
||||
</option>
|
||||
|
|
@ -93,9 +93,9 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('base_currency') ? 'has-error' : '']">
|
||||
<label for="base_currency" class="required">{{ __('admin::app.settings.channels.base-currency') }}</label>
|
||||
<?php $selectedOption = old('base_currency') ?: $channel->base_currency ?>
|
||||
<?php $selectedOption = old('base_currency') ?: $channel->base_currency_id ?>
|
||||
<select v-validate="'required'" class="control" id="base_currency" name="base_currency">
|
||||
@foreach(core()->allCurrencies() as $currency)
|
||||
@foreach(core()->getAllCurrencies() as $currency)
|
||||
<option value="{{ $currency->id }}" {{ $selectedOption == $currency->id ? 'selected' : '' }}>
|
||||
{{ $currency->name }}
|
||||
</option>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
{!! $datagrid->render() !!}
|
||||
@inject('channels','Webkul\Admin\DataGrids\ChannelDataGrid')
|
||||
{!! $channels->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -15,7 +15,8 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
{!! $datagrid->render() !!}
|
||||
@inject('countries','Webkul\Admin\DataGrids\CountryDataGrid')
|
||||
{!! $countries->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -15,7 +15,8 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
{!! $datagrid->render() !!}
|
||||
@inject('currencies','Webkul\Admin\DataGrids\CurrencyDataGrid')
|
||||
{!! $currencies->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -19,7 +19,8 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
{!! $datagrid->render() !!}
|
||||
@inject('exchange_rates','Webkul\Admin\DataGrids\ExchangeRatesDataGrid')
|
||||
{!! $exchange_rates->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -19,7 +19,8 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
{!! $datagrid->render() !!}
|
||||
@inject('inventory_sources','Webkul\Admin\DataGrids\InventorySourcesDataGrid')
|
||||
{!! $inventory_sources->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -15,7 +15,9 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
{!! $datagrid->render() !!}
|
||||
|
||||
@inject('locales','Webkul\Admin\DataGrids\LocalesDataGrid')
|
||||
{!! $locales->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -15,7 +15,8 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
{!! $datagrid->render() !!}
|
||||
@inject('sliders','Webkul\Admin\DataGrids\SliderDataGrid')
|
||||
{!! $sliders->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -28,13 +28,15 @@
|
|||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('admin::app.users.roles.name') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="email" name="name"/>
|
||||
<input type="text" v-validate="'required'" class="control" id="email" name="name" value="{{ old('name') }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="description">{{ __('admin::app.users.roles.description') }}</label>
|
||||
<textarea class="control" id="description" name="description"></textarea>
|
||||
<textarea class="control" id="description" name="description">
|
||||
{{ old('description') }}
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
|
|
|||
|
|
@ -30,13 +30,15 @@
|
|||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('admin::app.users.roles.name') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="email" name="name" value="{{ $role->name }}"/>
|
||||
<input type="text" v-validate="'required'" class="control" id="name" name="name" value="{{ old('name') ?: $role->name }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="description">{{ __('admin::app.users.roles.description') }}</label>
|
||||
<textarea class="control" id="description" name="description">{{ $role->description }}</textarea>
|
||||
<textarea class="control" id="description" name="description">
|
||||
{{ old('description') ?: $role->description }}
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
{!! $datagrid->render() !!}
|
||||
@inject('roles','Webkul\Admin\DataGrids\RolesDataGrid')
|
||||
{!! $roles->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
<div class="page-content">
|
||||
|
||||
@inject('datagrid','Webkul\Admin\DataGrids\UserDataGrid')
|
||||
{!! $datagrid->render() !!}
|
||||
{{-- <datetime></datetime> --}}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class AttributeFamilyTableSeeder extends Seeder
|
|||
{
|
||||
$this->attributeFamily = $attributeFamily;
|
||||
}
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
foreach($this->rawData as $row) {
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ class AttributeTableSeeder extends Seeder
|
|||
'en' => [
|
||||
'name' => 'Special Price From'
|
||||
],
|
||||
'type' => 'datetime',
|
||||
'type' => 'date',
|
||||
'position' => 13,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
|
|
@ -201,7 +201,7 @@ class AttributeTableSeeder extends Seeder
|
|||
'en' => [
|
||||
'name' => 'Special Price To'
|
||||
],
|
||||
'type' => 'datetime',
|
||||
'type' => 'date',
|
||||
'position' => 14,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class AttributeController extends Controller
|
|||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$attribute = $this->attribute->findOrFail($id);
|
||||
$attribute = $this->attribute->find($id);
|
||||
|
||||
return view($this->_config['view'], compact('attribute'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class AttributeFamilyController extends Controller
|
|||
*/
|
||||
public function create(Attribute $attribute)
|
||||
{
|
||||
$attributeFamily = $this->attributeFamily->findBy('code', 'default', ['*'], ['attribute_groups.custom_attributes']);
|
||||
$attributeFamily = $this->attributeFamily->with(['attribute_groups.custom_attributes'])->findOneByField('code', 'default');
|
||||
|
||||
$custom_attributes = $attribute->all(['id', 'code', 'admin_name', 'type']);
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ class AttributeFamilyController extends Controller
|
|||
*/
|
||||
public function edit(Attribute $attribute, $id)
|
||||
{
|
||||
$attributeFamily = $this->attributeFamily->findOrFail($id, ['*'], ['attribute_groups.custom_attributes']);
|
||||
$attributeFamily = $this->attributeFamily->find($id, ['*'], ['attribute_groups.custom_attributes']);
|
||||
|
||||
$custom_attributes = $attribute->all(['id', 'code', 'admin_name', 'type']);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use Webkul\Attribute\Models\Attribute;
|
|||
class AttributeOption extends TranslatableModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
public $translatedAttributes = ['label'];
|
||||
|
||||
protected $fillable = ['admin_name', 'sort_order'];
|
||||
|
|
@ -19,6 +19,6 @@ class AttributeOption extends TranslatableModel
|
|||
*/
|
||||
public function attribute()
|
||||
{
|
||||
return $this->belongsTo(Attribute::class);
|
||||
return $this->model()->getCustomAttributesAttribute();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
<?php
|
||||
|
||||
namespace Webkul\Attribute\Repositories;
|
||||
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||
use Webkul\Attribute\Repositories\AttributeGroupRepository;
|
||||
|
|
@ -74,7 +74,7 @@ class AttributeFamilyRepository extends Repository
|
|||
if(isset($attribute['id'])) {
|
||||
$attributeModel = $this->attribute->find($attribute['id']);
|
||||
} else {
|
||||
$attributeModel = $this->attribute->findBy('code', $attribute['code']);
|
||||
$attributeModel = $this->attribute->findOneByField('code', $attribute['code']);
|
||||
}
|
||||
|
||||
$attributeGroup->custom_attributes()->save($attributeModel, ['position' => $key + 1]);
|
||||
|
|
@ -92,12 +92,12 @@ class AttributeFamilyRepository extends Repository
|
|||
*/
|
||||
public function update(array $data, $id, $attribute = "id")
|
||||
{
|
||||
$family = $this->findOrFail($id);
|
||||
$family = $this->find($id);
|
||||
|
||||
$family->update($data);
|
||||
|
||||
$previousAttributeGroupIds = $family->attribute_groups()->pluck('id');
|
||||
|
||||
|
||||
if(isset($data['attribute_groups'])) {
|
||||
foreach ($data['attribute_groups'] as $attributeGroupId => $attributeGroupInputs) {
|
||||
if (str_contains($attributeGroupId, 'group_')) {
|
||||
|
|
@ -114,9 +114,9 @@ class AttributeFamilyRepository extends Repository
|
|||
$previousAttributeGroupIds->forget($index);
|
||||
}
|
||||
|
||||
$attributeGroup = $this->attributeGroup->findOrFail($attributeGroupId);
|
||||
$attributeGroup = $this->attributeGroup->find($attributeGroupId);
|
||||
$attributeGroup->update($attributeGroupInputs);
|
||||
|
||||
|
||||
$attributeIds = $attributeGroup->custom_attributes()->get()->pluck('id');
|
||||
|
||||
if(isset($attributeGroupInputs['custom_attributes'])) {
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class AttributeRepository extends Repository
|
|||
{
|
||||
$data = $this->validateUserInput($data);
|
||||
|
||||
$attribute = $this->findOrFail($id);
|
||||
$attribute = $this->find($id);
|
||||
|
||||
$attribute->update($data);
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class CategoryController extends Controller
|
|||
{
|
||||
$categories = $this->category->getCategoryTree($id);
|
||||
|
||||
$category = $this->category->findOrFail($id);
|
||||
$category = $this->category->find($id);
|
||||
|
||||
return view($this->_config['view'], compact('category', 'categories'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use Webkul\Core\Eloquent\Repository;
|
|||
use Webkul\Category\Models\Category;
|
||||
use Illuminate\Container\Container as App;
|
||||
use Webkul\Category\Models\CategoryTranslation;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
|
||||
/**
|
||||
* Category Reposotory
|
||||
|
|
@ -59,9 +60,11 @@ class CategoryRepository extends Repository
|
|||
/**
|
||||
* Specify category tree
|
||||
*
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCategoryTree($id = null) {
|
||||
public function getCategoryTree($id = null)
|
||||
{
|
||||
return $id
|
||||
? Category::orderBy('position', 'ASC')->where('id', '!=', $id)->get()->toTree()
|
||||
: Category::orderBy('position', 'ASC')->get()->toTree();
|
||||
|
|
@ -70,9 +73,30 @@ class CategoryRepository extends Repository
|
|||
/**
|
||||
* Checks slug is unique or not based on locale
|
||||
*
|
||||
* @param integer $id
|
||||
* @param string $slug
|
||||
* @return boolean
|
||||
*/
|
||||
public function isSlugUnique($id, $slug) {
|
||||
public function isSlugUnique($id, $slug)
|
||||
{
|
||||
return CategoryTranslation::where('category_id', '!=', $id)->where('slug', '=', $slug)->first() ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive category from slug
|
||||
*
|
||||
* @param string $slug
|
||||
* @return mixed
|
||||
*/
|
||||
public function findBySlugOrFail($slug)
|
||||
{
|
||||
$category = $this->model->whereTranslation('slug', $slug)->first();
|
||||
|
||||
if($category)
|
||||
return $category;
|
||||
|
||||
throw (new ModelNotFoundException)->setModel(
|
||||
get_class($this->model), $slug
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
/node_modules
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"name": "webkul/laravel-channel",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jitendra Singh",
|
||||
"email": "jitendra@webkul.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"baum/baum": "~1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Webkul\\Channel\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Webkul\\Channel\\Providers\\ChannelServiceProvider"
|
||||
],
|
||||
"aliases": { }
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel;
|
||||
|
||||
use Webkul\Channel\Models\Channel as ChannelModel;
|
||||
|
||||
class Channel
|
||||
{
|
||||
public function getAllChannels() {
|
||||
return ChannelModel::all();
|
||||
}
|
||||
|
||||
public function getChannel() {
|
||||
$channel = ChannelModel::first();
|
||||
|
||||
if(!$channel)
|
||||
return;
|
||||
|
||||
return $channel->code;
|
||||
}
|
||||
|
||||
public function getCurrentChannel() {
|
||||
//just retrieve only three columns id, name and code
|
||||
$current_channel = collect(ChannelModel::select('id', 'name', 'code')->first());
|
||||
return $current_channel;
|
||||
}
|
||||
|
||||
public function getChannelModel() {
|
||||
return ChannelModel::first();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
use Webkul\Channel\Channel;
|
||||
|
||||
if (! function_exists('channel')) {
|
||||
function channel()
|
||||
{
|
||||
return new Channel;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Foundation\AliasLoader;
|
||||
use Illuminate\Routing\Router;
|
||||
use Webkul\Channel\Channel;
|
||||
use Webkul\Channel\Facades\ChannelFacade;
|
||||
|
||||
class ChannelServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Router $router)
|
||||
{
|
||||
include __DIR__ . '/../Http/helpers.php';
|
||||
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerChannelFacade();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Bouncer as a singleton.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerChannelFacade()
|
||||
{
|
||||
$loader = AliasLoader::getInstance();
|
||||
$loader->alias('channel', ChannelFacade::class);
|
||||
|
||||
$this->app->singleton('channel', function () {
|
||||
return new Channel();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Contracts;
|
||||
|
||||
/**
|
||||
* Reposotory Interface
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
interface RepositoryInterface {
|
||||
|
||||
public function all($columns = ['*']);
|
||||
|
||||
public function paginate($perPage = 15, $columns = ['*']);
|
||||
|
||||
public function create(array $data);
|
||||
|
||||
public function update(array $data, $id);
|
||||
|
||||
public function delete($id);
|
||||
|
||||
public function find($id, $columns = ['*']);
|
||||
|
||||
public function findOrFail($id, $columns = ['*']);
|
||||
|
||||
public function findBy($field, $value, $columns = ['*']);
|
||||
|
||||
}
|
||||
|
|
@ -2,16 +2,173 @@
|
|||
|
||||
namespace Webkul\Core;
|
||||
|
||||
use Webkul\Core\Models\Channel as ChannelModel;
|
||||
use Webkul\Core\Models\Locale as LocaleModel;
|
||||
use Webkul\Core\Models\Currency as CurrencyModel;
|
||||
|
||||
class Core
|
||||
{
|
||||
/**
|
||||
* Returns all channels
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getAllChannels() {
|
||||
return ChannelModel::all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns currenct channel models
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCurrentChannel() {
|
||||
return ChannelModel::first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns currenct channel code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentChannelCode() {
|
||||
return ($channel = $this->getCurrentChannel()) ? $channel->code : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all locales
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getAllLocales() {
|
||||
return LocaleModel::all();
|
||||
}
|
||||
|
||||
public function allCurrencies() {
|
||||
/**
|
||||
* Returns all currencies
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getAllCurrencies()
|
||||
{
|
||||
return CurrencyModel::all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current channel's currency model
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCurrentCurrency()
|
||||
{
|
||||
$currency = CurrencyModel::first();
|
||||
|
||||
return $currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current channel's currency code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentCurrencyCode()
|
||||
{
|
||||
return ($currency = $this->getCurrentCurrency()) ? $currency->code : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current channel's currency symbol
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentCurrencySymbol()
|
||||
{
|
||||
return $this->getCurrentCurrency()->symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format and convert price with currency symbol
|
||||
*
|
||||
* @param float $price
|
||||
* @return string
|
||||
*/
|
||||
public function currency($price)
|
||||
{
|
||||
if(!$price)
|
||||
$price = 0;
|
||||
|
||||
$channel = $this->getCurrentChannel();
|
||||
|
||||
$currencyCode = $channel->base_currency->code;
|
||||
|
||||
return currency($price, $currencyCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if current date of the given channel (in the channel timezone) is within the range
|
||||
*
|
||||
* @param int|string|Channel $channel
|
||||
* @param string|null $dateFrom
|
||||
* @param string|null $dateTo
|
||||
* @return bool
|
||||
*/
|
||||
public function isChannelDateInInterval($dateFrom = null, $dateTo = null)
|
||||
{
|
||||
$channel = $this->getCurrentChannel();
|
||||
|
||||
$channelTimeStamp = $this->channelTimeStamp($channel);
|
||||
|
||||
$fromTimeStamp = strtotime($dateFrom);
|
||||
|
||||
$toTimeStamp = strtotime($dateTo);
|
||||
|
||||
if ($dateTo) {
|
||||
$toTimeStamp += 86400;
|
||||
}
|
||||
|
||||
$result = false;
|
||||
|
||||
if (!$this->is_empty_date($dateFrom) && $channelTimeStamp < $fromTimeStamp) {
|
||||
} elseif (!$this->is_empty_date($dateTo) && $channelTimeStamp > $toTimeStamp) {
|
||||
} else {
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get channel timestamp
|
||||
* Timstamp will be builded with channel timezone settings
|
||||
*
|
||||
* @param mixed $channel
|
||||
* @return int
|
||||
*/
|
||||
public function channelTimeStamp($channel)
|
||||
{
|
||||
$timezone = $channel->timezone;
|
||||
|
||||
$currentTimezone = @date_default_timezone_get();
|
||||
|
||||
@date_default_timezone_set($timezone);
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
|
||||
@date_default_timezone_set($currentTimezone);
|
||||
|
||||
return strtotime($date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether sql date is empty
|
||||
*
|
||||
* @param string $date
|
||||
* @return boolean
|
||||
*/
|
||||
function is_empty_date($date)
|
||||
{
|
||||
return preg_replace('#[ 0:-]#', '', $date) === '';
|
||||
}
|
||||
|
||||
// $timezonelist = \DateTimeZone::listIdentifiers(\DateTimeZone::ALL);
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core;
|
||||
|
||||
use Webkul\Core\Models\Locale as LocaleModel;
|
||||
|
||||
class Locale
|
||||
{
|
||||
public function all() {
|
||||
return LocaleModel::all();
|
||||
}
|
||||
}
|
||||
|
|
@ -18,10 +18,12 @@ class CreateChannelsTable extends Migration
|
|||
$table->string('code');
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->integer('default_locale')->unsigned();
|
||||
$table->integer('base_currency')->unsigned();
|
||||
$table->foreign('default_locale')->references('id')->on('locales')->onDelete('cascade');
|
||||
$table->foreign('base_currency')->references('id')->on('currencies')->onDelete('cascade');
|
||||
$table->string('timezone')->nullable();
|
||||
$table->string('theme')->nullable();
|
||||
$table->integer('default_locale_id')->unsigned();
|
||||
$table->integer('base_currency_id')->unsigned();
|
||||
$table->foreign('default_locale_id')->references('id')->on('locales')->onDelete('cascade');
|
||||
$table->foreign('base_currency_id')->references('id')->on('currencies')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
namespace Webkul\Core\Eloquent;
|
||||
|
||||
use Webkul\Core\Contracts\RepositoryInterface;
|
||||
use Webkul\Core\Exceptions\RepositoryException;
|
||||
|
||||
use Prettus\Repository\Eloquent\BaseRepository;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Container\Container as App;
|
||||
|
||||
|
|
@ -14,157 +12,45 @@ use Illuminate\Container\Container as App;
|
|||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
abstract class Repository implements RepositoryInterface {
|
||||
abstract class Repository extends BaseRepository {
|
||||
|
||||
/**
|
||||
* @var App
|
||||
*/
|
||||
private $app;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
protected $model;
|
||||
|
||||
/**
|
||||
* @param App $app
|
||||
* @throws \Webkul\Core\Exceptions\RepositoryException
|
||||
*/
|
||||
public function __construct(App $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
|
||||
$this->makeModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify Model class name
|
||||
* Find data by field and value
|
||||
*
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @param array $columns
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public abstract function model();
|
||||
public function findOneByField($field, $value = null, $columns = ['*'])
|
||||
{
|
||||
$model = parent::findByField($field, $value, $columns = ['*']);
|
||||
|
||||
return $model->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Find data by field and value
|
||||
*
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @param array $columns
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function all($columns = ['*'], $with = [])
|
||||
public function findOneWhere(array $where, $columns = ['*'])
|
||||
{
|
||||
return $this->resetScope()->model->with($with)->get($columns);
|
||||
$model = parent::findWhere($where, $columns);
|
||||
|
||||
return $model->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $perPage
|
||||
* @param array $columns
|
||||
* @return mixed
|
||||
*/
|
||||
public function paginate($perPage = 1, $columns = ['*'])
|
||||
public function getModel()
|
||||
{
|
||||
return $this->resetScope()->model->paginate($perPage, $columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
return $this->resetScope()->model->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param $id
|
||||
* @param string $attribute
|
||||
* @return mixed
|
||||
*/
|
||||
public function update(array $data, $id, $attribute = "id")
|
||||
{
|
||||
return $this->resetScope()->model->where($attribute, '=', $id)->first()->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
return $this->resetScope()->find($id)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param array $columns->with($with)
|
||||
* @return mixed
|
||||
*/
|
||||
public function find($id, $columns = ['*'], $with = [])
|
||||
{
|
||||
return $this->resetScope()->model->with($with)->find($id, $columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param array $columns
|
||||
* @return mixed
|
||||
*/
|
||||
public function findOrFail($id, $columns = ['*'], $with = [])
|
||||
{
|
||||
return $this->resetScope()->model->with($with)->findOrFail($id, $columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $attribute
|
||||
* @param $value
|
||||
* @param array $columns
|
||||
* @return mixed
|
||||
*/
|
||||
public function findBy($attribute, $value, $columns = ['*'], $with = [])
|
||||
{
|
||||
return $this->resetScope()->model->with($with)->where($attribute, '=', $value)->first($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $conditions
|
||||
* @param array $columns
|
||||
* @return mixed
|
||||
*/
|
||||
public function findWhere($conditions, $columns = ['*'], $with = [])
|
||||
{
|
||||
$model = $this->resetScope()->model;
|
||||
|
||||
foreach ($conditions as $column => $value) {
|
||||
if(is_array($value)) {
|
||||
list($column, $condition, $val) = $value;
|
||||
$this->model = $this->model->where($column, $condition, $val);
|
||||
} else {
|
||||
$model->where($column, $value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $model->with($with)->get($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
public function makeModel()
|
||||
{
|
||||
$model = $this->app->make($this->model());
|
||||
|
||||
if (!$model instanceof Model)
|
||||
throw new RepositoryException("Class {$this->model()} must be an instance of Illuminate\\Database\\Eloquent\\Model");
|
||||
|
||||
return $this->model = $model->newQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function resetScope() {
|
||||
$this->makeModel();
|
||||
|
||||
return $this;
|
||||
return $this->model;
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ class TranslatableModel extends Model
|
|||
protected function locale()
|
||||
{
|
||||
if($this->isChannelBased()) {
|
||||
return channel()->getDefaultChannelLocaleCode();
|
||||
return core()->getDefaultChannelLocaleCode();
|
||||
} else {
|
||||
if ($this->defaultLocale) {
|
||||
return $this->defaultLocale;
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Exceptions;
|
||||
|
||||
/**
|
||||
* Reposotory Exception
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class RepositoryException extends \Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Http\Controllers;
|
||||
namespace Webkul\Core\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\Channel\Repositories\ChannelRepository as Channel;
|
||||
use Webkul\Core\Repositories\ChannelRepository as Channel;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -32,7 +32,7 @@ class ChannelController extends Controller
|
|||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Channel\Repositories\ChannelRepository $channel
|
||||
* @param Webkul\Core\Repositories\ChannelRepository $channel
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Channel $channel)
|
||||
|
|
@ -94,7 +94,7 @@ class ChannelController extends Controller
|
|||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$channel = $this->channel->findOrFail($id, ['*'], ['locales', 'currencies']);
|
||||
$channel = $this->channel->with(['locales', 'currencies'])->find($id);
|
||||
|
||||
return view($this->_config['view'], compact('channel'));
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ class ExchangeRateController extends Controller
|
|||
{
|
||||
$currencies = $this->currency->all();
|
||||
|
||||
$exchangeRate = $this->exchangeRate->findOrFail($id);
|
||||
$exchangeRate = $this->exchangeRate->find($id);
|
||||
|
||||
return view($this->_config['view'], compact('currencies', 'exchangeRate'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class Locale
|
|||
public function handle($request, Closure $next)
|
||||
{
|
||||
if($locale = $request->get('locale')) {
|
||||
if($this->locale->findBy('code', $locale)) {
|
||||
if($this->locale->findOneByField('code', $locale)) {
|
||||
// app()->setLocale($locale);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
use Webkul\Core\Core;
|
||||
|
||||
|
||||
if (! function_exists('core')) {
|
||||
function core()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Models;
|
||||
namespace Webkul\Core\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\Core\Models\Locale;
|
||||
|
|
@ -34,6 +34,8 @@ class Channel extends Model
|
|||
return $this->belongsToMany(Currency::class, 'channel_currencies');
|
||||
}
|
||||
|
||||
|
||||
protected $with = ['base_currency'];
|
||||
/**
|
||||
* Get the base currency
|
||||
*/
|
||||
|
|
@ -43,7 +43,7 @@ class CoreServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerCoreFacade();
|
||||
$this->registerFacades();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -51,7 +51,7 @@ class CoreServiceProvider extends ServiceProvider
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerCoreFacade()
|
||||
protected function registerFacades()
|
||||
{
|
||||
$loader = AliasLoader::getInstance();
|
||||
$loader->alias('core', CoreFacade::class);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Channel\Repositories;
|
||||
namespace Webkul\Core\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ class ChannelRepository extends Repository
|
|||
*/
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\Channel\Models\Channel';
|
||||
return 'Webkul\Core\Models\Channel';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -45,7 +45,7 @@ class ChannelRepository extends Repository
|
|||
*/
|
||||
public function update(array $data, $id, $attribute = "id")
|
||||
{
|
||||
$channel = $this->findOrFail($id);
|
||||
$channel = $this->find($id);
|
||||
|
||||
$channel->update($data);
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ class CreateCustomersTable extends Migration
|
|||
$table->string('first_name');
|
||||
$table->string('last_name');
|
||||
$table->enum('gender', ['Male', 'Female']);
|
||||
$table->date('date_of_birth');
|
||||
$table->date('date_of_birth')->nullable();
|
||||
$table->string('phone')->unique()->nullable();
|
||||
$table->string('email')->unique();
|
||||
$table->string('password');
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
|
||||
Route::group(['middleware' => ['web']], function () {
|
||||
Route::prefix('customer')->group(function () {
|
||||
|
||||
// Login Routes
|
||||
Route::get('login', 'Webkul\Customer\Http\Controllers\SessionController@show')->defaults('_config', [
|
||||
'view' => 'shop::customers.session.index',
|
||||
])->name('customer.session.index');
|
||||
|
||||
Route::post('login', 'Webkul\Customer\Http\Controllers\SessionController@create')->defaults('_config', [
|
||||
'redirect' => 'customer.account.profile'
|
||||
])->name('customer.session.create');
|
||||
|
||||
|
||||
// Registration Routes
|
||||
Route::get('register', 'Webkul\Customer\Http\Controllers\RegistrationController@show')->defaults('_config', [
|
||||
'view' => 'shop::customers.signup.index' //hint path
|
||||
])->name('customer.register.index');
|
||||
|
||||
Route::post('register', 'Webkul\Customer\Http\Controllers\RegistrationController@create')->defaults('_config', [
|
||||
'redirect' => 'customer.account.profile',
|
||||
])->name('customer.register.create'); //redirect attribute will get changed immediately to account.index when account's index page will be made
|
||||
|
||||
// Auth Routes
|
||||
Route::group(['middleware' => ['customer']], function () {
|
||||
|
||||
//route for logout which will be under the auth guard of the customer by default
|
||||
Route::get('logout', 'Webkul\Customer\Http\Controllers\SessionController@destroy')->defaults('_config', [
|
||||
'redirect' => 'customer.session.index'
|
||||
])->name('customer.session.destroy');
|
||||
|
||||
//customer account
|
||||
Route::prefix('account')->group(function () {
|
||||
Route::get('profile', 'Webkul\Customer\Http\Controllers\CustomerController@profile')->defaults('_config', [
|
||||
'view' => 'shop::customers.account.profile.home.index'
|
||||
])->name('customer.account.profile');
|
||||
|
||||
//profile edit
|
||||
Route::get('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@editProfile')->defaults('_config', [
|
||||
'view' => 'shop::customers.account.profile.edit.index'
|
||||
])->name('customer.profile.edit');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -13,7 +13,7 @@ class CustomerServiceProvider extends ServiceProvider
|
|||
{
|
||||
public function boot(Router $router)
|
||||
{
|
||||
include __DIR__ . '/../Http/routes.php';
|
||||
// include __DIR__ . '/../Http/routes.php';
|
||||
|
||||
$this->publishes([
|
||||
__DIR__ . '/../../publishable/assets' => public_path('vendor/webkul/customer/assets'),
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class InventorySourceController extends Controller
|
|||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$inventorySource = $this->inventorySource->findOrFail($id);
|
||||
$inventorySource = $this->inventorySource->find($id);
|
||||
|
||||
return view($this->_config['view'], compact('inventorySource'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,28 +24,28 @@ class ProductController extends Controller
|
|||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
|
||||
/**
|
||||
* AttributeFamilyRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $attributeFamily;
|
||||
|
||||
|
||||
/**
|
||||
* CategoryRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $category;
|
||||
|
||||
|
||||
/**
|
||||
* InventorySourceRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $inventorySource;
|
||||
|
||||
|
||||
/**
|
||||
* ProductRepository object
|
||||
*
|
||||
|
|
@ -99,7 +99,7 @@ class ProductController extends Controller
|
|||
$families = $this->attributeFamily->all();
|
||||
|
||||
if($familyId = request()->get('family')) {
|
||||
$configurableFamily = $this->attributeFamily->findOrFail($familyId);
|
||||
$configurableFamily = $this->attributeFamily->find($familyId);
|
||||
}
|
||||
|
||||
return view($this->_config['view'], compact('families', 'configurableFamily'));
|
||||
|
|
@ -143,7 +143,7 @@ class ProductController extends Controller
|
|||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$product = $this->product->findOrFail($id);
|
||||
$product = $this->product->with(['variants'])->find($id);
|
||||
|
||||
$categories = $this->category->getCategoryTree();
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,13 @@ use Webkul\Product\Models\ProductAttributeValue;
|
|||
use Webkul\Product\Models\ProductInventory;
|
||||
use Webkul\Product\Models\ProductImage;
|
||||
use Webkul\Inventory\Models\InventorySource;
|
||||
use Webkul\Product\Models\ProductReview;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
protected $fillable = ['type', 'attribute_family_id', 'sku', 'parent_id'];
|
||||
|
||||
protected $with = ['attribute_family', 'attribute_values', 'variants', 'inventories'];
|
||||
protected $with = ['attribute_family', 'inventories'];
|
||||
|
||||
/**
|
||||
* Get the product attribute family that owns the product.
|
||||
|
|
@ -41,6 +42,14 @@ class Product extends Model
|
|||
return $this->hasMany(self::class, 'parent_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the product reviews that owns the product.
|
||||
*/
|
||||
public function reviews()
|
||||
{
|
||||
return $this->hasMany(ProductReview::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the product that owns the product.
|
||||
*/
|
||||
|
|
@ -131,41 +140,37 @@ class Product extends Model
|
|||
*/
|
||||
public function getAttribute($key)
|
||||
{
|
||||
if (!method_exists(self::class, $key) && !isset($this->attributes[$key])) {
|
||||
if (!method_exists(self::class, $key) && !in_array($key, ['parent_id', 'attribute_family_id']) && !isset($this->attributes[$key])) {
|
||||
if ($this->isCustomAttribute($key)) {
|
||||
$this->attributes[$key] = '';
|
||||
|
||||
$attributeModel = $this->attribute_family->custom_attributes()->where('attributes.code', $key)->first();
|
||||
|
||||
if($attributeModel) {
|
||||
$channel = request()->get('channel') ?: core()->getCurrentChannelCode();
|
||||
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
|
||||
if($attributeModel->value_per_channel) {
|
||||
$channel = request()->get('channel') ?: channel()->getChannel();
|
||||
if($attributeModel->value_per_locale) {
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
$attributeValue = $this->attribute_values()->where('channel', $channel)->where('locale', $locale)->where('attribute_id', $attributeModel->id)->first();
|
||||
} else {
|
||||
$attributeValue = $this->attribute_values()->where('channel', $channel)->where('attribute_id', $attributeModel->id)->first();
|
||||
}
|
||||
} else {
|
||||
if($attributeModel->value_per_locale) {
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
$attributeValue = $this->attribute_values()->where('locale', $locale)->where('attribute_id', $attributeModel->id)->first();
|
||||
} else {
|
||||
$attributeValue = $this->attribute_values()->where('attribute_id', $attributeModel->id)->first();
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->hasGetMutator($key)) {
|
||||
$this->attributes[$key] = $attributeValue[ProductAttributeValue::$attributeTypeFields[$attributeModel->type]];
|
||||
|
||||
return $this->getAttributeValue($key);
|
||||
}
|
||||
|
||||
return $attributeValue[ProductAttributeValue::$attributeTypeFields[$attributeModel->type]];
|
||||
$this->attributes[$key] = $attributeValue[ProductAttributeValue::$attributeTypeFields[$attributeModel->type]];
|
||||
}
|
||||
|
||||
return $this->getAttributeValue($key);
|
||||
}
|
||||
|
||||
return $this->getAttributeValue($key);
|
||||
}
|
||||
|
||||
return parent::getAttribute($key);
|
||||
|
|
@ -180,31 +185,30 @@ class Product extends Model
|
|||
|
||||
$hiddenAttributes = $this->getHidden();
|
||||
|
||||
$channel = request()->get('channel') ?: core()->getCurrentChannelCode();
|
||||
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
|
||||
foreach ($this->attribute_family->custom_attributes as $attribute) {
|
||||
if (in_array($attribute->code, $hiddenAttributes)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($attribute->value_per_channel) {
|
||||
$channel = request()->get('channel') ?: channel()->getChannel();
|
||||
if($attribute->value_per_locale) {
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
$attributeValue = $this->attribute_values()->where('channel', $channel)->where('locale', $locale)->where('attribute_id', $attribute->id)->first();
|
||||
} else {
|
||||
$attributeValue = $this->attribute_values()->where('channel', $channel)->where('attribute_id', $attribute->id)->first();
|
||||
}
|
||||
} else {
|
||||
if($attribute->value_per_locale) {
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
$attributeValue = $this->attribute_values()->where('locale', $locale)->where('attribute_id', $attribute->id)->first();
|
||||
} else {
|
||||
$attributeValue = $this->attribute_values()->where('attribute_id', $attribute->id)->first();
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_null($value = $attributeValue[ProductAttributeValue::$attributeTypeFields[$attribute->type]])) {
|
||||
$attributes[$attribute->code] = $value;
|
||||
}
|
||||
$attributes[$attribute->code] = $attributeValue[ProductAttributeValue::$attributeTypeFields[$attribute->type]];
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Product\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProductReview extends Model
|
||||
{
|
||||
protected $fillable = [];
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Product\Product;
|
||||
|
||||
use Webkul\Product\Models\ProductAttributeValue;
|
||||
|
||||
abstract class AbstractProduct
|
||||
{
|
||||
/**
|
||||
* Add Channle and Locale filter
|
||||
*
|
||||
* @param Attribute $attribute
|
||||
* @param QB $qb
|
||||
* @param sting $alias
|
||||
* @return QB
|
||||
*/
|
||||
public function applyChannelLocaleFilter($attribute, $qb, $alias = 'product_attribute_values')
|
||||
{
|
||||
$channel = core()->getCurrentChannelCode();
|
||||
|
||||
$locale = app()->getLocale();
|
||||
|
||||
if($attribute->value_per_channel) {
|
||||
if($attribute->value_per_locale) {
|
||||
$qb->where($alias . '.channel', $channel)
|
||||
->where($alias . '.locale', $locale);
|
||||
} else {
|
||||
$qb->where($alias . '.channel', $channel);
|
||||
}
|
||||
} else {
|
||||
if($attribute->value_per_locale) {
|
||||
$qb->where($alias . '.locale', $locale);
|
||||
}
|
||||
}
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds attributes to select
|
||||
*
|
||||
* @param QB $qb
|
||||
* @return QB
|
||||
*/
|
||||
public function addSelectAttributes($qb)
|
||||
{
|
||||
foreach ($this->attributeToSelect as $code) {
|
||||
$attribute = $this->attribute->findOneByField('code', $code);
|
||||
|
||||
$productValueAlias = 'pav_' . $attribute->code;
|
||||
|
||||
$qb->leftJoin('product_attribute_values as ' . $productValueAlias, function($leftJoin) use($attribute, $productValueAlias) {
|
||||
|
||||
$leftJoin->on('products.id', $productValueAlias . '.product_id');
|
||||
|
||||
$leftJoin = $this->applyChannelLocaleFilter($attribute, $leftJoin, $productValueAlias)->where($productValueAlias . '.attribute_id', $attribute->id);
|
||||
});
|
||||
|
||||
$qb->addSelect($productValueAlias . '.' . ProductAttributeValue::$attributeTypeFields[$attribute->type] . ' as ' . $code);
|
||||
}
|
||||
|
||||
return $qb;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Product\Product;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Webkul\Product\Repositories\ProductRepository as Product;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
|
||||
|
||||
class Collection extends AbstractProduct
|
||||
{
|
||||
/**
|
||||
* ProductRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $product;
|
||||
|
||||
/**
|
||||
* AttributeRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $attribute;
|
||||
|
||||
/**
|
||||
* array object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $attributeToSelect = [
|
||||
'name',
|
||||
'description',
|
||||
'short_description',
|
||||
'price',
|
||||
'special_price',
|
||||
'special_price_from',
|
||||
'special_price_to'
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Product\Repositories\ProductRepository $product
|
||||
* @param Webkul\Attribute\Repositories\AttributeRepository $attribute
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Product $product, Attribute $attribute)
|
||||
{
|
||||
$this->product = $product;
|
||||
|
||||
$this->attribute = $attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
* @return Void
|
||||
*/
|
||||
public function addAttributesToSelect($attributes)
|
||||
{
|
||||
$this->attributeToSelect = array_unique(
|
||||
array_merge($this->attributeToSelect, $attributes)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $categoryId
|
||||
* @return Collection
|
||||
*/
|
||||
public function getCollection($categoryId = null)
|
||||
{
|
||||
$qb = $this->product->getModel()
|
||||
->select('products.*')
|
||||
->join('product_categories', 'products.id', '=', 'product_categories.product_id')
|
||||
->where('product_categories.category_id', $categoryId);
|
||||
|
||||
$this->addSelectAttributes($qb);
|
||||
|
||||
// foreach (request()->input() as $code => $value) {
|
||||
// $filterAlias = 'filter_' . $code;
|
||||
|
||||
// $qb->leftJoin('product_attribute_values as ' . $filterAlias, 'products.id', '=', $filterAlias . '.product_id');
|
||||
|
||||
// $qb->where($filterAlias . '.' . ProductAttributeValue::$attributeTypeFields[$attribute->type], $value);
|
||||
// }
|
||||
|
||||
// if(0) {
|
||||
// $qb->orderBy('id', 'desc');
|
||||
// }
|
||||
|
||||
return $qb->paginate(9);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Product\Product;
|
||||
|
||||
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
|
||||
use Webkul\Product\Models\ProductAttributeValue;
|
||||
use Webkul\Product\Models\Product;
|
||||
|
||||
class Price extends AbstractProduct
|
||||
{
|
||||
/**
|
||||
* AttributeRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $attribute;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Attribute\Repositories\AttributeRepository $attribute
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Attribute $attribute)
|
||||
{
|
||||
$this->attribute = $attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the product's minimal price
|
||||
*
|
||||
* @param Product $product
|
||||
* @return float
|
||||
*/
|
||||
public function getMinimalPrice($product)
|
||||
{
|
||||
if($product->type == 'configurable') {
|
||||
return $this->getVariantMinPrice($product);
|
||||
} else {
|
||||
if($this->haveSpecialPrice($product)) {
|
||||
return $product->special_price;
|
||||
} else {
|
||||
return $product->price;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the product's minimal price
|
||||
*
|
||||
* @param Product $product
|
||||
* @return float
|
||||
*/
|
||||
public function getVariantMinPrice($product)
|
||||
{
|
||||
static $attribute;
|
||||
|
||||
if(!$attribute)
|
||||
$attribute = $this->attribute->findOneByField('code', 'price');
|
||||
|
||||
$qb = ProductAttributeValue::join('products', 'product_attribute_values.product_id', '=', 'products.id')
|
||||
->join('attributes', 'product_attribute_values.attribute_id', '=', 'attributes.id')
|
||||
->where('products.parent_id', $product->id)
|
||||
->where('attributes.code', 'price')
|
||||
->addSelect('product_attribute_values.*');
|
||||
|
||||
$this->applyChannelLocaleFilter($attribute, $qb);
|
||||
|
||||
return $qb->min('product_attribute_values.' . ProductAttributeValue::$attributeTypeFields['price']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the product's minimal price
|
||||
*
|
||||
* @param Product $product
|
||||
* @return float
|
||||
*/
|
||||
public function getSpecialPrice($product)
|
||||
{
|
||||
if($this->haveSpecialPrice($product)) {
|
||||
return $product->special_price;
|
||||
} else {
|
||||
return $product->price;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Product $product
|
||||
* @return boolean
|
||||
*/
|
||||
public function haveSpecialPrice($product)
|
||||
{
|
||||
if(is_null($product->special_price) || !$product->special_price)
|
||||
return false;
|
||||
|
||||
if (core()->isChannelDateInInterval($product->special_price_from, $product->special_price_to)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Shop\Product;
|
||||
|
||||
class Review extends AbstractProduct
|
||||
{
|
||||
/**
|
||||
* Returns the product's avg rating
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getAverageRating($product)
|
||||
{
|
||||
return round($product->reviews->average('rating'));
|
||||
}
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ class ProductAttributeValueRepository extends Repository
|
|||
if(isset($data['attribute_id'])) {
|
||||
$attribute = $this->attribute->find($data['attribute_id']);
|
||||
} else {
|
||||
$attribute = $this->attribute->findBy('code', $data['attribute_code']);
|
||||
$attribute = $this->attribute->findOneByField('code', $data['attribute_code']);
|
||||
}
|
||||
|
||||
if(!$attribute)
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ class ProductInventoryRepository extends Repository
|
|||
if(is_null($qty))
|
||||
continue;
|
||||
|
||||
$productInventory = $this->findWhere([
|
||||
$productInventory = $this->findOneWhere([
|
||||
'product_id' => $product->id,
|
||||
'inventory_source_id' => $inventorySourceId,
|
||||
])->first();
|
||||
]);
|
||||
|
||||
if($productInventory) {
|
||||
if(is_numeric($index = $inventorySourceIds->search($inventorySourceId))) {
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class ProductRepository extends Repository
|
|||
{
|
||||
$product = $this->model->create($data);
|
||||
|
||||
$nameAttribute = $this->attribute->findBy('code', 'status');
|
||||
$nameAttribute = $this->attribute->findOneByField('code', 'status');
|
||||
$this->attributeValue->create([
|
||||
'product_id' => $product->id,
|
||||
'attribute_id' => $nameAttribute->id,
|
||||
|
|
@ -115,7 +115,7 @@ class ProductRepository extends Repository
|
|||
$super_attributes = [];
|
||||
|
||||
foreach ($data['super_attributes'] as $attributeCode => $attributeOptions) {
|
||||
$attribute = $this->attribute->findBy('code', $attributeCode);
|
||||
$attribute = $this->attribute->findOneByField('code', $attributeCode);
|
||||
|
||||
$super_attributes[$attribute->id] = $attributeOptions;
|
||||
|
||||
|
|
@ -138,10 +138,10 @@ class ProductRepository extends Repository
|
|||
*/
|
||||
public function update(array $data, $id, $attribute = "id")
|
||||
{
|
||||
$product = $this->findOrFail($id);
|
||||
$product = $this->find($id);
|
||||
|
||||
if($product->parent_id && $this->checkVariantOptionAvailabiliy($data, $product)) {
|
||||
$data['parent_id'] = null;
|
||||
$data['parent_id'] = NULL;
|
||||
}
|
||||
|
||||
$product->update($data);
|
||||
|
|
@ -155,12 +155,12 @@ class ProductRepository extends Repository
|
|||
if(!isset($data[$attribute->code]) || !$data[$attribute->code])
|
||||
continue;
|
||||
|
||||
$attributeValue = $this->attributeValue->findWhere([
|
||||
$attributeValue = $this->attributeValue->findOneWhere([
|
||||
'product_id' => $product->id,
|
||||
'attribute_id' => $attribute->id,
|
||||
'channel' => $attribute->value_per_channel ? $data['channel'] : null,
|
||||
'locale' => $attribute->value_per_locale ? $data['locale'] : null
|
||||
])->first();
|
||||
]);
|
||||
|
||||
if(!$attributeValue) {
|
||||
$this->attributeValue->create([
|
||||
|
|
@ -228,11 +228,11 @@ class ProductRepository extends Repository
|
|||
]);
|
||||
|
||||
foreach (['sku', 'name', 'price', 'weight', 'status'] as $attributeCode) {
|
||||
$attribute = $this->attribute->findBy('code', $attributeCode);
|
||||
$attribute = $this->attribute->findOneByField('code', $attributeCode);
|
||||
|
||||
if($attribute->value_per_channel) {
|
||||
if($attribute->value_per_locale) {
|
||||
foreach(channel()->getAllChannels() as $channel) {
|
||||
foreach(core()->getAllChannels() as $channel) {
|
||||
foreach(core()->getAllLocales() as $locale) {
|
||||
$this->attributeValue->create([
|
||||
'product_id' => $variant->id,
|
||||
|
|
@ -244,7 +244,7 @@ class ProductRepository extends Repository
|
|||
}
|
||||
}
|
||||
} else {
|
||||
foreach(channel()->getAllChannels() as $channel) {
|
||||
foreach(core()->getAllChannels() as $channel) {
|
||||
$this->attributeValue->create([
|
||||
'product_id' => $variant->id,
|
||||
'attribute_id' => $attribute->id,
|
||||
|
|
@ -293,19 +293,19 @@ class ProductRepository extends Repository
|
|||
*/
|
||||
public function updateVariant(array $data, $id)
|
||||
{
|
||||
$variant = $this->findOrFail($id);
|
||||
$variant = $this->find($id);
|
||||
|
||||
$variant->update(['sku' => $data['sku']]);
|
||||
|
||||
foreach (['sku', 'name', 'price', 'weight', 'status'] as $attributeCode) {
|
||||
$attribute = $this->attribute->findBy('code', $attributeCode);
|
||||
$attribute = $this->attribute->findOneByField('code', $attributeCode);
|
||||
|
||||
$attributeValue = $this->attributeValue->findWhere([
|
||||
$attributeValue = $this->attributeValue->findOneWhere([
|
||||
'product_id' => $id,
|
||||
'attribute_id' => $attribute->id,
|
||||
'channel' => $attribute->value_per_channel ? $data['channel'] : null,
|
||||
'locale' => $attribute->value_per_locale ? $data['locale'] : null
|
||||
])->first();
|
||||
]);
|
||||
|
||||
if(!$attributeValue) {
|
||||
$this->attributeValue->create([
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
/node_modules
|
||||
/package-lock.json
|
||||
/package-lock.json
|
||||
npm-debug.log
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Shop\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\Category\Repositories\CategoryRepository as Category;
|
||||
use Webkul\Product\Repositories\ProductRepository as Product;
|
||||
|
||||
/**
|
||||
* Category controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* CategoryRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $category;
|
||||
|
||||
/**
|
||||
* ProductRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $product;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Category\Repositories\CategoryRepository $category
|
||||
* @param Webkul\Product\Repositories\ProductRepository $product
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Category $category, Product $product)
|
||||
{
|
||||
$this->product = $product;
|
||||
|
||||
$this->category = $category;
|
||||
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param string $slug
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index($slug)
|
||||
{
|
||||
$category = $this->category->findBySlugOrFail($slug);
|
||||
|
||||
return view($this->_config['view'], compact('category'));
|
||||
}
|
||||
}
|
||||
|
|
@ -7,30 +7,31 @@ use Illuminate\Http\Response;
|
|||
use Illuminate\Routing\Controller;
|
||||
use Webkul\Core\Repositories\SliderRepository as Sliders;
|
||||
use Webkul\Channel\Channel as Channel;
|
||||
|
||||
/**
|
||||
* Admin user session controller
|
||||
* Home page controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class HomeController extends controller
|
||||
|
||||
class HomeController extends controller
|
||||
{
|
||||
protected $_config;
|
||||
protected $sliders;
|
||||
protected $current_channel;
|
||||
|
||||
public function __construct(Sliders $s,Channel $c)
|
||||
public function __construct(Sliders $s)
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
$this->sliders = $s;
|
||||
$this->current_channel = $c;
|
||||
|
||||
}
|
||||
public function index() {
|
||||
|
||||
$current_channel = $this->current_channel->getCurrentChannel();
|
||||
$current_channel = core()->getCurrentChannel();
|
||||
|
||||
$all_sliders = $this->sliders->findWhere(['channel_id'=>$current_channel['id']]);
|
||||
$all_sliders = $this->sliders->findOneWhere(['channel_id'=>$current_channel['id']]);
|
||||
|
||||
return view($this->_config['view'])->with('data',$all_sliders);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Shop\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
/**
|
||||
* Product controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class ProductController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('shop::products.index');
|
||||
// return view($this->_config['view']);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,11 +5,10 @@ namespace Webkul\Shop\Http\Controllers;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Webkul\Channel\Channel;
|
||||
use Webkul\Core\Repositories\SliderRepository as Slider;
|
||||
|
||||
/**
|
||||
* Slider controller
|
||||
* Slider controller for managing the slider controls.
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
|
|
@ -44,8 +43,8 @@ class SliderController extends controller
|
|||
*/
|
||||
|
||||
public function create() {
|
||||
$call = new Channel();
|
||||
$channels = $call->getAllChannels();
|
||||
$channels = core()->getAllChannels();
|
||||
|
||||
return view($this->_config['view'])->with('channels',[$channels]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,14 @@ use Illuminate\Support\Collection;
|
|||
|
||||
use Webkul\Category\Repositories\CategoryRepository as Category;
|
||||
|
||||
|
||||
/**
|
||||
* Category List Composer on Navigation Menu
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class CategoryComposer
|
||||
{
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
<?php
|
||||
|
||||
Route::group(['middleware' => ['web']], function () {
|
||||
|
||||
Route::get('/', 'Webkul\Shop\Http\Controllers\HomeController@index')->defaults('_config', [
|
||||
'view' => 'shop::home.index'
|
||||
]);
|
||||
|
||||
Route::get('/categories/{slug}', 'Webkul\Shop\Http\Controllers\ProductController@index')->defaults('_config', [
|
||||
Route::get('/categories/{slug}', 'Webkul\Shop\Http\Controllers\CategoryController@index')->defaults('_config', [
|
||||
'view' => 'shop::products.index'
|
||||
]);
|
||||
|
||||
|
|
@ -21,4 +22,54 @@ Route::group(['middleware' => ['web']], function () {
|
|||
|
||||
Route::view('/customer/payment_complete','shop::customers.checkout.complete');
|
||||
|
||||
});
|
||||
|
||||
Route::view('/cart', 'shop::store.product.view.cart.index');
|
||||
|
||||
Route::view('/products/{slug}', 'shop::store.product.details.index');
|
||||
|
||||
//customer routes starts here
|
||||
Route::prefix('customer')->group(function () {
|
||||
|
||||
// Login Routes
|
||||
Route::get('login', 'Webkul\Customer\Http\Controllers\SessionController@show')->defaults('_config', [
|
||||
'view' => 'shop::customers.session.index',
|
||||
])->name('customer.session.index');
|
||||
|
||||
Route::post('login', 'Webkul\Customer\Http\Controllers\SessionController@create')->defaults('_config', [
|
||||
'redirect' => 'customer.account.profile'
|
||||
])->name('customer.session.create');
|
||||
|
||||
|
||||
// Registration Routes
|
||||
Route::get('register', 'Webkul\Customer\Http\Controllers\RegistrationController@show')->defaults('_config', [
|
||||
'view' => 'shop::customers.signup.index' //hint path
|
||||
])->name('customer.register.index');
|
||||
|
||||
Route::post('register', 'Webkul\Customer\Http\Controllers\RegistrationController@create')->defaults('_config', [
|
||||
'redirect' => 'customer.account.profile',
|
||||
])->name('customer.register.create'); //redirect attribute will get changed immediately to account.index when account's index page will be made
|
||||
|
||||
// Auth Routes
|
||||
Route::group(['middleware' => ['customer']], function () {
|
||||
|
||||
//route for logout which will be under the auth guard of the customer by default
|
||||
Route::get('logout', 'Webkul\Customer\Http\Controllers\SessionController@destroy')->defaults('_config', [
|
||||
'redirect' => 'customer.session.index'
|
||||
])->name('customer.session.destroy');
|
||||
|
||||
//customer account
|
||||
Route::prefix('account')->group(function () {
|
||||
Route::get('profile', 'Webkul\Customer\Http\Controllers\CustomerController@profile')->defaults('_config', [
|
||||
'view' => 'shop::customers.account.profile.index'
|
||||
])->name('customer.account.profile');
|
||||
|
||||
//profile edit
|
||||
Route::get('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@editProfile')->defaults('_config', [
|
||||
'view' => 'shop::customers.account.profile.edit'
|
||||
])->name('customer.profile.edit');
|
||||
});
|
||||
});
|
||||
});
|
||||
//customer routes end here
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="254px" height="236px" viewBox="0 0 254 236" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 50 (54983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>404-image</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Desktop" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.5">
|
||||
<g id="404-page" transform="translate(-960.000000, -288.000000)">
|
||||
<g id="404-image" transform="translate(961.000000, 289.000000)">
|
||||
<polyline id="Path-3" stroke="#242424" stroke-width="3" points="0.626953125 0.990234375 34.3359375 26.4658203 34.6796875 73.1640625 34.3359375 186.773437 160.960938 215.992187 210.71875 130.375 34.3359375 72.71875"></polyline>
|
||||
<g id="Group" transform="translate(46.000000, 190.000000)" fill="#FFFFFF" stroke="#242424" stroke-width="3">
|
||||
<circle id="Oval" cx="22.5" cy="22.5" r="21"></circle>
|
||||
<circle id="Oval" cx="23" cy="23" r="5.5"></circle>
|
||||
</g>
|
||||
<g id="Group" transform="translate(208.000000, 163.000000)" fill="#FFFFFF" stroke="#242424" stroke-width="3">
|
||||
<circle id="Oval" cx="22.5" cy="22.5" r="21"></circle>
|
||||
<circle id="Oval" cx="23" cy="23" r="5.5"></circle>
|
||||
</g>
|
||||
<path d="M178,205 L182,205 L182,208 L178,208 L178,205 Z M185,205 L206,205 L206,208 L185,208 L185,205 Z" id="Combined-Shape" fill="#242424" transform="translate(192.000000, 206.500000) rotate(-23.000000) translate(-192.000000, -206.500000) "></path>
|
||||
<path d="M172.473165,218.350993 L176.473165,218.350993 L176.473165,221.350993 L172.473165,221.350993 L172.473165,218.350993 Z M179.473165,218.350993 L200.473165,218.350993 L200.473165,221.350993 L179.473165,221.350993 L179.473165,218.350993 Z" id="Combined-Shape" fill="#242424" transform="translate(186.473165, 219.850993) rotate(-23.000000) translate(-186.473165, -219.850993) "></path>
|
||||
<path d="M198.610065,126.237911 L222.219028,78.9333292 L163.963322,59.4411726 L147.719875,109.950161 L198.610065,126.237911 Z" id="Path-4" stroke="#242424" stroke-width="3"></path>
|
||||
<polyline id="Path-5" stroke="#242424" stroke-width="3" points="131.557617 105.489258 134.746094 71.9423828 157.437808 79.0096878"></polyline>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="106px" height="16px" viewBox="0 0 106 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 50 (54983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Star-4</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Star-4" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<polygon id="Star" fill="#242424" points="8.41169779 13.2668737 3.21298265 16 4.2058489 10.2111456 2.29816166e-14 6.11145618 5.81234022 5.26687371 8.41169779 0 11.0110554 5.26687371 16.8233956 6.11145618 12.6175467 10.2111456 13.6104129 16"></polygon>
|
||||
<polygon id="Star" fill="#242424" points="31.4116978 13.2668737 26.2129827 16 27.2058489 10.2111456 23 6.11145618 28.8123402 5.26687371 31.4116978 0 34.0110554 5.26687371 39.8233956 6.11145618 35.6175467 10.2111456 36.6104129 16"></polygon>
|
||||
<polygon id="Star" fill="#242424" points="53.4116978 13.2668737 48.2129827 16 49.2058489 10.2111456 45 6.11145618 50.8123402 5.26687371 53.4116978 0 56.0110554 5.26687371 61.8233956 6.11145618 57.6175467 10.2111456 58.6104129 16"></polygon>
|
||||
<polygon id="Star" fill="#242424" points="75.4116978 13.2668737 70.2129827 16 71.2058489 10.2111456 67 6.11145618 72.8123402 5.26687371 75.4116978 0 78.0110554 5.26687371 83.8233956 6.11145618 79.6175467 10.2111456 80.6104129 16"></polygon>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 50 (54983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>icon-grid-view</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Desktop" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Category" transform="translate(-918.000000, -652.000000)" fill="#242424">
|
||||
<g id="icon-grid-view" transform="translate(918.000000, 652.000000)">
|
||||
<rect id="1" x="0" y="0" width="10" height="10"></rect>
|
||||
<rect id="2" x="0" y="14" width="10" height="10"></rect>
|
||||
<rect id="3" x="14" y="0" width="10" height="10"></rect>
|
||||
<rect id="4" x="14" y="14" width="10" height="10"></rect>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 947 B |
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 50 (54983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>icon-list-view</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Desktop" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Category" transform="translate(-952.000000, -652.000000)" fill="#242424">
|
||||
<g id="icon-list-view" transform="translate(952.000000, 652.000000)">
|
||||
<rect id="4" x="0" y="0" width="10" height="10"></rect>
|
||||
<rect id="4" x="0" y="14" width="10" height="10"></rect>
|
||||
<rect id="Rectangle-4" x="12" y="0" width="12" height="3"></rect>
|
||||
<rect id="Rectangle-4-Copy" x="12" y="5" width="10" height="3"></rect>
|
||||
<rect id="Rectangle-4" x="12" y="14" width="12" height="3"></rect>
|
||||
<rect id="Rectangle-4-Copy" x="12" y="19" width="10" height="3"></rect>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 50 (54983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>icon-share</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="icon-share" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M17.6017572,10.3626848 L17.6017572,8.97307668 L17.7423684,8.6716255 C18.0755216,7.95739026 18.7398682,7.5 19.5457911,7.5 C20.1894353,7.5 20.7487974,7.78098589 21.2150301,8.2450489 L25.7080449,12.7380637 L26.4358083,14.1586418 L25.673421,15.4378805 L25.5412491,15.5700523 L21.4220501,19.6885211 C20.7714032,20.3058878 20.2492699,20.6394498 19.5457911,20.6394498 C18.4975787,20.6394498 17.9427193,19.9473628 17.6730945,19.0185829 L17.6136225,18.8137191 L17.6136225,17.7824848 L17.0348214,17.7824848 C14.7402618,18.0465879 13.3365725,18.4574553 12.9871802,18.8050312 C12.8906505,18.901059 12.7357942,19.3763592 12.6365699,20.1145364 C12.6079463,20.3274811 12.5836405,20.5556138 12.5597427,20.8255333 C12.5451306,20.9905732 12.4990927,21.5648652 12.5023767,21.5251552 C12.4357011,22.3313848 12.3949365,22.6163508 12.2061579,22.9983804 C11.452927,24.5226869 9.71842249,24.8652049 8.74190088,23.2916804 C8.3315068,22.6303892 8.01010578,21.536647 7.69057879,19.8821889 C7.45964356,18.6864444 7.38096076,16.8312152 7.7443344,15.6617817 C8.1616307,14.3188106 8.80512846,13.2419676 9.75271558,12.4112199 C11.2470104,11.1011747 13.3610793,10.4388485 16.0925932,10.3626848 L17.6017572,10.3626848 Z" id="Path-4" stroke="#242424" stroke-width="3"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 928 B After Width: | Height: | Size: 928 B |
|
Before Width: | Height: | Size: 905 B After Width: | Height: | Size: 905 B |
|
|
@ -8,7 +8,7 @@ Vue.use(VeeValidate);
|
|||
|
||||
Vue.component("category-nav", require("./components/category-nav.vue"));
|
||||
Vue.component("category-item", require("./components/category-item.vue"));
|
||||
Vue.component("image-slider", require("./components/imageSlider.vue"));
|
||||
Vue.component("image-slider", require("./components/image-slider.vue"));
|
||||
Vue.component("vue-slider", require("vue-slider-component"));
|
||||
|
||||
$(document).ready(function () {
|
||||
|
|
|
|||