Modify menu system and added decimal validator

This commit is contained in:
jitendra 2018-12-12 15:09:20 +05:30
parent 9d41172512
commit 7f65c3327a
16 changed files with 489 additions and 346 deletions

7
config/acl.php Normal file
View File

@ -0,0 +1,7 @@
<?php
return [
];
?>

13
config/menu.php Normal file
View File

@ -0,0 +1,13 @@
<?php
return [
'admin' => [
],
'customer' => [
]
];
?>

View File

@ -0,0 +1,152 @@
<?php
return [
[
'key' => 'dashboard',
'name' => 'Dashboard',
'route' => 'admin.dashboard.index',
'sort' => 1
], [
'key' => 'sales',
'name' => 'Sales',
'route' => 'admin.sales.orders.index',
'sort' => 2
], [
'key' => 'sales.orders',
'name' => 'Orders',
'route' => 'admin.sales.orders.index',
'sort' => 1
], [
'key' => 'sales.invoices',
'name' => 'Invoices',
'route' => 'admin.sales.invoices.index',
'sort' => 2
], [
'key' => 'sales.shipments',
'name' => 'Shipments',
'route' => 'admin.sales.shipments.index',
'sort' => 3
], [
'key' => 'catalog',
'name' => 'Catalog',
'route' => 'admin.catalog.index',
'sort' => 3
], [
'key' => 'catalog.products',
'name' => 'Products',
'route' => 'admin.catalog.products.index',
'sort' => 1
], [
'key' => 'catalog.categories',
'name' => 'Categories',
'route' => 'admin.catalog.categories.index',
'sort' => 2
], [
'key' => 'catalog.attributes',
'name' => 'Attributes',
'route' => 'admin.catalog.attributes.index',
'sort' => 3
], [
'key' => 'catalog.families',
'name' => 'Families',
'route' => 'admin.catalog.families.index',
'sort' => 4
], [
'key' => 'customers',
'name' => 'Customers',
'route' => 'admin.customers.index',
'sort' => 4
], [
'key' => 'customers.customers',
'name' => 'Customers',
'route' => 'admin.customers.index',
'sort' => 1
], [
'key' => 'customers.groups',
'name' => 'Groups',
'route' => 'admin.groups.index',
'sort' => 2
], [
'key' => 'customers.reviews',
'name' => 'Reviews',
'route' => 'admin.customers.reviews.index',
'sort' => 3
], [
'key' => 'configuration',
'name' => 'Configure',
'route' => 'admin.account.edit',
'sort' => 1
], [
'key' => 'configuration',
'name' => 'Configure',
'route' => 'admin.account.edit',
'sort' => 1
], [
'key' => 'settings',
'name' => 'Settings',
'route' => 'admin.users.index',
'sort' => 6
], [
'key' => 'settings.locales',
'name' => 'Locales',
'route' => 'admin.locales.index',
'sort' => 1
], [
'key' => 'settings.currencies',
'name' => 'Currencies',
'route' => 'admin.currencies.index',
'sort' => 2
], [
'key' => 'settings.exchange_rates',
'name' => 'Exchange Rates',
'route' => 'admin.exchange_rates.index',
'sort' => 3
], [
'key' => 'settings.inventory_sources',
'name' => 'Inventory Sources',
'route' => 'admin.inventory_sources.index',
'sort' => 4
], [
'key' => 'settings.channels',
'name' => 'Channels',
'route' => 'admin.channels.index',
'sort' => 5
], [
'key' => 'settings.users',
'name' => 'Users',
'route' => 'admin.users.index',
'sort' => 6
], [
'key' => 'settings.users.users',
'name' => 'Users',
'route' => 'admin.users.index',
'sort' => 1
], [
'key' => 'settings.users.roles',
'name' => 'Roles',
'route' => 'admin.roles.index',
'sort' => 1
], [
'key' => 'settings.sliders',
'name' => 'Sliders',
'route' => 'admin.sliders.index',
'sort' => 7
], [
'key' => 'settings.taxes',
'name' => 'Taxes',
'route' => 'admin.tax-categories.index',
'sort' => 8
], [
'key' => 'settings.taxes.tax-categories',
'name' => 'Tax Categories',
'route' => 'admin.tax-categories.index',
'sort' => 1
], [
'key' => 'settings.taxes.tax-rates',
'name' => 'Tax Rates',
'route' => 'admin.tax-rates.index',
'sort' => 2
]
];
?>

View File

@ -1,61 +0,0 @@
<?php
return [
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
'customer' =>[
'driver' => 'session',
'provider' => 'customers'
],
'admin' => [
'driver' => 'session',
'provider' => 'admins'
],
'admin-api' => [
'driver' => 'token',
'provider' => 'admins',
]
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => Webkul\User\Models\User::class,
],
'customers' => [
'driver' => 'eloquent',
'model' => Webkul\Customer\Models\Customer::class,
],
'admins' => [
'driver' => 'eloquent',
'model' => Webkul\User\Models\Admin::class,
]
],
'passwords' => [
'admins' => [
'provider' => 'admins',
'table' => 'admin_password_resets',
'expire' => 60,
],
'customers' => [
'provider' => 'customers',
'table' => 'customer_password_resets',
'expire' => 60,
],
],
];

View File

@ -0,0 +1,200 @@
<?php
return [
[
'key' => 'dashboard',
'name' => 'Dashboard',
'route' => 'admin.dashboard.index',
'sort' => 1,
'icon-class' => 'dashboard-icon',
], [
'key' => 'sales',
'name' => 'Sales',
'route' => 'admin.sales.orders.index',
'sort' => 2,
'icon-class' => 'sales-icon',
], [
'key' => 'sales.orders',
'name' => 'Orders',
'route' => 'admin.sales.orders.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'sales.shipments',
'name' => 'Shipments',
'route' => 'admin.sales.shipments.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'sales.invoices',
'name' => 'Invoices',
'route' => 'admin.sales.invoices.index',
'sort' => 3,
'icon-class' => '',
],
[
'key' => 'catalog',
'name' => 'Catalog',
'route' => 'admin.catalog.products.index',
'sort' => 3,
'icon-class' => 'catalog-icon',
], [
'key' => 'catalog.products',
'name' => 'Products',
'route' => 'admin.catalog.products.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'catalog.categories',
'name' => 'Categories',
'route' => 'admin.catalog.categories.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'catalog.attributes',
'name' => 'Attributes',
'route' => 'admin.catalog.attributes.index',
'sort' => 3,
'icon-class' => '',
], [
'key' => 'catalog.families',
'name' => 'Families',
'route' => 'admin.catalog.families.index',
'sort' => 4,
'icon-class' => '',
], [
'key' => 'customers',
'name' => 'Customers',
'route' => 'admin.customer.index',
'sort' => 4,
'icon-class' => 'customer-icon',
], [
'key' => 'customers.customers',
'name' => 'Customers',
'route' => 'admin.customer.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'customers.groups',
'name' => 'Groups',
'route' => 'admin.groups.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'customers.reviews',
'name' => 'Reviews',
'route' => 'admin.customer.review.index',
'sort' => 3,
'icon-class' => '',
], [
'key' => 'customers.subscribers',
'name' => 'Newsletter Subscription',
'route' => 'admin.customers.subscribers.index',
'sort' => 4,
'icon-class' => '',
], [
'key' => 'configuration',
'name' => 'Configure',
'route' => 'admin.account.edit',
'sort' => 5,
'icon-class' => 'configuration-icon',
], [
'key' => 'configuration.account',
'name' => 'My Account',
'route' => 'admin.account.edit',
'sort' => 1,
'icon-class' => '',
],
[
'key' => 'configuration.sales',
'name' => 'Sales',
'route' => 'admin.configuration.sales.shipping_methods',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'configuration.sales.shipping_method',
'name' => 'Shipping Methods',
'route' => 'admin.configuration.sales.shipping_methods',
'sort' => 1,
'icon-class' => '',
],
[
'key' => 'settings',
'name' => 'Settings',
'route' => 'admin.locales.index',
'sort' => 6,
'icon-class' => 'settings-icon',
], [
'key' => 'settings.locales',
'name' => 'Locales',
'route' => 'admin.locales.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'settings.currencies',
'name' => 'Currencies',
'route' => 'admin.currencies.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'settings.exchange_rates',
'name' => 'Exchange Rates',
'route' => 'admin.exchange_rates.index',
'sort' => 3,
'icon-class' => '',
], [
'key' => 'settings.inventory_sources',
'name' => 'Inventory Sources',
'route' => 'admin.inventory_sources.index',
'sort' => 4,
'icon-class' => '',
], [
'key' => 'settings.channels',
'name' => 'Channels',
'route' => 'admin.channels.index',
'sort' => 5,
'icon-class' => '',
], [
'key' => 'settings.users',
'name' => 'Users',
'route' => 'admin.users.index',
'sort' => 6,
'icon-class' => '',
], [
'key' => 'settings.users.users',
'name' => 'Users',
'route' => 'admin.users.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'settings.users.roles',
'name' => 'Roles',
'route' => 'admin.roles.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'settings.sliders',
'name' => 'Sliders',
'route' => 'admin.sliders.index',
'sort' => 7,
'icon-class' => '',
], [
'key' => 'settings.taxes',
'name' => 'Taxes',
'route' => 'admin.tax-categories.index',
'sort' => 8,
'icon-class' => '',
], [
'key' => 'settings.taxes.tax-categories',
'name' => 'Tax Categories',
'route' => 'admin.tax-categories.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'settings.taxes.tax-rates',
'name' => 'Tax Rates',
'route' => 'admin.tax-rates.index',
'sort' => 2,
'icon-class' => '',
]
];

View File

@ -40,6 +40,16 @@ class AdminServiceProvider extends ServiceProvider
Handler::class
);
}
/**
* Register services.
*
* @return void
*/
public function register()
{
$this->registerConfig();
}
/**
* Bind the the data to the views
@ -78,18 +88,20 @@ class AdminServiceProvider extends ServiceProvider
$view->with('menu', $menu)->with('subMenus', $subMenus)->with('tabs', $tabs);
});
}
/**
* Merge the given configuration with the existing configuration.
* Register package config.
*
* @param string $path
* @param string $key
* @return void
*/
protected function mergeConfigFrom($path, $key)
protected function registerConfig()
{
$config = $this->app['config']->get($key, []);
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/menu.php', 'menu.admin'
);
$this->app['config']->set($key, array_merge($config, require $path));
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/acl.php', 'acl'
);
}
}
}

View File

@ -10,205 +10,6 @@ use Webkul\Admin\ProductFormAccordian;
class EventServiceProvider extends ServiceProvider
{
protected $menuItems = [
[
'key' => 'dashboard',
'name' => 'Dashboard',
'route' => 'admin.dashboard.index',
'sort' => 1,
'icon-class' => 'dashboard-icon',
], [
'key' => 'sales',
'name' => 'Sales',
'route' => 'admin.sales.orders.index',
'sort' => 2,
'icon-class' => 'sales-icon',
], [
'key' => 'sales.orders',
'name' => 'Orders',
'route' => 'admin.sales.orders.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'sales.shipments',
'name' => 'Shipments',
'route' => 'admin.sales.shipments.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'sales.invoices',
'name' => 'Invoices',
'route' => 'admin.sales.invoices.index',
'sort' => 3,
'icon-class' => '',
],
[
'key' => 'catalog',
'name' => 'Catalog',
'route' => 'admin.catalog.products.index',
'sort' => 3,
'icon-class' => 'catalog-icon',
], [
'key' => 'catalog.products',
'name' => 'Products',
'route' => 'admin.catalog.products.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'catalog.categories',
'name' => 'Categories',
'route' => 'admin.catalog.categories.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'catalog.attributes',
'name' => 'Attributes',
'route' => 'admin.catalog.attributes.index',
'sort' => 3,
'icon-class' => '',
], [
'key' => 'catalog.families',
'name' => 'Families',
'route' => 'admin.catalog.families.index',
'sort' => 4,
'icon-class' => '',
], [
'key' => 'customers',
'name' => 'Customers',
'route' => 'admin.customer.index',
'sort' => 4,
'icon-class' => 'customer-icon',
], [
'key' => 'customers.customers',
'name' => 'Customers',
'route' => 'admin.customer.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'customers.groups',
'name' => 'Groups',
'route' => 'admin.groups.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'customers.reviews',
'name' => 'Reviews',
'route' => 'admin.customer.review.index',
'sort' => 3,
'icon-class' => '',
], [
'key' => 'customers.subscribers',
'name' => 'Newsletter Subscription',
'route' => 'admin.customers.subscribers.index',
'sort' => 4,
'icon-class' => '',
], [
'key' => 'configuration',
'name' => 'Configure',
'route' => 'admin.account.edit',
'sort' => 5,
'icon-class' => 'configuration-icon',
], [
'key' => 'configuration.account',
'name' => 'My Account',
'route' => 'admin.account.edit',
'sort' => 1,
'icon-class' => '',
],
[
'key' => 'configuration.sales',
'name' => 'Sales',
'route' => 'admin.configuration.sales.shipping_methods',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'configuration.sales.shipping_method',
'name' => 'Shipping Methods',
'route' => 'admin.configuration.sales.shipping_methods',
'sort' => 1,
'icon-class' => '',
],
[
'key' => 'settings',
'name' => 'Settings',
'route' => 'admin.locales.index',
'sort' => 6,
'icon-class' => 'settings-icon',
], [
'key' => 'settings.locales',
'name' => 'Locales',
'route' => 'admin.locales.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'settings.currencies',
'name' => 'Currencies',
'route' => 'admin.currencies.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'settings.exchange_rates',
'name' => 'Exchange Rates',
'route' => 'admin.exchange_rates.index',
'sort' => 3,
'icon-class' => '',
], [
'key' => 'settings.inventory_sources',
'name' => 'Inventory Sources',
'route' => 'admin.inventory_sources.index',
'sort' => 4,
'icon-class' => '',
], [
'key' => 'settings.channels',
'name' => 'Channels',
'route' => 'admin.channels.index',
'sort' => 5,
'icon-class' => '',
], [
'key' => 'settings.users',
'name' => 'Users',
'route' => 'admin.users.index',
'sort' => 6,
'icon-class' => '',
], [
'key' => 'settings.users.users',
'name' => 'Users',
'route' => 'admin.users.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'settings.users.roles',
'name' => 'Roles',
'route' => 'admin.roles.index',
'sort' => 2,
'icon-class' => '',
], [
'key' => 'settings.sliders',
'name' => 'Sliders',
'route' => 'admin.sliders.index',
'sort' => 7,
'icon-class' => '',
], [
'key' => 'settings.taxes',
'name' => 'Taxes',
'route' => 'admin.tax-categories.index',
'sort' => 8,
'icon-class' => '',
], [
'key' => 'settings.taxes.tax-categories',
'name' => 'Tax Categories',
'route' => 'admin.tax-categories.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'settings.taxes.tax-rates',
'name' => 'Tax Rates',
'route' => 'admin.tax-rates.index',
'sort' => 2,
'icon-class' => '',
]
];
/**
* Bootstrap services.
*
@ -247,7 +48,7 @@ class EventServiceProvider extends ServiceProvider
});
Event::listen('admin.menu.build', function ($menu) {
foreach($this->menuItems as $item){
foreach(config('menu.admin') as $item) {
if (bouncer()->hasPermission($item['key'])) {
$menu->add($item['key'], $item['name'], $item['route'], $item['sort'], $item['icon-class']);
}
@ -263,61 +64,9 @@ class EventServiceProvider extends ServiceProvider
public function buildACL()
{
Event::listen('admin.acl.build', function ($acl) {
$acl->add('dashboard', 'Dashboard', 'admin.dashboard.index', 1);
$acl->add('sales', 'Sales', 'admin.sales.orders.index', 2);
$acl->add('sales.orders', 'Orders', 'admin.sales.orders.index', 1);
$acl->add('sales.invoices', 'Invoices', 'admin.sales.invoices.index', 1);
$acl->add('sales.shipments', 'Shipments', 'admin.sales.shipments.index', 1);
$acl->add('catalog', 'Catalog', 'admin.catalog.index', 3);
$acl->add('catalog.products', 'Products', 'admin.catalog.products.index', 1);
$acl->add('catalog.categories', 'Categories', 'admin.catalog.categories.index', 2);
$acl->add('catalog.attributes', 'Attributes', 'admin.catalog.attributes.index', 3);
$acl->add('catalog.families', 'Families', 'admin.catalog.families.index', 4);
$acl->add('customers', 'Customers', 'admin.customers.index', 4);
$acl->add('customers.customers', 'Customers', 'admin.customers.index', 1);
$acl->add('customers.groups', 'Groups', 'admin.groups.index', 2);
$acl->add('customers.reviews', 'Reviews', 'admin.customers.reviews.index', 3);
$acl->add('configuration', 'Configure', 'admin.account.edit', 5);
$acl->add('settings', 'Settings', 'admin.users.index', 6);
$acl->add('settings.locales', 'Locales', 'admin.locales.index', 1);
$acl->add('settings.currencies', 'Currencies', 'admin.currencies.index', 2);
$acl->add('settings.exchange_rates', 'Exchange Rates', 'admin.exchange_rates.index', 3);
$acl->add('settings.inventory_sources', 'Inventory Sources', 'admin.inventory_sources.index', 4);
$acl->add('settings.channels', 'Channels', 'admin.channels.index', 5);
$acl->add('settings.users', 'Users', 'admin.users.index', 6);
$acl->add('settings.users.users', 'Users', 'admin.users.index', 1);
$acl->add('settings.users.roles', 'Roles', 'admin.roles.index', 2);
$acl->add('settings.sliders', 'Sliders', 'admin.sliders.index', 7);
$acl->add('settings.taxes', 'Taxes', 'admin.tax-categories.index', 7);
$acl->add('settings.taxes.tax-categories', 'Tax Categories', 'admin.tax-categories.index', 1);
$acl->add('settings.taxes.tax-rates', 'Tax Rates', 'admin.tax-rates.index', 2);
foreach(config('acl') as $item) {
$acl->add($item['key'], $item['name'], $item['route'], $item['sort']);
}
});
}

View File

@ -103,8 +103,8 @@
<select class="control" id="validation" name="validation">
<option value=""></option>
<option value="numeric">{{ __('admin::app.catalog.attributes.number') }}</option>
<option value="decimal">{{ __('admin::app.catalog.attributes.decimal') }}</option>
<option value="email">{{ __('admin::app.catalog.attributes.email') }}</option>
<option value="decimal">{{ __('admin::app.catalog.attributes.decimal') }}</option>
<option value="url">{{ __('admin::app.catalog.attributes.url') }}</option>
</select>
</div>

View File

@ -128,7 +128,7 @@
<label for="validation">{{ __('admin::app.catalog.attributes.input_validation') }}</label>
<select class="control" id="validation" name="validation">
<option value=""></option>
<option value="number" {{ $selectedValidation == 'number' ? 'selected' : '' }}>
<option value="numeric" {{ $selectedValidation == 'number' ? 'selected' : '' }}>
{{ __('admin::app.catalog.attributes.number') }}
</option>
<option value="decimal" {{ $selectedValidation == 'decimal' ? 'selected' : '' }}>

View File

@ -26,17 +26,17 @@ class AttributeTableSeeder extends Seeder
['id' => '8','code' => 'status','admin_name' => 'Status','type' => 'boolean','validation' => NULL,'position' => '8','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '9','code' => 'short_description','admin_name' => 'Short Description','type' => 'textarea','validation' => NULL,'position' => '9','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '10','code' => 'description','admin_name' => 'Description','type' => 'textarea','validation' => NULL,'position' => '10','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '11','code' => 'price','admin_name' => 'Price','type' => 'price','validation' => NULL,'position' => '11','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '12','code' => 'cost','admin_name' => 'Cost','type' => 'price','validation' => NULL,'position' => '12','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '13','code' => 'special_price','admin_name' => 'Special Price','type' => 'price','validation' => NULL,'position' => '13','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '11','code' => 'price','admin_name' => 'Price','type' => 'price','validation' => 'decimal','position' => '11','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '12','code' => 'cost','admin_name' => 'Cost','type' => 'price','validation' => 'decimal','position' => '12','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '13','code' => 'special_price','admin_name' => 'Special Price','type' => 'price','validation' => 'decimal','position' => '13','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '14','code' => 'special_price_from','admin_name' => 'Special Price From','type' => 'date','validation' => NULL,'position' => '14','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '15','code' => 'special_price_to','admin_name' => 'Special Price To','type' => 'date','validation' => NULL,'position' => '15','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '16','code' => 'meta_title','admin_name' => 'Meta Title','type' => 'textarea','validation' => NULL,'position' => '16','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '17','code' => 'meta_keywords','admin_name' => 'Meta Keywords','type' => 'textarea','validation' => NULL,'position' => '17','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '18','code' => 'meta_description','admin_name' => 'Meta Description','type' => 'textarea','validation' => NULL,'position' => '18','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '19','code' => 'width','admin_name' => 'Width','type' => 'text','validation' => NULL,'position' => '19','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '20','code' => 'height','admin_name' => 'Height','type' => 'text','validation' => NULL,'position' => '20','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '21','code' => 'depth','admin_name' => 'Depth','type' => 'text','validation' => NULL,'position' => '21','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '19','code' => 'width','admin_name' => 'Width','type' => 'text','validation' => 'decimal','position' => '19','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '20','code' => 'height','admin_name' => 'Height','type' => 'text','validation' => 'decimal','position' => '20','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '21','code' => 'depth','admin_name' => 'Depth','type' => 'text','validation' => 'decimal','position' => '21','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '22','code' => 'weight','admin_name' => 'Weight','type' => 'text','validation' => 'decimal','position' => '22','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '23','code' => 'color','admin_name' => 'Color','type' => 'select','validation' => NULL,'position' => '23','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '1','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
['id' => '24','code' => 'size','admin_name' => 'Size','type' => 'select','validation' => NULL,'position' => '24','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '1','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now]

View File

@ -0,0 +1,30 @@
<?php
namespace Webkul\Core\Contracts\Validations;
use Illuminate\Contracts\Validation\Rule;
class Decimal implements Rule
{
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
return preg_match('/^\d*(\.\d{1,2})?$/', $value);
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return trans('core::validation.decimal');
}
}

View File

@ -27,6 +27,8 @@ class CoreServiceProvider extends ServiceProvider
Validator::extend('slug', 'Webkul\Core\Contracts\Validations\Slug@passes');
Validator::extend('code', 'Webkul\Core\Contracts\Validations\Code@passes');
Validator::extend('decimal', 'Webkul\Core\Contracts\Validations\Decimal@passes');
}
/**

View File

@ -2,5 +2,6 @@
return [
'slug' => 'The :attribute must be valid slug.',
'code' => 'The :attribute must be valid.'
'code' => 'The :attribute must be valid.',
'decimal' => 'The :attribute must be valid.'
];

View File

@ -0,0 +1,32 @@
<?php
return [
[
'key' => 'account',
'name' => 'My Account',
'route' =>'customer.profile.index',
'sort' => 1
], [
'key' => 'account.profile',
'name' => 'Profile',
'route' =>'customer.profile.index',
'sort' => 1
], [
'key' => 'account.address',
'name' => 'Address',
'route' =>'customer.address.index',
'sort' => 2
], [
'key' => 'account.reviews',
'name' => 'Reviews',
'route' =>'customer.reviews.index',
'sort' => 3
], [
'key' => 'account.wishlist',
'name' => 'Wishlist',
'route' =>'customer.wishlist.index',
'sort' => 4
]
];
?>

View File

@ -54,6 +54,8 @@ class ShopServiceProvider extends ServiceProvider
if (!$themes->current() && \Config::get('themes.default')) {
$themes->set(\Config::get('themes.default'));
}
$this->registerConfig();
}
/**
@ -84,17 +86,21 @@ class ShopServiceProvider extends ServiceProvider
});
Event::listen('customer.menu.build', function ($menu) {
$menu->add('account', 'My Account', 'customer.profile.index', 1);
$menu->add('account.profile', 'Profile', 'customer.profile.index', 1);
$menu->add('account.orders', 'Orders', 'customer.orders.index', 2);
$menu->add('account.address', 'Address', 'customer.address.index', 3);
$menu->add('account.reviews', 'Reviews', 'customer.reviews.index', 4);
$menu->add('account.wishlist', 'Wishlist', 'customer.wishlist.index', 5);
foreach(config('menu.customer') as $item) {
$menu->add($item['key'], $item['name'], $item['route'], $item['sort']);
}
});
}
/**
* Register package config.
*
* @return void
*/
protected function registerConfig()
{
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/menu.php', 'menu.customer'
);
}
}

View File

@ -1,8 +1,8 @@
const { mix } = require("laravel-mix");
require("laravel-mix-merge-manifest");
var publicPath = 'publishable/assets';
// var publicPath = "../../../public/themes/default/assets";
// var publicPath = 'publishable/assets';
var publicPath = "../../../public/themes/default/assets";
mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications();