Fixed issues 314 and 315
This commit is contained in:
commit
d9f0ddc89d
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
];
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'admin' => [
|
||||
|
||||
],
|
||||
|
||||
'customer' => [
|
||||
|
||||
]
|
||||
];
|
||||
|
||||
?>
|
||||
|
|
@ -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
|
||||
]
|
||||
];
|
||||
|
||||
?>
|
||||
|
|
@ -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,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
@ -0,0 +1,180 @@
|
|||
<?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.configuration.index',
|
||||
'sort' => 5,
|
||||
'icon-class' => 'configuration-icon',
|
||||
], [
|
||||
'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' => '',
|
||||
]
|
||||
];
|
||||
|
|
@ -51,6 +51,9 @@ class ConfigurationController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
// if(!request()->route('slug'))
|
||||
// return redirect()->route('admin.configuration.index', ['slug' => 'marketplace']);
|
||||
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,10 @@ Route::group(['middleware' => ['web']], function () {
|
|||
])->name('admin.customer.review.index');
|
||||
|
||||
|
||||
Route::get('configuration/{slug?}/{slug2?}', 'Webkul\Admin\Http\Controllers\ConfigurationController@index')->defaults('_config', [
|
||||
'view' => 'admin::configuration.index'
|
||||
])->name('admin.configuration.index');
|
||||
|
||||
//Shipping Methods Routes
|
||||
Route::get('configuration/sales/shipping-methods', 'Webkul\Admin\Http\Controllers\ConfigurationController@index')->defaults('_config', [
|
||||
'view' => 'admin::configuration.sales.shipping-method'
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class ProductFormAccordian {
|
|||
public static function create($callback) {
|
||||
$accordian = new ProductFormAccordian();
|
||||
$callback($accordian);
|
||||
$accordian->items = $accordian->sortItems($accordian->items);
|
||||
$accordian->items = core()->sortItems($accordian->items);
|
||||
|
||||
return $accordian;
|
||||
}
|
||||
|
|
@ -38,21 +38,4 @@ class ProductFormAccordian {
|
|||
'sort' => $sort
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to sort through the acl items and put them in order
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sortItems($items) {
|
||||
usort($items, function($a, $b) {
|
||||
if ($a['sort'] == $b['sort']) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a['sort'] < $b['sort']) ? -1 : 1;
|
||||
});
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -57,39 +67,33 @@ class AdminServiceProvider extends ServiceProvider
|
|||
view()->composer(['admin::layouts.nav-left', 'admin::layouts.nav-aside', 'admin::layouts.tabs'], function ($view) {
|
||||
$menu = current(Event::fire('admin.menu.create'));
|
||||
|
||||
$keys = explode('.', $menu->currentKey);
|
||||
$subMenus = $tabs = [];
|
||||
if (count($keys) > 1) {
|
||||
$subMenus = [
|
||||
'items' => $menu->sortItems(array_get($menu->items, current($keys) . '.children')),
|
||||
'current' => $menu->current,
|
||||
'currentKey' => $menu->currentKey
|
||||
];
|
||||
$menu->items = core()->sortItems($menu->items);
|
||||
|
||||
if (count($keys) > 2) {
|
||||
$tabs = [
|
||||
'items' => $menu->sortItems(array_get($menu->items, implode('.children.', array_slice($keys, 0, 2)) . '.children')),
|
||||
'current' => $menu->current,
|
||||
'currentKey' => $menu->currentKey
|
||||
];
|
||||
}
|
||||
}
|
||||
$view->with('menu', $menu);
|
||||
});
|
||||
|
||||
$view->with('menu', $menu)->with('subMenus', $subMenus)->with('tabs', $tabs);
|
||||
view()->composer(['admin::layouts.nav-aside', 'admin::layouts.tabs', 'admin::configuration.index'], function ($view) {
|
||||
$tree = current(Event::fire('admin.config.create'));
|
||||
|
||||
$tree->items = core()->sortItems($tree->items);
|
||||
|
||||
$view->with('config', $tree);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,209 +6,11 @@ use Illuminate\Support\ServiceProvider;
|
|||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Webkul\Ui\Menu;
|
||||
use Webkul\Core\Tree;
|
||||
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.
|
||||
*
|
||||
|
|
@ -218,6 +20,8 @@ class EventServiceProvider extends ServiceProvider
|
|||
{
|
||||
$this->createAdminMenu();
|
||||
|
||||
$this->createAdminConfig();
|
||||
|
||||
$this->buildACL();
|
||||
|
||||
$this->registerACL();
|
||||
|
|
@ -241,20 +45,40 @@ class EventServiceProvider extends ServiceProvider
|
|||
public function createAdminMenu()
|
||||
{
|
||||
Event::listen('admin.menu.create', function () {
|
||||
return Menu::create(function ($menu) {
|
||||
return Tree::create(function ($menu) {
|
||||
Event::fire('admin.menu.build', $menu);
|
||||
});
|
||||
});
|
||||
|
||||
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']);
|
||||
$menu->add($item, 'menu');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method fires an event for config creation, any package can add their config item by listening to the admin.config.build event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function createAdminConfig()
|
||||
{
|
||||
Event::listen('admin.config.create', function () {
|
||||
return Tree::create(function ($tree) {
|
||||
Event::fire('admin.config.build', $tree);
|
||||
});
|
||||
});
|
||||
|
||||
Event::listen('admin.config.build', function ($config) {
|
||||
foreach(config('core') as $item) {
|
||||
$config->add($item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Build route based ACL
|
||||
*
|
||||
|
|
@ -263,61 +87,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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -310,6 +310,9 @@ return [
|
|||
],
|
||||
|
||||
'configuration' => [
|
||||
'title' => 'Configuration',
|
||||
'save-btn-title' => 'Save',
|
||||
|
||||
'tax-categories' => [
|
||||
'title' => 'Tax Categories',
|
||||
'add-title' => 'Add Tax Category',
|
||||
|
|
@ -552,14 +555,17 @@ return [
|
|||
'status' => 'Status',
|
||||
'comment' => 'Comment'
|
||||
],
|
||||
|
||||
'subscribers' => [
|
||||
'title' => 'News Letter Subscribers',
|
||||
'title-edit' => 'Edit News Letter Subscriber',
|
||||
'email' => 'Email',
|
||||
'is_subscribed' => 'Subscribed',
|
||||
'edit-btn-title' => 'Update Subscriber',
|
||||
'update-success' => 'You updated subscriber',
|
||||
'update-failed' => 'Error! You cannot unsubscribed the subscriber'
|
||||
'update-success' => 'Subscriber was successfully updated',
|
||||
'update-failed' => 'Error! You cannot unsubscribe the subscriber',
|
||||
'delete-success' => 'Subscriber was successfully deleted',
|
||||
'delete-failed' => 'Erorr! Subscriber cannot be deleted'
|
||||
]
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
@extends('admin::layouts.content')
|
||||
@extends('admin::layouts.master')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.account.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
@section('content-wrapper')
|
||||
<div class="content full-page">
|
||||
<form method="POST" action="" @submit.prevent="onSubmit">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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' : '' }}>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
$validations = [];
|
||||
$disabled = false;
|
||||
|
||||
if (isset($field['validation'])) {
|
||||
array_push($validations, $field['validation']);
|
||||
}
|
||||
|
||||
$validations = implode('|', array_filter($validations));
|
||||
|
||||
$name = $field['title'];
|
||||
?>
|
||||
<div class="control-group {{ $field['type'] }}" :class="[errors.has('{{ $name }}') ? 'has-error' : '']">
|
||||
<label for="{{ $name }}" {{ !isset($field['validation']) || strpos('required', $field['validation']) < 0 ? '' : 'class=required' }}>
|
||||
|
||||
{{ $field['title'] }}
|
||||
|
||||
<?php
|
||||
$channel_locale = [];
|
||||
|
||||
if(isset($field['channel_based']) && $field['channel_based'])
|
||||
{
|
||||
array_push($channel_locale, $channel);
|
||||
}
|
||||
|
||||
if(isset($field['locale_based']) && $field['locale_based']) {
|
||||
array_push($channel_locale, $locale);
|
||||
}
|
||||
?>
|
||||
|
||||
@if(count($channel_locale))
|
||||
<span class="locale">[{{ implode(' - ', $channel_locale) }}]</span>
|
||||
@endif
|
||||
|
||||
</label>
|
||||
|
||||
<?php
|
||||
$configData = core()->getConfigData($name, current($channel_locale), next($channel_locale));
|
||||
?>
|
||||
|
||||
@if ($field['type'] == 'text')
|
||||
|
||||
<input type="text" v-validate="'{{ $validations }}'" class="control" id="{{ $name }}" name="{{ $name }}" value="{{ old($name) ?: core()->getConfigData($name) }}" data-vv-as=""{{ $field['name'] }}"">
|
||||
|
||||
@elseif ($field['type'] == 'textarea')
|
||||
|
||||
<textarea v-validate="'{{ $validations }}'" class="control" id="{{ $name }}" name="{{ $name }}" data-vv-as=""{{ $field['name'] }}"">{{ old($name) ?: core()->getConfigData($name) }}</textarea>
|
||||
|
||||
@elseif ($field['type'] == 'select')
|
||||
|
||||
<select v-validate="'{{ $validations }}'" class="control" id="{{ $name }}" name="{{ $name }}" data-vv-as=""{{ $field['name'] }}"" >
|
||||
|
||||
@foreach($field['options'] as $option)
|
||||
|
||||
<?php
|
||||
if($option['value']) {
|
||||
$value = 1;
|
||||
}else {
|
||||
$value = 0;
|
||||
}
|
||||
|
||||
$selectedOption = core()->getConfigData($name) ?? '';
|
||||
?>
|
||||
|
||||
<option value="{{ $value }}" {{ $value == $selectedOption ? 'selected' : ''}}>
|
||||
{{ $option['title'] }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
|
||||
@endif
|
||||
|
||||
<span class="control-error" v-if="errors.has('{{ $name }}')">@{{ errors.first('{!! $name !!}') }}</span>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.configuration.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<?php $locale = request()->get('locale') ?: app()->getLocale(); ?>
|
||||
<?php $channel = request()->get('channel') ?: core()->getDefaultChannelCode(); ?>
|
||||
|
||||
<form method="POST" action="" @submit.prevent="onSubmit" enctype="multipart/form-data">
|
||||
|
||||
<div class="page-header">
|
||||
|
||||
<div class="page-title">
|
||||
<h1>
|
||||
{{ __('admin::app.configuration.title') }}
|
||||
</h1>
|
||||
|
||||
<div class="control-group">
|
||||
<select class="control" id="channel-switcher" name="channel">
|
||||
@foreach(core()->getAllChannels() as $channelModel)
|
||||
|
||||
<option value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
|
||||
{{ $channelModel->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<select class="control" id="locale-switcher" name="locale">
|
||||
@foreach(core()->getAllLocales() as $localeModel)
|
||||
|
||||
<option value="{{ $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
|
||||
{{ $localeModel->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.configuration.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
@if ($groups = array_get($config->items, request()->route('slug') . '.children.' . request()->route('slug2') . '.children'))
|
||||
|
||||
@foreach ($groups as $key => $item)
|
||||
|
||||
<accordian :title="'{{ __($item['name']) }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
@foreach ($item['fields'] as $field)
|
||||
|
||||
@include ('admin::configuration.field-type', ['field' => $field])
|
||||
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#channel-switcher, #locale-switcher').on('change', function (e) {
|
||||
$('#channel-switcher').val()
|
||||
var query = '?channel=' + $('#channel-switcher').val() + '&locale=' + $('#locale-switcher').val();
|
||||
|
||||
window.location.href = "{{ route('admin.configuration.sales.shipping_methods') }}" + query;
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
|
@ -18,8 +18,3 @@
|
|||
@endforeach
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,37 @@
|
|||
@if(count($subMenus))
|
||||
<div class="aside-nav">
|
||||
<ul>
|
||||
@foreach($subMenus['items'] as $menuItem)
|
||||
<li class="{{ $menu->getActive($menuItem) }}">
|
||||
<a href="{{ $menuItem['url'] }}">
|
||||
{{ $menuItem['name'] }}
|
||||
<div class="aside-nav">
|
||||
<ul>
|
||||
@if (request()->route()->getName() != 'admin.configuration.index')
|
||||
|
||||
@if ($menu->getActive($menuItem))
|
||||
<?php $keys = explode('.', $menu->currentKey); ?>
|
||||
|
||||
@foreach(array_get($menu->items, current($keys) . '.children') as $item)
|
||||
<li class="{{ $menu->getActive($item) }}">
|
||||
<a href="{{ $item['url'] }}">
|
||||
{{ $item['name'] }}
|
||||
|
||||
@if ($menu->getActive($item))
|
||||
<i class="angle-right-icon"></i>
|
||||
@endif
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@else
|
||||
|
||||
@foreach($config->items as $key => $item)
|
||||
|
||||
<li class="{{ $item['key'] == request()->route('slug') ? 'active' : '' }}">
|
||||
<a href="{{ route('admin.configuration.index', $item['key']) }}">
|
||||
{{ isset($item['name']) ? $item['name'] : '' }}
|
||||
|
||||
@if ($item['key'] == request()->route('slug'))
|
||||
<i class="angle-right-icon"></i>
|
||||
@endif
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -1,8 +1,19 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'carriers' => [
|
||||
'free' => [
|
||||
[
|
||||
'key' => 'sales',
|
||||
'name' => 'Sales',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'sales.carriers',
|
||||
'name' => 'Shipping Methods',
|
||||
'sort' => 1,
|
||||
], [
|
||||
'key' => 'sales.carriers.free',
|
||||
'name' => 'Free Shipping',
|
||||
'sort' => 1,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'title',
|
||||
'title' => 'Title',
|
||||
|
|
@ -31,8 +42,12 @@ return [
|
|||
],
|
||||
'validation' => 'required'
|
||||
]
|
||||
],
|
||||
'flatrate' => [
|
||||
]
|
||||
], [
|
||||
'key' => 'sales.carriers.flatrate',
|
||||
'name' => 'Flat Rate Shipping',
|
||||
'sort' => 2,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'title',
|
||||
'title' => 'Title',
|
||||
|
|
@ -1,13 +1,34 @@
|
|||
@if(count($tabs))
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
@foreach($tabs['items'] as $tab)
|
||||
<li class="{{ $menu->getActive($tab) }}">
|
||||
<a href="{{ $tab['url'] }}">
|
||||
{{ $tab['name'] }}
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
@if (request()->route()->getName() != 'admin.configuration.index')
|
||||
|
||||
<?php $keys = explode('.', $menu->currentKey); ?>
|
||||
|
||||
|
||||
@foreach(array_get($menu->items, implode('.children.', array_slice($keys, 0, 2)) . '.children') as $item)
|
||||
<li class="{{ $menu->getActive($item) }}">
|
||||
<a href="{{ $item['url'] }}">
|
||||
{{ $item['name'] }}
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@else
|
||||
|
||||
@if (array_get($config->items, request()->route('slug') . '.children'))
|
||||
|
||||
@foreach (array_get($config->items, request()->route('slug') . '.children') as $key => $item)
|
||||
|
||||
<li class="{{ $key == request()->route('slug2') ? 'active' : '' }}">
|
||||
<a href="{{ route('admin.configuration.index', (request()->route('slug') . '/' . $key)) }}">
|
||||
{{ $item['name'] }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
@ -608,4 +608,99 @@ class Core
|
|||
return date('Y-m-d', $end);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to sort through the acl items and put them in order
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sortItems($items) {
|
||||
foreach ($items as &$item) {
|
||||
if(count($item['children'])) {
|
||||
$item['children'] = $this->sortItems($item['children']);
|
||||
}
|
||||
}
|
||||
|
||||
usort($items, function($a, $b) {
|
||||
if ($a['sort'] == $b['sort']) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a['sort'] < $b['sort']) ? -1 : 1;
|
||||
});
|
||||
|
||||
return $this->convertToAssociativeArray($items);
|
||||
}
|
||||
|
||||
public function convertToAssociativeArray($items)
|
||||
{
|
||||
foreach ($items as $key1 => $level1) {
|
||||
unset($items[$key1]);
|
||||
$items[$level1['key']] = $level1;
|
||||
|
||||
if(count($level1['children'])) {
|
||||
foreach ($level1['children'] as $key2 => $level2) {
|
||||
$temp2 = explode('.', $level2['key']);
|
||||
$finalKey2 = end($temp2);
|
||||
unset($items[$level1['key']]['children'][$key2]);
|
||||
$items[$level1['key']]['children'][$finalKey2] = $level2;
|
||||
|
||||
if(count($level2['children'])) {
|
||||
foreach ($level2['children'] as $key3 => $level3) {
|
||||
$temp3 = explode('.', $level3['key']);
|
||||
$finalKey3 = end($temp3);
|
||||
unset($items[$level1['key']]['children'][$finalKey2]['children'][$key3]);
|
||||
$items[$level1['key']]['children'][$finalKey2]['children'][$finalKey3] = $level3;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
public function array_set(&$array, $key, $value)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
return $array = $value;
|
||||
}
|
||||
|
||||
$keys = explode('.', $key);
|
||||
$count = count($keys);
|
||||
|
||||
while (count($keys) > 1) {
|
||||
$key = array_shift($keys);
|
||||
|
||||
if (! isset($array[$key]) || ! is_array($array[$key])) {
|
||||
$array[$key] = [];
|
||||
}
|
||||
|
||||
$array = &$array[$key];
|
||||
}
|
||||
|
||||
$finalKey = array_shift($keys);
|
||||
if(isset($array[$finalKey])) {
|
||||
$array[$finalKey] = $this->arrayMerge($array[$finalKey], $value);
|
||||
} else {
|
||||
$array[$finalKey] = $value;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
protected function arrayMerge(array &$array1, array &$array2)
|
||||
{
|
||||
$merged = $array1;
|
||||
foreach ($array2 as $key => &$value) {
|
||||
if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
|
||||
$merged[$key] = $this->arrayMerge($merged[$key], $value);
|
||||
} else {
|
||||
$merged[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $merged;
|
||||
}
|
||||
}
|
||||
|
|
@ -74,9 +74,9 @@ class SubscriptionController extends Controller
|
|||
$result = $subscriber->update($data);
|
||||
|
||||
if($result)
|
||||
session()->flash('success', trans('admin::app.settings.subscribers.update-success'));
|
||||
session()->flash('success', trans('admin::app.customers.subscribers.update-success'));
|
||||
else
|
||||
session()->flash('error', trans('admin::app.settings.subscribers.update-failed'));
|
||||
session()->flash('error', trans('admin::app.customers.subscribers.update-failed'));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
|
@ -89,7 +89,10 @@ class SubscriptionController extends Controller
|
|||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->subscribers->delete($id);
|
||||
if($this->subscribers->delete($id))
|
||||
session()->flash('success', 'admin::app.customers.subscribers.delete-success');
|
||||
else
|
||||
session()->flash('success', 'admin::app.customers.subscribers.delete-failed');
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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.'
|
||||
];
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core;
|
||||
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
class Tree {
|
||||
|
||||
public $items = [];
|
||||
|
||||
public $current;
|
||||
|
||||
public $currentKey;
|
||||
|
||||
public function __construct() {
|
||||
$this->current = Request::url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut method for create a Config with a callback.
|
||||
* This will allow you to do things like fire an event on creation.
|
||||
*
|
||||
* @param callable $callback Callback to use after the Config creation
|
||||
* @return object
|
||||
*/
|
||||
public static function create($callback) {
|
||||
$tree = new Tree();
|
||||
$callback($tree);
|
||||
|
||||
return $tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Config item to the item stack
|
||||
*
|
||||
* @param string $item Dot seperated heirarchy
|
||||
*/
|
||||
public function add($item, $type = '')
|
||||
{
|
||||
$item['children'] = [];
|
||||
|
||||
if ($type == 'menu') {
|
||||
$item['url'] = route($item['route']);
|
||||
|
||||
if (strpos($this->current, $item['url']) !== false) {
|
||||
$this->currentKey = $item['key'];
|
||||
}
|
||||
}
|
||||
|
||||
$children = str_replace('.', '.children.', $item['key']);
|
||||
core()->array_set($this->items, $children, $item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to find the active links
|
||||
*
|
||||
* @param array $item Item that needs to be checked if active
|
||||
* @return string
|
||||
*/
|
||||
public function getActive($item)
|
||||
{
|
||||
$url = trim($item['url'], '/');
|
||||
|
||||
if ((strpos($this->current, $url) !== false) || (strpos($this->currentKey, $item['key']) === 0)) {
|
||||
return 'active';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -83,7 +83,6 @@ class RegistrationController extends Controller
|
|||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
} else {
|
||||
session()->flash('error', trans('shop::app.customer.signup-form.failed'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
[
|
||||
'key' => 'sales',
|
||||
'name' => 'Sales',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'sales.carriers',
|
||||
'name' => 'Shipping Methods',
|
||||
'sort' => 1,
|
||||
], [
|
||||
'key' => 'sales.carriers.free',
|
||||
'name' => 'Free Shipping',
|
||||
'sort' => 1,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'title',
|
||||
'title' => 'Title',
|
||||
'type' => 'text',
|
||||
'validation' => 'required',
|
||||
'channel_based' => false,
|
||||
'locale_based' => true
|
||||
], [
|
||||
'name' => 'description',
|
||||
'title' => 'Description',
|
||||
'type' => 'textarea',
|
||||
'channel_based' => false,
|
||||
'locale_based' => true
|
||||
], [
|
||||
'name' => 'active',
|
||||
'title' => 'Status',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
[
|
||||
'title' => 'Active',
|
||||
'value' => true
|
||||
], [
|
||||
'title' => 'Inactive',
|
||||
'value' => false
|
||||
]
|
||||
],
|
||||
'validation' => 'required'
|
||||
]
|
||||
]
|
||||
], [
|
||||
'key' => 'sales.carriers.flatrate',
|
||||
'name' => 'Flat Rate Shipping',
|
||||
'sort' => 2,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'title',
|
||||
'title' => 'Title',
|
||||
'type' => 'text',
|
||||
'validation' => 'required',
|
||||
'channel_based' => true,
|
||||
'locale_based' => true
|
||||
], [
|
||||
'name' => 'description',
|
||||
'title' => 'Description',
|
||||
'type' => 'textarea',
|
||||
'channel_based' => true,
|
||||
'locale_based' => false
|
||||
], [
|
||||
'name' => 'active',
|
||||
'title' => 'Status',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
[
|
||||
'title' => 'Active',
|
||||
'value' => true
|
||||
], [
|
||||
'title' => 'Inactive',
|
||||
'value' => false
|
||||
]
|
||||
],
|
||||
'validation' => 'required'
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
@ -60,7 +60,7 @@ class ShippingServiceProvider extends ServiceProvider
|
|||
);
|
||||
|
||||
$this->mergeConfigFrom(
|
||||
dirname(__DIR__) . '/Config/fields.php', 'core'
|
||||
dirname(__DIR__) . '/Config/system.php', 'core'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,16 +1,4 @@
|
|||
{
|
||||
<<<<<<< HEAD
|
||||
"/js/shop.js": "/js/shop.js?id=ec33679ba3719e48cea6",
|
||||
"/css/shop.css": "/css/shop.css?id=0f78d361a01660ffd946"
|
||||
}
|
||||
=======
|
||||
<<<<<<< HEAD
|
||||
"/js/shop.js": "/js/shop.js?id=c7fe085a512d913b6670",
|
||||
"/css/shop.css": "/css/shop.css?id=77c5b3c611d7a0e05d7e"
|
||||
}
|
||||
=======
|
||||
"/js/shop.js": "/js/shop.js?id=c6ba9f43bd31f175a665",
|
||||
"/css/shop.css": "/css/shop.css?id=637386a2fb6b1de9c4c4"
|
||||
}
|
||||
>>>>>>> 5f5249abe4a1447708683968edd5ea610d7d25dc
|
||||
>>>>>>> e4530c0965b2c02ec2930313f2ec652a09f49cff
|
||||
"/css/shop.css": "/css/shop.css?id=585481fe8a712f48839d"
|
||||
}
|
||||
|
|
@ -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
|
||||
]
|
||||
];
|
||||
|
||||
?>
|
||||
|
|
@ -78,27 +78,37 @@ class SubscriptionController extends Controller
|
|||
if($unique()) {
|
||||
$token = uniqid();
|
||||
|
||||
$result = false;
|
||||
|
||||
$result = $this->subscription->create([
|
||||
'email' => $email,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'is_subscribed' => 1,
|
||||
'token' => $token
|
||||
]);
|
||||
|
||||
if(!$result) {
|
||||
session()->flash('error', trans('shop::app.subscription.not-subscribed'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$subscriptionData['email'] = $email;
|
||||
$subscriptionData['token'] = $token;
|
||||
|
||||
Mail::send(new SubscriptionEmail($subscriptionData));
|
||||
$mailSent = true;
|
||||
|
||||
session()->flash('success', trans('shop::app.subscription.subscribed'));
|
||||
try {
|
||||
session()->flash('success', trans('shop::app.subscription.subscribed'));
|
||||
|
||||
Mail::send(new SubscriptionEmail($subscriptionData));
|
||||
} catch(\Exception $e) {
|
||||
session()->flash('error', trans('shop::app.subscription.not-subscribed'));
|
||||
|
||||
$mailSent = false;
|
||||
}
|
||||
|
||||
$result = false;
|
||||
|
||||
if($mailSent) {
|
||||
$result = $this->subscription->create([
|
||||
'email' => $email,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'is_subscribed' => 1,
|
||||
'token' => $token
|
||||
]);
|
||||
|
||||
if(!$result) {
|
||||
session()->flash('error', trans('shop::app.subscription.not-subscribed'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
session()->flash('error', trans('shop::app.subscription.already'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use Webkul\Shop\Http\Middleware\Locale;
|
|||
use Webkul\Shop\Http\Middleware\Theme;
|
||||
use Webkul\Shop\Http\Middleware\Currency;
|
||||
use Webkul\Shop\Providers\ComposerServiceProvider;
|
||||
use Webkul\Ui\Menu;
|
||||
use Webkul\Core\Tree;
|
||||
|
||||
class ShopServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -58,6 +58,8 @@ class ShopServiceProvider extends ServiceProvider
|
|||
if (!$themes->current() && \Config::get('themes.default')) {
|
||||
$themes->set(\Config::get('themes.default'));
|
||||
}
|
||||
|
||||
$this->registerConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -82,23 +84,27 @@ class ShopServiceProvider extends ServiceProvider
|
|||
public function createCustomerMenu()
|
||||
{
|
||||
Event::listen('customer.menu.create', function () {
|
||||
return Menu::create(function ($menu) {
|
||||
Event::fire('customer.menu.build', $menu);
|
||||
return Tree::create(function ($tree) {
|
||||
Event::fire('customer.menu.build', $tree);
|
||||
});
|
||||
});
|
||||
|
||||
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);
|
||||
Event::listen('customer.menu.build', function ($tree) {
|
||||
foreach(config('menu.customer') as $item) {
|
||||
$tree->add($item, 'menu');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register package config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->mergeConfigFrom(
|
||||
dirname(__DIR__) . '/Config/menu.php', 'menu.customer'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -46,7 +46,8 @@ return [
|
|||
'not-subscribed' => 'You Cannot Be Subscribed To Subscription Emails, Try Again After Some time',
|
||||
'already' => 'You Are Already Subscribed To Our Subscription List',
|
||||
'unsubscribed' => 'You Are Unsubscribed From Bagisto Subscription Mails',
|
||||
'already-unsub' => 'You Are Already Unsubscribed'
|
||||
'already-unsub' => 'You Are Already Unsubscribed',
|
||||
'not-subscribed' => 'Error! Mail Cannot Be Sent Currently, Please Try Again Later'
|
||||
],
|
||||
|
||||
'search' => [
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<div class="form-container">
|
||||
<form action="{{ route('shop.subscribe') }}">
|
||||
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
|
||||
<input type="text" class="control subscribe-field" name="email" placeholder="Email Address" required><br/>
|
||||
<input type="email" class="control subscribe-field" name="email" placeholder="Email Address" required><br/>
|
||||
|
||||
<button class="btn btn-md btn-primary">{{ __('shop::app.subscription.subscribe') }}</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -1,98 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Ui;
|
||||
|
||||
use Illuminate\Support\Facades\HTML;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
class Menu {
|
||||
|
||||
public $items;
|
||||
public $current;
|
||||
public $currentKey;
|
||||
|
||||
public function __construct() {
|
||||
$this->current = Request::url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut method for create a menu with a callback.
|
||||
* This will allow you to do things like fire an event on creation.
|
||||
*
|
||||
* @param callable $callback Callback to use after the menu creation
|
||||
* @return object
|
||||
*/
|
||||
public static function create($callback) {
|
||||
$menu = new Menu();
|
||||
$callback($menu);
|
||||
$menu->sortItems($menu->items);
|
||||
|
||||
return $menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a menu item to the item stack
|
||||
*
|
||||
* @param string $key Dot seperated heirarchy
|
||||
* @param string $name Text for the anchor
|
||||
* @param string $route Route for the menu
|
||||
* @param integer $sort Sorting index for the items
|
||||
* @param string $iconClass Icon Class name
|
||||
*/
|
||||
public function add($key, $name, $route, $sort = 0, $iconClass = null)
|
||||
{
|
||||
$url = route($route);
|
||||
$item = [
|
||||
'key' => $key,
|
||||
'name' => $name,
|
||||
'url' => $url,
|
||||
'route' => $route,
|
||||
'sort' => $sort,
|
||||
'icon-class' => $iconClass,
|
||||
'children' => []
|
||||
];
|
||||
|
||||
if (strpos($this->current, $url) !== false) {
|
||||
$this->currentKey = $key;
|
||||
}
|
||||
|
||||
$children = str_replace('.', '.children.', $key);
|
||||
array_set($this->items, $children, $item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to sort through the menu items and put them in order
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sortItems($items) {
|
||||
if(!$items) {
|
||||
return;
|
||||
}
|
||||
usort($items, function($a, $b) {
|
||||
if ($a['sort'] == $b['sort']) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a['sort'] < $b['sort']) ? -1 : 1;
|
||||
});
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to find the active links
|
||||
*
|
||||
* @param array $item Item that needs to be checked if active
|
||||
* @return string
|
||||
*/
|
||||
public function getActive($item)
|
||||
{
|
||||
$url = trim($item['url'], '/');
|
||||
|
||||
if ((strpos($this->current, $url) !== false) || (strpos($this->currentKey, $item['key']) === 0)) {
|
||||
return 'active';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\User;
|
||||
|
||||
class ACLCreator {
|
||||
|
||||
public $items = [];
|
||||
|
||||
public $roles = [];
|
||||
|
||||
/**
|
||||
* Shortcut method for create a acl with a callback.
|
||||
* This will allow you to do things like fire an event on creation.
|
||||
*
|
||||
* @param callable $callback Callback to use after the acl creation
|
||||
* @return object
|
||||
*/
|
||||
public static function create($callback) {
|
||||
$acl = new ACLCreator();
|
||||
$callback($acl);
|
||||
$acl->items = $acl->sortItems($acl->items);
|
||||
|
||||
return $acl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a acl item to the item stack
|
||||
*
|
||||
* @param string $key Dot seperated heirarchy
|
||||
* @param string $name Text for the anchor
|
||||
* @param string $route Route for the acl
|
||||
* @param integer $sort Sorting index for the items
|
||||
*/
|
||||
public function add($key, $name, $route, $sort = 0)
|
||||
{
|
||||
$item = [
|
||||
'key' => $key,
|
||||
'name' => $name,
|
||||
'route' => $route,
|
||||
'sort' => $sort,
|
||||
'children' => []
|
||||
];
|
||||
|
||||
$children = str_replace('.', '.children.', $key);
|
||||
$this->array_set($this->items, $children, $item);
|
||||
|
||||
$this->roles[$route] = $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to sort through the acl items and put them in order
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sortItems($items) {
|
||||
foreach ($items as &$item) {
|
||||
if(count($item['children'])) {
|
||||
$item['children'] = $this->sortItems($item['children']);
|
||||
}
|
||||
}
|
||||
|
||||
usort($items, function($a, $b) {
|
||||
if ($a['sort'] == $b['sort']) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a['sort'] < $b['sort']) ? -1 : 1;
|
||||
});
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
public function array_set(&$array, $key, $value)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
return $array = $value;
|
||||
}
|
||||
|
||||
$keys = explode('.', $key);
|
||||
$count = count($keys);
|
||||
|
||||
while (count($keys) > 1) {
|
||||
$key = array_shift($keys);
|
||||
|
||||
if (! isset($array[$key]) || ! is_array($array[$key])) {
|
||||
$array[$key] = [];
|
||||
}
|
||||
|
||||
$array = &$array[$key];
|
||||
}
|
||||
|
||||
$finalKey = array_shift($keys);
|
||||
if(isset($array[$finalKey])) {
|
||||
$array[$finalKey] = $this->arrayMerge($array[$finalKey], $value);
|
||||
} else {
|
||||
$array[$finalKey] = $value;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
protected function arrayMerge(array &$array1, array &$array2)
|
||||
{
|
||||
$merged = $array1;
|
||||
foreach ($array2 as $key => &$value) {
|
||||
if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
|
||||
$merged[$key] = $this->arrayMerge($merged[$key], $value);
|
||||
} else {
|
||||
$merged[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $merged;
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Event;
|
|||
use Webkul\User\Bouncer;
|
||||
use Webkul\User\Facades\Bouncer as BouncerFacade;
|
||||
use Webkul\User\Http\Middleware\Bouncer as BouncerMiddleware;
|
||||
use Webkul\User\ACLCreator;
|
||||
use Webkul\Core\Tree;
|
||||
|
||||
class UserServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -37,7 +37,7 @@ class UserServiceProvider extends ServiceProvider
|
|||
public function createACL()
|
||||
{
|
||||
Event::listen('admin.acl.create', function () {
|
||||
return ACLCreator::create(function ($acl) {
|
||||
return Tree::create(function ($acl) {
|
||||
Event::fire('admin.acl.build', $acl);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue